@entrypulse/builder 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,209 @@
1
+ (function(ee,s){typeof exports=="object"&&typeof module<"u"?s(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],s):(ee=typeof globalThis<"u"?globalThis:ee||self,s(ee.EntryPulse={},ee.jsxRuntime,ee.React,ee.ReactDOM))})(this,(function(ee,s,C,bd){"use strict";var nT=Object.defineProperty;var aT=(ee,s,C)=>s in ee?nT(ee,s,{enumerable:!0,configurable:!0,writable:!0,value:C}):ee[s]=C;var Cl=(ee,s,C)=>aT(ee,typeof s!="symbol"?s+"":s,C);function yd(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const m=yd(C),Qn=yd(bd),vd=e=>{let t;const r=new Set,o=(d,p)=>{const u=typeof d=="function"?d(t):d;if(!Object.is(u,t)){const f=t;t=p??(typeof u!="object"||u===null)?u:Object.assign({},t,u),r.forEach(h=>h(t,f))}},n=()=>t,i={setState:o,getState:n,getInitialState:()=>c,subscribe:d=>(r.add(d),()=>r.delete(d))},c=t=e(o,n,i);return i},xv=(e=>e?vd(e):vd),wv=e=>e;function Sv(e,t=wv){const r=C.useSyncExternalStore(e.subscribe,C.useCallback(()=>t(e.getState()),[e,t]),C.useCallback(()=>t(e.getInitialState()),[e,t]));return C.useDebugValue(r),r}const xd=e=>{const t=xv(e),r=o=>Sv(t,o);return Object.assign(r,t),r},Cv=(e=>e?xd(e):xd);var wd=Symbol.for("immer-nothing"),Sd=Symbol.for("immer-draftable"),_t=Symbol.for("immer-state"),Nv=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Nt(e,...t){if(process.env.NODE_ENV!=="production"){const r=Nv[e],o=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ho=Object.getPrototypeOf;function mo(e){return!!e&&!!e[_t]}function jr(e){var t;return e?Nd(e)||Array.isArray(e)||!!e[Sd]||!!((t=e.constructor)!=null&&t[Sd])||jo(e)||Jn(e):!1}var Ev=Object.prototype.constructor.toString(),Cd=new WeakMap;function Nd(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let o=Cd.get(r);return o===void 0&&(o=Function.toString.call(r),Cd.set(r,o)),o===Ev}function Kn(e,t,r=!0){Xn(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((o,n)=>t(n,o,e))}function Xn(e){const t=e[_t];return t?t.type_:Array.isArray(e)?1:jo(e)?2:Jn(e)?3:0}function Nl(e,t){return Xn(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ed(e,t,r){const o=Xn(e);o===2?e.set(t,r):o===3?e.add(r):e[t]=r}function kv(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function jo(e){return e instanceof Map}function Jn(e){return e instanceof Set}function Yr(e){return e.copy_||e.base_}function El(e,t){if(jo(e))return new Map(e);if(Jn(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Nd(e);if(t===!0||t==="class_only"&&!r){const o=Object.getOwnPropertyDescriptors(e);delete o[_t];let n=Reflect.ownKeys(o);for(let a=0;a<n.length;a++){const l=n[a],i=o[l];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(o[l]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[l]})}return Object.create(Ho(e),o)}else{const o=Ho(e);if(o!==null&&r)return{...e};const n=Object.create(o);return Object.assign(n,e)}}function kl(e,t=!1){return Rn(e)||mo(e)||!jr(e)||(Xn(e)>1&&Object.defineProperties(e,{set:Zn,add:Zn,clear:Zn,delete:Zn}),Object.freeze(e),t&&Object.values(e).forEach(r=>kl(r,!0))),e}function _v(){Nt(2)}var Zn={value:_v};function Rn(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Dv={};function qr(e){const t=Dv[e];return t||Nt(0,e),t}var Yo;function kd(){return Yo}function Av(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function _d(e,t){t&&(qr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function _l(e){Dl(e),e.drafts_.forEach(Tv),e.drafts_=null}function Dl(e){e===Yo&&(Yo=e.parent_)}function Dd(e){return Yo=Av(Yo,e)}function Tv(e){const t=e[_t];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ad(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[_t].modified_&&(_l(t),Nt(4)),jr(e)&&(e=ea(t,e),t.parent_||ta(t,e)),t.patches_&&qr("Patches").generateReplacementPatches_(r[_t].base_,e,t.patches_,t.inversePatches_)):e=ea(t,r,[]),_l(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==wd?e:void 0}function ea(e,t,r){if(Rn(t))return t;const o=e.immer_.shouldUseStrictIteration(),n=t[_t];if(!n)return Kn(t,(a,l)=>Td(e,n,t,a,l,r),o),t;if(n.scope_!==e)return t;if(!n.modified_)return ta(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const a=n.copy_;let l=a,i=!1;n.type_===3&&(l=new Set(a),a.clear(),i=!0),Kn(l,(c,d)=>Td(e,n,a,c,d,r,i),o),ta(e,a,!1),r&&e.patches_&&qr("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function Td(e,t,r,o,n,a,l){if(n==null||typeof n!="object"&&!l)return;const i=Rn(n);if(!(i&&!l)){if(process.env.NODE_ENV!=="production"&&n===r&&Nt(5),mo(n)){const c=a&&t&&t.type_!==3&&!Nl(t.assigned_,o)?a.concat(o):void 0,d=ea(e,n,c);if(Ed(r,o,d),mo(d))e.canAutoFreeze_=!1;else return}else l&&r.add(n);if(jr(n)&&!i){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[o]===n&&i)return;ea(e,n),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&(jo(r)?r.has(o):Object.prototype.propertyIsEnumerable.call(r,o))&&ta(e,n)}}}function ta(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&kl(t,r)}function Mv(e,t){const r=Array.isArray(e),o={type_:r?1:0,scope_:t?t.scope_:kd(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=o,a=Al;r&&(n=[o],a=qo);const{revoke:l,proxy:i}=Proxy.revocable(n,a);return o.draft_=i,o.revoke_=l,i}var Al={get(e,t){if(t===_t)return e;const r=Yr(e);if(!Nl(r,t))return Iv(e,r,t);const o=r[t];return e.finalized_||!jr(o)?o:o===Tl(e.base_,t)?(Il(e),e.copy_[t]=Pl(o,e)):o},has(e,t){return t in Yr(e)},ownKeys(e){return Reflect.ownKeys(Yr(e))},set(e,t,r){const o=Md(Yr(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const n=Tl(Yr(e),t),a=n==null?void 0:n[_t];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(kv(r,n)&&(r!==void 0||Nl(e.base_,t)))return!0;Il(e),Ml(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Tl(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Il(e),Ml(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Yr(e),o=Reflect.getOwnPropertyDescriptor(r,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:r[t]}},defineProperty(){Nt(11)},getPrototypeOf(e){return Ho(e.base_)},setPrototypeOf(){Nt(12)}},qo={};Kn(Al,(e,t)=>{qo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),qo.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Nt(13),qo.set.call(this,e,t,void 0)},qo.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Nt(14),Al.set.call(this,e[0],t,r,e[0])};function Tl(e,t){const r=e[_t];return(r?Yr(r):e)[t]}function Iv(e,t,r){var n;const o=Md(t,r);return o?"value"in o?o.value:(n=o.get)==null?void 0:n.call(e.draft_):void 0}function Md(e,t){if(!(t in e))return;let r=Ho(e);for(;r;){const o=Object.getOwnPropertyDescriptor(r,t);if(o)return o;r=Ho(r)}}function Ml(e){e.modified_||(e.modified_=!0,e.parent_&&Ml(e.parent_))}function Il(e){e.copy_||(e.copy_=El(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Pv=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(r,o,n)=>{if(typeof r=="function"&&typeof o!="function"){const l=o;o=r;const i=this;return function(d=l,...p){return i.produce(d,u=>o.call(this,u,...p))}}typeof o!="function"&&Nt(6),n!==void 0&&typeof n!="function"&&Nt(7);let a;if(jr(r)){const l=Dd(this),i=Pl(r,void 0);let c=!0;try{a=o(i),c=!1}finally{c?_l(l):Dl(l)}return _d(l,n),Ad(a,l)}else if(!r||typeof r!="object"){if(a=o(r),a===void 0&&(a=r),a===wd&&(a=void 0),this.autoFreeze_&&kl(a,!0),n){const l=[],i=[];qr("Patches").generateReplacementPatches_(r,a,l,i),n(l,i)}return a}else Nt(1,r)},this.produceWithPatches=(r,o)=>{if(typeof r=="function")return(i,...c)=>this.produceWithPatches(i,d=>r(d,...c));let n,a;return[this.produce(r,o,(i,c)=>{n=i,a=c}),n,a]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),typeof(t==null?void 0:t.useStrictIteration)=="boolean"&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){jr(t)||Nt(8),mo(t)&&(t=Ov(t));const r=Dd(this),o=Pl(t,void 0);return o[_t].isManual_=!0,Dl(r),o}finishDraft(t,r){const o=t&&t[_t];(!o||!o.isManual_)&&Nt(9);const{scope_:n}=o;return _d(n,r),Ad(void 0,n)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let o;for(o=r.length-1;o>=0;o--){const a=r[o];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}o>-1&&(r=r.slice(o+1));const n=qr("Patches").applyPatches_;return mo(t)?n(t,r):this.produce(t,a=>n(a,r))}};function Pl(e,t){const r=jo(e)?qr("MapSet").proxyMap_(e,t):Jn(e)?qr("MapSet").proxySet_(e,t):Mv(e,t);return(t?t.scope_:kd()).drafts_.push(r),r}function Ov(e){return mo(e)||Nt(10,e),Id(e)}function Id(e){if(!jr(e)||Rn(e))return e;const t=e[_t];let r,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=El(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else r=El(e,!0);return Kn(r,(n,a)=>{Ed(r,n,Id(a))},o),t&&(t.finalized_=!1),r}var $v=new Pv,Lv=$v.produce;const Fv=e=>(t,r,o)=>(o.setState=(n,a,...l)=>{const i=typeof n=="function"?Lv(n):n;return t(i,a,...l)},e(o.setState,r,o));function ra(){const e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}function Ol(e){if(!e)return"";const t=e.trim().replace(/[^a-zA-Z0-9\s]/g,"").split(/\s+/).filter(Boolean);return t.length===0?"":t.map((r,o)=>{const n=r.toLowerCase();return o===0?n:n.charAt(0).toUpperCase()+n.slice(1)}).join("")}function Pd(e,t){const r=t instanceof Set?t:new Set(t),o=Ol(e.replace(/([A-Z])/g," $1").trim())||"field";if(!r.has(o))return o;let n=1,a=`${o}${n}`;for(;r.has(a);)n++,a=`${o}${n}`;return a}function $l(e){return new Set(e.map(t=>t.attributes.name).filter(Boolean))}const Gv={shortText:{label:"Short Text",placeholder:"Enter text..."},longText:{label:"Long Text",placeholder:"Enter your text here..."},multiLineInput:{label:"Multi-line Input",placeholder:"Enter your text..."},textEditor:{label:"Text Editor",placeholder:"Start typing..."},number:{label:"Number",placeholder:"Enter a number..."},slider:{label:"Slider",description:"Slide to select a value"},rangeSlider:{label:"Range Slider",description:"Select a range"},email:{label:"Email",placeholder:"Enter your email..."},phone:{label:"Phone",placeholder:"Enter your phone number..."},url:{label:"URL",placeholder:"https://example.com"},location:{label:"Location",placeholder:"Enter address...",description:"Enter your address"},password:{label:"Password",placeholder:"Enter your password..."},signature:{label:"Signature",description:"Draw your signature below"},captcha:{label:"Verification",description:"Please verify you are human"},singleChoice:{label:"Single Choice",description:"Select one option"},multipleChoice:{label:"Multiple Choice",description:"Select all that apply"},dropdown:{label:"Dropdown",placeholder:"Select an option..."},tags:{label:"Tags",placeholder:"Type and press enter...",description:"Add tags"},decisionBox:{label:"I agree to the terms and conditions"},toggleSwitch:{label:"Toggle Switch",description:"Turn on or off"},singleChoiceMatrix:{label:"Single Choice Matrix",description:"Select one option per row"},multipleChoiceMatrix:{label:"Multiple Choice Matrix",description:"Select options per row"},matrixTable:{label:"Matrix Table",description:"Fill in the table"},date:{label:"Date",placeholder:"Select a date..."},time:{label:"Time",placeholder:"Select a time..."},dateTime:{label:"Date & Time",placeholder:"Select date and time..."},multipleDates:{label:"Multiple Dates",placeholder:"Select dates...",description:"Select multiple dates"},dateRange:{label:"Date Range",placeholder:"Select date range...",description:"Select start and end dates"},fileUpload:{label:"File Upload",description:"Upload a file"},imageUpload:{label:"Image Upload",description:"Upload an image"},multiFileUpload:{label:"Multi-File Upload",description:"Upload multiple files"},multiImageUpload:{label:"Multi-Image Upload",description:"Upload multiple images"},paragraph:{label:"Paragraph",content:"Enter your paragraph text here. You can use this to provide instructions or additional information."},image:{label:"Image",alt:"Image description",src:""},link:{label:"Link",href:"https://example.com",content:"Click here",target:"_blank"},formHeading:{label:"Form Title",description:"Form description goes here"},sectionHeading:{label:"Section Title"},subheading:{label:"Subheading"},divider:{},spacer:{},group:{label:"Group",description:"Group description"},grid:{label:"Grid Layout"},table:{label:"Table"},repeatElement:{label:"Repeat Element",description:"Add more items"},repeatGroup:{label:"Repeat Group",description:"Add more groups"},pages:{label:"Form Pages"},submit:{label:"Submit"}},Vv={shortText:{labelPosition:"top",size:"default"},longText:{labelPosition:"top",size:"default"},multiLineInput:{labelPosition:"top",size:"default"},textEditor:{labelPosition:"top",size:"large"},number:{labelPosition:"top",size:"default"},slider:{labelPosition:"top",size:"default"},rangeSlider:{labelPosition:"top",size:"default"},email:{labelPosition:"top",size:"default"},phone:{labelPosition:"top",size:"default"},url:{labelPosition:"top",size:"default"},location:{labelPosition:"top",size:"large"},password:{labelPosition:"top",size:"default"},signature:{labelPosition:"top",size:"large"},captcha:{labelPosition:"hidden",size:"default"},singleChoice:{labelPosition:"top",size:"default"},multipleChoice:{labelPosition:"top",size:"default"},dropdown:{labelPosition:"top",size:"default"},tags:{labelPosition:"top",size:"default"},decisionBox:{labelPosition:"hidden",size:"default"},toggleSwitch:{labelPosition:"left",size:"default"},singleChoiceMatrix:{labelPosition:"top",size:"full"},multipleChoiceMatrix:{labelPosition:"top",size:"full"},matrixTable:{labelPosition:"top",size:"full"},date:{labelPosition:"top",size:"default"},time:{labelPosition:"top",size:"small"},dateTime:{labelPosition:"top",size:"default"},multipleDates:{labelPosition:"top",size:"default"},dateRange:{labelPosition:"top",size:"default"},fileUpload:{labelPosition:"top",size:"default"},imageUpload:{labelPosition:"top",size:"default"},multiFileUpload:{labelPosition:"top",size:"large"},multiImageUpload:{labelPosition:"top",size:"large"},paragraph:{labelPosition:"hidden",size:"default"},image:{labelPosition:"hidden",size:"default"},link:{labelPosition:"hidden",size:"default"},formHeading:{size:"large"},sectionHeading:{size:"medium"},subheading:{size:"small"},divider:{size:"default"},spacer:{size:"default",height:24},group:{size:"default"},grid:{size:"full",columns:2,gap:16},table:{size:"full"},repeatElement:{size:"default"},repeatGroup:{size:"full"},pages:{size:"full"},submit:{size:"default"}},Od={shortText:{maxLength:255},longText:{maxLength:5e3},multiLineInput:{maxLength:5e3},textEditor:{maxLength:5e4},number:{},slider:{},rangeSlider:{},email:{},phone:{},url:{},location:{},password:{minLength:8},singleChoice:{},multipleChoice:{},dropdown:{},tags:{},decisionBox:{},singleChoiceMatrix:{},multipleChoiceMatrix:{},date:{},time:{},dateTime:{},multipleDates:{},dateRange:{},fileUpload:{},imageUpload:{},multiFileUpload:{maxFiles:10},multiImageUpload:{maxFiles:10}},$d={longText:{rows:3,autoResize:!1},multiLineInput:{minRows:2,maxRows:10,autoResize:!0},textEditor:{toolbar:["bold","italic","underline","link"],height:200,allowImages:!1,allowLinks:!0},number:{step:1,decimals:0,thousandsSeparator:!1},slider:{min:0,max:100,step:1,showValue:!0,showMarks:!1},rangeSlider:{min:0,max:100,step:1,showValue:!0,minRange:0},phone:{defaultCountry:"US",format:"international"},location:{enableGeolocation:!1,showMap:!1},password:{showStrengthMeter:!0,showToggle:!0,minStrength:"medium"},signature:{strokeWidth:2,strokeColor:"#000000",backgroundColor:"#ffffff",canvasWidth:400,canvasHeight:200},captcha:{provider:"recaptcha",theme:"light"},singleChoice:{options:[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"},{label:"Option 3",value:"option3"}],allowOther:!1},multipleChoice:{options:[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"},{label:"Option 3",value:"option3"}],allowOther:!1},dropdown:{options:[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"},{label:"Option 3",value:"option3"}],allowOther:!1},tags:{options:[{label:"Tag 1",value:"tag1"},{label:"Tag 2",value:"tag2"},{label:"Tag 3",value:"tag3"}],maxTags:10,allowCustomTags:!0},decisionBox:{checkedLabel:"Yes",uncheckedLabel:"No"},toggleSwitch:{onLabel:"On",offLabel:"Off"},singleChoiceMatrix:{matrixRows:[{id:"row1",label:"Row 1"},{id:"row2",label:"Row 2"},{id:"row3",label:"Row 3"}],matrixColumns:[{id:"col1",label:"Column 1"},{id:"col2",label:"Column 2"},{id:"col3",label:"Column 3"}]},multipleChoiceMatrix:{matrixRows:[{id:"row1",label:"Row 1"},{id:"row2",label:"Row 2"},{id:"row3",label:"Row 3"}],matrixColumns:[{id:"col1",label:"Column 1"},{id:"col2",label:"Column 2"},{id:"col3",label:"Column 3"}],allowMultiplePerRow:!0},matrixTable:{matrixRows:[{id:"row1",label:"Row 1"},{id:"row2",label:"Row 2"}],matrixColumns:[{id:"col1",label:"Text",type:"text"},{id:"col2",label:"Number",type:"number"}]},date:{format:"YYYY-MM-DD",showCalendar:!0},time:{timeFormat:"12h",timeInterval:15},dateTime:{format:"YYYY-MM-DD",timeFormat:"12h",timeInterval:15},multipleDates:{format:"YYYY-MM-DD",showCalendar:!0},dateRange:{format:"YYYY-MM-DD",showCalendar:!0,minDays:1},fileUpload:{accept:"*/*",maxSize:10485760,multiple:!1},imageUpload:{accept:"image/*",maxSize:5242880,multiple:!1,allowCrop:!1},multiFileUpload:{accept:"*/*",maxSize:10485760,multiple:!0,maxFiles:10},multiImageUpload:{accept:"image/*",maxSize:5242880,multiple:!0,maxFiles:10,allowCrop:!1},paragraph:{textAlign:"left",fontSize:"medium",fontWeight:"normal"},image:{imageWidth:"100%",objectFit:"contain",borderRadius:0},link:{linkStyle:"text"},formHeading:{level:1,alignment:"left"},sectionHeading:{level:2,alignment:"left"},subheading:{level:3,alignment:"left"},divider:{style:"solid",thickness:1,color:"#e5e7eb"},spacer:{spacerHeight:24},group:{collapsed:!1,collapsible:!1,showBorder:!0,padding:16},grid:{gridColumns:2,gridGap:16,responsiveColumns:{sm:1,md:2,lg:2}},table:{tableColumns:[{id:"col1",header:"Column 1",align:"left"},{id:"col2",header:"Column 2",align:"left"}],showHeader:!0,striped:!0,bordered:!0},repeatElement:{minItems:1,maxItems:10,addButtonText:"Add Item",removeButtonText:"Remove",showItemNumber:!0},repeatGroup:{minItems:1,maxItems:10,addButtonText:"Add Group",removeButtonText:"Remove",itemLabel:"Item",showItemNumber:!0},pages:{showProgressBar:!0,showStepNumbers:!0,allowSkip:!1,validateOnNext:!0,activeStepId:"step1",steps:[{id:"step1",label:"Step 1",description:""},{id:"step2",label:"Step 2",description:""}]},submit:{buttonText:"Submit",buttonStyle:"primary",buttonSize:"medium",showIcon:!1,loadingText:"Submitting..."}},zv={shortText:"string",longText:"string",multiLineInput:"string",textEditor:"string",number:"number",slider:"number",rangeSlider:"object",email:"string",phone:"string",url:"string",location:"object",password:"string",signature:"string",captcha:"string",singleChoice:"string",multipleChoice:"array",dropdown:"string",tags:"array",decisionBox:"boolean",toggleSwitch:"boolean",singleChoiceMatrix:"object",multipleChoiceMatrix:"object",matrixTable:"object",date:"date",time:"string",dateTime:"date",multipleDates:"array",dateRange:"object",fileUpload:"object",imageUpload:"object",multiFileUpload:"array",multiImageUpload:"array",paragraph:"string",image:"string",link:"string",formHeading:"string",sectionHeading:"string",subheading:"string",divider:"string",spacer:"string",group:"object",grid:"object",table:"object",repeatElement:"array",repeatGroup:"array",pages:"object",submit:"string"};function Ld(e,t,r){const o=Pd(e,t),n={id:ra(),type:e,order:r,properties:{...Gv[e]},layout:{...Vv[e]},attributes:{name:o,dataType:zv[e]}};return Od[e]&&(n.validation={...Od[e]}),$d[e]&&(n.config=JSON.parse(JSON.stringify($d[e]))),n}function Fd(){return{id:`form-${ra()}`,version:"1.0.0",title:"Untitled Form",description:"",metadata:{createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},settings:{showProgressBar:!1,allowSaveDraft:!1,submitButtonText:"Submit",successMessage:"Thank you for your submission!",submitAction:"message"},elements:[]}}function Bv(e,t){const r=JSON.parse(JSON.stringify(e));return r.id=ra(),r.attributes.name=Pd(e.type,t),r}function Ll(e){return["paragraph","image","link","formHeading","sectionHeading","subheading","divider","spacer"].includes(e)}function Uv(e){const t=["paragraph","image","link","formHeading","sectionHeading","subheading","divider","spacer","captcha"],r=["singleChoice","dropdown","decisionBox","toggleSwitch","signature","captcha",...t],o=["number","slider","rangeSlider","date","time","dateTime","multipleDates","dateRange","fileUpload","imageUpload","multiFileUpload","multiImageUpload","singleChoice","multipleChoice","dropdown","decisionBox","toggleSwitch","signature","captcha","singleChoiceMatrix","multipleChoiceMatrix","matrixTable",...t];return{supportsRequired:!t.includes(e),supportsMinMax:!r.includes(e),supportsPattern:!o.includes(e)}}const Wv=50;function Gt(e,t){const r=e.history.slice(0,e.historyIndex+1);r.push(JSON.parse(JSON.stringify(t))),r.length>Wv&&r.shift(),e.history=r,e.historyIndex=r.length-1,e.schema=t}const Gd=Fd(),Hv={schema:Gd,selectedElementId:null,mode:"design",history:[JSON.parse(JSON.stringify(Gd))],historyIndex:0,hoveredElementId:null,draggedElementType:null},J=Cv()(Fv((e,t)=>({...Hv,addElement:(r,o)=>{e(n=>{var p;const a=n.schema.elements.some(u=>u.type==="pages");if(r==="pages"&&a){console.warn("Only one wizard can be added to the form");return}if(a&&r!=="pages"){console.warn("When a wizard exists, elements must be added inside wizard steps");return}const l=$l(n.schema.elements),i=o??n.schema.elements.length,c=Ld(r,l,i);(r==="group"||r==="grid"||r==="repeatGroup"||r==="pages")&&(c.children=[]);const d={...n.schema};o!==void 0?d.elements=[...n.schema.elements.slice(0,o),c,...n.schema.elements.slice(o).map(u=>({...u,order:u.order+1}))]:d.elements=[...n.schema.elements,c],d.metadata={...d.metadata,updatedAt:new Date().toISOString(),createdAt:((p=d.metadata)==null?void 0:p.createdAt)||new Date().toISOString()},Gt(n,d),n.selectedElementId=c.id})},addElementToContainer:(r,o,n)=>{e(a=>{var f;if(r==="pages"){console.warn("Wizard cannot be added inside a container");return}if(a.schema.elements.findIndex(h=>h.id===o)===-1)return;const i=$l(a.schema.elements),d=a.schema.elements.filter(h=>n?h.parentId===`${o}:${n}`:h.parentId===o).length,p=Ld(r,i,d);n?p.parentId=`${o}:${n}`:p.parentId=o,(r==="group"||r==="grid"||r==="repeatGroup")&&(p.children=[]);const u={...a.schema};u.elements=a.schema.elements.map(h=>h.id===o?{...h,children:[...h.children||[],p.id]}:h),u.elements=[...u.elements,p],u.metadata={...u.metadata,updatedAt:new Date().toISOString(),createdAt:((f=u.metadata)==null?void 0:f.createdAt)||new Date().toISOString()},Gt(a,u),a.selectedElementId=p.id})},updateElement:(r,o)=>{e(n=>{var i;if(n.schema.elements.findIndex(c=>c.id===r)===-1)return;const l={...n.schema};l.elements=n.schema.elements.map(c=>c.id===r?{...c,...o}:c),l.metadata={...l.metadata,updatedAt:new Date().toISOString(),createdAt:((i=l.metadata)==null?void 0:i.createdAt)||new Date().toISOString()},Gt(n,l)})},deleteElement:r=>{e(o=>{var c;const n=o.schema.elements.find(d=>d.id===r);if(!n)return;const a=new Set([r]),l=d=>{o.schema.elements.forEach(p=>{var u;(p.parentId===d||(u=p.parentId)!=null&&u.startsWith(`${d}:`))&&(a.add(p.id),l(p.id))})};l(r);const i={...o.schema};if(n.parentId){const d=n.parentId.split(":")[0];i.elements=o.schema.elements.map(p=>p.id===d&&p.children?{...p,children:p.children.filter(u=>u!==r)}:p)}i.elements=i.elements.filter(d=>!a.has(d.id)).map((d,p)=>d.parentId?d:{...d,order:p}),i.metadata={...i.metadata,updatedAt:new Date().toISOString(),createdAt:((c=i.metadata)==null?void 0:c.createdAt)||new Date().toISOString()},Gt(o,i),(o.selectedElementId===r||a.has(o.selectedElementId||""))&&(o.selectedElementId=null)})},duplicateElement:r=>{e(o=>{var d;const n=o.schema.elements.find(p=>p.id===r);if(!n)return;const a=$l(o.schema.elements),l=Bv(n,a);l.order=n.order+1;const i={...o.schema},c=n.order+1;i.elements=[...o.schema.elements.slice(0,c),l,...o.schema.elements.slice(c).map(p=>({...p,order:p.order+1}))],i.metadata={...i.metadata,updatedAt:new Date().toISOString(),createdAt:((d=i.metadata)==null?void 0:d.createdAt)||new Date().toISOString()},Gt(o,i),o.selectedElementId=l.id})},moveElement:(r,o)=>{e(n=>{var d;const a=n.schema.elements.findIndex(p=>p.id===r);if(a===-1||a===o)return;const l=[...n.schema.elements],[i]=l.splice(a,1);l.splice(o,0,i),l.forEach((p,u)=>{p.order=u});const c={...n.schema,elements:l,metadata:{...n.schema.metadata,updatedAt:new Date().toISOString(),createdAt:((d=n.schema.metadata)==null?void 0:d.createdAt)||new Date().toISOString()}};Gt(n,c)})},reorderElements:(r,o)=>{e(n=>{var c;if(r===o)return;const a=[...n.schema.elements],[l]=a.splice(r,1);a.splice(o,0,l),a.forEach((d,p)=>{d.order=p});const i={...n.schema,elements:a,metadata:{...n.schema.metadata,updatedAt:new Date().toISOString(),createdAt:((c=n.schema.metadata)==null?void 0:c.createdAt)||new Date().toISOString()}};Gt(n,i)})},selectElement:r=>{e(o=>{o.selectedElementId=r})},undo:()=>{e(r=>{r.historyIndex>0&&(r.historyIndex-=1,r.schema=JSON.parse(JSON.stringify(r.history[r.historyIndex])),r.selectedElementId=null)})},redo:()=>{e(r=>{r.historyIndex<r.history.length-1&&(r.historyIndex+=1,r.schema=JSON.parse(JSON.stringify(r.history[r.historyIndex])),r.selectedElementId=null)})},canUndo:()=>t().historyIndex>0,canRedo:()=>{const r=t();return r.historyIndex<r.history.length-1},setMode:r=>{e(o=>{o.mode=r})},loadSchema:r=>{e(o=>{o.schema=r,o.history=[JSON.parse(JSON.stringify(r))],o.historyIndex=0,o.selectedElementId=null})},exportSchema:()=>JSON.parse(JSON.stringify(t().schema)),resetForm:()=>{e(r=>{const o=Fd();r.schema=o,r.history=[JSON.parse(JSON.stringify(o))],r.historyIndex=0,r.selectedElementId=null})},updateFormTitle:r=>{e(o=>{var a;const n={...o.schema,title:r,metadata:{...o.schema.metadata,updatedAt:new Date().toISOString(),createdAt:((a=o.schema.metadata)==null?void 0:a.createdAt)||new Date().toISOString()}};Gt(o,n)})},updateFormDescription:r=>{e(o=>{var a;const n={...o.schema,description:r,metadata:{...o.schema.metadata,updatedAt:new Date().toISOString(),createdAt:((a=o.schema.metadata)==null?void 0:a.createdAt)||new Date().toISOString()}};Gt(o,n)})},setHoveredElementId:r=>{e(o=>{o.hoveredElementId=r})},setDraggedElementType:r=>{e(o=>{o.draggedElementType=r})},hasWizard:()=>t().schema.elements.some(r=>r.type==="pages"),addWizardStep:(r,o)=>{e(n=>{var l;const a={...n.schema};a.elements=n.schema.elements.map(i=>{var c,d;if(i.id===r&&i.type==="pages"){const p=((c=i.config)==null?void 0:c.steps)||[];return{...i,config:{...i.config,steps:[...p,o],activeStepId:((d=i.config)==null?void 0:d.activeStepId)||o.id}}}return i}),a.metadata={...a.metadata,updatedAt:new Date().toISOString(),createdAt:((l=a.metadata)==null?void 0:l.createdAt)||new Date().toISOString()},Gt(n,a)})},updateWizardStep:(r,o,n)=>{e(a=>{var i;const l={...a.schema};l.elements=a.schema.elements.map(c=>{var d;if(c.id===r&&c.type==="pages"){const p=(((d=c.config)==null?void 0:d.steps)||[]).map(u=>u.id===o?{...u,...n}:u);return{...c,config:{...c.config,steps:p}}}return c}),l.metadata={...l.metadata,updatedAt:new Date().toISOString(),createdAt:((i=l.metadata)==null?void 0:i.createdAt)||new Date().toISOString()},Gt(a,l)})},removeWizardStep:(r,o)=>{e(n=>{var u,f;const a=n.schema.elements.find(h=>h.id===r);if(!a||a.type!=="pages")return;const l=((u=a.config)==null?void 0:u.steps)||[];if(l.length<=1){console.warn("Wizard must have at least one step");return}const i=`${r}:${o}`,c=new Set,d=h=>{n.schema.elements.forEach(b=>{var g;(b.parentId===h||(g=b.parentId)!=null&&g.startsWith(`${h}:`))&&(c.add(b.id),d(b.id))})};d(i);const p={...n.schema};p.elements=n.schema.elements.map(h=>{var b,g,y;if(h.id===r){const x=l.filter(w=>w.id!==o),v=((b=h.config)==null?void 0:b.activeStepId)===o?(g=x[0])==null?void 0:g.id:(y=h.config)==null?void 0:y.activeStepId;return{...h,config:{...h.config,steps:x,activeStepId:v},children:(h.children||[]).filter(w=>!c.has(w))}}return h}),p.elements=p.elements.filter(h=>!c.has(h.id)),p.metadata={...p.metadata,updatedAt:new Date().toISOString(),createdAt:((f=p.metadata)==null?void 0:f.createdAt)||new Date().toISOString()},Gt(n,p)})},setActiveWizardStep:(r,o)=>{e(n=>{const a={...n.schema};a.elements=n.schema.elements.map(l=>l.id===r&&l.type==="pages"?{...l,config:{...l.config,activeStepId:o}}:l),n.schema=a})},getContainerChildren:(r,o)=>{const n=t(),a=o?`${r}:${o}`:r;return n.schema.elements.filter(l=>l.parentId===a).sort((l,i)=>l.order-i.order)},validateSchema:()=>{const r=t(),o=[],n=r.schema.elements.map(l=>l.attributes.name),a=n.filter((l,i)=>n.indexOf(l)!==i);return a.length>0&&a.forEach(l=>{o.push({type:"error",message:`Duplicate field name: "${l}"`})}),r.schema.elements.forEach(l=>{(!l.attributes.name||l.attributes.name.trim()==="")&&o.push({type:"error",elementId:l.id,message:`Element "${l.properties.label||l.type}" has no field name`})}),r.schema.elements.forEach(l=>{var i;(i=l.validation)!=null&&i.required&&(!l.properties.label||l.properties.label.trim()==="")&&o.push({type:"warning",elementId:l.id,message:"Required element has no label"})}),{valid:o.filter(l=>l.type==="error").length===0,errors:o}}})));function jv(){const e=t=>{const o=navigator.platform.toUpperCase().indexOf("MAC")>=0?t.metaKey:t.ctrlKey;o&&t.key==="z"&&!t.shiftKey?(t.preventDefault(),J.getState().undo()):(o&&t.shiftKey&&t.key==="z"||o&&t.key==="y")&&(t.preventDefault(),J.getState().redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}const Yv=()=>{const e=J(r=>r.selectedElementId);return J(r=>r.schema.elements).find(r=>r.id===e)};class qv{constructor(){Cl(this,"elements",new Map);Cl(this,"customGroups",new Map)}register(t,r={}){const{override:o=!1,group:n}=r;if(this.elements.has(t.type)&&!o){console.warn(`Element type "${t.type}" is already registered. Use { override: true } to replace it.`);return}if(!t.type)throw new Error("Element definition must have a type");if(!t.renderOnCanvas)throw new Error(`Element "${t.type}" must have a renderOnCanvas function`);if(!t.render)throw new Error(`Element "${t.type}" must have a render function`);if(!t.getDefaultValues)throw new Error(`Element "${t.type}" must have a getDefaultValues function`);if(this.elements.set(t.type,t),n){const a=this.customGroups.get(n);a?a.elements.push(t):this.customGroups.set(n,{id:n,label:n,elements:[t]})}}get(t){return this.elements.get(t)}has(t){return this.elements.has(t)}getAll(){return Array.from(this.elements.values())}getByCategory(t){return this.getAll().filter(r=>r.category===t)}getByStructure(t){return this.getAll().filter(r=>r.structure===t)}getByTypeCategory(t){return this.getAll().filter(r=>r.typeCategory===t)}getGroups(){const t=[],r={textInput:{label:"Text Input",order:1},numeric:{label:"Numeric",order:2},contact:{label:"Contact",order:3},security:{label:"Security",order:4},selection:{label:"Selection",order:5},matrix:{label:"Matrix",order:6},dateTime:{label:"Date & Time",order:7},fileUpload:{label:"File Upload",order:8},display:{label:"Display",order:9}},o={heading:{label:"Headings",order:10},layout:{label:"Layout",order:11},repeatable:{label:"Repeatable",order:12},special:{label:"Special",order:13}};for(const[n,a]of Object.entries(r)){const l=this.getAll().filter(i=>i.category==="field"&&i.subCategory===n);l.length>0&&t.push({id:n,label:a.label,elements:l,order:a.order})}for(const[n,a]of Object.entries(o)){const l=this.getAll().filter(i=>i.category==="page"&&i.subCategory===n);l.length>0&&t.push({id:n,label:a.label,elements:l,order:a.order})}for(const n of this.customGroups.values())t.push({...n,order:n.order??100});return t.sort((n,a)=>(n.order??0)-(a.order??0))}unregister(t){if(!this.elements.has(t))return!1;this.elements.delete(t);for(const r of this.customGroups.values()){const o=r.elements.findIndex(n=>n.type===t);o!==-1&&r.elements.splice(o,1)}return!0}clear(){this.elements.clear(),this.customGroups.clear()}getIcon(t){const r=this.get(t);return r==null?void 0:r.icon}getLabel(t){const r=this.get(t);return r==null?void 0:r.label}isContainer(t){const r=this.get(t);return(r==null?void 0:r.isContainer)??!1}supportsValidation(t){const r=this.get(t);return(r==null?void 0:r.supportsValidation)??!0}supportsOptions(t){const r=this.get(t);return(r==null?void 0:r.supportsOptions)??!1}getDefaultValues(t){const r=this.get(t);return r?r.getDefaultValues():{properties:{},layout:{},validation:{},config:{}}}}const Ke=new qv;function Qv(e,t){Ke.register(e,t)}function Kv(e,t){for(const r of e)Ke.register(r,t)}function Xv(e){return Ke.unregister(e)}function Jv(e){return Ke.get(e)}function Zv(e){return Ke.has(e)}const oa=({label:e,required:t,htmlFor:r,className:o=""})=>e?s.jsxs("label",{htmlFor:r,className:`block text-sm font-medium text-gray-700 ${o}`,children:[e,t&&s.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}):null,na=({description:e,className:t=""})=>e?s.jsx("p",{className:`text-xs text-gray-500 ${t}`,children:e}):null,Qo=({errors:e,className:t=""})=>!e||e.length===0?null:s.jsx("div",{className:`space-y-1 ${t}`,children:e.map((r,o)=>s.jsx("p",{className:"text-xs text-red-500",children:r},o))}),Rv=({label:e,description:t,required:r,errors:o,children:n})=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(oa,{label:e,required:r}),s.jsx(na,{description:t}),n,s.jsx(Qo,{errors:o})]}),ne=({label:e,description:t,required:r,errors:o,labelPosition:n="top",className:a="",children:l})=>n==="hidden"?s.jsxs("div",{className:`space-y-1.5 ${a}`,children:[l,s.jsx(Qo,{errors:o})]}):n==="left"?s.jsxs("div",{className:`flex items-start gap-4 ${a}`,children:[s.jsxs("div",{className:"w-1/3 pt-2",children:[s.jsx(oa,{label:e,required:r}),s.jsx(na,{description:t})]}),s.jsxs("div",{className:"flex-1 space-y-1.5",children:[l,s.jsx(Qo,{errors:o})]})]}):s.jsxs("div",{className:`space-y-1.5 ${a}`,children:[s.jsx(oa,{label:e,required:r}),s.jsx(na,{description:t}),l,s.jsx(Qo,{errors:o})]}),ex=({children:e,className:t=""})=>s.jsx("div",{className:`pointer-events-none ${t}`,children:e}),tx=({icon:e="📋",message:t,subMessage:r})=>s.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50",children:[s.jsx("span",{className:"text-4xl",children:e}),s.jsx("p",{className:"mt-2 text-sm text-gray-500",children:t}),r&&s.jsx("p",{className:"text-xs text-gray-400",children:r})]}),Qr=({icon:e,children:t,iconPosition:r="left"})=>s.jsxs("div",{className:"relative",children:[s.jsx("span",{className:`absolute top-1/2 -translate-y-1/2 text-gray-400 ${r==="left"?"left-3":"right-3"}`,children:e}),t]}),Fl=({prefix:e,suffix:t,children:r})=>s.jsxs("div",{className:"flex",children:[e&&s.jsx("span",{className:"inline-flex items-center px-3 border border-r-0 border-gray-300 rounded-l-md bg-gray-100 text-gray-500 text-sm",children:e}),s.jsx("div",{className:`flex-1 ${e?"":"rounded-l-md"} ${t?"":"rounded-r-md"}`,children:r}),t&&s.jsx("span",{className:"inline-flex items-center px-3 border border-l-0 border-gray-300 rounded-r-md bg-gray-100 text-gray-500 text-sm",children:t})]});function bt(e={}){const{hasError:t=!1,disabled:r=!1,size:o="medium",hasLeftIcon:n=!1,hasRightIcon:a=!1,hasPrefix:l=!1,hasSuffix:i=!1}=e,c={small:"px-2 py-1.5 text-sm",medium:"px-3 py-2 text-sm",large:"px-4 py-3 text-base"},d=["w-full","border","transition-colors","focus:outline-none","focus:ring-2","focus:ring-offset-0"];return d.push(c[o]),!l&&!i?d.push("rounded-md"):l&&!i?d.push("rounded-r-md"):!l&&i&&d.push("rounded-l-md"),n&&d.push("pl-10"),a&&d.push("pr-10"),r?d.push("bg-gray-50","text-gray-500","cursor-not-allowed","border-gray-300"):t?d.push("border-red-500","focus:ring-red-500","focus:border-red-500"):d.push("border-gray-300","focus:ring-blue-500","focus:border-blue-500"),d.join(" ")}function lt(e="medium"){return["w-full",{small:"px-2 py-1.5 text-sm",medium:"px-3 py-2 text-sm",large:"px-4 py-3 text-base"}[e],"border","border-gray-300","rounded-md","bg-gray-50","text-gray-500"].join(" ")}function rx(e={}){const{variant:t="primary",size:r="medium",disabled:o=!1}=e,n={small:"px-4 py-1.5 text-sm",medium:"px-6 py-2.5 text-base",large:"px-8 py-3 text-lg"},a={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-600 text-white hover:bg-gray-700",outline:"border-2 border-blue-600 text-blue-600 bg-transparent hover:bg-blue-50",ghost:"text-blue-600 hover:bg-blue-50"},l=["rounded-md","font-medium","transition-colors","focus:outline-none","focus:ring-2","focus:ring-offset-2",n[r]];return o&&l.push("opacity-50","cursor-not-allowed"),l.push(a[t]),l.join(" ")}function B(e){const{element:t,properties:r,layout:o,validation:n,config:a,mode:l,value:i,onChange:c,errors:d,readOnly:p,disabled:u}=e;return{label:r.label,description:r.description,placeholder:r.placeholder,prefix:r.prefix,suffix:r.suffix,required:(n==null?void 0:n.required)??!1,labelPosition:o.labelPosition??"top",isCanvas:l==="canvas",isDisabled:u||p||l==="canvas",value:i,onChange:c,errors:d,config:a,element:t}}const ox=[{type:"shortText",structure:"field",typeCategory:"Text",label:"Short Text",description:"Single line text input",icon:"📝",category:"field",subCategory:"textInput",dataType:"string",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0,showPrefix:!0,showSuffix:!0},configSection:{title:"Text Input Settings",icon:"📝"},fields:[{key:"showCharacterCount",label:"Show Character Count",type:"checkbox",section:"config",description:"Display remaining character count"},{key:"autoComplete",label:"Autocomplete",type:"select",section:"config",description:"Browser autofill hint",options:[{value:"off",label:"Off"},{value:"on",label:"On"},{value:"name",label:"Full Name"},{value:"given-name",label:"First Name"},{value:"family-name",label:"Last Name"},{value:"email",label:"Email"},{value:"tel",label:"Phone"},{value:"organization",label:"Organization"},{value:"street-address",label:"Street Address"},{value:"address-level2",label:"City"},{value:"address-level1",label:"State / Province"},{value:"postal-code",label:"Postal / Zip Code"},{value:"country",label:"Country"},{value:"username",label:"Username"},{value:"organization-title",label:"Job Title"}]}]},getDefaultValues:()=>({properties:{label:"Short Text",placeholder:"Enter text..."},layout:{labelPosition:"top",size:"full"},validation:{maxLength:255}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,children:s.jsx("input",{type:"text",placeholder:o,disabled:!0,className:lt()})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:l,onChange:i,errors:c,isDisabled:d}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsx("input",{type:"text",placeholder:o,value:l??"",onChange:p=>i==null?void 0:i(p.target.value),disabled:d,className:bt({hasError:((c==null?void 0:c.length)??0)>0,disabled:d})})})}},{type:"longText",structure:"field",typeCategory:"Text",label:"Long Text",description:"Multi-line text area",icon:"📄",category:"field",subCategory:"textInput",dataType:"string",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0},configSection:{title:"Text Area Settings",icon:"📄"},fields:[{key:"rows",label:"Visible Rows",type:"number",section:"config",min:1,max:20,placeholder:"3",description:"Number of visible text lines"},{key:"autoResize",label:"Auto-resize",type:"checkbox",section:"config",description:"Automatically adjust height to content"},{key:"showCharacterCount",label:"Show Character Count",type:"checkbox",section:"config",description:"Display remaining character count"}]},getDefaultValues:()=>({properties:{label:"Long Text",placeholder:"Enter text..."},layout:{labelPosition:"top",size:"full"},config:{rows:3,autoResize:!1},validation:{maxLength:5e3}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,config:l}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,children:s.jsx("textarea",{placeholder:o,disabled:!0,rows:(l==null?void 0:l.rows)||3,className:`${lt()} resize-none`})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:l,onChange:i,errors:c,isDisabled:d,config:p}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsx("textarea",{placeholder:o,value:l??"",onChange:u=>i==null?void 0:i(u.target.value),disabled:d,rows:(p==null?void 0:p.rows)||3,className:`${bt({hasError:((c==null?void 0:c.length)??0)>0,disabled:d})} resize-none`})})}},{type:"multiLineInput",structure:"field",typeCategory:"Text",label:"Multi-Line Input",description:"Auto-expanding text area",icon:"📝",category:"field",subCategory:"textInput",dataType:"string",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0},configSection:{title:"Auto-Resize Settings",icon:"📑"},fields:[{key:"minRows",label:"Min Rows",type:"number",section:"config",min:1,max:20,placeholder:"2",colSpan:1},{key:"maxRows",label:"Max Rows",type:"number",section:"config",min:1,max:50,placeholder:"10",colSpan:1},{key:"autoResize",label:"Auto-resize",type:"checkbox",section:"config",description:"Grow textarea to fit content"},{key:"showCharacterCount",label:"Show Character Count",type:"checkbox",section:"config",description:"Display remaining character count"}]},getDefaultValues:()=>({properties:{label:"Multi-Line Input",placeholder:"Enter text..."},layout:{labelPosition:"top",size:"full"},config:{minRows:2,maxRows:10,autoResize:!0},validation:{maxLength:5e3}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,config:l}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,children:s.jsx("textarea",{placeholder:o,disabled:!0,rows:(l==null?void 0:l.minRows)||2,className:`${lt()} resize-none`})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:l,onChange:i,errors:c,isDisabled:d,config:p}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsx("textarea",{placeholder:o,value:l??"",onChange:u=>i==null?void 0:i(u.target.value),disabled:d,rows:(p==null?void 0:p.minRows)||2,className:`${bt({hasError:((c==null?void 0:c.length)??0)>0,disabled:d})} resize-none`})})}},{type:"textEditor",structure:"field",typeCategory:"Text",label:"Rich Text Editor",description:"WYSIWYG text editor",icon:"✏️",category:"field",subCategory:"textInput",dataType:"string",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!1},configSection:{title:"Editor Settings",icon:"✏️"},fields:[{key:"toolbarPreset",label:"Toolbar",type:"select",section:"config",description:"Choose which formatting options appear",options:[{value:"basic",label:"Basic (Bold, Italic, Underline)"},{value:"standard",label:"Standard (+ Links, Lists)"},{value:"advanced",label:"Advanced (+ Headings, Blockquote)"},{value:"full",label:"Full (All options)"}]},{key:"height",label:"Height (px)",type:"number",section:"config",min:100,max:800,placeholder:"200",description:"Editor area height in pixels"},{key:"allowImages",label:"Allow Images",type:"checkbox",section:"config",description:"Let users embed images in content"},{key:"allowLinks",label:"Allow Links",type:"checkbox",section:"config",description:"Let users insert hyperlinks"}]},getDefaultValues:()=>({properties:{label:"Rich Text",placeholder:"Start typing..."},layout:{labelPosition:"top",size:"full"},config:{toolbar:["bold","italic","underline","link"],height:200,allowImages:!1,allowLinks:!0},validation:{maxLength:1e4}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,config:l}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,children:s.jsxs("div",{className:"border border-gray-300 rounded-md bg-gray-50 overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-1 p-2 border-b border-gray-200 bg-gray-100",children:[s.jsx("button",{disabled:!0,className:"p-1.5 rounded hover:bg-gray-200 text-gray-600",children:s.jsx("strong",{children:"B"})}),s.jsx("button",{disabled:!0,className:"p-1.5 rounded hover:bg-gray-200 text-gray-600",children:s.jsx("em",{children:"I"})}),s.jsx("button",{disabled:!0,className:"p-1.5 rounded hover:bg-gray-200 text-gray-600",children:s.jsx("u",{children:"U"})}),s.jsx("span",{className:"w-px h-4 bg-gray-300 mx-1"}),s.jsx("button",{disabled:!0,className:"p-1.5 rounded hover:bg-gray-200 text-gray-600 text-xs",children:"🔗"})]}),s.jsx("div",{className:"p-3 min-h-[120px] text-gray-400 text-sm",style:{height:(l==null?void 0:l.height)||200},children:o||"Start typing..."})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e);return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:`border rounded-md overflow-hidden ${((i==null?void 0:i.length)??0)>0?"border-red-500":"border-gray-300"}`,children:[s.jsxs("div",{className:"flex items-center gap-1 p-2 border-b border-gray-200 bg-gray-100",children:[s.jsx("button",{type:"button",disabled:c,className:"p-1.5 rounded hover:bg-gray-200 text-gray-600 disabled:opacity-50",children:s.jsx("strong",{children:"B"})}),s.jsx("button",{type:"button",disabled:c,className:"p-1.5 rounded hover:bg-gray-200 text-gray-600 disabled:opacity-50",children:s.jsx("em",{children:"I"})}),s.jsx("button",{type:"button",disabled:c,className:"p-1.5 rounded hover:bg-gray-200 text-gray-600 disabled:opacity-50",children:s.jsx("u",{children:"U"})}),s.jsx("span",{className:"w-px h-4 bg-gray-300 mx-1"}),s.jsx("button",{type:"button",disabled:c,className:"p-1.5 rounded hover:bg-gray-200 text-gray-600 text-xs disabled:opacity-50",children:"🔗"})]}),s.jsx("div",{contentEditable:!c,suppressContentEditableWarning:!0,onInput:p=>l==null?void 0:l(p.target.innerHTML),dangerouslySetInnerHTML:{__html:a??""},className:"p-3 min-h-[120px] text-sm focus:outline-none",style:{height:(d==null?void 0:d.height)||200}})]})})}}],nx=[{type:"number",structure:"field",typeCategory:"Numeric",label:"Number",description:"Numeric input field",icon:"🔢",category:"field",subCategory:"numeric",dataType:"number",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0,showPrefix:!0,showSuffix:!0},configSection:{title:"Number Settings",icon:"🔢"},fields:[{key:"step",label:"Step",type:"number",section:"config",min:.01,placeholder:"1",description:"Increment/decrement amount",colSpan:1},{key:"decimals",label:"Decimals",type:"number",section:"config",min:0,max:10,placeholder:"0",description:"Decimal places to allow",colSpan:1},{key:"thousandsSeparator",label:"Thousands Separator",type:"checkbox",section:"config",description:"Format numbers with commas (e.g. 1,000)"},{key:"currencySymbol",label:"Currency Symbol",type:"text",section:"config",placeholder:"$, €, £, ¥…",description:"Leave empty for plain numbers"},{key:"numberFormat",label:"Display Format",type:"select",section:"config",options:[{value:"number",label:"Plain Number"},{value:"currency",label:"Currency"},{value:"percent",label:"Percentage"}]},{key:"showStepper",label:"Show Stepper Buttons",type:"checkbox",section:"config",description:"Display +/- spin buttons"}]},getDefaultValues:()=>({properties:{label:"Number",placeholder:"Enter number..."},layout:{labelPosition:"top",size:"full"},config:{step:1,decimals:0,thousandsSeparator:!1}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,prefix:l,suffix:i}=B(e),c=s.jsx("input",{type:"number",placeholder:o,disabled:!0,className:`${lt()} ${l?"":"rounded-l-md"} ${i?"":"rounded-r-md"}`});return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,children:l||i?s.jsx(Fl,{prefix:l,suffix:i,children:c}):c})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,prefix:l,suffix:i,value:c,onChange:d,errors:p,isDisabled:u,config:f}=B(e),h=g=>{const y=g.target.value===""?void 0:Number(g.target.value);d==null||d(y)},b=s.jsx("input",{type:"number",placeholder:o,value:c??"",onChange:h,disabled:u,step:(f==null?void 0:f.step)||1,className:`${bt({hasError:((p==null?void 0:p.length)??0)>0,disabled:u})} ${l?"rounded-l-none":""} ${i?"rounded-r-none":""}`});return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,errors:p,children:l||i?s.jsx(Fl,{prefix:l,suffix:i,children:b}):b})}},{type:"slider",structure:"field",typeCategory:"Numeric",label:"Slider",description:"Range slider for numeric values",icon:"🎚️",category:"field",subCategory:"numeric",dataType:"number",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!1,showDescription:!0},configSection:{title:"Slider Settings",icon:"🎚️"},fields:[{key:"min",label:"Min Value",type:"number",section:"config",placeholder:"0",colSpan:1},{key:"max",label:"Max Value",type:"number",section:"config",placeholder:"100",colSpan:1},{key:"step",label:"Step",type:"number",section:"config",min:1,placeholder:"1",description:"Size of each increment"},{key:"showValue",label:"Show Value Label",type:"checkbox",section:"config",description:"Display the current value beside the slider"},{key:"showMarks",label:"Show Tick Marks",type:"checkbox",section:"config",description:"Display scale marks along the track"},{key:"showTooltip",label:"Show Tooltip on Drag",type:"checkbox",section:"config",description:"Floating tooltip while dragging"},{key:"trackColor",label:"Track Color",type:"select",section:"config",description:"Visual theme of the slider track",options:[{value:"primary",label:"Primary (Blue)"},{value:"success",label:"Success (Green)"},{value:"warning",label:"Warning (Amber)"},{value:"danger",label:"Danger (Red)"},{value:"neutral",label:"Neutral (Gray)"}]}]},getDefaultValues:()=>({properties:{label:"Slider",description:"Drag to select a value"},layout:{labelPosition:"top",size:"full"},config:{min:0,max:100,step:1,showValue:!0,showMarks:!1}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e),l=(a==null?void 0:a.min)??0,i=(a==null?void 0:a.max)??100;return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs text-gray-500",children:l}),s.jsx("input",{type:"range",min:l,max:i,disabled:!0,className:"flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-not-allowed"}),s.jsx("span",{className:"text-xs text-gray-500",children:i}),(a==null?void 0:a.showValue)&&s.jsx("span",{className:"text-sm font-medium text-gray-600 min-w-[40px] text-center",children:Math.round((l+i)/2)})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),p=(d==null?void 0:d.min)??0,u=(d==null?void 0:d.max)??100,f=(d==null?void 0:d.step)??1,h=a??p;return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs text-gray-500",children:p}),s.jsx("input",{type:"range",min:p,max:u,step:f,value:h,onChange:b=>l==null?void 0:l(Number(b.target.value)),disabled:c,className:"flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer disabled:cursor-not-allowed"}),s.jsx("span",{className:"text-xs text-gray-500",children:u}),(d==null?void 0:d.showValue)&&s.jsx("span",{className:"text-sm font-medium text-gray-600 min-w-[40px] text-center",children:h})]})})}},{type:"rangeSlider",structure:"field",typeCategory:"Numeric",label:"Range Slider",description:"Select a range of values",icon:"↔️",category:"field",subCategory:"numeric",dataType:"object",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!1,showDescription:!0},configSection:{title:"Range Slider Settings",icon:"↔️"},fields:[{key:"min",label:"Range Min",type:"number",section:"config",placeholder:"0",colSpan:1},{key:"max",label:"Range Max",type:"number",section:"config",placeholder:"100",colSpan:1},{key:"step",label:"Step",type:"number",section:"config",min:1,placeholder:"1",description:"Size of each increment",colSpan:1},{key:"minRange",label:"Min Gap",type:"number",section:"config",min:0,placeholder:"10",description:"Minimum distance between handles",colSpan:1},{key:"showValue",label:"Show Value Labels",type:"checkbox",section:"config",description:"Display selected range below the slider"},{key:"showTooltip",label:"Show Tooltip on Drag",type:"checkbox",section:"config",description:"Floating tooltip while dragging handles"},{key:"showBarLabels",label:"Show Min/Max Labels",type:"checkbox",section:"config",description:"Show the min/max values at track edges"}]},getDefaultValues:()=>({properties:{label:"Range Slider",description:"Select a range"},layout:{labelPosition:"top",size:"full"},config:{min:0,max:100,step:1,showValue:!0,minRange:10}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e),l=(a==null?void 0:a.min)??0,i=(a==null?void 0:a.max)??100;return s.jsxs(ne,{label:t,description:r,required:o,labelPosition:n,children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs text-gray-500",children:l}),s.jsxs("div",{className:"flex-1 relative h-2 bg-gray-200 rounded-lg",children:[s.jsx("div",{className:"absolute h-full bg-blue-400 rounded-lg left-[20%] right-[30%]"}),s.jsx("div",{className:"absolute w-4 h-4 bg-white border-2 border-blue-500 rounded-full -top-1 left-[20%] -ml-2"}),s.jsx("div",{className:"absolute w-4 h-4 bg-white border-2 border-blue-500 rounded-full -top-1 right-[30%] -mr-2"})]}),s.jsx("span",{className:"text-xs text-gray-500",children:i})]}),(a==null?void 0:a.showValue)&&s.jsxs("div",{className:"flex justify-between text-sm text-gray-600 mt-2",children:[s.jsxs("span",{children:["Min: ",Math.round(l+(i-l)*.2)]}),s.jsxs("span",{children:["Max: ",Math.round(l+(i-l)*.7)]})]})]})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),p=(d==null?void 0:d.min)??0,u=(d==null?void 0:d.max)??100,f=(d==null?void 0:d.step)??1,h=(a==null?void 0:a.min)??Math.round(p+(u-p)*.2),b=(a==null?void 0:a.max)??Math.round(p+(u-p)*.8),g=w=>{const S=Number(w.target.value),E=Math.min(S,b-((d==null?void 0:d.minRange)??0));l==null||l({min:E,max:b})},y=w=>{const S=Number(w.target.value),E=Math.max(S,h+((d==null?void 0:d.minRange)??0));l==null||l({min:h,max:E})},x=(h-p)/(u-p)*100,v=100-(b-p)/(u-p)*100;return s.jsxs(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-xs text-gray-500",children:p}),s.jsxs("div",{className:"flex-1 relative h-2 bg-gray-200 rounded-lg",children:[s.jsx("div",{className:"absolute h-full bg-blue-400 rounded-lg",style:{left:`${x}%`,right:`${v}%`}}),s.jsx("input",{type:"range",min:p,max:u,step:f,value:h,onChange:g,disabled:c,className:"absolute w-full h-full appearance-none bg-transparent pointer-events-auto cursor-pointer disabled:cursor-not-allowed",style:{zIndex:h>u-10?5:3}}),s.jsx("input",{type:"range",min:p,max:u,step:f,value:b,onChange:y,disabled:c,className:"absolute w-full h-full appearance-none bg-transparent pointer-events-auto cursor-pointer disabled:cursor-not-allowed",style:{zIndex:4}})]}),s.jsx("span",{className:"text-xs text-gray-500",children:u})]}),(d==null?void 0:d.showValue)&&s.jsxs("div",{className:"flex justify-between text-sm text-gray-600 mt-2",children:[s.jsxs("span",{children:["Min: ",h]}),s.jsxs("span",{children:["Max: ",b]})]})]})}}],ax=[{type:"singleChoice",structure:"field",typeCategory:"Selection",label:"Single Choice",description:"Radio button selection",icon:"⭕",category:"field",subCategory:"selection",dataType:"string",supportsValidation:!0,supportsOptions:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!1,showDescription:!0},configSection:{title:"Choice Settings",icon:"⭕"},fields:[{key:"layoutDirection",label:"Layout",type:"select",section:"config",description:"How options are arranged",options:[{value:"vertical",label:"Vertical (stacked)"},{value:"horizontal",label:"Horizontal (inline)"},{value:"grid",label:"Grid (2 columns)"}]},{key:"allowOther",label:'Allow "Other"',type:"checkbox",section:"config",description:'Add a free-text "Other" option at the end'},{key:"randomizeOptions",label:"Randomize Order",type:"checkbox",section:"config",description:"Shuffle options for each respondent (surveys)"},{key:"showAsButtonGroup",label:"Show as Button Group",type:"checkbox",section:"config",description:"Display options as selectable buttons instead of radios"},{key:"otherLabel",label:'"Other" Label',type:"text",section:"config",placeholder:"Other (please specify)",showWhen:{field:"allowOther",value:!0}}]},getDefaultValues:()=>({properties:{label:"Single Choice",description:"Select one option"},layout:{labelPosition:"top",size:"full"},config:{options:[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"},{label:"Option 3",value:"option3"}],allowOther:!1}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e),l=(a==null?void 0:a.options)||[];return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:"space-y-2",children:[l.map((i,c)=>s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"radio",disabled:!0,className:"text-blue-600"}),s.jsx("span",{className:"text-sm text-gray-700",children:i.label})]},c)),(a==null?void 0:a.allowOther)&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"radio",disabled:!0,className:"text-blue-600"}),s.jsx("span",{className:"text-sm text-gray-700",children:"Other"})]})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),p=(d==null?void 0:d.options)||[];return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:"space-y-2",children:[p.map((u,f)=>s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",checked:a===u.value,onChange:()=>l==null?void 0:l(u.value),disabled:c,className:"text-blue-600"}),s.jsx("span",{className:"text-sm text-gray-700",children:u.label})]},f)),(d==null?void 0:d.allowOther)&&s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"radio",checked:a==="__other__",onChange:()=>l==null?void 0:l("__other__"),disabled:c,className:"text-blue-600"}),s.jsx("span",{className:"text-sm text-gray-700",children:"Other"})]})]})})}},{type:"multipleChoice",structure:"field",typeCategory:"Selection",label:"Multiple Choice",description:"Checkbox multi-select",icon:"☑️",category:"field",subCategory:"selection",dataType:"array",supportsValidation:!0,supportsOptions:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!1,showDescription:!0},configSection:{title:"Choice Settings",icon:"☑️"},fields:[{key:"layoutDirection",label:"Layout",type:"select",section:"config",description:"How options are arranged",options:[{value:"vertical",label:"Vertical (stacked)"},{value:"horizontal",label:"Horizontal (inline)"},{value:"grid",label:"Grid (2 columns)"}]},{key:"allowOther",label:'Allow "Other"',type:"checkbox",section:"config",description:'Add a free-text "Other" option at the end'},{key:"randomizeOptions",label:"Randomize Order",type:"checkbox",section:"config",description:"Shuffle options for each respondent (surveys)"},{key:"showSelectAll",label:'Show "Select All"',type:"checkbox",section:"config",description:"Add a shortcut to check all options at once"},{key:"otherLabel",label:'"Other" Label',type:"text",section:"config",placeholder:"Other (please specify)",showWhen:{field:"allowOther",value:!0}}]},getDefaultValues:()=>({properties:{label:"Multiple Choice",description:"Select all that apply"},layout:{labelPosition:"top",size:"full"},config:{options:[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"},{label:"Option 3",value:"option3"}],allowOther:!1}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e),l=(a==null?void 0:a.options)||[];return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:"space-y-2",children:[l.map((i,c)=>s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",disabled:!0,className:"text-blue-600 rounded"}),s.jsx("span",{className:"text-sm text-gray-700",children:i.label})]},c)),(a==null?void 0:a.allowOther)&&s.jsxs("label",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"checkbox",disabled:!0,className:"text-blue-600 rounded"}),s.jsx("span",{className:"text-sm text-gray-700",children:"Other"})]})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),p=(d==null?void 0:d.options)||[],u=Array.isArray(a)?a:[],f=h=>{const b=u.includes(h)?u.filter(g=>g!==h):[...u,h];l==null||l(b)};return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:"space-y-2",children:[p.map((h,b)=>s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:u.includes(h.value),onChange:()=>f(h.value),disabled:c,className:"text-blue-600 rounded"}),s.jsx("span",{className:"text-sm text-gray-700",children:h.label})]},b)),(d==null?void 0:d.allowOther)&&s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:u.includes("__other__"),onChange:()=>f("__other__"),disabled:c,className:"text-blue-600 rounded"}),s.jsx("span",{className:"text-sm text-gray-700",children:"Other"})]})]})})}},{type:"dropdown",structure:"field",typeCategory:"Selection",label:"Dropdown",description:"Select from a dropdown list",icon:"📋",category:"field",subCategory:"selection",dataType:"string",supportsValidation:!0,supportsOptions:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0},configSection:{title:"Dropdown Settings",icon:"📋"},fields:[{key:"allowOther",label:'Allow "Other"',type:"checkbox",section:"config",description:"Let users type a custom value"},{key:"searchable",label:"Searchable",type:"checkbox",section:"config",description:"Enable type-to-search filtering"},{key:"clearable",label:"Clearable",type:"checkbox",section:"config",description:"Show a clear button to deselect"},{key:"otherLabel",label:'"Other" Label',type:"text",section:"config",placeholder:"Other (please specify)",showWhen:{field:"allowOther",value:!0}}]},getDefaultValues:()=>({properties:{label:"Dropdown",placeholder:"Select an option..."},layout:{labelPosition:"top",size:"full"},config:{options:[{label:"Option 1",value:"option1"},{label:"Option 2",value:"option2"},{label:"Option 3",value:"option3"}],allowOther:!1}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,config:l}=B(e),i=(l==null?void 0:l.options)||[];return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,children:s.jsxs("select",{disabled:!0,className:lt(),children:[s.jsx("option",{children:o||"Select an option..."}),i.map((c,d)=>s.jsx("option",{value:c.value,children:c.label},d))]})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:l,onChange:i,errors:c,isDisabled:d,config:p}=B(e),u=(p==null?void 0:p.options)||[];return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsxs("select",{value:l??"",onChange:f=>i==null?void 0:i(f.target.value||void 0),disabled:d,className:bt({hasError:((c==null?void 0:c.length)??0)>0,disabled:d}),children:[s.jsx("option",{value:"",children:o||"Select an option..."}),u.map((f,h)=>s.jsx("option",{value:f.value,children:f.label},h))]})})}},{type:"tags",structure:"field",typeCategory:"Selection",label:"Tags",description:"Tag-style multi-select",icon:"🏷️",category:"field",subCategory:"selection",dataType:"array",supportsValidation:!0,supportsOptions:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0},configSection:{title:"Tags Settings",icon:"🏷️"},fields:[{key:"maxTags",label:"Max Tags",type:"number",section:"config",min:1,placeholder:"10",description:"Maximum number of tags allowed"},{key:"allowCustomTags",label:"Allow Custom Tags",type:"checkbox",section:"config",description:"Let users type their own tags"},{key:"showSuggestions",label:"Show Suggestions",type:"checkbox",section:"config",description:"Display suggestion dropdown while typing"},{key:"tagColor",label:"Tag Color",type:"select",section:"config",description:"Color theme for selected tags",options:[{value:"primary",label:"Primary (Blue)"},{value:"neutral",label:"Neutral (Gray)"},{value:"success",label:"Success (Green)"},{value:"warning",label:"Warning (Amber)"},{value:"danger",label:"Danger (Red)"}]}]},getDefaultValues:()=>({properties:{label:"Tags",placeholder:"Add tag...",description:"Type and press Enter to add tags"},layout:{labelPosition:"top",size:"full"},config:{options:[{label:"Tag 1",value:"tag1"},{label:"Tag 2",value:"tag2"},{label:"Tag 3",value:"tag3"}],maxTags:10,allowCustomTags:!0}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,children:s.jsxs("div",{className:"flex flex-wrap gap-2 p-2 border border-gray-300 rounded-md bg-gray-50 min-h-[42px]",children:[s.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-100 text-blue-800 text-sm rounded",children:["Tag 1",s.jsx("button",{disabled:!0,className:"text-blue-600 hover:text-blue-800",children:"×"})]}),s.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-100 text-blue-800 text-sm rounded",children:["Tag 2",s.jsx("button",{disabled:!0,className:"text-blue-600 hover:text-blue-800",children:"×"})]}),s.jsx("input",{type:"text",placeholder:o||"Add tag...",disabled:!0,className:"flex-1 min-w-[100px] border-none bg-transparent text-sm focus:outline-none"})]})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:l,onChange:i,errors:c,isDisabled:d,config:p}=B(e),u=Array.isArray(l)?l:[],[f,h]=C.useState(""),b=y=>{y.key==="Enter"&&f.trim()&&(y.preventDefault(),!u.includes(f.trim())&&(!(p!=null&&p.maxTags)||u.length<p.maxTags)&&(i==null||i([...u,f.trim()])),h(""))},g=y=>{i==null||i(u.filter(x=>x!==y))};return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsxs("div",{className:`flex flex-wrap gap-2 p-2 border rounded-md min-h-[42px] ${((c==null?void 0:c.length)??0)>0?"border-red-500":"border-gray-300"} ${d?"bg-gray-50":"bg-white"}`,children:[u.map((y,x)=>s.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-100 text-blue-800 text-sm rounded",children:[y,!d&&s.jsx("button",{type:"button",onClick:()=>g(y),className:"text-blue-600 hover:text-blue-800",children:"×"})]},x)),!d&&(!(p!=null&&p.maxTags)||u.length<p.maxTags)&&s.jsx("input",{type:"text",placeholder:o||"Add tag...",value:f,onChange:y=>h(y.target.value),onKeyDown:b,disabled:d,className:"flex-1 min-w-[100px] border-none bg-transparent text-sm focus:outline-none"})]})})}},{type:"decisionBox",structure:"field",typeCategory:"Selection",label:"Decision Box",description:"Yes/No checkbox",icon:"✅",category:"field",subCategory:"selection",dataType:"boolean",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!1,showDescription:!0},configSection:{title:"Decision Box Settings",icon:"✅"},fields:[{key:"checkedLabel",label:"Checked Label",type:"text",section:"config",placeholder:"Yes",description:"Label shown when checked",colSpan:1},{key:"uncheckedLabel",label:"Unchecked Label",type:"text",section:"config",placeholder:"No",description:"Label shown when unchecked",colSpan:1},{key:"showAsSwitch",label:"Show as Toggle Switch",type:"checkbox",section:"config",description:"Display as a switch instead of a checkbox"}]},getDefaultValues:()=>({properties:{label:"I agree to the terms and conditions"},layout:{labelPosition:"top",size:"full"},config:{checkedLabel:"Yes",uncheckedLabel:"No"}}),renderOnCanvas:e=>{const{label:t,description:r,required:o}=B(e);return s.jsx("div",{className:"space-y-1.5",children:s.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[s.jsx("input",{type:"checkbox",disabled:!0,className:"mt-1 text-blue-600 rounded"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-gray-700",children:t}),o&&s.jsx("span",{className:"text-red-500 ml-1",children:"*"}),r&&s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:r})]})]})})},render:e=>{const{label:t,description:r,required:o,value:n,onChange:a,errors:l,isDisabled:i}=B(e);return s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"flex items-start gap-3 cursor-pointer",children:[s.jsx("input",{type:"checkbox",checked:n??!1,onChange:c=>a==null?void 0:a(c.target.checked),disabled:i,className:"mt-1 text-blue-600 rounded"}),s.jsxs("div",{children:[s.jsx("span",{className:"text-sm text-gray-700",children:t}),o&&s.jsx("span",{className:"text-red-500 ml-1",children:"*"}),r&&s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:r})]})]}),l&&l.length>0&&s.jsx("div",{className:"space-y-1",children:l.map((c,d)=>s.jsx("p",{className:"text-xs text-red-500",children:c},d))})]})}},{type:"toggleSwitch",structure:"field",typeCategory:"Selection",label:"Toggle Switch",description:"On/Off toggle switch",icon:"🔀",category:"field",subCategory:"selection",dataType:"boolean",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!1,showDescription:!0},configSection:{title:"Toggle Settings",icon:"🔀"},fields:[{key:"onLabel",label:"On Label",type:"text",section:"config",placeholder:"On",description:"Label for the active state",colSpan:1},{key:"offLabel",label:"Off Label",type:"text",section:"config",placeholder:"Off",description:"Label for the inactive state",colSpan:1},{key:"showLabels",label:"Show State Labels",type:"checkbox",section:"config",description:"Display on/off text next to the switch"},{key:"defaultValue",label:"Default State",type:"select",section:"config",description:"Initial state of the switch",options:[{value:"off",label:"Off (unchecked)"},{value:"on",label:"On (checked)"}]}]},getDefaultValues:()=>({properties:{label:"Toggle Switch",description:"Toggle on or off"},layout:{labelPosition:"top",size:"full"},config:{onLabel:"On",offLabel:"Off"}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e);return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-gray-500",children:(a==null?void 0:a.offLabel)||"Off"}),s.jsx("div",{className:"relative w-11 h-6 bg-gray-300 rounded-full",children:s.jsx("div",{className:"absolute left-1 top-1 w-4 h-4 bg-white rounded-full transition-transform"})}),s.jsx("span",{className:"text-sm text-gray-500",children:(a==null?void 0:a.onLabel)||"On"})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),p=a??!1;return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm text-gray-500",children:(d==null?void 0:d.offLabel)||"Off"}),s.jsx("button",{type:"button",onClick:()=>!c&&(l==null?void 0:l(!p)),disabled:c,className:`relative w-11 h-6 rounded-full transition-colors ${p?"bg-blue-600":"bg-gray-300"} ${c?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:s.jsx("div",{className:`absolute top-1 w-4 h-4 bg-white rounded-full transition-transform ${p?"translate-x-6":"translate-x-1"}`})}),s.jsx("span",{className:"text-sm text-gray-500",children:(d==null?void 0:d.onLabel)||"On"})]})})}}];function Vd(e,[t,r]){return Math.min(r,Math.max(t,e))}function xe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(n){if(e==null||e(n),r===!1||!n.defaultPrevented)return t==null?void 0:t(n)}}function dr(e,t=[]){let r=[];function o(a,l){const i=m.createContext(l),c=r.length;r=[...r,l];const d=u=>{var x;const{scope:f,children:h,...b}=u,g=((x=f==null?void 0:f[e])==null?void 0:x[c])||i,y=m.useMemo(()=>b,Object.values(b));return s.jsx(g.Provider,{value:y,children:h})};d.displayName=a+"Provider";function p(u,f){var g;const h=((g=f==null?void 0:f[e])==null?void 0:g[c])||i,b=m.useContext(h);if(b)return b;if(l!==void 0)return l;throw new Error(`\`${u}\` must be used within \`${a}\``)}return[d,p]}const n=()=>{const a=r.map(l=>m.createContext(l));return function(i){const c=(i==null?void 0:i[e])||a;return m.useMemo(()=>({[`__scope${e}`]:{...i,[e]:c}}),[i,c])}};return n.scopeName=e,[o,sx(n,...t)]}function sx(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const o=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(a){const l=o.reduce((i,{useScope:c,scopeName:d})=>{const u=c(a)[`__scope${d}`];return{...i,...u}},{});return m.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return r.scopeName=t.scopeName,r}function zd(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ko(...e){return t=>{let r=!1;const o=e.map(n=>{const a=zd(n,t);return!r&&typeof a=="function"&&(r=!0),a});if(r)return()=>{for(let n=0;n<o.length;n++){const a=o[n];typeof a=="function"?a():zd(e[n],null)}}}}function Fe(...e){return m.useCallback(Ko(...e),e)}function Bd(e){const t=lx(e),r=m.forwardRef((o,n)=>{const{children:a,...l}=o,i=m.Children.toArray(a),c=i.find(cx);if(c){const d=c.props.children,p=i.map(u=>u===c?m.Children.count(d)>1?m.Children.only(null):m.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...l,ref:n,children:m.isValidElement(d)?m.cloneElement(d,void 0,p):null})}return s.jsx(t,{...l,ref:n,children:a})});return r.displayName=`${e}.Slot`,r}function lx(e){const t=m.forwardRef((r,o)=>{const{children:n,...a}=r;if(m.isValidElement(n)){const l=ux(n),i=dx(a,n.props);return n.type!==m.Fragment&&(i.ref=o?Ko(o,l):l),m.cloneElement(n,i)}return m.Children.count(n)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ix=Symbol("radix.slottable");function cx(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ix}function dx(e,t){const r={...t};for(const o in t){const n=e[o],a=t[o];/^on[A-Z]/.test(o)?n&&a?r[o]=(...i)=>{const c=a(...i);return n(...i),c}:n&&(r[o]=n):o==="style"?r[o]={...n,...a}:o==="className"&&(r[o]=[n,a].filter(Boolean).join(" "))}return{...e,...r}}function ux(e){var o,n;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Gl(e){const t=e+"CollectionProvider",[r,o]=dr(t),[n,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),l=g=>{const{scope:y,children:x}=g,v=C.useRef(null),w=C.useRef(new Map).current;return s.jsx(n,{scope:y,itemMap:w,collectionRef:v,children:x})};l.displayName=t;const i=e+"CollectionSlot",c=Bd(i),d=C.forwardRef((g,y)=>{const{scope:x,children:v}=g,w=a(i,x),S=Fe(y,w.collectionRef);return s.jsx(c,{ref:S,children:v})});d.displayName=i;const p=e+"CollectionItemSlot",u="data-radix-collection-item",f=Bd(p),h=C.forwardRef((g,y)=>{const{scope:x,children:v,...w}=g,S=C.useRef(null),E=Fe(y,S),N=a(p,x);return C.useEffect(()=>(N.itemMap.set(S,{ref:S,...w}),()=>void N.itemMap.delete(S))),s.jsx(f,{[u]:"",ref:E,children:v})});h.displayName=p;function b(g){const y=a(e+"CollectionConsumer",g);return C.useCallback(()=>{const v=y.collectionRef.current;if(!v)return[];const w=Array.from(v.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((N,T)=>w.indexOf(N.ref.current)-w.indexOf(T.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:l,Slot:d,ItemSlot:h},b,o]}var px=m.createContext(void 0);function aa(e){const t=m.useContext(px);return e||t||"ltr"}function fx(e){const t=hx(e),r=m.forwardRef((o,n)=>{const{children:a,...l}=o,i=m.Children.toArray(a),c=i.find(gx);if(c){const d=c.props.children,p=i.map(u=>u===c?m.Children.count(d)>1?m.Children.only(null):m.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...l,ref:n,children:m.isValidElement(d)?m.cloneElement(d,void 0,p):null})}return s.jsx(t,{...l,ref:n,children:a})});return r.displayName=`${e}.Slot`,r}function hx(e){const t=m.forwardRef((r,o)=>{const{children:n,...a}=r;if(m.isValidElement(n)){const l=yx(n),i=bx(a,n.props);return n.type!==m.Fragment&&(i.ref=o?Ko(o,l):l),m.cloneElement(n,i)}return m.Children.count(n)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var mx=Symbol("radix.slottable");function gx(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===mx}function bx(e,t){const r={...t};for(const o in t){const n=e[o],a=t[o];/^on[A-Z]/.test(o)?n&&a?r[o]=(...i)=>{const c=a(...i);return n(...i),c}:n&&(r[o]=n):o==="style"?r[o]={...n,...a}:o==="className"&&(r[o]=[n,a].filter(Boolean).join(" "))}return{...e,...r}}function yx(e){var o,n;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var vx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ne=vx.reduce((e,t)=>{const r=fx(`Primitive.${t}`),o=m.forwardRef((n,a)=>{const{asChild:l,...i}=n,c=l?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...i,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function xx(e,t){e&&Qn.flushSync(()=>e.dispatchEvent(t))}function Er(e){const t=m.useRef(e);return m.useEffect(()=>{t.current=e}),m.useMemo(()=>(...r)=>{var o;return(o=t.current)==null?void 0:o.call(t,...r)},[])}function wx(e,t=globalThis==null?void 0:globalThis.document){const r=Er(e);m.useEffect(()=>{const o=n=>{n.key==="Escape"&&r(n)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[r,t])}var Sx="DismissableLayer",Vl="dismissableLayer.update",Cx="dismissableLayer.pointerDownOutside",Nx="dismissableLayer.focusOutside",Ud,Wd=m.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),zl=m.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:n,onFocusOutside:a,onInteractOutside:l,onDismiss:i,...c}=e,d=m.useContext(Wd),[p,u]=m.useState(null),f=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=m.useState({}),b=Fe(t,T=>u(T)),g=Array.from(d.layers),[y]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),x=g.indexOf(y),v=p?g.indexOf(p):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,S=v>=x,E=_x(T=>{const k=T.target,M=[...d.branches].some(D=>D.contains(k));!S||M||(n==null||n(T),l==null||l(T),T.defaultPrevented||i==null||i())},f),N=Dx(T=>{const k=T.target;[...d.branches].some(D=>D.contains(k))||(a==null||a(T),l==null||l(T),T.defaultPrevented||i==null||i())},f);return wx(T=>{v===d.layers.size-1&&(o==null||o(T),!T.defaultPrevented&&i&&(T.preventDefault(),i()))},f),m.useEffect(()=>{if(p)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Ud=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(p)),d.layers.add(p),Hd(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Ud)}},[p,f,r,d]),m.useEffect(()=>()=>{p&&(d.layers.delete(p),d.layersWithOutsidePointerEventsDisabled.delete(p),Hd())},[p,d]),m.useEffect(()=>{const T=()=>h({});return document.addEventListener(Vl,T),()=>document.removeEventListener(Vl,T)},[]),s.jsx(Ne.div,{...c,ref:b,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:xe(e.onFocusCapture,N.onFocusCapture),onBlurCapture:xe(e.onBlurCapture,N.onBlurCapture),onPointerDownCapture:xe(e.onPointerDownCapture,E.onPointerDownCapture)})});zl.displayName=Sx;var Ex="DismissableLayerBranch",kx=m.forwardRef((e,t)=>{const r=m.useContext(Wd),o=m.useRef(null),n=Fe(t,o);return m.useEffect(()=>{const a=o.current;if(a)return r.branches.add(a),()=>{r.branches.delete(a)}},[r.branches]),s.jsx(Ne.div,{...e,ref:n})});kx.displayName=Ex;function _x(e,t=globalThis==null?void 0:globalThis.document){const r=Er(e),o=m.useRef(!1),n=m.useRef(()=>{});return m.useEffect(()=>{const a=i=>{if(i.target&&!o.current){let c=function(){jd(Cx,r,d,{discrete:!0})};const d={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",n.current),n.current=c,t.addEventListener("click",n.current,{once:!0})):c()}else t.removeEventListener("click",n.current);o.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",a),t.removeEventListener("click",n.current)}},[t,r]),{onPointerDownCapture:()=>o.current=!0}}function Dx(e,t=globalThis==null?void 0:globalThis.document){const r=Er(e),o=m.useRef(!1);return m.useEffect(()=>{const n=a=>{a.target&&!o.current&&jd(Nx,r,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Hd(){const e=new CustomEvent(Vl);document.dispatchEvent(e)}function jd(e,t,r,{discrete:o}){const n=r.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),o?xx(n,a):n.dispatchEvent(a)}var Bl=0;function Ax(){m.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Yd()),document.body.insertAdjacentElement("beforeend",e[1]??Yd()),Bl++,()=>{Bl===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Bl--}},[])}function Yd(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Ul="focusScope.autoFocusOnMount",Wl="focusScope.autoFocusOnUnmount",qd={bubbles:!1,cancelable:!0},Tx="FocusScope",Qd=m.forwardRef((e,t)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:n,onUnmountAutoFocus:a,...l}=e,[i,c]=m.useState(null),d=Er(n),p=Er(a),u=m.useRef(null),f=Fe(t,g=>c(g)),h=m.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;m.useEffect(()=>{if(o){let g=function(w){if(h.paused||!i)return;const S=w.target;i.contains(S)?u.current=S:kr(u.current,{select:!0})},y=function(w){if(h.paused||!i)return;const S=w.relatedTarget;S!==null&&(i.contains(S)||kr(u.current,{select:!0}))},x=function(w){if(document.activeElement===document.body)for(const E of w)E.removedNodes.length>0&&kr(i)};document.addEventListener("focusin",g),document.addEventListener("focusout",y);const v=new MutationObserver(x);return i&&v.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",y),v.disconnect()}}},[o,i,h.paused]),m.useEffect(()=>{if(i){Jd.add(h);const g=document.activeElement;if(!i.contains(g)){const x=new CustomEvent(Ul,qd);i.addEventListener(Ul,d),i.dispatchEvent(x),x.defaultPrevented||(Mx(Lx(Kd(i)),{select:!0}),document.activeElement===g&&kr(i))}return()=>{i.removeEventListener(Ul,d),setTimeout(()=>{const x=new CustomEvent(Wl,qd);i.addEventListener(Wl,p),i.dispatchEvent(x),x.defaultPrevented||kr(g??document.body,{select:!0}),i.removeEventListener(Wl,p),Jd.remove(h)},0)}}},[i,d,p,h]);const b=m.useCallback(g=>{if(!r&&!o||h.paused)return;const y=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,x=document.activeElement;if(y&&x){const v=g.currentTarget,[w,S]=Ix(v);w&&S?!g.shiftKey&&x===S?(g.preventDefault(),r&&kr(w,{select:!0})):g.shiftKey&&x===w&&(g.preventDefault(),r&&kr(S,{select:!0})):x===v&&g.preventDefault()}},[r,o,h.paused]);return s.jsx(Ne.div,{tabIndex:-1,...l,ref:f,onKeyDown:b})});Qd.displayName=Tx;function Mx(e,{select:t=!1}={}){const r=document.activeElement;for(const o of e)if(kr(o,{select:t}),document.activeElement!==r)return}function Ix(e){const t=Kd(e),r=Xd(t,e),o=Xd(t.reverse(),e);return[r,o]}function Kd(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const n=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||n?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Xd(e,t){for(const r of e)if(!Px(r,{upTo:t}))return r}function Px(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Ox(e){return e instanceof HTMLInputElement&&"select"in e}function kr(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Ox(e)&&t&&e.select()}}var Jd=$x();function $x(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Zd(e,t),e.unshift(t)},remove(t){var r;e=Zd(e,t),(r=e[0])==null||r.resume()}}}function Zd(e,t){const r=[...e],o=r.indexOf(t);return o!==-1&&r.splice(o,1),r}function Lx(e){return e.filter(t=>t.tagName!=="A")}var it=globalThis!=null&&globalThis.document?m.useLayoutEffect:()=>{},Fx=m[" useId ".trim().toString()]||(()=>{}),Gx=0;function _r(e){const[t,r]=m.useState(Fx());return it(()=>{r(o=>o??String(Gx++))},[e]),e||(t?`radix-${t}`:"")}const Vx=["top","right","bottom","left"],Dr=Math.min,Dt=Math.max,sa=Math.round,la=Math.floor,er=e=>({x:e,y:e}),zx={left:"right",right:"left",bottom:"top",top:"bottom"},Bx={start:"end",end:"start"};function Hl(e,t,r){return Dt(e,Dr(t,r))}function ur(e,t){return typeof e=="function"?e(t):e}function pr(e){return e.split("-")[0]}function go(e){return e.split("-")[1]}function jl(e){return e==="x"?"y":"x"}function Yl(e){return e==="y"?"height":"width"}const Ux=new Set(["top","bottom"]);function tr(e){return Ux.has(pr(e))?"y":"x"}function ql(e){return jl(tr(e))}function Wx(e,t,r){r===void 0&&(r=!1);const o=go(e),n=ql(e),a=Yl(n);let l=n==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=ia(l)),[l,ia(l)]}function Hx(e){const t=ia(e);return[Ql(e),t,Ql(t)]}function Ql(e){return e.replace(/start|end/g,t=>Bx[t])}const Rd=["left","right"],eu=["right","left"],jx=["top","bottom"],Yx=["bottom","top"];function qx(e,t,r){switch(e){case"top":case"bottom":return r?t?eu:Rd:t?Rd:eu;case"left":case"right":return t?jx:Yx;default:return[]}}function Qx(e,t,r,o){const n=go(e);let a=qx(pr(e),r==="start",o);return n&&(a=a.map(l=>l+"-"+n),t&&(a=a.concat(a.map(Ql)))),a}function ia(e){return e.replace(/left|right|bottom|top/g,t=>zx[t])}function Kx(e){return{top:0,right:0,bottom:0,left:0,...e}}function tu(e){return typeof e!="number"?Kx(e):{top:e,right:e,bottom:e,left:e}}function ca(e){const{x:t,y:r,width:o,height:n}=e;return{width:o,height:n,top:r,left:t,right:t+o,bottom:r+n,x:t,y:r}}function ru(e,t,r){let{reference:o,floating:n}=e;const a=tr(t),l=ql(t),i=Yl(l),c=pr(t),d=a==="y",p=o.x+o.width/2-n.width/2,u=o.y+o.height/2-n.height/2,f=o[i]/2-n[i]/2;let h;switch(c){case"top":h={x:p,y:o.y-n.height};break;case"bottom":h={x:p,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:u};break;case"left":h={x:o.x-n.width,y:u};break;default:h={x:o.x,y:o.y}}switch(go(t)){case"start":h[l]-=f*(r&&d?-1:1);break;case"end":h[l]+=f*(r&&d?-1:1);break}return h}async function Xx(e,t){var r;t===void 0&&(t={});const{x:o,y:n,platform:a,rects:l,elements:i,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:u="floating",altBoundary:f=!1,padding:h=0}=ur(t,e),b=tu(h),y=i[f?u==="floating"?"reference":"floating":u],x=ca(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(y)))==null||r?y:y.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(i.floating)),boundary:d,rootBoundary:p,strategy:c})),v=u==="floating"?{x:o,y:n,width:l.floating.width,height:l.floating.height}:l.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(i.floating)),S=await(a.isElement==null?void 0:a.isElement(w))?await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1}:{x:1,y:1},E=ca(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:v,offsetParent:w,strategy:c}):v);return{top:(x.top-E.top+b.top)/S.y,bottom:(E.bottom-x.bottom+b.bottom)/S.y,left:(x.left-E.left+b.left)/S.x,right:(E.right-x.right+b.right)/S.x}}const Jx=async(e,t,r)=>{const{placement:o="bottom",strategy:n="absolute",middleware:a=[],platform:l}=r,i=a.filter(Boolean),c=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:n}),{x:p,y:u}=ru(d,o,c),f=o,h={},b=0;for(let y=0;y<i.length;y++){var g;const{name:x,fn:v}=i[y],{x:w,y:S,data:E,reset:N}=await v({x:p,y:u,initialPlacement:o,placement:f,strategy:n,middlewareData:h,rects:d,platform:{...l,detectOverflow:(g=l.detectOverflow)!=null?g:Xx},elements:{reference:e,floating:t}});p=w??p,u=S??u,h={...h,[x]:{...h[x],...E}},N&&b<=50&&(b++,typeof N=="object"&&(N.placement&&(f=N.placement),N.rects&&(d=N.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:n}):N.rects),{x:p,y:u}=ru(d,f,c)),y=-1)}return{x:p,y:u,placement:f,strategy:n,middlewareData:h}},Zx=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:o,placement:n,rects:a,platform:l,elements:i,middlewareData:c}=t,{element:d,padding:p=0}=ur(e,t)||{};if(d==null)return{};const u=tu(p),f={x:r,y:o},h=ql(n),b=Yl(h),g=await l.getDimensions(d),y=h==="y",x=y?"top":"left",v=y?"bottom":"right",w=y?"clientHeight":"clientWidth",S=a.reference[b]+a.reference[h]-f[h]-a.floating[b],E=f[h]-a.reference[h],N=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let T=N?N[w]:0;(!T||!await(l.isElement==null?void 0:l.isElement(N)))&&(T=i.floating[w]||a.floating[b]);const k=S/2-E/2,M=T/2-g[b]/2-1,D=Dr(u[x],M),U=Dr(u[v],M),$=D,F=T-g[b]-U,q=T/2-g[b]/2+k,R=Hl($,q,F),W=!c.arrow&&go(n)!=null&&q!==R&&a.reference[b]/2-(q<$?D:U)-g[b]/2<0,Q=W?q<$?q-$:q-F:0;return{[h]:f[h]+Q,data:{[h]:R,centerOffset:q-R-Q,...W&&{alignmentOffset:Q}},reset:W}}}),Rx=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,o;const{placement:n,middlewareData:a,rects:l,initialPlacement:i,platform:c,elements:d}=t,{mainAxis:p=!0,crossAxis:u=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:g=!0,...y}=ur(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const x=pr(n),v=tr(i),w=pr(i)===i,S=await(c.isRTL==null?void 0:c.isRTL(d.floating)),E=f||(w||!g?[ia(i)]:Hx(i)),N=b!=="none";!f&&N&&E.push(...Qx(i,g,b,S));const T=[i,...E],k=await c.detectOverflow(t,y),M=[];let D=((o=a.flip)==null?void 0:o.overflows)||[];if(p&&M.push(k[x]),u){const q=Wx(n,l,S);M.push(k[q[0]],k[q[1]])}if(D=[...D,{placement:n,overflows:M}],!M.every(q=>q<=0)){var U,$;const q=(((U=a.flip)==null?void 0:U.index)||0)+1,R=T[q];if(R&&(!(u==="alignment"?v!==tr(R):!1)||D.every(P=>tr(P.placement)===v?P.overflows[0]>0:!0)))return{data:{index:q,overflows:D},reset:{placement:R}};let W=($=D.filter(Q=>Q.overflows[0]<=0).sort((Q,P)=>Q.overflows[1]-P.overflows[1])[0])==null?void 0:$.placement;if(!W)switch(h){case"bestFit":{var F;const Q=(F=D.filter(P=>{if(N){const z=tr(P.placement);return z===v||z==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(z=>z>0).reduce((z,pe)=>z+pe,0)]).sort((P,z)=>P[1]-z[1])[0])==null?void 0:F[0];Q&&(W=Q);break}case"initialPlacement":W=i;break}if(n!==W)return{reset:{placement:W}}}return{}}}};function ou(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function nu(e){return Vx.some(t=>e[t]>=0)}const ew=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:o}=t,{strategy:n="referenceHidden",...a}=ur(e,t);switch(n){case"referenceHidden":{const l=await o.detectOverflow(t,{...a,elementContext:"reference"}),i=ou(l,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:nu(i)}}}case"escaped":{const l=await o.detectOverflow(t,{...a,altBoundary:!0}),i=ou(l,r.floating);return{data:{escapedOffsets:i,escaped:nu(i)}}}default:return{}}}}},au=new Set(["left","top"]);async function tw(e,t){const{placement:r,platform:o,elements:n}=e,a=await(o.isRTL==null?void 0:o.isRTL(n.floating)),l=pr(r),i=go(r),c=tr(r)==="y",d=au.has(l)?-1:1,p=a&&c?-1:1,u=ur(t,e);let{mainAxis:f,crossAxis:h,alignmentAxis:b}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&typeof b=="number"&&(h=i==="end"?b*-1:b),c?{x:h*p,y:f*d}:{x:f*d,y:h*p}}const rw=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,o;const{x:n,y:a,placement:l,middlewareData:i}=t,c=await tw(t,e);return l===((r=i.offset)==null?void 0:r.placement)&&(o=i.arrow)!=null&&o.alignmentOffset?{}:{x:n+c.x,y:a+c.y,data:{...c,placement:l}}}}},ow=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:o,placement:n,platform:a}=t,{mainAxis:l=!0,crossAxis:i=!1,limiter:c={fn:x=>{let{x:v,y:w}=x;return{x:v,y:w}}},...d}=ur(e,t),p={x:r,y:o},u=await a.detectOverflow(t,d),f=tr(pr(n)),h=jl(f);let b=p[h],g=p[f];if(l){const x=h==="y"?"top":"left",v=h==="y"?"bottom":"right",w=b+u[x],S=b-u[v];b=Hl(w,b,S)}if(i){const x=f==="y"?"top":"left",v=f==="y"?"bottom":"right",w=g+u[x],S=g-u[v];g=Hl(w,g,S)}const y=c.fn({...t,[h]:b,[f]:g});return{...y,data:{x:y.x-r,y:y.y-o,enabled:{[h]:l,[f]:i}}}}}},nw=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:o,placement:n,rects:a,middlewareData:l}=t,{offset:i=0,mainAxis:c=!0,crossAxis:d=!0}=ur(e,t),p={x:r,y:o},u=tr(n),f=jl(u);let h=p[f],b=p[u];const g=ur(i,t),y=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const w=f==="y"?"height":"width",S=a.reference[f]-a.floating[w]+y.mainAxis,E=a.reference[f]+a.reference[w]-y.mainAxis;h<S?h=S:h>E&&(h=E)}if(d){var x,v;const w=f==="y"?"width":"height",S=au.has(pr(n)),E=a.reference[u]-a.floating[w]+(S&&((x=l.offset)==null?void 0:x[u])||0)+(S?0:y.crossAxis),N=a.reference[u]+a.reference[w]+(S?0:((v=l.offset)==null?void 0:v[u])||0)-(S?y.crossAxis:0);b<E?b=E:b>N&&(b=N)}return{[f]:h,[u]:b}}}},aw=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,o;const{placement:n,rects:a,platform:l,elements:i}=t,{apply:c=()=>{},...d}=ur(e,t),p=await l.detectOverflow(t,d),u=pr(n),f=go(n),h=tr(n)==="y",{width:b,height:g}=a.floating;let y,x;u==="top"||u==="bottom"?(y=u,x=f===(await(l.isRTL==null?void 0:l.isRTL(i.floating))?"start":"end")?"left":"right"):(x=u,y=f==="end"?"top":"bottom");const v=g-p.top-p.bottom,w=b-p.left-p.right,S=Dr(g-p[y],v),E=Dr(b-p[x],w),N=!t.middlewareData.shift;let T=S,k=E;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(k=w),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(T=v),N&&!f){const D=Dt(p.left,0),U=Dt(p.right,0),$=Dt(p.top,0),F=Dt(p.bottom,0);h?k=b-2*(D!==0||U!==0?D+U:Dt(p.left,p.right)):T=g-2*($!==0||F!==0?$+F:Dt(p.top,p.bottom))}await c({...t,availableWidth:k,availableHeight:T});const M=await l.getDimensions(i.floating);return b!==M.width||g!==M.height?{reset:{rects:!0}}:{}}}};function da(){return typeof window<"u"}function bo(e){return su(e)?(e.nodeName||"").toLowerCase():"#document"}function At(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function rr(e){var t;return(t=(su(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function su(e){return da()?e instanceof Node||e instanceof At(e).Node:!1}function Wt(e){return da()?e instanceof Element||e instanceof At(e).Element:!1}function or(e){return da()?e instanceof HTMLElement||e instanceof At(e).HTMLElement:!1}function lu(e){return!da()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof At(e).ShadowRoot}const sw=new Set(["inline","contents"]);function Xo(e){const{overflow:t,overflowX:r,overflowY:o,display:n}=Ht(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+r)&&!sw.has(n)}const lw=new Set(["table","td","th"]);function iw(e){return lw.has(bo(e))}const cw=[":popover-open",":modal"];function ua(e){return cw.some(t=>{try{return e.matches(t)}catch{return!1}})}const dw=["transform","translate","scale","rotate","perspective"],uw=["transform","translate","scale","rotate","perspective","filter"],pw=["paint","layout","strict","content"];function Kl(e){const t=Xl(),r=Wt(e)?Ht(e):e;return dw.some(o=>r[o]?r[o]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||uw.some(o=>(r.willChange||"").includes(o))||pw.some(o=>(r.contain||"").includes(o))}function fw(e){let t=Ar(e);for(;or(t)&&!yo(t);){if(Kl(t))return t;if(ua(t))return null;t=Ar(t)}return null}function Xl(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const hw=new Set(["html","body","#document"]);function yo(e){return hw.has(bo(e))}function Ht(e){return At(e).getComputedStyle(e)}function pa(e){return Wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ar(e){if(bo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||lu(e)&&e.host||rr(e);return lu(t)?t.host:t}function iu(e){const t=Ar(e);return yo(t)?e.ownerDocument?e.ownerDocument.body:e.body:or(t)&&Xo(t)?t:iu(t)}function Jo(e,t,r){var o;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=iu(e),a=n===((o=e.ownerDocument)==null?void 0:o.body),l=At(n);if(a){const i=Jl(l);return t.concat(l,l.visualViewport||[],Xo(n)?n:[],i&&r?Jo(i):[])}return t.concat(n,Jo(n,[],r))}function Jl(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cu(e){const t=Ht(e);let r=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const n=or(e),a=n?e.offsetWidth:r,l=n?e.offsetHeight:o,i=sa(r)!==a||sa(o)!==l;return i&&(r=a,o=l),{width:r,height:o,$:i}}function Zl(e){return Wt(e)?e:e.contextElement}function vo(e){const t=Zl(e);if(!or(t))return er(1);const r=t.getBoundingClientRect(),{width:o,height:n,$:a}=cu(t);let l=(a?sa(r.width):r.width)/o,i=(a?sa(r.height):r.height)/n;return(!l||!Number.isFinite(l))&&(l=1),(!i||!Number.isFinite(i))&&(i=1),{x:l,y:i}}const mw=er(0);function du(e){const t=At(e);return!Xl()||!t.visualViewport?mw:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gw(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==At(e)?!1:t}function Kr(e,t,r,o){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),a=Zl(e);let l=er(1);t&&(o?Wt(o)&&(l=vo(o)):l=vo(e));const i=gw(a,r,o)?du(a):er(0);let c=(n.left+i.x)/l.x,d=(n.top+i.y)/l.y,p=n.width/l.x,u=n.height/l.y;if(a){const f=At(a),h=o&&Wt(o)?At(o):o;let b=f,g=Jl(b);for(;g&&o&&h!==b;){const y=vo(g),x=g.getBoundingClientRect(),v=Ht(g),w=x.left+(g.clientLeft+parseFloat(v.paddingLeft))*y.x,S=x.top+(g.clientTop+parseFloat(v.paddingTop))*y.y;c*=y.x,d*=y.y,p*=y.x,u*=y.y,c+=w,d+=S,b=At(g),g=Jl(b)}}return ca({width:p,height:u,x:c,y:d})}function fa(e,t){const r=pa(e).scrollLeft;return t?t.left+r:Kr(rr(e)).left+r}function uu(e,t){const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-fa(e,r),n=r.top+t.scrollTop;return{x:o,y:n}}function bw(e){let{elements:t,rect:r,offsetParent:o,strategy:n}=e;const a=n==="fixed",l=rr(o),i=t?ua(t.floating):!1;if(o===l||i&&a)return r;let c={scrollLeft:0,scrollTop:0},d=er(1);const p=er(0),u=or(o);if((u||!u&&!a)&&((bo(o)!=="body"||Xo(l))&&(c=pa(o)),or(o))){const h=Kr(o);d=vo(o),p.x=h.x+o.clientLeft,p.y=h.y+o.clientTop}const f=l&&!u&&!a?uu(l,c):er(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+p.x+f.x,y:r.y*d.y-c.scrollTop*d.y+p.y+f.y}}function yw(e){return Array.from(e.getClientRects())}function vw(e){const t=rr(e),r=pa(e),o=e.ownerDocument.body,n=Dt(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),a=Dt(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-r.scrollLeft+fa(e);const i=-r.scrollTop;return Ht(o).direction==="rtl"&&(l+=Dt(t.clientWidth,o.clientWidth)-n),{width:n,height:a,x:l,y:i}}const pu=25;function xw(e,t){const r=At(e),o=rr(e),n=r.visualViewport;let a=o.clientWidth,l=o.clientHeight,i=0,c=0;if(n){a=n.width,l=n.height;const p=Xl();(!p||p&&t==="fixed")&&(i=n.offsetLeft,c=n.offsetTop)}const d=fa(o);if(d<=0){const p=o.ownerDocument,u=p.body,f=getComputedStyle(u),h=p.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,b=Math.abs(o.clientWidth-u.clientWidth-h);b<=pu&&(a-=b)}else d<=pu&&(a+=d);return{width:a,height:l,x:i,y:c}}const ww=new Set(["absolute","fixed"]);function Sw(e,t){const r=Kr(e,!0,t==="fixed"),o=r.top+e.clientTop,n=r.left+e.clientLeft,a=or(e)?vo(e):er(1),l=e.clientWidth*a.x,i=e.clientHeight*a.y,c=n*a.x,d=o*a.y;return{width:l,height:i,x:c,y:d}}function fu(e,t,r){let o;if(t==="viewport")o=xw(e,r);else if(t==="document")o=vw(rr(e));else if(Wt(t))o=Sw(t,r);else{const n=du(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ca(o)}function hu(e,t){const r=Ar(e);return r===t||!Wt(r)||yo(r)?!1:Ht(r).position==="fixed"||hu(r,t)}function Cw(e,t){const r=t.get(e);if(r)return r;let o=Jo(e,[],!1).filter(i=>Wt(i)&&bo(i)!=="body"),n=null;const a=Ht(e).position==="fixed";let l=a?Ar(e):e;for(;Wt(l)&&!yo(l);){const i=Ht(l),c=Kl(l);!c&&i.position==="fixed"&&(n=null),(a?!c&&!n:!c&&i.position==="static"&&!!n&&ww.has(n.position)||Xo(l)&&!c&&hu(e,l))?o=o.filter(p=>p!==l):n=i,l=Ar(l)}return t.set(e,o),o}function Nw(e){let{element:t,boundary:r,rootBoundary:o,strategy:n}=e;const l=[...r==="clippingAncestors"?ua(t)?[]:Cw(t,this._c):[].concat(r),o],i=l[0],c=l.reduce((d,p)=>{const u=fu(t,p,n);return d.top=Dt(u.top,d.top),d.right=Dr(u.right,d.right),d.bottom=Dr(u.bottom,d.bottom),d.left=Dt(u.left,d.left),d},fu(t,i,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Ew(e){const{width:t,height:r}=cu(e);return{width:t,height:r}}function kw(e,t,r){const o=or(t),n=rr(t),a=r==="fixed",l=Kr(e,!0,a,t);let i={scrollLeft:0,scrollTop:0};const c=er(0);function d(){c.x=fa(n)}if(o||!o&&!a)if((bo(t)!=="body"||Xo(n))&&(i=pa(t)),o){const h=Kr(t,!0,a,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else n&&d();a&&!o&&n&&d();const p=n&&!o&&!a?uu(n,i):er(0),u=l.left+i.scrollLeft-c.x-p.x,f=l.top+i.scrollTop-c.y-p.y;return{x:u,y:f,width:l.width,height:l.height}}function Rl(e){return Ht(e).position==="static"}function mu(e,t){if(!or(e)||Ht(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return rr(e)===r&&(r=r.ownerDocument.body),r}function gu(e,t){const r=At(e);if(ua(e))return r;if(!or(e)){let n=Ar(e);for(;n&&!yo(n);){if(Wt(n)&&!Rl(n))return n;n=Ar(n)}return r}let o=mu(e,t);for(;o&&iw(o)&&Rl(o);)o=mu(o,t);return o&&yo(o)&&Rl(o)&&!Kl(o)?r:o||fw(e)||r}const _w=async function(e){const t=this.getOffsetParent||gu,r=this.getDimensions,o=await r(e.floating);return{reference:kw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Dw(e){return Ht(e).direction==="rtl"}const Aw={convertOffsetParentRelativeRectToViewportRelativeRect:bw,getDocumentElement:rr,getClippingRect:Nw,getOffsetParent:gu,getElementRects:_w,getClientRects:yw,getDimensions:Ew,getScale:vo,isElement:Wt,isRTL:Dw};function bu(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Tw(e,t){let r=null,o;const n=rr(e);function a(){var i;clearTimeout(o),(i=r)==null||i.disconnect(),r=null}function l(i,c){i===void 0&&(i=!1),c===void 0&&(c=1),a();const d=e.getBoundingClientRect(),{left:p,top:u,width:f,height:h}=d;if(i||t(),!f||!h)return;const b=la(u),g=la(n.clientWidth-(p+f)),y=la(n.clientHeight-(u+h)),x=la(p),w={rootMargin:-b+"px "+-g+"px "+-y+"px "+-x+"px",threshold:Dt(0,Dr(1,c))||1};let S=!0;function E(N){const T=N[0].intersectionRatio;if(T!==c){if(!S)return l();T?l(!1,T):o=setTimeout(()=>{l(!1,1e-7)},1e3)}T===1&&!bu(d,e.getBoundingClientRect())&&l(),S=!1}try{r=new IntersectionObserver(E,{...w,root:n.ownerDocument})}catch{r=new IntersectionObserver(E,w)}r.observe(e)}return l(!0),a}function Mw(e,t,r,o){o===void 0&&(o={});const{ancestorScroll:n=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,d=Zl(e),p=n||a?[...d?Jo(d):[],...Jo(t)]:[];p.forEach(x=>{n&&x.addEventListener("scroll",r,{passive:!0}),a&&x.addEventListener("resize",r)});const u=d&&i?Tw(d,r):null;let f=-1,h=null;l&&(h=new ResizeObserver(x=>{let[v]=x;v&&v.target===d&&h&&(h.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(t)})),r()}),d&&!c&&h.observe(d),h.observe(t));let b,g=c?Kr(e):null;c&&y();function y(){const x=Kr(e);g&&!bu(g,x)&&r(),g=x,b=requestAnimationFrame(y)}return r(),()=>{var x;p.forEach(v=>{n&&v.removeEventListener("scroll",r),a&&v.removeEventListener("resize",r)}),u==null||u(),(x=h)==null||x.disconnect(),h=null,c&&cancelAnimationFrame(b)}}const Iw=rw,Pw=ow,Ow=Rx,$w=aw,Lw=ew,yu=Zx,Fw=nw,Gw=(e,t,r)=>{const o=new Map,n={platform:Aw,...r},a={...n.platform,_c:o};return Jx(e,t,{...n,platform:a})};var Vw=typeof document<"u",zw=function(){},ha=Vw?C.useLayoutEffect:zw;function ma(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,o,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(o=r;o--!==0;)if(!ma(e[o],t[o]))return!1;return!0}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return!1;for(o=r;o--!==0;)if(!{}.hasOwnProperty.call(t,n[o]))return!1;for(o=r;o--!==0;){const a=n[o];if(!(a==="_owner"&&e.$$typeof)&&!ma(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function vu(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xu(e,t){const r=vu(e);return Math.round(t*r)/r}function ei(e){const t=m.useRef(e);return ha(()=>{t.current=e}),t}function Bw(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:o=[],platform:n,elements:{reference:a,floating:l}={},transform:i=!0,whileElementsMounted:c,open:d}=e,[p,u]=m.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[f,h]=m.useState(o);ma(f,o)||h(o);const[b,g]=m.useState(null),[y,x]=m.useState(null),v=m.useCallback(P=>{P!==N.current&&(N.current=P,g(P))},[]),w=m.useCallback(P=>{P!==T.current&&(T.current=P,x(P))},[]),S=a||b,E=l||y,N=m.useRef(null),T=m.useRef(null),k=m.useRef(p),M=c!=null,D=ei(c),U=ei(n),$=ei(d),F=m.useCallback(()=>{if(!N.current||!T.current)return;const P={placement:t,strategy:r,middleware:f};U.current&&(P.platform=U.current),Gw(N.current,T.current,P).then(z=>{const pe={...z,isPositioned:$.current!==!1};q.current&&!ma(k.current,pe)&&(k.current=pe,Qn.flushSync(()=>{u(pe)}))})},[f,t,r,U,$]);ha(()=>{d===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,u(P=>({...P,isPositioned:!1})))},[d]);const q=m.useRef(!1);ha(()=>(q.current=!0,()=>{q.current=!1}),[]),ha(()=>{if(S&&(N.current=S),E&&(T.current=E),S&&E){if(D.current)return D.current(S,E,F);F()}},[S,E,F,D,M]);const R=m.useMemo(()=>({reference:N,floating:T,setReference:v,setFloating:w}),[v,w]),W=m.useMemo(()=>({reference:S,floating:E}),[S,E]),Q=m.useMemo(()=>{const P={position:r,left:0,top:0};if(!W.floating)return P;const z=xu(W.floating,p.x),pe=xu(W.floating,p.y);return i?{...P,transform:"translate("+z+"px, "+pe+"px)",...vu(W.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:z,top:pe}},[r,i,W.floating,p.x,p.y]);return m.useMemo(()=>({...p,update:F,refs:R,elements:W,floatingStyles:Q}),[p,F,R,W,Q])}const Uw=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:o,padding:n}=typeof e=="function"?e(r):e;return o&&t(o)?o.current!=null?yu({element:o.current,padding:n}).fn(r):{}:o?yu({element:o,padding:n}).fn(r):{}}}},Ww=(e,t)=>({...Iw(e),options:[e,t]}),Hw=(e,t)=>({...Pw(e),options:[e,t]}),jw=(e,t)=>({...Fw(e),options:[e,t]}),Yw=(e,t)=>({...Ow(e),options:[e,t]}),qw=(e,t)=>({...$w(e),options:[e,t]}),Qw=(e,t)=>({...Lw(e),options:[e,t]}),Kw=(e,t)=>({...Uw(e),options:[e,t]});var Xw="Arrow",wu=m.forwardRef((e,t)=>{const{children:r,width:o=10,height:n=5,...a}=e;return s.jsx(Ne.svg,{...a,ref:t,width:o,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:s.jsx("polygon",{points:"0,0 30,0 15,10"})})});wu.displayName=Xw;var Jw=wu;function Su(e){const[t,r]=m.useState(void 0);return it(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const a=n[0];let l,i;if("borderBoxSize"in a){const c=a.borderBoxSize,d=Array.isArray(c)?c[0]:c;l=d.inlineSize,i=d.blockSize}else l=e.offsetWidth,i=e.offsetHeight;r({width:l,height:i})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else r(void 0)},[e]),t}var ti="Popper",[Cu,ga]=dr(ti),[Zw,Nu]=Cu(ti),Eu=e=>{const{__scopePopper:t,children:r}=e,[o,n]=m.useState(null);return s.jsx(Zw,{scope:t,anchor:o,onAnchorChange:n,children:r})};Eu.displayName=ti;var ku="PopperAnchor",_u=m.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:o,...n}=e,a=Nu(ku,r),l=m.useRef(null),i=Fe(t,l),c=m.useRef(null);return m.useEffect(()=>{const d=c.current;c.current=(o==null?void 0:o.current)||l.current,d!==c.current&&a.onAnchorChange(c.current)}),o?null:s.jsx(Ne.div,{...n,ref:i})});_u.displayName=ku;var ri="PopperContent",[Rw,e0]=Cu(ri),Du=m.forwardRef((e,t)=>{var X,se,ve,le,H,j;const{__scopePopper:r,side:o="bottom",sideOffset:n=0,align:a="center",alignOffset:l=0,arrowPadding:i=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:p=0,sticky:u="partial",hideWhenDetached:f=!1,updatePositionStrategy:h="optimized",onPlaced:b,...g}=e,y=Nu(ri,r),[x,v]=m.useState(null),w=Fe(t,ce=>v(ce)),[S,E]=m.useState(null),N=Su(S),T=(N==null?void 0:N.width)??0,k=(N==null?void 0:N.height)??0,M=o+(a!=="center"?"-"+a:""),D=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},U=Array.isArray(d)?d:[d],$=U.length>0,F={padding:D,boundary:U.filter(r0),altBoundary:$},{refs:q,floatingStyles:R,placement:W,isPositioned:Q,middlewareData:P}=Bw({strategy:"fixed",placement:M,whileElementsMounted:(...ce)=>Mw(...ce,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[Ww({mainAxis:n+k,alignmentAxis:l}),c&&Hw({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?jw():void 0,...F}),c&&Yw({...F}),qw({...F,apply:({elements:ce,rects:Ee,availableWidth:Se,availableHeight:ze})=>{const{width:Ye,height:We}=Ee.reference,Re=ce.floating.style;Re.setProperty("--radix-popper-available-width",`${Se}px`),Re.setProperty("--radix-popper-available-height",`${ze}px`),Re.setProperty("--radix-popper-anchor-width",`${Ye}px`),Re.setProperty("--radix-popper-anchor-height",`${We}px`)}}),S&&Kw({element:S,padding:i}),o0({arrowWidth:T,arrowHeight:k}),f&&Qw({strategy:"referenceHidden",...F})]}),[z,pe]=Mu(W),ge=Er(b);it(()=>{Q&&(ge==null||ge())},[Q,ge]);const L=(X=P.arrow)==null?void 0:X.x,Y=(se=P.arrow)==null?void 0:se.y,te=((ve=P.arrow)==null?void 0:ve.centerOffset)!==0,[fe,K]=m.useState();return it(()=>{x&&K(window.getComputedStyle(x).zIndex)},[x]),s.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...R,transform:Q?R.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[(le=P.transformOrigin)==null?void 0:le.x,(H=P.transformOrigin)==null?void 0:H.y].join(" "),...((j=P.hide)==null?void 0:j.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(Rw,{scope:r,placedSide:z,onArrowChange:E,arrowX:L,arrowY:Y,shouldHideArrow:te,children:s.jsx(Ne.div,{"data-side":z,"data-align":pe,...g,ref:w,style:{...g.style,animation:Q?void 0:"none"}})})})});Du.displayName=ri;var Au="PopperArrow",t0={top:"bottom",right:"left",bottom:"top",left:"right"},Tu=m.forwardRef(function(t,r){const{__scopePopper:o,...n}=t,a=e0(Au,o),l=t0[a.placedSide];return s.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:s.jsx(Jw,{...n,ref:r,style:{...n.style,display:"block"}})})});Tu.displayName=Au;function r0(e){return e!==null}var o0=e=>({name:"transformOrigin",options:e,fn(t){var y,x,v;const{placement:r,rects:o,middlewareData:n}=t,l=((y=n.arrow)==null?void 0:y.centerOffset)!==0,i=l?0:e.arrowWidth,c=l?0:e.arrowHeight,[d,p]=Mu(r),u={start:"0%",center:"50%",end:"100%"}[p],f=(((x=n.arrow)==null?void 0:x.x)??0)+i/2,h=(((v=n.arrow)==null?void 0:v.y)??0)+c/2;let b="",g="";return d==="bottom"?(b=l?u:`${f}px`,g=`${-c}px`):d==="top"?(b=l?u:`${f}px`,g=`${o.floating.height+c}px`):d==="right"?(b=`${-c}px`,g=l?u:`${h}px`):d==="left"&&(b=`${o.floating.width+c}px`,g=l?u:`${h}px`),{data:{x:b,y:g}}}});function Mu(e){const[t,r="center"]=e.split("-");return[t,r]}var Iu=Eu,Pu=_u,Ou=Du,$u=Tu,n0="Portal",oi=m.forwardRef((e,t)=>{var i;const{container:r,...o}=e,[n,a]=m.useState(!1);it(()=>a(!0),[]);const l=r||n&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return l?bd.createPortal(s.jsx(Ne.div,{...o,ref:t}),l):null});oi.displayName=n0;function a0(e){const t=s0(e),r=m.forwardRef((o,n)=>{const{children:a,...l}=o,i=m.Children.toArray(a),c=i.find(i0);if(c){const d=c.props.children,p=i.map(u=>u===c?m.Children.count(d)>1?m.Children.only(null):m.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...l,ref:n,children:m.isValidElement(d)?m.cloneElement(d,void 0,p):null})}return s.jsx(t,{...l,ref:n,children:a})});return r.displayName=`${e}.Slot`,r}function s0(e){const t=m.forwardRef((r,o)=>{const{children:n,...a}=r;if(m.isValidElement(n)){const l=d0(n),i=c0(a,n.props);return n.type!==m.Fragment&&(i.ref=o?Ko(o,l):l),m.cloneElement(n,i)}return m.Children.count(n)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var l0=Symbol("radix.slottable");function i0(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===l0}function c0(e,t){const r={...t};for(const o in t){const n=e[o],a=t[o];/^on[A-Z]/.test(o)?n&&a?r[o]=(...i)=>{const c=a(...i);return n(...i),c}:n&&(r[o]=n):o==="style"?r[o]={...n,...a}:o==="className"&&(r[o]=[n,a].filter(Boolean).join(" "))}return{...e,...r}}function d0(e){var o,n;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var u0=m[" useInsertionEffect ".trim().toString()]||it;function fr({prop:e,defaultProp:t,onChange:r=()=>{},caller:o}){const[n,a,l]=p0({defaultProp:t,onChange:r}),i=e!==void 0,c=i?e:n;{const p=m.useRef(e!==void 0);m.useEffect(()=>{const u=p.current;u!==i&&console.warn(`${o} is changing from ${u?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=i},[i,o])}const d=m.useCallback(p=>{var u;if(i){const f=f0(p)?p(e):p;f!==e&&((u=l.current)==null||u.call(l,f))}else a(p)},[i,e,a,l]);return[c,d]}function p0({defaultProp:e,onChange:t}){const[r,o]=m.useState(e),n=m.useRef(r),a=m.useRef(t);return u0(()=>{a.current=t},[t]),m.useEffect(()=>{var l;n.current!==r&&((l=a.current)==null||l.call(a,r),n.current=r)},[r,n]),[r,o,a]}function f0(e){return typeof e=="function"}function Lu(e){const t=m.useRef({value:e,previous:e});return m.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Fu=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),h0="VisuallyHidden",Gu=m.forwardRef((e,t)=>s.jsx(Ne.span,{...e,ref:t,style:{...Fu,...e.style}}));Gu.displayName=h0;var m0=Gu,g0=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},xo=new WeakMap,ba=new WeakMap,ya={},ni=0,Vu=function(e){return e&&(e.host||Vu(e.parentNode))},b0=function(e,t){return t.map(function(r){if(e.contains(r))return r;var o=Vu(r);return o&&e.contains(o)?o:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},y0=function(e,t,r,o){var n=b0(t,Array.isArray(e)?e:[e]);ya[r]||(ya[r]=new WeakMap);var a=ya[r],l=[],i=new Set,c=new Set(n),d=function(u){!u||i.has(u)||(i.add(u),d(u.parentNode))};n.forEach(d);var p=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(f){if(i.has(f))p(f);else try{var h=f.getAttribute(o),b=h!==null&&h!=="false",g=(xo.get(f)||0)+1,y=(a.get(f)||0)+1;xo.set(f,g),a.set(f,y),l.push(f),g===1&&b&&ba.set(f,!0),y===1&&f.setAttribute(r,"true"),b||f.setAttribute(o,"true")}catch(x){console.error("aria-hidden: cannot operate on ",f,x)}})};return p(t),i.clear(),ni++,function(){l.forEach(function(u){var f=xo.get(u)-1,h=a.get(u)-1;xo.set(u,f),a.set(u,h),f||(ba.has(u)||u.removeAttribute(o),ba.delete(u)),h||u.removeAttribute(r)}),ni--,ni||(xo=new WeakMap,xo=new WeakMap,ba=new WeakMap,ya={})}},v0=function(e,t,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),n=g0(e);return n?(o.push.apply(o,Array.from(n.querySelectorAll("[aria-live], script"))),y0(o,n,r,"aria-hidden")):function(){return null}},nr=function(){return nr=Object.assign||function(t){for(var r,o=1,n=arguments.length;o<n;o++){r=arguments[o];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},nr.apply(this,arguments)};function zu(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function x0(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,a;o<n;o++)(a||!(o in t))&&(a||(a=Array.prototype.slice.call(t,0,o)),a[o]=t[o]);return e.concat(a||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var va="right-scroll-bar-position",xa="width-before-scroll-bar",w0="with-scroll-bars-hidden",S0="--removed-body-scroll-bar-size";function ai(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function C0(e,t){var r=C.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(o){var n=r.value;n!==o&&(r.value=o,r.callback(o,n))}}}})[0];return r.callback=t,r.facade}var N0=typeof window<"u"?m.useLayoutEffect:m.useEffect,Bu=new WeakMap;function E0(e,t){var r=C0(null,function(o){return e.forEach(function(n){return ai(n,o)})});return N0(function(){var o=Bu.get(r);if(o){var n=new Set(o),a=new Set(e),l=r.current;n.forEach(function(i){a.has(i)||ai(i,null)}),a.forEach(function(i){n.has(i)||ai(i,l)})}Bu.set(r,e)},[e]),r}function k0(e){return e}function _0(e,t){t===void 0&&(t=k0);var r=[],o=!1,n={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(a){var l=t(a,o);return r.push(l),function(){r=r.filter(function(i){return i!==l})}},assignSyncMedium:function(a){for(o=!0;r.length;){var l=r;r=[],l.forEach(a)}r={push:function(i){return a(i)},filter:function(){return r}}},assignMedium:function(a){o=!0;var l=[];if(r.length){var i=r;r=[],i.forEach(a),l=r}var c=function(){var p=l;l=[],p.forEach(a)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(p){l.push(p),d()},filter:function(p){return l=l.filter(p),r}}}};return n}function D0(e){e===void 0&&(e={});var t=_0(null);return t.options=nr({async:!0,ssr:!1},e),t}var Uu=function(e){var t=e.sideCar,r=zu(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw new Error("Sidecar medium not found");return m.createElement(o,nr({},r))};Uu.isSideCarExport=!0;function A0(e,t){return e.useMedium(t),Uu}var Wu=D0(),si=function(){},wa=m.forwardRef(function(e,t){var r=m.useRef(null),o=m.useState({onScrollCapture:si,onWheelCapture:si,onTouchMoveCapture:si}),n=o[0],a=o[1],l=e.forwardProps,i=e.children,c=e.className,d=e.removeScrollBar,p=e.enabled,u=e.shards,f=e.sideCar,h=e.noRelative,b=e.noIsolation,g=e.inert,y=e.allowPinchZoom,x=e.as,v=x===void 0?"div":x,w=e.gapMode,S=zu(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=f,N=E0([r,t]),T=nr(nr({},S),n);return m.createElement(m.Fragment,null,p&&m.createElement(E,{sideCar:Wu,removeScrollBar:d,shards:u,noRelative:h,noIsolation:b,inert:g,setCallbacks:a,allowPinchZoom:!!y,lockRef:r,gapMode:w}),l?m.cloneElement(m.Children.only(i),nr(nr({},T),{ref:N})):m.createElement(v,nr({},T,{className:c,ref:N}),i))});wa.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},wa.classNames={fullWidth:xa,zeroRight:va};var T0=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function M0(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=T0();return t&&e.setAttribute("nonce",t),e}function I0(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function P0(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var O0=function(){var e=0,t=null;return{add:function(r){e==0&&(t=M0())&&(I0(t,r),P0(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},$0=function(){var e=O0();return function(t,r){m.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Hu=function(){var e=$0(),t=function(r){var o=r.styles,n=r.dynamic;return e(o,n),null};return t},L0={left:0,top:0,right:0,gap:0},li=function(e){return parseInt(e||"",10)||0},F0=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],n=t[e==="padding"?"paddingRight":"marginRight"];return[li(r),li(o),li(n)]},G0=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return L0;var t=F0(e),r=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-r+t[2]-t[0])}},V0=Hu(),wo="data-scroll-locked",z0=function(e,t,r,o){var n=e.left,a=e.top,l=e.right,i=e.gap;return r===void 0&&(r="margin"),`
2
+ .`.concat(w0,` {
3
+ overflow: hidden `).concat(o,`;
4
+ padding-right: `).concat(i,"px ").concat(o,`;
5
+ }
6
+ body[`).concat(wo,`] {
7
+ overflow: hidden `).concat(o,`;
8
+ overscroll-behavior: contain;
9
+ `).concat([t&&"position: relative ".concat(o,";"),r==="margin"&&`
10
+ padding-left: `.concat(n,`px;
11
+ padding-top: `).concat(a,`px;
12
+ padding-right: `).concat(l,`px;
13
+ margin-left:0;
14
+ margin-top:0;
15
+ margin-right: `).concat(i,"px ").concat(o,`;
16
+ `),r==="padding"&&"padding-right: ".concat(i,"px ").concat(o,";")].filter(Boolean).join(""),`
17
+ }
18
+
19
+ .`).concat(va,` {
20
+ right: `).concat(i,"px ").concat(o,`;
21
+ }
22
+
23
+ .`).concat(xa,` {
24
+ margin-right: `).concat(i,"px ").concat(o,`;
25
+ }
26
+
27
+ .`).concat(va," .").concat(va,` {
28
+ right: 0 `).concat(o,`;
29
+ }
30
+
31
+ .`).concat(xa," .").concat(xa,` {
32
+ margin-right: 0 `).concat(o,`;
33
+ }
34
+
35
+ body[`).concat(wo,`] {
36
+ `).concat(S0,": ").concat(i,`px;
37
+ }
38
+ `)},ju=function(){var e=parseInt(document.body.getAttribute(wo)||"0",10);return isFinite(e)?e:0},B0=function(){m.useEffect(function(){return document.body.setAttribute(wo,(ju()+1).toString()),function(){var e=ju()-1;e<=0?document.body.removeAttribute(wo):document.body.setAttribute(wo,e.toString())}},[])},U0=function(e){var t=e.noRelative,r=e.noImportant,o=e.gapMode,n=o===void 0?"margin":o;B0();var a=m.useMemo(function(){return G0(n)},[n]);return m.createElement(V0,{styles:z0(a,!t,n,r?"":"!important")})},ii=!1;if(typeof window<"u")try{var Sa=Object.defineProperty({},"passive",{get:function(){return ii=!0,!0}});window.addEventListener("test",Sa,Sa),window.removeEventListener("test",Sa,Sa)}catch{ii=!1}var So=ii?{passive:!1}:!1,W0=function(e){return e.tagName==="TEXTAREA"},Yu=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!W0(e)&&r[t]==="visible")},H0=function(e){return Yu(e,"overflowY")},j0=function(e){return Yu(e,"overflowX")},qu=function(e,t){var r=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var n=Qu(e,o);if(n){var a=Ku(e,o),l=a[1],i=a[2];if(l>i)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},Y0=function(e){var t=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[t,r,o]},q0=function(e){var t=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[t,r,o]},Qu=function(e,t){return e==="v"?H0(t):j0(t)},Ku=function(e,t){return e==="v"?Y0(t):q0(t)},Q0=function(e,t){return e==="h"&&t==="rtl"?-1:1},K0=function(e,t,r,o,n){var a=Q0(e,window.getComputedStyle(t).direction),l=a*o,i=r.target,c=t.contains(i),d=!1,p=l>0,u=0,f=0;do{if(!i)break;var h=Ku(e,i),b=h[0],g=h[1],y=h[2],x=g-y-a*b;(b||x)&&Qu(e,i)&&(u+=x,f+=b);var v=i.parentNode;i=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&i!==document.body||c&&(t.contains(i)||t===i));return(p&&Math.abs(u)<1||!p&&Math.abs(f)<1)&&(d=!0),d},Ca=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Xu=function(e){return[e.deltaX,e.deltaY]},Ju=function(e){return e&&"current"in e?e.current:e},X0=function(e,t){return e[0]===t[0]&&e[1]===t[1]},J0=function(e){return`
39
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
40
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
41
+ `)},Z0=0,Co=[];function R0(e){var t=m.useRef([]),r=m.useRef([0,0]),o=m.useRef(),n=m.useState(Z0++)[0],a=m.useState(Hu)[0],l=m.useRef(e);m.useEffect(function(){l.current=e},[e]),m.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var g=x0([e.lockRef.current],(e.shards||[]).map(Ju),!0).filter(Boolean);return g.forEach(function(y){return y.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),g.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var i=m.useCallback(function(g,y){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!l.current.allowPinchZoom;var x=Ca(g),v=r.current,w="deltaX"in g?g.deltaX:v[0]-x[0],S="deltaY"in g?g.deltaY:v[1]-x[1],E,N=g.target,T=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in g&&T==="h"&&N.type==="range")return!1;var k=window.getSelection(),M=k&&k.anchorNode,D=M?M===N||M.contains(N):!1;if(D)return!1;var U=qu(T,N);if(!U)return!0;if(U?E=T:(E=T==="v"?"h":"v",U=qu(T,N)),!U)return!1;if(!o.current&&"changedTouches"in g&&(w||S)&&(o.current=E),!E)return!0;var $=o.current||E;return K0($,y,g,$==="h"?w:S)},[]),c=m.useCallback(function(g){var y=g;if(!(!Co.length||Co[Co.length-1]!==a)){var x="deltaY"in y?Xu(y):Ca(y),v=t.current.filter(function(E){return E.name===y.type&&(E.target===y.target||y.target===E.shadowParent)&&X0(E.delta,x)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var w=(l.current.shards||[]).map(Ju).filter(Boolean).filter(function(E){return E.contains(y.target)}),S=w.length>0?i(y,w[0]):!l.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),d=m.useCallback(function(g,y,x,v){var w={name:g,delta:y,target:x,should:v,shadowParent:eS(x)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),p=m.useCallback(function(g){r.current=Ca(g),o.current=void 0},[]),u=m.useCallback(function(g){d(g.type,Xu(g),g.target,i(g,e.lockRef.current))},[]),f=m.useCallback(function(g){d(g.type,Ca(g),g.target,i(g,e.lockRef.current))},[]);m.useEffect(function(){return Co.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:f}),document.addEventListener("wheel",c,So),document.addEventListener("touchmove",c,So),document.addEventListener("touchstart",p,So),function(){Co=Co.filter(function(g){return g!==a}),document.removeEventListener("wheel",c,So),document.removeEventListener("touchmove",c,So),document.removeEventListener("touchstart",p,So)}},[]);var h=e.removeScrollBar,b=e.inert;return m.createElement(m.Fragment,null,b?m.createElement(a,{styles:J0(n)}):null,h?m.createElement(U0,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function eS(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const tS=A0(Wu,R0);var Zu=m.forwardRef(function(e,t){return m.createElement(wa,nr({},e,{ref:t,sideCar:tS}))});Zu.classNames=wa.classNames;var rS=[" ","Enter","ArrowUp","ArrowDown"],oS=[" ","Enter"],Xr="Select",[Na,Ea,nS]=Gl(Xr),[No]=dr(Xr,[nS,ga]),ka=ga(),[aS,Tr]=No(Xr),[sS,lS]=No(Xr),Ru=e=>{const{__scopeSelect:t,children:r,open:o,defaultOpen:n,onOpenChange:a,value:l,defaultValue:i,onValueChange:c,dir:d,name:p,autoComplete:u,disabled:f,required:h,form:b}=e,g=ka(t),[y,x]=m.useState(null),[v,w]=m.useState(null),[S,E]=m.useState(!1),N=aa(d),[T,k]=fr({prop:o,defaultProp:n??!1,onChange:a,caller:Xr}),[M,D]=fr({prop:l,defaultProp:i,onChange:c,caller:Xr}),U=m.useRef(null),$=y?b||!!y.closest("form"):!0,[F,q]=m.useState(new Set),R=Array.from(F).map(W=>W.props.value).join(";");return s.jsx(Iu,{...g,children:s.jsxs(aS,{required:h,scope:t,trigger:y,onTriggerChange:x,valueNode:v,onValueNodeChange:w,valueNodeHasChildren:S,onValueNodeHasChildrenChange:E,contentId:_r(),value:M,onValueChange:D,open:T,onOpenChange:k,dir:N,triggerPointerDownPosRef:U,disabled:f,children:[s.jsx(Na.Provider,{scope:t,children:s.jsx(sS,{scope:e.__scopeSelect,onNativeOptionAdd:m.useCallback(W=>{q(Q=>new Set(Q).add(W))},[]),onNativeOptionRemove:m.useCallback(W=>{q(Q=>{const P=new Set(Q);return P.delete(W),P})},[]),children:r})}),$?s.jsxs(Cp,{"aria-hidden":!0,required:h,tabIndex:-1,name:p,autoComplete:u,value:M,onChange:W=>D(W.target.value),disabled:f,form:b,children:[M===void 0?s.jsx("option",{value:""}):null,Array.from(F)]},R):null]})})};Ru.displayName=Xr;var ep="SelectTrigger",tp=m.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:o=!1,...n}=e,a=ka(r),l=Tr(ep,r),i=l.disabled||o,c=Fe(t,l.onTriggerChange),d=Ea(r),p=m.useRef("touch"),[u,f,h]=Ep(g=>{const y=d().filter(w=>!w.disabled),x=y.find(w=>w.value===l.value),v=kp(y,g,x);v!==void 0&&l.onValueChange(v.value)}),b=g=>{i||(l.onOpenChange(!0),h()),g&&(l.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return s.jsx(Pu,{asChild:!0,...a,children:s.jsx(Ne.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":Np(l.value)?"":void 0,...n,ref:c,onClick:xe(n.onClick,g=>{g.currentTarget.focus(),p.current!=="mouse"&&b(g)}),onPointerDown:xe(n.onPointerDown,g=>{p.current=g.pointerType;const y=g.target;y.hasPointerCapture(g.pointerId)&&y.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(b(g),g.preventDefault())}),onKeyDown:xe(n.onKeyDown,g=>{const y=u.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&f(g.key),!(y&&g.key===" ")&&rS.includes(g.key)&&(b(),g.preventDefault())})})})});tp.displayName=ep;var rp="SelectValue",op=m.forwardRef((e,t)=>{const{__scopeSelect:r,className:o,style:n,children:a,placeholder:l="",...i}=e,c=Tr(rp,r),{onValueNodeHasChildrenChange:d}=c,p=a!==void 0,u=Fe(t,c.onValueNodeChange);return it(()=>{d(p)},[d,p]),s.jsx(Ne.span,{...i,ref:u,style:{pointerEvents:"none"},children:Np(c.value)?s.jsx(s.Fragment,{children:l}):a})});op.displayName=rp;var iS="SelectIcon",np=m.forwardRef((e,t)=>{const{__scopeSelect:r,children:o,...n}=e;return s.jsx(Ne.span,{"aria-hidden":!0,...n,ref:t,children:o||"▼"})});np.displayName=iS;var cS="SelectPortal",ap=e=>s.jsx(oi,{asChild:!0,...e});ap.displayName=cS;var Jr="SelectContent",sp=m.forwardRef((e,t)=>{const r=Tr(Jr,e.__scopeSelect),[o,n]=m.useState();if(it(()=>{n(new DocumentFragment)},[]),!r.open){const a=o;return a?Qn.createPortal(s.jsx(lp,{scope:e.__scopeSelect,children:s.jsx(Na.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),a):null}return s.jsx(ip,{...e,ref:t})});sp.displayName=Jr;var jt=10,[lp,Mr]=No(Jr),dS="SelectContentImpl",uS=a0("SelectContent.RemoveScroll"),ip=m.forwardRef((e,t)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:a,onPointerDownOutside:l,side:i,sideOffset:c,align:d,alignOffset:p,arrowPadding:u,collisionBoundary:f,collisionPadding:h,sticky:b,hideWhenDetached:g,avoidCollisions:y,...x}=e,v=Tr(Jr,r),[w,S]=m.useState(null),[E,N]=m.useState(null),T=Fe(t,X=>S(X)),[k,M]=m.useState(null),[D,U]=m.useState(null),$=Ea(r),[F,q]=m.useState(!1),R=m.useRef(!1);m.useEffect(()=>{if(w)return v0(w)},[w]),Ax();const W=m.useCallback(X=>{const[se,...ve]=$().map(j=>j.ref.current),[le]=ve.slice(-1),H=document.activeElement;for(const j of X)if(j===H||(j==null||j.scrollIntoView({block:"nearest"}),j===se&&E&&(E.scrollTop=0),j===le&&E&&(E.scrollTop=E.scrollHeight),j==null||j.focus(),document.activeElement!==H))return},[$,E]),Q=m.useCallback(()=>W([k,w]),[W,k,w]);m.useEffect(()=>{F&&Q()},[F,Q]);const{onOpenChange:P,triggerPointerDownPosRef:z}=v;m.useEffect(()=>{if(w){let X={x:0,y:0};const se=le=>{var H,j;X={x:Math.abs(Math.round(le.pageX)-(((H=z.current)==null?void 0:H.x)??0)),y:Math.abs(Math.round(le.pageY)-(((j=z.current)==null?void 0:j.y)??0))}},ve=le=>{X.x<=10&&X.y<=10?le.preventDefault():w.contains(le.target)||P(!1),document.removeEventListener("pointermove",se),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",se),document.addEventListener("pointerup",ve,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",se),document.removeEventListener("pointerup",ve,{capture:!0})}}},[w,P,z]),m.useEffect(()=>{const X=()=>P(!1);return window.addEventListener("blur",X),window.addEventListener("resize",X),()=>{window.removeEventListener("blur",X),window.removeEventListener("resize",X)}},[P]);const[pe,ge]=Ep(X=>{const se=$().filter(H=>!H.disabled),ve=se.find(H=>H.ref.current===document.activeElement),le=kp(se,X,ve);le&&setTimeout(()=>le.ref.current.focus())}),L=m.useCallback((X,se,ve)=>{const le=!R.current&&!ve;(v.value!==void 0&&v.value===se||le)&&(M(X),le&&(R.current=!0))},[v.value]),Y=m.useCallback(()=>w==null?void 0:w.focus(),[w]),te=m.useCallback((X,se,ve)=>{const le=!R.current&&!ve;(v.value!==void 0&&v.value===se||le)&&U(X)},[v.value]),fe=o==="popper"?ci:cp,K=fe===ci?{side:i,sideOffset:c,align:d,alignOffset:p,arrowPadding:u,collisionBoundary:f,collisionPadding:h,sticky:b,hideWhenDetached:g,avoidCollisions:y}:{};return s.jsx(lp,{scope:r,content:w,viewport:E,onViewportChange:N,itemRefCallback:L,selectedItem:k,onItemLeave:Y,itemTextRefCallback:te,focusSelectedItem:Q,selectedItemText:D,position:o,isPositioned:F,searchRef:pe,children:s.jsx(Zu,{as:uS,allowPinchZoom:!0,children:s.jsx(Qd,{asChild:!0,trapped:v.open,onMountAutoFocus:X=>{X.preventDefault()},onUnmountAutoFocus:xe(n,X=>{var se;(se=v.trigger)==null||se.focus({preventScroll:!0}),X.preventDefault()}),children:s.jsx(zl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:X=>X.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:s.jsx(fe,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:X=>X.preventDefault(),...x,...K,onPlaced:()=>q(!0),ref:T,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:xe(x.onKeyDown,X=>{const se=X.ctrlKey||X.altKey||X.metaKey;if(X.key==="Tab"&&X.preventDefault(),!se&&X.key.length===1&&ge(X.key),["ArrowUp","ArrowDown","Home","End"].includes(X.key)){let le=$().filter(H=>!H.disabled).map(H=>H.ref.current);if(["ArrowUp","End"].includes(X.key)&&(le=le.slice().reverse()),["ArrowUp","ArrowDown"].includes(X.key)){const H=X.target,j=le.indexOf(H);le=le.slice(j+1)}setTimeout(()=>W(le)),X.preventDefault()}})})})})})})});ip.displayName=dS;var pS="SelectItemAlignedPosition",cp=m.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:o,...n}=e,a=Tr(Jr,r),l=Mr(Jr,r),[i,c]=m.useState(null),[d,p]=m.useState(null),u=Fe(t,T=>p(T)),f=Ea(r),h=m.useRef(!1),b=m.useRef(!0),{viewport:g,selectedItem:y,selectedItemText:x,focusSelectedItem:v}=l,w=m.useCallback(()=>{if(a.trigger&&a.valueNode&&i&&d&&g&&y&&x){const T=a.trigger.getBoundingClientRect(),k=d.getBoundingClientRect(),M=a.valueNode.getBoundingClientRect(),D=x.getBoundingClientRect();if(a.dir!=="rtl"){const H=D.left-k.left,j=M.left-H,ce=T.left-j,Ee=T.width+ce,Se=Math.max(Ee,k.width),ze=window.innerWidth-jt,Ye=Vd(j,[jt,Math.max(jt,ze-Se)]);i.style.minWidth=Ee+"px",i.style.left=Ye+"px"}else{const H=k.right-D.right,j=window.innerWidth-M.right-H,ce=window.innerWidth-T.right-j,Ee=T.width+ce,Se=Math.max(Ee,k.width),ze=window.innerWidth-jt,Ye=Vd(j,[jt,Math.max(jt,ze-Se)]);i.style.minWidth=Ee+"px",i.style.right=Ye+"px"}const U=f(),$=window.innerHeight-jt*2,F=g.scrollHeight,q=window.getComputedStyle(d),R=parseInt(q.borderTopWidth,10),W=parseInt(q.paddingTop,10),Q=parseInt(q.borderBottomWidth,10),P=parseInt(q.paddingBottom,10),z=R+W+F+P+Q,pe=Math.min(y.offsetHeight*5,z),ge=window.getComputedStyle(g),L=parseInt(ge.paddingTop,10),Y=parseInt(ge.paddingBottom,10),te=T.top+T.height/2-jt,fe=$-te,K=y.offsetHeight/2,X=y.offsetTop+K,se=R+W+X,ve=z-se;if(se<=te){const H=U.length>0&&y===U[U.length-1].ref.current;i.style.bottom="0px";const j=d.clientHeight-g.offsetTop-g.offsetHeight,ce=Math.max(fe,K+(H?Y:0)+j+Q),Ee=se+ce;i.style.height=Ee+"px"}else{const H=U.length>0&&y===U[0].ref.current;i.style.top="0px";const ce=Math.max(te,R+g.offsetTop+(H?L:0)+K)+ve;i.style.height=ce+"px",g.scrollTop=se-te+g.offsetTop}i.style.margin=`${jt}px 0`,i.style.minHeight=pe+"px",i.style.maxHeight=$+"px",o==null||o(),requestAnimationFrame(()=>h.current=!0)}},[f,a.trigger,a.valueNode,i,d,g,y,x,a.dir,o]);it(()=>w(),[w]);const[S,E]=m.useState();it(()=>{d&&E(window.getComputedStyle(d).zIndex)},[d]);const N=m.useCallback(T=>{T&&b.current===!0&&(w(),v==null||v(),b.current=!1)},[w,v]);return s.jsx(hS,{scope:r,contentWrapper:i,shouldExpandOnScrollRef:h,onScrollButtonChange:N,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:s.jsx(Ne.div,{...n,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});cp.displayName=pS;var fS="SelectPopperPosition",ci=m.forwardRef((e,t)=>{const{__scopeSelect:r,align:o="start",collisionPadding:n=jt,...a}=e,l=ka(r);return s.jsx(Ou,{...l,...a,ref:t,align:o,collisionPadding:n,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});ci.displayName=fS;var[hS,di]=No(Jr,{}),ui="SelectViewport",dp=m.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:o,...n}=e,a=Mr(ui,r),l=di(ui,r),i=Fe(t,a.onViewportChange),c=m.useRef(0);return s.jsxs(s.Fragment,{children:[s.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),s.jsx(Na.Slot,{scope:r,children:s.jsx(Ne.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:xe(n.onScroll,d=>{const p=d.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:f}=l;if(f!=null&&f.current&&u){const h=Math.abs(c.current-p.scrollTop);if(h>0){const b=window.innerHeight-jt*2,g=parseFloat(u.style.minHeight),y=parseFloat(u.style.height),x=Math.max(g,y);if(x<b){const v=x+h,w=Math.min(b,v),S=v-w;u.style.height=w+"px",u.style.bottom==="0px"&&(p.scrollTop=S>0?S:0,u.style.justifyContent="flex-end")}}}c.current=p.scrollTop})})})]})});dp.displayName=ui;var up="SelectGroup",[mS,gS]=No(up),bS=m.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,n=_r();return s.jsx(mS,{scope:r,id:n,children:s.jsx(Ne.div,{role:"group","aria-labelledby":n,...o,ref:t})})});bS.displayName=up;var pp="SelectLabel",fp=m.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,n=gS(pp,r);return s.jsx(Ne.div,{id:n.id,...o,ref:t})});fp.displayName=pp;var _a="SelectItem",[yS,hp]=No(_a),mp=m.forwardRef((e,t)=>{const{__scopeSelect:r,value:o,disabled:n=!1,textValue:a,...l}=e,i=Tr(_a,r),c=Mr(_a,r),d=i.value===o,[p,u]=m.useState(a??""),[f,h]=m.useState(!1),b=Fe(t,v=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,v,o,n)}),g=_r(),y=m.useRef("touch"),x=()=>{n||(i.onValueChange(o),i.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return s.jsx(yS,{scope:r,value:o,disabled:n,textId:g,isSelected:d,onItemTextChange:m.useCallback(v=>{u(w=>w||((v==null?void 0:v.textContent)??"").trim())},[]),children:s.jsx(Na.ItemSlot,{scope:r,value:o,disabled:n,textValue:p,children:s.jsx(Ne.div,{role:"option","aria-labelledby":g,"data-highlighted":f?"":void 0,"aria-selected":d&&f,"data-state":d?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...l,ref:b,onFocus:xe(l.onFocus,()=>h(!0)),onBlur:xe(l.onBlur,()=>h(!1)),onClick:xe(l.onClick,()=>{y.current!=="mouse"&&x()}),onPointerUp:xe(l.onPointerUp,()=>{y.current==="mouse"&&x()}),onPointerDown:xe(l.onPointerDown,v=>{y.current=v.pointerType}),onPointerMove:xe(l.onPointerMove,v=>{var w;y.current=v.pointerType,n?(w=c.onItemLeave)==null||w.call(c):y.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:xe(l.onPointerLeave,v=>{var w;v.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:xe(l.onKeyDown,v=>{var S;((S=c.searchRef)==null?void 0:S.current)!==""&&v.key===" "||(oS.includes(v.key)&&x(),v.key===" "&&v.preventDefault())})})})})});mp.displayName=_a;var Zo="SelectItemText",gp=m.forwardRef((e,t)=>{const{__scopeSelect:r,className:o,style:n,...a}=e,l=Tr(Zo,r),i=Mr(Zo,r),c=hp(Zo,r),d=lS(Zo,r),[p,u]=m.useState(null),f=Fe(t,x=>u(x),c.onItemTextChange,x=>{var v;return(v=i.itemTextRefCallback)==null?void 0:v.call(i,x,c.value,c.disabled)}),h=p==null?void 0:p.textContent,b=m.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:g,onNativeOptionRemove:y}=d;return it(()=>(g(b),()=>y(b)),[g,y,b]),s.jsxs(s.Fragment,{children:[s.jsx(Ne.span,{id:c.textId,...a,ref:f}),c.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Qn.createPortal(a.children,l.valueNode):null]})});gp.displayName=Zo;var bp="SelectItemIndicator",yp=m.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e;return hp(bp,r).isSelected?s.jsx(Ne.span,{"aria-hidden":!0,...o,ref:t}):null});yp.displayName=bp;var pi="SelectScrollUpButton",vp=m.forwardRef((e,t)=>{const r=Mr(pi,e.__scopeSelect),o=di(pi,e.__scopeSelect),[n,a]=m.useState(!1),l=Fe(t,o.onScrollButtonChange);return it(()=>{if(r.viewport&&r.isPositioned){let i=function(){const d=c.scrollTop>0;a(d)};const c=r.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),n?s.jsx(wp,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop-c.offsetHeight)}}):null});vp.displayName=pi;var fi="SelectScrollDownButton",xp=m.forwardRef((e,t)=>{const r=Mr(fi,e.__scopeSelect),o=di(fi,e.__scopeSelect),[n,a]=m.useState(!1),l=Fe(t,o.onScrollButtonChange);return it(()=>{if(r.viewport&&r.isPositioned){let i=function(){const d=c.scrollHeight-c.clientHeight,p=Math.ceil(c.scrollTop)<d;a(p)};const c=r.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),n?s.jsx(wp,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop+c.offsetHeight)}}):null});xp.displayName=fi;var wp=m.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:o,...n}=e,a=Mr("SelectScrollButton",r),l=m.useRef(null),i=Ea(r),c=m.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return m.useEffect(()=>()=>c(),[c]),it(()=>{var p;const d=i().find(u=>u.ref.current===document.activeElement);(p=d==null?void 0:d.ref.current)==null||p.scrollIntoView({block:"nearest"})},[i]),s.jsx(Ne.div,{"aria-hidden":!0,...n,ref:t,style:{flexShrink:0,...n.style},onPointerDown:xe(n.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(o,50))}),onPointerMove:xe(n.onPointerMove,()=>{var d;(d=a.onItemLeave)==null||d.call(a),l.current===null&&(l.current=window.setInterval(o,50))}),onPointerLeave:xe(n.onPointerLeave,()=>{c()})})}),vS="SelectSeparator",Sp=m.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e;return s.jsx(Ne.div,{"aria-hidden":!0,...o,ref:t})});Sp.displayName=vS;var hi="SelectArrow",xS=m.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,n=ka(r),a=Tr(hi,r),l=Mr(hi,r);return a.open&&l.position==="popper"?s.jsx($u,{...n,...o,ref:t}):null});xS.displayName=hi;var wS="SelectBubbleInput",Cp=m.forwardRef(({__scopeSelect:e,value:t,...r},o)=>{const n=m.useRef(null),a=Fe(o,n),l=Lu(t);return m.useEffect(()=>{const i=n.current;if(!i)return;const c=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(c,"value").set;if(l!==t&&p){const u=new Event("change",{bubbles:!0});p.call(i,t),i.dispatchEvent(u)}},[l,t]),s.jsx(Ne.select,{...r,style:{...Fu,...r.style},ref:a,defaultValue:t})});Cp.displayName=wS;function Np(e){return e===""||e===void 0}function Ep(e){const t=Er(e),r=m.useRef(""),o=m.useRef(0),n=m.useCallback(l=>{const i=r.current+l;t(i),(function c(d){r.current=d,window.clearTimeout(o.current),d!==""&&(o.current=window.setTimeout(()=>c(""),1e3))})(i)},[t]),a=m.useCallback(()=>{r.current="",window.clearTimeout(o.current)},[]);return m.useEffect(()=>()=>window.clearTimeout(o.current),[]),[r,n,a]}function kp(e,t,r){const n=t.length>1&&Array.from(t).every(d=>d===t[0])?t[0]:t,a=r?e.indexOf(r):-1;let l=SS(e,Math.max(a,0));n.length===1&&(l=l.filter(d=>d!==r));const c=l.find(d=>d.textValue.toLowerCase().startsWith(n.toLowerCase()));return c!==r?c:void 0}function SS(e,t){return e.map((r,o)=>e[(t+o)%e.length])}var CS=Ru,_p=tp,NS=op,ES=np,kS=ap,Dp=sp,_S=dp,Ap=fp,Tp=mp,DS=gp,AS=yp,Mp=vp,Ip=xp,Pp=Sp;/**
42
+ * @license lucide-react v0.563.0 - ISC
43
+ *
44
+ * This source code is licensed under the ISC license.
45
+ * See the LICENSE file in the root directory of this source tree.
46
+ */const Op=(...e)=>e.filter((t,r,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===r).join(" ").trim();/**
47
+ * @license lucide-react v0.563.0 - ISC
48
+ *
49
+ * This source code is licensed under the ISC license.
50
+ * See the LICENSE file in the root directory of this source tree.
51
+ */const TS=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
52
+ * @license lucide-react v0.563.0 - ISC
53
+ *
54
+ * This source code is licensed under the ISC license.
55
+ * See the LICENSE file in the root directory of this source tree.
56
+ */const MS=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,o)=>o?o.toUpperCase():r.toLowerCase());/**
57
+ * @license lucide-react v0.563.0 - ISC
58
+ *
59
+ * This source code is licensed under the ISC license.
60
+ * See the LICENSE file in the root directory of this source tree.
61
+ */const $p=e=>{const t=MS(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
62
+ * @license lucide-react v0.563.0 - ISC
63
+ *
64
+ * This source code is licensed under the ISC license.
65
+ * See the LICENSE file in the root directory of this source tree.
66
+ */var IS={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
67
+ * @license lucide-react v0.563.0 - ISC
68
+ *
69
+ * This source code is licensed under the ISC license.
70
+ * See the LICENSE file in the root directory of this source tree.
71
+ */const PS=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};/**
72
+ * @license lucide-react v0.563.0 - ISC
73
+ *
74
+ * This source code is licensed under the ISC license.
75
+ * See the LICENSE file in the root directory of this source tree.
76
+ */const OS=C.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:n="",children:a,iconNode:l,...i},c)=>C.createElement("svg",{ref:c,...IS,width:t,height:t,stroke:e,strokeWidth:o?Number(r)*24/Number(t):r,className:Op("lucide",n),...!a&&!PS(i)&&{"aria-hidden":"true"},...i},[...l.map(([d,p])=>C.createElement(d,p)),...Array.isArray(a)?a:[a]]));/**
77
+ * @license lucide-react v0.563.0 - ISC
78
+ *
79
+ * This source code is licensed under the ISC license.
80
+ * See the LICENSE file in the root directory of this source tree.
81
+ */const nt=(e,t)=>{const r=C.forwardRef(({className:o,...n},a)=>C.createElement(OS,{ref:a,iconNode:t,className:Op(`lucide-${TS($p(e))}`,`lucide-${e}`,o),...n}));return r.displayName=$p(e),r};/**
82
+ * @license lucide-react v0.563.0 - ISC
83
+ *
84
+ * This source code is licensed under the ISC license.
85
+ * See the LICENSE file in the root directory of this source tree.
86
+ */const $S=nt("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
87
+ * @license lucide-react v0.563.0 - ISC
88
+ *
89
+ * This source code is licensed under the ISC license.
90
+ * See the LICENSE file in the root directory of this source tree.
91
+ */const Lp=nt("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
92
+ * @license lucide-react v0.563.0 - ISC
93
+ *
94
+ * This source code is licensed under the ISC license.
95
+ * See the LICENSE file in the root directory of this source tree.
96
+ */const Eo=nt("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
97
+ * @license lucide-react v0.563.0 - ISC
98
+ *
99
+ * This source code is licensed under the ISC license.
100
+ * See the LICENSE file in the root directory of this source tree.
101
+ */const Fp=nt("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
102
+ * @license lucide-react v0.563.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ */const LS=nt("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
107
+ * @license lucide-react v0.563.0 - ISC
108
+ *
109
+ * This source code is licensed under the ISC license.
110
+ * See the LICENSE file in the root directory of this source tree.
111
+ */const FS=nt("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);/**
112
+ * @license lucide-react v0.563.0 - ISC
113
+ *
114
+ * This source code is licensed under the ISC license.
115
+ * See the LICENSE file in the root directory of this source tree.
116
+ */const Gp=nt("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
117
+ * @license lucide-react v0.563.0 - ISC
118
+ *
119
+ * This source code is licensed under the ISC license.
120
+ * See the LICENSE file in the root directory of this source tree.
121
+ */const GS=nt("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
122
+ * @license lucide-react v0.563.0 - ISC
123
+ *
124
+ * This source code is licensed under the ISC license.
125
+ * See the LICENSE file in the root directory of this source tree.
126
+ */const Vp=nt("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
127
+ * @license lucide-react v0.563.0 - ISC
128
+ *
129
+ * This source code is licensed under the ISC license.
130
+ * See the LICENSE file in the root directory of this source tree.
131
+ */const VS=nt("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
132
+ * @license lucide-react v0.563.0 - ISC
133
+ *
134
+ * This source code is licensed under the ISC license.
135
+ * See the LICENSE file in the root directory of this source tree.
136
+ */const mi=nt("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
137
+ * @license lucide-react v0.563.0 - ISC
138
+ *
139
+ * This source code is licensed under the ISC license.
140
+ * See the LICENSE file in the root directory of this source tree.
141
+ */const zS=nt("redo-2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/**
142
+ * @license lucide-react v0.563.0 - ISC
143
+ *
144
+ * This source code is licensed under the ISC license.
145
+ * See the LICENSE file in the root directory of this source tree.
146
+ */const BS=nt("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/**
147
+ * @license lucide-react v0.563.0 - ISC
148
+ *
149
+ * This source code is licensed under the ISC license.
150
+ * See the LICENSE file in the root directory of this source tree.
151
+ */const US=nt("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
152
+ * @license lucide-react v0.563.0 - ISC
153
+ *
154
+ * This source code is licensed under the ISC license.
155
+ * See the LICENSE file in the root directory of this source tree.
156
+ */const gi=nt("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);/**
157
+ * @license lucide-react v0.563.0 - ISC
158
+ *
159
+ * This source code is licensed under the ISC license.
160
+ * See the LICENSE file in the root directory of this source tree.
161
+ */const WS=nt("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
162
+ * @license lucide-react v0.563.0 - ISC
163
+ *
164
+ * This source code is licensed under the ISC license.
165
+ * See the LICENSE file in the root directory of this source tree.
166
+ */const HS=nt("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);/**
167
+ * @license lucide-react v0.563.0 - ISC
168
+ *
169
+ * This source code is licensed under the ISC license.
170
+ * See the LICENSE file in the root directory of this source tree.
171
+ */const Da=nt("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function zp(e){var t,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=zp(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function Bp(){for(var e,t,r=0,o="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=zp(e))&&(o&&(o+=" "),o+=t);return o}const jS=(e,t)=>{const r=new Array(e.length+t.length);for(let o=0;o<e.length;o++)r[o]=e[o];for(let o=0;o<t.length;o++)r[e.length+o]=t[o];return r},YS=(e,t)=>({classGroupId:e,validator:t}),Up=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Aa="-",Wp=[],qS="arbitrary..",QS=e=>{const t=XS(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return KS(l);const i=l.split(Aa),c=i[0]===""&&i.length>1?1:0;return Hp(i,c,t)},getConflictingClassGroupIds:(l,i)=>{if(i){const c=o[l],d=r[l];return c?d?jS(d,c):c:d||Wp}return r[l]||Wp}}},Hp=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const d=Hp(e,t+1,a);if(d)return d}const l=r.validators;if(l===null)return;const i=t===0?e.join(Aa):e.slice(t).join(Aa),c=l.length;for(let d=0;d<c;d++){const p=l[d];if(p.validator(i))return p.classGroupId}},KS=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),o=t.slice(0,r);return o?qS+o:void 0})(),XS=e=>{const{theme:t,classGroups:r}=e;return JS(r,t)},JS=(e,t)=>{const r=Up();for(const o in e){const n=e[o];bi(n,r,o,t)}return r},bi=(e,t,r,o)=>{const n=e.length;for(let a=0;a<n;a++){const l=e[a];ZS(l,t,r,o)}},ZS=(e,t,r,o)=>{if(typeof e=="string"){RS(e,t,r);return}if(typeof e=="function"){eC(e,t,r,o);return}tC(e,t,r,o)},RS=(e,t,r)=>{const o=e===""?t:jp(t,e);o.classGroupId=r},eC=(e,t,r,o)=>{if(rC(e)){bi(e(o),t,r,o);return}t.validators===null&&(t.validators=[]),t.validators.push(YS(r,e))},tC=(e,t,r,o)=>{const n=Object.entries(e),a=n.length;for(let l=0;l<a;l++){const[i,c]=n[l];bi(c,jp(t,i),r,o)}},jp=(e,t)=>{let r=e;const o=t.split(Aa),n=o.length;for(let a=0;a<n;a++){const l=o[a];let i=r.nextPart.get(l);i||(i=Up(),r.nextPart.set(l,i)),r=i}return r},rC=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,oC=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),o=Object.create(null);const n=(a,l)=>{r[a]=l,t++,t>e&&(t=0,o=r,r=Object.create(null))};return{get(a){let l=r[a];if(l!==void 0)return l;if((l=o[a])!==void 0)return n(a,l),l},set(a,l){a in r?r[a]=l:n(a,l)}}},yi="!",Yp=":",nC=[],qp=(e,t,r,o,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:o,isExternal:n}),aC=e=>{const{prefix:t,experimentalParseClassName:r}=e;let o=n=>{const a=[];let l=0,i=0,c=0,d;const p=n.length;for(let g=0;g<p;g++){const y=n[g];if(l===0&&i===0){if(y===Yp){a.push(n.slice(c,g)),c=g+1;continue}if(y==="/"){d=g;continue}}y==="["?l++:y==="]"?l--:y==="("?i++:y===")"&&i--}const u=a.length===0?n:n.slice(c);let f=u,h=!1;u.endsWith(yi)?(f=u.slice(0,-1),h=!0):u.startsWith(yi)&&(f=u.slice(1),h=!0);const b=d&&d>c?d-c:void 0;return qp(a,h,f,b)};if(t){const n=t+Yp,a=o;o=l=>l.startsWith(n)?a(l.slice(n.length)):qp(nC,!1,l,void 0,!0)}if(r){const n=o;o=a=>r({className:a,parseClassName:n})}return o},sC=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,o)=>{t.set(r,1e6+o)}),r=>{const o=[];let n=[];for(let a=0;a<r.length;a++){const l=r[a],i=l[0]==="[",c=t.has(l);i||c?(n.length>0&&(n.sort(),o.push(...n),n=[]),o.push(l)):n.push(l)}return n.length>0&&(n.sort(),o.push(...n)),o}},lC=e=>({cache:oC(e.cacheSize),parseClassName:aC(e),sortModifiers:sC(e),...QS(e)}),iC=/\s+/,cC=(e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:n,sortModifiers:a}=t,l=[],i=e.trim().split(iC);let c="";for(let d=i.length-1;d>=0;d-=1){const p=i[d],{isExternal:u,modifiers:f,hasImportantModifier:h,baseClassName:b,maybePostfixModifierPosition:g}=r(p);if(u){c=p+(c.length>0?" "+c:c);continue}let y=!!g,x=o(y?b.substring(0,g):b);if(!x){if(!y){c=p+(c.length>0?" "+c:c);continue}if(x=o(b),!x){c=p+(c.length>0?" "+c:c);continue}y=!1}const v=f.length===0?"":f.length===1?f[0]:a(f).join(":"),w=h?v+yi:v,S=w+x;if(l.indexOf(S)>-1)continue;l.push(S);const E=n(x,y);for(let N=0;N<E.length;++N){const T=E[N];l.push(w+T)}c=p+(c.length>0?" "+c:c)}return c},dC=(...e)=>{let t=0,r,o,n="";for(;t<e.length;)(r=e[t++])&&(o=Qp(r))&&(n&&(n+=" "),n+=o);return n},Qp=e=>{if(typeof e=="string")return e;let t,r="";for(let o=0;o<e.length;o++)e[o]&&(t=Qp(e[o]))&&(r&&(r+=" "),r+=t);return r},uC=(e,...t)=>{let r,o,n,a;const l=c=>{const d=t.reduce((p,u)=>u(p),e());return r=lC(d),o=r.cache.get,n=r.cache.set,a=i,i(c)},i=c=>{const d=o(c);if(d)return d;const p=cC(c,r);return n(c,p),p};return a=l,(...c)=>a(dC(...c))},pC=[],et=e=>{const t=r=>r[e]||pC;return t.isThemeGetter=!0,t},Kp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Xp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,fC=/^\d+\/\d+$/,hC=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,mC=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,gC=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,bC=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,yC=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ko=e=>fC.test(e),we=e=>!!e&&!Number.isNaN(Number(e)),Ir=e=>!!e&&Number.isInteger(Number(e)),vi=e=>e.endsWith("%")&&we(e.slice(0,-1)),hr=e=>hC.test(e),vC=()=>!0,xC=e=>mC.test(e)&&!gC.test(e),Jp=()=>!1,wC=e=>bC.test(e),SC=e=>yC.test(e),CC=e=>!re(e)&&!oe(e),NC=e=>_o(e,rf,Jp),re=e=>Kp.test(e),Zr=e=>_o(e,of,xC),xi=e=>_o(e,AC,we),Zp=e=>_o(e,ef,Jp),EC=e=>_o(e,tf,SC),Ta=e=>_o(e,nf,wC),oe=e=>Xp.test(e),Ro=e=>Do(e,of),kC=e=>Do(e,TC),Rp=e=>Do(e,ef),_C=e=>Do(e,rf),DC=e=>Do(e,tf),Ma=e=>Do(e,nf,!0),_o=(e,t,r)=>{const o=Kp.exec(e);return o?o[1]?t(o[1]):r(o[2]):!1},Do=(e,t,r=!1)=>{const o=Xp.exec(e);return o?o[1]?t(o[1]):r:!1},ef=e=>e==="position"||e==="percentage",tf=e=>e==="image"||e==="url",rf=e=>e==="length"||e==="size"||e==="bg-size",of=e=>e==="length",AC=e=>e==="number",TC=e=>e==="family-name",nf=e=>e==="shadow",MC=uC(()=>{const e=et("color"),t=et("font"),r=et("text"),o=et("font-weight"),n=et("tracking"),a=et("leading"),l=et("breakpoint"),i=et("container"),c=et("spacing"),d=et("radius"),p=et("shadow"),u=et("inset-shadow"),f=et("text-shadow"),h=et("drop-shadow"),b=et("blur"),g=et("perspective"),y=et("aspect"),x=et("ease"),v=et("animate"),w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],E=()=>[...S(),oe,re],N=()=>["auto","hidden","clip","visible","scroll"],T=()=>["auto","contain","none"],k=()=>[oe,re,c],M=()=>[ko,"full","auto",...k()],D=()=>[Ir,"none","subgrid",oe,re],U=()=>["auto",{span:["full",Ir,oe,re]},Ir,oe,re],$=()=>[Ir,"auto",oe,re],F=()=>["auto","min","max","fr",oe,re],q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],R=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...k()],Q=()=>[ko,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],P=()=>[e,oe,re],z=()=>[...S(),Rp,Zp,{position:[oe,re]}],pe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ge=()=>["auto","cover","contain",_C,NC,{size:[oe,re]}],L=()=>[vi,Ro,Zr],Y=()=>["","none","full",d,oe,re],te=()=>["",we,Ro,Zr],fe=()=>["solid","dashed","dotted","double"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>[we,vi,Rp,Zp],se=()=>["","none",b,oe,re],ve=()=>["none",we,oe,re],le=()=>["none",we,oe,re],H=()=>[we,oe,re],j=()=>[ko,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[hr],breakpoint:[hr],color:[vC],container:[hr],"drop-shadow":[hr],ease:["in","out","in-out"],font:[CC],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[hr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[hr],shadow:[hr],spacing:["px",we],text:[hr],"text-shadow":[hr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ko,re,oe,y]}],container:["container"],columns:[{columns:[we,re,oe,i]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:E()}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{start:M()}],end:[{end:M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[Ir,"auto",oe,re]}],basis:[{basis:[ko,"full","auto",i,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[we,ko,"auto","initial","none",re]}],grow:[{grow:["",we,oe,re]}],shrink:[{shrink:["",we,oe,re]}],order:[{order:[Ir,"first","last","none",oe,re]}],"grid-cols":[{"grid-cols":D()}],"col-start-end":[{col:U()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":D()}],"row-start-end":[{row:U()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...q(),"normal"]}],"justify-items":[{"justify-items":[...R(),"normal"]}],"justify-self":[{"justify-self":["auto",...R()]}],"align-content":[{content:["normal",...q()]}],"align-items":[{items:[...R(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...R(),{baseline:["","last"]}]}],"place-content":[{"place-content":q()}],"place-items":[{"place-items":[...R(),"baseline"]}],"place-self":[{"place-self":["auto",...R()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],w:[{w:[i,"screen",...Q()]}],"min-w":[{"min-w":[i,"screen","none",...Q()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[l]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",r,Ro,Zr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,oe,xi]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",vi,re]}],"font-family":[{font:[kC,re,t]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,oe,re]}],"line-clamp":[{"line-clamp":[we,"none",oe,xi]}],leading:[{leading:[a,...k()]}],"list-image":[{"list-image":["none",oe,re]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",oe,re]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...fe(),"wavy"]}],"text-decoration-thickness":[{decoration:[we,"from-font","auto",oe,Zr]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[we,"auto",oe,re]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",oe,re]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",oe,re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:z()}],"bg-repeat":[{bg:pe()}],"bg-size":[{bg:ge()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Ir,oe,re],radial:["",oe,re],conic:[Ir,oe,re]},DC,EC]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:L()}],"gradient-via-pos":[{via:L()}],"gradient-to-pos":[{to:L()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:te()}],"border-w-x":[{"border-x":te()}],"border-w-y":[{"border-y":te()}],"border-w-s":[{"border-s":te()}],"border-w-e":[{"border-e":te()}],"border-w-t":[{"border-t":te()}],"border-w-r":[{"border-r":te()}],"border-w-b":[{"border-b":te()}],"border-w-l":[{"border-l":te()}],"divide-x":[{"divide-x":te()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":te()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...fe(),"hidden","none"]}],"divide-style":[{divide:[...fe(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...fe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[we,oe,re]}],"outline-w":[{outline:["",we,Ro,Zr]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",p,Ma,Ta]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",u,Ma,Ta]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:te()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[we,Zr]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":te()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",f,Ma,Ta]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[we,oe,re]}],"mix-blend":[{"mix-blend":[...K(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":K()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[we]}],"mask-image-linear-from-pos":[{"mask-linear-from":X()}],"mask-image-linear-to-pos":[{"mask-linear-to":X()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":X()}],"mask-image-t-to-pos":[{"mask-t-to":X()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":X()}],"mask-image-r-to-pos":[{"mask-r-to":X()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":X()}],"mask-image-b-to-pos":[{"mask-b-to":X()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":X()}],"mask-image-l-to-pos":[{"mask-l-to":X()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":X()}],"mask-image-x-to-pos":[{"mask-x-to":X()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":X()}],"mask-image-y-to-pos":[{"mask-y-to":X()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[oe,re]}],"mask-image-radial-from-pos":[{"mask-radial-from":X()}],"mask-image-radial-to-pos":[{"mask-radial-to":X()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[we]}],"mask-image-conic-from-pos":[{"mask-conic-from":X()}],"mask-image-conic-to-pos":[{"mask-conic-to":X()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:z()}],"mask-repeat":[{mask:pe()}],"mask-size":[{mask:ge()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",oe,re]}],filter:[{filter:["","none",oe,re]}],blur:[{blur:se()}],brightness:[{brightness:[we,oe,re]}],contrast:[{contrast:[we,oe,re]}],"drop-shadow":[{"drop-shadow":["","none",h,Ma,Ta]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",we,oe,re]}],"hue-rotate":[{"hue-rotate":[we,oe,re]}],invert:[{invert:["",we,oe,re]}],saturate:[{saturate:[we,oe,re]}],sepia:[{sepia:["",we,oe,re]}],"backdrop-filter":[{"backdrop-filter":["","none",oe,re]}],"backdrop-blur":[{"backdrop-blur":se()}],"backdrop-brightness":[{"backdrop-brightness":[we,oe,re]}],"backdrop-contrast":[{"backdrop-contrast":[we,oe,re]}],"backdrop-grayscale":[{"backdrop-grayscale":["",we,oe,re]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[we,oe,re]}],"backdrop-invert":[{"backdrop-invert":["",we,oe,re]}],"backdrop-opacity":[{"backdrop-opacity":[we,oe,re]}],"backdrop-saturate":[{"backdrop-saturate":[we,oe,re]}],"backdrop-sepia":[{"backdrop-sepia":["",we,oe,re]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",oe,re]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[we,"initial",oe,re]}],ease:[{ease:["linear","initial",x,oe,re]}],delay:[{delay:[we,oe,re]}],animate:[{animate:["none",v,oe,re]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[g,oe,re]}],"perspective-origin":[{"perspective-origin":E()}],rotate:[{rotate:ve()}],"rotate-x":[{"rotate-x":ve()}],"rotate-y":[{"rotate-y":ve()}],"rotate-z":[{"rotate-z":ve()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:H()}],"skew-x":[{"skew-x":H()}],"skew-y":[{"skew-y":H()}],transform:[{transform:[oe,re,"","none","gpu","cpu"]}],"transform-origin":[{origin:E()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:j()}],"translate-x":[{"translate-x":j()}],"translate-y":[{"translate-y":j()}],"translate-z":[{"translate-z":j()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",oe,re]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",oe,re]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[we,Ro,Zr,xi]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function be(...e){return MC(Bp(e))}const Ia=CS,Pa=NS,en=m.forwardRef(({className:e,children:t,...r},o)=>s.jsxs(_p,{ref:o,className:be("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,s.jsx(ES,{asChild:!0,children:s.jsx(Eo,{className:"h-4 w-4 opacity-50"})})]}));en.displayName=_p.displayName;const af=m.forwardRef(({className:e,...t},r)=>s.jsx(Mp,{ref:r,className:be("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Fp,{className:"h-4 w-4"})}));af.displayName=Mp.displayName;const sf=m.forwardRef(({className:e,...t},r)=>s.jsx(Ip,{ref:r,className:be("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Eo,{className:"h-4 w-4"})}));sf.displayName=Ip.displayName;const tn=m.forwardRef(({className:e,children:t,position:r="popper",...o},n)=>s.jsx(kS,{children:s.jsxs(Dp,{ref:n,className:be("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...o,children:[s.jsx(af,{}),s.jsx(_S,{className:be("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(sf,{})]})}));tn.displayName=Dp.displayName;const IC=m.forwardRef(({className:e,...t},r)=>s.jsx(Ap,{ref:r,className:be("px-2 py-1.5 text-sm font-semibold",e),...t}));IC.displayName=Ap.displayName;const Rr=m.forwardRef(({className:e,children:t,...r},o)=>s.jsxs(Tp,{ref:o,className:be("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[s.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(AS,{children:s.jsx(Lp,{className:"h-4 w-4"})})}),s.jsx(DS,{children:t})]}));Rr.displayName=Tp.displayName;const PC=m.forwardRef(({className:e,...t},r)=>s.jsx(Pp,{ref:r,className:be("-mx-1 my-1 h-px bg-muted",e),...t}));PC.displayName=Pp.displayName;const eo=[{code:"US",name:"United States",dialCode:"+1",flag:"🇺🇸"},{code:"GB",name:"United Kingdom",dialCode:"+44",flag:"🇬🇧"},{code:"CA",name:"Canada",dialCode:"+1",flag:"🇨🇦"},{code:"AU",name:"Australia",dialCode:"+61",flag:"🇦🇺"},{code:"DE",name:"Germany",dialCode:"+49",flag:"🇩🇪"},{code:"FR",name:"France",dialCode:"+33",flag:"🇫🇷"},{code:"IT",name:"Italy",dialCode:"+39",flag:"🇮🇹"},{code:"ES",name:"Spain",dialCode:"+34",flag:"🇪🇸"},{code:"NL",name:"Netherlands",dialCode:"+31",flag:"🇳🇱"},{code:"BE",name:"Belgium",dialCode:"+32",flag:"🇧🇪"},{code:"CH",name:"Switzerland",dialCode:"+41",flag:"🇨🇭"},{code:"AT",name:"Austria",dialCode:"+43",flag:"🇦🇹"},{code:"SE",name:"Sweden",dialCode:"+46",flag:"🇸🇪"},{code:"NO",name:"Norway",dialCode:"+47",flag:"🇳🇴"},{code:"DK",name:"Denmark",dialCode:"+45",flag:"🇩🇰"},{code:"FI",name:"Finland",dialCode:"+358",flag:"🇫🇮"},{code:"IE",name:"Ireland",dialCode:"+353",flag:"🇮🇪"},{code:"PT",name:"Portugal",dialCode:"+351",flag:"🇵🇹"},{code:"GR",name:"Greece",dialCode:"+30",flag:"🇬🇷"},{code:"PL",name:"Poland",dialCode:"+48",flag:"🇵🇱"},{code:"CZ",name:"Czech Republic",dialCode:"+420",flag:"🇨🇿"},{code:"HU",name:"Hungary",dialCode:"+36",flag:"🇭🇺"},{code:"RO",name:"Romania",dialCode:"+40",flag:"🇷🇴"},{code:"BG",name:"Bulgaria",dialCode:"+359",flag:"🇧🇬"},{code:"HR",name:"Croatia",dialCode:"+385",flag:"🇭🇷"},{code:"SK",name:"Slovakia",dialCode:"+421",flag:"🇸🇰"},{code:"SI",name:"Slovenia",dialCode:"+386",flag:"🇸🇮"},{code:"RS",name:"Serbia",dialCode:"+381",flag:"🇷🇸"},{code:"UA",name:"Ukraine",dialCode:"+380",flag:"🇺🇦"},{code:"RU",name:"Russia",dialCode:"+7",flag:"🇷🇺"},{code:"TR",name:"Turkey",dialCode:"+90",flag:"🇹🇷"},{code:"IL",name:"Israel",dialCode:"+972",flag:"🇮🇱"},{code:"SA",name:"Saudi Arabia",dialCode:"+966",flag:"🇸🇦"},{code:"AE",name:"United Arab Emirates",dialCode:"+971",flag:"🇦🇪"},{code:"QA",name:"Qatar",dialCode:"+974",flag:"🇶🇦"},{code:"KW",name:"Kuwait",dialCode:"+965",flag:"🇰🇼"},{code:"BH",name:"Bahrain",dialCode:"+973",flag:"🇧🇭"},{code:"OM",name:"Oman",dialCode:"+968",flag:"🇴🇲"},{code:"EG",name:"Egypt",dialCode:"+20",flag:"🇪🇬"},{code:"MA",name:"Morocco",dialCode:"+212",flag:"🇲🇦"},{code:"ZA",name:"South Africa",dialCode:"+27",flag:"🇿🇦"},{code:"NG",name:"Nigeria",dialCode:"+234",flag:"🇳🇬"},{code:"KE",name:"Kenya",dialCode:"+254",flag:"🇰🇪"},{code:"GH",name:"Ghana",dialCode:"+233",flag:"🇬🇭"},{code:"IN",name:"India",dialCode:"+91",flag:"🇮🇳"},{code:"PK",name:"Pakistan",dialCode:"+92",flag:"🇵🇰"},{code:"BD",name:"Bangladesh",dialCode:"+880",flag:"🇧🇩"},{code:"CN",name:"China",dialCode:"+86",flag:"🇨🇳"},{code:"JP",name:"Japan",dialCode:"+81",flag:"🇯🇵"},{code:"KR",name:"South Korea",dialCode:"+82",flag:"🇰🇷"},{code:"TW",name:"Taiwan",dialCode:"+886",flag:"🇹🇼"},{code:"HK",name:"Hong Kong",dialCode:"+852",flag:"🇭🇰"},{code:"SG",name:"Singapore",dialCode:"+65",flag:"🇸🇬"},{code:"MY",name:"Malaysia",dialCode:"+60",flag:"🇲🇾"},{code:"TH",name:"Thailand",dialCode:"+66",flag:"🇹🇭"},{code:"VN",name:"Vietnam",dialCode:"+84",flag:"🇻🇳"},{code:"ID",name:"Indonesia",dialCode:"+62",flag:"🇮🇩"},{code:"PH",name:"Philippines",dialCode:"+63",flag:"🇵🇭"},{code:"NZ",name:"New Zealand",dialCode:"+64",flag:"🇳🇿"},{code:"MX",name:"Mexico",dialCode:"+52",flag:"🇲🇽"},{code:"BR",name:"Brazil",dialCode:"+55",flag:"🇧🇷"},{code:"AR",name:"Argentina",dialCode:"+54",flag:"🇦🇷"},{code:"CL",name:"Chile",dialCode:"+56",flag:"🇨🇱"},{code:"CO",name:"Colombia",dialCode:"+57",flag:"🇨🇴"},{code:"PE",name:"Peru",dialCode:"+51",flag:"🇵🇪"},{code:"VE",name:"Venezuela",dialCode:"+58",flag:"🇻🇪"},{code:"EC",name:"Ecuador",dialCode:"+593",flag:"🇪🇨"},{code:"UY",name:"Uruguay",dialCode:"+598",flag:"🇺🇾"},{code:"PY",name:"Paraguay",dialCode:"+595",flag:"🇵🇾"},{code:"BO",name:"Bolivia",dialCode:"+591",flag:"🇧🇴"},{code:"CR",name:"Costa Rica",dialCode:"+506",flag:"🇨🇷"},{code:"PA",name:"Panama",dialCode:"+507",flag:"🇵🇦"},{code:"DO",name:"Dominican Republic",dialCode:"+1",flag:"🇩🇴"},{code:"PR",name:"Puerto Rico",dialCode:"+1",flag:"🇵🇷"},{code:"JM",name:"Jamaica",dialCode:"+1",flag:"🇯🇲"},{code:"TT",name:"Trinidad and Tobago",dialCode:"+1",flag:"🇹🇹"},{code:"IS",name:"Iceland",dialCode:"+354",flag:"🇮🇸"},{code:"LU",name:"Luxembourg",dialCode:"+352",flag:"🇱🇺"},{code:"MT",name:"Malta",dialCode:"+356",flag:"🇲🇹"},{code:"CY",name:"Cyprus",dialCode:"+357",flag:"🇨🇾"},{code:"EE",name:"Estonia",dialCode:"+372",flag:"🇪🇪"},{code:"LV",name:"Latvia",dialCode:"+371",flag:"🇱🇻"},{code:"LT",name:"Lithuania",dialCode:"+370",flag:"🇱🇹"}],OC=[...eo].sort((e,t)=>e.name.localeCompare(t.name)),rn=e=>eo.find(t=>t.code===e),$C=(e,t="US")=>{const r=rn(t)||eo[0];if(!e)return{countryCode:r.code,dialCode:r.dialCode,number:""};if(e.startsWith("+")){for(const o of eo)if(e.startsWith(o.dialCode))return{countryCode:o.code,dialCode:o.dialCode,number:e.slice(o.dialCode.length).trim()}}return{countryCode:r.code,dialCode:r.dialCode,number:e.replace(/^\+/,"")}},LC=({value:e,onChange:t,onBlur:r,defaultCountry:o="US",disabled:n=!1,placeholder:a="Phone number",hasError:l=!1,className:i,inputClassName:c})=>{const d=C.useMemo(()=>{if(!e){const v=rn(o)||eo[0];return{countryCode:v.code,dialCode:v.dialCode,number:""}}return typeof e=="string"?$C(e,o):e},[e,o]),[p,u]=C.useState(d.countryCode),[f,h]=C.useState(d.number),b=C.useRef(null);C.useEffect(()=>{u(d.countryCode),h(d.number)},[d.countryCode,d.number]);const g=C.useMemo(()=>rn(p)||eo[0],[p]),y=v=>{const w=rn(v);if(w){u(v);const S={countryCode:w.code,dialCode:w.dialCode,number:f};t==null||t(S)}},x=v=>{const w=v.target.value.replace(/[^\d\s\-()]/g,"");h(w),t==null||t({countryCode:g.code,dialCode:g.dialCode,number:w})};return s.jsxs("div",{className:be("flex",i),children:[s.jsxs(Ia,{value:p,onValueChange:y,disabled:n,children:[s.jsx(en,{className:be("w-[110px] rounded-r-none border-r-0 focus:z-10",l&&"border-red-500",n&&"opacity-50 cursor-not-allowed"),children:s.jsx(Pa,{children:s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"text-base",children:g.flag}),s.jsx("span",{className:"text-sm text-muted-foreground",children:g.dialCode})]})})}),s.jsx(tn,{className:"max-h-[300px]",children:OC.map(v=>s.jsx(Rr,{value:v.code,className:"cursor-pointer",children:s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-base",children:v.flag}),s.jsx("span",{className:"flex-1",children:v.name}),s.jsx("span",{className:"text-muted-foreground text-sm",children:v.dialCode})]})},v.code))})]}),s.jsx("input",{ref:b,type:"tel",value:f,onChange:x,onBlur:r,disabled:n,placeholder:a,className:be("flex-1 h-9 rounded-l-none rounded-r-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors","placeholder:text-muted-foreground","focus:outline-none focus:ring-1 focus:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",l&&"border-red-500 focus:ring-red-500",c)})]})},FC=({defaultCountry:e="US",placeholder:t="Phone number",className:r})=>{const o=rn(e)||eo[0];return s.jsxs("div",{className:be("flex",r),children:[s.jsxs("div",{className:"flex items-center gap-1.5 h-9 px-3 rounded-l-md border border-r-0 border-input bg-muted/50 text-sm",children:[s.jsx("span",{className:"text-base",children:o.flag}),s.jsx("span",{className:"text-muted-foreground",children:o.dialCode}),s.jsx("svg",{className:"h-4 w-4 opacity-50",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:"m6 9 6 6 6-6"})})]}),s.jsx("input",{type:"tel",placeholder:t,disabled:!0,className:be("flex-1 h-9 rounded-l-none rounded-r-md border border-input bg-muted/50 px-3 py-2 text-sm","placeholder:text-muted-foreground","disabled:cursor-not-allowed disabled:opacity-50")})]})},GC=[{type:"email",structure:"field",typeCategory:"Contact",label:"Email",description:"Email address input",icon:"✉️",category:"field",subCategory:"contact",dataType:"string",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0,showPrefix:!1,showSuffix:!1},fields:[]},getDefaultValues:()=>({properties:{label:"Email",placeholder:"email@example.com"},layout:{labelPosition:"top",size:"full"},validation:{}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,children:s.jsx(Qr,{icon:"✉️",children:s.jsx("input",{type:"email",placeholder:o||"email@example.com",disabled:!0,className:`${lt()} pl-10`})})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:l,onChange:i,errors:c,isDisabled:d}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsx(Qr,{icon:"✉️",children:s.jsx("input",{type:"email",placeholder:o||"email@example.com",value:l??"",onChange:p=>i==null?void 0:i(p.target.value),disabled:d,className:`${bt({hasError:((c==null?void 0:c.length)??0)>0,disabled:d})} pl-10`})})})}},{type:"phone",structure:"field",typeCategory:"Contact",label:"Phone",description:"Phone number input with country code",icon:"📱",category:"field",subCategory:"contact",dataType:"object",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0,showPrefix:!1,showSuffix:!1},configSection:{title:"Phone Settings",icon:"📱"},fields:[{key:"defaultCountry",label:"Default Country",type:"select",section:"config",options:[{value:"US",label:"🇺🇸 United States (+1)"},{value:"GB",label:"🇬🇧 United Kingdom (+44)"},{value:"CA",label:"🇨🇦 Canada (+1)"},{value:"AU",label:"🇦🇺 Australia (+61)"},{value:"DE",label:"🇩🇪 Germany (+49)"},{value:"FR",label:"🇫🇷 France (+33)"},{value:"IT",label:"🇮🇹 Italy (+39)"},{value:"ES",label:"🇪🇸 Spain (+34)"},{value:"NL",label:"🇳🇱 Netherlands (+31)"},{value:"BE",label:"🇧🇪 Belgium (+32)"},{value:"CH",label:"🇨🇭 Switzerland (+41)"},{value:"AT",label:"🇦🇹 Austria (+43)"},{value:"SE",label:"🇸🇪 Sweden (+46)"},{value:"NO",label:"🇳🇴 Norway (+47)"},{value:"DK",label:"🇩🇰 Denmark (+45)"},{value:"FI",label:"🇫🇮 Finland (+358)"},{value:"IE",label:"🇮🇪 Ireland (+353)"},{value:"PT",label:"🇵🇹 Portugal (+351)"},{value:"PL",label:"🇵🇱 Poland (+48)"},{value:"TR",label:"🇹🇷 Turkey (+90)"},{value:"IN",label:"🇮🇳 India (+91)"},{value:"JP",label:"🇯🇵 Japan (+81)"},{value:"KR",label:"🇰🇷 South Korea (+82)"},{value:"BR",label:"🇧🇷 Brazil (+55)"},{value:"MX",label:"🇲🇽 Mexico (+52)"}]},{key:"format",label:"Number Format",type:"select",section:"config",options:[{value:"international",label:"International (+1 555 123 4567)"},{value:"national",label:"National ((555) 123-4567)"}]}]},getDefaultValues:()=>({properties:{label:"Phone",placeholder:"Phone number"},layout:{labelPosition:"top",size:"full"},config:{defaultCountry:"US",format:"international"}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,config:l}=B(e),i=(l==null?void 0:l.defaultCountry)||"US";return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,children:s.jsx(FC,{defaultCountry:i,placeholder:o||"Phone number"})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:l,onChange:i,errors:c,isDisabled:d,config:p}=B(e),u=(p==null?void 0:p.defaultCountry)||"US",f=h=>{i==null||i(h)};return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsx(LC,{value:l,onChange:f,defaultCountry:u,disabled:d,placeholder:o||"Phone number",hasError:((c==null?void 0:c.length)??0)>0})})}},{type:"url",structure:"field",typeCategory:"Contact",label:"URL",description:"Website URL input",icon:"🔗",category:"field",subCategory:"contact",dataType:"string",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0,showPrefix:!1,showSuffix:!1},fields:[]},getDefaultValues:()=>({properties:{label:"Website",placeholder:"https://example.com"},layout:{labelPosition:"top",size:"full"}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,children:s.jsx(Qr,{icon:"🔗",children:s.jsx("input",{type:"url",placeholder:o||"https://example.com",disabled:!0,className:`${lt()} pl-10`})})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:l,onChange:i,errors:c,isDisabled:d}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsx(Qr,{icon:"🔗",children:s.jsx("input",{type:"url",placeholder:o||"https://example.com",value:l??"",onChange:p=>i==null?void 0:i(p.target.value),disabled:d,className:`${bt({hasError:((c==null?void 0:c.length)??0)>0,disabled:d})} pl-10`})})})}},{type:"location",structure:"field",typeCategory:"Contact",label:"Location",description:"Address/location input",icon:"📍",category:"field",subCategory:"contact",dataType:"object",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0,showPrefix:!1,showSuffix:!1},configSection:{title:"Location Settings",icon:"📍"},fields:[{key:"enableGeolocation",label:"Enable Geolocation",type:"checkbox",section:"config",description:"Allow auto-detect location"},{key:"showMap",label:"Show Map",type:"checkbox",section:"config",description:"Display map preview"},{key:"mapProvider",label:"Map Provider",type:"select",section:"config",showWhen:{field:"showMap",value:!0},options:[{value:"google",label:"Google Maps"},{value:"openstreetmap",label:"OpenStreetMap"}]}]},getDefaultValues:()=>({properties:{label:"Location",placeholder:"Enter address...",description:"Enter your address"},layout:{labelPosition:"top",size:"full"},config:{enableGeolocation:!1,showMap:!1,mapProvider:"openstreetmap"}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,config:l}=B(e);return s.jsxs(ne,{label:t,description:r,required:n,labelPosition:a,children:[s.jsx(Qr,{icon:"📍",children:s.jsx("input",{type:"text",placeholder:o||"Enter address...",disabled:!0,className:`${lt()} pl-10`})}),(l==null?void 0:l.showMap)&&s.jsx("div",{className:"h-32 bg-gray-200 rounded-md flex items-center justify-center text-gray-400 text-sm mt-2",children:"🗺️ Map Preview"})]})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:l,onChange:i,errors:c,isDisabled:d,config:p}=B(e);return s.jsx(ne,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsxs("div",{className:"space-y-2",children:[s.jsx(Qr,{icon:"📍",children:s.jsx("input",{type:"text",placeholder:o||"Enter address...",value:typeof l=="string"?l:(l==null?void 0:l.address)??"",onChange:u=>i==null?void 0:i(u.target.value),disabled:d,className:`${bt({hasError:((c==null?void 0:c.length)??0)>0,disabled:d})} pl-10`})}),(p==null?void 0:p.enableGeolocation)&&!d&&s.jsx("button",{type:"button",className:"text-sm text-blue-600 hover:text-blue-700 flex items-center gap-1",children:"📍 Use current location"}),(p==null?void 0:p.showMap)&&s.jsx("div",{className:"h-32 bg-gray-200 rounded-md flex items-center justify-center text-gray-400 text-sm",children:"🗺️ Map Preview"})]})})}}],VC=[{type:"date",structure:"field",typeCategory:"DateTime",label:"Date",description:"Date picker input",icon:"📅",category:"field",subCategory:"dateTime",dataType:"date",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0},configSection:{title:"Date Settings",icon:"📅"},fields:[{key:"format",label:"Display Format",type:"select",section:"config",options:[{value:"YYYY-MM-DD",label:"YYYY-MM-DD (2025-01-15)"},{value:"DD/MM/YYYY",label:"DD/MM/YYYY (15/01/2025)"},{value:"MM/DD/YYYY",label:"MM/DD/YYYY (01/15/2025)"},{value:"MMMM D, YYYY",label:"MMMM D, YYYY (January 15, 2025)"}]},{key:"showCalendar",label:"Show Calendar Picker",type:"checkbox",section:"config",description:"Display a calendar dropdown for date selection"},{key:"minDate",label:"Min Date",type:"text",section:"config",placeholder:"YYYY-MM-DD",description:"Earliest selectable date"},{key:"maxDate",label:"Max Date",type:"text",section:"config",placeholder:"YYYY-MM-DD",description:"Latest selectable date"},{key:"disableWeekends",label:"Disable Weekends",type:"checkbox",section:"config",description:"Prevent selecting Saturday and Sunday"}]},getDefaultValues:()=>({properties:{label:"Date",placeholder:"Select a date"},layout:{labelPosition:"top",size:"full"},config:{format:"YYYY-MM-DD",showCalendar:!0}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n}=B(e);return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsx("input",{type:"date",disabled:!0,className:lt()})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c}=B(e);return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsx("input",{type:"date",value:a??"",onChange:d=>l==null?void 0:l(d.target.value),disabled:c,className:bt({hasError:((i==null?void 0:i.length)??0)>0,disabled:c})})})}},{type:"time",structure:"field",typeCategory:"DateTime",label:"Time",description:"Time picker input",icon:"🕐",category:"field",subCategory:"dateTime",dataType:"string",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0},configSection:{title:"Time Settings",icon:"⏰"},fields:[{key:"timeFormat",label:"Time Format",type:"select",section:"config",options:[{value:"12h",label:"12-hour (AM / PM)"},{value:"24h",label:"24-hour"}]},{key:"timeInterval",label:"Minute Interval",type:"select",section:"config",description:"Granularity for the time dropdown",options:[{value:5,label:"5 minutes"},{value:10,label:"10 minutes"},{value:15,label:"15 minutes"},{value:30,label:"30 minutes"},{value:60,label:"1 hour"}]},{key:"minTime",label:"Earliest Time",type:"text",section:"config",placeholder:"09:00",description:"Minimum selectable time",colSpan:1},{key:"maxTime",label:"Latest Time",type:"text",section:"config",placeholder:"17:00",description:"Maximum selectable time",colSpan:1},{key:"showNowButton",label:'Show "Now" Button',type:"checkbox",section:"config",description:"Quick-fill with the current time"}]},getDefaultValues:()=>({properties:{label:"Time",placeholder:"Select a time"},layout:{labelPosition:"top",size:"full"},config:{timeFormat:"24h",timeInterval:15}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n}=B(e);return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsx("input",{type:"time",disabled:!0,className:lt()})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c}=B(e);return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsx("input",{type:"time",value:a??"",onChange:d=>l==null?void 0:l(d.target.value),disabled:c,className:bt({hasError:((i==null?void 0:i.length)??0)>0,disabled:c})})})}},{type:"dateTime",structure:"field",typeCategory:"DateTime",label:"Date & Time",description:"Combined date and time picker",icon:"📆",category:"field",subCategory:"dateTime",dataType:"date",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0},configSection:{title:"Date & Time Settings",icon:"📅"},fields:[{key:"format",label:"Date Format",type:"select",section:"config",options:[{value:"YYYY-MM-DD",label:"YYYY-MM-DD"},{value:"DD/MM/YYYY",label:"DD/MM/YYYY"},{value:"MM/DD/YYYY",label:"MM/DD/YYYY"},{value:"MMMM D, YYYY",label:"MMMM D, YYYY"}]},{key:"timeFormat",label:"Time Format",type:"select",section:"config",options:[{value:"12h",label:"12-hour (AM / PM)"},{value:"24h",label:"24-hour"}]},{key:"timeInterval",label:"Minute Interval",type:"select",section:"config",options:[{value:5,label:"5 minutes"},{value:10,label:"10 minutes"},{value:15,label:"15 minutes"},{value:30,label:"30 minutes"},{value:60,label:"1 hour"}]},{key:"minDate",label:"Min Date",type:"text",section:"config",placeholder:"YYYY-MM-DD",colSpan:1},{key:"maxDate",label:"Max Date",type:"text",section:"config",placeholder:"YYYY-MM-DD",colSpan:1},{key:"showSeconds",label:"Show Seconds",type:"checkbox",section:"config",description:"Include seconds in the time picker"}]},getDefaultValues:()=>({properties:{label:"Date & Time",placeholder:"Select date and time"},layout:{labelPosition:"top",size:"full"},config:{format:"YYYY-MM-DD",timeFormat:"24h",timeInterval:15}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n}=B(e);return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"date",disabled:!0,className:`flex-1 ${lt()}`}),s.jsx("input",{type:"time",disabled:!0,className:`w-32 ${lt()}`})]})})},render:e=>{var b;const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c}=B(e),d=typeof a=="object"?a==null?void 0:a.date:(a==null?void 0:a.split("T")[0])??"",p=typeof a=="object"?a==null?void 0:a.time:((b=a==null?void 0:a.split("T")[1])==null?void 0:b.substring(0,5))??"",u=g=>{typeof a=="object"?l==null||l({...a,date:g}):l==null||l(`${g}T${p||"00:00"}`)},f=g=>{typeof a=="object"?l==null||l({...a,time:g}):l==null||l(`${d||""}T${g}`)},h=bt({hasError:((i==null?void 0:i.length)??0)>0,disabled:c});return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"date",value:d,onChange:g=>u(g.target.value),disabled:c,className:`flex-1 ${h}`}),s.jsx("input",{type:"time",value:p,onChange:g=>f(g.target.value),disabled:c,className:`w-32 ${h}`})]})})}},{type:"multipleDates",structure:"field",typeCategory:"DateTime",label:"Multiple Dates",description:"Select multiple dates",icon:"📅",category:"field",subCategory:"dateTime",dataType:"array",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0},configSection:{title:"Multiple Dates Settings",icon:"📆"},fields:[{key:"format",label:"Display Format",type:"select",section:"config",options:[{value:"YYYY-MM-DD",label:"YYYY-MM-DD"},{value:"DD/MM/YYYY",label:"DD/MM/YYYY"},{value:"MM/DD/YYYY",label:"MM/DD/YYYY"},{value:"MMMM D, YYYY",label:"MMMM D, YYYY"}]},{key:"showCalendar",label:"Show Calendar Picker",type:"checkbox",section:"config",description:"Display a calendar for multi-date selection"},{key:"minDates",label:"Min Dates",type:"number",section:"validation",min:1,placeholder:"1",description:"Minimum number of dates to select",colSpan:1},{key:"maxDates",label:"Max Dates",type:"number",section:"validation",min:1,placeholder:"10",description:"Maximum number of dates allowed",colSpan:1},{key:"allowPastDates",label:"Allow Past Dates",type:"checkbox",section:"config",description:"Let users select dates in the past"},{key:"disableWeekends",label:"Disable Weekends",type:"checkbox",section:"config",description:"Prevent selecting Saturday and Sunday"}]},getDefaultValues:()=>({properties:{label:"Multiple Dates",placeholder:"Add dates",description:"Select one or more dates"},layout:{labelPosition:"top",size:"full"},config:{format:"YYYY-MM-DD",showCalendar:!0}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n}=B(e);return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-100 text-blue-800 text-sm rounded",children:["2024-01-15",s.jsx("button",{disabled:!0,className:"text-blue-600",children:"×"})]}),s.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-100 text-blue-800 text-sm rounded",children:["2024-01-20",s.jsx("button",{disabled:!0,className:"text-blue-600",children:"×"})]})]}),s.jsx("input",{type:"date",disabled:!0,className:lt()})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c}=B(e),d=Array.isArray(a)?a:[],p=f=>{f&&!d.includes(f)&&(l==null||l([...d,f]))},u=f=>{l==null||l(d.filter(h=>h!==f))};return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:"space-y-2",children:[d.length>0&&s.jsx("div",{className:"flex flex-wrap gap-2",children:d.map((f,h)=>s.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 bg-blue-100 text-blue-800 text-sm rounded",children:[f,!c&&s.jsx("button",{type:"button",onClick:()=>u(f),className:"text-blue-600 hover:text-blue-800",children:"×"})]},h))}),s.jsx("input",{type:"date",onChange:f=>{p(f.target.value),f.target.value=""},disabled:c,className:bt({hasError:((i==null?void 0:i.length)??0)>0,disabled:c})})]})})}},{type:"dateRange",structure:"field",typeCategory:"DateTime",label:"Date Range",description:"Select a date range",icon:"📆",category:"field",subCategory:"dateTime",dataType:"object",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0},configSection:{title:"Date Range Settings",icon:"📊"},fields:[{key:"format",label:"Display Format",type:"select",section:"config",options:[{value:"YYYY-MM-DD",label:"YYYY-MM-DD"},{value:"DD/MM/YYYY",label:"DD/MM/YYYY"},{value:"MM/DD/YYYY",label:"MM/DD/YYYY"},{value:"MMMM D, YYYY",label:"MMMM D, YYYY"}]},{key:"showCalendar",label:"Show Calendar Picker",type:"checkbox",section:"config",description:"Display a calendar range selector"},{key:"minDays",label:"Min Days",type:"number",section:"config",min:1,placeholder:"1",description:"Minimum length of the selected range",colSpan:1},{key:"maxDays",label:"Max Days",type:"number",section:"config",min:1,placeholder:"30",description:"Maximum length of the selected range",colSpan:1},{key:"allowSameDayRange",label:"Allow Same-Day Range",type:"checkbox",section:"config",description:"Start and end date can be the same day"},{key:"disableWeekends",label:"Disable Weekends",type:"checkbox",section:"config",description:"Exclude Saturday and Sunday from selection"},{key:"minDate",label:"Earliest Start Date",type:"text",section:"config",placeholder:"YYYY-MM-DD",description:"First selectable date in the range"},{key:"maxDate",label:"Latest End Date",type:"text",section:"config",placeholder:"YYYY-MM-DD",description:"Last selectable date in the range"}]},getDefaultValues:()=>({properties:{label:"Date Range",placeholder:"Select date range",description:"Select start and end dates"},layout:{labelPosition:"top",size:"full"},config:{format:"YYYY-MM-DD",showCalendar:!0,minDays:1}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n}=B(e);return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"date",disabled:!0,placeholder:"Start date",className:`flex-1 ${lt()}`}),s.jsx("span",{className:"text-gray-400",children:"→"}),s.jsx("input",{type:"date",disabled:!0,placeholder:"End date",className:`flex-1 ${lt()}`})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c}=B(e),d=(a==null?void 0:a.start)??"",p=(a==null?void 0:a.end)??"",u=b=>{l==null||l({start:b,end:p})},f=b=>{l==null||l({start:d,end:b})},h=bt({hasError:((i==null?void 0:i.length)??0)>0,disabled:c});return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{type:"date",value:d,onChange:b=>u(b.target.value),disabled:c,placeholder:"Start date",className:`flex-1 ${h}`}),s.jsx("span",{className:"text-gray-400",children:"→"}),s.jsx("input",{type:"date",value:p,onChange:b=>f(b.target.value),disabled:c,min:d,placeholder:"End date",className:`flex-1 ${h}`})]})})}}],zC=[{type:"paragraph",structure:"field",typeCategory:"Display",label:"Paragraph",description:"Static text content",icon:"📜",category:"field",subCategory:"display",dataType:"string",supportsValidation:!1,getDefaultValues:()=>({properties:{label:"Paragraph",content:"Enter your paragraph text here. This is a static text element that displays information to users."},layout:{labelPosition:"hidden",size:"full"},config:{textAlign:"left",fontSize:"medium",fontWeight:"normal"}}),renderOnCanvas:e=>{const{element:t,config:r}=B(e),o=t.properties.content||"Enter your paragraph text here.",n={small:"text-sm",medium:"text-base",large:"text-lg"}[(r==null?void 0:r.fontSize)||"medium"],a={normal:"font-normal",medium:"font-medium",bold:"font-bold"}[(r==null?void 0:r.fontWeight)||"normal"];return s.jsx("div",{className:"prose prose-sm max-w-none",style:{textAlign:(r==null?void 0:r.textAlign)||"left"},children:s.jsx("p",{className:`text-gray-700 ${n} ${a}`,children:o})})},render:e=>{const{element:t,config:r}=B(e),o=t.properties.content||"",n={small:"text-sm",medium:"text-base",large:"text-lg"}[(r==null?void 0:r.fontSize)||"medium"],a={normal:"font-normal",medium:"font-medium",bold:"font-bold"}[(r==null?void 0:r.fontWeight)||"normal"];return s.jsx("div",{className:"prose prose-sm max-w-none",style:{textAlign:(r==null?void 0:r.textAlign)||"left"},children:s.jsx("p",{className:`text-gray-700 ${n} ${a}`,children:o})})}},{type:"image",structure:"field",typeCategory:"Display",label:"Image",description:"Display an image",icon:"🖼️",category:"field",subCategory:"display",dataType:"string",supportsValidation:!1,getDefaultValues:()=>({properties:{label:"Image",alt:"Image description",src:""},layout:{labelPosition:"hidden",size:"full"},config:{imageWidth:"100%",objectFit:"contain",borderRadius:0}}),renderOnCanvas:e=>{const{element:t,config:r}=B(e),o=t.properties.src,n=t.properties.alt||"Image";return o?s.jsx("div",{className:"space-y-1.5",children:s.jsx("img",{src:o,alt:n,className:"max-w-full rounded",style:{width:(r==null?void 0:r.imageWidth)||"100%",objectFit:(r==null?void 0:r.objectFit)||"contain",borderRadius:(r==null?void 0:r.borderRadius)||0}})}):s.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-8 text-center bg-gray-50",children:[s.jsx("span",{className:"text-4xl",children:"🏞️"}),s.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"No image selected"}),s.jsx("p",{className:"text-xs text-gray-400",children:"Set image URL in properties"})]})},render:e=>{const{element:t,config:r}=B(e),o=t.properties.src,n=t.properties.alt||"Image";return o?s.jsx("div",{className:"space-y-1.5",children:s.jsx("img",{src:o,alt:n,className:"max-w-full",style:{width:(r==null?void 0:r.imageWidth)||"100%",objectFit:(r==null?void 0:r.objectFit)||"contain",borderRadius:(r==null?void 0:r.borderRadius)||0}})}):null}},{type:"link",structure:"field",typeCategory:"Display",label:"Link",description:"Clickable link or button",icon:"🔗",category:"field",subCategory:"display",dataType:"string",supportsValidation:!1,getDefaultValues:()=>({properties:{label:"Link",href:"https://example.com",content:"Click here",target:"_blank"},layout:{labelPosition:"hidden",size:"default"},config:{linkStyle:"text"}}),renderOnCanvas:e=>{const{element:t,config:r}=B(e),o=t.properties.content||(r==null?void 0:r.linkText)||"Click here",n=t.properties.href||"https://example.com";return(r==null?void 0:r.linkStyle)==="button"?s.jsxs("div",{className:"space-y-1",children:[s.jsx("a",{href:"#",onClick:a=>a.preventDefault(),className:"inline-block px-4 py-2 bg-blue-600 text-white rounded-md text-sm hover:bg-blue-700",children:o}),s.jsx("p",{className:"text-xs text-gray-400",children:n})]}):s.jsxs("div",{className:"space-y-1",children:[s.jsx("a",{href:"#",onClick:a=>a.preventDefault(),className:"text-blue-600 hover:text-blue-800 underline text-sm",children:o}),s.jsx("p",{className:"text-xs text-gray-400",children:n})]})},render:e=>{const{element:t,config:r}=B(e),o=t.properties.content||(r==null?void 0:r.linkText)||"Click here",n=t.properties.href||"#",a=t.properties.target||"_blank";return(r==null?void 0:r.linkStyle)==="button"?s.jsx("a",{href:n,target:a,rel:a==="_blank"?"noopener noreferrer":void 0,className:"inline-block px-4 py-2 bg-blue-600 text-white rounded-md text-sm hover:bg-blue-700 transition-colors",children:o}):s.jsx("a",{href:n,target:a,rel:a==="_blank"?"noopener noreferrer":void 0,className:"text-blue-600 hover:text-blue-800 underline text-sm transition-colors",children:o})}}],BC=[{type:"divider",structure:"page",typeCategory:"Layout",label:"Divider",description:"Horizontal line separator",icon:"➖",category:"page",subCategory:"layout",supportsValidation:!1,getDefaultValues:()=>({properties:{},layout:{size:"full"},config:{style:"solid",thickness:1,color:"rgb(209, 213, 219)"}}),renderOnCanvas:e=>{const{config:t}=B(e);return s.jsx("hr",{style:{borderStyle:(t==null?void 0:t.style)||"solid",borderWidth:`${(t==null?void 0:t.thickness)||1}px 0 0 0`,borderColor:(t==null?void 0:t.color)||"rgb(209, 213, 219)"}})},render:e=>{const{config:t}=B(e);return s.jsx("hr",{style:{borderStyle:(t==null?void 0:t.style)||"solid",borderWidth:`${(t==null?void 0:t.thickness)||1}px 0 0 0`,borderColor:(t==null?void 0:t.color)||"rgb(209, 213, 219)"}})}},{type:"spacer",structure:"page",typeCategory:"Layout",label:"Spacer",description:"Vertical spacing element",icon:"↕️",category:"page",subCategory:"layout",supportsValidation:!1,getDefaultValues:()=>({properties:{},layout:{size:"full",height:24},config:{spacerHeight:24}}),renderOnCanvas:e=>{const{config:t}=B(e),r=(t==null?void 0:t.spacerHeight)||24;return s.jsx("div",{className:"bg-gray-100/50 border border-dashed border-gray-300 rounded flex items-center justify-center",style:{height:r},children:s.jsxs("span",{className:"text-xs text-gray-400",children:["↕️ Spacer (",r,"px)"]})})},render:e=>{const{config:t}=B(e),r=(t==null?void 0:t.spacerHeight)||24;return s.jsx("div",{style:{height:r}})}},{type:"formHeading",structure:"page",typeCategory:"Heading",label:"Form Heading",description:"Main form title",icon:"📋",category:"page",subCategory:"heading",supportsValidation:!1,getDefaultValues:()=>({properties:{label:"Form Title",description:"Form description goes here"},layout:{size:"full"},config:{level:1,alignment:"left"}}),renderOnCanvas:e=>{const{label:t,description:r,config:o}=B(e);return s.jsxs("div",{className:`text-${(o==null?void 0:o.alignment)||"left"}`,children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:t}),r&&s.jsx("p",{className:"text-gray-600 mt-1",children:r})]})},render:e=>{const{label:t,description:r,config:o}=B(e);return s.jsxs("div",{className:`text-${(o==null?void 0:o.alignment)||"left"}`,children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:t}),r&&s.jsx("p",{className:"text-gray-600 mt-1",children:r})]})}},{type:"sectionHeading",structure:"page",typeCategory:"Heading",label:"Section Heading",description:"Section title",icon:"📑",category:"page",subCategory:"heading",supportsValidation:!1,getDefaultValues:()=>({properties:{label:"Section Title"},layout:{size:"full"},config:{level:2,alignment:"left"}}),renderOnCanvas:e=>{const{label:t,description:r,config:o}=B(e);return s.jsxs("div",{className:`text-${(o==null?void 0:o.alignment)||"left"}`,children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-800",children:t}),r&&s.jsx("p",{className:"text-gray-500 text-sm mt-1",children:r})]})},render:e=>{const{label:t,description:r,config:o}=B(e);return s.jsxs("div",{className:`text-${(o==null?void 0:o.alignment)||"left"}`,children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-800",children:t}),r&&s.jsx("p",{className:"text-gray-500 text-sm mt-1",children:r})]})}},{type:"subheading",structure:"page",typeCategory:"Heading",label:"Subheading",description:"Smaller heading",icon:"📝",category:"page",subCategory:"heading",supportsValidation:!1,getDefaultValues:()=>({properties:{label:"Subheading"},layout:{size:"full"},config:{level:3,alignment:"left"}}),renderOnCanvas:e=>{const{label:t,description:r,config:o}=B(e);return s.jsxs("div",{className:`text-${(o==null?void 0:o.alignment)||"left"}`,children:[s.jsx("h3",{className:"text-lg font-medium text-gray-700",children:t}),r&&s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:r})]})},render:e=>{const{label:t,description:r,config:o}=B(e);return s.jsxs("div",{className:`text-${(o==null?void 0:o.alignment)||"left"}`,children:[s.jsx("h3",{className:"text-lg font-medium text-gray-700",children:t}),r&&s.jsx("p",{className:"text-gray-500 text-sm mt-0.5",children:r})]})}},{type:"submit",structure:"page",typeCategory:"Special",label:"Submit Button",description:"Form submission button",icon:"🚀",category:"page",subCategory:"special",supportsValidation:!1,getDefaultValues:()=>({properties:{label:"Submit"},layout:{size:"default"},config:{buttonText:"Submit",buttonStyle:"primary",buttonSize:"medium",showIcon:!1,loadingText:"Submitting..."}}),renderOnCanvas:e=>{const{label:t,config:r}=B(e),o=(r==null?void 0:r.buttonText)||t||"Submit",n=(r==null?void 0:r.buttonStyle)||"primary",a=(r==null?void 0:r.buttonSize)||"medium",l={primary:"bg-blue-600 text-white hover:bg-blue-700",secondary:"bg-gray-600 text-white hover:bg-gray-700",outline:"border-2 border-blue-600 text-blue-600 bg-transparent hover:bg-blue-50",ghost:"text-blue-600 hover:bg-blue-50"},i={small:"px-4 py-1.5 text-sm",medium:"px-6 py-2.5 text-base",large:"px-8 py-3 text-lg"};return s.jsxs("button",{type:"button",disabled:!0,className:`rounded-md font-medium transition-colors ${l[n]} ${i[a]}`,children:[(r==null?void 0:r.showIcon)&&(r==null?void 0:r.iconPosition)==="left"&&s.jsx("span",{className:"mr-2",children:"🚀"}),o,(r==null?void 0:r.showIcon)&&(r==null?void 0:r.iconPosition)==="right"&&s.jsx("span",{className:"ml-2",children:"🚀"})]})},render:e=>{const{label:t,config:r,isDisabled:o}=B(e),n=(r==null?void 0:r.buttonText)||t||"Submit",a=(r==null?void 0:r.buttonStyle)||"primary",l=(r==null?void 0:r.buttonSize)||"medium",i={primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-gray-600 text-white hover:bg-gray-700 focus:ring-gray-500",outline:"border-2 border-blue-600 text-blue-600 bg-transparent hover:bg-blue-50 focus:ring-blue-500",ghost:"text-blue-600 hover:bg-blue-50 focus:ring-blue-500"},c={small:"px-4 py-1.5 text-sm",medium:"px-6 py-2.5 text-base",large:"px-8 py-3 text-lg"};return s.jsxs("button",{type:"submit",disabled:o,className:`rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 ${i[a]} ${c[l]} ${o?"opacity-50 cursor-not-allowed":""}`,children:[(r==null?void 0:r.showIcon)&&(r==null?void 0:r.iconPosition)==="left"&&s.jsx("span",{className:"mr-2",children:"🚀"}),n,(r==null?void 0:r.showIcon)&&(r==null?void 0:r.iconPosition)==="right"&&s.jsx("span",{className:"ml-2",children:"🚀"})]})}}],UC=[{type:"singleChoiceMatrix",structure:"field",typeCategory:"Matrix",label:"Single Choice Matrix",description:"Matrix with radio button selections",icon:"📊",category:"field",subCategory:"matrix",dataType:"object",supportsValidation:!0,supportsMatrix:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!1,showDescription:!0},configSection:{title:"Matrix Settings",icon:"📊"},fields:[{key:"randomizeRows",label:"Randomize Row Order",type:"checkbox",section:"config",description:"Shuffle rows for each respondent (surveys)"},{key:"randomizeColumns",label:"Randomize Column Order",type:"checkbox",section:"config",description:"Shuffle columns for each respondent"},{key:"showRowNumbers",label:"Show Row Numbers",type:"checkbox",section:"config",description:"Number each row for easy reference"},{key:"requiredPerRow",label:"Require Every Row",type:"checkbox",section:"config",description:"Each row must have a selection before submit"},{key:"layoutStyle",label:"Layout Style",type:"select",section:"config",description:"Visual presentation of the matrix",options:[{value:"table",label:"Table (grid)"},{value:"card",label:"Card per row"},{value:"inline",label:"Inline (compact)"}]}]},getDefaultValues:()=>({properties:{label:"Single Choice Matrix",description:"Select one option per row"},layout:{labelPosition:"top",size:"full"},config:{matrixRows:[{id:"row1",label:"Row 1"},{id:"row2",label:"Row 2"},{id:"row3",label:"Row 3"}],matrixColumns:[{id:"col1",label:"Option 1"},{id:"col2",label:"Option 2"},{id:"col3",label:"Option 3"}]}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e),l=(a==null?void 0:a.matrixRows)||[],i=(a==null?void 0:a.matrixColumns)||[];return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full border-collapse text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"p-2 text-left"}),i.map(c=>s.jsx("th",{className:"p-2 text-center font-medium text-gray-700",children:c.label},c.id))]})}),s.jsx("tbody",{children:l.map(c=>s.jsxs("tr",{className:"border-t border-gray-200",children:[s.jsx("td",{className:"p-2 text-gray-700",children:c.label}),i.map(d=>s.jsx("td",{className:"p-2 text-center",children:s.jsx("input",{type:"radio",disabled:!0,name:c.id,className:"text-blue-600"})},d.id))]},c.id))})]})})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),p=(d==null?void 0:d.matrixRows)||[],u=(d==null?void 0:d.matrixColumns)||[],f=a||{},h=(b,g)=>{c||l==null||l({...f,[b]:g})};return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full border-collapse text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"p-2 text-left"}),u.map(b=>s.jsx("th",{className:"p-2 text-center font-medium text-gray-700",children:b.label},b.id))]})}),s.jsx("tbody",{children:p.map(b=>s.jsxs("tr",{className:"border-t border-gray-200",children:[s.jsx("td",{className:"p-2 text-gray-700",children:b.label}),u.map(g=>s.jsx("td",{className:"p-2 text-center",children:s.jsx("input",{type:"radio",name:`${e.element.id}-${b.id}`,checked:f[b.id]===g.id,onChange:()=>h(b.id,g.id),disabled:c,className:"text-blue-600 cursor-pointer disabled:cursor-not-allowed"})},g.id))]},b.id))})]})})})}},{type:"multipleChoiceMatrix",structure:"field",typeCategory:"Matrix",label:"Multiple Choice Matrix",description:"Matrix with checkbox selections",icon:"📋",category:"field",subCategory:"matrix",dataType:"object",supportsValidation:!0,supportsMatrix:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!1,showDescription:!0},configSection:{title:"Matrix Settings",icon:"📋"},fields:[{key:"allowMultiplePerRow",label:"Allow Multiple Per Row",type:"checkbox",section:"config",description:"Let users select more than one column per row"},{key:"maxSelectionsPerRow",label:"Max Selections Per Row",type:"number",section:"config",min:1,placeholder:"e.g. 3",description:"Limit how many columns can be checked per row",showWhen:{field:"allowMultiplePerRow",value:!0}},{key:"randomizeRows",label:"Randomize Row Order",type:"checkbox",section:"config",description:"Shuffle rows for each respondent (surveys)"},{key:"randomizeColumns",label:"Randomize Column Order",type:"checkbox",section:"config",description:"Shuffle columns for each respondent"},{key:"showRowNumbers",label:"Show Row Numbers",type:"checkbox",section:"config",description:"Number each row for easy reference"},{key:"showSelectAll",label:'Show "Select All" Column',type:"checkbox",section:"config",description:"Add a column header to check all rows at once"}]},getDefaultValues:()=>({properties:{label:"Multiple Choice Matrix",description:"Select multiple options per row"},layout:{labelPosition:"top",size:"full"},config:{matrixRows:[{id:"row1",label:"Row 1"},{id:"row2",label:"Row 2"},{id:"row3",label:"Row 3"}],matrixColumns:[{id:"col1",label:"Option 1"},{id:"col2",label:"Option 2"},{id:"col3",label:"Option 3"}],allowMultiplePerRow:!0}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e),l=(a==null?void 0:a.matrixRows)||[],i=(a==null?void 0:a.matrixColumns)||[];return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full border-collapse text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"p-2 text-left"}),i.map(c=>s.jsx("th",{className:"p-2 text-center font-medium text-gray-700",children:c.label},c.id))]})}),s.jsx("tbody",{children:l.map(c=>s.jsxs("tr",{className:"border-t border-gray-200",children:[s.jsx("td",{className:"p-2 text-gray-700",children:c.label}),i.map(d=>s.jsx("td",{className:"p-2 text-center",children:s.jsx("input",{type:"checkbox",disabled:!0,className:"text-blue-600 rounded"})},d.id))]},c.id))})]})})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),p=(d==null?void 0:d.matrixRows)||[],u=(d==null?void 0:d.matrixColumns)||[],f=a||{},h=(b,g)=>{if(c)return;const y=f[b]||[],x=y.includes(g)?y.filter(v=>v!==g):[...y,g];l==null||l({...f,[b]:x})};return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full border-collapse text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:"p-2 text-left"}),u.map(b=>s.jsx("th",{className:"p-2 text-center font-medium text-gray-700",children:b.label},b.id))]})}),s.jsx("tbody",{children:p.map(b=>s.jsxs("tr",{className:"border-t border-gray-200",children:[s.jsx("td",{className:"p-2 text-gray-700",children:b.label}),u.map(g=>s.jsx("td",{className:"p-2 text-center",children:s.jsx("input",{type:"checkbox",checked:(f[b.id]||[]).includes(g.id),onChange:()=>h(b.id,g.id),disabled:c,className:"text-blue-600 rounded cursor-pointer disabled:cursor-not-allowed"})},g.id))]},b.id))})]})})})}},{type:"matrixTable",structure:"field",typeCategory:"Matrix",label:"Matrix Table",description:"Table with text/number inputs",icon:"📑",category:"field",subCategory:"matrix",dataType:"object",supportsValidation:!0,supportsMatrix:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!1,showDescription:!0},configSection:{title:"Table Settings",icon:"📑"},fields:[{key:"showRowNumbers",label:"Show Row Numbers",type:"checkbox",section:"config",description:"Number each row for easy reference"},{key:"showColumnTotals",label:"Show Column Totals",type:"checkbox",section:"config",description:"Display sum at the bottom of numeric columns"},{key:"allowAddRows",label:"Allow Adding Rows",type:"checkbox",section:"config",description:"Let users add extra rows beyond the defaults"},{key:"allowDeleteRows",label:"Allow Deleting Rows",type:"checkbox",section:"config",description:"Let users remove rows they added",showWhen:{field:"allowAddRows",value:!0}},{key:"stickyHeader",label:"Sticky Header",type:"checkbox",section:"config",description:"Keep column headers visible while scrolling"},{key:"cellPlaceholder",label:"Cell Placeholder",type:"text",section:"config",placeholder:"Enter value...",description:"Placeholder text shown inside empty cells"}]},getDefaultValues:()=>({properties:{label:"Matrix Table",description:"Enter values in each cell"},layout:{labelPosition:"top",size:"full"},config:{matrixRows:[{id:"row1",label:"Row 1"},{id:"row2",label:"Row 2"}],matrixColumns:[{id:"col1",label:"Column 1",type:"text"},{id:"col2",label:"Column 2",type:"number"}]}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e),l=(a==null?void 0:a.matrixRows)||[],i=(a==null?void 0:a.matrixColumns)||[];return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full border-collapse text-sm border border-gray-200",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-gray-50",children:[s.jsx("th",{className:"p-2 text-left border border-gray-200"}),i.map(c=>s.jsx("th",{className:"p-2 text-center font-medium text-gray-700 border border-gray-200",children:c.label},c.id))]})}),s.jsx("tbody",{children:l.map(c=>s.jsxs("tr",{children:[s.jsx("td",{className:"p-2 text-gray-700 border border-gray-200 bg-gray-50",children:c.label}),i.map(d=>s.jsx("td",{className:"p-2 border border-gray-200",children:s.jsx("input",{type:d.type==="number"?"number":"text",disabled:!0,className:"w-full px-2 py-1 border border-gray-300 rounded text-sm bg-gray-50"})},d.id))]},c.id))})]})})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),p=(d==null?void 0:d.matrixRows)||[],u=(d==null?void 0:d.matrixColumns)||[],f=a||{},h=(b,g,y)=>{const x={...f,[b]:{...f[b]||{},[g]:y}};l==null||l(x)};return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("table",{className:"w-full border-collapse text-sm border border-gray-200",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"bg-gray-50",children:[s.jsx("th",{className:"p-2 text-left border border-gray-200"}),u.map(b=>s.jsx("th",{className:"p-2 text-center font-medium text-gray-700 border border-gray-200",children:b.label},b.id))]})}),s.jsx("tbody",{children:p.map(b=>s.jsxs("tr",{children:[s.jsx("td",{className:"p-2 text-gray-700 border border-gray-200 bg-gray-50",children:b.label}),u.map(g=>{var y;return s.jsx("td",{className:"p-2 border border-gray-200",children:s.jsx("input",{type:g.type==="number"?"number":"text",value:((y=f[b.id])==null?void 0:y[g.id])??"",onChange:x=>h(b.id,g.id,g.type==="number"?Number(x.target.value):x.target.value),disabled:c,className:`w-full px-2 py-1 border rounded text-sm ${c?"bg-gray-50 border-gray-300":"bg-white border-gray-300 focus:border-blue-500 focus:ring-1 focus:ring-blue-500"}`})},g.id)})]},b.id))})]})})})}}],WC=[{type:"fileUpload",structure:"field",typeCategory:"FileUpload",label:"File Upload",description:"Single file upload",icon:"📎",category:"field",subCategory:"fileUpload",dataType:"file",supportsValidation:!0,getDefaultValues:()=>({properties:{label:"File Upload",description:"Upload a file"},layout:{labelPosition:"top",size:"full"},config:{accept:"*/*",maxSize:10485760,multiple:!1}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e);return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50",children:[s.jsx("svg",{className:"mx-auto h-8 w-8 text-gray-400",stroke:"currentColor",fill:"none",viewBox:"0 0 48 48",children:s.jsx("path",{d:"M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}),s.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Click or drag to upload"}),s.jsxs("p",{className:"text-xs text-gray-400",children:[(a==null?void 0:a.accept)||"All files"," (Max:"," ",Math.round(((a==null?void 0:a.maxSize)||10485760)/1024/1024),"MB)"]})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),p=b=>{var y;const g=(y=b.target.files)==null?void 0:y[0];g&&(l==null||l(g))},u=b=>{var y;b.preventDefault();const g=(y=b.dataTransfer.files)==null?void 0:y[0];g&&(l==null||l(g))},f=b=>{b.preventDefault()},h=a instanceof File?a.name:a==null?void 0:a.name;return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{onDrop:c?void 0:u,onDragOver:c?void 0:f,className:`border-2 border-dashed rounded-lg p-6 text-center transition-colors ${((i==null?void 0:i.length)??0)>0?"border-red-300 bg-red-50":"border-gray-300 bg-gray-50 hover:border-gray-400"} ${c?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[s.jsx("input",{type:"file",accept:d==null?void 0:d.accept,onChange:p,disabled:c,className:"hidden",id:`file-upload-${e.element.id}`}),s.jsx("label",{htmlFor:`file-upload-${e.element.id}`,className:c?"cursor-not-allowed":"cursor-pointer",children:h?s.jsxs("div",{className:"flex items-center justify-center gap-2",children:[s.jsx("span",{className:"text-2xl",children:"📄"}),s.jsx("span",{className:"text-sm text-gray-700",children:h}),!c&&s.jsx("button",{type:"button",onClick:b=>{b.preventDefault(),l==null||l(null)},className:"text-red-500 hover:text-red-700",children:"×"})]}):s.jsxs(s.Fragment,{children:[s.jsx("svg",{className:"mx-auto h-8 w-8 text-gray-400",stroke:"currentColor",fill:"none",viewBox:"0 0 48 48",children:s.jsx("path",{d:"M28 8H12a4 4 0 00-4 4v20m32-12v8m0 0v8a4 4 0 01-4 4H12a4 4 0 01-4-4v-4m32-4l-3.172-3.172a4 4 0 00-5.656 0L28 28M8 32l9.172-9.172a4 4 0 015.656 0L28 28m0 0l4 4m4-24h8m-4-4v8m-12 4h.02",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}),s.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Click or drag to upload"}),s.jsxs("p",{className:"text-xs text-gray-400",children:[(d==null?void 0:d.accept)||"All files"," (Max:"," ",Math.round(((d==null?void 0:d.maxSize)||10485760)/1024/1024),"MB)"]})]})})]})})}},{type:"imageUpload",structure:"field",typeCategory:"FileUpload",label:"Image Upload",description:"Single image upload with preview",icon:"🖼️",category:"field",subCategory:"fileUpload",dataType:"file",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!1,showDescription:!0},configSection:{title:"Image Upload Settings",icon:"🖼️"},fields:[{key:"maxSize",label:"Max Size (MB)",type:"number",section:"config",min:1,max:100,placeholder:"5",description:"Maximum image file size"},{key:"allowCrop",label:"Allow Cropping",type:"checkbox",section:"config",description:"Let users crop the image after upload"},{key:"aspectRatio",label:"Aspect Ratio",type:"select",section:"config",description:"Constrain crop to a specific ratio",showWhen:{field:"allowCrop",value:!0},options:[{value:"free",label:"Free (no constraint)"},{value:"1:1",label:"1:1 (Square)"},{value:"4:3",label:"4:3 (Standard)"},{value:"16:9",label:"16:9 (Widescreen)"},{value:"3:2",label:"3:2 (Portrait)"},{value:"2:3",label:"2:3 (Landscape)"}]},{key:"minWidth",label:"Min Width (px)",type:"number",section:"config",min:1,placeholder:"e.g. 200",description:"Minimum allowed image width",colSpan:1},{key:"minHeight",label:"Min Height (px)",type:"number",section:"config",min:1,placeholder:"e.g. 200",description:"Minimum allowed image height",colSpan:1},{key:"showPreview",label:"Show Preview",type:"checkbox",section:"config",description:"Display a thumbnail preview of the uploaded image"},{key:"compressOnUpload",label:"Auto-compress",type:"checkbox",section:"config",description:"Automatically compress large images on upload"}]},getDefaultValues:()=>({properties:{label:"Image Upload",description:"Upload an image"},layout:{labelPosition:"top",size:"full"},config:{accept:"image/*",maxSize:5242880,multiple:!1,allowCrop:!1}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e);return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50",children:[s.jsx("span",{className:"text-4xl",children:"🖼️"}),s.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Click or drag to upload image"}),s.jsxs("p",{className:"text-xs text-gray-400",children:["Images only (Max:"," ",Math.round(((a==null?void 0:a.maxSize)||5242880)/1024/1024),"MB)"]})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),[p,u]=C.useState(null);C.useEffect(()=>{if(a instanceof File){const b=new FileReader;b.onloadend=()=>{u(b.result)},b.readAsDataURL(a)}else u(typeof a=="string"?a:null)},[a]);const f=b=>{var y;const g=(y=b.target.files)==null?void 0:y[0];g&&(l==null||l(g))},h=()=>{l==null||l(null),u(null)};return s.jsx(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:p?s.jsxs("div",{className:"relative inline-block",children:[s.jsx("img",{src:p,alt:"Preview",className:"max-w-full max-h-48 rounded-lg border border-gray-200"}),!c&&s.jsx("button",{type:"button",onClick:h,className:"absolute -top-2 -right-2 w-6 h-6 bg-red-500 text-white rounded-full flex items-center justify-center text-sm hover:bg-red-600",children:"×"})]}):s.jsxs("div",{className:`border-2 border-dashed rounded-lg p-6 text-center transition-colors ${((i==null?void 0:i.length)??0)>0?"border-red-300 bg-red-50":"border-gray-300 bg-gray-50 hover:border-gray-400"} ${c?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[s.jsx("input",{type:"file",accept:(d==null?void 0:d.accept)||"image/*",onChange:f,disabled:c,className:"hidden",id:`image-upload-${e.element.id}`}),s.jsxs("label",{htmlFor:`image-upload-${e.element.id}`,className:c?"cursor-not-allowed":"cursor-pointer",children:[s.jsx("span",{className:"text-4xl",children:"🖼️"}),s.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Click or drag to upload image"}),s.jsxs("p",{className:"text-xs text-gray-400",children:["Images only (Max:"," ",Math.round(((d==null?void 0:d.maxSize)||5242880)/1024/1024),"MB)"]})]})]})})}},{type:"multiFileUpload",structure:"field",typeCategory:"FileUpload",label:"Multi File Upload",description:"Upload multiple files",icon:"📁",category:"field",subCategory:"fileUpload",dataType:"array",supportsValidation:!0,getDefaultValues:()=>({properties:{label:"Multi File Upload",description:"Upload multiple files"},layout:{labelPosition:"top",size:"full"},config:{accept:"*/*",maxSize:10485760,multiple:!0,maxFiles:10}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e);return s.jsxs(ne,{label:t,description:r,required:o,labelPosition:n,children:[s.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50",children:[s.jsx("span",{className:"text-4xl",children:"📁"}),s.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Click or drag to upload files"}),s.jsxs("p",{className:"text-xs text-gray-400",children:["Up to ",(a==null?void 0:a.maxFiles)||10," files"]})]}),s.jsx("div",{className:"space-y-2 mt-2",children:s.jsxs("div",{className:"flex items-center gap-2 p-2 bg-gray-100 rounded text-sm",children:[s.jsx("span",{children:"📄"}),s.jsx("span",{className:"flex-1 truncate",children:"document.pdf"}),s.jsx("button",{disabled:!0,className:"text-gray-400 hover:text-red-500",children:"×"})]})})]})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),p=Array.isArray(a)?a:[],u=(d==null?void 0:d.maxFiles)||10,f=b=>{const g=Array.from(b.target.files||[]),y=[...p,...g].slice(0,u);l==null||l(y)},h=b=>{const g=p.filter((y,x)=>x!==b);l==null||l(g)};return s.jsxs(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:[s.jsxs("div",{className:`border-2 border-dashed rounded-lg p-6 text-center transition-colors ${((i==null?void 0:i.length)??0)>0?"border-red-300 bg-red-50":"border-gray-300 bg-gray-50 hover:border-gray-400"} ${c||p.length>=u?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[s.jsx("input",{type:"file",accept:d==null?void 0:d.accept,multiple:!0,onChange:f,disabled:c||p.length>=u,className:"hidden",id:`multi-file-upload-${e.element.id}`}),s.jsxs("label",{htmlFor:`multi-file-upload-${e.element.id}`,className:c||p.length>=u?"cursor-not-allowed":"cursor-pointer",children:[s.jsx("span",{className:"text-4xl",children:"📁"}),s.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Click or drag to upload files"}),s.jsxs("p",{className:"text-xs text-gray-400",children:[p.length," / ",u," files"]})]})]}),p.length>0&&s.jsx("div",{className:"space-y-2 mt-2",children:p.map((b,g)=>s.jsxs("div",{className:"flex items-center gap-2 p-2 bg-gray-100 rounded text-sm",children:[s.jsx("span",{children:"📄"}),s.jsx("span",{className:"flex-1 truncate",children:b.name}),s.jsxs("span",{className:"text-xs text-gray-500",children:[(b.size/1024).toFixed(1)," KB"]}),!c&&s.jsx("button",{type:"button",onClick:()=>h(g),className:"text-gray-400 hover:text-red-500",children:"×"})]},g))})]})}},{type:"multiImageUpload",structure:"field",typeCategory:"FileUpload",label:"Multi Image Upload",description:"Upload multiple images with preview",icon:"🖼️",category:"field",subCategory:"fileUpload",dataType:"array",supportsValidation:!0,getDefaultValues:()=>({properties:{label:"Multi Image Upload",description:"Upload multiple images"},layout:{labelPosition:"top",size:"full"},config:{accept:"image/*",maxSize:5242880,multiple:!0,maxFiles:10,allowCrop:!1}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e);return s.jsxs(ne,{label:t,description:r,required:o,labelPosition:n,children:[s.jsxs("div",{className:"border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50",children:[s.jsx("span",{className:"text-4xl",children:"🖼️"}),s.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Click or drag to upload images"}),s.jsxs("p",{className:"text-xs text-gray-400",children:["Up to ",(a==null?void 0:a.maxFiles)||10," images"]})]}),s.jsx("div",{className:"flex gap-2 flex-wrap mt-2",children:s.jsxs("div",{className:"w-20 h-20 bg-gray-200 rounded-lg flex items-center justify-center relative",children:[s.jsx("span",{className:"text-2xl",children:"🖼️"}),s.jsx("button",{disabled:!0,className:"absolute -top-1 -right-1 w-5 h-5 bg-red-500 text-white rounded-full text-xs",children:"×"})]})})]})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),[p,u]=C.useState([]),f=Array.isArray(a)?a:[],h=(d==null?void 0:d.maxFiles)||10;C.useEffect(()=>{(async()=>{const x=[];for(const v of f)if(v instanceof File){const w=new FileReader,S=await new Promise(E=>{w.onloadend=()=>E(w.result),w.readAsDataURL(v)});x.push(S)}u(x)})()},[f]);const b=y=>{const x=Array.from(y.target.files||[]),v=[...f,...x].slice(0,h);l==null||l(v)},g=y=>{const x=f.filter((v,w)=>w!==y);l==null||l(x)};return s.jsxs(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:[s.jsxs("div",{className:`border-2 border-dashed rounded-lg p-6 text-center transition-colors ${((i==null?void 0:i.length)??0)>0?"border-red-300 bg-red-50":"border-gray-300 bg-gray-50 hover:border-gray-400"} ${c||f.length>=h?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[s.jsx("input",{type:"file",accept:(d==null?void 0:d.accept)||"image/*",multiple:!0,onChange:b,disabled:c||f.length>=h,className:"hidden",id:`multi-image-upload-${e.element.id}`}),s.jsxs("label",{htmlFor:`multi-image-upload-${e.element.id}`,className:c||f.length>=h?"cursor-not-allowed":"cursor-pointer",children:[s.jsx("span",{className:"text-4xl",children:"🖼️"}),s.jsx("p",{className:"mt-2 text-sm text-gray-500",children:"Click or drag to upload images"}),s.jsxs("p",{className:"text-xs text-gray-400",children:[f.length," / ",h," images"]})]})]}),p.length>0&&s.jsx("div",{className:"flex gap-2 flex-wrap mt-2",children:p.map((y,x)=>s.jsxs("div",{className:"w-20 h-20 rounded-lg overflow-hidden relative border border-gray-200",children:[s.jsx("img",{src:y,alt:`Preview ${x+1}`,className:"w-full h-full object-cover"}),!c&&s.jsx("button",{type:"button",onClick:()=>g(x),className:"absolute -top-1 -right-1 w-5 h-5 bg-red-500 text-white rounded-full text-xs hover:bg-red-600 flex items-center justify-center",children:"×"})]},x))})]})}}],HC=[{type:"password",structure:"field",typeCategory:"Security",label:"Password",description:"Secure password input",icon:"🔒",category:"field",subCategory:"security",dataType:"string",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!0,showDescription:!0},configSection:{title:"Password Settings",icon:"🔒"},fields:[{key:"showStrengthMeter",label:"Show Strength Meter",type:"checkbox",section:"config",description:"Visual indicator of password strength"},{key:"showToggle",label:"Show / Hide Toggle",type:"checkbox",section:"config",description:"Let users reveal their password"},{key:"minStrength",label:"Minimum Strength",type:"select",section:"config",description:"Lowest accepted password strength level",options:[{value:"weak",label:"Weak"},{value:"medium",label:"Medium"},{value:"strong",label:"Strong"}]},{key:"strengthLabels",label:"Show Requirements Hint",type:"checkbox",section:"config",description:"Display password rules (length, special chars, etc.)"}]},getDefaultValues:()=>({properties:{label:"Password",placeholder:"••••••••"},layout:{labelPosition:"top",size:"full"},config:{showStrengthMeter:!1,showToggle:!0,minStrength:"medium"},validation:{minLength:8}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,config:l}=B(e);return s.jsxs(ne,{label:t,description:r,required:n,labelPosition:a,children:[s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:"password",placeholder:o||"••••••••",disabled:!0,className:`${lt()} pr-10`}),(l==null?void 0:l.showToggle)&&s.jsx("button",{disabled:!0,className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400",children:"👁️"})]}),(l==null?void 0:l.showStrengthMeter)&&s.jsxs("div",{className:"flex gap-1 mt-2",children:[s.jsx("div",{className:"h-1 flex-1 bg-gray-300 rounded"}),s.jsx("div",{className:"h-1 flex-1 bg-gray-300 rounded"}),s.jsx("div",{className:"h-1 flex-1 bg-gray-300 rounded"}),s.jsx("div",{className:"h-1 flex-1 bg-gray-300 rounded"})]})]})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:l,onChange:i,errors:c,isDisabled:d,config:p}=B(e),[u,f]=C.useState(!1),b=(y=>{if(!y)return 0;let x=0;return y.length>=8&&x++,/[a-z]/.test(y)&&/[A-Z]/.test(y)&&x++,/\d/.test(y)&&x++,/[^a-zA-Z0-9]/.test(y)&&x++,x})(l||""),g=["bg-red-500","bg-orange-500","bg-yellow-500","bg-green-500"];return s.jsxs(ne,{label:t,description:r,required:n,labelPosition:a,errors:c,children:[s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:u?"text":"password",placeholder:o||"••••••••",value:l??"",onChange:y=>i==null?void 0:i(y.target.value),disabled:d,className:`${bt({hasError:((c==null?void 0:c.length)??0)>0,disabled:d})} pr-10`}),(p==null?void 0:p.showToggle)&&!d&&s.jsx("button",{type:"button",onClick:()=>f(!u),className:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:u?"🙈":"👁️"})]}),(p==null?void 0:p.showStrengthMeter)&&l&&s.jsx("div",{className:"flex gap-1 mt-2",children:[0,1,2,3].map(y=>s.jsx("div",{className:`h-1 flex-1 rounded ${y<b?g[b-1]:"bg-gray-300"}`},y))})]})}},{type:"signature",structure:"field",typeCategory:"Security",label:"Signature",description:"Handwritten signature pad",icon:"✍️",category:"field",subCategory:"security",dataType:"string",supportsValidation:!0,settingsSchema:{properties:{showLabel:!0,showPlaceholder:!1,showDescription:!0},configSection:{title:"Signature Pad Settings",icon:"✍️"},fields:[{key:"canvasWidth",label:"Width (px)",type:"number",section:"config",min:100,max:1200,placeholder:"400",description:"Drawing area width",colSpan:1},{key:"canvasHeight",label:"Height (px)",type:"number",section:"config",min:50,max:600,placeholder:"200",description:"Drawing area height",colSpan:1},{key:"strokeWidth",label:"Stroke Width",type:"number",section:"config",min:1,max:10,placeholder:"2",description:"Pen thickness",colSpan:1},{key:"strokeColor",label:"Stroke Color",type:"color",section:"config",placeholder:"#000000",description:"Pen color",colSpan:1},{key:"backgroundColor",label:"Background Color",type:"color",section:"config",placeholder:"#ffffff",description:"Pad background color"},{key:"requireFullName",label:"Require Full Name",type:"checkbox",section:"config",description:"Ask for a printed name below the signature"},{key:"showTimestamp",label:"Show Timestamp",type:"checkbox",section:"config",description:"Auto-record date and time of signing"}]},getDefaultValues:()=>({properties:{label:"Signature",description:"Please sign below"},layout:{labelPosition:"top",size:"full"},config:{strokeWidth:2,strokeColor:"#000000",backgroundColor:"#ffffff",canvasWidth:400,canvasHeight:200}}),renderOnCanvas:e=>{const{label:t,description:r,required:o,labelPosition:n,config:a}=B(e);return s.jsxs(ne,{label:t,description:r,required:o,labelPosition:n,children:[s.jsx("div",{className:"border-2 border-dashed border-gray-300 rounded-lg bg-gray-50 flex items-center justify-center",style:{height:(a==null?void 0:a.canvasHeight)||200,backgroundColor:(a==null?void 0:a.backgroundColor)||"#ffffff"},children:s.jsxs("div",{className:"text-center text-gray-400",children:[s.jsx("span",{className:"text-3xl",children:"✍️"}),s.jsx("p",{className:"text-sm mt-2",children:"Draw your signature here"})]})}),s.jsx("button",{disabled:!0,className:"text-sm text-blue-600 hover:text-blue-700 mt-2",children:"Clear signature"})]})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c,config:d}=B(e),p=C.useRef(null),[u,f]=C.useState(!1),h=x=>{if(c)return;f(!0);const v=p.current;if(!v)return;const w=v.getContext("2d");if(!w)return;const S=v.getBoundingClientRect();w.beginPath(),w.moveTo(x.clientX-S.left,x.clientY-S.top)},b=x=>{if(!u||c)return;const v=p.current;if(!v)return;const w=v.getContext("2d");if(!w)return;const S=v.getBoundingClientRect();w.lineWidth=(d==null?void 0:d.strokeWidth)||2,w.strokeStyle=(d==null?void 0:d.strokeColor)||"#000000",w.lineCap="round",w.lineTo(x.clientX-S.left,x.clientY-S.top),w.stroke()},g=()=>{u&&p.current&&(f(!1),l==null||l(p.current.toDataURL()))},y=()=>{const x=p.current;if(!x)return;const v=x.getContext("2d");v&&(v.fillStyle=(d==null?void 0:d.backgroundColor)||"#ffffff",v.fillRect(0,0,x.width,x.height),l==null||l(""))};return s.jsxs(ne,{label:t,description:r,required:o,labelPosition:n,errors:i,children:[s.jsx("div",{className:`border-2 rounded-lg overflow-hidden ${((i==null?void 0:i.length)??0)>0?"border-red-500":"border-gray-300"} ${c?"opacity-50":""}`,style:{backgroundColor:(d==null?void 0:d.backgroundColor)||"#ffffff"},children:s.jsx("canvas",{ref:p,width:(d==null?void 0:d.canvasWidth)||400,height:(d==null?void 0:d.canvasHeight)||200,onMouseDown:h,onMouseMove:b,onMouseUp:g,onMouseLeave:g,className:c?"cursor-not-allowed":"cursor-crosshair",style:{display:"block",width:"100%"}})}),!c&&s.jsx("button",{type:"button",onClick:y,className:"text-sm text-blue-600 hover:text-blue-700 mt-2",children:"Clear signature"})]})}},{type:"captcha",structure:"field",typeCategory:"Security",label:"Captcha",description:"Bot protection verification",icon:"🤖",category:"field",subCategory:"security",dataType:"string",supportsValidation:!0,settingsSchema:{properties:{showLabel:!1,showPlaceholder:!1,showDescription:!0},configSection:{title:"Captcha Settings",icon:"🤖"},fields:[{key:"provider",label:"Provider",type:"select",section:"config",description:"Which CAPTCHA service to use",options:[{value:"recaptcha",label:"Google reCAPTCHA v3"},{value:"recaptcha-v2",label:"Google reCAPTCHA v2"},{value:"hcaptcha",label:"hCaptcha"},{value:"turnstile",label:"Cloudflare Turnstile"},{value:"friendly",label:"Friendly Captcha"}]},{key:"siteKey",label:"Site Key",type:"text",section:"config",placeholder:"Your site key from provider",description:"Public key provided by the CAPTCHA service"},{key:"theme",label:"Widget Theme",type:"select",section:"config",options:[{value:"light",label:"Light"},{value:"dark",label:"Dark"},{value:"auto",label:"Auto (match page)"}]},{key:"size",label:"Widget Size",type:"select",section:"config",options:[{value:"normal",label:"Normal"},{value:"compact",label:"Compact"},{value:"invisible",label:"Invisible"}]}]},getDefaultValues:()=>({properties:{label:"CAPTCHA",description:"Please verify you are human"},layout:{labelPosition:"hidden",size:"default"},config:{provider:"recaptcha",siteKey:"",theme:"light"}}),renderOnCanvas:e=>{const{description:t}=B(e);return s.jsxs("div",{className:"space-y-1.5",children:[t&&s.jsx("p",{className:"text-xs text-gray-500",children:t}),s.jsx("div",{className:"border border-gray-300 rounded-md p-4 bg-gray-50 max-w-[300px]",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"w-7 h-7 border-2 border-gray-300 rounded flex items-center justify-center",children:"☐"}),s.jsx("span",{className:"text-sm text-gray-700",children:"I'm not a robot"}),s.jsx("div",{className:"ml-auto",children:s.jsxs("div",{className:"text-xs text-gray-400 text-center",children:[s.jsx("div",{className:"text-lg",children:"🔄"}),s.jsx("span",{children:"reCAPTCHA"})]})})]})})]})},render:e=>{const{description:t,value:r,onChange:o,errors:n,isDisabled:a,config:l}=B(e),i=r===!0,c=()=>{a||o==null||o(!0)};return s.jsxs("div",{className:"space-y-1.5",children:[t&&s.jsx("p",{className:"text-xs text-gray-500",children:t}),s.jsx("div",{className:`border rounded-md p-4 max-w-[300px] ${((n==null?void 0:n.length)??0)>0?"border-red-500 bg-red-50":i?"border-green-500 bg-green-50":"border-gray-300 bg-gray-50"}`,children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("button",{type:"button",onClick:c,disabled:a||i,className:`w-7 h-7 border-2 rounded flex items-center justify-center transition-colors ${i?"border-green-500 bg-green-500 text-white":"border-gray-300 hover:border-gray-400"} ${a?"cursor-not-allowed opacity-50":"cursor-pointer"}`,children:i?"✓":""}),s.jsx("span",{className:"text-sm text-gray-700",children:i?"Verified!":"I'm not a robot"}),s.jsx("div",{className:"ml-auto",children:s.jsxs("div",{className:"text-xs text-gray-400 text-center",children:[s.jsx("div",{className:"text-lg",children:(l==null?void 0:l.provider)==="hcaptcha"?"🛡️":"🔄"}),s.jsx("span",{children:(l==null?void 0:l.provider)==="hcaptcha"?"hCaptcha":(l==null?void 0:l.provider)==="turnstile"?"Turnstile":"reCAPTCHA"})]})})]})}),n&&n.length>0&&s.jsx("div",{className:"space-y-1",children:n.map((d,p)=>s.jsx("p",{className:"text-xs text-red-500",children:d},p))})]})}}],jC=[{type:"group",structure:"page",typeCategory:"Layout",label:"Group",description:"Container to group related elements together",icon:"📦",category:"page",subCategory:"layout",supportsValidation:!1,isContainer:!0,dataType:"object",getDefaultValues:()=>({properties:{label:"Group",description:""},layout:{size:"full"},config:{collapsed:!1,collapsible:!1,showBorder:!0,padding:16}}),renderOnCanvas:e=>{const{label:t,description:r,config:o}=B(e),n=(o==null?void 0:o.showBorder)??!0,a=(o==null?void 0:o.collapsible)??!1;return s.jsxs("div",{className:`rounded-lg ${n?"border border-gray-200":""}`,style:{padding:(o==null?void 0:o.padding)||16},children:[s.jsx("div",{className:"flex items-center justify-between mb-2",children:s.jsxs("div",{children:[s.jsxs("h3",{className:"font-medium text-gray-800 flex items-center gap-2",children:[a&&s.jsx("span",{className:"text-gray-400 text-sm",children:"▼"}),t||"Group"]}),r&&s.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:r})]})}),s.jsx("div",{className:"border-2 border-dashed border-gray-200 rounded-md p-4 min-h-[80px] flex items-center justify-center",children:s.jsx("span",{className:"text-sm text-gray-400",children:"Drop elements here"})})]})},render:e=>{const{label:t,description:r,config:o,element:n}=B(e),{renderChildren:a}=e,l=(o==null?void 0:o.showBorder)??!0,i=(o==null?void 0:o.collapsible)??!1,[c,d]=C.useState((o==null?void 0:o.collapsed)??!1);return s.jsxs("div",{className:`rounded-lg ${l?"border border-gray-200":""}`,style:{padding:(o==null?void 0:o.padding)||16},children:[s.jsx("div",{className:`flex items-center justify-between ${i?"cursor-pointer":""}`,onClick:()=>i&&d(!c),children:s.jsxs("div",{children:[s.jsxs("h3",{className:"font-medium text-gray-800 flex items-center gap-2",children:[i&&s.jsx("span",{className:`text-gray-400 text-sm transition-transform ${c?"-rotate-90":""}`,children:"▼"}),t||"Group"]}),r&&!c&&s.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:r})]})}),!c&&s.jsx("div",{className:"mt-3",children:a?a(n.id):s.jsx("div",{"data-container-id":n.id,className:"space-y-4"})})]})}},{type:"grid",structure:"page",typeCategory:"Layout",label:"Grid",description:"Arrange elements in a responsive grid layout",icon:"⊞",category:"page",subCategory:"layout",supportsValidation:!1,isContainer:!0,dataType:"object",getDefaultValues:()=>({properties:{label:""},layout:{size:"full"},config:{gridColumns:2,gridGap:16,responsiveColumns:{sm:1,md:2,lg:2}}}),renderOnCanvas:e=>{const{label:t,config:r}=B(e),o=(r==null?void 0:r.gridColumns)||2,n=(r==null?void 0:r.gridGap)||16;return s.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[t&&s.jsx("div",{className:"mb-3",children:s.jsx("h3",{className:"font-medium text-gray-800",children:t})}),s.jsx("div",{className:"grid",style:{gridTemplateColumns:`repeat(${o}, 1fr)`,gap:n},children:Array.from({length:o}).map((a,l)=>s.jsx("div",{className:"border-2 border-dashed border-gray-200 rounded-md p-4 min-h-[60px] flex items-center justify-center",children:s.jsxs("span",{className:"text-xs text-gray-400",children:["Column ",l+1]})},l))})]})},render:e=>{const{label:t,config:r,element:o}=B(e),{renderChildren:n}=e,a=(r==null?void 0:r.gridColumns)||2,l=(r==null?void 0:r.gridGap)||16;return s.jsxs("div",{children:[t&&s.jsx("div",{className:"mb-3",children:s.jsx("h3",{className:"font-medium text-gray-800",children:t})}),s.jsx("div",{className:"grid",style:{gridTemplateColumns:`repeat(${a}, 1fr)`,gap:l},children:n?n(o.id):s.jsx("div",{"data-container-id":o.id,className:"space-y-4"})})]})}},{type:"table",structure:"page",typeCategory:"Layout",label:"Table",description:"Display data in a table format",icon:"📊",category:"page",subCategory:"layout",supportsValidation:!1,isContainer:!0,dataType:"array",getDefaultValues:()=>({properties:{label:"Table",description:""},layout:{size:"full"},config:{tableColumns:[{id:"col1",header:"Column 1",width:"auto",align:"left"},{id:"col2",header:"Column 2",width:"auto",align:"left"},{id:"col3",header:"Column 3",width:"auto",align:"left"}],showHeader:!0,striped:!0,bordered:!0}}),renderOnCanvas:e=>{const{label:t,description:r,config:o}=B(e),n=(o==null?void 0:o.tableColumns)||[{id:"col1",header:"Column 1"},{id:"col2",header:"Column 2"}],a=(o==null?void 0:o.showHeader)??!0,l=(o==null?void 0:o.striped)??!0,i=(o==null?void 0:o.bordered)??!0;return s.jsxs("div",{className:"space-y-2",children:[t&&s.jsxs("div",{children:[s.jsx("h3",{className:"font-medium text-gray-800",children:t}),r&&s.jsx("p",{className:"text-sm text-gray-500",children:r})]}),s.jsx("div",{className:`overflow-hidden rounded-lg ${i?"border border-gray-200":""}`,children:s.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[a&&s.jsx("thead",{className:"bg-gray-50",children:s.jsx("tr",{children:n.map(c=>s.jsx("th",{className:`px-4 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider text-${c.align||"left"}`,children:c.header},c.id))})}),s.jsx("tbody",{className:`bg-white ${l?"divide-y divide-gray-200":""}`,children:[1,2].map((c,d)=>s.jsx("tr",{className:l&&d%2===1?"bg-gray-50":"",children:n.map(p=>s.jsx("td",{className:`px-4 py-3 text-sm text-gray-500 text-${p.align||"left"}`,children:s.jsx("span",{className:"text-gray-300",children:"Sample data"})},p.id))},c))})]})}),s.jsx("p",{className:"text-xs text-gray-400 text-center",children:"Table preview - drop elements to define row structure"})]})},render:e=>{const{label:t,description:r,config:o,value:n=[]}=B(e),a=(o==null?void 0:o.tableColumns)||[],l=(o==null?void 0:o.showHeader)??!0,i=(o==null?void 0:o.striped)??!0,c=(o==null?void 0:o.bordered)??!0,d=Array.isArray(n)?n:[];return s.jsxs("div",{className:"space-y-2",children:[t&&s.jsxs("div",{children:[s.jsx("h3",{className:"font-medium text-gray-800",children:t}),r&&s.jsx("p",{className:"text-sm text-gray-500",children:r})]}),s.jsx("div",{className:`overflow-x-auto rounded-lg ${c?"border border-gray-200":""}`,children:s.jsxs("table",{className:"min-w-full divide-y divide-gray-200",children:[l&&s.jsx("thead",{className:"bg-gray-50",children:s.jsx("tr",{children:a.map(p=>s.jsx("th",{style:{width:p.width||"auto"},className:`px-4 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider text-${p.align||"left"}`,children:p.header},p.id))})}),s.jsx("tbody",{className:`bg-white ${i?"divide-y divide-gray-200":""}`,children:d.length===0?s.jsx("tr",{children:s.jsx("td",{colSpan:a.length,className:"px-4 py-8 text-sm text-gray-400 text-center",children:"No data available"})}):d.map((p,u)=>s.jsx("tr",{className:i&&u%2===1?"bg-gray-50":"",children:a.map(f=>s.jsx("td",{className:`px-4 py-3 text-sm text-gray-700 text-${f.align||"left"}`,children:p[f.id]??"-"},f.id))},u))})]})})]})}},{type:"pages",structure:"page",typeCategory:"Special",label:"Wizard / Pages",description:"Multi-step form wizard with progress tracking",icon:"📑",category:"page",subCategory:"special",supportsValidation:!1,isContainer:!0,dataType:"object",getDefaultValues:()=>({properties:{label:"Form Wizard"},layout:{size:"full"},config:{showProgressBar:!0,showStepNumbers:!0,allowSkip:!1,validateOnNext:!0,steps:[{id:"step-1",label:"Step 1",description:"First step"},{id:"step-2",label:"Step 2",description:"Second step"}],activeStepId:"step-1"}}),renderOnCanvas:e=>{var i,c;const{config:t}=B(e),r=(t==null?void 0:t.steps)||[{id:"step-1",label:"Step 1"},{id:"step-2",label:"Step 2"}],o=(t==null?void 0:t.activeStepId)||((i=r[0])==null?void 0:i.id),n=r.findIndex(d=>d.id===o),a=(t==null?void 0:t.showProgressBar)??!0,l=(t==null?void 0:t.showStepNumbers)??!0;return s.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 bg-white",children:[a&&s.jsxs("div",{className:"mb-6",children:[s.jsx("div",{className:"h-2 bg-gray-200 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-blue-600 transition-all duration-300",style:{width:`${(n+1)/r.length*100}%`}})}),l&&s.jsx("div",{className:"flex justify-between mt-3",children:r.map((d,p)=>{const u=p<n,f=p===n;return s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors ${u?"bg-green-500 text-white":f?"bg-blue-600 text-white":"bg-gray-200 text-gray-500"}`,children:u?"✓":p+1}),s.jsx("span",{className:`text-xs mt-1 ${f?"text-blue-600 font-medium":"text-gray-500"}`,children:d.label})]},d.id)})})]}),s.jsx("div",{className:"border-2 border-dashed border-gray-200 rounded-lg p-6 min-h-[150px] flex items-center justify-center",children:s.jsxs("div",{className:"text-center",children:[s.jsxs("span",{className:"text-gray-400 text-sm",children:["Step ",n+1,":"," ",(c=r[n])==null?void 0:c.label]}),s.jsx("p",{className:"text-gray-300 text-xs mt-1",children:"Drop elements here for this step"})]})}),s.jsxs("div",{className:"flex justify-between mt-4 pt-4 border-t border-gray-200",children:[s.jsx("button",{type:"button",disabled:n===0,className:`px-4 py-2 text-sm rounded-md ${n===0?"bg-gray-100 text-gray-400 cursor-not-allowed":"bg-gray-200 text-gray-700 hover:bg-gray-300"}`,children:"← Previous"}),s.jsx("button",{type:"button",className:"px-4 py-2 text-sm rounded-md bg-blue-600 text-white hover:bg-blue-700",children:n===r.length-1?"Submit":"Next →"})]})]})},render:e=>{const{config:t,element:r}=B(e),o=(t==null?void 0:t.steps)||[];return s.jsx("div",{"data-wizard-id":r.id,"data-wizard-steps":o.length})}}],YC=[{type:"repeatElement",structure:"page",typeCategory:"Repeatable",label:"Repeat Element",description:"Allow users to add multiple values of a single field",icon:"🔄",category:"page",subCategory:"repeatable",supportsValidation:!0,isContainer:!1,dataType:"array",getDefaultValues:()=>({properties:{label:"Repeatable Field",description:"Add multiple values",placeholder:"Enter value"},layout:{labelPosition:"top",size:"full"},validation:{required:!1},config:{minItems:1,maxItems:10,addButtonText:"Add Item",removeButtonText:"Remove",showItemNumber:!0}}),renderOnCanvas:e=>{const{label:t,description:r,placeholder:o,required:n,config:a}=B(e),l=(a==null?void 0:a.minItems)||1,i=(a==null?void 0:a.maxItems)||10,c=(a==null?void 0:a.addButtonText)||"Add Item",d=(a==null?void 0:a.showItemNumber)??!0;return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:[t||"Repeatable Field",n&&s.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),r&&s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:r})]}),s.jsx("div",{className:"space-y-2",children:Array.from({length:Math.min(2,l)}).map((p,u)=>s.jsxs("div",{className:"flex items-center gap-2",children:[d&&s.jsxs("span",{className:"text-xs text-gray-400 w-4",children:[u+1,"."]}),s.jsx("input",{type:"text",placeholder:o||"Enter value",disabled:!0,className:"flex-1 px-3 py-2 text-sm border border-gray-300 rounded-md bg-gray-50 text-gray-500"}),s.jsx("button",{type:"button",disabled:!0,className:"p-2 text-gray-400 hover:text-red-500 disabled:opacity-50",children:"✕"})]},u))}),s.jsxs("button",{type:"button",disabled:!0,className:"flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700 disabled:opacity-50",children:[s.jsx("span",{children:"+"}),s.jsx("span",{children:c})]}),s.jsxs("p",{className:"text-xs text-gray-400",children:["Min: ",l," | Max: ",i," items"]})]})},render:e=>{const{label:t,description:r,placeholder:o,required:n,config:a,value:l=[],onChange:i,errors:c,isDisabled:d}=B(e),p=(a==null?void 0:a.minItems)||1,u=(a==null?void 0:a.maxItems)||10,f=(a==null?void 0:a.addButtonText)||"Add Item",h=(a==null?void 0:a.showItemNumber)??!0,b=Array.isArray(l)?l:[""],g=b.length<u,y=b.length>p,x=()=>{g&&i&&i([...b,""])},v=E=>{if(y&&i){const N=b.filter((T,k)=>k!==E);i(N)}},w=(E,N)=>{if(i){const T=[...b];T[E]=N,i(T)}},S=c&&c.length>0;return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsxs("label",{className:"block text-sm font-medium text-gray-700",children:[t||"Repeatable Field",n&&s.jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),r&&s.jsx("p",{className:"text-xs text-gray-500 mt-0.5",children:r})]}),s.jsx("div",{className:"space-y-2",children:b.map((E,N)=>s.jsxs("div",{className:"flex items-center gap-2",children:[h&&s.jsxs("span",{className:"text-xs text-gray-400 w-4",children:[N+1,"."]}),s.jsx("input",{type:"text",value:E,onChange:T=>w(N,T.target.value),placeholder:o||"Enter value",disabled:d,className:`flex-1 px-3 py-2 text-sm border rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-offset-0 ${S?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-blue-500 focus:border-blue-500"} ${d?"bg-gray-50 text-gray-500 cursor-not-allowed":""}`}),s.jsx("button",{type:"button",onClick:()=>v(N),disabled:!y||d,className:`p-2 transition-colors ${y&&!d?"text-gray-400 hover:text-red-500":"text-gray-300 cursor-not-allowed"}`,children:"✕"})]},N))}),g&&!d&&s.jsxs("button",{type:"button",onClick:x,className:"flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700",children:[s.jsx("span",{children:"+"}),s.jsx("span",{children:f})]}),c&&c.length>0&&s.jsx("div",{className:"space-y-1",children:c.map((E,N)=>s.jsx("p",{className:"text-xs text-red-500",children:E},N))})]})}},{type:"repeatGroup",structure:"page",typeCategory:"Repeatable",label:"Repeat Group",description:"Allow users to add multiple instances of a group of fields",icon:"📚",category:"page",subCategory:"repeatable",supportsValidation:!0,isContainer:!0,dataType:"array",getDefaultValues:()=>({properties:{label:"Repeatable Section",description:"Add multiple entries"},layout:{size:"full"},validation:{required:!1},config:{minItems:1,maxItems:10,addButtonText:"Add Entry",removeButtonText:"Remove",itemLabel:"Entry",showItemNumber:!0}}),renderOnCanvas:e=>{const{label:t,description:r,config:o}=B(e),n=(o==null?void 0:o.minItems)||1,a=(o==null?void 0:o.maxItems)||10,l=(o==null?void 0:o.addButtonText)||"Add Entry",i=(o==null?void 0:o.itemLabel)||"Entry",c=(o==null?void 0:o.showItemNumber)??!0;return s.jsxs("div",{className:"border border-gray-200 rounded-lg p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsxs("h3",{className:"font-medium text-gray-800 flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:"📚"}),t||"Repeatable Section"]}),r&&s.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:r})]}),s.jsxs("span",{className:"text-xs text-gray-400 bg-gray-100 px-2 py-1 rounded",children:[n,"-",a," items"]})]}),s.jsxs("div",{className:"border border-dashed border-gray-300 rounded-lg",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-50 border-b border-dashed border-gray-300 rounded-t-lg",children:[s.jsxs("span",{className:"text-sm font-medium text-gray-600",children:[c&&"1. ",i]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",disabled:!0,className:"text-gray-400 hover:text-gray-600 text-sm",children:"▲"}),s.jsx("button",{type:"button",disabled:!0,className:"text-gray-400 hover:text-gray-600 text-sm",children:"▼"}),s.jsx("button",{type:"button",disabled:!0,className:"text-gray-400 hover:text-red-500 text-sm",children:"✕"})]})]}),s.jsx("div",{className:"p-4 min-h-[80px] flex items-center justify-center",children:s.jsx("span",{className:"text-sm text-gray-400",children:"Drop elements here to define the repeatable group structure"})})]}),s.jsxs("button",{type:"button",disabled:!0,className:"w-full flex items-center justify-center gap-2 py-2 border-2 border-dashed border-gray-300 rounded-lg text-sm text-gray-500 hover:border-blue-400 hover:text-blue-600 transition-colors disabled:opacity-50",children:[s.jsx("span",{children:"+"}),s.jsx("span",{children:l})]})]})},render:e=>{const{label:t,description:r,config:o,element:n,value:a=[],onChange:l,errors:i,isDisabled:c}=B(e),{renderChildren:d}=e,p=(o==null?void 0:o.minItems)||1,u=(o==null?void 0:o.maxItems)||10,f=(o==null?void 0:o.addButtonText)||"Add Entry",h=(o==null?void 0:o.removeButtonText)||"Remove",b=(o==null?void 0:o.itemLabel)||"Entry",g=(o==null?void 0:o.showItemNumber)??!0,y=Array.isArray(a)?a:Array.from({length:p},()=>({})),x=y.length<u,v=y.length>p,w=()=>{x&&l&&l([...y,{}])},S=k=>{if(v&&l){const M=y.filter((D,U)=>U!==k);l(M)}},E=k=>{if(k>0&&l){const M=[...y];[M[k-1],M[k]]=[M[k],M[k-1]],l(M)}},N=k=>{if(k<y.length-1&&l){const M=[...y];[M[k],M[k+1]]=[M[k+1],M[k]],l(M)}},T=i&&i.length>0;return s.jsxs("div",{className:`border rounded-lg p-4 space-y-4 ${T?"border-red-300":"border-gray-200"}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"font-medium text-gray-800",children:t||"Repeatable Section"}),r&&s.jsx("p",{className:"text-sm text-gray-500 mt-0.5",children:r})]}),s.jsxs("span",{className:"text-xs text-gray-400",children:[y.length," of ",u]})]}),s.jsx("div",{className:"space-y-3",children:y.map((k,M)=>{var D;return s.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-gray-50 border-b border-gray-200",children:[s.jsxs("span",{className:"text-sm font-medium text-gray-600",children:[g&&`${M+1}. `,b]}),!c&&s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{type:"button",onClick:()=>E(M),disabled:M===0,className:`p-1 rounded transition-colors ${M===0?"text-gray-300 cursor-not-allowed":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`,title:"Move up",children:"▲"}),s.jsx("button",{type:"button",onClick:()=>N(M),disabled:M===y.length-1,className:`p-1 rounded transition-colors ${M===y.length-1?"text-gray-300 cursor-not-allowed":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`,title:"Move down",children:"▼"}),s.jsx("button",{type:"button",onClick:()=>S(M),disabled:!v,className:`p-1 rounded transition-colors ${v?"text-gray-400 hover:text-red-500 hover:bg-red-50":"text-gray-300 cursor-not-allowed"}`,title:h,children:"✕"})]})]}),s.jsx("div",{className:"p-4",children:d?d(n.id,`${((D=n.attributes)==null?void 0:D.name)||n.id}[${M}]`):s.jsx("div",{"data-repeat-group-item":n.id,"data-repeat-index":M,className:"text-sm text-gray-400 text-center py-4",children:"Group fields render here"})})]},M)})}),x&&!c&&s.jsxs("button",{type:"button",onClick:w,className:"w-full flex items-center justify-center gap-2 py-2 border-2 border-dashed border-gray-300 rounded-lg text-sm text-gray-500 hover:border-blue-400 hover:text-blue-600 transition-colors",children:[s.jsx("span",{children:"+"}),s.jsx("span",{children:f})]}),i&&i.length>0&&s.jsx("div",{className:"space-y-1",children:i.map((k,M)=>s.jsx("p",{className:"text-xs text-red-500",children:k},M))})]})}}],lf=[...ox,...nx,...ax,...GC,...VC,...zC,...BC,...UC,...WC,...HC,...jC,...YC];function qC(){for(const e of lf)Ke.register(e)}const QC=["shortText","longText","multiLineInput","textEditor"],KC=["number","slider","rangeSlider"],XC=["email","phone","url","location"],JC=["password","signature","captcha"],ZC=["singleChoice","multipleChoice","dropdown","tags","decisionBox","toggleSwitch"],RC=["singleChoiceMatrix","multipleChoiceMatrix","matrixTable"],eN=["date","time","dateTime","multipleDates","dateRange"],tN=["fileUpload","imageUpload","multiFileUpload","multiImageUpload"],rN=["paragraph","image","link"],oN=[...QC,...KC,...XC,...JC,...ZC,...RC,...eN,...tN,...rN],wi={shortText:"Short Text",longText:"Long Text",multiLineInput:"Multi-line Input",textEditor:"Text Editor",number:"Number",slider:"Slider",rangeSlider:"Range Slider",email:"Email",phone:"Phone",url:"URL",location:"Location",password:"Password",signature:"Signature",captcha:"Captcha",singleChoice:"Single Choice",multipleChoice:"Multiple Choice",dropdown:"Dropdown",tags:"Tags",decisionBox:"Decision Box",toggleSwitch:"Toggle Switch",singleChoiceMatrix:"Single Choice Matrix",multipleChoiceMatrix:"Multiple Choice Matrix",matrixTable:"Matrix Table",date:"Date",time:"Time",dateTime:"Date & Time",multipleDates:"Multiple Dates",dateRange:"Date Range",fileUpload:"File Upload",imageUpload:"Image Upload",multiFileUpload:"Multi-File Upload",multiImageUpload:"Multi-Image Upload",paragraph:"Paragraph",image:"Image",link:"Link",formHeading:"Form Heading",sectionHeading:"Section Heading",subheading:"Subheading",divider:"Divider",spacer:"Spacer",group:"Group",grid:"Grid",table:"Table",repeatElement:"Repeat Element",repeatGroup:"Repeat Group",pages:"Pages (Wizard)",submit:"Submit Button"},Si={shortText:"📝",longText:"📄",multiLineInput:"📑",textEditor:"✏️",number:"🔢",slider:"🎚️",rangeSlider:"↔️",email:"✉️",phone:"📱",url:"🔗",location:"📍",password:"🔒",signature:"✍️",captcha:"🤖",singleChoice:"🔘",multipleChoice:"☑️",dropdown:"📋",tags:"🏷️",decisionBox:"✅",toggleSwitch:"🔀",singleChoiceMatrix:"📊",multipleChoiceMatrix:"📈",matrixTable:"📉",date:"📅",time:"⏰",dateTime:"📆",multipleDates:"🗓️",dateRange:"↔️",fileUpload:"📎",imageUpload:"🖼️",multiFileUpload:"📁",multiImageUpload:"🖼️",paragraph:"📃",image:"🏞️",link:"🔗",formHeading:"🏷️",sectionHeading:"📌",subheading:"📎",divider:"➖",spacer:"↕️",group:"📦",grid:"⊞",table:"📊",repeatElement:"🔄",repeatGroup:"🔁",pages:"📖",submit:"🚀"};function nN(e){return oN.includes(e)}const aN=["singleChoice","multipleChoice","dropdown","tags"],sN=["shortText","longText","multiLineInput","textEditor","number","slider","rangeSlider","email","phone","url","location","password","singleChoice","multipleChoice","dropdown","tags","decisionBox","date","time","dateTime","multipleDates","dateRange","fileUpload","imageUpload","multiFileUpload","multiImageUpload"],lN=["singleChoiceMatrix","multipleChoiceMatrix","matrixTable"];function iN(e){return aN.includes(e)}function cN(e){return sN.includes(e)}function dN(e){return lN.includes(e)}const Oa=({element:e,isSelected:t=!1})=>{const r=Ke.get(e.type),o={element:e,properties:e.properties,layout:e.layout,validation:e.validation,logic:e.logic,config:e.config,isSelected:t,mode:"canvas"};if(r&&r.renderOnCanvas)try{return s.jsx(s.Fragment,{children:r.renderOnCanvas(o)})}catch(n){return console.error(`Error rendering element "${e.type}" on canvas:`,n),s.jsx($a,{element:e,error:n})}return s.jsx($a,{element:e})},cf=({element:e,value:t,onChange:r,errors:o=[],formValues:n={},readOnly:a=!1,disabled:l=!1})=>{const i=Ke.get(e.type),c={element:e,properties:e.properties,layout:e.layout,validation:e.validation,logic:e.logic,config:e.config,mode:"render",value:t,onChange:r,errors:o,formValues:n,readOnly:a,disabled:l};if(i&&i.render)try{return s.jsx(s.Fragment,{children:i.render(c)})}catch(d){return console.error(`Error rendering element "${e.type}":`,d),s.jsx($a,{element:e,error:d})}return s.jsx($a,{element:e})},$a=({element:e,error:t})=>{const r=Si[e.type]||"❓",o=wi[e.type]||e.type;return t?s.jsxs("div",{className:"p-4 bg-red-50 border border-red-200 rounded text-red-600 text-sm",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{children:"⚠️"}),s.jsxs("span",{children:["Error rendering: ",o]})]}),s.jsx("p",{className:"text-xs mt-1 text-red-500",children:t instanceof Error?t.message:"Unknown error"})]}):s.jsxs("div",{className:"p-4 bg-gray-100 rounded text-gray-600 text-sm",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{children:r}),s.jsx("span",{children:o})]}),s.jsx("p",{className:"text-xs mt-1 text-gray-400",children:"Element type not registered in the element registry"})]})};function uN(e){return Ke.has(e)}function df(e){const t=Ke.get(e);return t?t.icon:Si[e]}function Ci(e){const t=Ke.get(e);return t?t.label:wi[e]||e}function pN(e,t){return s.jsx(Oa,{element:e,isSelected:t})}function fN(e,t,r,o,n){return s.jsx(cf,{element:e,value:t,onChange:r,errors:o,formValues:n})}const Vt=m.forwardRef(({className:e,type:t,...r},o)=>s.jsx("input",{type:t,className:be("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:o,...r}));Vt.displayName="Input";const uf=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,pf=Bp,La=(e,t)=>r=>{var o;if((t==null?void 0:t.variants)==null)return pf(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:a}=t,l=Object.keys(n).map(d=>{const p=r==null?void 0:r[d],u=a==null?void 0:a[d];if(p===null)return null;const f=uf(p)||uf(u);return n[d][f]}),i=r&&Object.entries(r).reduce((d,p)=>{let[u,f]=p;return f===void 0||(d[u]=f),d},{}),c=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((d,p)=>{let{class:u,className:f,...h}=p;return Object.entries(h).every(b=>{let[g,y]=b;return Array.isArray(y)?y.includes({...a,...i}[g]):{...a,...i}[g]===y})?[...d,u,f]:d},[]);return pf(e,l,c,r==null?void 0:r.class,r==null?void 0:r.className)},hN=La("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Ni({className:e,variant:t,...r}){return s.jsx("div",{className:be(hN({variant:t}),e),...r})}var Ei="rovingFocusGroup.onEntryFocus",mN={bubbles:!1,cancelable:!0},on="RovingFocusGroup",[ki,ff,gN]=Gl(on),[bN,hf]=dr(on,[gN]),[yN,vN]=bN(on),mf=m.forwardRef((e,t)=>s.jsx(ki.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(ki.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(xN,{...e,ref:t})})}));mf.displayName=on;var xN=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:n=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...u}=e,f=m.useRef(null),h=Fe(t,f),b=aa(a),[g,y]=fr({prop:l,defaultProp:i??null,onChange:c,caller:on}),[x,v]=m.useState(!1),w=Er(d),S=ff(r),E=m.useRef(!1),[N,T]=m.useState(0);return m.useEffect(()=>{const k=f.current;if(k)return k.addEventListener(Ei,w),()=>k.removeEventListener(Ei,w)},[w]),s.jsx(yN,{scope:r,orientation:o,dir:b,loop:n,currentTabStopId:g,onItemFocus:m.useCallback(k=>y(k),[y]),onItemShiftTab:m.useCallback(()=>v(!0),[]),onFocusableItemAdd:m.useCallback(()=>T(k=>k+1),[]),onFocusableItemRemove:m.useCallback(()=>T(k=>k-1),[]),children:s.jsx(Ne.div,{tabIndex:x||N===0?-1:0,"data-orientation":o,...u,ref:h,style:{outline:"none",...e.style},onMouseDown:xe(e.onMouseDown,()=>{E.current=!0}),onFocus:xe(e.onFocus,k=>{const M=!E.current;if(k.target===k.currentTarget&&M&&!x){const D=new CustomEvent(Ei,mN);if(k.currentTarget.dispatchEvent(D),!D.defaultPrevented){const U=S().filter(W=>W.focusable),$=U.find(W=>W.active),F=U.find(W=>W.id===g),R=[$,F,...U].filter(Boolean).map(W=>W.ref.current);yf(R,p)}}E.current=!1}),onBlur:xe(e.onBlur,()=>v(!1))})})}),gf="RovingFocusGroupItem",bf=m.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:n=!1,tabStopId:a,children:l,...i}=e,c=_r(),d=a||c,p=vN(gf,r),u=p.currentTabStopId===d,f=ff(r),{onFocusableItemAdd:h,onFocusableItemRemove:b,currentTabStopId:g}=p;return m.useEffect(()=>{if(o)return h(),()=>b()},[o,h,b]),s.jsx(ki.ItemSlot,{scope:r,id:d,focusable:o,active:n,children:s.jsx(Ne.span,{tabIndex:u?0:-1,"data-orientation":p.orientation,...i,ref:t,onMouseDown:xe(e.onMouseDown,y=>{o?p.onItemFocus(d):y.preventDefault()}),onFocus:xe(e.onFocus,()=>p.onItemFocus(d)),onKeyDown:xe(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){p.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const x=CN(y,p.orientation,p.dir);if(x!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let w=f().filter(S=>S.focusable).map(S=>S.ref.current);if(x==="last")w.reverse();else if(x==="prev"||x==="next"){x==="prev"&&w.reverse();const S=w.indexOf(y.currentTarget);w=p.loop?NN(w,S+1):w.slice(S+1)}setTimeout(()=>yf(w))}}),children:typeof l=="function"?l({isCurrentTabStop:u,hasTabStop:g!=null}):l})})});bf.displayName=gf;var wN={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function SN(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function CN(e,t,r){const o=SN(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return wN[o]}function yf(e,t=!1){const r=document.activeElement;for(const o of e)if(o===r||(o.focus({preventScroll:t}),document.activeElement!==r))return}function NN(e,t){return e.map((r,o)=>e[(t+o)%e.length])}var EN=mf,kN=bf;function _N(e,t){return m.useReducer((r,o)=>t[r][o]??r,e)}var Ao=e=>{const{present:t,children:r}=e,o=DN(t),n=typeof r=="function"?r({present:o.isPresent}):m.Children.only(r),a=Fe(o.ref,AN(n));return typeof r=="function"||o.isPresent?m.cloneElement(n,{ref:a}):null};Ao.displayName="Presence";function DN(e){const[t,r]=m.useState(),o=m.useRef(null),n=m.useRef(e),a=m.useRef("none"),l=e?"mounted":"unmounted",[i,c]=_N(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return m.useEffect(()=>{const d=Fa(o.current);a.current=i==="mounted"?d:"none"},[i]),it(()=>{const d=o.current,p=n.current;if(p!==e){const f=a.current,h=Fa(d);e?c("MOUNT"):h==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(p&&f!==h?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,c]),it(()=>{if(t){let d;const p=t.ownerDocument.defaultView??window,u=h=>{const g=Fa(o.current).includes(CSS.escape(h.animationName));if(h.target===t&&g&&(c("ANIMATION_END"),!n.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",d=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},f=h=>{h.target===t&&(a.current=Fa(o.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{p.clearTimeout(d),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:m.useCallback(d=>{o.current=d?getComputedStyle(d):null,r(d)},[])}}function Fa(e){return(e==null?void 0:e.animationName)||"none"}function AN(e){var o,n;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Ga="Tabs",[TN]=dr(Ga,[hf]),vf=hf(),[MN,_i]=TN(Ga),xf=m.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,onValueChange:n,defaultValue:a,orientation:l="horizontal",dir:i,activationMode:c="automatic",...d}=e,p=aa(i),[u,f]=fr({prop:o,onChange:n,defaultProp:a??"",caller:Ga});return s.jsx(MN,{scope:r,baseId:_r(),value:u,onValueChange:f,orientation:l,dir:p,activationMode:c,children:s.jsx(Ne.div,{dir:p,"data-orientation":l,...d,ref:t})})});xf.displayName=Ga;var wf="TabsList",Sf=m.forwardRef((e,t)=>{const{__scopeTabs:r,loop:o=!0,...n}=e,a=_i(wf,r),l=vf(r);return s.jsx(EN,{asChild:!0,...l,orientation:a.orientation,dir:a.dir,loop:o,children:s.jsx(Ne.div,{role:"tablist","aria-orientation":a.orientation,...n,ref:t})})});Sf.displayName=wf;var Cf="TabsTrigger",Nf=m.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,disabled:n=!1,...a}=e,l=_i(Cf,r),i=vf(r),c=_f(l.baseId,o),d=Df(l.baseId,o),p=o===l.value;return s.jsx(kN,{asChild:!0,...i,focusable:!n,active:p,children:s.jsx(Ne.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":d,"data-state":p?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:c,...a,ref:t,onMouseDown:xe(e.onMouseDown,u=>{!n&&u.button===0&&u.ctrlKey===!1?l.onValueChange(o):u.preventDefault()}),onKeyDown:xe(e.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&l.onValueChange(o)}),onFocus:xe(e.onFocus,()=>{const u=l.activationMode!=="manual";!p&&!n&&u&&l.onValueChange(o)})})})});Nf.displayName=Cf;var Ef="TabsContent",kf=m.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,forceMount:n,children:a,...l}=e,i=_i(Ef,r),c=_f(i.baseId,o),d=Df(i.baseId,o),p=o===i.value,u=m.useRef(p);return m.useEffect(()=>{const f=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(f)},[]),s.jsx(Ao,{present:n||p,children:({present:f})=>s.jsx(Ne.div,{"data-state":p?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:d,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:f&&a})})});kf.displayName=Ef;function _f(e,t){return`${e}-trigger-${t}`}function Df(e,t){return`${e}-content-${t}`}var IN=xf,Af=Sf,Tf=Nf,Mf=kf;const PN=IN,If=m.forwardRef(({className:e,...t},r)=>s.jsx(Af,{ref:r,className:be("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));If.displayName=Af.displayName;const Va=m.forwardRef(({className:e,...t},r)=>s.jsx(Tf,{ref:r,className:be("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Va.displayName=Tf.displayName;const za=m.forwardRef(({className:e,...t},r)=>s.jsx(Mf,{ref:r,className:be("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));za.displayName=Mf.displayName;var Ba="Collapsible",[ON,Pf]=dr(Ba),[$N,Di]=ON(Ba),Of=m.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:o,defaultOpen:n,disabled:a,onOpenChange:l,...i}=e,[c,d]=fr({prop:o,defaultProp:n??!1,onChange:l,caller:Ba});return s.jsx($N,{scope:r,disabled:a,contentId:_r(),open:c,onOpenToggle:m.useCallback(()=>d(p=>!p),[d]),children:s.jsx(Ne.div,{"data-state":Ii(c),"data-disabled":a?"":void 0,...i,ref:t})})});Of.displayName=Ba;var $f="CollapsibleTrigger",Ai=m.forwardRef((e,t)=>{const{__scopeCollapsible:r,...o}=e,n=Di($f,r);return s.jsx(Ne.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":Ii(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...o,ref:t,onClick:xe(e.onClick,n.onOpenToggle)})});Ai.displayName=$f;var Ti="CollapsibleContent",Mi=m.forwardRef((e,t)=>{const{forceMount:r,...o}=e,n=Di(Ti,e.__scopeCollapsible);return s.jsx(Ao,{present:r||n.open,children:({present:a})=>s.jsx(LN,{...o,ref:t,present:a})})});Mi.displayName=Ti;var LN=m.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:o,children:n,...a}=e,l=Di(Ti,r),[i,c]=m.useState(o),d=m.useRef(null),p=Fe(t,d),u=m.useRef(0),f=u.current,h=m.useRef(0),b=h.current,g=l.open||i,y=m.useRef(g),x=m.useRef(void 0);return m.useEffect(()=>{const v=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(v)},[]),it(()=>{const v=d.current;if(v){x.current=x.current||{transitionDuration:v.style.transitionDuration,animationName:v.style.animationName},v.style.transitionDuration="0s",v.style.animationName="none";const w=v.getBoundingClientRect();u.current=w.height,h.current=w.width,y.current||(v.style.transitionDuration=x.current.transitionDuration,v.style.animationName=x.current.animationName),c(o)}},[l.open,o]),s.jsx(Ne.div,{"data-state":Ii(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!g,...a,ref:p,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":b?`${b}px`:void 0,...e.style},children:g&&n})});function Ii(e){return e?"open":"closed"}var Lf=Of,FN=Ai,GN=Mi;const Ff=Lf,Gf=Ai,Vf=Mi;var VN=Symbol.for("react.lazy"),Ua=m[" use ".trim().toString()];function zN(e){return typeof e=="object"&&e!==null&&"then"in e}function zf(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===VN&&"_payload"in e&&zN(e._payload)}function Bf(e){const t=UN(e),r=m.forwardRef((o,n)=>{let{children:a,...l}=o;zf(a)&&typeof Ua=="function"&&(a=Ua(a._payload));const i=m.Children.toArray(a),c=i.find(HN);if(c){const d=c.props.children,p=i.map(u=>u===c?m.Children.count(d)>1?m.Children.only(null):m.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...l,ref:n,children:m.isValidElement(d)?m.cloneElement(d,void 0,p):null})}return s.jsx(t,{...l,ref:n,children:a})});return r.displayName=`${e}.Slot`,r}var BN=Bf("Slot");function UN(e){const t=m.forwardRef((r,o)=>{let{children:n,...a}=r;if(zf(n)&&typeof Ua=="function"&&(n=Ua(n._payload)),m.isValidElement(n)){const l=YN(n),i=jN(a,n.props);return n.type!==m.Fragment&&(i.ref=o?Ko(o,l):l),m.cloneElement(n,i)}return m.Children.count(n)>1?m.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var WN=Symbol("radix.slottable");function HN(e){return m.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===WN}function jN(e,t){const r={...t};for(const o in t){const n=e[o],a=t[o];/^on[A-Z]/.test(o)?n&&a?r[o]=(...i)=>{const c=a(...i);return n(...i),c}:n&&(r[o]=n):o==="style"?r[o]={...n,...a}:o==="className"&&(r[o]=[n,a].filter(Boolean).join(" "))}return{...e,...r}}function YN(e){var o,n;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}const qN=La("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Be=m.forwardRef(({className:e,variant:t,size:r,asChild:o=!1,...n},a)=>{const l=o?BN:"button";return s.jsx(l,{className:be(qN({variant:t,size:r,className:e})),ref:a,...n})});Be.displayName="Button";var QN=Symbol("radix.slottable");function KN(e){const t=({children:r})=>s.jsx(s.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=QN,t}var[Wa]=dr("Tooltip",[ga]),Ha=ga(),Uf="TooltipProvider",XN=700,Pi="tooltip.open",[JN,Oi]=Wa(Uf),Wf=e=>{const{__scopeTooltip:t,delayDuration:r=XN,skipDelayDuration:o=300,disableHoverableContent:n=!1,children:a}=e,l=m.useRef(!0),i=m.useRef(!1),c=m.useRef(0);return m.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),s.jsx(JN,{scope:t,isOpenDelayedRef:l,delayDuration:r,onOpen:m.useCallback(()=>{window.clearTimeout(c.current),l.current=!1},[]),onClose:m.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>l.current=!0,o)},[o]),isPointerInTransitRef:i,onPointerInTransitChange:m.useCallback(d=>{i.current=d},[]),disableHoverableContent:n,children:a})};Wf.displayName=Uf;var nn="Tooltip",[ZN,an]=Wa(nn),Hf=e=>{const{__scopeTooltip:t,children:r,open:o,defaultOpen:n,onOpenChange:a,disableHoverableContent:l,delayDuration:i}=e,c=Oi(nn,e.__scopeTooltip),d=Ha(t),[p,u]=m.useState(null),f=_r(),h=m.useRef(0),b=l??c.disableHoverableContent,g=i??c.delayDuration,y=m.useRef(!1),[x,v]=fr({prop:o,defaultProp:n??!1,onChange:T=>{T?(c.onOpen(),document.dispatchEvent(new CustomEvent(Pi))):c.onClose(),a==null||a(T)},caller:nn}),w=m.useMemo(()=>x?y.current?"delayed-open":"instant-open":"closed",[x]),S=m.useCallback(()=>{window.clearTimeout(h.current),h.current=0,y.current=!1,v(!0)},[v]),E=m.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v(!1)},[v]),N=m.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{y.current=!0,v(!0),h.current=0},g)},[g,v]);return m.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),s.jsx(Iu,{...d,children:s.jsx(ZN,{scope:t,contentId:f,open:x,stateAttribute:w,trigger:p,onTriggerChange:u,onTriggerEnter:m.useCallback(()=>{c.isOpenDelayedRef.current?N():S()},[c.isOpenDelayedRef,N,S]),onTriggerLeave:m.useCallback(()=>{b?E():(window.clearTimeout(h.current),h.current=0)},[E,b]),onOpen:S,onClose:E,disableHoverableContent:b,children:r})})};Hf.displayName=nn;var $i="TooltipTrigger",jf=m.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=an($i,r),a=Oi($i,r),l=Ha(r),i=m.useRef(null),c=Fe(t,i,n.onTriggerChange),d=m.useRef(!1),p=m.useRef(!1),u=m.useCallback(()=>d.current=!1,[]);return m.useEffect(()=>()=>document.removeEventListener("pointerup",u),[u]),s.jsx(Pu,{asChild:!0,...l,children:s.jsx(Ne.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...o,ref:c,onPointerMove:xe(e.onPointerMove,f=>{f.pointerType!=="touch"&&!p.current&&!a.isPointerInTransitRef.current&&(n.onTriggerEnter(),p.current=!0)}),onPointerLeave:xe(e.onPointerLeave,()=>{n.onTriggerLeave(),p.current=!1}),onPointerDown:xe(e.onPointerDown,()=>{n.open&&n.onClose(),d.current=!0,document.addEventListener("pointerup",u,{once:!0})}),onFocus:xe(e.onFocus,()=>{d.current||n.onOpen()}),onBlur:xe(e.onBlur,n.onClose),onClick:xe(e.onClick,n.onClose)})})});jf.displayName=$i;var Li="TooltipPortal",[RN,eE]=Wa(Li,{forceMount:void 0}),Yf=e=>{const{__scopeTooltip:t,forceMount:r,children:o,container:n}=e,a=an(Li,t);return s.jsx(RN,{scope:t,forceMount:r,children:s.jsx(Ao,{present:r||a.open,children:s.jsx(oi,{asChild:!0,container:n,children:o})})})};Yf.displayName=Li;var To="TooltipContent",qf=m.forwardRef((e,t)=>{const r=eE(To,e.__scopeTooltip),{forceMount:o=r.forceMount,side:n="top",...a}=e,l=an(To,e.__scopeTooltip);return s.jsx(Ao,{present:o||l.open,children:l.disableHoverableContent?s.jsx(Qf,{side:n,...a,ref:t}):s.jsx(tE,{side:n,...a,ref:t})})}),tE=m.forwardRef((e,t)=>{const r=an(To,e.__scopeTooltip),o=Oi(To,e.__scopeTooltip),n=m.useRef(null),a=Fe(t,n),[l,i]=m.useState(null),{trigger:c,onClose:d}=r,p=n.current,{onPointerInTransitChange:u}=o,f=m.useCallback(()=>{i(null),u(!1)},[u]),h=m.useCallback((b,g)=>{const y=b.currentTarget,x={x:b.clientX,y:b.clientY},v=sE(x,y.getBoundingClientRect()),w=lE(x,v),S=iE(g.getBoundingClientRect()),E=dE([...w,...S]);i(E),u(!0)},[u]);return m.useEffect(()=>()=>f(),[f]),m.useEffect(()=>{if(c&&p){const b=y=>h(y,p),g=y=>h(y,c);return c.addEventListener("pointerleave",b),p.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",b),p.removeEventListener("pointerleave",g)}}},[c,p,h,f]),m.useEffect(()=>{if(l){const b=g=>{const y=g.target,x={x:g.clientX,y:g.clientY},v=(c==null?void 0:c.contains(y))||(p==null?void 0:p.contains(y)),w=!cE(x,l);v?f():w&&(f(),d())};return document.addEventListener("pointermove",b),()=>document.removeEventListener("pointermove",b)}},[c,p,l,d,f]),s.jsx(Qf,{...e,ref:a})}),[rE,oE]=Wa(nn,{isInside:!1}),nE=KN("TooltipContent"),Qf=m.forwardRef((e,t)=>{const{__scopeTooltip:r,children:o,"aria-label":n,onEscapeKeyDown:a,onPointerDownOutside:l,...i}=e,c=an(To,r),d=Ha(r),{onClose:p}=c;return m.useEffect(()=>(document.addEventListener(Pi,p),()=>document.removeEventListener(Pi,p)),[p]),m.useEffect(()=>{if(c.trigger){const u=f=>{const h=f.target;h!=null&&h.contains(c.trigger)&&p()};return window.addEventListener("scroll",u,{capture:!0}),()=>window.removeEventListener("scroll",u,{capture:!0})}},[c.trigger,p]),s.jsx(zl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u=>u.preventDefault(),onDismiss:p,children:s.jsxs(Ou,{"data-state":c.stateAttribute,...d,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[s.jsx(nE,{children:o}),s.jsx(rE,{scope:r,isInside:!0,children:s.jsx(m0,{id:c.contentId,role:"tooltip",children:n||o})})]})})});qf.displayName=To;var Kf="TooltipArrow",aE=m.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=Ha(r);return oE(Kf,r).isInside?null:s.jsx($u,{...n,...o,ref:t})});aE.displayName=Kf;function sE(e,t){const r=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),n=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(r,o,n,a)){case a:return"left";case n:return"right";case r:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function lE(e,t,r=5){const o=[];switch(t){case"top":o.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":o.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":o.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":o.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return o}function iE(e){const{top:t,right:r,bottom:o,left:n}=e;return[{x:n,y:t},{x:r,y:t},{x:r,y:o},{x:n,y:o}]}function cE(e,t){const{x:r,y:o}=e;let n=!1;for(let a=0,l=t.length-1;a<t.length;l=a++){const i=t[a],c=t[l],d=i.x,p=i.y,u=c.x,f=c.y;p>o!=f>o&&r<(u-d)*(o-p)/(f-p)+d&&(n=!n)}return n}function dE(e){const t=e.slice();return t.sort((r,o)=>r.x<o.x?-1:r.x>o.x?1:r.y<o.y?-1:r.y>o.y?1:0),uE(t)}function uE(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o<e.length;o++){const n=e[o];for(;t.length>=2;){const a=t[t.length-1],l=t[t.length-2];if((a.x-l.x)*(n.y-l.y)>=(a.y-l.y)*(n.x-l.x))t.pop();else break}t.push(n)}t.pop();const r=[];for(let o=e.length-1;o>=0;o--){const n=e[o];for(;r.length>=2;){const a=r[r.length-1],l=r[r.length-2];if((a.x-l.x)*(n.y-l.y)>=(a.y-l.y)*(n.x-l.x))r.pop();else break}r.push(n)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var pE=Wf,fE=Hf,hE=jf,mE=Yf,Xf=qf;const ja=pE,ar=fE,sr=hE,Yt=m.forwardRef(({className:e,sideOffset:t=4,...r},o)=>s.jsx(mE,{children:s.jsx(Xf,{ref:o,sideOffset:t,className:be("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",e),...r})}));Yt.displayName=Xf.displayName;const Fi=m.forwardRef(({className:e,children:t,...r},o)=>s.jsx("div",{ref:o,className:be("relative overflow-hidden",e),...r,children:s.jsx("div",{className:"h-full w-full overflow-auto rounded-[inherit]",children:t})}));Fi.displayName="ScrollArea";const gE=m.forwardRef(({className:e,orientation:t="vertical",...r},o)=>s.jsx("div",{ref:o,className:be("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:s.jsx("div",{className:"relative flex-1 rounded-full bg-border"})}));gE.displayName="ScrollBar";function Jf(e){return{order:99,disabled:!1,hidden:!1,...e}}function bE(e){return e.map((t,r)=>Jf({...t,order:t.order??100+r}))}function Zf(e,t){return typeof e.disabled=="function"?e.disabled(t):e.disabled??!1}function Rf(e,t){return typeof e.hidden=="function"?e.hidden(t):e.hidden??!1}const yE=({element:e,onAddElement:t,isDisabled:r=!1,disabledReason:o,wizardExists:n=!1})=>{const a=J(u=>u.setDraggedElementType),l=u=>{if(r){u.preventDefault();return}u.dataTransfer.setData("elementType",e.type),u.dataTransfer.effectAllowed="copy",a(e.type)},i=()=>{a(null)},c=()=>{r||t(e.type)},d=()=>{if(typeof e.icon=="string")return s.jsx("span",{className:"text-lg flex-shrink-0",children:e.icon});const u=e.icon;return s.jsx(u,{className:"w-5 h-5 flex-shrink-0"})},p=s.jsxs("div",{draggable:!r,onDragStart:l,onDragEnd:i,onClick:c,className:be("flex items-center gap-2 p-2 bg-card border border-border rounded-md transition-all duration-150 select-none",r?"opacity-50 cursor-not-allowed":"cursor-grab hover:border-primary hover:shadow-sm active:cursor-grabbing"),children:[d(),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("div",{className:"text-xs font-medium text-foreground truncate",children:e.label}),r&&s.jsx("div",{className:"text-xs text-orange-500 truncate",children:"Already added"})]})]});return r&&o?s.jsx(ja,{children:s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:p}),s.jsx(Yt,{children:s.jsx("p",{children:o})})]})}):s.jsx(ja,{children:s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:p}),s.jsx(Yt,{children:s.jsxs("div",{className:"max-w-xs",children:[s.jsx("p",{className:"font-medium",children:e.label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:e.description}),s.jsx("p",{className:"text-xs mt-1 text-muted-foreground/70",children:n?"Drag into wizard step":"Drag or click to add"})]})})]})})},eh=({label:e,elements:t,searchQuery:r,onAddElement:o,defaultExpanded:n=!1,hasWizard:a=!1,wizardExists:l=!1})=>{const[i,c]=C.useState(n),d=C.useMemo(()=>{if(!r.trim())return t;const u=r.toLowerCase();return t.filter(f=>f.label.toLowerCase().includes(u)||f.description.toLowerCase().includes(u)||f.searchKeywords&&f.searchKeywords.some(h=>h.toLowerCase().includes(u)))},[t,r]);if(r&&d.length===0)return null;const p=r?!0:i;return s.jsxs(Ff,{open:p,onOpenChange:c,className:"mb-2",children:[s.jsx(Gf,{asChild:!0,children:s.jsxs(Be,{variant:"ghost",className:"w-full flex items-center justify-between px-2 py-1.5 h-auto text-xs font-semibold text-muted-foreground uppercase tracking-wider hover:bg-muted",children:[s.jsx("span",{children:e}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Ni,{variant:"secondary",className:"font-normal normal-case text-xs",children:d.length}),s.jsx(Eo,{className:be("h-4 w-4 transition-transform",p&&"rotate-180")})]})]})}),s.jsx(Vf,{children:s.jsx("div",{className:"grid grid-cols-2 gap-1.5 mt-1.5",children:d.map(u=>s.jsx(yE,{element:u,onAddElement:o,isDisabled:u.type==="pages"&&a,disabledReason:"Only one wizard can be added per form",wizardExists:l},u.type))})})]})},th=({searchQuery:e,elements:t})=>t.some(o=>o.label.toLowerCase().includes(e.toLowerCase())||o.description.toLowerCase().includes(e.toLowerCase())||o.searchKeywords&&o.searchKeywords.some(n=>n.toLowerCase().includes(e.toLowerCase())))?null:s.jsxs("div",{className:"text-center py-8 text-muted-foreground text-sm",children:[s.jsx("div",{className:"text-3xl mb-2",children:"🔍"}),s.jsxs("p",{children:['No elements found for "',e,'"']}),s.jsx("p",{className:"text-xs mt-1 text-muted-foreground/70",children:"Try a different search term"})]}),vE=({sidebarTabs:e=[]})=>{const[t,r]=C.useState("fields"),[o,n]=C.useState(""),a=J(D=>D.addElement),l=J(D=>D.hasWizard),i=J(D=>D.schema),c=J(D=>D.mode),d=J(D=>D.loadSchema),p=J(D=>D.exportSchema),u=J(D=>D.resetForm),f=J(D=>D.updateFormTitle),h=J(D=>D.updateFormDescription),b=J(D=>D.updateElement),g=J(D=>D.deleteElement),y=J(D=>D.selectElement),x=J(D=>D.setMode),v=D=>{w&&D!=="pages"||a(D)},w=l(),S=C.useMemo(()=>{const D=Ke.getGroups(),U=D.filter(F=>F.elements.some(q=>q.category==="field")),$=D.filter(F=>F.elements.some(q=>q.category==="page"));return{fieldGroups:U,pageGroups:$}},[]),E=C.useMemo(()=>Ke.getByCategory("field"),[]),N=C.useMemo(()=>Ke.getByCategory("page"),[]),T=["textInput","selection","heading","layout","special"],k=C.useMemo(()=>({schema:i,mode:c,actions:{addElement:a,loadSchema:d,exportSchema:p,resetForm:u,updateFormTitle:f,updateFormDescription:h,updateElement:b,deleteElement:g,selectElement:y,setMode:x}}),[i,c,a,d,p,u,f,h,b,g,y,x]),M=C.useMemo(()=>e.length?[...e].filter(D=>!Rf(D,k)).sort((D,U)=>(D.order??99)-(U.order??99)):[],[e,k]);return s.jsxs("div",{className:"w-72 bg-muted/50 border-r border-border flex flex-col h-full",children:[w&&s.jsx("div",{className:"p-2 bg-orange-50 border-b border-orange-200",children:s.jsxs("div",{className:"flex items-start gap-2 text-xs text-orange-700",children:[s.jsx("span",{className:"text-base",children:"📑"}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:"Wizard Mode Active"}),s.jsx("p",{className:"text-orange-600",children:"Drop elements inside wizard steps, not on the main canvas."})]})]})}),s.jsx("div",{className:"p-3 border-b border-border bg-card",children:s.jsxs("div",{className:"relative",children:[s.jsx(BS,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),s.jsx(Vt,{type:"text",placeholder:"Search elements...",value:o,onChange:D=>n(D.target.value),className:"pl-9 pr-8"}),o&&s.jsx(Be,{variant:"ghost",size:"icon",className:"absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6",onClick:()=>n(""),children:s.jsx(Da,{className:"h-4 w-4"})})]})}),s.jsxs(PN,{value:t,onValueChange:r,className:"flex-1 flex flex-col min-h-0 overflow-hidden",children:[s.jsx(Fi,{"aria-disabled":!0,children:s.jsxs(If,{className:"w-full rounded-none border-b border-border bg-card h-auto p-0 flex-shrink-0",children:[s.jsxs(Va,{value:"fields",className:"flex-1 rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-primary/5 py-2.5",children:["Fields (",E.length,")"]}),s.jsxs(Va,{value:"pages",className:"flex-1 rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-primary/5 py-2.5",children:["Page (",N.length,")"]}),M.map(D=>{const U=D.icon;return s.jsxs(Va,{value:D.id,className:"flex-1 rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-primary/5 py-2.5",disabled:Zf(D,k),children:[U&&s.jsx(U,{className:"h-3.5 w-3.5 mr-1"}),D.label]},D.id)})]})}),s.jsxs("div",{className:"flex-1 min-h-0 relative",children:[s.jsx(za,{value:"fields",className:"absolute inset-0 mt-0 data-[state=inactive]:hidden overflow-auto",children:s.jsxs("div",{className:"p-3",children:[S.fieldGroups.map(D=>s.jsx(eh,{label:D.label,elements:D.elements.filter(U=>U.category==="field"),searchQuery:o,onAddElement:v,defaultExpanded:T.includes(D.id),wizardExists:w},D.id)),o&&s.jsx(th,{searchQuery:o,elements:E})]})}),s.jsx(za,{value:"pages",className:"absolute inset-0 mt-0 data-[state=inactive]:hidden overflow-auto",children:s.jsxs("div",{className:"p-3",children:[S.pageGroups.map(D=>s.jsx(eh,{label:D.label,elements:D.elements.filter(U=>U.category==="page"),searchQuery:o,onAddElement:v,defaultExpanded:T.includes(D.id),hasWizard:w,wizardExists:w},D.id)),o&&s.jsx(th,{searchQuery:o,elements:N})]})}),M.map(D=>{const U=D.content;return s.jsx(za,{value:D.id,className:"absolute inset-0 mt-0 data-[state=inactive]:hidden overflow-auto",children:s.jsx(U,{...k})},D.id)})]})]})]})},xE=["shortText","longText","multiLineInput","textEditor","number","slider","rangeSlider","email","phone","url","location","password","signature","captcha","singleChoice","multipleChoice","dropdown","tags","decisionBox","toggleSwitch","singleChoiceMatrix","multipleChoiceMatrix","matrixTable","date","time","dateTime","multipleDates","dateRange","fileUpload","imageUpload","multiFileUpload","multiImageUpload","paragraph","image","link","formHeading","sectionHeading","subheading","divider","spacer","group","grid","table","repeatElement","repeatGroup","pages","submit"];function wE(e){const t=[];if(!e||typeof e!="object")return t.push({type:"error",message:"Schema must be a valid object"}),{valid:!1,errors:t};const r=e;if((!r.id||typeof r.id!="string")&&t.push({type:"error",message:'Schema must have a valid "id" field (string)'}),(!r.version||typeof r.version!="string")&&t.push({type:"error",message:'Schema must have a valid "version" field (string)'}),(!r.title||typeof r.title!="string")&&t.push({type:"error",message:'Schema must have a valid "title" field (string)'}),!Array.isArray(r.elements))return t.push({type:"error",message:'Schema must have an "elements" array'}),{valid:!1,errors:t};const o=new Set,n=new Map;r.elements.forEach((i,c)=>{const d=SE(i,c,o,n);t.push(...d)}),n.forEach((i,c)=>{i.length>1&&t.push({type:"error",message:`Duplicate field name "${c}" found in elements: ${i.join(", ")}`})});const a=new Set(o);return r.elements.forEach(i=>{if(i&&i.logic){const c=NE(i,a);t.push(...c)}}),r.elements.length===0&&t.push({type:"warning",message:"Schema has no elements"}),!r.elements.some(i=>i&&i.type==="submit")&&r.elements.length>0&&t.push({type:"warning",message:"Schema has no submit button"}),{valid:t.filter(i=>i.type==="error").length===0,errors:t}}function SE(e,t,r,o){const n=[],a=`Element at index ${t}`;if(!e||typeof e!="object")return n.push({type:"error",message:`${a}: Must be a valid object`}),n;const l=e;if(!l.id||typeof l.id!="string"?n.push({type:"error",message:`${a}: Must have a valid "id" field (string)`}):(r.has(l.id)&&n.push({type:"error",message:`${a}: Duplicate element ID "${l.id}"`}),r.add(l.id)),!l.type||typeof l.type!="string"?n.push({type:"error",message:`${a}: Must have a valid "type" field (string)`}):xE.includes(l.type)||n.push({type:"error",message:`${a}: Invalid element type "${l.type}"`}),typeof l.order!="number"&&n.push({type:"warning",elementId:l.id,message:`${a}: Missing or invalid "order" field`}),(!l.properties||typeof l.properties!="object")&&n.push({type:"warning",elementId:l.id,message:`${a}: Missing "properties" object`}),(!l.layout||typeof l.layout!="object")&&n.push({type:"warning",elementId:l.id,message:`${a}: Missing "layout" object`}),!l.attributes||typeof l.attributes!="object")n.push({type:"warning",elementId:l.id,message:`${a}: Missing "attributes" object`});else{const c=l.attributes;if(!c.name||typeof c.name!="string")n.push({type:"error",elementId:l.id,message:`${a}: Missing or invalid "attributes.name" field`});else{const d=o.get(c.name)||[];d.push(l.id),o.set(c.name,d)}}const i=CE(l);return n.push(...i),n}function CE(e){const t=[],r=e.type,o=e.config,n=e.id;return["singleChoice","multipleChoice","dropdown","tags"].includes(r)&&(!(o!=null&&o.options)||!Array.isArray(o.options)?t.push({type:"warning",elementId:n,message:`${r} element should have config.options array`}):o.options.length===0?t.push({type:"warning",elementId:n,message:`${r} element has no options defined`}):o.options.forEach((i,c)=>{if(!i||typeof i!="object")t.push({type:"error",elementId:n,message:`${r} option at index ${c} is invalid`});else{const d=i;(typeof d.label!="string"||typeof d.value!="string")&&t.push({type:"warning",elementId:n,message:`${r} option at index ${c} should have label and value strings`})}})),["singleChoiceMatrix","multipleChoiceMatrix","matrixTable"].includes(r)&&((!(o!=null&&o.matrixRows)||!Array.isArray(o.matrixRows))&&t.push({type:"warning",elementId:n,message:`${r} element should have config.matrixRows array`}),(!(o!=null&&o.matrixColumns)||!Array.isArray(o.matrixColumns))&&t.push({type:"warning",elementId:n,message:`${r} element should have config.matrixColumns array`})),r==="pages"&&(!(o!=null&&o.pagesList)||!Array.isArray(o.pagesList))&&t.push({type:"warning",elementId:n,message:"pages element should have config.pagesList array"}),(r==="slider"||r==="rangeSlider")&&o&&typeof o.min=="number"&&typeof o.max=="number"&&o.min>=o.max&&t.push({type:"error",elementId:n,message:`${r} min value must be less than max value`}),t}function NE(e,t){var a,l,i,c;const r=[],o=e.logic;if(!o)return r;const n=(d,p)=>{d&&d.forEach((u,f)=>{u.field?t.has(u.field)||r.push({type:"warning",elementId:e.id,message:`${p} rule ${f+1}: References unknown field "${u.field}"`}):r.push({type:"warning",elementId:e.id,message:`${p} rule ${f+1}: Missing field reference`}),u.operator||r.push({type:"warning",elementId:e.id,message:`${p} rule ${f+1}: Missing operator`})})};return(a=o.showWhen)!=null&&a.rules&&n(o.showWhen.rules,"showWhen"),(l=o.hideWhen)!=null&&l.rules&&n(o.hideWhen.rules,"hideWhen"),(i=o.requireWhen)!=null&&i.rules&&n(o.requireWhen.rules,"requireWhen"),(c=o.disableWhen)!=null&&c.rules&&n(o.disableWhen.rules,"disableWhen"),r}function EE(e){let t;try{t=JSON.parse(e)}catch(o){return{schema:null,validation:{valid:!1,errors:[{type:"error",message:`Invalid JSON: ${o.message}`}]}}}const r=wE(t);return{schema:r.valid?t:null,validation:r}}function kE(e){var r;const t=JSON.parse(JSON.stringify(e));return t.id||(t.id=((r=crypto.randomUUID)==null?void 0:r.call(crypto))||`form_${Date.now()}`),t.version||(t.version="1.0"),t.title||(t.title="Untitled Form"),Array.isArray(t.elements)||(t.elements=[]),t.metadata||(t.metadata={createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}),t.elements=t.elements.map((o,n)=>{var a;return o.id||(o.id=((a=crypto.randomUUID)==null?void 0:a.call(crypto))||`element_${Date.now()}_${n}`),typeof o.order!="number"&&(o.order=n),o.properties||(o.properties={}),o.layout||(o.layout={}),o.attributes||(o.attributes={name:`field_${n}`}),o.attributes.name||(o.attributes.name=`field_${n}`),o}),t.elements.forEach((o,n)=>{o.order=n}),t}function _E(e){if(e.valid&&e.errors.length===0)return"Schema is valid.";const t=e.errors.filter(n=>n.type==="error").length,r=e.errors.filter(n=>n.type==="warning").length;let o="";return t>0&&(o+=`${t} error${t!==1?"s":""}`),r>0&&(o&&(o+=", "),o+=`${r} warning${r!==1?"s":""}`),o}function rh(e){return{order:0,variant:"ghost",disabled:!1,hidden:!1,...e}}function DE(e){return e.map((t,r)=>rh({...t,order:t.order??r}))}function oh(e,t){return typeof e.disabled=="function"?e.disabled(t):e.disabled??!1}function Gi(e,t){return typeof e.hidden=="function"?e.hidden(t):e.hidden??!1}class AE{constructor(){Cl(this,"modes",new Map)}register(t){if(!t.id)throw new Error("Mode definition must have an id");if(!t.label)throw new Error(`Mode "${t.id}" must have a label`);if(!t.icon)throw new Error(`Mode "${t.id}" must have an icon`);if(!t.renderContent)throw new Error(`Mode "${t.id}" must have a renderContent function`);if(this.modes.has(t.id)){console.warn(`Mode "${t.id}" is already registered. Use modeRegistry.unregister("${t.id}") first or manage registration order.`);return}this.modes.set(t.id,t)}get(t){return this.modes.get(t)}has(t){return this.modes.has(t)}getAll(){return Array.from(this.modes.values()).sort((t,r)=>(t.order??50)-(r.order??50))}getVisible(){return this.getAll().filter(t=>!t.hidden)}unregister(t){return this.modes.delete(t)}clear(){this.modes.clear()}}const Tt=new AE;function TE(e){Tt.register(e)}function ME(e){for(const t of e)Tt.register(t)}function IE(e){return Tt.unregister(e)}function PE(e){return Tt.get(e)}function OE(e){return Tt.has(e)}const to=({action:e,context:t})=>{const r=e.icon,o=oh(e,t),n=async()=>{o||await e.onClick(t)},a=e.variant==="destructive"?"text-destructive hover:text-destructive hover:bg-destructive/10":"";return s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:"ghost",size:"icon",onClick:n,disabled:o,className:a,children:s.jsx(r,{className:"h-5 w-5"})})}),s.jsx(Yt,{children:s.jsx("p",{children:e.label})})]})},$E=({schema:e,canUndo:t,canRedo:r,onUndo:o,onRedo:n,onExport:a,exportSchema:l,onImport:i,onReset:c,mode:d,onModeChange:p,toolbarConfig:u})=>{const f=C.useRef(null),h=C.useMemo(()=>({schema:e,mode:d,canUndo:t,canRedo:r,actions:{undo:o,redo:n,loadSchema:i,exportSchema:l,setMode:p,resetForm:c}}),[e,d,t,r,o,n,i,l,p,c]),b=()=>{var N;(N=f.current)==null||N.click()},g=N=>{var k;const T=(k=N.target.files)==null?void 0:k[0];if(T){const M=new FileReader;M.onload=D=>{var U;try{const $=(U=D.target)==null?void 0:U.result,{schema:F,validation:q}=EE($);if(!q.valid){const W=_E(q),Q=q.errors.filter(z=>z.type==="error").slice(0,5).map(z=>`• ${z.message}`).join(`
172
+ `);if(window.confirm(`Schema validation failed (${W}):
173
+
174
+ ${Q}
175
+
176
+ Would you like to attempt to import anyway? The schema will be sanitized.`)){const z=JSON.parse($),pe=kE(z);i(pe)}return}const R=q.errors.filter(W=>W.type==="warning");R.length>0&&console.warn("Schema import warnings:",R),i(F)}catch($){console.error("Failed to import schema:",$),alert("Invalid JSON file. Please select a valid form schema.")}},M.readAsText(T)}f.current&&(f.current.value="")},y=new Set((u==null?void 0:u.hideBuiltinActions)??[]);(u==null?void 0:u.showUndoRedo)===!1&&(y.add("undo"),y.add("redo")),(u==null?void 0:u.showModeToggle)===!1&&(y.add("design-mode"),y.add("preview-mode")),(u==null?void 0:u.showImportExport)===!1&&(y.add("import"),y.add("export")),(u==null?void 0:u.showReset)===!1&&y.add("reset");const x=new Map,v=(u==null?void 0:u.actions)??[];v.forEach(N=>{N.override&&x.set(N.override,N)});const w=C.useMemo(()=>{const N={left:[],center:[],right:[]};return v.filter(T=>!T.override&&!Gi(T,h)).forEach(T=>{N[T.position].push(T)}),Object.values(N).forEach(T=>{T.sort((k,M)=>(k.order??0)-(M.order??0))}),N},[v,h]),S=N=>!(y.has(N)||x.has(N)),E=(N,T)=>{if(y.has(N))return null;const k=x.get(N);return k&&!Gi(k,h)?s.jsx(to,{action:k,context:h},N):T()};return s.jsx(ja,{children:s.jsxs("div",{className:"flex items-center justify-between px-4 py-2 bg-card border-b border-border",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[w.left.filter(N=>(N.order??0)<0).map(N=>s.jsx(to,{action:N,context:h},N.id)),E("undo",()=>S("undo")?s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:"ghost",size:"icon",onClick:o,disabled:!t,children:s.jsx(WS,{className:"h-5 w-5"})})}),s.jsx(Yt,{children:s.jsx("p",{children:"Undo (⌘Z)"})})]},"undo"):null),E("redo",()=>S("redo")?s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:"ghost",size:"icon",onClick:n,disabled:!r,children:s.jsx(zS,{className:"h-5 w-5"})})}),s.jsx(Yt,{children:s.jsx("p",{children:"Redo (⌘⇧Z)"})})]},"redo"):null),w.left.filter(N=>(N.order??0)>=0).map(N=>s.jsx(to,{action:N,context:h},N.id))]}),s.jsxs("div",{className:"flex items-center gap-2",children:[w.center.filter(N=>(N.order??0)<0).map(N=>s.jsx(to,{action:N,context:h},N.id)),(u==null?void 0:u.showModeToggle)!==!1&&Tt.getVisible().length>0&&s.jsx("div",{className:"flex items-center bg-muted rounded-lg p-1",children:Tt.getVisible().map(N=>{const T=`${N.id}-mode`;if(y.has(T))return null;const k=N.icon,M=d===N.id;return s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:M?"secondary":"ghost",size:"icon",onClick:()=>p(N.id),className:be(M&&"bg-background shadow-sm"),children:s.jsx(k,{className:"h-5 w-5"})})}),s.jsx(Yt,{children:s.jsx("p",{children:N.description??N.label})})]},N.id)})}),w.center.filter(N=>(N.order??0)>=0).map(N=>s.jsx(to,{action:N,context:h},N.id))]}),s.jsxs("div",{className:"flex items-center gap-1",children:[w.right.filter(N=>(N.order??0)<0).map(N=>s.jsx(to,{action:N,context:h},N.id)),s.jsx("input",{ref:f,type:"file",accept:".json",onChange:g,className:"hidden"}),E("import",()=>S("import")?s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:"ghost",size:"icon",onClick:b,children:s.jsx(HS,{className:"h-5 w-5"})})}),s.jsx(Yt,{children:s.jsx("p",{children:"Import"})})]},"import"):null),E("export",()=>S("export")?s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:"ghost",size:"icon",onClick:a,children:s.jsx(FS,{className:"h-5 w-5"})})}),s.jsx(Yt,{children:s.jsx("p",{children:"Export"})})]},"export"):null),E("reset",()=>S("reset")?s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive hover:bg-destructive/10",onClick:c,children:s.jsx(gi,{className:"h-5 w-5"})})}),s.jsx(Yt,{children:s.jsx("p",{children:"Reset"})})]},"reset"):null),w.right.filter(N=>(N.order??0)>=0).map(N=>s.jsx(to,{action:N,context:h},N.id))]})]})})},sn=({containerId:e,stepId:t,label:r="Drop elements here",children:o,isEmpty:n=!0})=>{const[a,l]=C.useState(!1),i=C.useRef(null),c=J(h=>h.addElementToContainer),d=J(h=>h.setDraggedElementType),p=h=>{h.preventDefault();const g=h.currentTarget.querySelectorAll("[data-drop-zone]");for(const y of g){const x=y.getBoundingClientRect();if(h.clientX>=x.left&&h.clientX<=x.right&&h.clientY>=x.top&&h.clientY<=x.bottom){l(!1);return}}h.stopPropagation(),l(!0)},u=h=>{h.preventDefault();const b=h.relatedTarget,g=h.currentTarget;if(b&&g.contains(b)){const y=b.closest("[data-drop-zone]");y&&y!==g&&l(!1);return}h.stopPropagation(),l(!1)},f=h=>{h.preventDefault();const g=h.currentTarget.querySelectorAll("[data-drop-zone]");for(const x of g){const v=x.getBoundingClientRect();if(h.clientX>=v.left&&h.clientX<=v.right&&h.clientY>=v.top&&h.clientY<=v.bottom){l(!1);return}}h.stopPropagation(),l(!1);const y=h.dataTransfer.getData("elementType");y&&(c(y,e,t),d(null))};return s.jsx("div",{ref:i,"data-drop-zone":e,"data-step-id":t,onDragOver:p,onDragLeave:u,onDrop:f,className:`min-h-[60px] rounded transition-all ${a?"border-2 border-blue-400 border-dashed bg-blue-50":n?"border-2 border-dashed border-gray-300 bg-gray-50/50":"border border-dashed border-gray-200"}`,style:{pointerEvents:"auto"},children:n?s.jsx("div",{className:"flex items-center justify-center h-full min-h-[60px] text-gray-400 text-sm pointer-events-none",children:a?"Release to drop":r}):s.jsx("div",{className:"space-y-2 p-2",children:o})})},nh=e=>{const t=df(e);if(!t)return"📋";if(typeof t=="string")return t;const r=t;return s.jsx(r,{className:"w-4 h-4 inline-block"})},Ya=({element:e,isSelected:t,isHovered:r,onSelect:o,onHover:n,onDelete:a})=>{const l=()=>e.type==="group"?s.jsx(ah,{element:e}):e.type==="grid"?s.jsx(sh,{element:e}):e.type==="repeatGroup"?s.jsx(lh,{element:e}):s.jsx(Oa,{element:e,isSelected:t}),i=e.type==="group"||e.type==="grid"||e.type==="repeatGroup";return s.jsxs("div",{onClick:c=>{c.stopPropagation(),o()},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),className:`relative p-3 rounded-lg border transition-all ${i?"cursor-default":"cursor-pointer"} ${t?"border-blue-500 bg-blue-50/50 shadow-sm":r?"border-blue-300 bg-gray-50":"border-gray-200 hover:border-gray-300"}`,children:[(t||r)&&s.jsxs("div",{className:"absolute -top-2 left-2 px-1.5 py-0.5 bg-blue-500 text-white text-xs rounded-full shadow-sm flex items-center gap-1",children:[nh(e.type)," ",Ci(e.type)]}),(t||r)&&s.jsx("button",{onClick:c=>{c.stopPropagation(),a()},className:"absolute -top-2 right-2 w-5 h-5 bg-red-500 text-white rounded-full flex items-center justify-center text-xs hover:bg-red-600 shadow-sm",children:"×"}),l()]})},LE=({element:e,index:t,isSelected:r,isHovered:o,onSelect:n,onHover:a,onDelete:l,onDuplicate:i,onDragStart:c,onDragOver:d,onDragEnd:p,isDragTarget:u})=>{const f=()=>e.type==="group"?s.jsx(ah,{element:e}):e.type==="grid"?s.jsx(sh,{element:e}):e.type==="repeatGroup"?s.jsx(lh,{element:e}):e.type==="pages"?s.jsx(FE,{element:e}):s.jsx(Oa,{element:e,isSelected:r}),h=y=>{y.dataTransfer.effectAllowed="move",y.dataTransfer.setData("elementId",e.id),c(t)},b=y=>{y.preventDefault(),y.dataTransfer.dropEffect="move",d(t)},g=()=>{p()};return s.jsxs("div",{draggable:!0,onDragStart:h,onDragOver:b,onDragEnd:g,onClick:n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),className:`relative p-4 rounded-lg border-2 transition-all cursor-grab active:cursor-grabbing ${u?"border-blue-500 border-dashed bg-blue-50":r?"border-blue-500 bg-blue-50/30 shadow-sm":o?"border-blue-300 bg-gray-50/50":"border-transparent hover:border-gray-200"}`,children:[u&&s.jsx("div",{className:"absolute -top-1 left-0 right-0 h-0.5 bg-blue-500 rounded"}),(r||o)&&s.jsxs("div",{className:"absolute -top-3 left-3 px-2 py-0.5 bg-blue-500 text-white text-xs rounded-full shadow-sm flex items-center gap-1",children:[nh(e.type)," ",Ci(e.type)]}),(r||o)&&s.jsxs("div",{className:"absolute -top-3 right-3 flex gap-1",children:[s.jsx("button",{onClick:y=>{y.stopPropagation(),i()},className:"p-1 bg-white border border-gray-200 rounded shadow-sm hover:bg-gray-50 text-xs",title:"Duplicate",children:"📋"}),s.jsx("button",{onClick:y=>{y.stopPropagation(),l()},className:"p-1 bg-white border border-gray-200 rounded shadow-sm hover:bg-red-50 hover:border-red-200 text-xs",title:"Delete",children:"🗑️"})]}),f(),(r||o)&&s.jsxs("div",{className:"absolute left-1 top-1/2 -translate-y-1/2 flex flex-col gap-0.5 cursor-grab",title:"Drag to reorder",children:[s.jsx("div",{className:"w-4 h-0.5 bg-gray-400 rounded"}),s.jsx("div",{className:"w-4 h-0.5 bg-gray-400 rounded"}),s.jsx("div",{className:"w-4 h-0.5 bg-gray-400 rounded"})]})]})},ah=({element:e})=>{var p;const t=e.properties.label||"Group",r=e.properties.description,o=J(u=>u.schema.elements),n=J(u=>u.selectedElementId),a=J(u=>u.hoveredElementId),l=J(u=>u.selectElement),i=J(u=>u.setHoveredElementId),c=J(u=>u.deleteElement),d=o.filter(u=>u.parentId===e.id).sort((u,f)=>u.order-f.order);return s.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",style:{padding:((p=e.config)==null?void 0:p.padding)||16},children:[s.jsxs("div",{className:"mb-3",children:[s.jsx("h3",{className:"font-medium text-gray-800",children:t}),r&&s.jsx("p",{className:"text-sm text-gray-500",children:r})]}),s.jsx(sn,{containerId:e.id,label:"Drop elements into this group",isEmpty:d.length===0,children:d.map(u=>s.jsx(Ya,{element:u,isSelected:n===u.id,isHovered:a===u.id,onSelect:()=>l(u.id),onHover:f=>i(f?u.id:null),onDelete:()=>c(u.id)},u.id))})]})},sh=({element:e})=>{var p,u;const t=e.properties.label,r=((p=e.config)==null?void 0:p.gridColumns)||2,o=J(f=>f.schema.elements),n=J(f=>f.selectedElementId),a=J(f=>f.hoveredElementId),l=J(f=>f.selectElement),i=J(f=>f.setHoveredElementId),c=J(f=>f.deleteElement),d=o.filter(f=>f.parentId===e.id).sort((f,h)=>f.order-h.order);return s.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[t&&s.jsx("div",{className:"mb-3",children:s.jsx("h3",{className:"font-medium text-gray-800",children:t})}),s.jsx("div",{className:"grid",style:{gridTemplateColumns:`repeat(${r}, 1fr)`,gap:((u=e.config)==null?void 0:u.gridGap)||16},children:d.length===0?Array.from({length:r}).map((f,h)=>s.jsx(sn,{containerId:e.id,label:`Column ${h+1}`},h)):d.map(f=>s.jsx(Ya,{element:f,isSelected:n===f.id,isHovered:a===f.id,onSelect:()=>l(f.id),onHover:h=>i(h?f.id:null),onDelete:()=>c(f.id)},f.id))}),d.length>0&&d.length<r*3&&s.jsx("div",{className:"mt-3",children:s.jsx(sn,{containerId:e.id,label:"Add more elements"})})]})},lh=({element:e})=>{var p,u,f;const t=e.properties.label||"Repeat Group",r=e.properties.description,o=J(h=>h.schema.elements),n=J(h=>h.selectedElementId),a=J(h=>h.hoveredElementId),l=J(h=>h.selectElement),i=J(h=>h.setHoveredElementId),c=J(h=>h.deleteElement),d=o.filter(h=>h.parentId===e.id).sort((h,b)=>h.order-b.order);return s.jsxs("div",{className:"border border-gray-200 rounded-lg p-4",children:[s.jsxs("div",{className:"mb-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-lg",children:"🔄"}),s.jsx("h3",{className:"font-medium text-gray-800",children:t})]}),r&&s.jsx("p",{className:"text-sm text-gray-500",children:r})]}),s.jsxs("div",{className:"border border-dashed border-gray-300 rounded-lg p-3 bg-gray-50/50",children:[s.jsx("div",{className:"text-xs text-gray-500 mb-2 font-medium",children:"📋 Item Template (will repeat)"}),s.jsx(sn,{containerId:e.id,label:"Drop elements to create the repeatable template",isEmpty:d.length===0,children:d.map(h=>s.jsx(Ya,{element:h,isSelected:n===h.id,isHovered:a===h.id,onSelect:()=>l(h.id),onHover:b=>i(b?h.id:null),onDelete:()=>c(h.id)},h.id))})]}),s.jsx("div",{className:"mt-3",children:s.jsxs("button",{disabled:!0,className:"text-sm text-blue-600 hover:text-blue-700 flex items-center gap-1 opacity-70",children:["➕ ",((p=e.config)==null?void 0:p.addButtonText)||"Add Item"]})}),s.jsxs("div",{className:"mt-3 text-xs text-gray-500 bg-gray-100 rounded p-2",children:["ℹ️ Min: ",((u=e.config)==null?void 0:u.minItems)||1,", Max:"," ",((f=e.config)==null?void 0:f.maxItems)||10," items"]})]})},FE=({element:e})=>{var S,E,N,T;const t=J(k=>k.schema.elements),r=J(k=>k.selectedElementId),o=J(k=>k.hoveredElementId),n=J(k=>k.selectElement),a=J(k=>k.setHoveredElementId),l=J(k=>k.deleteElement),i=J(k=>k.addWizardStep),c=J(k=>k.updateWizardStep),d=J(k=>k.removeWizardStep),p=J(k=>k.setActiveWizardStep),u=((S=e.config)==null?void 0:S.steps)||[],f=((E=e.config)==null?void 0:E.activeStepId)||((N=u[0])==null?void 0:N.id),h=u.findIndex(k=>k.id===f),b=u[h],g=h===u.length-1,y=t.filter(k=>{var M;return k.parentId?k.parentId===`${e.id}:${f}`||k.parentId===e.id&&((M=k.config)==null?void 0:M.wizardStepId)===f:!1}).sort((k,M)=>k.order-M.order),x=()=>{const k={id:ra(),label:`Step ${u.length+1}`,description:""};i(e.id,k)},v=()=>{h>0&&p(e.id,u[h-1].id)},w=()=>{h<u.length-1&&p(e.id,u[h+1].id)};return s.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden",children:[s.jsxs("div",{className:"bg-gray-50 border-b border-gray-200 p-3",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[s.jsx("span",{className:"text-lg",children:"📑"}),s.jsx("h3",{className:"font-medium text-gray-800",children:e.properties.label||"Multi-Step Form"})]}),s.jsxs("div",{className:"flex gap-1 flex-wrap",children:[u.map((k,M)=>s.jsxs("button",{onClick:()=>p(e.id,k.id),className:`px-3 py-1.5 text-sm rounded transition-colors ${k.id===f?"bg-blue-500 text-white":"bg-white border border-gray-200 hover:bg-gray-100"}`,children:[M+1,". ",k.label]},k.id)),s.jsx("button",{onClick:x,className:"px-3 py-1.5 text-sm border border-dashed border-gray-300 rounded hover:bg-gray-100 text-gray-500",children:"+ Add Step"})]}),((T=e.config)==null?void 0:T.showProgressBar)&&s.jsxs("div",{className:"mt-3",children:[s.jsx("div",{className:"h-2 bg-gray-200 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-blue-500 transition-all",style:{width:`${(h+1)/u.length*100}%`}})}),s.jsxs("div",{className:"text-xs text-gray-500 mt-1",children:["Step ",h+1," of ",u.length]})]})]}),s.jsx("div",{className:"p-4",children:b&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"mb-4",children:[s.jsx("input",{type:"text",value:b.label,onChange:k=>c(e.id,f,{label:k.target.value}),className:"text-lg font-semibold text-gray-800 border-none bg-transparent w-full focus:outline-none focus:ring-0",placeholder:"Step title"}),s.jsx("input",{type:"text",value:b.description||"",onChange:k=>c(e.id,f,{description:k.target.value}),className:"text-sm text-gray-500 border-none bg-transparent w-full focus:outline-none focus:ring-0",placeholder:"Step description (optional)"})]}),s.jsx(sn,{containerId:e.id,stepId:f,label:"Drop elements for this step",isEmpty:y.length===0,children:y.map(k=>s.jsx(Ya,{element:k,isSelected:r===k.id,isHovered:o===k.id,onSelect:()=>n(k.id),onHover:M=>a(M?k.id:null),onDelete:()=>l(k.id)},k.id))}),s.jsxs("div",{className:"flex justify-between mt-4 pt-4 border-t border-gray-200",children:[s.jsx("button",{disabled:h===0,onClick:v,className:"px-4 py-2 text-sm border border-gray-300 rounded hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed",children:"← Previous"}),s.jsxs("div",{className:"flex gap-2",children:[u.length>1&&s.jsx("button",{onClick:()=>d(e.id,f),className:"px-3 py-2 text-sm text-red-600 hover:bg-red-50 rounded",children:"🗑️ Delete Step"}),s.jsx("button",{disabled:g,onClick:w,className:"px-4 py-2 text-sm bg-blue-500 text-white rounded hover:bg-blue-600 disabled:opacity-50 disabled:cursor-not-allowed",children:"Next →"})]})]})]})}),s.jsx("div",{className:"px-4 pb-4",children:s.jsxs("div",{className:"text-xs text-gray-500 bg-gray-50 rounded p-2",children:["ℹ️ This wizard has ",u.length," step(s). Click on step tabs to switch between them and add elements. The Submit button will only appear on the last step during form submission."]})})]})},GE=()=>s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground",children:[s.jsx("div",{className:"text-6xl mb-4",children:"📝"}),s.jsx("h3",{className:"text-lg font-medium text-foreground/70 mb-2",children:"Start Building Your Form"}),s.jsx("p",{className:"text-sm text-center max-w-md",children:"Drag elements from the left sidebar or click them to add to your form. Click on any element to configure its properties."})]}),VE=({toolbarConfig:e})=>{const t=J(L=>L.schema),r=J(L=>L.selectedElementId),o=J(L=>L.hoveredElementId),n=J(L=>L.addElement),a=J(L=>L.selectElement),l=J(L=>L.deleteElement),i=J(L=>L.duplicateElement),c=J(L=>L.reorderElements),d=J(L=>L.setHoveredElementId),p=J(L=>L.undo),u=J(L=>L.redo),f=J(L=>L.canUndo),h=J(L=>L.canRedo),b=J(L=>L.exportSchema),g=J(L=>L.loadSchema),y=J(L=>L.resetForm),x=J(L=>L.mode),v=J(L=>L.setMode),w=J(L=>L.hasWizard),[S,E]=C.useState(!1),[N,T]=C.useState(null),[k,M]=C.useState(null),D=w(),U=L=>{if(L.preventDefault(),D){L.dataTransfer.dropEffect="none";return}L.dataTransfer.dropEffect="copy",E(!0)},$=L=>{L.currentTarget.contains(L.relatedTarget)||E(!1)},F=L=>{if(L.preventDefault(),E(!1),D)return;const Y=L.dataTransfer.getData("elementType");Y&&n(Y)},q=()=>{const L=b(),Y=new Blob([JSON.stringify(L,null,2)],{type:"application/json"}),te=URL.createObjectURL(Y),fe=document.createElement("a");fe.href=te,fe.download=`${t.title.replace(/\s+/g,"-").toLowerCase()}-schema.json`,document.body.appendChild(fe),fe.click(),document.body.removeChild(fe),URL.revokeObjectURL(te)},R=L=>{g(L)},W=()=>{(t.elements.length===0||window.confirm("Are you sure you want to reset the form? This will delete all elements."))&&y()},Q=L=>{L.target===L.currentTarget&&a(null)},P=[...t.elements].filter(L=>!L.parentId).sort((L,Y)=>L.order-Y.order),z=L=>{T(L)},pe=L=>{N!==null&&N!==L&&M(L)},ge=()=>{N!==null&&k!==null&&N!==k&&c(N,k),T(null),M(null)};return s.jsxs("div",{className:"flex-1 flex flex-col bg-gray-100 overflow-hidden",children:[s.jsx($E,{schema:t,canUndo:f(),canRedo:h(),onUndo:p,onRedo:u,onExport:q,exportSchema:b,onImport:R,onReset:W,mode:x,onModeChange:v,toolbarConfig:e}),s.jsx("div",{className:`flex-1 overflow-auto p-4 ${S&&!D?"bg-blue-50":""}`,onDragOver:U,onDragLeave:$,onDrop:F,onClick:Q,children:s.jsxs("div",{className:"max-w-4xl mx-auto p-2",children:[s.jsx("div",{className:"mb-0 text-center",children:t.description&&s.jsx("p",{className:"text-gray-500",children:t.description})}),s.jsx("div",{className:`bg-white rounded-xl shadow-sm border-2 transition-colors ${S&&!D?"border-blue-400 border-dashed":"border-gray-200"}`,children:P.length===0?s.jsx("div",{className:"p-2",children:s.jsx(GE,{})}):s.jsx("div",{className:"p-4 space-y-2",children:P.map((L,Y)=>s.jsx(LE,{element:L,index:Y,isSelected:r===L.id,isHovered:o===L.id,onSelect:()=>a(L.id),onHover:te=>d(te?L.id:null),onDelete:()=>l(L.id),onDuplicate:()=>i(L.id),onDragStart:z,onDragOver:pe,onDragEnd:ge,isDragTarget:k===Y},L.id))})}),S&&!D&&s.jsx("div",{className:"mt-4 p-4 border-2 border-dashed border-blue-400 rounded-lg text-center text-blue-500 bg-blue-50/50",children:"Drop element here"}),D&&S&&s.jsx("div",{className:"mt-4 p-4 border-2 border-dashed border-orange-400 rounded-lg text-center text-orange-600 bg-orange-50/50",children:"⚠️ Drop elements inside wizard steps, not here"})]})})]})};var ih=Symbol.for("immer-nothing"),ch=Symbol.for("immer-draftable"),yt=Symbol.for("immer-state"),zE=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Mt(e,...t){if(process.env.NODE_ENV!=="production"){const r=zE[e],o=ro(r)?r.apply(null,t):r;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var It=Object,Mo=It.getPrototypeOf,qa="constructor",Qa="prototype",Vi="configurable",Ka="enumerable",Xa="writable",ln="value",Pr=e=>!!e&&!!e[yt];function mr(e){var t;return e?uh(e)||Ra(e)||!!e[ch]||!!((t=e[qa])!=null&&t[ch])||es(e)||ts(e):!1}var BE=It[Qa][qa].toString(),dh=new WeakMap;function uh(e){if(!e||!Bi(e))return!1;const t=Mo(e);if(t===null||t===It[Qa])return!0;const r=It.hasOwnProperty.call(t,qa)&&t[qa];if(r===Object)return!0;if(!ro(r))return!1;let o=dh.get(r);return o===void 0&&(o=Function.toString.call(r),dh.set(r,o)),o===BE}function Ja(e,t,r=!0){cn(e)===0?(r?Reflect.ownKeys(e):It.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((o,n)=>t(n,o,e))}function cn(e){const t=e[yt];return t?t.type_:Ra(e)?1:es(e)?2:ts(e)?3:0}var ph=(e,t,r=cn(e))=>r===2?e.has(t):It[Qa].hasOwnProperty.call(e,t),zi=(e,t,r=cn(e))=>r===2?e.get(t):e[t],Za=(e,t,r,o=cn(e))=>{o===2?e.set(t,r):o===3?e.add(r):e[t]=r};function UE(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ra=Array.isArray,es=e=>e instanceof Map,ts=e=>e instanceof Set,Bi=e=>typeof e=="object",ro=e=>typeof e=="function",Ui=e=>typeof e=="boolean";function WE(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var gr=e=>e.copy_||e.base_,Wi=e=>e.modified_?e.copy_:e.base_;function Hi(e,t){if(es(e))return new Map(e);if(ts(e))return new Set(e);if(Ra(e))return Array[Qa].slice.call(e);const r=uh(e);if(t===!0||t==="class_only"&&!r){const o=It.getOwnPropertyDescriptors(e);delete o[yt];let n=Reflect.ownKeys(o);for(let a=0;a<n.length;a++){const l=n[a],i=o[l];i[Xa]===!1&&(i[Xa]=!0,i[Vi]=!0),(i.get||i.set)&&(o[l]={[Vi]:!0,[Xa]:!0,[Ka]:i[Ka],[ln]:e[l]})}return It.create(Mo(e),o)}else{const o=Mo(e);if(o!==null&&r)return{...e};const n=It.create(o);return It.assign(n,e)}}function ji(e,t=!1){return os(e)||Pr(e)||!mr(e)||(cn(e)>1&&It.defineProperties(e,{set:rs,add:rs,clear:rs,delete:rs}),It.freeze(e),t&&Ja(e,(r,o)=>{ji(o,!0)},!1)),e}function HE(){Mt(2)}var rs={[ln]:HE};function os(e){return e===null||!Bi(e)?!0:It.isFrozen(e)}var ns="MapSet",Yi="Patches",fh="ArrayMethods",hh={};function oo(e){const t=hh[e];return t||Mt(0,e),t}var mh=e=>!!hh[e],dn,gh=()=>dn,jE=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:mh(ns)?oo(ns):void 0,arrayMethodsPlugin_:mh(fh)?oo(fh):void 0});function bh(e,t){t&&(e.patchPlugin_=oo(Yi),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function qi(e){Qi(e),e.drafts_.forEach(YE),e.drafts_=null}function Qi(e){e===dn&&(dn=e.parent_)}var yh=e=>dn=jE(dn,e);function YE(e){const t=e[yt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function vh(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[yt].modified_&&(qi(t),Mt(4)),mr(e)&&(e=xh(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[yt].base_,e,t)}else e=xh(t,r);return qE(t,e,!0),qi(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ih?e:void 0}function xh(e,t){if(os(t))return t;const r=t[yt];if(!r)return ss(t,e.handledSet_,e);if(!as(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:o}=r;if(o)for(;o.length>0;)o.pop()(e);Ch(r,e)}return r.copy_}function qE(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ji(t,r)}function wh(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var as=(e,t)=>e.scope_===t,QE=[];function Sh(e,t,r,o){const n=gr(e),a=e.type_;if(o!==void 0&&zi(n,o,a)===t){Za(n,o,r,a);return}if(!e.draftLocations_){const i=e.draftLocations_=new Map;Ja(n,(c,d)=>{if(Pr(d)){const p=i.get(d)||[];p.push(c),i.set(d,p)}})}const l=e.draftLocations_.get(t)??QE;for(const i of l)Za(n,i,r,a)}function KE(e,t,r){e.callbacks_.push(function(n){var i;const a=t;if(!a||!as(a,n))return;(i=n.mapSetPlugin_)==null||i.fixSetContents(a);const l=Wi(a);Sh(e,a.draft_??a,l,r),Ch(a,n)})}function Ch(e,t){var o;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((o=e.assigned_)==null?void 0:o.size)??0)>0)){const{patchPlugin_:n}=t;if(n){const a=n.getPath(e);a&&n.generatePatches_(e,a,t)}wh(e)}}function XE(e,t,r){const{scope_:o}=e;if(Pr(r)){const n=r[yt];as(n,o)&&n.callbacks_.push(function(){is(e);const l=Wi(n);Sh(e,r,l,t)})}else mr(r)&&e.callbacks_.push(function(){const a=gr(e);e.type_===3?a.has(r)&&ss(r,o.handledSet_,o):zi(a,t,e.type_)===r&&o.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&ss(zi(e.copy_,t,e.type_),o.handledSet_,o)})}function ss(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Pr(e)||t.has(e)||!mr(e)||os(e)||(t.add(e),Ja(e,(o,n)=>{if(Pr(n)){const a=n[yt];if(as(a,r)){const l=Wi(a);Za(e,o,l,e.type_),wh(a)}}else mr(n)&&ss(n,t,r)})),e}function JE(e,t){const r=Ra(e),o={type_:r?1:0,scope_:t?t.scope_:gh(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let n=o,a=ls;r&&(n=[o],a=un);const{revoke:l,proxy:i}=Proxy.revocable(n,a);return o.draft_=i,o.revoke_=l,[i,o]}var ls={get(e,t){if(t===yt)return e;let r=e.scope_.arrayMethodsPlugin_;const o=e.type_===1&&typeof t=="string";if(o&&r!=null&&r.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const n=gr(e);if(!ph(n,t,e.type_))return ZE(e,n,t);const a=n[t];if(e.finalized_||!mr(a)||o&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&WE(t))return a;if(a===Ki(e.base_,t)){is(e);const l=e.type_===1?+t:t,i=Ji(e.scope_,a,e,l);return e.copy_[l]=i}return a},has(e,t){return t in gr(e)},ownKeys(e){return Reflect.ownKeys(gr(e))},set(e,t,r){const o=Nh(gr(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const n=Ki(gr(e),t),a=n==null?void 0:n[yt];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(UE(r,n)&&(r!==void 0||ph(e.base_,t,e.type_)))return!0;is(e),Xi(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),XE(e,t,r)),!0},deleteProperty(e,t){return is(e),Ki(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Xi(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=gr(e),o=Reflect.getOwnPropertyDescriptor(r,t);return o&&{[Xa]:!0,[Vi]:e.type_!==1||t!=="length",[Ka]:o[Ka],[ln]:r[t]}},defineProperty(){Mt(11)},getPrototypeOf(e){return Mo(e.base_)},setPrototypeOf(){Mt(12)}},un={};for(let e in ls){let t=ls[e];un[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}un.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Mt(13),un.set.call(this,e,t,void 0)},un.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Mt(14),ls.set.call(this,e[0],t,r,e[0])};function Ki(e,t){const r=e[yt];return(r?gr(r):e)[t]}function ZE(e,t,r){var n;const o=Nh(t,r);return o?ln in o?o[ln]:(n=o.get)==null?void 0:n.call(e.draft_):void 0}function Nh(e,t){if(!(t in e))return;let r=Mo(e);for(;r;){const o=Object.getOwnPropertyDescriptor(r,t);if(o)return o;r=Mo(r)}}function Xi(e){e.modified_||(e.modified_=!0,e.parent_&&Xi(e.parent_))}function is(e){e.copy_||(e.assigned_=new Map,e.copy_=Hi(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var RE=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,o,n)=>{if(ro(r)&&!ro(o)){const l=o;o=r;const i=this;return function(d=l,...p){return i.produce(d,u=>o.call(this,u,...p))}}ro(o)||Mt(6),n!==void 0&&!ro(n)&&Mt(7);let a;if(mr(r)){const l=yh(this),i=Ji(l,r,void 0);let c=!0;try{a=o(i),c=!1}finally{c?qi(l):Qi(l)}return bh(l,n),vh(a,l)}else if(!r||!Bi(r)){if(a=o(r),a===void 0&&(a=r),a===ih&&(a=void 0),this.autoFreeze_&&ji(a,!0),n){const l=[],i=[];oo(Yi).generateReplacementPatches_(r,a,{patches_:l,inversePatches_:i}),n(l,i)}return a}else Mt(1,r)},this.produceWithPatches=(r,o)=>{if(ro(r))return(i,...c)=>this.produceWithPatches(i,d=>r(d,...c));let n,a;return[this.produce(r,o,(i,c)=>{n=i,a=c}),n,a]},Ui(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),Ui(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),Ui(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){mr(t)||Mt(8),Pr(t)&&(t=ek(t));const r=yh(this),o=Ji(r,t,void 0);return o[yt].isManual_=!0,Qi(r),o}finishDraft(t,r){const o=t&&t[yt];(!o||!o.isManual_)&&Mt(9);const{scope_:n}=o;return bh(n,r),vh(void 0,n)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let o;for(o=r.length-1;o>=0;o--){const a=r[o];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}o>-1&&(r=r.slice(o+1));const n=oo(Yi).applyPatches_;return Pr(t)?n(t,r):this.produce(t,a=>n(a,r))}};function Ji(e,t,r,o){const[n,a]=es(t)?oo(ns).proxyMap_(t,r):ts(t)?oo(ns).proxySet_(t,r):JE(t,r);return((r==null?void 0:r.scope_)??gh()).drafts_.push(n),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=o,r&&o!==void 0?KE(r,a,o):a.callbacks_.push(function(c){var p;(p=c.mapSetPlugin_)==null||p.fixSetContents(a);const{patchPlugin_:d}=c;a.modified_&&d&&d.generatePatches_(a,[],c)}),n}function ek(e){return Pr(e)||Mt(10,e),Eh(e)}function Eh(e){if(!mr(e)||os(e))return e;const t=e[yt];let r,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Hi(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else r=Hi(e,!0);return Ja(r,(n,a)=>{Za(r,n,Eh(a))},o),t&&(t.finalized_=!1),r}var tk=new RE,br=tk.produce,kh={"¼":"1/4","½":"1/2","¾":"3/4","⅐":"1/7","⅑":"1/9","⅒":"1/10","⅓":"1/3","⅔":"2/3","⅕":"1/5","⅖":"2/5","⅗":"3/5","⅘":"4/5","⅙":"1/6","⅚":"5/6","⅛":"1/8","⅜":"3/8","⅝":"5/8","⅞":"7/8","⅟":"1/"},Zi=/^(?=-?\s*\.\d|-?\s*\d)(-)?\s*((?:\d(?:[\d,_]*\d)?)*)(([eE][+-]?\d(?:[\d,_]*\d)?)?|\.\d(?:[\d,_]*\d)?([eE][+-]?\d(?:[\d,_]*\d)?)?|(\s+\d(?:[\d,_]*\d)?\s*)?\s*\/\s*\d(?:[\d,_]*\d)?)?$/,rk=new RegExp(Zi.source.replace(/\$$/,"(?:\\s*[^\\.\\d\\/].*)?")),ok=new RegExp(`(${Object.keys(kh).join("|")})`),cs={MMM:3e3,MM:2e3,M:1e3,CM:900,DCCC:800,DCC:700,DC:600,D:500,CD:400,CCC:300,CC:200,C:100,XC:90,LXXX:80,LXX:70,LX:60,L:50,XL:40,XXX:30,XX:20,XII:12,XI:11,X:10,IX:9,VIII:8,VII:7,VI:6,V:5,IV:4,III:3,II:2,I:1},_h={"Ⅰ":"I","Ⅱ":"II","Ⅲ":"III","Ⅳ":"IV","Ⅴ":"V","Ⅵ":"VI","Ⅶ":"VII","Ⅷ":"VIII","Ⅸ":"IX","Ⅹ":"X","Ⅺ":"XI","Ⅻ":"XII","Ⅼ":"L","Ⅽ":"C","Ⅾ":"D","Ⅿ":"M","ⅰ":"I","ⅱ":"II","ⅲ":"III","ⅳ":"IV","ⅴ":"V","ⅵ":"VI","ⅶ":"VII","ⅷ":"VIII","ⅸ":"IX","ⅹ":"X","ⅺ":"XI","ⅻ":"XII","ⅼ":"L","ⅽ":"C","ⅾ":"D","ⅿ":"M"},nk=new RegExp(`(${Object.keys(_h).join("|")})`,"gi"),ak=/^(?=[MDCLXVI])(M{0,3})(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$/i,Dh={round:3,allowTrailingInvalid:!1,romanNumerals:!1,bigIntOnOverflow:!1},sk=e=>{const t=`${e}`.replace(nk,(i,c)=>_h[c]).toUpperCase(),r=ak.exec(t);if(!r)return NaN;const[,o,n,a,l]=r;return(cs[o]??0)+(cs[n]??0)+(cs[a]??0)+(cs[l]??0)},lk=/^\s*\//;function ik(e,t=Dh){if(typeof e=="number"||typeof e=="bigint")return e;let r=NaN;const o=`${e}`.replace(ok,(f,h)=>` ${kh[h]}`).replace("⁄","/").trim();if(o.length===0)return NaN;const n={...Dh,...t},a=(n.allowTrailingInvalid?rk:Zi).exec(o);if(!a)return n.romanNumerals?sk(o):NaN;const[,l,i,c]=a,d=i.replace(/[,_]/g,""),p=c==null?void 0:c.replace(/[,_]/g,"");if(!d&&p&&p.startsWith("."))r=0;else{if(n.bigIntOnOverflow){const f=BigInt(l?`-${d}`:d);if(f>BigInt(Number.MAX_SAFE_INTEGER)||f<BigInt(Number.MIN_SAFE_INTEGER))return f}r=parseInt(d)}if(!p)return l?r*-1:r;const u=n.round===!1?NaN:parseFloat(`1e${Math.floor(Math.max(0,n.round))}`);if(p.startsWith(".")||p.startsWith("e")||p.startsWith("E")){const f=parseFloat(`${r}${p}`);r=isNaN(u)?f:Math.round(f*u)/u}else if(lk.test(p)){const f=parseInt(d),h=parseInt(p.replace("/",""));r=isNaN(u)?f/h:Math.round(f*u/h)/u}else{const f=p.split("/"),[h,b]=f.map(g=>parseInt(g));r+=isNaN(u)?h/b:Math.round(h*u/b)/u}return l?r*-1:r}const ds="~",Or="------",$e={fields:{title:"Field",placeholderName:ds,placeholderLabel:Or,placeholderGroupLabel:Or},operators:{title:"Operator",placeholderName:ds,placeholderLabel:Or,placeholderGroupLabel:Or},values:{title:"Values",placeholderName:ds,placeholderLabel:Or,placeholderGroupLabel:Or},matchMode:{title:"Match mode"},matchThreshold:{title:"Match threshold"},value:{title:"Value"},removeRule:{label:"⨯",title:"Remove rule"},removeGroup:{label:"⨯",title:"Remove group"},addRule:{label:"+ Rule",title:"Add rule"},addGroup:{label:"+ Group",title:"Add group"},combinators:{title:"Combinator"},notToggle:{label:"Not",title:"Invert this group"},cloneRule:{label:"⧉",title:"Clone rule"},cloneRuleGroup:{label:"⧉",title:"Clone group"},shiftActionUp:{label:"˄",title:"Shift up"},shiftActionDown:{label:"˅",title:"Shift down"},dragHandle:{label:"⁞⁞",title:"Drag handle"},lockRule:{label:"🔓",title:"Lock rule"},lockGroup:{label:"🔓",title:"Lock group"},lockRuleDisabled:{label:"🔒",title:"Unlock rule"},lockGroupDisabled:{label:"🔒",title:"Unlock group"},muteRule:{label:"🔊",title:"Mute rule"},muteGroup:{label:"🔊",title:"Mute group"},unmuteRule:{label:"🔇",title:"Unmute rule"},unmuteGroup:{label:"🔇",title:"Unmute group"},valueSourceSelector:{title:"Value source"}},Ri=",",Ah={"=":"=","!=":"!=","<":"<",">":">","<=":"<=",">=":">=",contains:"contains",beginsWith:"begins with",endsWith:"ends with",doesNotContain:"does not contain",doesNotBeginWith:"does not begin with",doesNotEndWith:"does not end with",null:"is null",notNull:"is not null",in:"in",notIn:"not in",between:"between",notBetween:"not between"},ck={and:"AND",or:"OR",xor:"XOR"},dk=[{name:"=",value:"=",label:"="},{name:"!=",value:"!=",label:"!="},{name:"<",value:"<",label:"<"},{name:">",value:">",label:">"},{name:"<=",value:"<=",label:"<="},{name:">=",value:">=",label:">="},{name:"contains",value:"contains",label:"contains"},{name:"beginsWith",value:"beginsWith",label:"begins with"},{name:"endsWith",value:"endsWith",label:"ends with"},{name:"doesNotContain",value:"doesNotContain",label:"does not contain"},{name:"doesNotBeginWith",value:"doesNotBeginWith",label:"does not begin with"},{name:"doesNotEndWith",value:"doesNotEndWith",label:"does not end with"},{name:"null",value:"null",label:"is null"},{name:"notNull",value:"notNull",label:"is not null"},{name:"in",value:"in",label:"in"},{name:"notIn",value:"notIn",label:"not in"},{name:"between",value:"between",label:"between"},{name:"notBetween",value:"notBetween",label:"not between"}],pn=[{name:"and",value:"and",label:"AND"},{name:"or",value:"or",label:"OR"}];[...pn];const Th=[{name:"all",value:"all",label:"all"},{name:"some",value:"some",label:"some"},{name:"none",value:"none",label:"none"},{name:"atLeast",value:"atLeast",label:"at least"},{name:"atMost",value:"atMost",label:"at most"},{name:"exactly",value:"exactly",label:"exactly"}],de={queryBuilder:"queryBuilder",ruleGroup:"ruleGroup",header:"ruleGroup-header",body:"ruleGroup-body",combinators:"ruleGroup-combinators",addRule:"ruleGroup-addRule",addGroup:"ruleGroup-addGroup",cloneRule:"rule-cloneRule",cloneGroup:"ruleGroup-cloneGroup",removeGroup:"ruleGroup-remove",notToggle:"ruleGroup-notToggle",rule:"rule",fields:"rule-fields",matchMode:"rule-matchMode",matchThreshold:"rule-matchThreshold",operators:"rule-operators",value:"rule-value",removeRule:"rule-remove",betweenRules:"betweenRules",valid:"queryBuilder-valid",invalid:"queryBuilder-invalid",shiftActions:"shiftActions",dndDragging:"dndDragging",dndOver:"dndOver",dndCopy:"dndCopy",dndGroup:"dndGroup",dndDropNotAllowed:"dndDropNotAllowed",dragHandle:"queryBuilder-dragHandle",disabled:"queryBuilder-disabled",muted:"queryBuilder-muted",lockRule:"rule-lock",lockGroup:"ruleGroup-lock",muteRule:"rule-mute",muteGroup:"ruleGroup-mute",valueSource:"rule-valueSource",valueListItem:"rule-value-list-item",hasSubQuery:"rule-hasSubQuery"},uk={queryBuilder:"",ruleGroup:"",header:"",body:"",combinators:"",addRule:"",addGroup:"",cloneRule:"",cloneGroup:"",removeGroup:"",notToggle:"",rule:"",fields:"",matchMode:"",matchThreshold:"",operators:"",value:"",removeRule:"",shiftActions:"",dragHandle:"",lockRule:"",lockGroup:"",muteRule:"",muteGroup:"",muted:"",valueSource:"",actionElement:"",valueSelector:"",betweenRules:"",valid:"",invalid:"",dndDragging:"",dndOver:"",dndGroup:"",dndCopy:"",dndDropNotAllowed:"",disabled:"",valueListItem:"",branches:"",hasSubQuery:"",loading:""},ue={rule:"rule",ruleGroup:"rule-group",inlineCombinator:"inline-combinator",addGroup:"add-group",removeGroup:"remove-group",cloneGroup:"clone-group",cloneRule:"clone-rule",addRule:"add-rule",removeRule:"remove-rule",combinators:"combinators",fields:"fields",operators:"operators",valueEditor:"value-editor",notToggle:"not-toggle",shiftActions:"shift-actions",dragHandle:"drag-handle",lockRule:"lock-rule",lockGroup:"lock-group",muteRule:"mute-rule",muteGroup:"mute-group",valueSourceSelector:"value-source-selector",matchModeEditor:"match-mode-editor"},tt={parentPathDisabled:"action aborted: parent path disabled",pathDisabled:"action aborted: path is disabled",onAddRuleFalse:"onAddRule callback returned false",onAddGroupFalse:"onAddGroup callback returned false",onGroupRuleFalse:"onGroupRule callback returned false",onGroupGroupFalse:"onGroupGroup callback returned false",onMoveRuleFalse:"onMoveRule callback returned false",onMoveGroupFalse:"onMoveGroup callback returned false",onRemoveFalse:"onRemove callback returned false",add:"rule or group added",remove:"rule or group removed",update:"rule or group updated",move:"rule or group moved",group:"rule or group grouped with another"},Mh=[],pk={addRuleToNewGroups:!1,autoSelectField:!0,autoSelectOperator:!0,autoSelectValue:!1,debugMode:!1,enableDragAndDrop:!1,enableMountQueryChange:!0,listsAsArrays:!1,resetOnFieldChange:!0,resetOnOperatorChange:!1,showCloneButtons:!1,showCombinatorsBetweenRules:!1,showLockButtons:!1,showMuteButtons:!1,showNotToggle:!1,showShiftActions:!1,suppressStandardClassnames:!1},fk=(e,t=Ri)=>typeof e=="string"?e.split(`\\${t}`).map(r=>r.split(t)).reduce((r,o,n)=>n===0?o:[...r.slice(0,-1),`${r.at(-1)}${t}${o[0]}`,...o.slice(1)],[]):[],ec=(e,t=Ri)=>e.map(r=>`${r??""}`.replaceAll(t[0],`\\${t[0]}`)).join(t),hk=e=>typeof e=="string"?e.trim():e,us=(e,{retainEmptyStrings:t}={})=>Array.isArray(e)?e.map(r=>hk(r)):typeof e=="string"?fk(e,Ri).filter(t?()=>!0:r=>!/^\s*$/.test(r)).map(r=>r.trim()):typeof e=="number"?[e]:[];function Ih(e){let t,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){const n=e.length;for(t=0;t<n;t++)e[t]&&(r=Ih(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function De(...e){let t=0,r,o,n="";const a=e.length;for(;t<a;t++)(r=e[t])&&(o=Ih(r))&&(n&&(n+=" "),n+=o);return n}const fn=e=>typeof e=="string"?e.toLowerCase():e;new RegExp(Zi.source.replace(/^\^/,String.raw`^\s*`).replace(/\$$/,String.raw`\s*$`));const $r=e=>e===null||typeof e!="object"?!1:Object.getPrototypeOf(e)===Object.prototype,Ge=e=>$r(e)&&Array.isArray(e.rules),hn=e=>Ge(e)&&typeof e.combinator=="string",mn=e=>Ge(e)&&e.combinator===void 0,mk=Object.keys,Ph=Object.entries,tc=e=>$r(e)&&"name"in e&&typeof e.name=="string",rc=e=>$r(e)&&"value"in e&&typeof e.value=="string";function lr(e,t,r){return br(o=>{const n={};let a=!!t;if(typeof o=="string")return{...t,name:o,value:o,label:(r==null?void 0:r[o])??o};if(tc(o)&&!rc(o)?(n.value=o.name,a=!0):!tc(o)&&rc(o)&&(n.name=o.value,a=!0),a)return Object.assign({},t,o,n)})(e)}function ps(e,t,r){return Array.isArray(e)?br(o=>{if(Lr(o))for(const n of o)for(const[a,l]of n.options.entries())n.options[a]=lr(l,t,r);else for(const[n,a]of o.entries())o[n]=lr(a,t,r)})(e):[]}function Oh(e,t){return Object.fromEntries(Object.entries(e).map(([r,o])=>[r,lr(o,t)]))}const $h=e=>{const t=new Set,r=[];for(const o of e)t.has(o.value??o.name)||(t.add(o.value??o.name),r.push(o));return e.length===r.length?e:r},gk=e=>Array.isArray(e)&&e.length>0&&$r(e[0])&&"options"in e[0]&&Array.isArray(e[0].options),fs=e=>{let t=!1;if(Array.isArray(e))for(const r of e)if(tc(r)||rc(r))t=!0;else return!1;return t},Lr=(e,{allowEmpty:t=!1}={})=>{let r=!1;if(Array.isArray(e))for(const o of e)if($r(o)&&"options"in o&&(fs(o.options)||t&&Array.isArray(o.options)&&o.options.length===0))r=!0;else return!1;return r};function Io(e,t){return(Lr(e,{allowEmpty:!0})?e.flatMap(r=>r.options):e).find(r=>r.value===t||r.name===t)}function ct(e){if(!Array.isArray(e)||e.length===0)return null;if(Lr(e,{allowEmpty:!0})){for(const t of e)if(t.options.length>0)return t.options[0].value??t.options[0].name;return null}return e[0].value??e[0].name}const Lh=e=>{const t=new Set,r=new Set,o=[];for(const n of e)if(!t.has(n.label)){t.add(n.label);const a=[];for(const l of n.options)r.has(l.value??l.name)||(r.add(l.value??l.name),a.push(lr(l)));o.push({...n,options:a})}return o},gn=e=>{const{optionList:t,baseOption:r={},labelMap:o={},placeholder:{placeholderName:n=ds,placeholderLabel:a=Or,placeholderGroupLabel:l=Or}={},autoSelectOption:i=!0}=e,c={id:n,name:n,value:n,label:a},d=t??[c];let p;const u=Array.isArray(d)?ps(d,r,o):mk(Oh(d,r)).map(h=>({...d[h],name:h,value:h})).sort((h,b)=>h.label.localeCompare(b.label));Lr(u)?p=Lh(i?u:[{label:l,options:[c]},...u]):p=$h(i?u:[c,...u]);let f={};if(Array.isArray(d))if(Lr(p))for(const h of p)for(const b of h.options)f[b.value??b.name]=lr(b,r);else for(const h of p)f[h.value??h.name]=lr(h,r);else{const h=Oh(d,r);f=i?h:{...h,[n]:c}}return{defaultOption:c,optionList:p,optionsMap:f}},Fh=(e,t,r)=>{var a;const o=lr(e),n=lr(r);return o.value===n.value?!1:typeof o.comparator=="string"?o[o.comparator]===n[o.comparator]:((a=o.comparator)==null?void 0:a.call(o,n,t))??!1},Gh=(e,t,r)=>{if(!e.comparator){const o=n=>(n.value??n.name)!==(e.value??e.name);return Lr(t)?t.map(n=>({...n,options:n.options.filter(a=>o(a))})):t.filter(n=>o(n))}return Lr(t)?t.map(o=>({...o,options:o.options.filter(n=>Fh(e,r,n))})).filter(o=>o.options.length>0):t.filter(o=>Fh(e,r,o))},hs=(e,{parseNumbers:t,bigIntOnOverflow:r}={})=>{if(!t||typeof e=="bigint"||typeof e=="number")return e;if(t==="native")return Number.parseFloat(e);const o=ik(e,{allowTrailingInvalid:t==="enhanced",bigIntOnOverflow:r,romanNumerals:!1,round:!1});return typeof o=="bigint"||!Number.isNaN(o)?o:e},bk=({parseNumbers:e,inputType:t})=>{if(typeof e=="string"){const[r,o]=e.split("-");return o==="limited"?t==="number"?r:!1:r}return e?"strict":!1},yk=e=>{const{mode:t,threshold:r}=e.match??{};if(!t)return null;if(!Ge(e.value))return!1;const o=fn(t),n=o==="atleast"&&r===1?"some":o==="atmost"&&r===0?"none":o;return(n==="atleast"||n==="atmost"||n==="exactly")&&(typeof r!="number"||r<0)?!1:{mode:n,threshold:r}},Xe=(e,t)=>{let r=t,o=0;for(;o<e.length&&r&&Ge(r);){const n=r.rules[e[o]];r=typeof n=="string"?null:n,o++}return o<e.length?null:r},Vh=(e,t)=>{if(t.id===e)return t;for(const r of t.rules)if(typeof r!="string"){if(r.id===e)return r;if(Ge(r)){const o=Vh(e,r);if(o)return o}}return null},Po=(e,t)=>{if(t.id===e)return[];const r=t.rules.findIndex(o=>typeof o!="string"&&o.id===e);if(r>=0)return[r];for(const[o,n]of Object.entries(t.rules))if(Ge(n)){const a=Po(e,n);if(Array.isArray(a))return[Number.parseInt(o),...a]}return null},qe=e=>e.slice(0,-1),no=(e,t)=>e.length===t.length&&e.every((r,o)=>r===t[o]),zh=(e,t)=>{const r=[],o=qe(e),n=qe(t);let a=0;for(;a<o.length&&a<n.length&&o[a]===n[a];)r.push(n[a]),a++;return r},Oo=(e,t)=>{let r=!!t.disabled,o=t,n=0;for(;n<e.length&&!r&&Ge(o);){const a=o.rules[e[n]];$r(a)&&(Ge(a)||"field"in a&&a.field)&&(r=!!a.disabled,o=a),n++}return r},vk=e=>no([],e.path)?"Query builder":`Rule group at path ${e.path.join("-")}`,bn=globalThis.crypto;let zt=()=>"00-0-4-2-000".replaceAll(/[^-]/g,e=>((Math.random()+Math.trunc(e))*65536>>Number.parseInt(e)).toString(16).padStart(4,"0"));if(bn){if(typeof bn.randomUUID=="function")zt=()=>bn.randomUUID();else if(typeof bn.getRandomValues=="function"){const e="89ab",t=new Uint32Array(32);zt=()=>{bn.getRandomValues(t);let r=(t[0]%16).toString(16);for(let o=1;o<32;o++)o===12?r=`${r}4`:o===16?r=`${r}${e[t[17]%4]}`:r=`${r}${(t[o]%16).toString(16)}`,(o===7||o===11||o===15||o===19)&&(r=`${r}-`);return r}}}const xk={name:"name",value:"name",matchModes:null,label:"label"},wk=(e,t)=>{const r=e?lr(e):xk;let o=r.matchModes??!1;return!o&&t&&(o=t(r.value,{fieldData:r})),o===!0?Th:o===!1?[]:fs(o)?ps(o):(o==null?void 0:o.map(n=>Th.find(a=>a.value===fn(n))??{name:n,value:n,label:n}))??[]},Bh=e=>{const t=typeof e=="boolean"?e:typeof e=="object"&&e!==null?e.valid:null;return typeof t=="boolean"?t?de.valid:de.invalid:""},Uh=[{name:"value",value:"value",label:"value"}],Sk={name:"name",value:"name",valueSources:null,label:"label"},Wh=(e,t,r)=>{const o=e?lr(e):Sk;let n=o.valueSources??!1;return typeof n=="function"&&(n=n(t)),!n&&r&&(n=r(o.value,t,{fieldData:o})),n?fs(n)?ps(n):n.map(a=>Uh.find(l=>l.value===fn(a))??{name:a,value:a,label:a}):Uh},Le=(e,t,r)=>{const o=Ph(t).map(([n,[a,l]])=>{var i;return[n,a??l??((i=r==null?void 0:r[e])==null?void 0:i[n])]}).filter(n=>!!n[1]);if(o.length>0||r){const n=(r==null?void 0:r[e])??{},a=Object.assign({},n,Object.fromEntries(o));return{[e]:a}}},ye=(e,t)=>De(t.map(r=>De(r==null?void 0:r[e]))),Ck=(...e)=>({queryBuilder:ye("queryBuilder",e),ruleGroup:ye("ruleGroup",e),header:ye("header",e),body:ye("body",e),combinators:ye("combinators",e),addRule:ye("addRule",e),addGroup:ye("addGroup",e),cloneRule:ye("cloneRule",e),cloneGroup:ye("cloneGroup",e),removeGroup:ye("removeGroup",e),rule:ye("rule",e),fields:ye("fields",e),operators:ye("operators",e),value:ye("value",e),removeRule:ye("removeRule",e),notToggle:ye("notToggle",e),shiftActions:ye("shiftActions",e),dragHandle:ye("dragHandle",e),lockRule:ye("lockRule",e),lockGroup:ye("lockGroup",e),muteRule:ye("muteRule",e),muteGroup:ye("muteGroup",e),muted:ye("muted",e),valueSource:ye("valueSource",e),actionElement:ye("actionElement",e),valueSelector:ye("valueSelector",e),betweenRules:ye("betweenRules",e),valid:ye("valid",e),invalid:ye("invalid",e),dndDragging:ye("dndDragging",e),dndOver:ye("dndOver",e),dndCopy:ye("dndCopy",e),dndGroup:ye("dndGroup",e),dndDropNotAllowed:ye("dndDropNotAllowed",e),disabled:ye("disabled",e),valueListItem:ye("valueListItem",e),matchMode:ye("matchMode",e),matchThreshold:ye("matchThreshold",e),branches:ye("branches",e),hasSubQuery:ye("hasSubQuery",e),loading:ye("loading",e)}),Nk=(e,t)=>e===!1?!1:e?!0:t!==!1,Ek=(e,t)=>e?!0:e===!1?!1:!!t,Hh=(e,t,r,o)=>o?t??r:e?Nk(t,r):Ek(t,r),kk=(e={},t={},r)=>Ph(pk).reduce((o,[n,a])=>(o[n]=Hh(a,e[n],t[n],!1),o),{}),jh=(e,{idGenerator:t=zt}={})=>br(e,r=>{r.id||(r.id=t()),yk(r)&&(r.value=ms(r.value,{idGenerator:t}))}),ms=(e,{idGenerator:t=zt}={})=>br(e,r=>{r.id||(r.id=t()),r.rules=r.rules.map(o=>typeof o=="string"?o:Ge(o)?ms(o,{idGenerator:t}):jh(o,{idGenerator:t}))}),Yh=(e,{idGenerator:t=zt}={})=>Ge(e)?ms(e,{idGenerator:t}):jh(e,{idGenerator:t}),_k=(e,{idGenerator:t=zt}={})=>structuredClone({...e,id:t()}),oc=(e,{idGenerator:t=zt}={})=>{if(!$r(e))return e;if(!Ge(e))return structuredClone({...e,id:t()});const r={...e,id:t()};return Array.isArray(r.rules)&&(r.rules=e.rules.map(o=>typeof o=="string"?o:Ge(o)?oc(o,{idGenerator:t}):_k(o,{idGenerator:t}))),r},qh=(e,t,r,{combinators:o=pn,combinatorPreceding:n,idGenerator:a=zt}={})=>br(e,l=>{const i=Array.isArray(r)?Xe(r,l):Vh(r,l);if(!(!i||!Ge(i))){if(mn(i)&&i.rules.length>0){const c=i.rules.at(-2);i.rules.push(n??(typeof c=="string"?c:ct(o)))}i.rules.push(Yh(t,{idGenerator:a}))}}),Dk=(e,t,r,o,{resetOnFieldChange:n=!0,resetOnOperatorChange:a=!1,getRuleDefaultOperator:l=()=>"=",getValueSources:i=()=>["value"],getRuleDefaultValue:c=()=>"",getMatchModes:d=()=>[]}={})=>br(e,p=>{var x;const u=Array.isArray(o)?o:Po(o,p);if(!u)return;if(t==="combinator"&&!hn(p)){const v=Xe(qe(u),p).rules;u.at(-1)%2===1&&(v[u.at(-1)]=r);return}const f=Xe(u,p);if(!f)return;const h=Ge(f);if(f[t]===r||(t!=="valueSource"&&(f[t]=r),h))return;let b=!1,g=!1;if(t==="field"){const v=d(f.field),w=d(r);if(w.length===0)delete f.match;else{const S=(x=f.match)!=null&&x.mode&&Io(w,f.match.mode)?null:ct(w);S&&(f.match={mode:S,threshold:1})}(v.length>0||w.length>0)&&(n=!0)}n&&t==="field"&&(f.operator=l(r),b=!0,g=!0),a&&t==="operator"&&(b=!0,g=!0);const y=ct(Wh({name:f.field,value:f.field,label:""},f.operator,i));(b&&f.valueSource&&y!==f.valueSource||t==="valueSource"&&r!==f.valueSource)&&(g=!!f.valueSource||!f.valueSource&&r!==y,f.valueSource=b?y:r),g&&(f.value=c(f))}),Ak=(e,t)=>{const r=Array.isArray(t)?t:Po(t,e);return!r||r.length===0||!hn(e)&&!Xe(r,e)?e:br(e,o=>{const n=r.at(-1),a=Xe(qe(r),o);if(a&&Ge(a))if(!hn(a)&&a.rules.length>1){const l=n===0?0:n-1;a.rules.splice(l,2)}else a.rules.splice(n,1)})},Qh=(e,t,r)=>{if(Array.isArray(r))return r;const o=mn(e);if(r==="up"){if(no(t,[0]))return t;if(t.at(-1)===0){const n=qe(t);return[...qe(n),Math.max(0,n.at(-1)-(o?1:0))]}else{const n=[...qe(t),Math.max(0,t.at(-1)-(o?2:1))],a=Xe(n,e);return Ge(a)?[...n,a.rules.length]:[...qe(t),Math.max(0,t.at(-1)-(o?3:1))]}}else if(r==="down"){if(no([e.rules.length-1],t))return t;if(t.at(-1)===Xe(qe(t),e).rules.length-1){const n=qe(t);return[...qe(n),n.at(-1)+1]}else{const n=[...qe(t),t.at(-1)+(o?2:1)];return Ge(Xe(n,e))?[...n,0]:[...qe(t),t.at(-1)+(o?3:2)]}}return t},Tk=(e,t,r,{clone:o=!1,combinators:n=pn,idGenerator:a=zt}={})=>{const l=Array.isArray(t)?t:Po(t,e);if(!l)return e;const i=Qh(e,l,r);if(l.length===0||no(l,i)||!Xe(qe(i),e))return e;const c=Xe(l,e);if(!c)return e;const d=o?oc(c,{idGenerator:a}):c;return br(e,p=>{const u=mn(p),f=Xe(qe(l),p),h=l.at(-1),b=u&&h>0?f.rules[h-1]:null,g=u&&h<f.rules.length-1?f.rules[h+1]:null;if(!o){const E=u?Math.max(0,h-1):h,N=u?2:1;f.rules.splice(E,N)}const y=[...i],x=zh(l,i);!o&&l.length===x.length+1&&i[x.length]>l[x.length]&&(y[x.length]-=u?2:1);const v=Xe(qe(y),p),w=y.at(-1),S=(...E)=>v.rules.splice(w,0,...E);v.rules.length===0||!u?S(d):w===0?h===0&&g?S(d,g):S(d,v.rules[1]??b??ct(n)):S(b||(v.rules[w-2]??g??ct(n)),d)})},Mk=(e,t,r,{clone:o=!1,combinators:n=pn,idGenerator:a=zt}={})=>{const l=Array.isArray(t)?t:Po(t,e),i=Array.isArray(r)?r:Po(r,e);if(!l||!i)return e;const c=Qh(e,l,i);if(l.length===0||no(l,c)||!Xe(qe(c),e))return e;const d=Xe(l,e),p=Xe(i,e);if(!d||!p)return e;const u=o?oc(d,{idGenerator:a}):d;return br(e,f=>{const h=mn(f),b=Xe(qe(l),f),g=l.at(-1);if(!o){const S=h?Math.max(0,g-1):g,E=h?2:1;b.rules.splice(S,E)}const y=[...c],x=zh(l,c);!o&&l.length===x.length+1&&c[x.length]>l[x.length]&&(y[x.length]-=h?2:1);const v=Xe(qe(y),f),w=y.at(-1);v.rules.splice(w,1,Yh(h?{rules:[p,ct(n),u]}:{combinator:ct(n),rules:[p,u]},{idGenerator:a}))})};function dt(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Ik=typeof Symbol=="function"&&Symbol.observable||"@@observable",Kh=Ik,nc=()=>Math.random().toString(36).substring(7).split("").join("."),Pk={INIT:`@@redux/INIT${nc()}`,REPLACE:`@@redux/REPLACE${nc()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${nc()}`},ao=Pk;function yn(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function Ok(e){if(e===void 0)return"undefined";if(e===null)return"null";const t=typeof e;switch(t){case"boolean":case"string":case"number":case"symbol":case"function":return t}if(Array.isArray(e))return"array";if(Fk(e))return"date";if(Lk(e))return"error";const r=$k(e);switch(r){case"Symbol":case"Promise":case"WeakMap":case"WeakSet":case"Map":case"Set":return r}return Object.prototype.toString.call(e).slice(8,-1).toLowerCase().replace(/\s/g,"")}function $k(e){return typeof e.constructor=="function"?e.constructor.name:null}function Lk(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Fk(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Fr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=Ok(e)),t}function Xh(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?dt(2):`Expected the root reducer to be a function. Instead, received: '${Fr(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?dt(0):"It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.");if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(process.env.NODE_ENV==="production"?dt(1):`Expected the enhancer to be a function. Instead, received: '${Fr(r)}'`);return r(Xh)(e,t)}let o=e,n=t,a=new Map,l=a,i=0,c=!1;function d(){l===a&&(l=new Map,a.forEach((y,x)=>{l.set(x,y)}))}function p(){if(c)throw new Error(process.env.NODE_ENV==="production"?dt(3):"You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return n}function u(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?dt(4):`Expected the listener to be a function. Instead, received: '${Fr(y)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?dt(5):"You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api/store#subscribelistener for more details.");let x=!0;d();const v=i++;return l.set(v,y),function(){if(x){if(c)throw new Error(process.env.NODE_ENV==="production"?dt(6):"You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api/store#subscribelistener for more details.");x=!1,d(),l.delete(v),a=null}}}function f(y){if(!yn(y))throw new Error(process.env.NODE_ENV==="production"?dt(7):`Actions must be plain objects. Instead, the actual type was: '${Fr(y)}'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples.`);if(typeof y.type>"u")throw new Error(process.env.NODE_ENV==="production"?dt(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof y.type!="string")throw new Error(process.env.NODE_ENV==="production"?dt(17):`Action "type" property must be a string. Instead, the actual type was: '${Fr(y.type)}'. Value was: '${y.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?dt(9):"Reducers may not dispatch actions.");try{c=!0,n=o(n,y)}finally{c=!1}return(a=l).forEach(v=>{v()}),y}function h(y){if(typeof y!="function")throw new Error(process.env.NODE_ENV==="production"?dt(10):`Expected the nextReducer to be a function. Instead, received: '${Fr(y)}`);o=y,f({type:ao.REPLACE})}function b(){const y=u;return{subscribe(x){if(typeof x!="object"||x===null)throw new Error(process.env.NODE_ENV==="production"?dt(11):`Expected the observer to be an object. Instead, received: '${Fr(x)}'`);function v(){const S=x;S.next&&S.next(p())}return v(),{unsubscribe:y(v)}},[Kh](){return this}}}return f({type:ao.INIT}),{dispatch:f,subscribe:u,getState:p,replaceReducer:h,[Kh]:b}}function Jh(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function Gk(e,t,r,o){const n=Object.keys(t),a=r&&r.type===ao.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(n.length===0)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!yn(e))return`The ${a} has unexpected type of "${Fr(e)}". Expected argument to be an object with the following keys: "${n.join('", "')}"`;const l=Object.keys(e).filter(i=>!t.hasOwnProperty(i)&&!o[i]);if(l.forEach(i=>{o[i]=!0}),!(r&&r.type===ao.REPLACE)&&l.length>0)return`Unexpected ${l.length>1?"keys":"key"} "${l.join('", "')}" found in ${a}. Expected to find one of the known reducer keys instead: "${n.join('", "')}". Unexpected keys will be ignored.`}function Vk(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:ao.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?dt(12):`The slice reducer for key "${t}" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);if(typeof r(void 0,{type:ao.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?dt(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${ao.INIT}' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.`)})}function Zh(e){const t=Object.keys(e),r={};for(let l=0;l<t.length;l++){const i=t[l];process.env.NODE_ENV!=="production"&&typeof e[i]>"u"&&Jh(`No reducer provided for key "${i}"`),typeof e[i]=="function"&&(r[i]=e[i])}const o=Object.keys(r);let n;process.env.NODE_ENV!=="production"&&(n={});let a;try{Vk(r)}catch(l){a=l}return function(i={},c){if(a)throw a;if(process.env.NODE_ENV!=="production"){const u=Gk(i,r,c,n);u&&Jh(u)}let d=!1;const p={};for(let u=0;u<o.length;u++){const f=o[u],h=r[f],b=i[f],g=h(b,c);if(typeof g>"u"){const y=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?dt(14):`When called with an action of type ${y?`"${String(y)}"`:"(unknown type)"}, the slice reducer for key "${f}" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.`)}p[f]=g,d=d||g!==b}return d=d||o.length!==Object.keys(i).length,d?p:i}}function gs(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...o)=>t(r(...o)))}function zk(...e){return t=>(r,o)=>{const n=t(r,o);let a=()=>{throw new Error(process.env.NODE_ENV==="production"?dt(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const l={getState:n.getState,dispatch:(c,...d)=>a(c,...d)},i=e.map(c=>c(l));return a=gs(...i)(n.dispatch),{...n,dispatch:a}}}function Rh(e){return yn(e)&&"type"in e&&typeof e.type=="string"}var em=Symbol.for("immer-nothing"),tm=Symbol.for("immer-draftable"),vt=Symbol.for("immer-state"),Bk=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Pt(e,...t){if(process.env.NODE_ENV!=="production"){const r=Bk[e],o=so(r)?r.apply(null,t):r;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ot=Object,$o=Ot.getPrototypeOf,bs="constructor",ys="prototype",ac="configurable",vs="enumerable",xs="writable",vn="value",yr=e=>!!e&&!!e[vt];function qt(e){var t;return e?om(e)||Cs(e)||!!e[tm]||!!((t=e[bs])!=null&&t[tm])||Ns(e)||Es(e):!1}var Uk=Ot[ys][bs].toString(),rm=new WeakMap;function om(e){if(!e||!lc(e))return!1;const t=$o(e);if(t===null||t===Ot[ys])return!0;const r=Ot.hasOwnProperty.call(t,bs)&&t[bs];if(r===Object)return!0;if(!so(r))return!1;let o=rm.get(r);return o===void 0&&(o=Function.toString.call(r),rm.set(r,o)),o===Uk}function ws(e,t,r=!0){xn(e)===0?(r?Reflect.ownKeys(e):Ot.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((o,n)=>t(n,o,e))}function xn(e){const t=e[vt];return t?t.type_:Cs(e)?1:Ns(e)?2:Es(e)?3:0}var nm=(e,t,r=xn(e))=>r===2?e.has(t):Ot[ys].hasOwnProperty.call(e,t),sc=(e,t,r=xn(e))=>r===2?e.get(t):e[t],Ss=(e,t,r,o=xn(e))=>{o===2?e.set(t,r):o===3?e.add(r):e[t]=r};function Wk(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Cs=Array.isArray,Ns=e=>e instanceof Map,Es=e=>e instanceof Set,lc=e=>typeof e=="object",so=e=>typeof e=="function",ic=e=>typeof e=="boolean";function Hk(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var vr=e=>e.copy_||e.base_,cc=e=>e.modified_?e.copy_:e.base_;function dc(e,t){if(Ns(e))return new Map(e);if(Es(e))return new Set(e);if(Cs(e))return Array[ys].slice.call(e);const r=om(e);if(t===!0||t==="class_only"&&!r){const o=Ot.getOwnPropertyDescriptors(e);delete o[vt];let n=Reflect.ownKeys(o);for(let a=0;a<n.length;a++){const l=n[a],i=o[l];i[xs]===!1&&(i[xs]=!0,i[ac]=!0),(i.get||i.set)&&(o[l]={[ac]:!0,[xs]:!0,[vs]:i[vs],[vn]:e[l]})}return Ot.create($o(e),o)}else{const o=$o(e);if(o!==null&&r)return{...e};const n=Ot.create(o);return Ot.assign(n,e)}}function uc(e,t=!1){return _s(e)||yr(e)||!qt(e)||(xn(e)>1&&Ot.defineProperties(e,{set:ks,add:ks,clear:ks,delete:ks}),Ot.freeze(e),t&&ws(e,(r,o)=>{uc(o,!0)},!1)),e}function jk(){Pt(2)}var ks={[vn]:jk};function _s(e){return e===null||!lc(e)?!0:Ot.isFrozen(e)}var Ds="MapSet",pc="Patches",am="ArrayMethods",sm={};function lo(e){const t=sm[e];return t||Pt(0,e),t}var lm=e=>!!sm[e],wn,im=()=>wn,Yk=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:lm(Ds)?lo(Ds):void 0,arrayMethodsPlugin_:lm(am)?lo(am):void 0});function cm(e,t){t&&(e.patchPlugin_=lo(pc),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fc(e){hc(e),e.drafts_.forEach(qk),e.drafts_=null}function hc(e){e===wn&&(wn=e.parent_)}var dm=e=>wn=Yk(wn,e);function qk(e){const t=e[vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function um(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[vt].modified_&&(fc(t),Pt(4)),qt(e)&&(e=pm(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[vt].base_,e,t)}else e=pm(t,r);return Qk(t,e,!0),fc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==em?e:void 0}function pm(e,t){if(_s(t))return t;const r=t[vt];if(!r)return Ts(t,e.handledSet_,e);if(!As(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:o}=r;if(o)for(;o.length>0;)o.pop()(e);mm(r,e)}return r.copy_}function Qk(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&uc(t,r)}function fm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var As=(e,t)=>e.scope_===t,Kk=[];function hm(e,t,r,o){const n=vr(e),a=e.type_;if(o!==void 0&&sc(n,o,a)===t){Ss(n,o,r,a);return}if(!e.draftLocations_){const i=e.draftLocations_=new Map;ws(n,(c,d)=>{if(yr(d)){const p=i.get(d)||[];p.push(c),i.set(d,p)}})}const l=e.draftLocations_.get(t)??Kk;for(const i of l)Ss(n,i,r,a)}function Xk(e,t,r){e.callbacks_.push(function(n){var i;const a=t;if(!a||!As(a,n))return;(i=n.mapSetPlugin_)==null||i.fixSetContents(a);const l=cc(a);hm(e,a.draft_??a,l,r),mm(a,n)})}function mm(e,t){var o;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((o=e.assigned_)==null?void 0:o.size)??0)>0)){const{patchPlugin_:n}=t;if(n){const a=n.getPath(e);a&&n.generatePatches_(e,a,t)}fm(e)}}function Jk(e,t,r){const{scope_:o}=e;if(yr(r)){const n=r[vt];As(n,o)&&n.callbacks_.push(function(){Is(e);const l=cc(n);hm(e,r,l,t)})}else qt(r)&&e.callbacks_.push(function(){const a=vr(e);e.type_===3?a.has(r)&&Ts(r,o.handledSet_,o):sc(a,t,e.type_)===r&&o.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ts(sc(e.copy_,t,e.type_),o.handledSet_,o)})}function Ts(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||yr(e)||t.has(e)||!qt(e)||_s(e)||(t.add(e),ws(e,(o,n)=>{if(yr(n)){const a=n[vt];if(As(a,r)){const l=cc(a);Ss(e,o,l,e.type_),fm(a)}}else qt(n)&&Ts(n,t,r)})),e}function Zk(e,t){const r=Cs(e),o={type_:r?1:0,scope_:t?t.scope_:im(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let n=o,a=Ms;r&&(n=[o],a=Sn);const{revoke:l,proxy:i}=Proxy.revocable(n,a);return o.draft_=i,o.revoke_=l,[i,o]}var Ms={get(e,t){if(t===vt)return e;let r=e.scope_.arrayMethodsPlugin_;const o=e.type_===1&&typeof t=="string";if(o&&r!=null&&r.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const n=vr(e);if(!nm(n,t,e.type_))return Rk(e,n,t);const a=n[t];if(e.finalized_||!qt(a)||o&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&Hk(t))return a;if(a===mc(e.base_,t)){Is(e);const l=e.type_===1?+t:t,i=bc(e.scope_,a,e,l);return e.copy_[l]=i}return a},has(e,t){return t in vr(e)},ownKeys(e){return Reflect.ownKeys(vr(e))},set(e,t,r){const o=gm(vr(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const n=mc(vr(e),t),a=n==null?void 0:n[vt];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Wk(r,n)&&(r!==void 0||nm(e.base_,t,e.type_)))return!0;Is(e),gc(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),Jk(e,t,r)),!0},deleteProperty(e,t){return Is(e),mc(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),gc(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=vr(e),o=Reflect.getOwnPropertyDescriptor(r,t);return o&&{[xs]:!0,[ac]:e.type_!==1||t!=="length",[vs]:o[vs],[vn]:r[t]}},defineProperty(){Pt(11)},getPrototypeOf(e){return $o(e.base_)},setPrototypeOf(){Pt(12)}},Sn={};for(let e in Ms){let t=Ms[e];Sn[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Sn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Pt(13),Sn.set.call(this,e,t,void 0)},Sn.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Pt(14),Ms.set.call(this,e[0],t,r,e[0])};function mc(e,t){const r=e[vt];return(r?vr(r):e)[t]}function Rk(e,t,r){var n;const o=gm(t,r);return o?vn in o?o[vn]:(n=o.get)==null?void 0:n.call(e.draft_):void 0}function gm(e,t){if(!(t in e))return;let r=$o(e);for(;r;){const o=Object.getOwnPropertyDescriptor(r,t);if(o)return o;r=$o(r)}}function gc(e){e.modified_||(e.modified_=!0,e.parent_&&gc(e.parent_))}function Is(e){e.copy_||(e.assigned_=new Map,e.copy_=dc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var e1=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,o,n)=>{if(so(r)&&!so(o)){const l=o;o=r;const i=this;return function(d=l,...p){return i.produce(d,u=>o.call(this,u,...p))}}so(o)||Pt(6),n!==void 0&&!so(n)&&Pt(7);let a;if(qt(r)){const l=dm(this),i=bc(l,r,void 0);let c=!0;try{a=o(i),c=!1}finally{c?fc(l):hc(l)}return cm(l,n),um(a,l)}else if(!r||!lc(r)){if(a=o(r),a===void 0&&(a=r),a===em&&(a=void 0),this.autoFreeze_&&uc(a,!0),n){const l=[],i=[];lo(pc).generateReplacementPatches_(r,a,{patches_:l,inversePatches_:i}),n(l,i)}return a}else Pt(1,r)},this.produceWithPatches=(r,o)=>{if(so(r))return(i,...c)=>this.produceWithPatches(i,d=>r(d,...c));let n,a;return[this.produce(r,o,(i,c)=>{n=i,a=c}),n,a]},ic(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),ic(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),ic(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){qt(t)||Pt(8),yr(t)&&(t=t1(t));const r=dm(this),o=bc(r,t,void 0);return o[vt].isManual_=!0,hc(r),o}finishDraft(t,r){const o=t&&t[vt];(!o||!o.isManual_)&&Pt(9);const{scope_:n}=o;return cm(n,r),um(void 0,n)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let o;for(o=r.length-1;o>=0;o--){const a=r[o];if(a.path.length===0&&a.op==="replace"){t=a.value;break}}o>-1&&(r=r.slice(o+1));const n=lo(pc).applyPatches_;return yr(t)?n(t,r):this.produce(t,a=>n(a,r))}};function bc(e,t,r,o){const[n,a]=Ns(t)?lo(Ds).proxyMap_(t,r):Es(t)?lo(Ds).proxySet_(t,r):Zk(t,r);return((r==null?void 0:r.scope_)??im()).drafts_.push(n),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=o,r&&o!==void 0?Xk(r,a,o):a.callbacks_.push(function(c){var p;(p=c.mapSetPlugin_)==null||p.fixSetContents(a);const{patchPlugin_:d}=c;a.modified_&&d&&d.generatePatches_(a,[],c)}),n}function t1(e){return yr(e)||Pt(10,e),bm(e)}function bm(e){if(!qt(e)||_s(e))return e;const t=e[vt];let r,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=dc(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else r=dc(e,!0);return ws(r,(n,a)=>{Ss(r,n,bm(a))},o),t&&(t.finalized_=!1),r}var r1=new e1,ym=r1.produce,o1=(e,t,r)=>{if(t.length===1&&t[0]===r){let o=!1;try{const n={};e(n)===n&&(o=!0)}catch{}if(o){let n;try{throw new Error}catch(a){({stack:n}=a)}console.warn(`The result function returned its own inputs without modification. e.g
177
+ \`createSelector([state => state.todos], todos => todos)\`
178
+ This could lead to inefficient memoization and unnecessary re-renders.
179
+ Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,{stack:n})}}},n1=(e,t,r)=>{const{memoize:o,memoizeOptions:n}=t,{inputSelectorResults:a,inputSelectorResultsCopy:l}=e,i=o(()=>({}),...n);if(!(i.apply(null,a)===i.apply(null,l))){let d;try{throw new Error}catch(p){({stack:d}=p)}console.warn(`An input selector returned a different result when passed same arguments.
180
+ This means your output selector will likely run more frequently than intended.
181
+ Avoid returning a new reference inside your input selector, e.g.
182
+ \`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,{arguments:r,firstInputs:a,secondInputs:l,stack:d})}},a1={inputStabilityCheck:"once",identityFunctionCheck:"once"};function s1(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function l1(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function i1(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(o=>typeof o=="function"?`function ${o.name||"unnamed"}()`:typeof o).join(", ");throw new TypeError(`${t}[${r}]`)}}var vm=e=>Array.isArray(e)?e:[e];function c1(e){const t=Array.isArray(e[0])?e[0]:e;return i1(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function xm(e,t){const r=[],{length:o}=e;for(let n=0;n<o;n++)r.push(e[n].apply(null,t));return r}var d1=(e,t)=>{const{identityFunctionCheck:r,inputStabilityCheck:o}={...a1,...t};return{identityFunctionCheck:{shouldRun:r==="always"||r==="once"&&e,run:o1},inputStabilityCheck:{shouldRun:o==="always"||o==="once"&&e,run:n1}}},u1=class{constructor(e){this.value=e}deref(){return this.value}},p1=typeof WeakRef<"u"?WeakRef:u1,f1=0,wm=1;function Ps(){return{s:f1,v:void 0,o:null,p:null}}function Sm(e,t={}){let r=Ps();const{resultEqualityCheck:o}=t;let n,a=0;function l(){var u;let i=r;const{length:c}=arguments;for(let f=0,h=c;f<h;f++){const b=arguments[f];if(typeof b=="function"||typeof b=="object"&&b!==null){let g=i.o;g===null&&(i.o=g=new WeakMap);const y=g.get(b);y===void 0?(i=Ps(),g.set(b,i)):i=y}else{let g=i.p;g===null&&(i.p=g=new Map);const y=g.get(b);y===void 0?(i=Ps(),g.set(b,i)):i=y}}const d=i;let p;if(i.s===wm)p=i.v;else if(p=e.apply(null,arguments),a++,o){const f=((u=n==null?void 0:n.deref)==null?void 0:u.call(n))??n;f!=null&&o(f,p)&&(p=f,a!==0&&a--),n=typeof p=="object"&&p!==null||typeof p=="function"?new p1(p):p}return d.s=wm,d.v=p,p}return l.clearCache=()=>{r=Ps(),l.resetResultsCount()},l.resultsCount=()=>a,l.resetResultsCount=()=>{a=0},l}function h1(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,o=(...n)=>{let a=0,l=0,i,c={},d=n.pop();typeof d=="object"&&(c=d,d=n.pop()),s1(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const p={...r,...c},{memoize:u,memoizeOptions:f=[],argsMemoize:h=Sm,argsMemoizeOptions:b=[],devModeChecks:g={}}=p,y=vm(f),x=vm(b),v=c1(n),w=u(function(){return a++,d.apply(null,arguments)},...y);let S=!0;const E=h(function(){l++;const T=xm(v,arguments);if(i=w.apply(null,T),process.env.NODE_ENV!=="production"){const{identityFunctionCheck:k,inputStabilityCheck:M}=d1(S,g);if(k.shouldRun&&k.run(d,T,i),M.shouldRun){const D=xm(v,arguments);M.run({inputSelectorResults:T,inputSelectorResultsCopy:D},{memoize:u,memoizeOptions:y},arguments)}S&&(S=!1)}return i},...x);return Object.assign(E,{resultFunc:d,memoizedResultFunc:w,dependencies:v,dependencyRecomputations:()=>l,resetDependencyRecomputations:()=>{l=0},lastResult:()=>i,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:u,argsMemoize:h})};return Object.assign(o,{withTypes:()=>o}),o}var m1=h1(Sm),g1=Object.assign((e,t=m1)=>{l1(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),o=r.map(a=>e[a]);return t(o,(...a)=>a.reduce((l,i,c)=>(l[r[c]]=i,l),{}))},{withTypes:()=>g1});function Cm(e){return({dispatch:r,getState:o})=>n=>a=>typeof a=="function"?a(r,o,e):n(a)}var b1=Cm(),y1=Cm,v1=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?gs:gs.apply(null,arguments)},x1=e=>e&&typeof e.match=="function";function Nm(e,t){function r(...o){if(t){let n=t(...o);if(!n)throw new Error(process.env.NODE_ENV==="production"?Pe(0):"prepareAction did not return an object");return{type:e,payload:n.payload,..."meta"in n&&{meta:n.meta},..."error"in n&&{error:n.error}}}return{type:e,payload:o[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=o=>Rh(o)&&o.type===e,r}function w1(e){return typeof e=="function"&&"type"in e&&x1(e)}function S1(e){const t=e?`${e}`.split("/"):[],r=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched.
183
+ Make sure you're calling the action creator before dispatching, i.e. \`dispatch(${r}())\` instead of \`dispatch(${r})\`. This is necessary even if the action has no payload.`}function C1(e={}){if(process.env.NODE_ENV==="production")return()=>r=>o=>r(o);const{isActionCreator:t=w1}=e;return()=>r=>o=>(t(o)&&console.warn(S1(o.type)),r(o))}function Em(e,t){let r=0;return{measureTime(o){const n=Date.now();try{return o()}finally{const a=Date.now();r+=a-n}},warnIfExceeded(){r>e&&console.warn(`${t} took ${r}ms, which is more than the warning threshold of ${e}ms.
184
+ If your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.
185
+ It is disabled in production builds, so you don't need to worry about that.`)}}}var km=class qn extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,qn.prototype)}static get[Symbol.species](){return qn}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new qn(...t[0].concat(this)):new qn(...t.concat(this))}};function _m(e){return qt(e)?ym(e,()=>{}):e}function Cn(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function N1(e){return typeof e!="object"||e==null||Object.isFrozen(e)}function E1(e,t,r){const o=Dm(e,t,r);return{detectMutations(){return Am(e,t,o,r)}}}function Dm(e,t=[],r,o="",n=new Set){const a={value:r};if(!e(r)&&!n.has(r)){n.add(r),a.children={};const l=t.length>0;for(const i in r){const c=o?o+"."+i:i;l&&t.some(p=>p instanceof RegExp?p.test(c):c===p)||(a.children[i]=Dm(e,t,r[i],c))}}return a}function Am(e,t=[],r,o,n=!1,a=""){const l=r?r.value:void 0,i=l===o;if(n&&!i&&!Number.isNaN(o))return{wasMutated:!0,path:a};if(e(l)||e(o))return{wasMutated:!1};const c={};for(let p in r.children)c[p]=!0;for(let p in o)c[p]=!0;const d=t.length>0;for(let p in c){const u=a?a+"."+p:p;if(d&&t.some(b=>b instanceof RegExp?b.test(u):u===b))continue;const f=Am(e,t,r.children[p],o[p],i,u);if(f.wasMutated)return f}return{wasMutated:!1}}function k1(e={}){if(process.env.NODE_ENV==="production")return()=>t=>r=>t(r);{let t=function(i,c,d,p){return JSON.stringify(i,r(c,p),d)},r=function(i,c){let d=[],p=[];return c||(c=function(u,f){return d[0]===f?"[Circular ~]":"[Circular ~."+p.slice(0,d.indexOf(f)).join(".")+"]"}),function(u,f){if(d.length>0){var h=d.indexOf(this);~h?d.splice(h+1):d.push(this),~h?p.splice(h,1/0,u):p.push(u),~d.indexOf(f)&&(f=c.call(this,u,f))}else d.push(f);return i==null?f:i.call(this,u,f)}},{isImmutable:o=N1,ignoredPaths:n,warnAfter:a=32}=e;const l=E1.bind(null,o,n);return({getState:i})=>{let c=i(),d=l(c),p;return u=>f=>{const h=Em(a,"ImmutableStateInvariantMiddleware");h.measureTime(()=>{if(c=i(),p=d.detectMutations(),d=l(c),p.wasMutated)throw new Error(process.env.NODE_ENV==="production"?Pe(19):`A state mutation was detected between dispatches, in the path '${p.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)});const b=u(f);return h.measureTime(()=>{if(c=i(),p=d.detectMutations(),d=l(c),p.wasMutated)throw new Error(process.env.NODE_ENV==="production"?Pe(20):`A state mutation was detected inside a dispatch, in the path: ${p.path||""}. Take a look at the reducer(s) handling the action ${t(f)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}),h.warnIfExceeded(),b}}}}function Tm(e){const t=typeof e;return e==null||t==="string"||t==="boolean"||t==="number"||Array.isArray(e)||yn(e)}function yc(e,t="",r=Tm,o,n=[],a){let l;if(!r(e))return{keyPath:t||"<root>",value:e};if(typeof e!="object"||e===null||a!=null&&a.has(e))return!1;const i=o!=null?o(e):Object.entries(e),c=n.length>0;for(const[d,p]of i){const u=t?t+"."+d:d;if(!(c&&n.some(h=>h instanceof RegExp?h.test(u):u===h))){if(!r(p))return{keyPath:u,value:p};if(typeof p=="object"&&(l=yc(p,u,r,o,n,a),l))return l}}return a&&Mm(e)&&a.add(e),!1}function Mm(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if(!(typeof t!="object"||t===null)&&!Mm(t))return!1;return!0}function _1(e={}){if(process.env.NODE_ENV==="production")return()=>t=>r=>t(r);{const{isSerializable:t=Tm,getEntries:r,ignoredActions:o=[],ignoredActionPaths:n=["meta.arg","meta.baseQueryMeta"],ignoredPaths:a=[],warnAfter:l=32,ignoreState:i=!1,ignoreActions:c=!1,disableCache:d=!1}=e,p=!d&&WeakSet?new WeakSet:void 0;return u=>f=>h=>{if(!Rh(h))return f(h);const b=f(h),g=Em(l,"SerializableStateInvariantMiddleware");return!c&&!(o.length&&o.indexOf(h.type)!==-1)&&g.measureTime(()=>{const y=yc(h,"",t,r,n,p);if(y){const{keyPath:x,value:v}=y;console.error(`A non-serializable value was detected in an action, in the path: \`${x}\`. Value:`,v,`
186
+ Take a look at the logic that dispatched this action: `,h,`
187
+ (See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)`,`
188
+ (To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)`)}}),i||(g.measureTime(()=>{const y=u.getState(),x=yc(y,"",t,r,a,p);if(x){const{keyPath:v,value:w}=x;console.error(`A non-serializable value was detected in the state, in the path: \`${v}\`. Value:`,w,`
189
+ Take a look at the reducer(s) handling this action type: ${h.type}.
190
+ (See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}}),g.warnIfExceeded()),b}}}function Os(e){return typeof e=="boolean"}var D1=()=>function(t){const{thunk:r=!0,immutableCheck:o=!0,serializableCheck:n=!0,actionCreatorCheck:a=!0}=t??{};let l=new km;if(r&&(Os(r)?l.push(b1):l.push(y1(r.extraArgument))),process.env.NODE_ENV!=="production"){if(o){let i={};Os(o)||(i=o),l.unshift(k1(i))}if(n){let i={};Os(n)||(i=n),l.push(_1(i))}if(a){let i={};Os(a)||(i=a),l.unshift(C1(i))}}return l},A1="RTK_autoBatch",Im=e=>t=>{setTimeout(t,e)},T1=(e={type:"raf"})=>t=>(...r)=>{const o=t(...r);let n=!0,a=!1,l=!1;const i=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:Im(10):e.type==="callback"?e.queueNotification:Im(e.timeout),d=()=>{l=!1,a&&(a=!1,i.forEach(p=>p()))};return Object.assign({},o,{subscribe(p){const u=()=>n&&p(),f=o.subscribe(u);return i.add(p),()=>{f(),i.delete(p)}},dispatch(p){var u;try{return n=!((u=p==null?void 0:p.meta)!=null&&u[A1]),a=!n,a&&(l||(l=!0,c(d))),o.dispatch(p)}finally{n=!0}}})},M1=e=>function(r){const{autoBatch:o=!0}=r??{};let n=new km(e);return o&&n.push(T1(typeof o=="object"?o:void 0)),n};function I1(e){const t=D1(),{reducer:r=void 0,middleware:o,devTools:n=!0,duplicateMiddlewareCheck:a=!0,preloadedState:l=void 0,enhancers:i=void 0}=e||{};let c;if(typeof r=="function")c=r;else if(yn(r))c=Zh(r);else throw new Error(process.env.NODE_ENV==="production"?Pe(1):"`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");if(process.env.NODE_ENV!=="production"&&o&&typeof o!="function")throw new Error(process.env.NODE_ENV==="production"?Pe(2):"`middleware` field must be a callback");let d;if(typeof o=="function"){if(d=o(t),process.env.NODE_ENV!=="production"&&!Array.isArray(d))throw new Error(process.env.NODE_ENV==="production"?Pe(3):"when using a middleware builder function, an array of middleware must be returned")}else d=t();if(process.env.NODE_ENV!=="production"&&d.some(g=>typeof g!="function"))throw new Error(process.env.NODE_ENV==="production"?Pe(4):"each middleware provided to configureStore must be a function");if(process.env.NODE_ENV!=="production"&&a){let g=new Set;d.forEach(y=>{if(g.has(y))throw new Error(process.env.NODE_ENV==="production"?Pe(42):"Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.");g.add(y)})}let p=gs;n&&(p=v1({trace:process.env.NODE_ENV!=="production",...typeof n=="object"&&n}));const u=zk(...d),f=M1(u);if(process.env.NODE_ENV!=="production"&&i&&typeof i!="function")throw new Error(process.env.NODE_ENV==="production"?Pe(5):"`enhancers` field must be a callback");let h=typeof i=="function"?i(f):f();if(process.env.NODE_ENV!=="production"&&!Array.isArray(h))throw new Error(process.env.NODE_ENV==="production"?Pe(6):"`enhancers` callback must return an array");if(process.env.NODE_ENV!=="production"&&h.some(g=>typeof g!="function"))throw new Error(process.env.NODE_ENV==="production"?Pe(7):"each enhancer provided to configureStore must be a function");process.env.NODE_ENV!=="production"&&d.length&&!h.includes(u)&&console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");const b=p(...h);return Xh(c,l,b)}function Pm(e){const t={},r=[];let o;const n={addCase(a,l){if(process.env.NODE_ENV!=="production"){if(r.length>0)throw new Error(process.env.NODE_ENV==="production"?Pe(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error(process.env.NODE_ENV==="production"?Pe(27):"`builder.addCase` should only be called before calling `builder.addDefaultCase`")}const i=typeof a=="string"?a:a.type;if(!i)throw new Error(process.env.NODE_ENV==="production"?Pe(28):"`builder.addCase` cannot be called with an empty action type");if(i in t)throw new Error(process.env.NODE_ENV==="production"?Pe(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${i}'`);return t[i]=l,n},addAsyncThunk(a,l){if(process.env.NODE_ENV!=="production"&&o)throw new Error(process.env.NODE_ENV==="production"?Pe(43):"`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");return l.pending&&(t[a.pending.type]=l.pending),l.rejected&&(t[a.rejected.type]=l.rejected),l.fulfilled&&(t[a.fulfilled.type]=l.fulfilled),l.settled&&r.push({matcher:a.settled,reducer:l.settled}),n},addMatcher(a,l){if(process.env.NODE_ENV!=="production"&&o)throw new Error(process.env.NODE_ENV==="production"?Pe(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return r.push({matcher:a,reducer:l}),n},addDefaultCase(a){if(process.env.NODE_ENV!=="production"&&o)throw new Error(process.env.NODE_ENV==="production"?Pe(31):"`builder.addDefaultCase` can only be called once");return o=a,n}};return e(n),[t,r,o]}function P1(e){return typeof e=="function"}function O1(e,t){if(process.env.NODE_ENV!=="production"&&typeof t=="object")throw new Error(process.env.NODE_ENV==="production"?Pe(8):"The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");let[r,o,n]=Pm(t),a;if(P1(e))a=()=>_m(e());else{const i=_m(e);a=()=>i}function l(i=a(),c){let d=[r[c.type],...o.filter(({matcher:p})=>p(c)).map(({reducer:p})=>p)];return d.filter(p=>!!p).length===0&&(d=[n]),d.reduce((p,u)=>{if(u)if(yr(p)){const h=u(p,c);return h===void 0?p:h}else{if(qt(p))return ym(p,f=>u(f,c));{const f=u(p,c);if(f===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return f}}return p},i)}return l.getInitialState=a,l}var $1="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",L1=(e=21)=>{let t="",r=e;for(;r--;)t+=$1[Math.random()*64|0];return t},F1=Symbol.for("rtk-slice-createasyncthunk");function G1(e,t){return`${e}/${t}`}function V1({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[F1];return function(n){const{name:a,reducerPath:l=a}=n;if(!a)throw new Error(process.env.NODE_ENV==="production"?Pe(11):"`name` is a required option for createSlice");typeof process<"u"&&process.env.NODE_ENV==="development"&&n.initialState===void 0&&console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");const i=(typeof n.reducers=="function"?n.reducers(B1()):n.reducers)||{},c=Object.keys(i),d={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},p={addCase(S,E){const N=typeof S=="string"?S:S.type;if(!N)throw new Error(process.env.NODE_ENV==="production"?Pe(12):"`context.addCase` cannot be called with an empty action type");if(N in d.sliceCaseReducersByType)throw new Error(process.env.NODE_ENV==="production"?Pe(13):"`context.addCase` cannot be called with two reducers for the same action type: "+N);return d.sliceCaseReducersByType[N]=E,p},addMatcher(S,E){return d.sliceMatchers.push({matcher:S,reducer:E}),p},exposeAction(S,E){return d.actionCreators[S]=E,p},exposeCaseReducer(S,E){return d.sliceCaseReducersByName[S]=E,p}};c.forEach(S=>{const E=i[S],N={reducerName:S,type:G1(a,S),createNotation:typeof n.reducers=="function"};W1(E)?j1(N,E,p,t):U1(N,E,p)});function u(){if(process.env.NODE_ENV!=="production"&&typeof n.extraReducers=="object")throw new Error(process.env.NODE_ENV==="production"?Pe(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[S={},E=[],N=void 0]=typeof n.extraReducers=="function"?Pm(n.extraReducers):[n.extraReducers],T={...S,...d.sliceCaseReducersByType};return O1(n.initialState,k=>{for(let M in T)k.addCase(M,T[M]);for(let M of d.sliceMatchers)k.addMatcher(M.matcher,M.reducer);for(let M of E)k.addMatcher(M.matcher,M.reducer);N&&k.addDefaultCase(N)})}const f=S=>S,h=new Map,b=new WeakMap;let g;function y(S,E){return g||(g=u()),g(S,E)}function x(){return g||(g=u()),g.getInitialState()}function v(S,E=!1){function N(k){let M=k[S];if(typeof M>"u"){if(E)M=Cn(b,N,x);else if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV==="production"?Pe(15):"selectSlice returned undefined for an uninjected slice reducer")}return M}function T(k=f){const M=Cn(h,E,()=>new WeakMap);return Cn(M,k,()=>{const D={};for(const[U,$]of Object.entries(n.selectors??{}))D[U]=z1($,k,()=>Cn(b,k,x),E);return D})}return{reducerPath:S,getSelectors:T,get selectors(){return T(N)},selectSlice:N}}const w={name:a,reducer:y,actions:d.actionCreators,caseReducers:d.sliceCaseReducersByName,getInitialState:x,...v(l),injectInto(S,{reducerPath:E,...N}={}){const T=E??l;return S.inject({reducerPath:T,reducer:y},N),{...w,...v(T,!0)}}};return w}}function z1(e,t,r,o){function n(a,...l){let i=t(a);if(typeof i>"u"){if(o)i=r();else if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV==="production"?Pe(16):"selectState returned undefined for an uninjected slice reducer")}return e(i,...l)}return n.unwrapped=e,n}var Om=V1();function B1(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function U1({type:e,reducerName:t,createNotation:r},o,n){let a,l;if("reducer"in o){if(r&&!H1(o))throw new Error(process.env.NODE_ENV==="production"?Pe(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");a=o.reducer,l=o.prepare}else a=o;n.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,l?Nm(e,l):Nm(e))}function W1(e){return e._reducerDefinitionType==="asyncThunk"}function H1(e){return e._reducerDefinitionType==="reducerWithPrepare"}function j1({type:e,reducerName:t},r,o,n){if(!n)throw new Error(process.env.NODE_ENV==="production"?Pe(18):"Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");const{payloadCreator:a,fulfilled:l,pending:i,rejected:c,settled:d,options:p}=r,u=n(e,a,p);o.exposeAction(t,u),l&&o.addCase(u.fulfilled,l),i&&o.addCase(u.pending,i),c&&o.addCase(u.rejected,c),d&&o.addMatcher(u.settled,d),o.exposeCaseReducer(t,{fulfilled:l||$s,pending:i||$s,rejected:c||$s,settled:d||$s})}function $s(){}var Y1=e=>"reducerPath"in e&&typeof e.reducerPath=="string",q1=e=>e.flatMap(t=>Y1(t)?[[t.reducerPath,t.reducer]]:Object.entries(t)),vc=Symbol.for("rtk-state-proxy-original"),Q1=e=>!!e&&!!e[vc],K1=new WeakMap,X1=(e,t,r)=>Cn(K1,e,()=>new Proxy(e,{get:(o,n,a)=>{if(n===vc)return o;const l=Reflect.get(o,n,a);if(typeof l>"u"){const i=r[n];if(typeof i<"u")return i;const c=t[n];if(c){const d=c(void 0,{type:L1()});if(typeof d>"u")throw new Error(process.env.NODE_ENV==="production"?Pe(24):`The slice reducer for key "${n.toString()}" returned undefined when called for selector(). If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.`);return r[n]=d,d}}return l}})),J1=e=>{if(!Q1(e))throw new Error(process.env.NODE_ENV==="production"?Pe(25):"original must be used on state Proxy");return e[vc]},Z1={},R1=(e=Z1)=>e;function e_(...e){const t=Object.fromEntries(q1(e)),r=()=>Object.keys(t).length?Zh(t):R1;let o=r();function n(c,d){return o(c,d)}n.withLazyLoadedSlices=()=>n;const a={},l=(c,d={})=>{const{reducerPath:p,reducer:u}=c,f=t[p];return!d.overrideExisting&&f&&f!==u?(typeof process<"u"&&process.env.NODE_ENV==="development"&&console.error(`called \`inject\` to override already-existing reducer ${p} without specifying \`overrideExisting: true\``),n):(d.overrideExisting&&f!==u&&delete a[p],t[p]=u,o=r(),n)},i=Object.assign(function(d,p){return function(f,...h){return d(X1(p?p(f,...h):f,t,a),...h)}},{original:J1});return Object.assign(n,{inject:l,selector:i})}function Pe(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var Ls={exports:{}},xc={};/**
191
+ * @license React
192
+ * use-sync-external-store-with-selector.production.js
193
+ *
194
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
195
+ *
196
+ * This source code is licensed under the MIT license found in the
197
+ * LICENSE file in the root directory of this source tree.
198
+ */var $m;function t_(){if($m)return xc;$m=1;var e=C;function t(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:t,o=e.useSyncExternalStore,n=e.useRef,a=e.useEffect,l=e.useMemo,i=e.useDebugValue;return xc.useSyncExternalStoreWithSelector=function(c,d,p,u,f){var h=n(null);if(h.current===null){var b={hasValue:!1,value:null};h.current=b}else b=h.current;h=l(function(){function y(E){if(!x){if(x=!0,v=E,E=u(E),f!==void 0&&b.hasValue){var N=b.value;if(f(N,E))return w=N}return w=E}if(N=w,r(v,E))return N;var T=u(E);return f!==void 0&&f(N,T)?(v=E,N):(v=E,w=T)}var x=!1,v,w,S=p===void 0?null:p;return[function(){return y(d())},S===null?void 0:function(){return y(S())}]},[d,p,u,f]);var g=o(c,h[0],h[1]);return a(function(){b.hasValue=!0,b.value=g},[g]),i(g),g},xc}var wc={};/**
199
+ * @license React
200
+ * use-sync-external-store-with-selector.development.js
201
+ *
202
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
203
+ *
204
+ * This source code is licensed under the MIT license found in the
205
+ * LICENSE file in the root directory of this source tree.
206
+ */var Lm;function r_(){return Lm||(Lm=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=C,r=typeof Object.is=="function"?Object.is:e,o=t.useSyncExternalStore,n=t.useRef,a=t.useEffect,l=t.useMemo,i=t.useDebugValue;wc.useSyncExternalStoreWithSelector=function(c,d,p,u,f){var h=n(null);if(h.current===null){var b={hasValue:!1,value:null};h.current=b}else b=h.current;h=l(function(){function y(E){if(!x){if(x=!0,v=E,E=u(E),f!==void 0&&b.hasValue){var N=b.value;if(f(N,E))return w=N}return w=E}if(N=w,r(v,E))return N;var T=u(E);return f!==void 0&&f(N,T)?(v=E,N):(v=E,w=T)}var x=!1,v,w,S=p===void 0?null:p;return[function(){return y(d())},S===null?void 0:function(){return y(S())}]},[d,p,u,f]);var g=o(c,h[0],h[1]);return a(function(){b.hasValue=!0,b.value=g},[g]),i(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),wc}var Fm;function o_(){return Fm||(Fm=1,process.env.NODE_ENV==="production"?Ls.exports=t_():Ls.exports=r_()),Ls.exports}var n_=o_();function a_(e){e()}function s_(){let e=null,t=null;return{clear(){e=null,t=null},notify(){a_(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let o=e;for(;o;)r.push(o),o=o.next;return r},subscribe(r){let o=!0;const n=t={callback:r,next:null,prev:t};return n.prev?n.prev.next=n:e=n,function(){!o||e===null||(o=!1,n.next?n.next.prev=n.prev:t=n.prev,n.prev?n.prev.next=n.next:e=n.next)}}}}var Gm={notify(){},get:()=>[]};function l_(e,t){let r,o=Gm,n=0,a=!1;function l(g){p();const y=o.subscribe(g);let x=!1;return()=>{x||(x=!0,y(),u())}}function i(){o.notify()}function c(){b.onStateChange&&b.onStateChange()}function d(){return a}function p(){n++,r||(r=e.subscribe(c),o=s_())}function u(){n--,r&&n===0&&(r(),r=void 0,o.clear(),o=Gm)}function f(){a||(a=!0,p())}function h(){a&&(a=!1,u())}const b={addNestedSub:l,notifyNestedSubs:i,handleChangeWrapper:c,isSubscribed:d,trySubscribe:f,tryUnsubscribe:h,getListeners:()=>o};return b}var i_=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",c_=i_(),d_=()=>typeof navigator<"u"&&navigator.product==="ReactNative",u_=d_(),p_=()=>c_||u_?m.useLayoutEffect:m.useEffect,f_=p_(),Sc=Symbol.for("react-redux-context"),Cc=typeof globalThis<"u"?globalThis:{};function h_(){if(!m.createContext)return{};const e=Cc[Sc]??(Cc[Sc]=new Map);let t=e.get(m.createContext);return t||(t=m.createContext(null),process.env.NODE_ENV!=="production"&&(t.displayName="ReactRedux"),e.set(m.createContext,t)),t}var Gr=h_();function m_(e){const{children:t,context:r,serverState:o,store:n}=e,a=m.useMemo(()=>{const c=l_(n),d={store:n,subscription:c,getServerState:o?()=>o:void 0};if(process.env.NODE_ENV==="production")return d;{const{identityFunctionCheck:p="once",stabilityCheck:u="once"}=e;return Object.assign(d,{stabilityCheck:u,identityFunctionCheck:p})}},[n,o]),l=m.useMemo(()=>n.getState(),[n]);f_(()=>{const{subscription:c}=a;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),l!==n.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[a,l]);const i=r||Gr;return m.createElement(i.Provider,{value:a},t)}var g_=m_;function Nc(e=Gr){return function(){const r=m.useContext(e);if(process.env.NODE_ENV!=="production"&&!r)throw new Error("could not find react-redux context value; please ensure the component is wrapped in a <Provider>");return r}}var Vm=Nc();function Ec(e=Gr){const t=e===Gr?Vm:Nc(e),r=()=>{const{store:o}=t();return o};return Object.assign(r,{withTypes:()=>r}),r}var b_=Ec();function y_(e=Gr){const t=e===Gr?b_:Ec(e),r=()=>t().dispatch;return Object.assign(r,{withTypes:()=>r}),r}var v_=(e,t)=>e===t;function x_(e=Gr){const t=e===Gr?Vm:Nc(e),r=(o,n={})=>{const{equalityFn:a=v_}=typeof n=="function"?{equalityFn:n}:n;if(process.env.NODE_ENV!=="production"){if(!o)throw new Error("You must pass a selector to useSelector");if(typeof o!="function")throw new Error("You must pass a function as a selector to useSelector");if(typeof a!="function")throw new Error("You must pass a function as an equality function to useSelector")}const l=t(),{store:i,subscription:c,getServerState:d}=l,p=m.useRef(!0),u=m.useCallback({[o.name](h){const b=o(h);if(process.env.NODE_ENV!=="production"){const{devModeChecks:g={}}=typeof n=="function"?{}:n,{identityFunctionCheck:y,stabilityCheck:x}=l,{identityFunctionCheck:v,stabilityCheck:w}={stabilityCheck:x,identityFunctionCheck:y,...g};if(w==="always"||w==="once"&&p.current){const S=o(h);if(!a(b,S)){let E;try{throw new Error}catch(N){({stack:E}=N)}console.warn("Selector "+(o.name||"unknown")+` returned a different result when called with the same parameters. This can lead to unnecessary rerenders.
207
+ Selectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization`,{state:h,selected:b,selected2:S,stack:E})}}if((v==="always"||v==="once"&&p.current)&&b===h){let S;try{throw new Error}catch(E){({stack:S}=E)}console.warn("Selector "+(o.name||"unknown")+` returned the root state when called. This can lead to unnecessary rerenders.
208
+ Selectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.`,{stack:S})}p.current&&(p.current=!1)}return b}}[o.name],[o]),f=n_.useSyncExternalStoreWithSelector(c.addNestedSub,i.getState,d||i.getState,u,a);return m.useDebugValue(f),f};return Object.assign(r,{withTypes:()=>r}),r}var zm=Symbol.for("immer-nothing"),Bm=Symbol.for("immer-draftable"),xt=Symbol.for("immer-state"),w_=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function $t(e,...t){if(process.env.NODE_ENV!=="production"){const r=w_[e],o=io(r)?r.apply(null,t):r;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Lt=Object,Lo=Lt.getPrototypeOf,Fs="constructor",Gs="prototype",kc="configurable",Vs="enumerable",zs="writable",Nn="value",Vr=e=>!!e&&!!e[xt];function xr(e){var t;return e?Wm(e)||Ws(e)||!!e[Bm]||!!((t=e[Fs])!=null&&t[Bm])||Hs(e)||js(e):!1}var S_=Lt[Gs][Fs].toString(),Um=new WeakMap;function Wm(e){if(!e||!Dc(e))return!1;const t=Lo(e);if(t===null||t===Lt[Gs])return!0;const r=Lt.hasOwnProperty.call(t,Fs)&&t[Fs];if(r===Object)return!0;if(!io(r))return!1;let o=Um.get(r);return o===void 0&&(o=Function.toString.call(r),Um.set(r,o)),o===S_}function Bs(e,t,r=!0){En(e)===0?(r?Reflect.ownKeys(e):Lt.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((o,n)=>t(n,o,e))}function En(e){const t=e[xt];return t?t.type_:Ws(e)?1:Hs(e)?2:js(e)?3:0}var Hm=(e,t,r=En(e))=>r===2?e.has(t):Lt[Gs].hasOwnProperty.call(e,t),_c=(e,t,r=En(e))=>r===2?e.get(t):e[t],Us=(e,t,r,o=En(e))=>{o===2?e.set(t,r):o===3?e.add(r):e[t]=r};function C_(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ws=Array.isArray,Hs=e=>e instanceof Map,js=e=>e instanceof Set,Dc=e=>typeof e=="object",io=e=>typeof e=="function",Ac=e=>typeof e=="boolean";function N_(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var wr=e=>e.copy_||e.base_,Tc=e=>e.modified_?e.copy_:e.base_;function Mc(e,t){if(Hs(e))return new Map(e);if(js(e))return new Set(e);if(Ws(e))return Array[Gs].slice.call(e);const r=Wm(e);if(t===!0||t==="class_only"&&!r){const o=Lt.getOwnPropertyDescriptors(e);delete o[xt];let n=Reflect.ownKeys(o);for(let a=0;a<n.length;a++){const l=n[a],i=o[l];i[zs]===!1&&(i[zs]=!0,i[kc]=!0),(i.get||i.set)&&(o[l]={[kc]:!0,[zs]:!0,[Vs]:i[Vs],[Nn]:e[l]})}return Lt.create(Lo(e),o)}else{const o=Lo(e);if(o!==null&&r)return{...e};const n=Lt.create(o);return Lt.assign(n,e)}}function Ic(e,t=!1){return qs(e)||Vr(e)||!xr(e)||(En(e)>1&&Lt.defineProperties(e,{set:Ys,add:Ys,clear:Ys,delete:Ys}),Lt.freeze(e),t&&Bs(e,(r,o)=>{Ic(o,!0)},!1)),e}function E_(){$t(2)}var Ys={[Nn]:E_};function qs(e){return e===null||!Dc(e)?!0:Lt.isFrozen(e)}var Qs="MapSet",Pc="Patches",jm="ArrayMethods",Ym={};function co(e){const t=Ym[e];return t||$t(0,e),t}var qm=e=>!!Ym[e],kn,Qm=()=>kn,k_=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:qm(Qs)?co(Qs):void 0,arrayMethodsPlugin_:qm(jm)?co(jm):void 0});function Km(e,t){t&&(e.patchPlugin_=co(Pc),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Oc(e){$c(e),e.drafts_.forEach(__),e.drafts_=null}function $c(e){e===kn&&(kn=e.parent_)}var Xm=e=>kn=k_(kn,e);function __(e){const t=e[xt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Jm(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[xt].modified_&&(Oc(t),$t(4)),xr(e)&&(e=Zm(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[xt].base_,e,t)}else e=Zm(t,r);return D_(t,e,!0),Oc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==zm?e:void 0}function Zm(e,t){if(qs(t))return t;const r=t[xt];if(!r)return Xs(t,e.handledSet_,e);if(!Ks(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:o}=r;if(o)for(;o.length>0;)o.pop()(e);tg(r,e)}return r.copy_}function D_(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ic(t,r)}function Rm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ks=(e,t)=>e.scope_===t,A_=[];function eg(e,t,r,o){const n=wr(e),a=e.type_;if(o!==void 0&&_c(n,o,a)===t){Us(n,o,r,a);return}if(!e.draftLocations_){const i=e.draftLocations_=new Map;Bs(n,(c,d)=>{if(Vr(d)){const p=i.get(d)||[];p.push(c),i.set(d,p)}})}const l=e.draftLocations_.get(t)??A_;for(const i of l)Us(n,i,r,a)}function T_(e,t,r){e.callbacks_.push(function(n){var i;const a=t;if(!a||!Ks(a,n))return;(i=n.mapSetPlugin_)==null||i.fixSetContents(a);const l=Tc(a);eg(e,a.draft_??a,l,r),tg(a,n)})}function tg(e,t){var o;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((o=e.assigned_)==null?void 0:o.size)??0)>0)){const{patchPlugin_:n}=t;if(n){const a=n.getPath(e);a&&n.generatePatches_(e,a,t)}Rm(e)}}function M_(e,t,r){const{scope_:o}=e;if(Vr(r)){const n=r[xt];Ks(n,o)&&n.callbacks_.push(function(){Zs(e);const l=Tc(n);eg(e,r,l,t)})}else xr(r)&&e.callbacks_.push(function(){const a=wr(e);e.type_===3?a.has(r)&&Xs(r,o.handledSet_,o):_c(a,t,e.type_)===r&&o.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Xs(_c(e.copy_,t,e.type_),o.handledSet_,o)})}function Xs(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Vr(e)||t.has(e)||!xr(e)||qs(e)||(t.add(e),Bs(e,(o,n)=>{if(Vr(n)){const a=n[xt];if(Ks(a,r)){const l=Tc(a);Us(e,o,l,e.type_),Rm(a)}}else xr(n)&&Xs(n,t,r)})),e}function I_(e,t){const r=Ws(e),o={type_:r?1:0,scope_:t?t.scope_:Qm(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let n=o,a=Js;r&&(n=[o],a=_n);const{revoke:l,proxy:i}=Proxy.revocable(n,a);return o.draft_=i,o.revoke_=l,[i,o]}var Js={get(e,t){if(t===xt)return e;let r=e.scope_.arrayMethodsPlugin_;const o=e.type_===1&&typeof t=="string";if(o&&r!=null&&r.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const n=wr(e);if(!Hm(n,t,e.type_))return P_(e,n,t);const a=n[t];if(e.finalized_||!xr(a)||o&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&N_(t))return a;if(a===Lc(e.base_,t)){Zs(e);const l=e.type_===1?+t:t,i=Gc(e.scope_,a,e,l);return e.copy_[l]=i}return a},has(e,t){return t in wr(e)},ownKeys(e){return Reflect.ownKeys(wr(e))},set(e,t,r){const o=rg(wr(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const n=Lc(wr(e),t),a=n==null?void 0:n[xt];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(C_(r,n)&&(r!==void 0||Hm(e.base_,t,e.type_)))return!0;Zs(e),Fc(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),M_(e,t,r)),!0},deleteProperty(e,t){return Zs(e),Lc(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Fc(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=wr(e),o=Reflect.getOwnPropertyDescriptor(r,t);return o&&{[zs]:!0,[kc]:e.type_!==1||t!=="length",[Vs]:o[Vs],[Nn]:r[t]}},defineProperty(){$t(11)},getPrototypeOf(e){return Lo(e.base_)},setPrototypeOf(){$t(12)}},_n={};for(let e in Js){let t=Js[e];_n[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}_n.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&$t(13),_n.set.call(this,e,t,void 0)},_n.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&$t(14),Js.set.call(this,e[0],t,r,e[0])};function Lc(e,t){const r=e[xt];return(r?wr(r):e)[t]}function P_(e,t,r){var n;const o=rg(t,r);return o?Nn in o?o[Nn]:(n=o.get)==null?void 0:n.call(e.draft_):void 0}function rg(e,t){if(!(t in e))return;let r=Lo(e);for(;r;){const o=Object.getOwnPropertyDescriptor(r,t);if(o)return o;r=Lo(r)}}function Fc(e){e.modified_||(e.modified_=!0,e.parent_&&Fc(e.parent_))}function Zs(e){e.copy_||(e.assigned_=new Map,e.copy_=Mc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var O_=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,o)=>{if(io(t)&&!io(r)){const a=r;r=t;const l=this;return function(c=a,...d){return l.produce(c,p=>r.call(this,p,...d))}}io(r)||$t(6),o!==void 0&&!io(o)&&$t(7);let n;if(xr(t)){const a=Xm(this),l=Gc(a,t,void 0);let i=!0;try{n=r(l),i=!1}finally{i?Oc(a):$c(a)}return Km(a,o),Jm(n,a)}else if(!t||!Dc(t)){if(n=r(t),n===void 0&&(n=t),n===zm&&(n=void 0),this.autoFreeze_&&Ic(n,!0),o){const a=[],l=[];co(Pc).generateReplacementPatches_(t,n,{patches_:a,inversePatches_:l}),o(a,l)}return n}else $t(1,t)},this.produceWithPatches=(t,r)=>{if(io(t))return(l,...i)=>this.produceWithPatches(l,c=>t(c,...i));let o,n;return[this.produce(t,r,(l,i)=>{o=l,n=i}),o,n]},Ac(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ac(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ac(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){xr(e)||$t(8),Vr(e)&&(e=$_(e));const t=Xm(this),r=Gc(t,e,void 0);return r[xt].isManual_=!0,$c(t),r}finishDraft(e,t){const r=e&&e[xt];(!r||!r.isManual_)&&$t(9);const{scope_:o}=r;return Km(o,t),Jm(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(n.path.length===0&&n.op==="replace"){e=n.value;break}}r>-1&&(t=t.slice(r+1));const o=co(Pc).applyPatches_;return Vr(e)?o(e,t):this.produce(e,n=>o(n,t))}};function Gc(e,t,r,o){const[n,a]=Hs(t)?co(Qs).proxyMap_(t,r):js(t)?co(Qs).proxySet_(t,r):I_(t,r);return((r==null?void 0:r.scope_)??Qm()).drafts_.push(n),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=o,r&&o!==void 0?T_(r,a,o):a.callbacks_.push(function(c){var p;(p=c.mapSetPlugin_)==null||p.fixSetContents(a);const{patchPlugin_:d}=c;a.modified_&&d&&d.generatePatches_(a,[],c)}),n}function $_(e){return Vr(e)||$t(10,e),og(e)}function og(e){if(!xr(e)||qs(e))return e;const t=e[xt];let r,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Mc(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else r=Mc(e,!0);return Bs(r,(n,a)=>{Us(r,n,og(a))},o),t&&(t.finalized_=!1),r}var L_=new O_,F_=L_.produce;const Qt=e=>m.createElement("button",{type:"button","data-testid":e.testID,disabled:e.disabled&&!e.disabledTranslation,className:e.className,title:e.disabledTranslation&&e.disabled?e.disabledTranslation.title:e.title,onClick:t=>e.handleOnClick(t)},e.disabledTranslation&&e.disabled?e.disabledTranslation.label:e.label),G_=C.forwardRef((e,t)=>m.createElement("span",{"data-testid":e.testID,ref:t,className:e.className,title:e.title},e.label)),V_=e=>{const{component:t,...r}=e,o=De(r.schema.suppressStandardClassnames||de.betweenRules,r.schema.classNames.betweenRules);return m.createElement("div",{className:o,"data-testid":ue.inlineCombinator},m.createElement(t,{...r,testID:ue.combinators}))},z_={name:"",value:"",label:""},ng=e=>["atleast","atmost","exactly"].includes(fn(e)??""),ag=[],B_=e=>{const{match:t,options:r,title:o,className:n,disabled:a,testID:l,schema:i,selectorComponent:c=e.schema.controls.valueSelector,numericEditorComponent:d=e.schema.controls.valueEditor}=e,{thresholdNum:p,thresholdRule:u,thresholdSchema:f,handleChangeMode:h,handleChangeThreshold:b}=U_(e);return m.createElement(m.Fragment,null,m.createElement(c,{schema:i,testID:l,className:n,title:o,handleOnChange:h,disabled:a,value:t.mode,options:r,multiple:!1,listsAsArrays:!1,path:ag,level:0}),ng(t.mode)&&m.createElement(d,{skipHook:!0,testID:l,inputType:"number",title:o,className:n,disabled:a,handleOnChange:b,field:"",operator:"",value:p,valueSource:"value",fieldData:z_,schema:f,path:ag,level:0,rule:u}))},U_=e=>{const{match:t,handleOnChange:r}=e,o=m.useMemo(()=>typeof t.threshold=="number"?Math.max(0,t.threshold):1,[t.threshold]);return{thresholdNum:o,thresholdRule:m.useMemo(()=>({field:"",operator:"=",value:o}),[o]),thresholdSchema:m.useMemo(()=>({...e.schema,parseNumbers:!0}),[e.schema]),handleChangeMode:C.useCallback(n=>{ng(n)&&typeof t.threshold!="number"?r({...t,mode:n,threshold:1}):r({...t,mode:n})},[r,t]),handleChangeThreshold:C.useCallback(n=>{r({...t,threshold:hs(n,{parseNumbers:!0})})},[r,t])}},W_=e=>{const t=m.useId();return m.createElement("label",{"data-testid":e.testID,className:e.className,title:e.title,htmlFor:t},m.createElement("input",{id:t,type:"checkbox",onChange:r=>e.handleOnChange(r.target.checked),checked:!!e.checked,disabled:e.disabled}),e.label)},ut={errorInvalidIndependentCombinatorsProp:"QueryBuilder was rendered with a truthy independentCombinators prop. This prop is deprecated and unnecessary. Furthermore, the initial query/defaultQuery prop was of type RuleGroupType instead of type RuleGroupIC. More info: https://react-querybuilder.js.org/docs/components/querybuilder#independent-combinators",errorUnnecessaryIndependentCombinatorsProp:"QueryBuilder was rendered with the deprecated and unnecessary independentCombinators prop. To use independent combinators, make sure the query/defaultQuery prop is of type RuleGroupIC when the component mounts. More info: https://react-querybuilder.js.org/docs/components/querybuilder#independent-combinators",errorDeprecatedRuleGroupProps:"A custom RuleGroup component has rendered a standard RuleGroup component with deprecated props. The combinator, not, and rules props should not be used. Instead, the full group object should be passed as the ruleGroup prop.",errorDeprecatedRuleProps:"A custom RuleGroup component has rendered a standard Rule component with deprecated props. The field, operator, value, and valueSource props should not be used. Instead, the full rule object should be passed as the rule prop.",errorBothQueryDefaultQuery:"QueryBuilder was rendered with both query and defaultQuery props. QueryBuilder must be either controlled or uncontrolled (specify either the query prop, or the defaultQuery prop, but not both). Decide between using a controlled or uncontrolled query builder and remove one of these props. More info: https://reactjs.org/link/controlled-components",errorUncontrolledToControlled:"QueryBuilder is changing from an uncontrolled component to be controlled. This is likely caused by the query changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled query builder for the lifetime of the component. More info: https://reactjs.org/link/controlled-components",errorControlledToUncontrolled:"QueryBuilder is changing from a controlled component to be uncontrolled. This is likely caused by the query changing from defined to undefined, which should not happen. Decide between using a controlled or uncontrolled query builder for the lifetime of the component. More info: https://reactjs.org/link/controlled-components",errorEnabledDndWithoutReactDnD:"QueryBuilder was rendered with the enableDragAndDrop prop set to true, but either react-dnd was not detected or one of react-dnd-html5-backend or react-dnd-touch-backend was not detected. To enable drag-and-drop functionality, install react-dnd and one of the backend packages and wrap QueryBuilder in QueryBuilderDnD from @react-querybuilder/dnd.",errorDeprecatedDebugImport:"Importing from react-querybuilder/debug is deprecated. To enable Redux DevTools for React Query Builder's internal store, set globalThis.__RQB_DEVTOOLS__ = true."},Dn=Om({name:"queries",initialState:{},reducers:{setQueryState:(e,{payload:{qbId:t,query:r}})=>{e[t]=r}},selectors:{getQuerySelectorById:(e,t)=>e[t]}}),sg=m.createContext(null),H_={[ut.errorInvalidIndependentCombinatorsProp]:!1,[ut.errorUnnecessaryIndependentCombinatorsProp]:!1,[ut.errorDeprecatedRuleGroupProps]:!1,[ut.errorDeprecatedRuleProps]:!1,[ut.errorBothQueryDefaultQuery]:!1,[ut.errorUncontrolledToControlled]:!1,[ut.errorControlledToUncontrolled]:!1,[ut.errorEnabledDndWithoutReactDnD]:!1,[ut.errorDeprecatedDebugImport]:!1},Vc=Om({name:"warnings",initialState:H_,reducers:{rqbWarn:(e,{payload:t})=>{e[t]||(console.error(t),e[t]=!0)}}}),lg=e_(Dn,Vc).withLazyLoadedSlices(),j_=e=>y_(e),Y_=e=>Ec(e),q_=e=>x_(e),Q_=e=>({useRQB_INTERNAL_QueryBuilderDispatch:j_(e),useRQB_INTERNAL_QueryBuilderStore:Y_(e),useRQB_INTERNAL_QueryBuilderSelector:q_(e)}),zc=({payload:e,onQueryChange:t})=>r=>{r(Dn.actions.setQueryState(e)),typeof t=="function"&&t(e.query)},Bc=Q_(sg),Uc=Bc.useRQB_INTERNAL_QueryBuilderDispatch,K_=Bc.useRQB_INTERNAL_QueryBuilderStore,X_=Bc.useRQB_INTERNAL_QueryBuilderSelector,{rqbWarn:J_}=Vc.actions,uo=e=>t=>{setTimeout(()=>t(J_(e)))},Z_={queries:Dn.getInitialState(),warnings:Vc.getInitialState()},R_={reducer:lg,preloadedState:Z_,middleware:e=>e({serializableCheck:{ignoredActions:[Dn.actions.setQueryState.type],ignoredPaths:[/^queries\b.*\.rules\.\d+\.value$/]}})},eD=e=>{const t=C.useRef({value:e,prev:null}),r=t.current.value;return e!==r&&(t.current.prev=r,t.current.value=e),t.current.prev},tD=e=>{const t=Uc(),{defaultQuery:r,queryProp:o}=e,n=eD(!!o);process.env.NODE_ENV!=="production"&&(o&&r?t(uo(ut.errorBothQueryDefaultQuery)):n===!0&&!o&&r?t(uo(ut.errorControlledToUncontrolled)):n===!1&&o&&!r&&t(uo(ut.errorUncontrolledToControlled)))};function Wc(e,t,r){const o=Uc();process.env.NODE_ENV!=="production"&&t&&(e==="independentCombinators"&&(r==="invalid"&&o(uo(ut.errorInvalidIndependentCombinatorsProp)),r==="unnecessary"&&o(uo(ut.errorUnnecessaryIndependentCombinatorsProp))),e==="rule"&&o(uo(ut.errorDeprecatedRuleProps)),e==="ruleGroup"&&o(uo(ut.errorDeprecatedRuleGroupProps)))}const ig=e=>{const{optionList:t,optionsMap:r,defaultOption:o}=C.useMemo(()=>gn({placeholder:e.translations.fields,optionList:e.fields,autoSelectOption:e.autoSelectField,baseOption:e.baseField}),[e.autoSelectField,e.baseField,e.fields,e.translations.fields]);return{fields:t,fieldMap:r,defaultField:o}},rD=e=>{const t=I1({...R_,devTools:e?{name:"React Query Builder"}:!1});return t.addSlice=r=>{lg.inject(r),t.dispatch({type:crypto.randomUUID().slice(0,8),meta:`Initializing state for slice "${r.name}"`})},t};let Hc=null;function cg(e){return Hc||(Hc=rD(globalThis==null?void 0:globalThis.__RQB_DEVTOOLS__)),Hc}const po=e=>t=>Dn.selectors.getQuerySelectorById({queries:t.queries},e),oD=(e,t)=>{const r=m.useContext(jc);return X_(e,t)??(r==null?void 0:r.initialQuery)},nD={},aD={},sD=[],lD={},iD=()=>null,dg=()=>"",fo=()=>!0,cD=(...e)=>{console.log(...e)};function dD(e,t){const{query:r,defaultQuery:o,getValueEditorSeparator:n=iD,getRuleClassname:a=dg,getRuleGroupClassname:l=dg,onAddRule:i=fo,onAddGroup:c=fo,onMoveRule:d=fo,onMoveGroup:p=fo,onGroupRule:u=fo,onGroupGroup:f=fo,onRemove:h=fo,onQueryChange:b,showCombinatorsBetweenRules:g=!1,showNotToggle:y=!1,showShiftActions:x=!1,showCloneButtons:v=!1,showLockButtons:w=!1,showMuteButtons:S=!1,suppressStandardClassnames:E=!1,resetOnFieldChange:N=!0,resetOnOperatorChange:T=!1,autoSelectField:k=!0,autoSelectOperator:M=!0,autoSelectValue:D=!0,addRuleToNewGroups:U=!1,listsAsArrays:$=!1,parseNumbers:F=!1,disabled:q=!1,validator:R,onLog:W=cD,idGenerator:Q,accessibleDescriptionGenerator:P=vk}=e,{qbId:z,rqbContext:pe,fields:ge,fieldMap:L,combinators:Y,getOperatorsMain:te,getMatchModesMain:fe,getRuleDefaultOperator:K,getSubQueryBuilderPropsMain:X,getValueEditorTypeMain:se,getValueSourcesMain:ve,getValuesMain:le,getRuleDefaultValue:H,getInputTypeMain:j,createRule:ce,createRuleGroup:Ee}=t,{controlClassnames:Se,controlElements:ze,debugMode:Ye,enableDragAndDrop:We,enableMountQueryChange:Re,translations:he}=pe,_=!!g,A=!!y,I=!!x,V=!!v,G=!!w,O=!!S,Z=!!N,me=!!T,Ce=!!k,He=!!M,St=!!D,pt=!!U,Cr=!!$,ht=!!E,kt=(e.maxLevels??0)>0?Number(e.maxLevels):1/0,Te=C.useCallback((...ie)=>{Ye&&W(...ie)},[Ye,W]);tD({defaultQuery:o,queryProp:r});const je=K_(),Ct=Uc(),Zt=C.useMemo(()=>po(z),[z]),Me=oD(Zt),at=C.useCallback(()=>Zt(je.getState()),[je,Zt]),Vo=C.useMemo(()=>Ee(),[Ee]),zo=r??Me??o??Vo,mt=zo.id?zo:ms(zo,{idGenerator:Q}),[On]=C.useState(mt),hl=C.useMemo(()=>({...pe,initialQuery:On}),[pe,On]);C.useEffect(()=>{r&&!Object.is(r,Me)&&Ct(zc({payload:{qbId:z,query:r},onQueryChange:void 0}))},[r,z,Me,Ct]);const Nr=C.useMemo(()=>mn(mt),[mt]),Bo=!!e.independentCombinators&&!Nr;Wc("independentCombinators",Bo||!Bo&&(e.independentCombinators??"not present")!=="not present",Bo?"invalid":"unnecessary");const $n=C.useRef(!1);C.useEffect(()=>{$n.current||($n.current=!0,Ct(zc({payload:{qbId:z,query:mt},onQueryChange:Re&&typeof b=="function"?b:void 0})))},[Re,b,z,Ct,mt]);const ft=C.useCallback(ie=>{Ct(zc({payload:{qbId:z,query:ie},onQueryChange:b}))},[b,z,Ct]),Uo=Array.isArray(q)&&q||sD,ot=q===!0,ml=mt.disabled||Uo.some(ie=>ie.length===0),Ln=C.useCallback((ie,ke,Ie)=>{const Ae=po(z)(je.getState());if(!Ae)return;if(Oo(ke,Ae)||ot){Te({qbId:z,type:tt.parentPathDisabled,rule:ie,parentPath:ke,query:Ae});return}const _e=i(ie,ke,Ae,Ie);if(!_e){Te({qbId:z,type:tt.onAddRuleFalse,rule:ie,parentPath:ke,query:Ae});return}const st=_e===!0?ie:_e,gt=qh(Ae,st,ke,{combinators:Y,combinatorPreceding:st.combinatorPreceding??void 0,idGenerator:Q});Te({qbId:z,type:tt.add,query:Ae,newQuery:gt,newRule:st,parentPath:ke}),ft(gt)},[Y,ft,Q,Te,i,z,je,ot]),Fn=C.useCallback((ie,ke,Ie)=>{if(ke.length>=kt)return;const Ae=po(z)(je.getState());if(!Ae)return;if(Oo(ke,Ae)||ot){Te({qbId:z,type:tt.parentPathDisabled,ruleGroup:ie,parentPath:ke,query:Ae});return}const _e=c(ie,ke,Ae,Ie);if(!_e){Te({qbId:z,type:tt.onAddGroupFalse,ruleGroup:ie,parentPath:ke,query:Ae});return}const st=_e===!0?ie:_e,gt=qh(Ae,st,ke,{combinators:Y,combinatorPreceding:st.combinatorPreceding??void 0,idGenerator:Q});Te({qbId:z,type:tt.add,query:Ae,newQuery:gt,newGroup:st,parentPath:ke}),ft(gt)},[Y,ft,Q,Te,kt,c,z,je,ot]),Gn=C.useCallback((ie,ke,Ie)=>{const Ae=po(z)(je.getState());if(!Ae)return;if(Oo(Ie,Ae)&&ie!=="disabled"||ot){Te({qbId:z,type:tt.pathDisabled,path:Ie,prop:ie,value:ke,query:Ae});return}const _e=Dk(Ae,ie,ke,Ie,{resetOnFieldChange:Z,resetOnOperatorChange:me,getRuleDefaultOperator:K,getValueSources:ve,getRuleDefaultValue:H,getMatchModes:fe});Te({qbId:z,type:tt.update,query:Ae,newQuery:_e,prop:ie,value:ke,path:Ie}),ft(_e)},[ft,fe,K,H,ve,Te,z,je,ot,Z,me]),Wo=C.useCallback((ie,ke)=>{const Ie=po(z)(je.getState());if(!Ie)return;if(Oo(ie,Ie)||ot){Te({qbId:z,type:tt.pathDisabled,path:ie,query:Ie});return}const Ae=Xe(ie,Ie);if(Ae)if(h(Ae,ie,Ie,ke)){const _e=Ak(Ie,ie);Te({qbId:z,type:tt.remove,query:Ie,newQuery:_e,path:ie,ruleOrGroup:Ae}),ft(_e)}else Te({qbId:z,type:tt.onRemoveFalse,ruleOrGroup:Ae,path:ie,query:Ie})},[ft,Te,h,z,je,ot]),Vn=C.useCallback((ie,ke,Ie,Ae)=>{const _e=po(z)(je.getState());if(!_e)return;if(Oo(ie,_e)||ot){Te({qbId:z,type:tt.pathDisabled,oldPath:ie,newPath:ke,query:_e});return}const st=Tk(_e,ie,ke,{clone:Ie,combinators:Y,idGenerator:Q}),gt=Xe(ie,_e),Wr=Ge(gt),cr=(Wr?p:d)(gt,ie,ke,_e,st,{clone:Ie,combinators:Y},Ae);if(!cr){Te({qbId:z,type:Wr?tt.onMoveGroupFalse:tt.onMoveRuleFalse,ruleOrGroup:gt,oldPath:ie,newPath:ke,clone:Ie,query:_e,nextQuery:st});return}const Hr=Ge(cr)?cr:st;Te({qbId:z,type:tt.move,query:_e,newQuery:Hr,oldPath:ie,newPath:ke,clone:Ie}),ft(Hr)},[Y,ft,Q,Te,p,d,z,je,ot]),zn=C.useCallback((ie,ke,Ie,Ae)=>{const _e=po(z)(je.getState());if(!_e)return;if(Oo(ie,_e)||ot){Te({qbId:z,type:tt.pathDisabled,sourcePath:ie,targetPath:ke,query:_e});return}const st=Mk(_e,ie,ke,{clone:Ie,combinators:Y,idGenerator:Q}),gt=Xe(ie,_e),Wr=Ge(gt),cr=(Wr?f:u)(gt,ie,ke,_e,st,{clone:Ie,combinators:Y},Ae);if(!cr){Te({qbId:z,type:Wr?tt.onGroupGroupFalse:tt.onGroupRuleFalse,ruleOrGroup:gt,sourcePath:ie,targetPath:ke,clone:Ie,query:_e,nextQuery:st});return}const Hr=Ge(cr)?cr:st;Te({qbId:z,type:tt.group,query:_e,newQuery:Hr,sourcePath:ie,targetPath:ke,clone:Ie}),ft(Hr)},[Y,ft,Q,Te,f,u,z,je,ot]),{validationResult:Ut,validationMap:Bn}=C.useMemo(()=>{const ie=typeof R=="function"&&mt?R(mt):nD;return{validationResult:ie,validationMap:typeof ie=="boolean"?aD:ie}},[mt,R]),gl=We?"enabled":"disabled",bl=Nr||_?"enabled":"disabled",yl=C.useMemo(()=>typeof mt.combinator=="string"?{combinator:mt.combinator}:lD,[mt.combinator]),vl=C.useMemo(()=>De(ht||de.queryBuilder,De(Se.queryBuilder),ot&&Se.disabled,typeof Ut=="boolean"&&Ut&&Se.valid,typeof Ut=="boolean"&&!Ut&&Se.invalid,ht||{[de.disabled]:ot,[de.valid]:typeof Ut=="boolean"&&Ut,[de.invalid]:typeof Ut=="boolean"&&!Ut}),[Se.disabled,Se.invalid,Se.queryBuilder,Se.valid,ot,ht,Ut]),Un=C.useCallback(ie=>Ee(ie??Nr),[Ee,Nr]),xl=C.useMemo(()=>({addRuleToNewGroups:pt,accessibleDescriptionGenerator:P,autoSelectField:Ce,autoSelectOperator:He,autoSelectValue:St,classNames:Se,combinators:Y,controls:ze,createRule:ce,createRuleGroup:Un,disabledPaths:Uo,enableDragAndDrop:We,fieldMap:L,fields:ge,dispatchQuery:ft,getQuery:at,getInputType:j,getOperators:te,getMatchModes:fe,getRuleClassname:a,getRuleGroupClassname:l,getSubQueryBuilderProps:X,getValueEditorSeparator:n,getValueEditorType:se,getValues:le,getValueSources:ve,independentCombinators:Nr,listsAsArrays:Cr,maxLevels:kt,parseNumbers:F,qbId:z,showCloneButtons:V,showCombinatorsBetweenRules:_,showLockButtons:G,showMuteButtons:O,showNotToggle:A,showShiftActions:I,suppressStandardClassnames:ht,validationMap:Bn}),[P,pt,Ce,He,St,Y,Se,ze,ce,Un,Uo,ft,We,L,ge,j,te,fe,at,a,l,X,n,se,le,ve,Nr,Cr,kt,F,z,V,_,G,O,A,I,ht,Bn]);return{actions:C.useMemo(()=>({moveRule:Vn,onGroupAdd:Fn,onGroupRemove:Wo,onPropChange:Gn,onRuleAdd:Ln,onRuleRemove:Wo,groupRule:zn}),[zn,Vn,Fn,Gn,Ln,Wo]),rootGroup:mt,rootGroupDisabled:ml,queryDisabled:ot,rqbContext:hl,schema:xl,translations:he,wrapperClassName:vl,dndEnabledAttr:gl,inlineCombinatorsAttr:bl,combinatorPropObject:yl}}const ug=(e,t,r)=>{const o=ct(e);if(t.operator==="between"||t.operator==="notBetween"){const n=[o,o];return r?n:ec(n.map(a=>a??""),",")}return o},uD=e=>{const[t]=C.useState(zt),{fields:r,baseField:o,operators:n,baseOperator:a,combinators:l,baseCombinator:i,translations:c,enableMountQueryChange:d=!0,controlClassnames:p,controlElements:u,getDefaultField:f,getDefaultOperator:h,getDefaultValue:b,getMatchModes:g,getOperators:y,getSubQueryBuilderProps:x,getValueEditorType:v,getValueSources:w,getInputType:S,getValues:E,autoSelectField:N=!0,autoSelectOperator:T=!0,autoSelectValue:k=!0,addRuleToNewGroups:M=!1,enableDragAndDrop:D,listsAsArrays:U=!1,debugMode:$=!1,idGenerator:F=zt}=e,[q]=C.useState(e.query??e.defaultQuery),R=ND({controlClassnames:p,controlElements:u,debugMode:$,enableDragAndDrop:D,enableMountQueryChange:d,translations:c,initialQuery:q,qbId:t,finalize:!0}),{translations:W}=R,{fields:Q,fieldMap:P}=ig({fields:r,baseField:o,autoSelectField:N,translations:W}),{optionList:z}=C.useMemo(()=>gn({optionList:l??pn,labelMap:ck,baseOption:i,autoSelectOption:!0}),[i,l]),{optionList:pe}=C.useMemo(()=>gn({optionList:n??dk,placeholder:W.operators,labelMap:Ah,baseOption:a,autoSelectOption:T}),[T,a,n,W.operators]),ge=C.useCallback((H,{fieldData:j})=>gn({optionList:(j==null?void 0:j.operators)??(y==null?void 0:y(H,{fieldData:j}))??pe,placeholder:W.operators,baseOption:a,labelMap:Ah,autoSelectOption:T}).optionList,[T,a,y,pe,W.operators]),L=C.useCallback(H=>{const j=P[H];return j!=null&&j.defaultOperator?j.defaultOperator:h?typeof h=="function"?h(H,{fieldData:j}):h:ct(ge(H,{fieldData:j})??[])??""},[P,h,ge]),Y=C.useCallback((H,j,{fieldData:ce})=>ce.valueEditorType?typeof ce.valueEditorType=="function"?ce.valueEditorType(j):ce.valueEditorType:(v==null?void 0:v(H,j,{fieldData:ce}))??"text",[v]),te=C.useCallback((H,j,ce)=>Wh(P[H],j,w),[P,w]),fe=C.useCallback((H,j)=>wk(P[H],g),[P,g]),K=C.useCallback((H,j)=>(x==null?void 0:x(H,j))??{},[x]),X=C.useCallback((H,j,{fieldData:ce})=>gn({optionList:(ce==null?void 0:ce.values)??(E==null?void 0:E(H,j,{fieldData:ce}))??[],placeholder:W.values,autoSelectOption:k}).optionList,[k,E,W.values]),se=C.useCallback(H=>{const j=P[H.field]??{};if((j==null?void 0:j.defaultValue)!==void 0&&j.defaultValue!==null)return j.defaultValue;if(b)return b(H,{fieldData:j});let ce="";const Ee=X(H.field,H.operator,{fieldData:j});if(H.valueSource==="field"){const Se=Gh(j,Q,H.operator);ce=Se.length>0?ug(Se,H,U):""}else if(Ee.length>0){const Se=Y(H.field,H.operator,{fieldData:j});Se==="multiselect"?ce=U?[]:"":(Se==="select"||Se==="radio")&&(ce=ug(Ee,H,U))}else Y(H.field,H.operator,{fieldData:j})==="checkbox"&&(ce=!1);return ce},[P,Q,b,Y,X,U]),ve=C.useCallback((H,j,{fieldData:ce})=>{if(S){const Ee=S(H,j,{fieldData:ce});if(Ee)return Ee}return"text"},[S]),le=C.useCallback(()=>{let H="";const j=Q;if((j==null?void 0:j.length)>0&&j[0]){const We=ct(j);We&&(H=We)}if(f)if(typeof f=="function"){const We=f(j);We&&(H=We)}else H=f;const ce=L(H),Ee=ct(te(H,ce,{fieldData:Io(j,H)}))??"value",Se=ct(fe(H,{fieldData:Io(j,H)})),ze={id:F(),field:H,operator:ce,valueSource:Ee,value:"",...Se?{match:{mode:Se,threshold:1}}:null},Ye=se(ze);return{...ze,value:Ye}},[Q,f,fe,L,se,te,F]);return{qbId:t,rqbContext:R,fields:Q,fieldMap:P,combinators:z,getMatchModesMain:fe,getOperatorsMain:ge,getRuleDefaultOperator:L,getSubQueryBuilderPropsMain:K,getValueEditorTypeMain:Y,getValueSourcesMain:te,getValuesMain:X,getRuleDefaultValue:se,getInputTypeMain:ve,createRule:le,createRuleGroup:C.useCallback(H=>H?{id:F(),rules:M?[le()]:[],not:!1}:{id:F(),rules:M?[le()]:[],combinator:ct(z)??"",not:!1},[M,z,le,F])}},pg=e=>dD(e,uD(e)),jc=C.createContext({}),pD=m.memo(function(t){const r=fg(t),{schema:{controls:{ruleGroupBodyElements:o,ruleGroupHeaderElements:n}}}=r,a=Qe(r.addRule),l=Qe(r.addGroup),i=Qe(r.cloneGroup),c=Qe(r.toggleLockGroup),d=Qe(r.toggleMuteGroup),p=Qe(r.removeGroup),u=Qe(r.shiftGroupUp),f=Qe(r.shiftGroupDown),h=C.useMemo(()=>({addRule:a,addGroup:l,cloneGroup:i,toggleLockGroup:c,toggleMuteGroup:d,removeGroup:p,shiftGroupUp:u,shiftGroupDown:f}),[a,l,i,c,d,p,u,f]);return m.createElement("div",{ref:r.previewRef,title:r.accessibleDescription,className:r.outerClassName,"data-testid":ue.ruleGroup,"data-not":r.ruleGroup.not?"true":void 0,"data-dragmonitorid":r.dragMonitorId,"data-dropmonitorid":r.dropMonitorId,"data-rule-group-id":r.id,"data-level":r.path.length,"data-path":JSON.stringify(r.path)},m.createElement("div",{ref:r.dropRef,className:r.classNames.header},m.createElement(n,{...r,...h})),m.createElement("div",{className:r.classNames.body},m.createElement(o,{...r,...h})))}),fD=m.memo(function(t){const{schema:{controls:{shiftActions:r,dragHandle:o,combinatorSelector:n,notToggle:a,addRuleAction:l,addGroupAction:i,cloneGroupAction:c,lockGroupAction:d,muteGroupAction:p,removeGroupAction:u}}}=t,f=C.useMemo(()=>({level:t.path.length,path:t.path,disabled:t.disabled,context:t.context,validation:t.validationResult,schema:t.schema}),[t.path,t.disabled,t.context,t.validationResult,t.schema]),h=C.useMemo(()=>t.schema.showShiftActions?{shiftUp:t.translations.shiftActionUp.title,shiftDown:t.translations.shiftActionDown.title}:void 0,[t.schema.showShiftActions,t.translations]),b=C.useMemo(()=>t.schema.showShiftActions?{shiftUp:t.translations.shiftActionUp.label,shiftDown:t.translations.shiftActionDown.label}:void 0,[t.schema.showShiftActions,t.translations]);return m.createElement(C.Fragment,null,t.schema.showShiftActions&&t.path.length>0&&m.createElement(r,{key:ue.shiftActions,...f,testID:ue.shiftActions,titles:h,labels:b,className:t.classNames.shiftActions,shiftUp:t.shiftGroupUp,shiftDown:t.shiftGroupDown,shiftUpDisabled:t.shiftUpDisabled,shiftDownDisabled:t.shiftDownDisabled,ruleOrGroup:t.ruleGroup}),t.path.length>0&&t.schema.enableDragAndDrop&&m.createElement(o,{key:ue.dragHandle,...f,testID:ue.dragHandle,ref:t.dragRef,title:t.translations.dragHandle.title,label:t.translations.dragHandle.label,className:t.classNames.dragHandle,ruleOrGroup:t.ruleGroup}),!t.schema.showCombinatorsBetweenRules&&!t.schema.independentCombinators&&m.createElement(n,{key:ue.combinators,...f,testID:ue.combinators,options:t.schema.combinators,value:t.combinator,title:t.translations.combinators.title,className:t.classNames.combinators,handleOnChange:t.onCombinatorChange,rules:t.ruleGroup.rules,ruleGroup:t.ruleGroup}),t.schema.showNotToggle&&m.createElement(a,{key:ue.notToggle,...f,testID:ue.notToggle,className:t.classNames.notToggle,title:t.translations.notToggle.title,label:t.translations.notToggle.label,checked:t.ruleGroup.not,handleOnChange:t.onNotToggleChange,ruleGroup:t.ruleGroup}),m.createElement(l,{key:ue.addRule,...f,testID:ue.addRule,label:t.translations.addRule.label,title:t.translations.addRule.title,className:t.classNames.addRule,handleOnClick:t.addRule,rules:t.ruleGroup.rules,ruleOrGroup:t.ruleGroup}),t.schema.maxLevels>t.path.length&&m.createElement(i,{key:ue.addGroup,...f,testID:ue.addGroup,label:t.translations.addGroup.label,title:t.translations.addGroup.title,className:t.classNames.addGroup,handleOnClick:t.addGroup,rules:t.ruleGroup.rules,ruleOrGroup:t.ruleGroup}),t.schema.showCloneButtons&&t.path.length>0&&m.createElement(c,{key:ue.cloneGroup,...f,testID:ue.cloneGroup,label:t.translations.cloneRuleGroup.label,title:t.translations.cloneRuleGroup.title,className:t.classNames.cloneGroup,handleOnClick:t.cloneGroup,rules:t.ruleGroup.rules,ruleOrGroup:t.ruleGroup}),t.schema.showLockButtons&&m.createElement(d,{key:ue.lockGroup,...f,testID:ue.lockGroup,label:t.translations.lockGroup.label,title:t.translations.lockGroup.title,className:t.classNames.lockGroup,handleOnClick:t.toggleLockGroup,rules:t.ruleGroup.rules,disabledTranslation:t.parentDisabled?void 0:t.translations.lockGroupDisabled,ruleOrGroup:t.ruleGroup}),t.schema.showMuteButtons&&m.createElement(p,{key:ue.muteGroup,...f,testID:ue.muteGroup,label:t.ruleGroup.muted?t.translations.unmuteGroup.label:t.translations.muteGroup.label,title:t.ruleGroup.muted?t.translations.unmuteGroup.title:t.translations.muteGroup.title,className:t.classNames.muteGroup,handleOnClick:t.toggleMuteGroup,rules:t.ruleGroup.rules,ruleOrGroup:t.ruleGroup}),t.path.length>0&&m.createElement(u,{key:ue.removeGroup,...f,testID:ue.removeGroup,label:t.translations.removeGroup.label,title:t.translations.removeGroup.title,className:t.classNames.removeGroup,handleOnClick:t.removeGroup,rules:t.ruleGroup.rules,ruleOrGroup:t.ruleGroup}))}),hD=m.memo(function(t){const{schema:{controls:{combinatorSelector:r,inlineCombinator:o,ruleGroup:n,rule:a}}}=t;return m.createElement(C.Fragment,null,t.ruleGroup.rules.map((l,i,{length:c})=>{const d=t.pathsMemo[i],p=d.path,u=d.disabled||typeof l!="string"&&l.disabled,f=no([0],p),h=t.path.length===0&&i===c-1,b=typeof l=="string"?[...p,l].join("-"):l.id;return m.createElement(C.Fragment,{key:b},i>0&&!t.schema.independentCombinators&&t.schema.showCombinatorsBetweenRules&&m.createElement(o,{key:ue.inlineCombinator,options:t.schema.combinators,value:t.combinator,title:t.translations.combinators.title,className:t.classNames.combinators,handleOnChange:t.onCombinatorChange,rules:t.ruleGroup.rules,level:t.path.length,context:t.context,validation:t.validationResult,component:r,path:p,disabled:t.disabled,schema:t.schema,ruleGroup:t.ruleGroup}),typeof l=="string"?m.createElement(o,{key:`${ue.inlineCombinator}-independent`,options:t.schema.combinators,value:l,title:t.translations.combinators.title,className:t.classNames.combinators,handleOnChange:g=>t.onIndependentCombinatorChange(g,i),rules:t.ruleGroup.rules,level:t.path.length,context:t.context,validation:t.validationResult,component:r,path:p,disabled:u,schema:t.schema,ruleGroup:t.ruleGroup}):Ge(l)?m.createElement(n,{key:ue.ruleGroup,id:l.id,schema:t.schema,actions:t.actions,path:p,translations:t.translations,ruleGroup:l,rules:l.rules,combinator:hn(l)?l.combinator:void 0,not:!!l.not,disabled:u,parentDisabled:t.parentDisabled||t.disabled,parentMuted:t.parentMuted||t.muted,shiftUpDisabled:f,shiftDownDisabled:h,context:t.context}):m.createElement(a,{key:ue.rule,id:l.id,rule:l,field:l.field,operator:l.operator,value:l.value,valueSource:l.valueSource,schema:t.schema,actions:t.actions,path:p,disabled:u,parentDisabled:t.parentDisabled||t.disabled,parentMuted:t.parentMuted||t.muted,translations:t.translations,shiftUpDisabled:f,shiftDownDisabled:h,context:t.context}))}))}),fg=e=>{const{id:t,path:r,ruleGroup:o,schema:{qbId:n,accessibleDescriptionGenerator:a,classNames:l,combinators:i,createRule:c,createRuleGroup:d,disabledPaths:p,independentCombinators:u,validationMap:f,enableDragAndDrop:h,getRuleGroupClassname:b,suppressStandardClassnames:g},actions:{onGroupAdd:y,onGroupRemove:x,onPropChange:v,onRuleAdd:w,moveRule:S},disabled:E,parentDisabled:N,parentMuted:T,shiftUpDisabled:k,shiftDownDisabled:M,combinator:D,rules:U,not:$,dropEffect:F="move",groupItems:q=!1,dragMonitorId:R="",dropMonitorId:W="",previewRef:Q=null,dragRef:P=null,dropRef:z=null,isDragging:pe=!1,isOver:ge=!1,dropNotAllowed:L=!1}=e;Wc("ruleGroup",!o),mg(h,!!(R||W||Q||P||z));const Y=!!N||!!E,te=!!T||!!(o!=null&&o.muted),fe=C.useMemo(()=>o&&hn(o)?o.combinator:o?ct(i):D??ct(i),[D,i,o]),K=C.useMemo(()=>{if(o){if(o.combinator===fe||u)return o;const O=structuredClone(o);return O.combinator=fe,O}return{rules:U,not:$}},[fe,u,$,o,U]),X=C.useMemo(()=>({header:De(g||de.header,l.header,ge&&F==="copy"&&l.dndCopy,L&&l.dndDropNotAllowed,g||{[de.dndOver]:ge,[de.dndCopy]:ge&&F==="copy",[de.dndDropNotAllowed]:L}),shiftActions:De(g||de.shiftActions,l.shiftActions),dragHandle:De(g||de.dragHandle,l.dragHandle),combinators:De(g||de.combinators,l.valueSelector,l.combinators),notToggle:De(g||de.notToggle,l.notToggle),addRule:De(g||de.addRule,l.actionElement,l.addRule),addGroup:De(g||de.addGroup,l.actionElement,l.addGroup),cloneGroup:De(g||de.cloneGroup,l.actionElement,l.cloneGroup),lockGroup:De(g||de.lockGroup,l.actionElement,l.lockGroup),muteGroup:De(g||de.muteGroup,l.actionElement,l.muteGroup),removeGroup:De(g||de.removeGroup,l.actionElement,l.removeGroup),body:De(g||de.body,l.body)}),[l.actionElement,l.addGroup,l.addRule,l.body,l.cloneGroup,l.combinators,l.dndCopy,l.dndDropNotAllowed,l.dragHandle,l.header,l.lockGroup,l.muteGroup,l.notToggle,l.removeGroup,l.shiftActions,l.valueSelector,F,L,ge,g]),se=C.useCallback(O=>{Y||v("combinator",O,r)},[Y,v,r]),ve=C.useCallback((O,Z,me)=>{Y||v("combinator",O,[...r,Z])},[Y,v,r]),le=C.useCallback((O,Z)=>{Y||v("not",O,r)},[Y,v,r]),H=C.useCallback((O,Z)=>{Y||w(c(),r,Z)},[c,Y,w,r]),j=C.useCallback((O,Z)=>{Y||y(d(),r,Z)},[d,Y,y,r]),ce=C.useCallback(()=>{Y||S(r,[...qe(r),r.at(-1)+1],!0)},[Y,S,r]),Ee=C.useCallback((O,Z)=>{!Y&&!k&&S(r,"up",O==null?void 0:O.altKey)},[Y,S,r,k]),Se=C.useCallback((O,Z)=>{!Y&&!M&&S(r,"down",O==null?void 0:O.altKey)},[Y,S,r,M]),ze=C.useCallback(()=>{v("disabled",!Y,r)},[Y,v,r]),Ye=C.useCallback(()=>{v("muted",!K.muted,r)},[K.muted,v,r]),We=C.useCallback(()=>{Y||x(r)},[Y,x,r]),Re=f[t??""],he=C.useMemo(()=>Bh(Re),[Re]),_=C.useMemo(()=>{var O;return u?null:((O=Io(i,fe))==null?void 0:O.className)??""},[fe,i,u]),A=C.useMemo(()=>b(K),[b,K]),I=C.useMemo(()=>De(A,_,g||de.ruleGroup,l.ruleGroup,Y&&l.disabled,te&&l.muted,pe&&l.dndDragging,ge&&q&&l.dndGroup,g||{[de.disabled]:Y,[de.muted]:te,[de.dndDragging]:pe,[de.dndGroup]:ge&&q},he),[l.disabled,l.muted,l.dndDragging,l.dndGroup,l.ruleGroup,_,Y,te,q,pe,ge,A,g,he]),V=ED({disabled:Y,disabledPaths:p,path:r,nestedArray:K.rules}),G=C.useMemo(()=>a({path:r,qbId:n}),[a,r,n]);return{...e,addGroup:j,addRule:H,accessibleDescription:G,classNames:X,cloneGroup:ce,combinator:fe,disabled:Y,dragMonitorId:R,dragRef:P,dropMonitorId:W,dropRef:z,isDragging:pe,isOver:ge,muted:te,onCombinatorChange:se,onGroupAdd:y,onIndependentCombinatorChange:ve,onNotToggleChange:le,outerClassName:I,parentDisabled:N,pathsMemo:V,previewRef:Q,removeGroup:We,ruleGroup:K,shiftGroupUp:Ee,shiftGroupDown:Se,toggleLockGroup:ze,toggleMuteGroup:Ye,validationClassName:he,validationResult:Re}},mD=e=>{var t,r,o,n;return m.createElement("div",{"data-testid":e.testID,className:e.className},m.createElement("button",{disabled:e.disabled||e.shiftUpDisabled,onClick:e.shiftUp,title:(t=e.titles)==null?void 0:t.shiftUp},(r=e.labels)==null?void 0:r.shiftUp),m.createElement("button",{disabled:e.disabled||e.shiftDownDisabled,onClick:e.shiftDown,title:(o=e.titles)==null?void 0:o.shiftDown},(n=e.labels)==null?void 0:n.shiftDown))},gD=({name:e,disabled:t,checked:r,label:o,handleOnChange:n})=>{const a=m.useId();return m.createElement("label",{htmlFor:a},m.createElement("input",{id:a,type:"radio",value:e,disabled:t,checked:r,onChange:l=>n(l.target.value)}),o)},bD=e=>{const{operator:t,value:r,handleOnChange:o,title:n,className:a,type:l="text",inputType:i,values:c=[],listsAsArrays:d,fieldData:p,disabled:u,separator:f=null,testID:h,selectorComponent:b=e.schema.controls.valueSelector,parseNumbers:g,skipHook:y,valueSource:x,...v}=e,{valueAsArray:w,multiValueHandler:S,bigIntValueHandler:E,parseNumberMethod:N,valueListItemClassName:T,inputTypeCoerced:k}=yD(e);if(t==="null"||t==="notNull")return null;const M=(p==null?void 0:p.placeholder)??"";if((t==="between"||t==="notBetween")&&(l==="select"||l==="text")){const D=["from","to"].map((U,$)=>l==="text"?m.createElement("input",{key:U,type:k,placeholder:M,value:w[$]??"",className:T,disabled:u,onChange:F=>S(F.target.value,$)}):m.createElement(b,{key:U,...v,schema:e.schema,className:T,handleOnChange:F=>S(F,$),disabled:u,value:w[$]??ct(c),options:c,listsAsArrays:d}));return m.createElement("span",{"data-testid":h,className:a,title:n},D[0],f,D[1])}switch(l){case"select":case"multiselect":return m.createElement(b,{...v,schema:e.schema,testID:h,className:a,title:n,handleOnChange:o,disabled:u,value:r,options:c,multiple:l==="multiselect",listsAsArrays:d});case"textarea":return m.createElement("textarea",{"data-testid":h,placeholder:M,value:r,title:n,className:a,disabled:u,onChange:D=>o(D.target.value)});case"switch":case"checkbox":return m.createElement("input",{"data-testid":h,type:"checkbox",className:a,title:n,onChange:D=>o(D.target.checked),checked:!!r,disabled:u});case"radio":return m.createElement("span",{"data-testid":h,className:a,title:n},c.map(D=>m.createElement(gD,{key:D.name,name:D.name,disabled:u,checked:r===D.name,handleOnChange:o,label:D.label})))}return i==="bigint"?m.createElement("input",{"data-testid":h,type:k,placeholder:M,value:`${r}`,title:n,className:a,disabled:u,onChange:D=>E(D.target.value)}):m.createElement("input",{"data-testid":h,type:k,placeholder:M,value:r,title:n,className:a,disabled:u,onChange:D=>o(hs(D.target.value,{parseNumbers:N}))})},yD=e=>{const{handleOnChange:t,inputType:r,operator:o,value:n,listsAsArrays:a,parseNumbers:l,values:i,type:c,skipHook:d,schema:{classNames:p,suppressStandardClassnames:u}}=e;C.useEffect(()=>{!d&&c!=="multiselect"&&!["between","notBetween","in","notIn"].includes(o)&&(Array.isArray(n)||r==="number"&&typeof n=="string"&&n.includes(","))&&t(us(n,{retainEmptyStrings:!0})[0]??"")},[t,r,o,d,c,n]);const f=C.useMemo(()=>us(n,{retainEmptyStrings:!0}),[n]),h=C.useMemo(()=>bk({parseNumbers:l,inputType:r}),[r,l]);return{valueAsArray:f,multiValueHandler:C.useCallback((b,g)=>{const y=F_(f,x=>{x[g]=hs(b,{parseNumbers:h}),g===0&&(o==="between"||o==="notBetween")&&(x.length<2||x[1]===void 0)&&(x[1]=ct(i))});t(a?y:ec(y,","))},[t,a,o,h,f,i]),bigIntValueHandler:C.useCallback(b=>{const g=hs(b,{parseNumbers:h,bigIntOnOverflow:!0});let y;try{y=BigInt(g)}catch{t(g);return}t(y)},[t,h]),parseNumberMethod:h,valueListItemClassName:De(u||de.valueListItem,p==null?void 0:p.valueListItem),inputTypeCoerced:r==="bigint"||o==="in"||o==="notIn"?"text":r||"text"}},vD=e=>{const{multiple:t,onChange:r}=e;return C.useMemo(()=>t?o=>r(Array.from(o.target.selectedOptions).map(n=>n.value)):o=>r(o.target.value),[t,r])},xD=e=>gk(e)?e.map(t=>m.createElement("optgroup",{key:t.label,label:t.label},t.options.map(r=>m.createElement("option",{key:r.name,value:r.name,disabled:r.disabled},r.label)))):Array.isArray(e)?e.map(t=>m.createElement("option",{key:t.name,value:t.name,disabled:t.disabled},t.label)):null,An=e=>{const{onChange:t,val:r}=wD(e),o=vD({multiple:e.multiple,onChange:t});return m.createElement("select",{"data-testid":e.testID,className:e.className,value:r,title:e.title,disabled:e.disabled,multiple:!!e.multiple,onChange:o},xD(e.options))},wD=e=>{const{handleOnChange:t,listsAsArrays:r=!1,multiple:o=!1,value:n}=e;return{onChange:C.useCallback(a=>{if(o){const l=us(a);t(r?l:ec(l,","))}else t(a)},[t,r,o]),val:C.useMemo(()=>o?us(n):n,[o,n])}},SD=({props:e})=>{const t=pg(e),r=t.schema.controls.ruleGroup,o=jc;return m.createElement(o.Provider,{key:t.dndEnabledAttr,value:t.rqbContext},m.createElement("div",{role:"form",className:t.wrapperClassName,"data-dnd":t.dndEnabledAttr,"data-inlinecombinators":t.inlineCombinatorsAttr},m.createElement(r,{translations:t.translations,ruleGroup:t.rootGroup,rules:t.rootGroup.rules,...t.combinatorPropObject,not:!!t.rootGroup.not,schema:t.schema,actions:t.actions,id:t.rootGroup.id,path:Mh,disabled:t.rootGroupDisabled,shiftUpDisabled:!0,shiftDownDisabled:!0,parentDisabled:t.queryDisabled,context:e.context})))},Rs=()=>null,CD=C.forwardRef(Rs),el={},ND=({finalize:e,...t})=>{var b,g,y,x,v,w,S,E,N,T,k,M,D,U,$,F,q,R,W,Q,P,z,pe,ge,L,Y,te,fe,K,X,se,ve,le,H,j,ce,Ee,Se,ze,Ye,We,Re,he,_,A,I,V,G,O,Z,me,Ce,He,St,pt,Cr,ht,kt,Te,je,Ct,Zt,Me,at,Vo,zo,mt,On,hl,Nr,Bo,$n,ft,Uo,ot,ml,Ln,Fn,Gn,Wo,Vn,zn,Ut,Bn,gl,bl,yl,vl,Un,xl,ie,ke,Ie,Ae,_e,st,gt,Wr,cr,Hr,Cb,Nb,Eb,kb,_b,Db;const r=C.useContext(jc),o=C.useMemo(()=>kk(t,r),[t,r,e]),n=e?r.enableDragAndDrop!==!1&&Hh(!1,t.enableDragAndDrop,r.enableDragAndDrop):t.enableDragAndDrop??r.enableDragAndDrop,a=C.useMemo(()=>Ck(Object.assign({},uk),r.controlClassnames,t.controlClassnames),[r.controlClassnames,t.controlClassnames,e]),l=C.useMemo(()=>({actionElement:a.actionElement,addGroup:a.addGroup,addRule:a.addRule,body:a.body,cloneGroup:a.cloneGroup,cloneRule:a.cloneRule,combinators:a.combinators,dragHandle:a.dragHandle,fields:a.fields,header:a.header,lockGroup:a.lockGroup,lockRule:a.lockRule,muteGroup:a.muteGroup,muteRule:a.muteRule,muted:a.muted,notToggle:a.notToggle,operators:a.operators,queryBuilder:a.queryBuilder,removeGroup:a.removeGroup,removeRule:a.removeRule,rule:a.rule,ruleGroup:a.ruleGroup,shiftActions:a.shiftActions,value:a.value,valueSelector:a.valueSelector,valueSource:a.valueSource,betweenRules:a.betweenRules,valid:a.valid,invalid:a.invalid,dndDragging:a.dndDragging,dndOver:a.dndOver,dndCopy:a.dndCopy,dndGroup:a.dndGroup,dndDropNotAllowed:a.dndDropNotAllowed,disabled:a.disabled,valueListItem:a.valueListItem,matchMode:a.matchMode,matchThreshold:a.matchThreshold,branches:a.branches,hasSubQuery:a.hasSubQuery,loading:a.loading}),[a.actionElement,a.addGroup,a.addRule,a.betweenRules,a.body,a.branches,a.cloneGroup,a.cloneRule,a.combinators,a.disabled,a.dndCopy,a.dndDropNotAllowed,a.dndGroup,a.dndDragging,a.dndOver,a.dragHandle,a.fields,a.hasSubQuery,a.header,a.invalid,a.loading,a.lockGroup,a.lockRule,a.muteGroup,a.muteRule,a.muted,a.matchMode,a.matchThreshold,a.notToggle,a.operators,a.queryBuilder,a.removeGroup,a.removeRule,a.rule,a.ruleGroup,a.shiftActions,a.valid,a.value,a.valueListItem,a.valueSelector,a.valueSource]),i=r.controlElements??el,c=t.controlElements??el,d=C.useCallback((Rt,Wn,Hn)=>{const jn=Rt==="dragHandle"?CD:Rs,wl=(Rt.endsWith("Action")&&c.actionElement?c.actionElement:void 0)??(Rt.endsWith("Selector")&&c.valueSelector?c.valueSelector:void 0),Sl=(Rt.endsWith("Action")&&i.actionElement?i.actionElement:void 0)??(Rt.endsWith("Selector")&&i.valueSelector?i.valueSelector:void 0),Yn=Wn===null?jn:Wn??wl??(Hn===null?jn:Hn??Sl);return Yn?{[Rt]:Yn}:{[Rt]:tl[Rt]}},[i.actionElement,i.valueSelector,e,c.actionElement,c.valueSelector]),p=C.useMemo(()=>Object.assign({},d("addGroupAction",c.addGroupAction,i.addGroupAction),d("addRuleAction",c.addRuleAction,i.addRuleAction),d("cloneGroupAction",c.cloneGroupAction,i.cloneGroupAction),d("cloneRuleAction",c.cloneRuleAction,i.cloneRuleAction),d("combinatorSelector",c.combinatorSelector,i.combinatorSelector),d("dragHandle",c.dragHandle,i.dragHandle),d("fieldSelector",c.fieldSelector,i.fieldSelector),d("inlineCombinator",c.inlineCombinator,i.inlineCombinator),d("lockGroupAction",c.lockGroupAction,i.lockGroupAction),d("lockRuleAction",c.lockRuleAction,i.lockRuleAction),d("muteGroupAction",c.muteGroupAction,i.muteGroupAction),d("muteRuleAction",c.muteRuleAction,i.muteRuleAction),d("notToggle",c.notToggle,i.notToggle),d("operatorSelector",c.operatorSelector,i.operatorSelector),d("removeGroupAction",c.removeGroupAction,i.removeGroupAction),d("removeRuleAction",c.removeRuleAction,i.removeRuleAction),d("shiftActions",c.shiftActions,i.shiftActions),{valueEditor:c.valueEditor===null?Rs:c.valueEditor??(i.valueEditor===null?Rs:i.valueEditor)??tl.valueEditor},d("valueSourceSelector",c.valueSourceSelector,i.valueSourceSelector),d("matchModeEditor",c.matchModeEditor,i.matchModeEditor),d("rule",c.rule,i.rule),d("ruleGroup",c.ruleGroup,i.ruleGroup),d("ruleGroupBodyElements",c.ruleGroupBodyElements,i.ruleGroupBodyElements),d("ruleGroupHeaderElements",c.ruleGroupHeaderElements,i.ruleGroupHeaderElements),{actionElement:c.actionElement??i.actionElement??tl.actionElement},{valueSelector:c.valueSelector??i.valueSelector??tl.valueSelector}),[i.actionElement,i.addGroupAction,i.addRuleAction,i.cloneGroupAction,i.cloneRuleAction,i.combinatorSelector,i.dragHandle,i.fieldSelector,i.inlineCombinator,i.lockGroupAction,i.lockRuleAction,i.muteGroupAction,i.muteRuleAction,i.matchModeEditor,i.notToggle,i.operatorSelector,i.removeGroupAction,i.removeRuleAction,i.rule,i.ruleGroup,i.ruleGroupBodyElements,i.ruleGroupHeaderElements,i.shiftActions,i.valueEditor,i.valueSelector,i.valueSourceSelector,d,e,c.actionElement,c.addGroupAction,c.addRuleAction,c.cloneGroupAction,c.cloneRuleAction,c.combinatorSelector,c.dragHandle,c.fieldSelector,c.inlineCombinator,c.lockGroupAction,c.lockRuleAction,c.muteGroupAction,c.muteRuleAction,c.matchModeEditor,c.notToggle,c.operatorSelector,c.removeGroupAction,c.removeRuleAction,c.rule,c.ruleGroup,c.ruleGroupBodyElements,c.ruleGroupHeaderElements,c.shiftActions,c.valueEditor,c.valueSelector,c.valueSourceSelector]),u=t.translations??el,f=r.translations??el,h=C.useMemo(()=>{var Rt,Wn,Hn,jn,wl,Sl,Yn,Ab,Tb,Mb,Ib,Pb,Ob,$b,Lb,Fb,Gb,Vb,zb,Bb,Ub,Wb,Hb,jb,Yb,qb,Qb,Kb,Xb,Jb,Zb,Rb,ey,ty,ry,oy,ny,ay,sy,ly,iy,cy,dy,uy,py,fy,hy,my,gy,by,yy,vy,xy,wy,Sy,Cy,Ny,Ey,ky,_y,Dy,Ay,Ty,My,Iy,Py,Oy,$y,Ly,Fy,Gy,Vy,zy,By,Uy,Wy,Hy,jy,Yy,qy,Qy,Ky,Xy,Jy,Zy,Ry,ev,tv,rv,ov,nv,av,sv,lv,iv,cv,dv,uv,pv,fv,hv,mv,gv,bv,yv,vv;return Object.assign({},Le("addGroup",{label:[(Rt=u.addGroup)==null?void 0:Rt.label,(Wn=f.addGroup)==null?void 0:Wn.label],title:[(Hn=u.addGroup)==null?void 0:Hn.title,(jn=f.addGroup)==null?void 0:jn.title]},$e),Le("addRule",{label:[(wl=u.addRule)==null?void 0:wl.label,(Sl=f.addRule)==null?void 0:Sl.label],title:[(Yn=u.addRule)==null?void 0:Yn.title,(Ab=f.addRule)==null?void 0:Ab.title]},$e),Le("cloneRule",{label:[(Tb=u.cloneRule)==null?void 0:Tb.label,(Mb=f.cloneRule)==null?void 0:Mb.label],title:[(Ib=u.cloneRule)==null?void 0:Ib.title,(Pb=f.cloneRule)==null?void 0:Pb.title]},$e),Le("cloneRuleGroup",{label:[(Ob=u.cloneRuleGroup)==null?void 0:Ob.label,($b=f.cloneRuleGroup)==null?void 0:$b.label],title:[(Lb=u.cloneRuleGroup)==null?void 0:Lb.title,(Fb=f.cloneRuleGroup)==null?void 0:Fb.title]},$e),Le("combinators",{title:[(Gb=u.combinators)==null?void 0:Gb.title,(Vb=f.combinators)==null?void 0:Vb.title]},$e),Le("dragHandle",{label:[(zb=u.dragHandle)==null?void 0:zb.label,(Bb=f.dragHandle)==null?void 0:Bb.label],title:[(Ub=u.dragHandle)==null?void 0:Ub.title,(Wb=f.dragHandle)==null?void 0:Wb.title]},$e),Le("fields",{placeholderGroupLabel:[(Hb=u.fields)==null?void 0:Hb.placeholderGroupLabel,(jb=f.fields)==null?void 0:jb.placeholderGroupLabel],placeholderLabel:[(Yb=u.fields)==null?void 0:Yb.placeholderLabel,(qb=f.fields)==null?void 0:qb.placeholderLabel],placeholderName:[(Qb=u.fields)==null?void 0:Qb.placeholderName,(Kb=f.fields)==null?void 0:Kb.placeholderName],title:[(Xb=u.fields)==null?void 0:Xb.title,(Jb=f.fields)==null?void 0:Jb.title]},$e),Le("lockGroup",{label:[(Zb=u.lockGroup)==null?void 0:Zb.label,(Rb=f.lockGroup)==null?void 0:Rb.label],title:[(ey=u.lockGroup)==null?void 0:ey.title,(ty=f.lockGroup)==null?void 0:ty.title]},$e),Le("lockGroupDisabled",{label:[(ry=u.lockGroupDisabled)==null?void 0:ry.label,(oy=f.lockGroupDisabled)==null?void 0:oy.label],title:[(ny=u.lockGroupDisabled)==null?void 0:ny.title,(ay=f.lockGroupDisabled)==null?void 0:ay.title]},$e),Le("lockRule",{label:[(sy=u.lockRule)==null?void 0:sy.label,(ly=f.lockRule)==null?void 0:ly.label],title:[(iy=u.lockRule)==null?void 0:iy.title,(cy=f.lockRule)==null?void 0:cy.title]},$e),Le("lockRuleDisabled",{label:[(dy=u.lockRuleDisabled)==null?void 0:dy.label,(uy=f.lockRuleDisabled)==null?void 0:uy.label],title:[(py=u.lockRuleDisabled)==null?void 0:py.title,(fy=f.lockRuleDisabled)==null?void 0:fy.title]},$e),Le("muteGroup",{label:[(hy=u.muteGroup)==null?void 0:hy.label,(my=f.muteGroup)==null?void 0:my.label],title:[(gy=u.muteGroup)==null?void 0:gy.title,(by=f.muteGroup)==null?void 0:by.title]},$e),Le("unmuteGroup",{label:[(yy=u.unmuteGroup)==null?void 0:yy.label,(vy=f.unmuteGroup)==null?void 0:vy.label],title:[(xy=u.unmuteGroup)==null?void 0:xy.title,(wy=f.unmuteGroup)==null?void 0:wy.title]},$e),Le("muteRule",{label:[(Sy=u.muteRule)==null?void 0:Sy.label,(Cy=f.muteRule)==null?void 0:Cy.label],title:[(Ny=u.muteRule)==null?void 0:Ny.title,(Ey=f.muteRule)==null?void 0:Ey.title]},$e),Le("unmuteRule",{label:[(ky=u.unmuteRule)==null?void 0:ky.label,(_y=f.unmuteRule)==null?void 0:_y.label],title:[(Dy=u.unmuteRule)==null?void 0:Dy.title,(Ay=f.unmuteRule)==null?void 0:Ay.title]},$e),Le("notToggle",{label:[(Ty=u.notToggle)==null?void 0:Ty.label,(My=f.notToggle)==null?void 0:My.label],title:[(Iy=u.notToggle)==null?void 0:Iy.title,(Py=f.notToggle)==null?void 0:Py.title]},$e),Le("operators",{placeholderGroupLabel:[(Oy=u.operators)==null?void 0:Oy.placeholderGroupLabel,($y=f.operators)==null?void 0:$y.placeholderGroupLabel],placeholderLabel:[(Ly=u.operators)==null?void 0:Ly.placeholderLabel,(Fy=f.operators)==null?void 0:Fy.placeholderLabel],placeholderName:[(Gy=u.operators)==null?void 0:Gy.placeholderName,(Vy=f.operators)==null?void 0:Vy.placeholderName],title:[(zy=u.operators)==null?void 0:zy.title,(By=f.operators)==null?void 0:By.title]},$e),Le("values",{placeholderGroupLabel:[(Uy=u.values)==null?void 0:Uy.placeholderGroupLabel,(Wy=f.values)==null?void 0:Wy.placeholderGroupLabel],placeholderLabel:[(Hy=u.values)==null?void 0:Hy.placeholderLabel,(jy=f.values)==null?void 0:jy.placeholderLabel],placeholderName:[(Yy=u.values)==null?void 0:Yy.placeholderName,(qy=f.values)==null?void 0:qy.placeholderName],title:[(Qy=u.values)==null?void 0:Qy.title,(Ky=f.values)==null?void 0:Ky.title]},$e),Le("removeGroup",{label:[(Xy=u.removeGroup)==null?void 0:Xy.label,(Jy=f.removeGroup)==null?void 0:Jy.label],title:[(Zy=u.removeGroup)==null?void 0:Zy.title,(Ry=f.removeGroup)==null?void 0:Ry.title]},$e),Le("removeRule",{label:[(ev=u.removeRule)==null?void 0:ev.label,(tv=f.removeRule)==null?void 0:tv.label],title:[(rv=u.removeRule)==null?void 0:rv.title,(ov=f.removeRule)==null?void 0:ov.title]},$e),Le("shiftActionDown",{label:[(nv=u.shiftActionDown)==null?void 0:nv.label,(av=f.shiftActionDown)==null?void 0:av.label],title:[(sv=u.shiftActionDown)==null?void 0:sv.title,(lv=f.shiftActionDown)==null?void 0:lv.title]},$e),Le("shiftActionUp",{label:[(iv=u.shiftActionUp)==null?void 0:iv.label,(cv=f.shiftActionUp)==null?void 0:cv.label],title:[(dv=u.shiftActionUp)==null?void 0:dv.title,(uv=f.shiftActionUp)==null?void 0:uv.title]},$e),Le("matchMode",{title:[(pv=u.matchMode)==null?void 0:pv.title,(fv=f.matchMode)==null?void 0:fv.title]},$e),Le("matchThreshold",{title:[(hv=u.matchThreshold)==null?void 0:hv.title,(mv=f.matchThreshold)==null?void 0:mv.title]},$e),Le("value",{title:[(gv=u.value)==null?void 0:gv.title,(bv=f.value)==null?void 0:bv.title]},$e),Le("valueSourceSelector",{title:[(yv=u.valueSourceSelector)==null?void 0:yv.title,(vv=f.valueSourceSelector)==null?void 0:vv.title]},$e))},[(b=f.addGroup)==null?void 0:b.label,(g=f.addGroup)==null?void 0:g.title,(y=f.addRule)==null?void 0:y.label,(x=f.addRule)==null?void 0:x.title,(v=f.cloneRule)==null?void 0:v.label,(w=f.cloneRule)==null?void 0:w.title,(S=f.cloneRuleGroup)==null?void 0:S.label,(E=f.cloneRuleGroup)==null?void 0:E.title,(N=f.combinators)==null?void 0:N.title,(T=f.dragHandle)==null?void 0:T.label,(k=f.dragHandle)==null?void 0:k.title,(M=f.fields)==null?void 0:M.placeholderGroupLabel,(D=f.fields)==null?void 0:D.placeholderLabel,(U=f.fields)==null?void 0:U.placeholderName,($=f.fields)==null?void 0:$.title,(F=f.lockGroup)==null?void 0:F.label,(q=f.lockGroup)==null?void 0:q.title,(R=f.lockGroupDisabled)==null?void 0:R.label,(W=f.lockGroupDisabled)==null?void 0:W.title,(Q=f.lockRule)==null?void 0:Q.label,(P=f.lockRule)==null?void 0:P.title,(z=f.lockRuleDisabled)==null?void 0:z.label,(pe=f.lockRuleDisabled)==null?void 0:pe.title,(ge=f.muteGroup)==null?void 0:ge.label,(L=f.muteGroup)==null?void 0:L.title,(Y=f.unmuteGroup)==null?void 0:Y.label,(te=f.unmuteGroup)==null?void 0:te.title,(fe=f.muteRule)==null?void 0:fe.label,(K=f.muteRule)==null?void 0:K.title,(X=f.unmuteRule)==null?void 0:X.label,(se=f.unmuteRule)==null?void 0:se.title,(ve=f.matchMode)==null?void 0:ve.title,(le=f.matchThreshold)==null?void 0:le.title,(H=f.notToggle)==null?void 0:H.label,(j=f.notToggle)==null?void 0:j.title,(ce=f.operators)==null?void 0:ce.placeholderGroupLabel,(Ee=f.operators)==null?void 0:Ee.placeholderLabel,(Se=f.operators)==null?void 0:Se.placeholderName,(ze=f.operators)==null?void 0:ze.title,(Ye=f.removeGroup)==null?void 0:Ye.label,(We=f.removeGroup)==null?void 0:We.title,(Re=f.removeRule)==null?void 0:Re.label,(he=f.removeRule)==null?void 0:he.title,(_=f.shiftActionDown)==null?void 0:_.label,(A=f.shiftActionDown)==null?void 0:A.title,(I=f.shiftActionUp)==null?void 0:I.label,(V=f.shiftActionUp)==null?void 0:V.title,(G=f.value)==null?void 0:G.title,(O=f.values)==null?void 0:O.placeholderGroupLabel,(Z=f.values)==null?void 0:Z.placeholderLabel,(me=f.values)==null?void 0:me.placeholderName,(Ce=f.values)==null?void 0:Ce.title,(He=f.valueSourceSelector)==null?void 0:He.title,e,(St=u.addGroup)==null?void 0:St.label,(pt=u.addGroup)==null?void 0:pt.title,(Cr=u.addRule)==null?void 0:Cr.label,(ht=u.addRule)==null?void 0:ht.title,(kt=u.cloneRule)==null?void 0:kt.label,(Te=u.cloneRule)==null?void 0:Te.title,(je=u.cloneRuleGroup)==null?void 0:je.label,(Ct=u.cloneRuleGroup)==null?void 0:Ct.title,(Zt=u.combinators)==null?void 0:Zt.title,(Me=u.dragHandle)==null?void 0:Me.label,(at=u.dragHandle)==null?void 0:at.title,(Vo=u.fields)==null?void 0:Vo.placeholderGroupLabel,(zo=u.fields)==null?void 0:zo.placeholderLabel,(mt=u.fields)==null?void 0:mt.placeholderName,(On=u.fields)==null?void 0:On.title,(hl=u.lockGroup)==null?void 0:hl.label,(Nr=u.lockGroup)==null?void 0:Nr.title,(Bo=u.lockGroupDisabled)==null?void 0:Bo.label,($n=u.lockGroupDisabled)==null?void 0:$n.title,(ft=u.lockRule)==null?void 0:ft.label,(Uo=u.lockRule)==null?void 0:Uo.title,(ot=u.lockRuleDisabled)==null?void 0:ot.label,(ml=u.lockRuleDisabled)==null?void 0:ml.title,(Ln=u.muteGroup)==null?void 0:Ln.label,(Fn=u.muteGroup)==null?void 0:Fn.title,(Gn=u.unmuteGroup)==null?void 0:Gn.label,(Wo=u.unmuteGroup)==null?void 0:Wo.title,(Vn=u.muteRule)==null?void 0:Vn.label,(zn=u.muteRule)==null?void 0:zn.title,(Ut=u.unmuteRule)==null?void 0:Ut.label,(Bn=u.unmuteRule)==null?void 0:Bn.title,(gl=u.matchMode)==null?void 0:gl.title,(bl=u.matchThreshold)==null?void 0:bl.title,(yl=u.notToggle)==null?void 0:yl.label,(vl=u.notToggle)==null?void 0:vl.title,(Un=u.operators)==null?void 0:Un.placeholderGroupLabel,(xl=u.operators)==null?void 0:xl.placeholderLabel,(ie=u.operators)==null?void 0:ie.placeholderName,(ke=u.operators)==null?void 0:ke.title,(Ie=u.removeGroup)==null?void 0:Ie.label,(Ae=u.removeGroup)==null?void 0:Ae.title,(_e=u.removeRule)==null?void 0:_e.label,(st=u.removeRule)==null?void 0:st.title,(gt=u.shiftActionDown)==null?void 0:gt.label,(Wr=u.shiftActionDown)==null?void 0:Wr.title,(cr=u.shiftActionUp)==null?void 0:cr.label,(Hr=u.shiftActionUp)==null?void 0:Hr.title,(Cb=u.value)==null?void 0:Cb.title,(Nb=u.values)==null?void 0:Nb.placeholderGroupLabel,(Eb=u.values)==null?void 0:Eb.placeholderLabel,(kb=u.values)==null?void 0:kb.placeholderName,(_b=u.values)==null?void 0:_b.title,(Db=u.valueSourceSelector)==null?void 0:Db.title]);return{...o,controlClassnames:l,controlElements:p,enableDragAndDrop:n,translations:h,initialQuery:t.initialQuery,qbId:t.qbId}},ED=({disabled:e,path:t,nestedArray:r,disabledPaths:o})=>{const n=r.length;return C.useMemo(()=>{const a=[];for(let l=0;l<n;l++){const i=[...t,l];a[l]={path:i,disabled:e||o.some(c=>no(i,c))}}return a},[e,t,n,o])};let hg=!1;const mg=(e,t)=>{process.env.NODE_ENV!=="production"&&!hg&&e&&!t&&(console.error(ut.errorEnabledDndWithoutReactDnD),hg=!0)},Qe=e=>C.useCallback((t,r)=>{t==null||t.preventDefault(),t==null||t.stopPropagation(),e(t,r)},[e]),kD={mode:"all"},_D=[{name:"",value:"",label:""}],DD=m.memo(function(t){const r=MD(t),o=Qe(r.cloneRule),n=Qe(r.toggleLockRule),a=Qe(r.toggleMuteRule),l=Qe(r.removeRule),i=Qe(r.shiftRuleUp),c=Qe(r.shiftRuleDown),d=C.useMemo(()=>({cloneRule:o,toggleLockRule:n,toggleMuteRule:a,removeRule:l,shiftRuleUp:i,shiftRuleDown:c}),[o,l,c,i,n,a]);return m.createElement("div",{ref:r.dndRef,"data-testid":ue.rule,"data-dragmonitorid":r.dragMonitorId,"data-dropmonitorid":r.dropMonitorId,className:r.outerClassName,"data-rule-id":r.id,"data-level":r.path.length,"data-path":JSON.stringify(r.path)},r.matchModes.length>0?m.createElement(TD,{...r,...d}):m.createElement(gg,{...r,...d}))}),gg=m.memo(function(t){const{schema:{controls:{shiftActions:r,dragHandle:o,fieldSelector:n,matchModeEditor:a,operatorSelector:l,valueSourceSelector:i,valueEditor:c,cloneRuleAction:d,lockRuleAction:p,muteRuleAction:u,removeRuleAction:f,ruleGroupBodyElements:h,ruleGroupHeaderElements:b}},groupComponentsWrapper:g=m.Fragment}=t,y=C.useMemo(()=>({level:t.path.length,path:t.path,disabled:t.disabled,context:t.context,validation:t.validationResult,schema:t.schema,rule:t.rule}),[t.path,t.disabled,t.context,t.validationResult,t.schema,t.rule]),x=C.useMemo(()=>!(t.schema.fields.length===1&&$r(t.schema.fields[0])&&"value"in t.schema.fields[0]&&t.schema.fields[0].value===""),[t.schema.fields]),v=C.useMemo(()=>t.schema.showShiftActions?{shiftUp:t.translations.shiftActionUp.title,shiftDown:t.translations.shiftActionDown.title}:void 0,[t.schema.showShiftActions,t.translations]),w=C.useMemo(()=>t.schema.showShiftActions?{shiftUp:t.translations.shiftActionUp.label,shiftDown:t.translations.shiftActionDown.label}:void 0,[t.schema.showShiftActions,t.translations]);return m.createElement(m.Fragment,null,t.schema.showShiftActions&&m.createElement(r,{key:ue.shiftActions,...y,testID:ue.shiftActions,titles:v,labels:w,className:t.classNames.shiftActions,ruleOrGroup:t.rule,shiftUp:t.shiftRuleUp,shiftDown:t.shiftRuleDown,shiftUpDisabled:t.shiftUpDisabled,shiftDownDisabled:t.shiftDownDisabled}),t.schema.enableDragAndDrop&&m.createElement(o,{key:ue.dragHandle,...y,testID:ue.dragHandle,ref:t.dragRef,title:t.translations.dragHandle.title,label:t.translations.dragHandle.label,className:t.classNames.dragHandle,ruleOrGroup:t.rule}),x&&m.createElement(n,{key:ue.fields,...y,testID:ue.fields,options:t.schema.fields,title:t.translations.fields.title,value:t.rule.field,operator:t.rule.operator,className:t.classNames.fields,handleOnChange:t.onChangeField}),(t.schema.autoSelectField||t.rule.field!==t.translations.fields.placeholderName)&&(t.subQuery?m.createElement(a,{key:ue.matchModeEditor,...y,testID:ue.matchModeEditor,field:t.rule.field,fieldData:t.fieldData,title:t.translations.matchMode.title,options:t.matchModes,match:t.rule.match??kD,className:t.classNames.matchMode,classNames:t.classNames,handleOnChange:t.onChangeMatchMode}):m.createElement(m.Fragment,null,m.createElement(l,{key:ue.operators,...y,testID:ue.operators,field:t.rule.field,fieldData:t.fieldData,title:t.translations.operators.title,options:t.operators,value:t.rule.operator,className:t.classNames.operators,handleOnChange:t.onChangeOperator}),(t.schema.autoSelectOperator||t.rule.operator!==t.translations.operators.placeholderName)&&!t.hideValueControls&&m.createElement(m.Fragment,null,!["null","notnull"].includes(fn(`${t.rule.operator}`))&&t.valueSources.length>1&&m.createElement(i,{key:ue.valueSourceSelector,...y,testID:ue.valueSourceSelector,field:t.rule.field,fieldData:t.fieldData,title:t.translations.valueSourceSelector.title,options:t.valueSourceOptions,value:t.rule.valueSource??"value",className:t.classNames.valueSource,handleOnChange:t.onChangeValueSource}),m.createElement(c,{key:ue.valueEditor,...y,testID:ue.valueEditor,field:t.rule.field,fieldData:t.fieldData,title:t.translations.value.title,operator:t.rule.operator,value:t.rule.value,valueSource:t.rule.valueSource??"value",type:t.valueEditorType,inputType:t.inputType,values:t.values,listsAsArrays:t.schema.listsAsArrays,parseNumbers:t.schema.parseNumbers,separator:t.valueEditorSeparator,className:t.classNames.value,handleOnChange:t.onChangeValue})))),t.subQuery&&m.createElement(g,{className:t.subQuery.classNames.header},m.createElement(b,t.subQuery)),t.schema.showCloneButtons&&m.createElement(d,{key:ue.cloneRule,...y,testID:ue.cloneRule,label:t.translations.cloneRule.label,title:t.translations.cloneRule.title,className:t.classNames.cloneRule,ruleOrGroup:t.rule,handleOnClick:t.cloneRule}),t.schema.showLockButtons&&m.createElement(p,{key:ue.lockRule,...y,testID:ue.lockRule,label:t.translations.lockRule.label,title:t.translations.lockRule.title,className:t.classNames.lockRule,ruleOrGroup:t.rule,handleOnClick:t.toggleLockRule,disabledTranslation:t.parentDisabled?void 0:t.translations.lockRuleDisabled}),t.schema.showMuteButtons&&m.createElement(u,{key:ue.muteRule,...y,testID:ue.muteRule,label:t.rule.muted?t.translations.unmuteRule.label:t.translations.muteRule.label,title:t.rule.muted?t.translations.unmuteRule.title:t.translations.muteRule.title,className:t.classNames.muteRule,ruleOrGroup:t.rule,handleOnClick:t.toggleMuteRule}),m.createElement(f,{key:ue.removeRule,...y,testID:ue.removeRule,label:t.translations.removeRule.label,title:t.translations.removeRule.title,className:t.classNames.removeRule,ruleOrGroup:t.rule,handleOnClick:t.removeRule}),t.subQuery&&m.createElement(g,{className:t.subQuery.classNames.body},m.createElement(h,t.subQuery)))}),AD=e=>m.createElement("div",e),TD=m.memo(function(t){const r=C.useMemo(()=>t.schema.createRuleGroup(),[t.schema]),o=pg({...t.subQueryBuilderProps,enableDragAndDrop:!1,disabled:t.disabled,fields:t.subproperties.fields,enableMountQueryChange:!Ge(t.rule.value)||!t.rule.value.id,query:Ge(t.rule.value)?t.rule.value:r,onQueryChange:t.onChangeValue}),n=fg({...o,ruleGroup:o.rootGroup,path:Mh,disabled:t.disabled,parentDisabled:o.queryDisabled,id:o.rootGroup.id,shiftUpDisabled:!0,shiftDownDisabled:!0}),a=Qe(n.addRule),l=Qe(n.addGroup),i=Qe(n.cloneGroup),c=Qe(n.toggleLockGroup),d=Qe(n.removeGroup),p=Qe(n.shiftGroupUp),u=Qe(n.shiftGroupDown),f=C.useMemo(()=>({...n,addGroup:l,addRule:a,cloneGroup:i,removeGroup:d,shiftGroupDown:u,shiftGroupUp:p,toggleLockGroup:c}),[l,a,i,d,u,p,n,c]);return m.createElement(gg,{...t,groupComponentsWrapper:t.groupComponentsWrapper??AD,subQuery:f})}),MD=e=>{const{id:t,path:r,rule:o,schema:{classNames:n,fields:a,fieldMap:l,getInputType:i,getMatchModes:c,getOperators:d,getSubQueryBuilderProps:p,getValueEditorType:u,getValueEditorSeparator:f,getValueSources:h,getValues:b,validationMap:g,enableDragAndDrop:y,getRuleClassname:x,suppressStandardClassnames:v},actions:{moveRule:w,onPropChange:S,onRuleRemove:E},disabled:N,parentDisabled:T,parentMuted:k,shiftUpDisabled:M,shiftDownDisabled:D,field:U,operator:$,value:F,valueSource:q,dropEffect:R="move",groupItems:W=!1,dragMonitorId:Q="",dropMonitorId:P="",dndRef:z=null,dragRef:pe=null,isDragging:ge=!1,isOver:L=!1,dropNotAllowed:Y=!1}=e;Wc("rule",!o),mg(y,!!(Q||P||z||pe));const te=!!T||!!N,fe=!!k||!!(o!=null&&o.muted),K=C.useMemo(()=>o??{id:t,field:U??"",operator:$??"",value:F,valueSource:q},[U,t,$,o,F,q]),X=C.useMemo(()=>({shiftActions:De(v||de.shiftActions,n.shiftActions),dragHandle:De(v||de.dragHandle,n.dragHandle),fields:De(v||de.fields,n.valueSelector,n.fields),matchMode:De(v||de.matchMode,n.valueSelector,n.matchMode),matchThreshold:De(v||de.matchThreshold,n.valueSelector,n.matchThreshold),operators:De(v||de.operators,n.valueSelector,n.operators),valueSource:De(v||de.valueSource,n.valueSelector,n.valueSource),value:De(v||de.value,n.value),cloneRule:De(v||de.cloneRule,n.actionElement,n.cloneRule),lockRule:De(v||de.lockRule,n.actionElement,n.lockRule),muteRule:De(v||de.muteRule,n.actionElement,n.muteRule),removeRule:De(v||de.removeRule,n.actionElement,n.removeRule),valueListItem:De(v||de.valueListItem,n.valueListItem)}),[n.shiftActions,n.dragHandle,n.valueSelector,n.fields,n.matchMode,n.matchThreshold,n.operators,n.valueSource,n.value,n.actionElement,n.cloneRule,n.lockRule,n.muteRule,n.removeRule,n.valueListItem,v]),se=C.useCallback(Me=>(at,Vo)=>{te||S(Me,at,r,Vo)},[te,S,r]),ve=C.useMemo(()=>se("field"),[se]),le=C.useMemo(()=>se("operator"),[se]),H=C.useMemo(()=>se("match"),[se]),j=C.useMemo(()=>se("valueSource"),[se]),ce=C.useMemo(()=>se("value"),[se]),Ee=C.useCallback((Me,at)=>{te||w(r,[...qe(r),r.at(-1)+1],!0,at)},[te,w,r]),Se=C.useCallback((Me,at)=>S("disabled",!te,r,at),[te,S,r]),ze=C.useCallback((Me,at)=>S("muted",!K.muted,r,at),[K.muted,S,r]),Ye=C.useCallback((Me,at)=>{te||E(r)},[te,E,r]),We=C.useCallback((Me,at)=>{!te&&!M&&w(r,"up",Me==null?void 0:Me.altKey,at)},[te,w,r,M]),Re=C.useCallback((Me,at)=>{!te&&!D&&w(r,"down",Me==null?void 0:Me.altKey,at)},[te,w,r,D]),he=C.useMemo(()=>(l==null?void 0:l[K.field])??{name:K.field,value:K.field,label:K.field},[l,K.field]),_=C.useMemo(()=>he.inputType??i(K.field,K.operator,{fieldData:he}),[he,i,K.field,K.operator]),A=C.useMemo(()=>c(K.field,{fieldData:he}),[he,c,K.field]),I=C.useMemo(()=>d(K.field,{fieldData:he}),[he,d,K.field]),V=C.useMemo(()=>Io(I,K.operator),[I,K.operator]),G=V==null?void 0:V.arity,O=typeof G=="string"&&G==="unary"||typeof G=="number"&&G<2,Z=C.useMemo(()=>{const Me=h(K.field,K.operator,{fieldData:he});return K.valueSource&&!Io(Me,K.valueSource)?[...Me,{name:K.valueSource,value:K.valueSource,label:K.valueSource}]:Me},[he,h,K.field,K.operator,K.valueSource]),me=C.useMemo(()=>Z.map(({value:Me})=>Me),[Z]),Ce=C.useMemo(()=>K.valueSource==="field"?"select":u(K.field,K.operator,{fieldData:he}),[he,u,K.field,K.operator,K.valueSource]),He=C.useMemo(()=>f(K.field,K.operator,{fieldData:he}),[he,f,K.field,K.operator]),St=C.useMemo(()=>{const Me=K.valueSource==="field"?Gh(he,a,K.operator):b(K.field,K.operator,{fieldData:he});return fs(Me)||Lr(Me)?ps(Me):Me},[he,a,b,K.field,K.operator,K.valueSource]),pt=C.useMemo(()=>p(K.field,{fieldData:he}),[he,p,K.field]),Cr=ig({translations:e.translations,fields:he.subproperties??pt.fields??_D,autoSelectField:e.schema.autoSelectField||!!he.subproperties}),ht=C.useMemo(()=>g[t??""]??(typeof he.validator=="function"?he.validator(K):null),[he,t,K,g]),kt=C.useMemo(()=>Bh(ht),[ht]),Te=(he==null?void 0:he.className)??"",je=(V==null?void 0:V.className)??"",Ct=A.length>0,Zt=C.useMemo(()=>De(x(K,{fieldData:he}),Te,je,v||de.rule,n.rule,te&&n.disabled,fe&&n.muted,ge&&n.dndDragging,L&&n.dndOver,L&&R==="copy"&&n.dndCopy,L&&W&&n.dndGroup,Y&&n.dndDropNotAllowed,Ct&&n.hasSubQuery,v||{[de.disabled]:te,[de.muted]:fe,[de.dndDragging]:ge,[de.dndOver]:L,[de.dndCopy]:L&&R==="copy",[de.dndGroup]:L&&W,[de.dndDropNotAllowed]:Y,[de.hasSubQuery]:Ct},kt),[n.disabled,n.muted,n.dndCopy,n.dndDragging,n.dndGroup,n.dndOver,n.dndDropNotAllowed,n.hasSubQuery,n.rule,te,R,Y,fe,Te,he,x,W,Ct,ge,L,je,K,v,kt]);return{...e,classNames:X,cloneRule:Ee,disabled:te,dndRef:z,dragMonitorId:Q,dragRef:pe,dropMonitorId:P,fieldData:he,generateOnChangeHandler:se,onChangeField:ve,onChangeMatchMode:H,onChangeOperator:le,onChangeValueSource:j,onChangeValue:ce,hideValueControls:O,inputType:_,matchModes:A,muted:fe,operators:I,outerClassName:Zt,removeRule:Ye,rule:K,shiftRuleUp:We,shiftRuleDown:Re,subproperties:Cr,subQueryBuilderProps:pt,toggleLockRule:Se,toggleMuteRule:ze,validationResult:ht,valueEditorSeparator:He,valueEditorType:Ce,values:St,valueSourceOptions:Z,valueSources:me}},tl={actionElement:Qt,addGroupAction:Qt,addRuleAction:Qt,cloneGroupAction:Qt,cloneRuleAction:Qt,combinatorSelector:An,dragHandle:G_,fieldSelector:An,inlineCombinator:V_,lockGroupAction:Qt,lockRuleAction:Qt,matchModeEditor:B_,muteGroupAction:Qt,muteRuleAction:Qt,notToggle:W_,operatorSelector:An,removeGroupAction:Qt,removeRuleAction:Qt,rule:DD,ruleGroup:pD,ruleGroupBodyElements:hD,ruleGroupHeaderElements:fD,shiftActions:mD,valueEditor:bD,valueSelector:An,valueSourceSelector:An};cg();const ID=e=>m.createElement(g_,{context:sg,store:cg()},e.children),rl=e=>m.createElement(ID,null,m.createElement(SD,{props:e}));function bg(e,t,r){var n,a;const o={visible:!0,required:((n=e.validation)==null?void 0:n.required)??!1,disabled:((a=e.properties)==null?void 0:a.disabled)??!1};return e.logic&&(o.visible=PD(e.logic,t,r),e.logic.requireWhen&&(o.required=ol(e.logic.requireWhen,t,r)),e.logic.disableWhen&&(o.disabled=ol(e.logic.disableWhen,t,r))),o}function PD(e,t,r){const{showWhen:o,hideWhen:n}=e;let a=!0;if(o&&o.rules&&o.rules.length>0&&(a=ol(o,t,r)),n&&n.rules&&n.rules.length>0){const l=ol(n,t,r);a=a&&!l}return a}function ol(e,t,r){if(!e||!e.rules||e.rules.length===0)return!0;const{combinator:o,rules:n}=e,a=n.map(l=>{const i=r.find(p=>p.id===l.field||p.attributes.name===l.field),c=(i==null?void 0:i.attributes.name)||l.field,d=t[c];return OD(d,l.operator,l.value)});return o==="and"?a.every(l=>l):a.some(l=>l)}function OD(e,t,r){const o=e??"";switch(t){case"equals":case"=":case"==":return o===r;case"notEquals":case"!=":case"<>":return o!==r;case"contains":return String(o).toLowerCase().includes(String(r).toLowerCase());case"notContains":case"doesNotContain":return!String(o).toLowerCase().includes(String(r).toLowerCase());case"startsWith":case"beginsWith":return String(o).toLowerCase().startsWith(String(r).toLowerCase());case"endsWith":return String(o).toLowerCase().endsWith(String(r).toLowerCase());case"matches":try{return new RegExp(r,"i").test(String(o))}catch{return!1}case"isEmpty":case"null":return o===""||o===null||o===void 0||Array.isArray(o)&&o.length===0;case"isNotEmpty":case"notNull":return o!==""&&o!==null&&o!==void 0&&!(Array.isArray(o)&&o.length===0);case"greaterThan":case">":return Number(o)>Number(r);case"greaterThanOrEquals":case">=":return Number(o)>=Number(r);case"lessThan":case"<":return Number(o)<Number(r);case"lessThanOrEquals":case"<=":return Number(o)<=Number(r);case"between":if(Array.isArray(r)&&r.length===2){const n=Number(o);return n>=Number(r[0])&&n<=Number(r[1])}return!1;case"notBetween":if(Array.isArray(r)&&r.length===2){const n=Number(o);return n<Number(r[0])||n>Number(r[1])}return!0;case"in":return Array.isArray(r)?r.includes(o):!1;case"notIn":return Array.isArray(r)?!r.includes(o):!0;case"isTrue":return o===!0||o==="true"||o===1;case"isFalse":return o===!1||o==="false"||o===0;case"hasLength":return Array.isArray(o)&&o.length===Number(r);case"hasMinLength":return Array.isArray(o)&&o.length>=Number(r);case"hasMaxLength":return Array.isArray(o)&&o.length<=Number(r);case"includes":case"arrayContains":return Array.isArray(o)&&o.includes(r);case"notIncludes":case"arrayNotContains":return!Array.isArray(o)||!o.includes(r);default:return console.warn(`Unknown operator: ${t}`),!0}}function $D(e){const t=[{name:"isEmpty",label:"is empty"},{name:"isNotEmpty",label:"is not empty"}],r=[{name:"equals",label:"equals"},{name:"notEquals",label:"does not equal"}],o=[...r,{name:"contains",label:"contains"},{name:"notContains",label:"does not contain"},{name:"startsWith",label:"starts with"},{name:"endsWith",label:"ends with"},...t],n=[...r,{name:"greaterThan",label:"is greater than"},{name:"greaterThanOrEquals",label:"is greater than or equal to"},{name:"lessThan",label:"is less than"},{name:"lessThanOrEquals",label:"is less than or equal to"},{name:"between",label:"is between"},...t],a=[{name:"isTrue",label:"is checked"},{name:"isFalse",label:"is not checked"}],l=[...r,{name:"in",label:"is one of"},{name:"notIn",label:"is not one of"},...t],i=[{name:"includes",label:"includes"},{name:"notIncludes",label:"does not include"},{name:"hasLength",label:"has exactly"},{name:"hasMinLength",label:"has at least"},{name:"hasMaxLength",label:"has at most"},...t];switch(e){case"shortText":case"longText":case"multiLineInput":case"textEditor":case"email":case"phone":case"url":case"password":case"location":return o;case"number":case"slider":case"rangeSlider":return n;case"decisionBox":case"toggleSwitch":return a;case"singleChoice":case"dropdown":return l;case"multipleChoice":case"tags":return i;case"date":case"time":case"dateTime":case"dateRange":case"multipleDates":return[...r,{name:"greaterThan",label:"is after"},{name:"lessThan",label:"is before"},{name:"between",label:"is between"},...t];case"fileUpload":case"imageUpload":case"multiFileUpload":case"multiImageUpload":return t;case"singleChoiceMatrix":case"multipleChoiceMatrix":case"matrixTable":return t;default:return[...r,...t]}}function LD(e){switch(e){case"number":case"slider":case"rangeSlider":return"number";case"decisionBox":case"toggleSwitch":return"checkbox";case"date":case"dateRange":case"multipleDates":return"date";case"time":return"time";case"dateTime":return"datetime-local";case"singleChoice":case"dropdown":case"multipleChoice":case"tags":return"select";case"email":return"email";default:return"text"}}function FD(e){var t;if((t=e.config)!=null&&t.options&&Array.isArray(e.config.options))return e.config.options.map(r=>({name:r.value,label:r.label}))}function nl(e){return!e||!e.rules||e.rules.length===0?{combinator:"and",rules:[]}:{combinator:e.combinator,rules:e.rules.map(t=>({field:t.field,operator:t.operator,value:t.value}))}}function al(e){return{combinator:e.combinator,rules:e.rules.filter(t=>"field"in t).map(t=>"field"in t?{field:t.field,operator:t.operator,value:t.value}:null).filter(Boolean)}}const sl=({title:e,children:t,defaultOpen:r=!1,badge:o})=>{const[n,a]=C.useState(r);return s.jsxs(Ff,{open:n,onOpenChange:a,className:"border border-border rounded-lg overflow-hidden",children:[s.jsx(Gf,{asChild:!0,children:s.jsxs(Be,{variant:"ghost",className:"w-full flex items-center justify-between px-3 py-2 h-auto bg-muted/50 hover:bg-muted rounded-none",children:[s.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[e,o&&s.jsx(Ni,{variant:"secondary",className:"text-xs",children:o})]}),s.jsx(Eo,{className:be("h-4 w-4 transition-transform",n&&"rotate-180")})]})}),s.jsx(Vf,{children:s.jsx("div",{className:"p-3 bg-card",children:t})})]})},GD=({element:e,elements:t,onUpdate:r})=>{var u,f,h,b,g,y,x,v,w,S,E,N,T,k,M,D,U,$,F,q,R,W,Q,P,z,pe,ge,L,Y,te,fe,K,X,se,ve,le,H,j,ce,Ee,Se,ze,Ye,We,Re,he,_,A;const o=C.useMemo(()=>t.filter(I=>I.id!==e.id).filter(I=>!["divider","spacer","paragraph","image","link","formHeading","sectionHeading","subheading","submit"].includes(I.type)).map(I=>{var Z;const V=$D(I.type),G=LD(I.type),O=FD(I);return{name:I.id,label:I.properties.label||I.attributes.name||`Field ${I.order+1}`,inputType:G,operators:V.map(me=>({name:me.name,label:me.label})),values:O==null?void 0:O.map(me=>({name:me.name,label:me.label})),defaultOperator:((Z=V[0])==null?void 0:Z.name)||"equals"}}),[t,e.id]),n=C.useCallback(I=>{const V=al(I),G={...e.logic,showWhen:V.rules.length>0?V:void 0};r({logic:G})},[e.logic,r]),a=C.useCallback(I=>{const V=al(I),G={...e.logic,hideWhen:V.rules.length>0?V:void 0};r({logic:G})},[e.logic,r]),l=C.useCallback(I=>{const V=al(I),G={...e.logic,requireWhen:V.rules.length>0?V:void 0};r({logic:G})},[e.logic,r]),i=C.useCallback(I=>{const V=al(I),G={...e.logic,disableWhen:V.rules.length>0?V:void 0};r({logic:G})},[e.logic,r]),c=C.useCallback(()=>{r({logic:void 0})},[r]),d=e.logic&&((((f=(u=e.logic.showWhen)==null?void 0:u.rules)==null?void 0:f.length)??0)>0||(((b=(h=e.logic.hideWhen)==null?void 0:h.rules)==null?void 0:b.length)??0)>0||(((y=(g=e.logic.requireWhen)==null?void 0:g.rules)==null?void 0:y.length)??0)>0||(((v=(x=e.logic.disableWhen)==null?void 0:x.rules)==null?void 0:v.length)??0)>0),p=(((E=(S=(w=e.logic)==null?void 0:w.showWhen)==null?void 0:S.rules)==null?void 0:E.length)??0)+(((k=(T=(N=e.logic)==null?void 0:N.hideWhen)==null?void 0:T.rules)==null?void 0:k.length)??0)+(((U=(D=(M=e.logic)==null?void 0:M.requireWhen)==null?void 0:D.rules)==null?void 0:U.length)??0)+(((q=(F=($=e.logic)==null?void 0:$.disableWhen)==null?void 0:F.rules)==null?void 0:q.length)??0);return o.length===0?s.jsxs("div",{className:"text-sm text-muted-foreground p-4 text-center bg-muted/50 rounded-lg",children:[s.jsx(Vp,{className:"w-8 h-8 mx-auto mb-2 text-muted-foreground/50"}),s.jsx("p",{children:"Add more fields to enable conditional logic."}),s.jsx("p",{className:"text-xs mt-1",children:"Logic rules require other fields to reference."})]}):s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:"text-sm text-muted-foreground",children:d?s.jsxs("span",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"w-2 h-2 bg-primary rounded-full"}),p," rule",p!==1?"s":""," ","configured"]}):s.jsx("span",{className:"text-muted-foreground/70",children:"No logic configured"})}),d&&s.jsxs(Be,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive hover:bg-destructive/10",onClick:c,children:[s.jsx(gi,{className:"h-3 w-3 mr-1"}),"Clear all"]})]}),s.jsxs(sl,{title:"Show When",defaultOpen:!!((Q=(W=(R=e.logic)==null?void 0:R.showWhen)==null?void 0:W.rules)!=null&&Q.length),badge:(pe=(z=(P=e.logic)==null?void 0:P.showWhen)==null?void 0:z.rules)!=null&&pe.length?String(e.logic.showWhen.rules.length):void 0,children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"This element will only be visible when these conditions are met."}),s.jsx("div",{className:"query-builder-wrapper",children:s.jsx(rl,{fields:o,query:nl((ge=e.logic)==null?void 0:ge.showWhen),onQueryChange:n,controlClassnames:{queryBuilder:"qb-lite",ruleGroup:"bg-muted/50 p-2 rounded border border-border",combinators:"px-2 py-1 border border-input rounded text-sm bg-background",addRule:"px-2 py-1 bg-primary text-primary-foreground rounded text-xs hover:bg-primary/90",addGroup:"px-2 py-1 bg-secondary text-secondary-foreground rounded text-xs hover:bg-secondary/80 ml-1",removeGroup:"px-2 py-1 bg-destructive/10 text-destructive rounded text-xs hover:bg-destructive/20",removeRule:"px-1 py-1 text-destructive hover:text-destructive/80",fields:"px-2 py-1 border border-input rounded text-sm min-w-[120px] bg-background",operators:"px-2 py-1 border border-input rounded text-sm mx-1 bg-background",value:"px-2 py-1 border border-input rounded text-sm bg-background"}})})]}),s.jsxs(sl,{title:"Hide When",defaultOpen:!!((te=(Y=(L=e.logic)==null?void 0:L.hideWhen)==null?void 0:Y.rules)!=null&&te.length),badge:(X=(K=(fe=e.logic)==null?void 0:fe.hideWhen)==null?void 0:K.rules)!=null&&X.length?String(e.logic.hideWhen.rules.length):void 0,children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"This element will be hidden when these conditions are met."}),s.jsx("div",{className:"query-builder-wrapper",children:s.jsx(rl,{fields:o,query:nl((se=e.logic)==null?void 0:se.hideWhen),onQueryChange:a,controlClassnames:{queryBuilder:"qb-lite",ruleGroup:"bg-muted/50 p-2 rounded border border-border",combinators:"px-2 py-1 border border-input rounded text-sm bg-background",addRule:"px-2 py-1 bg-primary text-primary-foreground rounded text-xs hover:bg-primary/90",addGroup:"px-2 py-1 bg-secondary text-secondary-foreground rounded text-xs hover:bg-secondary/80 ml-1",removeGroup:"px-2 py-1 bg-destructive/10 text-destructive rounded text-xs hover:bg-destructive/20",removeRule:"px-1 py-1 text-destructive hover:text-destructive/80",fields:"px-2 py-1 border border-input rounded text-sm min-w-[120px] bg-background",operators:"px-2 py-1 border border-input rounded text-sm mx-1 bg-background",value:"px-2 py-1 border border-input rounded text-sm bg-background"}})})]}),s.jsxs(sl,{title:"Required When",defaultOpen:!!((H=(le=(ve=e.logic)==null?void 0:ve.requireWhen)==null?void 0:le.rules)!=null&&H.length),badge:(Ee=(ce=(j=e.logic)==null?void 0:j.requireWhen)==null?void 0:ce.rules)!=null&&Ee.length?String(e.logic.requireWhen.rules.length):void 0,children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"This element will be required when these conditions are met."}),s.jsx("div",{className:"query-builder-wrapper",children:s.jsx(rl,{fields:o,query:nl((Se=e.logic)==null?void 0:Se.requireWhen),onQueryChange:l,controlClassnames:{queryBuilder:"qb-lite",ruleGroup:"bg-muted/50 p-2 rounded border border-border",combinators:"px-2 py-1 border border-input rounded text-sm bg-background",addRule:"px-2 py-1 bg-primary text-primary-foreground rounded text-xs hover:bg-primary/90",addGroup:"px-2 py-1 bg-secondary text-secondary-foreground rounded text-xs hover:bg-secondary/80 ml-1",removeGroup:"px-2 py-1 bg-destructive/10 text-destructive rounded text-xs hover:bg-destructive/20",removeRule:"px-1 py-1 text-destructive hover:text-destructive/80",fields:"px-2 py-1 border border-input rounded text-sm min-w-[120px] bg-background",operators:"px-2 py-1 border border-input rounded text-sm mx-1 bg-background",value:"px-2 py-1 border border-input rounded text-sm bg-background"}})})]}),s.jsxs(sl,{title:"Disabled When",defaultOpen:!!((We=(Ye=(ze=e.logic)==null?void 0:ze.disableWhen)==null?void 0:Ye.rules)!=null&&We.length),badge:(_=(he=(Re=e.logic)==null?void 0:Re.disableWhen)==null?void 0:he.rules)!=null&&_.length?String(e.logic.disableWhen.rules.length):void 0,children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"This element will be disabled when these conditions are met."}),s.jsx("div",{className:"query-builder-wrapper",children:s.jsx(rl,{fields:o,query:nl((A=e.logic)==null?void 0:A.disableWhen),onQueryChange:i,controlClassnames:{queryBuilder:"qb-lite",ruleGroup:"bg-muted/50 p-2 rounded border border-border",combinators:"px-2 py-1 border border-input rounded text-sm bg-background",addRule:"px-2 py-1 bg-primary text-primary-foreground rounded text-xs hover:bg-primary/90",addGroup:"px-2 py-1 bg-secondary text-secondary-foreground rounded text-xs hover:bg-secondary/80 ml-1",removeGroup:"px-2 py-1 bg-destructive/10 text-destructive rounded text-xs hover:bg-destructive/20",removeRule:"px-1 py-1 text-destructive hover:text-destructive/80",fields:"px-2 py-1 border border-input rounded text-sm min-w-[120px] bg-background",operators:"px-2 py-1 border border-input rounded text-sm mx-1 bg-background",value:"px-2 py-1 border border-input rounded text-sm bg-background"}})})]})]})};var VD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],zD=VD.reduce((e,t)=>{const r=Bf(`Primitive.${t}`),o=m.forwardRef((n,a)=>{const{asChild:l,...i}=n,c=l?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...i,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),BD="Label",yg=m.forwardRef((e,t)=>s.jsx(zD.label,{...e,ref:t,onMouseDown:r=>{var n;r.target.closest("button, input, select, textarea")||((n=e.onMouseDown)==null||n.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));yg.displayName=BD;var vg=yg;const UD=La("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Bt=m.forwardRef(({className:e,...t},r)=>s.jsx(vg,{ref:r,className:be(UD(),e),...t}));Bt.displayName=vg.displayName;const Yc=m.forwardRef(({className:e,...t},r)=>s.jsx("textarea",{className:be("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...t}));Yc.displayName="Textarea";var ll="Checkbox",[WD]=dr(ll),[HD,qc]=WD(ll);function jD(e){const{__scopeCheckbox:t,checked:r,children:o,defaultChecked:n,disabled:a,form:l,name:i,onCheckedChange:c,required:d,value:p="on",internal_do_not_use_render:u}=e,[f,h]=fr({prop:r,defaultProp:n??!1,onChange:c,caller:ll}),[b,g]=m.useState(null),[y,x]=m.useState(null),v=m.useRef(!1),w=b?!!l||!!b.closest("form"):!0,S={checked:f,disabled:a,setChecked:h,control:b,setControl:g,name:i,form:l,value:p,hasConsumerStoppedPropagationRef:v,required:d,defaultChecked:zr(n)?!1:n,isFormControl:w,bubbleInput:y,setBubbleInput:x};return s.jsx(HD,{scope:t,...S,children:YD(u)?u(S):o})}var xg="CheckboxTrigger",wg=m.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...o},n)=>{const{control:a,value:l,disabled:i,checked:c,required:d,setControl:p,setChecked:u,hasConsumerStoppedPropagationRef:f,isFormControl:h,bubbleInput:b}=qc(xg,e),g=Fe(n,p),y=m.useRef(c);return m.useEffect(()=>{const x=a==null?void 0:a.form;if(x){const v=()=>u(y.current);return x.addEventListener("reset",v),()=>x.removeEventListener("reset",v)}},[a,u]),s.jsx(Ne.button,{type:"button",role:"checkbox","aria-checked":zr(c)?"mixed":c,"aria-required":d,"data-state":kg(c),"data-disabled":i?"":void 0,disabled:i,value:l,...o,ref:g,onKeyDown:xe(t,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:xe(r,x=>{u(v=>zr(v)?!0:!v),b&&h&&(f.current=x.isPropagationStopped(),f.current||x.stopPropagation())})})});wg.displayName=xg;var Qc=m.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:o,checked:n,defaultChecked:a,required:l,disabled:i,value:c,onCheckedChange:d,form:p,...u}=e;return s.jsx(jD,{__scopeCheckbox:r,checked:n,defaultChecked:a,disabled:i,required:l,onCheckedChange:d,name:o,form:p,value:c,internal_do_not_use_render:({isFormControl:f})=>s.jsxs(s.Fragment,{children:[s.jsx(wg,{...u,ref:t,__scopeCheckbox:r}),f&&s.jsx(Eg,{__scopeCheckbox:r})]})})});Qc.displayName=ll;var Sg="CheckboxIndicator",Cg=m.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:o,...n}=e,a=qc(Sg,r);return s.jsx(Ao,{present:o||zr(a.checked)||a.checked===!0,children:s.jsx(Ne.span,{"data-state":kg(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t,style:{pointerEvents:"none",...e.style}})})});Cg.displayName=Sg;var Ng="CheckboxBubbleInput",Eg=m.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:o,hasConsumerStoppedPropagationRef:n,checked:a,defaultChecked:l,required:i,disabled:c,name:d,value:p,form:u,bubbleInput:f,setBubbleInput:h}=qc(Ng,e),b=Fe(r,h),g=Lu(a),y=Su(o);m.useEffect(()=>{const v=f;if(!v)return;const w=window.HTMLInputElement.prototype,E=Object.getOwnPropertyDescriptor(w,"checked").set,N=!n.current;if(g!==a&&E){const T=new Event("click",{bubbles:N});v.indeterminate=zr(a),E.call(v,zr(a)?!1:a),v.dispatchEvent(T)}},[f,g,a,n]);const x=m.useRef(zr(a)?!1:a);return s.jsx(Ne.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??x.current,required:i,disabled:c,name:d,value:p,form:u,...t,tabIndex:-1,ref:b,style:{...t.style,...y,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Eg.displayName=Ng;function YD(e){return typeof e=="function"}function zr(e){return e==="indeterminate"}function kg(e){return zr(e)?"indeterminate":e?"checked":"unchecked"}const Kc=m.forwardRef(({className:e,...t},r)=>s.jsx(Qc,{ref:r,className:be("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:s.jsx(Cg,{className:be("grid place-content-center text-current"),children:s.jsx(Lp,{className:"h-4 w-4"})})}));Kc.displayName=Qc.displayName;var Kt="Accordion",qD=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Xc,QD,KD]=Gl(Kt),[il]=dr(Kt,[KD,Pf]),Jc=Pf(),_g=C.forwardRef((e,t)=>{const{type:r,...o}=e,n=o,a=o;return s.jsx(Xc.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?s.jsx(RD,{...a,ref:t}):s.jsx(ZD,{...n,ref:t})})});_g.displayName=Kt;var[Dg,XD]=il(Kt),[Ag,JD]=il(Kt,{collapsible:!1}),ZD=C.forwardRef((e,t)=>{const{value:r,defaultValue:o,onValueChange:n=()=>{},collapsible:a=!1,...l}=e,[i,c]=fr({prop:r,defaultProp:o??"",onChange:n,caller:Kt});return s.jsx(Dg,{scope:e.__scopeAccordion,value:C.useMemo(()=>i?[i]:[],[i]),onItemOpen:c,onItemClose:C.useCallback(()=>a&&c(""),[a,c]),children:s.jsx(Ag,{scope:e.__scopeAccordion,collapsible:a,children:s.jsx(Tg,{...l,ref:t})})})}),RD=C.forwardRef((e,t)=>{const{value:r,defaultValue:o,onValueChange:n=()=>{},...a}=e,[l,i]=fr({prop:r,defaultProp:o??[],onChange:n,caller:Kt}),c=C.useCallback(p=>i((u=[])=>[...u,p]),[i]),d=C.useCallback(p=>i((u=[])=>u.filter(f=>f!==p)),[i]);return s.jsx(Dg,{scope:e.__scopeAccordion,value:l,onItemOpen:c,onItemClose:d,children:s.jsx(Ag,{scope:e.__scopeAccordion,collapsible:!0,children:s.jsx(Tg,{...a,ref:t})})})}),[eA,cl]=il(Kt),Tg=C.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:o,dir:n,orientation:a="vertical",...l}=e,i=C.useRef(null),c=Fe(i,t),d=QD(r),u=aa(n)==="ltr",f=xe(e.onKeyDown,h=>{var k;if(!qD.includes(h.key))return;const b=h.target,g=d().filter(M=>{var D;return!((D=M.ref.current)!=null&&D.disabled)}),y=g.findIndex(M=>M.ref.current===b),x=g.length;if(y===-1)return;h.preventDefault();let v=y;const w=0,S=x-1,E=()=>{v=y+1,v>S&&(v=w)},N=()=>{v=y-1,v<w&&(v=S)};switch(h.key){case"Home":v=w;break;case"End":v=S;break;case"ArrowRight":a==="horizontal"&&(u?E():N());break;case"ArrowDown":a==="vertical"&&E();break;case"ArrowLeft":a==="horizontal"&&(u?N():E());break;case"ArrowUp":a==="vertical"&&N();break}const T=v%x;(k=g[T].ref.current)==null||k.focus()});return s.jsx(eA,{scope:r,disabled:o,direction:n,orientation:a,children:s.jsx(Xc.Slot,{scope:r,children:s.jsx(Ne.div,{...l,"data-orientation":a,ref:c,onKeyDown:o?void 0:f})})})}),dl="AccordionItem",[tA,Zc]=il(dl),Mg=C.forwardRef((e,t)=>{const{__scopeAccordion:r,value:o,...n}=e,a=cl(dl,r),l=XD(dl,r),i=Jc(r),c=_r(),d=o&&l.value.includes(o)||!1,p=a.disabled||e.disabled;return s.jsx(tA,{scope:r,open:d,disabled:p,triggerId:c,children:s.jsx(Lf,{"data-orientation":a.orientation,"data-state":Fg(d),...i,...n,ref:t,disabled:p,open:d,onOpenChange:u=>{u?l.onItemOpen(o):l.onItemClose(o)}})})});Mg.displayName=dl;var Ig="AccordionHeader",Pg=C.forwardRef((e,t)=>{const{__scopeAccordion:r,...o}=e,n=cl(Kt,r),a=Zc(Ig,r);return s.jsx(Ne.h3,{"data-orientation":n.orientation,"data-state":Fg(a.open),"data-disabled":a.disabled?"":void 0,...o,ref:t})});Pg.displayName=Ig;var Rc="AccordionTrigger",Og=C.forwardRef((e,t)=>{const{__scopeAccordion:r,...o}=e,n=cl(Kt,r),a=Zc(Rc,r),l=JD(Rc,r),i=Jc(r);return s.jsx(Xc.ItemSlot,{scope:r,children:s.jsx(FN,{"aria-disabled":a.open&&!l.collapsible||void 0,"data-orientation":n.orientation,id:a.triggerId,...i,...o,ref:t})})});Og.displayName=Rc;var $g="AccordionContent",Lg=C.forwardRef((e,t)=>{const{__scopeAccordion:r,...o}=e,n=cl(Kt,r),a=Zc($g,r),l=Jc(r);return s.jsx(GN,{role:"region","aria-labelledby":a.triggerId,"data-orientation":n.orientation,...l,...o,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});Lg.displayName=$g;function Fg(e){return e?"open":"closed"}var rA=_g,oA=Mg,nA=Pg,Gg=Og,Vg=Lg;const zg=rA,ed=m.forwardRef(({className:e,...t},r)=>s.jsx(oA,{ref:r,className:be("border-b",e),...t}));ed.displayName="AccordionItem";const td=m.forwardRef(({className:e,children:t,...r},o)=>s.jsx(nA,{className:"flex",children:s.jsxs(Gg,{ref:o,className:be("flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",e),...r,children:[t,s.jsx(Eo,{className:"h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200"})]})}));td.displayName=Gg.displayName;const rd=m.forwardRef(({className:e,children:t,...r},o)=>s.jsx(Vg,{ref:o,className:"overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...r,children:s.jsx("div",{className:be("pb-4 pt-0",e),children:t})}));rd.displayName=Vg.displayName;function od(e,t,r){var o,n,a,l;switch(t){case"properties":return(o=e.properties)==null?void 0:o[r];case"config":return(n=e.config)==null?void 0:n[r];case"layout":return(a=e.layout)==null?void 0:a[r];case"validation":return(l=e.validation)==null?void 0:l[r];default:return}}function aA(e,t,r,o){switch(e){case"properties":return{properties:{...t.properties,[r]:o}};case"config":return{config:{...t.config,[r]:o}};case"layout":return{layout:{...t.layout,[r]:o}};case"validation":return{validation:{...t.validation,[r]:o}};default:return{}}}function sA(e,t,r){const{field:o,value:n}=r;if(o.includes(".")){const[l,...i]=o.split("."),c=i.join(".");return od(e,l,c)===n}return od(e,t.section,o)===n}const Bg=({field:e,element:t,onUpdate:r})=>{var a;const o=od(t,e.section,e.key)??e.defaultValue,n=l=>{r(aA(e.section,t,e.key,l))};switch(e.type){case"text":case"url":case"color":return s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Bt,{className:"text-xs font-medium text-muted-foreground",children:e.label}),s.jsx(Vt,{type:e.type==="color"?"color":e.type==="url"?"url":"text",value:o??"",onChange:l=>n(l.target.value),placeholder:e.placeholder}),e.description&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:e.description})]});case"textarea":return s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Bt,{className:"text-xs font-medium text-muted-foreground",children:e.label}),s.jsx(Yc,{value:o??"",onChange:l=>n(l.target.value),placeholder:e.placeholder,rows:e.rows??3}),e.description&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:e.description})]});case"number":return s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Bt,{className:"text-xs font-medium text-muted-foreground",children:e.label}),s.jsx(Vt,{type:"number",value:o??"",onChange:l=>{const i=l.target.value;n(i?Number.isInteger(e.min)||Number.isInteger(e.max)?parseInt(i,10):parseFloat(i):void 0)},placeholder:e.placeholder,min:e.min,max:e.max}),e.description&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:e.description})]});case"checkbox":return s.jsxs("div",{className:"flex items-start space-x-2",children:[s.jsx(Kc,{id:`ds-${e.section}-${e.key}`,checked:!!o,onCheckedChange:l=>n(!!l)}),s.jsxs("div",{className:"space-y-0.5 leading-none",children:[s.jsx(Bt,{htmlFor:`ds-${e.section}-${e.key}`,className:"text-xs font-medium text-foreground cursor-pointer",children:e.label}),e.description&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:e.description})]})]});case"select":return s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Bt,{className:"text-xs font-medium text-muted-foreground",children:e.label}),s.jsxs(Ia,{value:o!=null?String(o):"",onValueChange:l=>{var c;const i=(c=e.options)==null?void 0:c.find(d=>typeof d.value=="number"&&String(d.value)===l);n(i?i.value:l)},children:[s.jsx(en,{children:s.jsx(Pa,{placeholder:e.placeholder||"Select..."})}),s.jsx(tn,{children:(a=e.options)==null?void 0:a.map(l=>s.jsx(Rr,{value:String(l.value),children:l.label},String(l.value)))})]}),e.description&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:e.description})]});default:return null}},lA=({title:e,icon:t,defaultOpen:r=!0,children:o})=>s.jsx(zg,{type:"single",collapsible:!0,defaultValue:r?"item":void 0,children:s.jsxs(ed,{value:"item",className:"border-b border-border",children:[s.jsx(td,{className:"px-4 py-3 hover:bg-muted/50 hover:no-underline",children:s.jsxs("span",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[t&&s.jsx("span",{children:t}),e]})}),s.jsx(rd,{className:"px-4 pb-4",children:s.jsx("div",{className:"space-y-4",children:o})})]})}),iA=({element:e,schema:t,onUpdate:r})=>{const o=t.fields.filter(c=>c.showWhen?sA(e,c,c.showWhen):!0),n=[];let a=[];const l=()=>{a.length>0&&(n.push(a),a=[])};for(const c of o)c.colSpan===1?(a.push(c),a.length===2&&l()):(l(),n.push([c]));l();const{configSection:i}=t;return s.jsx(lA,{title:(i==null?void 0:i.title)??"Settings",icon:i==null?void 0:i.icon,defaultOpen:!1,children:n.map((c,d)=>{if(!c.every(u=>u.colSpan===1)){const u=c[0];return s.jsx(Bg,{field:u,element:e,onUpdate:r},`${u.section}.${u.key}`)}return s.jsx("div",{className:"grid grid-cols-2 gap-2",children:c.map(u=>s.jsx(Bg,{field:u,element:e,onUpdate:r},`${u.section}.${u.key}`))},`row-${d}`)})})},Br=({title:e,children:t,defaultOpen:r=!0,icon:o})=>s.jsx(zg,{type:"single",collapsible:!0,defaultValue:r?"item":void 0,children:s.jsxs(ed,{value:"item",className:"border-b border-border",children:[s.jsx(td,{className:"px-4 py-3 hover:bg-muted/50 hover:no-underline",children:s.jsxs("span",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:[o&&s.jsx("span",{children:o}),e]})}),s.jsx(rd,{className:"px-4 pb-4",children:s.jsx("div",{className:"space-y-4",children:t})})]})}),Oe=({label:e,value:t,onChange:r,type:o="text",placeholder:n,rows:a=3,min:l,max:i,step:c,helpText:d})=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Bt,{className:"text-sm font-medium",children:e}),o==="textarea"?s.jsx(Yc,{value:t??"",onChange:p=>r(p.target.value),placeholder:n,rows:a,className:"resize-none"}):o==="color"?s.jsxs("div",{className:"flex gap-2",children:[s.jsx("input",{type:"color",value:(t==null?void 0:t.toString())||"#000000",onChange:p=>r(p.target.value),className:"w-10 h-9 border border-input rounded-md cursor-pointer"}),s.jsx(Vt,{type:"text",value:t??"",onChange:p=>r(p.target.value),placeholder:n||"#000000",className:"flex-1"})]}):s.jsx(Vt,{type:o,value:t??"",onChange:p=>r(p.target.value),placeholder:n,min:l,max:i,step:c}),d&&s.jsx("p",{className:"text-xs text-muted-foreground",children:d})]}),Ug=({label:e,checked:t,onChange:r,description:o})=>s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx(Kc,{id:e,checked:t||!1,onCheckedChange:n=>r(n===!0),className:"mt-0.5"}),s.jsxs("div",{className:"grid gap-0.5 leading-none",children:[s.jsx(Bt,{htmlFor:e,className:"text-sm font-medium cursor-pointer",children:e}),o&&s.jsx("p",{className:"text-xs text-muted-foreground",children:o})]})]}),nd=({label:e,value:t,onChange:r,options:o,helpText:n})=>s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(Bt,{className:"text-sm font-medium",children:e}),s.jsxs(Ia,{value:(t==null?void 0:t.toString())??"",onValueChange:r,children:[s.jsx(en,{className:"w-full",children:s.jsx(Pa,{placeholder:"Select..."})}),s.jsx(tn,{children:o.map(a=>s.jsx(Rr,{value:a.value,children:a.label},a.value))})]}),n&&s.jsx("p",{className:"text-xs text-muted-foreground",children:n})]}),cA=({options:e,onChange:t})=>{const r=(l,i,c)=>{const d=[...e];if(d[l]={...d[l],[i]:c},i==="label"){const p=d[l].value,u=e[l].label;(!p||p===Ol(u))&&(d[l].value=Ol(c))}t(d)},o=()=>{const l=e.length+1;t([...e,{label:`Option ${l}`,value:`option${l}`}])},n=l=>{e.length>1&&t(e.filter((i,c)=>c!==l))},a=(l,i)=>{const c=i==="up"?l-1:l+1;if(c<0||c>=e.length)return;const d=[...e];[d[l],d[c]]=[d[c],d[l]],t(d)};return s.jsxs("div",{className:"space-y-2",children:[s.jsx(Bt,{className:"text-sm font-medium",children:"Options"}),s.jsx("div",{className:"space-y-2",children:e.map((l,i)=>s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx(Be,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>a(i,"up"),disabled:i===0,children:s.jsx(Fp,{className:"h-3 w-3"})}),s.jsx(Be,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>a(i,"down"),disabled:i===e.length-1,children:s.jsx(Eo,{className:"h-3 w-3"})})]}),s.jsx(Vt,{type:"text",value:l.label,onChange:c=>r(i,"label",c.target.value),placeholder:"Label",className:"flex-1 h-8"}),s.jsx(Vt,{type:"text",value:l.value,onChange:c=>r(i,"value",c.target.value),placeholder:"Value",className:"w-20 h-8 text-muted-foreground"}),s.jsx(ja,{children:s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>n(i),disabled:e.length<=1,children:s.jsx(Da,{className:"h-4 w-4"})})}),s.jsx(Yt,{children:s.jsx("p",{children:"Remove option"})})]})})]},i))}),s.jsxs(Be,{variant:"ghost",size:"sm",className:"text-primary",onClick:o,children:[s.jsx(mi,{className:"h-4 w-4 mr-1"}),"Add option"]})]})},dA=({rows:e,columns:t,onRowsChange:r,onColumnsChange:o,showColumnType:n=!1})=>{const a=()=>{const u=`row${e.length+1}`;r([...e,{id:u,label:`Row ${e.length+1}`}])},l=u=>{e.length>1&&r(e.filter((f,h)=>h!==u))},i=(u,f,h)=>{const b=[...e];b[u]={...b[u],[f]:h},r(b)},c=()=>{const u=`col${t.length+1}`;o([...t,{id:u,label:`Column ${t.length+1}`,type:"text"}])},d=u=>{t.length>1&&o(t.filter((f,h)=>h!==u))},p=(u,f,h)=>{const b=[...t];b[u]={...b[u],[f]:h},o(b)};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(Bt,{className:"text-sm font-medium",children:"Rows"}),s.jsx("div",{className:"space-y-2",children:e.map((u,f)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vt,{type:"text",value:u.id,onChange:h=>i(f,"id",h.target.value),placeholder:"Row ID",className:"w-24 h-8 font-mono text-xs"}),s.jsx(Vt,{type:"text",value:u.label,onChange:h=>i(f,"label",h.target.value),placeholder:"Row label",className:"flex-1 h-8"}),s.jsx(Be,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>l(f),disabled:e.length<=1,children:s.jsx(Da,{className:"h-4 w-4"})})]},f))}),s.jsxs(Be,{variant:"ghost",size:"sm",className:"text-primary",onClick:a,children:[s.jsx(mi,{className:"h-4 w-4 mr-1"}),"Add row"]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(Bt,{className:"text-sm font-medium",children:"Columns"}),s.jsx("div",{className:"space-y-2",children:t.map((u,f)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vt,{type:"text",value:u.id,onChange:h=>p(f,"id",h.target.value),placeholder:"Column ID",className:"w-24 h-8 font-mono text-xs"}),s.jsx(Vt,{type:"text",value:u.label,onChange:h=>p(f,"label",h.target.value),placeholder:"Column label",className:"flex-1 h-8"}),n&&s.jsxs(Ia,{value:u.type||"text",onValueChange:h=>p(f,"type",h),children:[s.jsx(en,{className:"w-24 h-8",children:s.jsx(Pa,{})}),s.jsxs(tn,{children:[s.jsx(Rr,{value:"text",children:"Text"}),s.jsx(Rr,{value:"number",children:"Number"}),s.jsx(Rr,{value:"dropdown",children:"Dropdown"})]})]}),s.jsx(Be,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>d(f),disabled:t.length<=1,children:s.jsx(Da,{className:"h-4 w-4"})})]},f))}),s.jsxs(Be,{variant:"ghost",size:"sm",className:"text-primary",onClick:c,children:[s.jsx(mi,{className:"h-4 w-4 mr-1"}),"Add column"]})]})]})},uA=({element:e,onUpdate:t})=>{const r=(c,d)=>{t({properties:{...e.properties,[c]:d}})},o=["shortText","longText","multiLineInput","textEditor","number","email","phone","url","location","password","dropdown","tags","date","time","dateTime","multipleDates","dateRange"].includes(e.type),n=!["divider","spacer","paragraph","image","link"].includes(e.type),a=["paragraph"].includes(e.type),l=["link"].includes(e.type),i=["image"].includes(e.type);return s.jsxs(Br,{title:"Properties",icon:"📝",children:[!["divider","spacer"].includes(e.type)&&s.jsx(Oe,{label:"Label",value:e.properties.label,onChange:c=>r("label",c),placeholder:"Enter label..."}),o&&s.jsx(Oe,{label:"Placeholder",value:e.properties.placeholder,onChange:c=>r("placeholder",c),placeholder:"Enter placeholder..."}),n&&s.jsx(Oe,{label:"Description",value:e.properties.description,onChange:c=>r("description",c),type:"textarea",placeholder:"Enter description...",rows:2}),a&&s.jsx(Oe,{label:"Content",value:e.properties.content,onChange:c=>r("content",c),type:"textarea",placeholder:"Enter paragraph text...",rows:4}),l&&s.jsxs(s.Fragment,{children:[s.jsx(Oe,{label:"Link Text",value:e.properties.content,onChange:c=>r("content",c),placeholder:"Click here"}),s.jsx(Oe,{label:"URL",value:e.properties.href,onChange:c=>r("href",c),type:"url",placeholder:"https://example.com"}),s.jsx(nd,{label:"Target",value:e.properties.target,onChange:c=>r("target",c),options:[{value:"_blank",label:"New Tab"},{value:"_self",label:"Same Tab"}]})]}),i&&s.jsxs(s.Fragment,{children:[s.jsx(Oe,{label:"Image URL",value:e.properties.src,onChange:c=>r("src",c),type:"url",placeholder:"https://example.com/image.jpg"}),s.jsx(Oe,{label:"Alt Text",value:e.properties.alt,onChange:c=>r("alt",c),placeholder:"Image description"})]}),["shortText","number"].includes(e.type)&&s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(Oe,{label:"Prefix",value:e.properties.prefix,onChange:c=>r("prefix",c),placeholder:"$"}),s.jsx(Oe,{label:"Suffix",value:e.properties.suffix,onChange:c=>r("suffix",c),placeholder:".00"})]})]})},pA=({element:e,onUpdate:t})=>{const r=(n,a)=>{t({layout:{...e.layout,[n]:a}})},o=!["divider","spacer","formHeading","sectionHeading","subheading","paragraph","image","link","captcha","decisionBox"].includes(e.type);return s.jsxs(Br,{title:"Layout",icon:"📐",defaultOpen:!1,children:[o&&s.jsx(nd,{label:"Label Position",value:e.layout.labelPosition,onChange:n=>r("labelPosition",n),options:[{value:"top",label:"Top"},{value:"left",label:"Left"},{value:"hidden",label:"Hidden"}]}),s.jsx(nd,{label:"Size",value:e.layout.size,onChange:n=>r("size",n),options:[{value:"small",label:"Small"},{value:"default",label:"Default"},{value:"medium",label:"Medium"},{value:"large",label:"Large"},{value:"full",label:"Full Width"}]}),s.jsx(Oe,{label:"Custom Width",value:e.layout.width,onChange:n=>r("width",n),placeholder:"e.g., 50%, 300px"}),s.jsx(Oe,{label:"CSS Class",value:e.layout.className,onChange:n=>r("className",n),placeholder:"custom-class",helpText:"Additional CSS classes"})]})},fA=({element:e,onUpdate:t})=>{var c,d,p,u,f,h,b,g,y,x,v;const r=(w,S)=>{t({validation:{...e.validation,[w]:S}})},o=Uv(e.type),n=["shortText","longText","multiLineInput","textEditor","password"].includes(e.type),a=["number","slider","rangeSlider"].includes(e.type),l=["multiFileUpload","multiImageUpload"].includes(e.type),i=["multipleDates"].includes(e.type);return s.jsxs(Br,{title:"Validation",icon:"✅",defaultOpen:!1,children:[o.supportsRequired&&s.jsx(Ug,{label:"Required",checked:(c=e.validation)==null?void 0:c.required,onChange:w=>r("required",w),description:"Field must be filled"}),n&&s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(Oe,{label:"Min Length",value:(d=e.validation)==null?void 0:d.minLength,onChange:w=>r("minLength",w?parseInt(w):void 0),type:"number",placeholder:"0",min:0}),s.jsx(Oe,{label:"Max Length",value:(p=e.validation)==null?void 0:p.maxLength,onChange:w=>r("maxLength",w?parseInt(w):void 0),type:"number",placeholder:"255",min:0})]}),a&&s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(Oe,{label:"Min Value",value:(u=e.validation)==null?void 0:u.min,onChange:w=>r("min",w?parseFloat(w):void 0),type:"number"}),s.jsx(Oe,{label:"Max Value",value:(f=e.validation)==null?void 0:f.max,onChange:w=>r("max",w?parseFloat(w):void 0),type:"number"})]}),o.supportsPattern&&s.jsx(Oe,{label:"Pattern (Regex)",value:(h=e.validation)==null?void 0:h.pattern,onChange:w=>r("pattern",w),placeholder:"^[a-zA-Z]+$",helpText:"Regular expression for validation"}),l&&s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(Oe,{label:"Min Files",value:(b=e.validation)==null?void 0:b.minFiles,onChange:w=>r("minFiles",w?parseInt(w):void 0),type:"number",min:0}),s.jsx(Oe,{label:"Max Files",value:(g=e.validation)==null?void 0:g.maxFiles,onChange:w=>r("maxFiles",w?parseInt(w):void 0),type:"number",min:1})]}),i&&s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(Oe,{label:"Min Dates",value:(y=e.validation)==null?void 0:y.minDates,onChange:w=>r("minDates",w?parseInt(w):void 0),type:"number",min:0}),s.jsx(Oe,{label:"Max Dates",value:(x=e.validation)==null?void 0:x.maxDates,onChange:w=>r("maxDates",w?parseInt(w):void 0),type:"number",min:1})]}),s.jsx(Oe,{label:"Error Message",value:(v=e.validation)==null?void 0:v.errorMessage,onChange:w=>r("errorMessage",w),placeholder:"Custom error message..."})]})},hA=({element:e,onUpdate:t,existingNames:r})=>{const[o,n]=C.useState(null),a=(l,i)=>{{const c=new Set(r);c.delete(e.attributes.name),c.has(i)?n("This field name already exists"):!i||i.trim()===""?n("Field name is required"):/^[a-zA-Z][a-zA-Z0-9_]*$/.test(i)?n(null):n("Must start with letter, only letters/numbers/underscores")}t({attributes:{...e.attributes,[l]:i}})};return s.jsx(Br,{title:"Attributes",icon:"🏷️",defaultOpen:!1,children:s.jsxs("div",{children:[s.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Field Name"}),s.jsx("input",{type:"text",value:e.attributes.name||"",onChange:l=>a("name",l.target.value),placeholder:"fieldName",className:`w-full px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:border-transparent ${o?"border-red-300 focus:ring-red-500":"border-gray-300 focus:ring-blue-500"}`}),o&&s.jsx("p",{className:"mt-1 text-xs text-red-600",children:o}),s.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Used as the key in JSON output"})]})})},mA=({element:e,onUpdate:t})=>{var n,a,l,i;const r=c=>{t({config:{...e.config,options:c}})},o=(c,d)=>{t({config:{...e.config,[c]:d}})};return s.jsxs(Br,{title:"Options",icon:"📋",children:[s.jsx(cA,{options:((n=e.config)==null?void 0:n.options)||[],onChange:r}),s.jsx(Ug,{label:"Allow 'Other' option",checked:(a=e.config)==null?void 0:a.allowOther,onChange:c=>o("allowOther",c),description:"Let users enter custom value"}),((l=e.config)==null?void 0:l.allowOther)&&s.jsx(Oe,{label:"Other Label",value:(i=e.config)==null?void 0:i.otherLabel,onChange:c=>o("otherLabel",c),placeholder:"Other..."})]})},gA=({element:e,onUpdate:t})=>{var o,n;const r=(a,l)=>{t({config:{...e.config,[a]:l}})};return s.jsx(Br,{title:"Matrix Configuration",icon:"📊",children:s.jsx(dA,{rows:((o=e.config)==null?void 0:o.matrixRows)||[],columns:((n=e.config)==null?void 0:n.matrixColumns)||[],onRowsChange:a=>r("matrixRows",a),onColumnsChange:a=>r("matrixColumns",a),showColumnType:e.type==="matrixTable"})})},bA=()=>s.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center px-6 py-12",children:[s.jsx("div",{className:"w-12 h-12 bg-muted rounded-full flex items-center justify-center mb-4",children:s.jsx(US,{className:"w-6 h-6 text-muted-foreground"})}),s.jsx("h3",{className:"text-sm font-medium text-foreground mb-1",children:"No element selected"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Click on an element in the canvas to edit its properties"})]}),yA=({element:e,onUpdate:t,propertyConfig:r})=>{const o=(p,u)=>{t({properties:{...e.properties,[p]:u}})},n=r??{showLabel:!0,showPlaceholder:!0,showDescription:!0,showPrefix:!1,showSuffix:!1},a=n.showLabel!==!1,l=n.showPlaceholder===!0,i=n.showDescription!==!1,c=n.showPrefix===!0,d=n.showSuffix===!0;return!a&&!l&&!i&&!c&&!d?null:s.jsxs(Br,{title:"Properties",icon:"📝",children:[a&&s.jsx(Oe,{label:"Label",value:e.properties.label,onChange:p=>o("label",p),placeholder:"Enter label..."}),l&&s.jsx(Oe,{label:"Placeholder",value:e.properties.placeholder,onChange:p=>o("placeholder",p),placeholder:"Enter placeholder..."}),i&&s.jsx(Oe,{label:"Description",value:e.properties.description,onChange:p=>o("description",p),type:"textarea",placeholder:"Enter description...",rows:2}),(c||d)&&s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[c&&s.jsx(Oe,{label:"Prefix",value:e.properties.prefix,onChange:p=>o("prefix",p),placeholder:"$"}),d&&s.jsx(Oe,{label:"Suffix",value:e.properties.suffix,onChange:p=>o("suffix",p),placeholder:".00"})]})]})},vA=()=>{const e=Yv(),t=J(b=>b.updateElement),r=J(b=>b.deleteElement),o=J(b=>b.duplicateElement),n=J(b=>b.schema.elements),a=C.useMemo(()=>new Set(n.map(b=>b.attributes.name).filter(Boolean)),[n]);if(!e)return s.jsx("div",{className:"w-80 bg-card border-l border-border flex-col h-full hidden",children:s.jsx(bA,{})});const l=b=>{t(e.id,b)},i=Ke.get(e.type),c=!!(i!=null&&i.renderSettings),d=i==null?void 0:i.settingsSchema,p=c||!!d,u=i!=null&&i.icon&&typeof i.icon=="string"?i.icon:Si[e.type],f=(i==null?void 0:i.label)??wi[e.type],h=d==null?void 0:d.showSections;return s.jsxs("div",{className:"w-80 bg-card border-l border-border flex flex-col h-full",children:[s.jsxs("div",{className:"p-4 border-b border-border",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx("span",{className:"text-xl",children:u}),s.jsx("h2",{className:"text-lg font-semibold text-foreground",children:f})]}),s.jsxs("div",{className:"flex gap-2 mt-3",children:[s.jsxs(Be,{variant:"secondary",size:"sm",className:"flex-1",onClick:()=>o(e.id),children:[s.jsx(LS,{className:"h-3 w-3 mr-1"}),"Duplicate"]}),s.jsxs(Be,{variant:"destructive",size:"sm",className:"flex-1",onClick:()=>{window.confirm("Are you sure you want to delete this element?")&&r(e.id)},children:[s.jsx(gi,{className:"h-3 w-3 mr-1"}),"Delete"]})]})]}),s.jsxs(Fi,{className:"flex-1",children:[c&&i.renderSettings({element:e,onUpdate:l}),!c&&s.jsxs(s.Fragment,{children:[(h==null?void 0:h.properties)!==!1&&(p?s.jsx(yA,{element:e,onUpdate:l,propertyConfig:d==null?void 0:d.properties}):s.jsx(uA,{element:e,onUpdate:l})),(h==null?void 0:h.options)!==!1&&iN(e.type)&&s.jsx(mA,{element:e,onUpdate:l}),(h==null?void 0:h.matrix)!==!1&&dN(e.type)&&s.jsx(gA,{element:e,onUpdate:l}),d&&s.jsx(iA,{element:e,schema:d,onUpdate:l}),(h==null?void 0:h.layout)!==!1&&s.jsx(pA,{element:e,onUpdate:l}),(h==null?void 0:h.validation)!==!1&&((i==null?void 0:i.supportsValidation)??cN(e.type))&&!Ll(e.type)&&s.jsx(fA,{element:e,onUpdate:l}),(h==null?void 0:h.attributes)!==!1&&((i==null?void 0:i.structure)==="field"||nN(e.type))&&!Ll(e.type)&&s.jsx(hA,{element:e,onUpdate:l,existingNames:a}),(h==null?void 0:h.logic)!==!1&&!Ll(e.type)&&s.jsx(Br,{title:"Conditional Logic",icon:"⚡",children:s.jsx(GD,{element:e,elements:n,onUpdate:l})})]})]})]})};var Tn=e=>e.type==="checkbox",ho=e=>e instanceof Date,Et=e=>e==null;const Wg=e=>typeof e=="object";var Je=e=>!Et(e)&&!Array.isArray(e)&&Wg(e)&&!ho(e),xA=e=>Je(e)&&e.target?Tn(e.target)?e.target.checked:e.target.value:e,wA=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,SA=(e,t)=>e.has(wA(t)),CA=e=>{const t=e.constructor&&e.constructor.prototype;return Je(t)&&t.hasOwnProperty("isPrototypeOf")},ad=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function rt(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(ad&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Je(e)&&CA(e)))return e;const o=r?[]:Object.create(Object.getPrototypeOf(e));for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=rt(e[n]));return o}var ul=e=>/^\w*$/.test(e),Ue=e=>e===void 0,sd=e=>Array.isArray(e)?e.filter(Boolean):[],ld=e=>sd(e.replace(/["|']|\]/g,"").split(/\.|\[/)),ae=(e,t,r)=>{if(!t||!Je(e))return r;const o=(ul(t)?[t]:ld(t)).reduce((n,a)=>Et(n)?n:n[a],e);return Ue(o)||o===e?Ue(e[t])?r:e[t]:o},ir=e=>typeof e=="boolean",Xt=e=>typeof e=="function",Ve=(e,t,r)=>{let o=-1;const n=ul(t)?[t]:ld(t),a=n.length,l=a-1;for(;++o<a;){const i=n[o];let c=r;if(o!==l){const d=e[i];c=Je(d)||Array.isArray(d)?d:isNaN(+n[o+1])?{}:[]}if(i==="__proto__"||i==="constructor"||i==="prototype")return;e[i]=c,e=e[i]}};const Hg={BLUR:"blur",FOCUS_OUT:"focusout"},Jt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Sr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},jg=C.createContext(null);jg.displayName="HookFormControlContext";var NA=(e,t,r,o=!0)=>{const n={defaultValues:t._defaultValues};for(const a in e)Object.defineProperty(n,a,{get:()=>{const l=a;return t._proxyFormState[l]!==Jt.all&&(t._proxyFormState[l]=!o||Jt.all),e[l]}});return n};const EA=typeof window<"u"?C.useLayoutEffect:C.useEffect;var Ft=e=>typeof e=="string",kA=(e,t,r,o,n)=>Ft(e)?(o&&t.watch.add(e),ae(r,e,n)):Array.isArray(e)?e.map(a=>(o&&t.watch.add(a),ae(r,a))):(o&&(t.watchAll=!0),r),id=e=>Et(e)||!Wg(e);function Ur(e,t,r=new WeakSet){if(id(e)||id(t))return Object.is(e,t);if(ho(e)&&ho(t))return Object.is(e.getTime(),t.getTime());const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const a of o){const l=e[a];if(!n.includes(a))return!1;if(a!=="ref"){const i=t[a];if(ho(l)&&ho(i)||Je(l)&&Je(i)||Array.isArray(l)&&Array.isArray(i)?!Ur(l,i,r):!Object.is(l,i))return!1}}return!0}const cd=C.createContext(null);cd.displayName="HookFormContext";const dd=()=>C.useContext(cd),Yg=e=>{const{children:t,watch:r,getValues:o,getFieldState:n,setError:a,clearErrors:l,setValue:i,trigger:c,formState:d,resetField:p,reset:u,handleSubmit:f,unregister:h,control:b,register:g,setFocus:y,subscribe:x}=e;return C.createElement(cd.Provider,{value:C.useMemo(()=>({watch:r,getValues:o,getFieldState:n,setError:a,clearErrors:l,setValue:i,trigger:c,formState:d,resetField:p,reset:u,handleSubmit:f,unregister:h,control:b,register:g,setFocus:y,subscribe:x}),[l,b,d,n,o,f,g,u,p,a,y,i,x,c,h,r])},C.createElement(jg.Provider,{value:b},t))};var _A=(e,t,r,o,n)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[o]:n||!0}}:{},Mn=e=>Array.isArray(e)?e:[e],qg=()=>{let e=[];return{get observers(){return e},next:n=>{for(const a of e)a.next&&a.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(a=>a!==n)}}),unsubscribe:()=>{e=[]}}};function Qg(e,t){const r={};for(const o in e)if(e.hasOwnProperty(o)){const n=e[o],a=t[o];if(n&&Je(n)&&a){const l=Qg(n,a);Je(l)&&(r[o]=l)}else e[o]&&(r[o]=a)}return r}var wt=e=>Je(e)&&!Object.keys(e).length,ud=e=>e.type==="file",pl=e=>{if(!ad)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},Kg=e=>e.type==="select-multiple",pd=e=>e.type==="radio",DA=e=>pd(e)||Tn(e),fd=e=>pl(e)&&e.isConnected;function AA(e,t){const r=t.slice(0,-1).length;let o=0;for(;o<r;)e=Ue(e)?o++:e[t[o++]];return e}function TA(e){for(const t in e)if(e.hasOwnProperty(t)&&!Ue(e[t]))return!1;return!0}function Ze(e,t){const r=Array.isArray(t)?t:ul(t)?[t]:ld(t),o=r.length===1?e:AA(e,r),n=r.length-1,a=r[n];return o&&delete o[a],n!==0&&(Je(o)&&wt(o)||Array.isArray(o)&&TA(o))&&Ze(e,r.slice(0,-1)),e}var MA=e=>{for(const t in e)if(Xt(e[t]))return!0;return!1};function Xg(e){return Array.isArray(e)||Je(e)&&!MA(e)}function hd(e,t={}){for(const r in e){const o=e[r];Xg(o)?(t[r]=Array.isArray(o)?[]:{},hd(o,t[r])):Ue(o)||(t[r]=!0)}return t}function Fo(e,t,r){r||(r=hd(t));for(const o in e){const n=e[o];if(Xg(n))Ue(t)||id(r[o])?r[o]=hd(n,Array.isArray(n)?[]:{}):Fo(n,Et(t)?{}:t[o],r[o]);else{const a=t[o];r[o]=!Ur(n,a)}}return r}const Jg={value:!1,isValid:!1},Zg={value:!0,isValid:!0};var Rg=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ue(e[0].attributes.value)?Ue(e[0].value)||e[0].value===""?Zg:{value:e[0].value,isValid:!0}:Zg:Jg}return Jg},eb=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:o})=>Ue(e)?e:t?e===""?NaN:e&&+e:r&&Ft(e)?new Date(e):o?o(e):e;const tb={isValid:!1,value:null};var rb=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,tb):tb;function ob(e){const t=e.ref;return ud(t)?t.files:pd(t)?rb(e.refs).value:Kg(t)?[...t.selectedOptions].map(({value:r})=>r):Tn(t)?Rg(e.refs).value:eb(Ue(t.value)?e.ref.value:t.value,e)}var IA=(e,t,r,o)=>{const n={};for(const a of e){const l=ae(t,a);l&&Ve(n,a,l._f)}return{criteriaMode:r,names:[...e],fields:n,shouldUseNativeValidation:o}},fl=e=>e instanceof RegExp,In=e=>Ue(e)?e:fl(e)?e.source:Je(e)?fl(e.value)?e.value.source:e.value:e,nb=e=>({isOnSubmit:!e||e===Jt.onSubmit,isOnBlur:e===Jt.onBlur,isOnChange:e===Jt.onChange,isOnAll:e===Jt.all,isOnTouch:e===Jt.onTouched});const ab="AsyncFunction";var PA=e=>!!e&&!!e.validate&&!!(Xt(e.validate)&&e.validate.constructor.name===ab||Je(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===ab)),OA=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),sb=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(o=>e.startsWith(o)&&/^\.\w+/.test(e.slice(o.length))));const Pn=(e,t,r,o)=>{for(const n of r||Object.keys(e)){const a=ae(e,n);if(a){const{_f:l,...i}=a;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],n)&&!o)return!0;if(l.ref&&t(l.ref,l.name)&&!o)return!0;if(Pn(i,t))break}else if(Je(i)&&Pn(i,t))break}}};function lb(e,t,r){const o=ae(e,r);if(o||ul(r))return{error:o,name:r};const n=r.split(".");for(;n.length;){const a=n.join("."),l=ae(t,a),i=ae(e,a);if(l&&!Array.isArray(l)&&r!==a)return{name:r};if(i&&i.type)return{name:a,error:i};if(i&&i.root&&i.root.type)return{name:`${a}.root`,error:i.root};n.pop()}return{name:r}}var $A=(e,t,r,o)=>{r(e);const{name:n,...a}=e;return wt(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(l=>t[l]===(!o||Jt.all))},LA=(e,t,r)=>!e||!t||e===t||Mn(e).some(o=>o&&(r?o===t:o.startsWith(t)||t.startsWith(o))),FA=(e,t,r,o,n)=>n.isOnAll?!1:!r&&n.isOnTouch?!(t||e):(r?o.isOnBlur:n.isOnBlur)?!e:(r?o.isOnChange:n.isOnChange)?e:!0,GA=(e,t)=>!sd(ae(e,t)).length&&Ze(e,t),VA=(e,t,r)=>{const o=Mn(ae(e,r));return Ve(o,"root",t[r]),Ve(e,r,o),e};function ib(e,t,r="validate"){if(Ft(e)||Array.isArray(e)&&e.every(Ft)||ir(e)&&!e)return{type:r,message:Ft(e)?e:"",ref:t}}var Go=e=>Je(e)&&!fl(e)?e:{value:e,message:""},cb=async(e,t,r,o,n,a)=>{const{ref:l,refs:i,required:c,maxLength:d,minLength:p,min:u,max:f,pattern:h,validate:b,name:g,valueAsNumber:y,mount:x}=e._f,v=ae(r,g);if(!x||t.has(g))return{};const w=i?i[0]:l,S=$=>{n&&w.reportValidity&&(w.setCustomValidity(ir($)?"":$||""),w.reportValidity())},E={},N=pd(l),T=Tn(l),k=N||T,M=(y||ud(l))&&Ue(l.value)&&Ue(v)||pl(l)&&l.value===""||v===""||Array.isArray(v)&&!v.length,D=_A.bind(null,g,o,E),U=($,F,q,R=Sr.maxLength,W=Sr.minLength)=>{const Q=$?F:q;E[g]={type:$?R:W,message:Q,ref:l,...D($?R:W,Q)}};if(a?!Array.isArray(v)||!v.length:c&&(!k&&(M||Et(v))||ir(v)&&!v||T&&!Rg(i).isValid||N&&!rb(i).isValid)){const{value:$,message:F}=Ft(c)?{value:!!c,message:c}:Go(c);if($&&(E[g]={type:Sr.required,message:F,ref:w,...D(Sr.required,F)},!o))return S(F),E}if(!M&&(!Et(u)||!Et(f))){let $,F;const q=Go(f),R=Go(u);if(!Et(v)&&!isNaN(v)){const W=l.valueAsNumber||v&&+v;Et(q.value)||($=W>q.value),Et(R.value)||(F=W<R.value)}else{const W=l.valueAsDate||new Date(v),Q=pe=>new Date(new Date().toDateString()+" "+pe),P=l.type=="time",z=l.type=="week";Ft(q.value)&&v&&($=P?Q(v)>Q(q.value):z?v>q.value:W>new Date(q.value)),Ft(R.value)&&v&&(F=P?Q(v)<Q(R.value):z?v<R.value:W<new Date(R.value))}if(($||F)&&(U(!!$,q.message,R.message,Sr.max,Sr.min),!o))return S(E[g].message),E}if((d||p)&&!M&&(Ft(v)||a&&Array.isArray(v))){const $=Go(d),F=Go(p),q=!Et($.value)&&v.length>+$.value,R=!Et(F.value)&&v.length<+F.value;if((q||R)&&(U(q,$.message,F.message),!o))return S(E[g].message),E}if(h&&!M&&Ft(v)){const{value:$,message:F}=Go(h);if(fl($)&&!v.match($)&&(E[g]={type:Sr.pattern,message:F,ref:l,...D(Sr.pattern,F)},!o))return S(F),E}if(b){if(Xt(b)){const $=await b(v,r),F=ib($,w);if(F&&(E[g]={...F,...D(Sr.validate,F.message)},!o))return S(F.message),E}else if(Je(b)){let $={};for(const F in b){if(!wt($)&&!o)break;const q=ib(await b[F](v,r),w,F);q&&($={...q,...D(F,q.message)},S(q.message),o&&(E[g]=$))}if(!wt($)&&(E[g]={ref:w,...$},!o))return E}}return S(!0),E};const zA={mode:Jt.onSubmit,reValidateMode:Jt.onChange,shouldFocusError:!0};function BA(e={}){let t={...zA,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Xt(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},o={},n=Je(t.defaultValues)||Je(t.values)?rt(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:rt(n),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={...p};let f={...u};const h={array:qg(),state:qg()},b=t.criteriaMode===Jt.all,g=_=>A=>{clearTimeout(d),d=setTimeout(_,A)},y=async _=>{if(!l.keepIsValid&&!t.disabled&&(u.isValid||f.isValid||_)){let A;t.resolver?(A=wt((await k()).errors),x()):A=await D(o,!0),A!==r.isValid&&h.state.next({isValid:A})}},x=(_,A)=>{!t.disabled&&(u.isValidating||u.validatingFields||f.isValidating||f.validatingFields)&&((_||Array.from(i.mount)).forEach(I=>{I&&(A?Ve(r.validatingFields,I,A):Ze(r.validatingFields,I))}),h.state.next({validatingFields:r.validatingFields,isValidating:!wt(r.validatingFields)}))},v=(_,A=[],I,V,G=!0,O=!0)=>{if(V&&I&&!t.disabled){if(l.action=!0,O&&Array.isArray(ae(o,_))){const Z=I(ae(o,_),V.argA,V.argB);G&&Ve(o,_,Z)}if(O&&Array.isArray(ae(r.errors,_))){const Z=I(ae(r.errors,_),V.argA,V.argB);G&&Ve(r.errors,_,Z),GA(r.errors,_)}if((u.touchedFields||f.touchedFields)&&O&&Array.isArray(ae(r.touchedFields,_))){const Z=I(ae(r.touchedFields,_),V.argA,V.argB);G&&Ve(r.touchedFields,_,Z)}(u.dirtyFields||f.dirtyFields)&&(r.dirtyFields=Fo(n,a)),h.state.next({name:_,isDirty:$(_,A),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ve(a,_,A)},w=(_,A)=>{Ve(r.errors,_,A),h.state.next({errors:r.errors})},S=_=>{r.errors=_,h.state.next({errors:r.errors,isValid:!1})},E=(_,A,I,V)=>{const G=ae(o,_);if(G){const O=ae(a,_,Ue(I)?ae(n,_):I);Ue(O)||V&&V.defaultChecked||A?Ve(a,_,A?O:ob(G._f)):R(_,O),l.mount&&!l.action&&y()}},N=(_,A,I,V,G)=>{let O=!1,Z=!1;const me={name:_};if(!t.disabled){if(!I||V){(u.isDirty||f.isDirty)&&(Z=r.isDirty,r.isDirty=me.isDirty=$(),O=Z!==me.isDirty);const Ce=Ur(ae(n,_),A);Z=!!ae(r.dirtyFields,_),Ce?Ze(r.dirtyFields,_):Ve(r.dirtyFields,_,!0),me.dirtyFields=r.dirtyFields,O=O||(u.dirtyFields||f.dirtyFields)&&Z!==!Ce}if(I){const Ce=ae(r.touchedFields,_);Ce||(Ve(r.touchedFields,_,I),me.touchedFields=r.touchedFields,O=O||(u.touchedFields||f.touchedFields)&&Ce!==I)}O&&G&&h.state.next(me)}return O?me:{}},T=(_,A,I,V)=>{const G=ae(r.errors,_),O=(u.isValid||f.isValid)&&ir(A)&&r.isValid!==A;if(t.delayError&&I?(c=g(()=>w(_,I)),c(t.delayError)):(clearTimeout(d),c=null,I?Ve(r.errors,_,I):Ze(r.errors,_)),(I?!Ur(G,I):G)||!wt(V)||O){const Z={...V,...O&&ir(A)?{isValid:A}:{},errors:r.errors,name:_};r={...r,...Z},h.state.next(Z)}},k=async _=>(x(_,!0),await t.resolver(a,t.context,IA(_||i.mount,o,t.criteriaMode,t.shouldUseNativeValidation))),M=async _=>{const{errors:A}=await k(_);if(x(_),_)for(const I of _){const V=ae(A,I);V?Ve(r.errors,I,V):Ze(r.errors,I)}else r.errors=A;return A},D=async(_,A,I={valid:!0})=>{for(const V in _){const G=_[V];if(G){const{_f:O,...Z}=G;if(O){const me=i.array.has(O.name),Ce=G._f&&PA(G._f);Ce&&u.validatingFields&&x([O.name],!0);const He=await cb(G,i.disabled,a,b,t.shouldUseNativeValidation&&!A,me);if(Ce&&u.validatingFields&&x([O.name]),He[O.name]&&(I.valid=!1,A||e.shouldUseNativeValidation))break;!A&&(ae(He,O.name)?me?VA(r.errors,He,O.name):Ve(r.errors,O.name,He[O.name]):Ze(r.errors,O.name))}!wt(Z)&&await D(Z,A,I)}}return I.valid},U=()=>{for(const _ of i.unMount){const A=ae(o,_);A&&(A._f.refs?A._f.refs.every(I=>!fd(I)):!fd(A._f.ref))&&se(_)}i.unMount=new Set},$=(_,A)=>!t.disabled&&(_&&A&&Ve(a,_,A),!Ur(ge(),n)),F=(_,A,I)=>kA(_,i,{...l.mount?a:Ue(A)?n:Ft(_)?{[_]:A}:A},I,A),q=_=>sd(ae(l.mount?a:n,_,t.shouldUnregister?ae(n,_,[]):[])),R=(_,A,I={})=>{const V=ae(o,_);let G=A;if(V){const O=V._f;O&&(!O.disabled&&Ve(a,_,eb(A,O)),G=pl(O.ref)&&Et(A)?"":A,Kg(O.ref)?[...O.ref.options].forEach(Z=>Z.selected=G.includes(Z.value)):O.refs?Tn(O.ref)?O.refs.forEach(Z=>{(!Z.defaultChecked||!Z.disabled)&&(Array.isArray(G)?Z.checked=!!G.find(me=>me===Z.value):Z.checked=G===Z.value||!!G)}):O.refs.forEach(Z=>Z.checked=Z.value===G):ud(O.ref)?O.ref.value="":(O.ref.value=G,O.ref.type||h.state.next({name:_,values:rt(a)})))}(I.shouldDirty||I.shouldTouch)&&N(_,G,I.shouldTouch,I.shouldDirty,!0),I.shouldValidate&&pe(_)},W=(_,A,I)=>{for(const V in A){if(!A.hasOwnProperty(V))return;const G=A[V],O=_+"."+V,Z=ae(o,O);(i.array.has(_)||Je(G)||Z&&!Z._f)&&!ho(G)?W(O,G,I):R(O,G,I)}},Q=(_,A,I={})=>{const V=ae(o,_),G=i.array.has(_),O=rt(A);Ve(a,_,O),G?(h.array.next({name:_,values:rt(a)}),(u.isDirty||u.dirtyFields||f.isDirty||f.dirtyFields)&&I.shouldDirty&&h.state.next({name:_,dirtyFields:Fo(n,a),isDirty:$(_,O)})):V&&!V._f&&!Et(O)?W(_,O,I):R(_,O,I),sb(_,i)?h.state.next({...r,name:_,values:rt(a)}):h.state.next({name:l.mount?_:void 0,values:rt(a)})},P=async _=>{l.mount=!0;const A=_.target;let I=A.name,V=!0;const G=ae(o,I),O=Ce=>{V=Number.isNaN(Ce)||ho(Ce)&&isNaN(Ce.getTime())||Ur(Ce,ae(a,I,Ce))},Z=nb(t.mode),me=nb(t.reValidateMode);if(G){let Ce,He;const St=A.type?ob(G._f):xA(_),pt=_.type===Hg.BLUR||_.type===Hg.FOCUS_OUT,Cr=!OA(G._f)&&!t.resolver&&!ae(r.errors,I)&&!G._f.deps||FA(pt,ae(r.touchedFields,I),r.isSubmitted,me,Z),ht=sb(I,i,pt);Ve(a,I,St),pt?(!A||!A.readOnly)&&(G._f.onBlur&&G._f.onBlur(_),c&&c(0)):G._f.onChange&&G._f.onChange(_);const kt=N(I,St,pt),Te=!wt(kt)||ht;if(!pt&&h.state.next({name:I,type:_.type,values:rt(a)}),Cr)return(u.isValid||f.isValid)&&(t.mode==="onBlur"?pt&&y():pt||y()),Te&&h.state.next({name:I,...ht?{}:kt});if(!pt&&ht&&h.state.next({...r}),t.resolver){const{errors:je}=await k([I]);if(x([I]),O(St),V){const Ct=lb(r.errors,o,I),Zt=lb(je,o,Ct.name||I);Ce=Zt.error,I=Zt.name,He=wt(je)}}else x([I],!0),Ce=(await cb(G,i.disabled,a,b,t.shouldUseNativeValidation))[I],x([I]),O(St),V&&(Ce?He=!1:(u.isValid||f.isValid)&&(He=await D(o,!0)));V&&(G._f.deps&&(!Array.isArray(G._f.deps)||G._f.deps.length>0)&&pe(G._f.deps),T(I,He,Ce,kt))}},z=(_,A)=>{if(ae(r.errors,A)&&_.focus)return _.focus(),1},pe=async(_,A={})=>{let I,V;const G=Mn(_);if(t.resolver){const O=await M(Ue(_)?_:G);I=wt(O),V=_?!G.some(Z=>ae(O,Z)):I}else _?(V=(await Promise.all(G.map(async O=>{const Z=ae(o,O);return await D(Z&&Z._f?{[O]:Z}:Z)}))).every(Boolean),!(!V&&!r.isValid)&&y()):V=I=await D(o);return h.state.next({...!Ft(_)||(u.isValid||f.isValid)&&I!==r.isValid?{}:{name:_},...t.resolver||!_?{isValid:I}:{},errors:r.errors}),A.shouldFocus&&!V&&Pn(o,z,_?G:i.mount),V},ge=(_,A)=>{let I={...l.mount?a:n};return A&&(I=Qg(A.dirtyFields?r.dirtyFields:r.touchedFields,I)),Ue(_)?I:Ft(_)?ae(I,_):_.map(V=>ae(I,V))},L=(_,A)=>({invalid:!!ae((A||r).errors,_),isDirty:!!ae((A||r).dirtyFields,_),error:ae((A||r).errors,_),isValidating:!!ae(r.validatingFields,_),isTouched:!!ae((A||r).touchedFields,_)}),Y=_=>{_&&Mn(_).forEach(A=>Ze(r.errors,A)),h.state.next({errors:_?r.errors:{}})},te=(_,A,I)=>{const V=(ae(o,_,{_f:{}})._f||{}).ref,G=ae(r.errors,_)||{},{ref:O,message:Z,type:me,...Ce}=G;Ve(r.errors,_,{...Ce,...A,ref:V}),h.state.next({name:_,errors:r.errors,isValid:!1}),I&&I.shouldFocus&&V&&V.focus&&V.focus()},fe=(_,A)=>Xt(_)?h.state.subscribe({next:I=>"values"in I&&_(F(void 0,A),I)}):F(_,A,!0),K=_=>h.state.subscribe({next:A=>{LA(_.name,A.name,_.exact)&&$A(A,_.formState||u,We,_.reRenderRoot)&&_.callback({values:{...a},...r,...A,defaultValues:n})}}).unsubscribe,X=_=>(l.mount=!0,f={...f,..._.formState},K({..._,formState:{...p,..._.formState}})),se=(_,A={})=>{for(const I of _?Mn(_):i.mount)i.mount.delete(I),i.array.delete(I),A.keepValue||(Ze(o,I),Ze(a,I)),!A.keepError&&Ze(r.errors,I),!A.keepDirty&&Ze(r.dirtyFields,I),!A.keepTouched&&Ze(r.touchedFields,I),!A.keepIsValidating&&Ze(r.validatingFields,I),!t.shouldUnregister&&!A.keepDefaultValue&&Ze(n,I);h.state.next({values:rt(a)}),h.state.next({...r,...A.keepDirty?{isDirty:$()}:{}}),!A.keepIsValid&&y()},ve=({disabled:_,name:A})=>{if(ir(_)&&l.mount||_||i.disabled.has(A)){const G=i.disabled.has(A)!==!!_;_?i.disabled.add(A):i.disabled.delete(A),G&&l.mount&&!l.action&&y()}},le=(_,A={})=>{let I=ae(o,_);const V=ir(A.disabled)||ir(t.disabled);return Ve(o,_,{...I||{},_f:{...I&&I._f?I._f:{ref:{name:_}},name:_,mount:!0,...A}}),i.mount.add(_),I?ve({disabled:ir(A.disabled)?A.disabled:t.disabled,name:_}):E(_,!0,A.value),{...V?{disabled:A.disabled||t.disabled}:{},...t.progressive?{required:!!A.required,min:In(A.min),max:In(A.max),minLength:In(A.minLength),maxLength:In(A.maxLength),pattern:In(A.pattern)}:{},name:_,onChange:P,onBlur:P,ref:G=>{if(G){le(_,A),I=ae(o,_);const O=Ue(G.value)&&G.querySelectorAll&&G.querySelectorAll("input,select,textarea")[0]||G,Z=DA(O),me=I._f.refs||[];if(Z?me.find(Ce=>Ce===O):O===I._f.ref)return;Ve(o,_,{_f:{...I._f,...Z?{refs:[...me.filter(fd),O,...Array.isArray(ae(n,_))?[{}]:[]],ref:{type:O.type,name:_}}:{ref:O}}}),E(_,!1,void 0,O)}else I=ae(o,_,{}),I._f&&(I._f.mount=!1),(t.shouldUnregister||A.shouldUnregister)&&!(SA(i.array,_)&&l.action)&&i.unMount.add(_)}}},H=()=>t.shouldFocusError&&Pn(o,z,i.mount),j=_=>{ir(_)&&(h.state.next({disabled:_}),Pn(o,(A,I)=>{const V=ae(o,I);V&&(A.disabled=V._f.disabled||_,Array.isArray(V._f.refs)&&V._f.refs.forEach(G=>{G.disabled=V._f.disabled||_}))},0,!1))},ce=(_,A)=>async I=>{let V;I&&(I.preventDefault&&I.preventDefault(),I.persist&&I.persist());let G=rt(a);if(h.state.next({isSubmitting:!0}),t.resolver){const{errors:O,values:Z}=await k();x(),r.errors=O,G=rt(Z)}else await D(o);if(i.disabled.size)for(const O of i.disabled)Ze(G,O);if(Ze(r.errors,"root"),wt(r.errors)){h.state.next({errors:{}});try{await _(G,I)}catch(O){V=O}}else A&&await A({...r.errors},I),H(),setTimeout(H);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:wt(r.errors)&&!V,submitCount:r.submitCount+1,errors:r.errors}),V)throw V},Ee=(_,A={})=>{ae(o,_)&&(Ue(A.defaultValue)?Q(_,rt(ae(n,_))):(Q(_,A.defaultValue),Ve(n,_,rt(A.defaultValue))),A.keepTouched||Ze(r.touchedFields,_),A.keepDirty||(Ze(r.dirtyFields,_),r.isDirty=A.defaultValue?$(_,rt(ae(n,_))):$()),A.keepError||(Ze(r.errors,_),u.isValid&&y()),h.state.next({...r}))},Se=(_,A={})=>{const I=_?rt(_):n,V=rt(I),G=wt(_),O=G?n:V;if(A.keepDefaultValues||(n=I),!A.keepValues){if(A.keepDirtyValues){const Z=new Set([...i.mount,...Object.keys(Fo(n,a))]);for(const me of Array.from(Z)){const Ce=ae(r.dirtyFields,me),He=ae(a,me),St=ae(O,me);Ce&&!Ue(He)?Ve(O,me,He):!Ce&&!Ue(St)&&Q(me,St)}}else{if(ad&&Ue(_))for(const Z of i.mount){const me=ae(o,Z);if(me&&me._f){const Ce=Array.isArray(me._f.refs)?me._f.refs[0]:me._f.ref;if(pl(Ce)){const He=Ce.closest("form");if(He){He.reset();break}}}}if(A.keepFieldsRef)for(const Z of i.mount)Q(Z,ae(O,Z));else o={}}a=t.shouldUnregister?A.keepDefaultValues?rt(n):{}:rt(O),h.array.next({values:{...O}}),h.state.next({values:{...O}})}i={mount:A.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!u.isValid||!!A.keepIsValid||!!A.keepDirtyValues||!t.shouldUnregister&&!wt(O),l.watch=!!t.shouldUnregister,l.keepIsValid=!!A.keepIsValid,l.action=!1,A.keepErrors||(r.errors={}),h.state.next({submitCount:A.keepSubmitCount?r.submitCount:0,isDirty:G?!1:A.keepDirty?r.isDirty:!!(A.keepDefaultValues&&!Ur(_,n)),isSubmitted:A.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:G?{}:A.keepDirtyValues?A.keepDefaultValues&&a?Fo(n,a):r.dirtyFields:A.keepDefaultValues&&_?Fo(n,_):A.keepDirty?r.dirtyFields:{},touchedFields:A.keepTouched?r.touchedFields:{},errors:A.keepErrors?r.errors:{},isSubmitSuccessful:A.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:n})},ze=(_,A)=>Se(Xt(_)?_(a):_,{...t.resetOptions,...A}),Ye=(_,A={})=>{const I=ae(o,_),V=I&&I._f;if(V){const G=V.refs?V.refs[0]:V.ref;G.focus&&setTimeout(()=>{G.focus(),A.shouldSelect&&Xt(G.select)&&G.select()})}},We=_=>{r={...r,..._}},he={control:{register:le,unregister:se,getFieldState:L,handleSubmit:ce,setError:te,_subscribe:K,_runSchema:k,_updateIsValidating:x,_focusError:H,_getWatch:F,_getDirty:$,_setValid:y,_setFieldArray:v,_setDisabledField:ve,_setErrors:S,_getFieldArray:q,_reset:Se,_resetDefaultValues:()=>Xt(t.defaultValues)&&t.defaultValues().then(_=>{ze(_,t.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:U,_disableForm:j,_subjects:h,_proxyFormState:u,get _fields(){return o},get _formValues(){return a},get _state(){return l},set _state(_){l=_},get _defaultValues(){return n},get _names(){return i},set _names(_){i=_},get _formState(){return r},get _options(){return t},set _options(_){t={...t,..._}}},subscribe:X,trigger:pe,register:le,handleSubmit:ce,watch:fe,setValue:Q,getValues:ge,reset:ze,resetField:Ee,clearErrors:Y,unregister:se,setError:te,setFocus:Ye,getFieldState:L};return{...he,formControl:he}}function db(e={}){const t=C.useRef(void 0),r=C.useRef(void 0),[o,n]=C.useState({isDirty:!1,isValidating:!1,isLoading:Xt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Xt(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:o},e.defaultValues&&!Xt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...i}=BA(e);t.current={...i,formState:o}}const a=t.current.control;return a._options=e,EA(()=>{const l=a._subscribe({formState:a._proxyFormState,callback:()=>n({...a._formState}),reRenderRoot:!0});return n(i=>({...i,isReady:!0})),a._formState.isReady=!0,l},[a]),C.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),C.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),C.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),C.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),C.useEffect(()=>{if(a._proxyFormState.isDirty){const l=a._getDirty();l!==o.isDirty&&a._subjects.state.next({isDirty:l})}},[a,o.isDirty]),C.useEffect(()=>{var l;e.values&&!Ur(e.values,r.current)?(a._reset(e.values,{keepFieldsRef:!0,...a._options.resetOptions}),!((l=a._options.resetOptions)===null||l===void 0)&&l.keepIsValid||a._setValid(),r.current=e.values,n(i=>({...i}))):a._resetDefaultValues()},[a,e.values]),C.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),t.current.formState=C.useMemo(()=>NA(o,a),[a,o]),t.current}function ub(e){return["divider","paragraph","heading","link","image"].includes(e.type)?"layout":["submit","button"].includes(e.type)?"action":["pages","group","repeatGroup"].includes(e.type)?"container":"field"}function pb(e,t){var n;const r=[],o=new Map;for(const a of t){const l=((n=a.attributes)==null?void 0:n.name)||a.id;o.set(l,a)}for(const[a,l]of Object.entries(e)){const i=o.get(a);if(i){const c=ub(i);if(c==="layout"||c==="action")continue;r.push({id:a,value:l,type:i.type,category:c})}else r.push({id:a,value:l,type:"unknown",category:"field"})}return r}function md(e,t,r="keyValue"){return r==="array"?pb(e,t):e}function UA(e,t){var n;const r={},o=new Map;for(const a of t){const l=((n=a.attributes)==null?void 0:n.name)||a.id;o.set(l,a)}for(const[a,l]of Object.entries(e)){const i=o.get(a);if(i){const c=ub(i);(c==="field"||c==="container")&&(r[a]=l)}else r[a]=l}return r}const WA=({currentPage:e,totalPages:t,pages:r,showStepNumbers:o,onPageClick:n})=>{const a=(e+1)/t*100;return s.jsxs("div",{className:"mb-8",children:[s.jsx("div",{className:"h-2 bg-gray-200 rounded-full overflow-hidden",children:s.jsx("div",{className:"h-full bg-blue-600 transition-all duration-300 ease-out",style:{width:`${a}%`}})}),o&&s.jsx("div",{className:"flex justify-between mt-4",children:r.map((l,i)=>{const c=i<e,d=i===e;return s.jsxs("button",{type:"button",onClick:()=>n==null?void 0:n(i),disabled:i>e,className:`flex flex-col items-center ${n&&i<=e?"cursor-pointer":"cursor-default"}`,children:[s.jsx("div",{className:`w-8 h-8 rounded-full flex items-center justify-center text-sm font-medium transition-colors ${c?"bg-blue-600 text-white":d?"bg-blue-600 text-white ring-4 ring-blue-100":"bg-gray-200 text-gray-500"}`,children:c?s.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",children:s.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):i+1}),s.jsx("span",{className:`mt-2 text-xs font-medium ${d?"text-blue-600":"text-gray-500"}`,children:l.title})]},l.id)})})]})},HA=({page:e,pageIndex:t,totalPages:r})=>s.jsxs("div",{className:"mb-6",children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:e.title}),s.jsxs("span",{className:"text-sm text-gray-500",children:["Step ",t+1," of ",r]})]}),e.description&&s.jsx("p",{className:"text-gray-600",children:e.description})]}),jA=({currentPage:e,totalPages:t,allowSkip:r,isSubmitting:o,onPrevious:n,onNext:a,onSkip:l})=>{const i=e===0,c=e===t-1;return s.jsxs("div",{className:"flex items-center justify-between mt-8 pt-6 border-t border-gray-200",children:[s.jsx("div",{children:!i&&s.jsx("button",{type:"button",onClick:n,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500",children:"← Previous"})}),s.jsxs("div",{className:"flex gap-3",children:[r&&!c&&s.jsx("button",{type:"button",onClick:l,className:"px-4 py-2 text-sm font-medium text-gray-500 hover:text-gray-700",children:"Skip"}),c?s.jsx("button",{type:"submit",disabled:o,className:"px-6 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:o?"Submitting...":"Submit"}):s.jsx("button",{type:"button",onClick:a,className:"px-6 py-2 text-sm font-medium text-white bg-blue-600 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500",children:"Next →"})]})]})},fb=({element:e,elements:t})=>{const{setValue:r,watch:o}=dd(),n=o(),{visible:a,required:l,disabled:i}=C.useMemo(()=>bg(e,n,t),[e,n,t]);if(!a)return null;const c=e.attributes.name,d=o(c),p=i||e.properties.disabled||!1,u={small:"max-w-xs",medium:"max-w-md",large:"max-w-lg",full:"w-full",default:"max-w-md"},f=u[e.layout.size||"default"]||u.default,h=Ke.get(e.type),b=(w,S)=>{const E=t.filter(N=>N.parentId===w).sort((N,T)=>N.order-T.order);return s.jsx("div",{className:"space-y-4",children:E.map(N=>s.jsx(fb,{element:{...N,attributes:{...N.attributes,name:S?`${S}.${N.attributes.name}`:N.attributes.name}},elements:t},N.id))})},g={element:e,properties:e.properties,layout:e.layout,validation:{...e.validation,required:l},logic:e.logic,config:e.config,mode:"render",value:d,onChange:w=>r(c,w),errors:[],formValues:n,readOnly:!1,disabled:p,allElements:t,renderChildren:b},y=()=>h!=null&&h.render?h.render(g):s.jsxs("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-md text-sm text-yellow-700",children:[s.jsxs("p",{className:"font-medium",children:["Unknown element type: ",e.type]}),s.jsxs("p",{className:"text-xs mt-1",children:["This element is not registered in the element registry. Please register it using ",s.jsx("code",{children:"registerElement()"}),"."]})]});return(h==null?void 0:h.structure)==="page"&&["heading","layout","special"].includes(h.subCategory||"")||["paragraph","image","link","formHeading","sectionHeading","subheading","divider","spacer","captcha","submit"].includes(e.type)?s.jsx("div",{className:`${f} mb-4`,children:y()}):s.jsx("div",{className:`${f} mb-4`,children:y()})};function YA(e){var o,n,a;if(e.attributes.defaultValue!==void 0)return e.attributes.defaultValue;const t=Ke.get(e.type);switch(t==null?void 0:t.dataType){case"array":return[];case"boolean":return!1;case"number":return((o=e.config)==null?void 0:o.min)??0;case"object":return e.type==="rangeSlider"?[((n=e.config)==null?void 0:n.min)??0,((a=e.config)==null?void 0:a.max)??100]:e.type==="dateRange"?{start:"",end:""}:{};default:return""}}function qA(e){const t={};return e.forEach(r=>{var o;(o=r.attributes)!=null&&o.name&&(t[r.attributes.name]=YA(r))}),t}const gd=({schema:e,onSubmit:t,initialValues:r,onPageChange:o,submissionFormat:n="keyValue"})=>{const[a,l]=C.useState(0),[i,c]=C.useState(!1),[d,p]=C.useState(null),u=C.useMemo(()=>e.elements.find(M=>M.type==="pages"),[e.elements]),f=C.useMemo(()=>{var M,D,U,$,F;return{showProgressBar:((M=u==null?void 0:u.config)==null?void 0:M.showProgressBar)??!0,showStepNumbers:((D=u==null?void 0:u.config)==null?void 0:D.showStepNumbers)??!0,allowSkip:((U=u==null?void 0:u.config)==null?void 0:U.allowSkip)??!1,validateOnNext:(($=u==null?void 0:u.config)==null?void 0:$.validateOnNext)??!0,steps:((F=u==null?void 0:u.config)==null?void 0:F.steps)||[{id:"step1",label:"Step 1"}]}},[u]),h=C.useMemo(()=>u?f.steps.map(D=>{const U=e.elements.filter($=>{var F;return $.parentId===`${u.id}:${D.id}`||$.parentId===u.id&&((F=$.config)==null?void 0:F.wizardStepId)===D.id});return{id:D.id,title:D.label,description:D.description,elements:U.sort(($,F)=>$.order-F.order)}}):[],[u,f.steps,e.elements]),b=C.useMemo(()=>e.elements.filter(M=>M.type!=="pages"),[e.elements]),g=C.useMemo(()=>r||qA(b),[r,b]),y=db({defaultValues:g,mode:"onChange"}),{handleSubmit:x,trigger:v}=y,w=C.useCallback(M=>{M>=0&&M<h.length&&(l(M),o==null||o(M))},[h.length,o]),S=C.useCallback(()=>{w(a-1)},[a,w]),E=C.useCallback(async()=>{if(f.validateOnNext){const M=h[a].elements.filter(U=>{var $;return($=U.attributes)==null?void 0:$.name}).map(U=>U.attributes.name);if(!await v(M))return}w(a+1)},[a,f.validateOnNext,h,v,w]),N=C.useCallback(()=>{w(a+1)},[a,w]),T=C.useCallback(async M=>{c(!0);try{const D=md(M,e.elements,n);console.log("Wizard form submitted:",D),p(D),await(t==null?void 0:t(D))}catch(D){console.error("Form submission error:",D)}finally{c(!1)}},[t,e.elements,n]),k=h[a];return k?s.jsxs("div",{className:"max-w-3xl mx-auto",children:[s.jsx(Yg,{...y,children:s.jsxs("form",{onSubmit:x(T),className:"space-y-1",children:[f.showProgressBar&&s.jsx(WA,{currentPage:a,totalPages:h.length,pages:h,showStepNumbers:f.showStepNumbers,onPageClick:f.allowSkip?w:void 0}),s.jsx(HA,{page:k,pageIndex:a,totalPages:h.length}),s.jsx("div",{className:"space-y-4",children:k.elements.map(M=>s.jsx(fb,{element:M,elements:e.elements},M.id))}),s.jsx(jA,{currentPage:a,totalPages:h.length,allowSkip:f.allowSkip,isSubmitting:i,onPrevious:S,onNext:E,onSkip:N})]})}),d&&s.jsxs("div",{className:"mt-8 p-4 bg-green-50 border border-green-200 rounded-lg",children:[s.jsx("h3",{className:"text-lg font-medium text-green-800 mb-2",children:"Form Submitted Successfully!"}),s.jsx("pre",{className:"text-sm text-green-700 overflow-x-auto",children:JSON.stringify(d,null,2)})]})]}):s.jsxs("div",{className:"p-8 text-center text-gray-500",children:[s.jsx("p",{children:"No wizard steps configured."}),s.jsx("p",{className:"text-sm mt-2",children:"Add steps to the wizard element to create a multi-page form."})]})};function QA(e){var o,n,a;if(e.attributes.defaultValue!==void 0)return e.attributes.defaultValue;const t=Ke.get(e.type);switch(t==null?void 0:t.dataType){case"array":return[];case"boolean":return!1;case"number":return((o=e.config)==null?void 0:o.min)??0;case"object":return e.type==="rangeSlider"?[((n=e.config)==null?void 0:n.min)??0,((a=e.config)==null?void 0:a.max)??100]:e.type==="dateRange"?{start:"",end:""}:{};default:return""}}function KA(e){const t={};return e.forEach(r=>{var o;(o=r.attributes)!=null&&o.name&&(t[r.attributes.name]=QA(r))}),t}const hb=({element:e,elements:t})=>{const{watch:r}=dd(),o=r(),{visible:n,required:a,disabled:l}=C.useMemo(()=>bg(e,o,t),[e,o,t]);return n?s.jsx(XA,{element:e,elements:t,dynamicRequired:a,dynamicDisabled:l}):null},XA=({element:e,elements:t,dynamicRequired:r,dynamicDisabled:o})=>{const{setValue:n,watch:a}=dd(),l=e.attributes.name,i=a(l),c=o||e.properties.disabled||!1,d=r,p={small:"max-w-xs",medium:"max-w-md",large:"max-w-lg",full:"w-full",default:"max-w-md"},u=p[e.layout.size||"default"]||p.default,f=Ke.get(e.type),h=(v,w)=>{const S=t.filter(E=>E.parentId===v).sort((E,N)=>E.order-N.order);return s.jsx("div",{className:"space-y-4",children:S.map(E=>s.jsx(hb,{element:{...E,attributes:{...E.attributes,name:w?`${w}.${E.attributes.name}`:E.attributes.name}},elements:t},E.id))})},b={element:e,properties:e.properties,layout:e.layout,validation:{...e.validation,required:d},logic:e.logic,config:e.config,mode:"render",value:i,onChange:v=>n(l,v),errors:[],formValues:a(),readOnly:!1,disabled:c,allElements:t,renderChildren:h},g=()=>f!=null&&f.render?f.render(b):s.jsxs("div",{className:"p-3 bg-yellow-50 border border-yellow-200 rounded-md text-sm text-yellow-700",children:[s.jsxs("p",{className:"font-medium",children:["Unknown element type: ",e.type]}),s.jsxs("p",{className:"text-xs mt-1",children:["This element is not registered in the element registry. Please register it using ",s.jsx("code",{children:"registerElement()"}),"."]})]});return(f==null?void 0:f.structure)==="page"&&["heading","layout","special"].includes(f.subCategory||"")||["paragraph","image","link","formHeading","sectionHeading","subheading","divider","spacer","captcha","submit"].includes(e.type)?s.jsx("div",{className:`${u} mb-4`,children:g()}):s.jsx("div",{className:`${u} mb-4`,children:g()})},mb=({schema:e,onSubmit:t,initialValues:r,submissionFormat:o="keyValue"})=>{const[n,a]=C.useState(null);if(C.useMemo(()=>e.elements.some(f=>f.type==="pages"),[e.elements]))return s.jsx(gd,{schema:e,onSubmit:t,initialValues:r,submissionFormat:o});const i=C.useMemo(()=>e.elements.filter(f=>!f.parentId),[e.elements]),c=C.useMemo(()=>r||KA(i),[r,i]),d=db({defaultValues:c,mode:"onChange"}),p=C.useCallback(f=>{const h=md(f,e.elements,o);console.log("Form submitted:",h),a(h),t==null||t(h)},[t,e.elements,o]),u=C.useMemo(()=>[...i].sort((f,h)=>f.order-h.order),[i]);return s.jsxs("div",{className:"max-w-3xl mx-auto",children:[s.jsx(Yg,{...d,children:s.jsxs("form",{onSubmit:d.handleSubmit(p),className:"space-y-1",children:[s.jsx("div",{className:"",children:e.description&&s.jsx("p",{className:"mt-2 text-gray-600",children:e.description})}),s.jsx("div",{className:"space-y-4",children:u.map(f=>s.jsx(hb,{element:f,elements:e.elements},f.id))})]})}),n&&s.jsxs("div",{className:"mt-8 p-4 bg-green-50 border border-green-200 rounded-lg",children:[s.jsx("h3",{className:"text-lg font-medium text-green-800 mb-2",children:"Submitted Data:"}),s.jsx("pre",{className:"text-sm text-green-700 overflow-x-auto",children:JSON.stringify(n,null,2)})]})]})},gb=m.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:be("rounded-xl border bg-card text-card-foreground shadow",e),...t}));gb.displayName="Card";const JA=m.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:be("flex flex-col space-y-1.5 p-6",e),...t}));JA.displayName="CardHeader";const ZA=m.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:be("font-semibold leading-none tracking-tight",e),...t}));ZA.displayName="CardTitle";const RA=m.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:be("text-sm text-muted-foreground",e),...t}));RA.displayName="CardDescription";const bb=m.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:be("p-6 pt-0",e),...t}));bb.displayName="CardContent";const eT=m.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:be("flex items-center p-6 pt-0",e),...t}));eT.displayName="CardFooter";const tT=La("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),yb=m.forwardRef(({className:e,variant:t,...r},o)=>s.jsx("div",{ref:o,role:"alert",className:be(tT({variant:t}),e),...r}));yb.displayName="Alert";const vb=m.forwardRef(({className:e,...t},r)=>s.jsx("h5",{ref:r,className:be("mb-1 font-medium leading-none tracking-tight",e),...t}));vb.displayName="AlertTitle";const xb=m.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:be("text-sm [&_p]:leading-relaxed",e),...t}));xb.displayName="AlertDescription";const rT={id:"design",label:"Design Mode",icon:VS,order:0,keyboardShortcut:"d",description:"Edit your form layout and properties",renderContent:(e,t)=>s.jsxs(s.Fragment,{children:[t==null?void 0:t.ElementSidebar,t==null?void 0:t.Canvas,t==null?void 0:t.PropertyPanel]})},oT={id:"preview",label:"Preview Mode",icon:Gp,order:10,keyboardShortcut:"p",description:"Preview your form as an end user",renderContent:(e,t)=>{const{schema:r,setMode:o,submissionFormat:n,onSubmit:a}=e,l=r.elements.some(c=>c.type==="pages"),i=c=>{console.log("Form submitted:",c),a==null||a(c)};return s.jsx("div",{className:"flex-1 overflow-y-auto bg-muted/30",children:s.jsxs("div",{className:"py-8 px-4",children:[s.jsx("div",{className:"max-w-3xl mx-auto mb-6",children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(Gp,{className:"h-4 w-4"}),s.jsx("span",{children:"Preview Mode"}),l&&s.jsx(Ni,{variant:"secondary",children:"Wizard Form"})]}),s.jsxs(Be,{variant:"ghost",size:"sm",onClick:()=>o("design"),children:[s.jsx($S,{className:"h-4 w-4 mr-1"}),"Back to Editor"]})]})}),s.jsx(gb,{className:"max-w-3xl mx-auto",children:s.jsx(bb,{className:"p-8",children:r.elements.length===0?s.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[s.jsx(GS,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground/50"}),s.jsx("p",{className:"text-lg font-medium mb-2",children:"No elements to preview"}),s.jsx("p",{className:"text-sm",children:"Switch to Design mode and add some elements to your form."})]}):l?s.jsx(gd,{schema:r,onSubmit:i,submissionFormat:n}):s.jsx(mb,{schema:r,onSubmit:i,submissionFormat:n})})}),r.elements.some(c=>c.logic)&&s.jsx("div",{className:"max-w-3xl mx-auto mt-6",children:s.jsxs(yb,{children:[s.jsx(Vp,{className:"h-4 w-4"}),s.jsx(vb,{children:"Conditional Logic Active"}),s.jsx(xb,{children:"This form has conditional logic rules. Some fields may show/hide based on your input."})]})})]})})}};function wb(){Tt.has("design")||Tt.register(rT),Tt.has("preview")||Tt.register(oT)}wb();const Sb=({initialSchema:e,onSchemaChange:t,toolbarActions:r,toolbarConfig:o,sidebarTabs:n,sidebarConfig:a,onPreviewSubmit:l,showElementSidebar:i=!0,showPropertyPanel:c=!0,submissionFormat:d="array",className:p})=>{const u=J(S=>S.mode),f=J(S=>S.setMode),h=J(S=>S.schema),b=J(S=>S.loadSchema);C.useEffect(()=>jv(),[]),C.useEffect(()=>{e&&b(e)},[e,b]),C.useEffect(()=>{t&&t(h)},[h,t]);const g=r||o?{...o,actions:[...(o==null?void 0:o.actions)??[],...r??[]]}:void 0,y=n||a!=null&&a.tabs?[...(a==null?void 0:a.tabs)??[],...n??[]]:void 0,x=Tt.get(u),v=C.useMemo(()=>({schema:h,currentMode:u,setMode:f,submissionFormat:d,onSubmit:l,showElementSidebar:i,showPropertyPanel:c,loadSchema:b}),[h,u,f,d,l,i,c,b]),w=C.useMemo(()=>({ElementSidebar:i?s.jsx(vE,{sidebarTabs:y}):void 0,Canvas:s.jsx(VE,{toolbarConfig:g}),PropertyPanel:c?s.jsx(vA,{}):void 0}),[i,y,g,c]);return s.jsx("div",{className:`h-screen flex flex-col bg-muted/50 ${p??""}`,children:s.jsx("main",{className:"flex-1 flex overflow-hidden",children:x?x.renderContent(v,w):null})})};ee.AffixInput=Fl,ee.CanvasElementRenderer=Oa,ee.CanvasPreviewWrapper=ex,ee.ElementDescription=na,ee.ElementLabel=oa,ee.EmptyState=tx,ee.EntryPulse=Sb,ee.ErrorMessages=Qo,ee.FieldWrapper=Rv,ee.FormElementRenderer=cf,ee.FormPreview=mb,ee.IconInput=Qr,ee.InputWrapper=ne,ee.WizardForm=gd,ee.builtInElements=lf,ee.createSidebarTab=Jf,ee.createSidebarTabs=bE,ee.createToolbarAction=rh,ee.createToolbarActions=DE,ee.default=Sb,ee.elementRegistry=Ke,ee.extractContextValues=B,ee.filterFieldData=UA,ee.getButtonClassName=rx,ee.getCanvasInputClassName=lt,ee.getElementDefinition=Jv,ee.getElementIcon=df,ee.getElementLabel=Ci,ee.getInputClassName=bt,ee.getModeDefinition=PE,ee.hasElement=Zv,ee.hasMode=OE,ee.isActionDisabled=oh,ee.isActionHidden=Gi,ee.isElementRegistered=uN,ee.isSidebarTabDisabled=Zf,ee.isSidebarTabHidden=Rf,ee.modeRegistry=Tt,ee.registerBuiltInElements=qC,ee.registerBuiltinModes=wb,ee.registerElement=Qv,ee.registerElements=Kv,ee.registerMode=TE,ee.registerModes=ME,ee.renderElement=fN,ee.renderElementOnCanvas=pN,ee.transformSubmissionData=md,ee.transformToArrayFormat=pb,ee.unregisterElement=Xv,ee.unregisterMode=IE,ee.useFormStore=J,Object.defineProperties(ee,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
209
+ //# sourceMappingURL=entry-pulse.umd.cjs.map