@entrypulse/builder 1.2.0 → 1.2.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(te,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):(te=typeof globalThis<"u"?globalThis:te||self,s(te.EntryPulse={},te.jsxRuntime,te.React,te.ReactDOM))})(this,(function(te,s,N,xd){"use strict";var dT=Object.defineProperty;var uT=(te,s,N)=>s in te?dT(te,s,{enumerable:!0,configurable:!0,writable:!0,value:N}):te[s]=N;var kl=(te,s,N)=>uT(te,typeof s!="symbol"?s+"":s,N);function wd(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 g=wd(N),Kn=wd(xd),Sd=e=>{let t;const r=new Set,o=(d,f)=>{const u=typeof d=="function"?d(t):d;if(!Object.is(u,t)){const h=t;t=f??(typeof u!="object"||u===null)?u:Object.assign({},t,u),r.forEach(m=>m(t,h))}},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},kv=(e=>e?Sd(e):Sd),_v=e=>e;function Dv(e,t=_v){const r=N.useSyncExternalStore(e.subscribe,N.useCallback(()=>t(e.getState()),[e,t]),N.useCallback(()=>t(e.getInitialState()),[e,t]));return N.useDebugValue(r),r}const Cd=e=>{const t=kv(e),r=o=>Dv(t,o);return Object.assign(r,t),r},Av=(e=>e?Cd(e):Cd);var Nd=Symbol.for("immer-nothing"),Ed=Symbol.for("immer-draftable"),_t=Symbol.for("immer-state"),Tv=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=Tv[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?_d(e)||Array.isArray(e)||!!e[Ed]||!!((t=e.constructor)!=null&&t[Ed])||jo(e)||Zn(e):!1}var Mv=Object.prototype.constructor.toString(),kd=new WeakMap;function _d(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=kd.get(r);return o===void 0&&(o=Function.toString.call(r),kd.set(r,o)),o===Mv}function Xn(e,t,r=!0){Jn(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 Jn(e){const t=e[_t];return t?t.type_:Array.isArray(e)?1:jo(e)?2:Zn(e)?3:0}function _l(e,t){return Jn(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Dd(e,t,r){const o=Jn(e);o===2?e.set(t,r):o===3?e.add(r):e[t]=r}function Iv(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function jo(e){return e instanceof Map}function Zn(e){return e instanceof Set}function Yr(e){return e.copy_||e.base_}function Dl(e,t){if(jo(e))return new Map(e);if(Zn(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=_d(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 Al(e,t=!1){return ea(e)||mo(e)||!jr(e)||(Jn(e)>1&&Object.defineProperties(e,{set:Rn,add:Rn,clear:Rn,delete:Rn}),Object.freeze(e),t&&Object.values(e).forEach(r=>Al(r,!0))),e}function Pv(){Nt(2)}var Rn={value:Pv};function ea(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var Ov={};function qr(e){const t=Ov[e];return t||Nt(0,e),t}var Yo;function Ad(){return Yo}function Lv(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Td(e,t){t&&(qr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Tl(e){Ml(e),e.drafts_.forEach($v),e.drafts_=null}function Ml(e){e===Yo&&(Yo=e.parent_)}function Md(e){return Yo=Lv(Yo,e)}function $v(e){const t=e[_t];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Id(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[_t].modified_&&(Tl(t),Nt(4)),jr(e)&&(e=ta(t,e),t.parent_||ra(t,e)),t.patches_&&qr("Patches").generateReplacementPatches_(r[_t].base_,e,t.patches_,t.inversePatches_)):e=ta(t,r,[]),Tl(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Nd?e:void 0}function ta(e,t,r){if(ea(t))return t;const o=e.immer_.shouldUseStrictIteration(),n=t[_t];if(!n)return Xn(t,(a,l)=>Pd(e,n,t,a,l,r),o),t;if(n.scope_!==e)return t;if(!n.modified_)return ra(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),Xn(l,(c,d)=>Pd(e,n,a,c,d,r,i),o),ra(e,a,!1),r&&e.patches_&&qr("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function Pd(e,t,r,o,n,a,l){if(n==null||typeof n!="object"&&!l)return;const i=ea(n);if(!(i&&!l)){if(process.env.NODE_ENV!=="production"&&n===r&&Nt(5),mo(n)){const c=a&&t&&t.type_!==3&&!_l(t.assigned_,o)?a.concat(o):void 0,d=ta(e,n,c);if(Dd(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;ta(e,n),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&(jo(r)?r.has(o):Object.prototype.propertyIsEnumerable.call(r,o))&&ra(e,n)}}}function ra(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Al(t,r)}function Fv(e,t){const r=Array.isArray(e),o={type_:r?1:0,scope_:t?t.scope_:Ad(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=o,a=Il;r&&(n=[o],a=qo);const{revoke:l,proxy:i}=Proxy.revocable(n,a);return o.draft_=i,o.revoke_=l,i}var Il={get(e,t){if(t===_t)return e;const r=Yr(e);if(!_l(r,t))return Gv(e,r,t);const o=r[t];return e.finalized_||!jr(o)?o:o===Pl(e.base_,t)?(Ll(e),e.copy_[t]=$l(o,e)):o},has(e,t){return t in Yr(e)},ownKeys(e){return Reflect.ownKeys(Yr(e))},set(e,t,r){const o=Od(Yr(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const n=Pl(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(Iv(r,n)&&(r!==void 0||_l(e.base_,t)))return!0;Ll(e),Ol(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 Pl(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ll(e),Ol(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={};Xn(Il,(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),Il.set.call(this,e[0],t,r,e[0])};function Pl(e,t){const r=e[_t];return(r?Yr(r):e)[t]}function Gv(e,t,r){var n;const o=Od(t,r);return o?"value"in o?o.value:(n=o.get)==null?void 0:n.call(e.draft_):void 0}function Od(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 Ol(e){e.modified_||(e.modified_=!0,e.parent_&&Ol(e.parent_))}function Ll(e){e.copy_||(e.copy_=Dl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Vv=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,...f){return i.produce(d,u=>o.call(this,u,...f))}}typeof o!="function"&&Nt(6),n!==void 0&&typeof n!="function"&&Nt(7);let a;if(jr(r)){const l=Md(this),i=$l(r,void 0);let c=!0;try{a=o(i),c=!1}finally{c?Tl(l):Ml(l)}return Td(l,n),Id(a,l)}else if(!r||typeof r!="object"){if(a=o(r),a===void 0&&(a=r),a===Nd&&(a=void 0),this.autoFreeze_&&Al(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=zv(t));const r=Md(this),o=$l(t,void 0);return o[_t].isManual_=!0,Ml(r),o}finishDraft(t,r){const o=t&&t[_t];(!o||!o.isManual_)&&Nt(9);const{scope_:n}=o;return Td(n,r),Id(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 $l(e,t){const r=jo(e)?qr("MapSet").proxyMap_(e,t):Zn(e)?qr("MapSet").proxySet_(e,t):Fv(e,t);return(t?t.scope_:Ad()).drafts_.push(r),r}function zv(e){return mo(e)||Nt(10,e),Ld(e)}function Ld(e){if(!jr(e)||ea(e))return e;const t=e[_t];let r,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Dl(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else r=Dl(e,!0);return Xn(r,(n,a)=>{Dd(r,n,Ld(a))},o),t&&(t.finalized_=!1),r}var Bv=new Vv,Uv=Bv.produce;const Wv=e=>(t,r,o)=>(o.setState=(n,a,...l)=>{const i=typeof n=="function"?Uv(n):n;return t(i,a,...l)},e(o.setState,r,o));function oa(){const e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}function Fl(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 $d(e,t){const r=t instanceof Set?t:new Set(t),o=Fl(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 Gl(e){return new Set(e.map(t=>t.attributes.name).filter(Boolean))}const Hv={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"}},jv={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"}},Fd={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}},Gd={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..."}},Yv={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 Vd(e,t,r){const o=$d(e,t),n={id:oa(),type:e,order:r,properties:{...Hv[e]},layout:{...jv[e]},attributes:{name:o,dataType:Yv[e]}};return Fd[e]&&(n.validation={...Fd[e]}),Gd[e]&&(n.config=JSON.parse(JSON.stringify(Gd[e]))),n}function zd(){return{id:`form-${oa()}`,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 qv(e,t){const r=JSON.parse(JSON.stringify(e));return r.id=oa(),r.attributes.name=$d(e.type,t),r}function Vl(e){return["paragraph","image","link","formHeading","sectionHeading","subheading","divider","spacer"].includes(e)}function Qv(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 Kv=50;function Gt(e,t){const r=e.history.slice(0,e.historyIndex+1);r.push(JSON.parse(JSON.stringify(t))),r.length>Kv&&r.shift(),e.history=r,e.historyIndex=r.length-1,e.schema=t}const Bd=zd(),Xv={schema:Bd,selectedElementId:null,mode:"design",history:[JSON.parse(JSON.stringify(Bd))],historyIndex:0,hoveredElementId:null,draggedElementType:null},Z=Av()(Wv((e,t)=>({...Xv,addElement:(r,o)=>{e(n=>{var f;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=Gl(n.schema.elements),i=o??n.schema.elements.length,c=Vd(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:((f=d.metadata)==null?void 0:f.createdAt)||new Date().toISOString()},Gt(n,d),n.selectedElementId=c.id})},addElementToContainer:(r,o,n)=>{e(a=>{var h;if(r==="pages"){console.warn("Wizard cannot be added inside a container");return}if(a.schema.elements.findIndex(m=>m.id===o)===-1)return;const i=Gl(a.schema.elements),d=a.schema.elements.filter(m=>n?m.parentId===`${o}:${n}`:m.parentId===o).length,f=Vd(r,i,d);n?f.parentId=`${o}:${n}`:f.parentId=o,(r==="group"||r==="grid"||r==="repeatGroup")&&(f.children=[]);const u={...a.schema};u.elements=a.schema.elements.map(m=>m.id===o?{...m,children:[...m.children||[],f.id]}:m),u.elements=[...u.elements,f],u.metadata={...u.metadata,updatedAt:new Date().toISOString(),createdAt:((h=u.metadata)==null?void 0:h.createdAt)||new Date().toISOString()},Gt(a,u),a.selectedElementId=f.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(f=>{var u;(f.parentId===d||(u=f.parentId)!=null&&u.startsWith(`${d}:`))&&(a.add(f.id),l(f.id))})};l(r);const i={...o.schema};if(n.parentId){const d=n.parentId.split(":")[0];i.elements=o.schema.elements.map(f=>f.id===d&&f.children?{...f,children:f.children.filter(u=>u!==r)}:f)}i.elements=i.elements.filter(d=>!a.has(d.id)).map((d,f)=>d.parentId?d:{...d,order:f}),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(f=>f.id===r);if(!n)return;const a=Gl(o.schema.elements),l=qv(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(f=>({...f,order:f.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(f=>f.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((f,u)=>{f.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,f)=>{d.order=f});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=zd();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 f=((c=i.config)==null?void 0:c.steps)||[];return{...i,config:{...i.config,steps:[...f,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 f=(((d=c.config)==null?void 0:d.steps)||[]).map(u=>u.id===o?{...u,...n}:u);return{...c,config:{...c.config,steps:f}}}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,h;const a=n.schema.elements.find(m=>m.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=m=>{n.schema.elements.forEach(y=>{var b;(y.parentId===m||(b=y.parentId)!=null&&b.startsWith(`${m}:`))&&(c.add(y.id),d(y.id))})};d(i);const f={...n.schema};f.elements=n.schema.elements.map(m=>{var y,b,v;if(m.id===r){const w=l.filter(S=>S.id!==o),x=((y=m.config)==null?void 0:y.activeStepId)===o?(b=w[0])==null?void 0:b.id:(v=m.config)==null?void 0:v.activeStepId;return{...m,config:{...m.config,steps:w,activeStepId:x},children:(m.children||[]).filter(S=>!c.has(S))}}return m}),f.elements=f.elements.filter(m=>!c.has(m.id)),f.metadata={...f.metadata,updatedAt:new Date().toISOString(),createdAt:((h=f.metadata)==null?void 0:h.createdAt)||new Date().toISOString()},Gt(n,f)})},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(),Z.getState().undo()):(o&&t.shiftKey&&t.key==="z"||o&&t.key==="y")&&(t.preventDefault(),Z.getState().redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}const Zv=()=>{const e=Z(r=>r.selectedElementId);return Z(r=>r.schema.elements).find(r=>r.id===e)};class Rv{constructor(){kl(this,"elements",new Map);kl(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},product:{label:"Porduct",order:10},payment:{label:"Payment",order:11},orther:{label:"Other",order:12}},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 Rv;function ex(e,t){Ke.register(e,t)}function tx(e,t){for(const r of e)Ke.register(r,t)}function rx(e){return Ke.unregister(e)}function ox(e){return Ke.get(e)}function nx(e){return Ke.has(e)}function Ud(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=Ud(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function Wd(){for(var e,t,r=0,o="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=Ud(e))&&(o&&(o+=" "),o+=t);return o}const ax=(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},sx=(e,t)=>({classGroupId:e,validator:t}),Hd=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),na="-",jd=[],lx="arbitrary..",ix=e=>{const t=dx(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return cx(l);const i=l.split(na),c=i[0]===""&&i.length>1?1:0;return Yd(i,c,t)},getConflictingClassGroupIds:(l,i)=>{if(i){const c=o[l],d=r[l];return c?d?ax(d,c):c:d||jd}return r[l]||jd}}},Yd=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const d=Yd(e,t+1,a);if(d)return d}const l=r.validators;if(l===null)return;const i=t===0?e.join(na):e.slice(t).join(na),c=l.length;for(let d=0;d<c;d++){const f=l[d];if(f.validator(i))return f.classGroupId}},cx=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?lx+o:void 0})(),dx=e=>{const{theme:t,classGroups:r}=e;return ux(r,t)},ux=(e,t)=>{const r=Hd();for(const o in e){const n=e[o];zl(n,r,o,t)}return r},zl=(e,t,r,o)=>{const n=e.length;for(let a=0;a<n;a++){const l=e[a];px(l,t,r,o)}},px=(e,t,r,o)=>{if(typeof e=="string"){fx(e,t,r);return}if(typeof e=="function"){hx(e,t,r,o);return}mx(e,t,r,o)},fx=(e,t,r)=>{const o=e===""?t:qd(t,e);o.classGroupId=r},hx=(e,t,r,o)=>{if(gx(e)){zl(e(o),t,r,o);return}t.validators===null&&(t.validators=[]),t.validators.push(sx(r,e))},mx=(e,t,r,o)=>{const n=Object.entries(e),a=n.length;for(let l=0;l<a;l++){const[i,c]=n[l];zl(c,qd(t,i),r,o)}},qd=(e,t)=>{let r=e;const o=t.split(na),n=o.length;for(let a=0;a<n;a++){const l=o[a];let i=r.nextPart.get(l);i||(i=Hd(),r.nextPart.set(l,i)),r=i}return r},gx=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,bx=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)}}},Bl="!",Qd=":",yx=[],Kd=(e,t,r,o,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:o,isExternal:n}),vx=e=>{const{prefix:t,experimentalParseClassName:r}=e;let o=n=>{const a=[];let l=0,i=0,c=0,d;const f=n.length;for(let b=0;b<f;b++){const v=n[b];if(l===0&&i===0){if(v===Qd){a.push(n.slice(c,b)),c=b+1;continue}if(v==="/"){d=b;continue}}v==="["?l++:v==="]"?l--:v==="("?i++:v===")"&&i--}const u=a.length===0?n:n.slice(c);let h=u,m=!1;u.endsWith(Bl)?(h=u.slice(0,-1),m=!0):u.startsWith(Bl)&&(h=u.slice(1),m=!0);const y=d&&d>c?d-c:void 0;return Kd(a,m,h,y)};if(t){const n=t+Qd,a=o;o=l=>l.startsWith(n)?a(l.slice(n.length)):Kd(yx,!1,l,void 0,!0)}if(r){const n=o;o=a=>r({className:a,parseClassName:n})}return o},xx=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}},wx=e=>({cache:bx(e.cacheSize),parseClassName:vx(e),sortModifiers:xx(e),...ix(e)}),Sx=/\s+/,Cx=(e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:n,sortModifiers:a}=t,l=[],i=e.trim().split(Sx);let c="";for(let d=i.length-1;d>=0;d-=1){const f=i[d],{isExternal:u,modifiers:h,hasImportantModifier:m,baseClassName:y,maybePostfixModifierPosition:b}=r(f);if(u){c=f+(c.length>0?" "+c:c);continue}let v=!!b,w=o(v?y.substring(0,b):y);if(!w){if(!v){c=f+(c.length>0?" "+c:c);continue}if(w=o(y),!w){c=f+(c.length>0?" "+c:c);continue}v=!1}const x=h.length===0?"":h.length===1?h[0]:a(h).join(":"),S=m?x+Bl:x,C=S+w;if(l.indexOf(C)>-1)continue;l.push(C);const k=n(w,v);for(let E=0;E<k.length;++E){const M=k[E];l.push(S+M)}c=f+(c.length>0?" "+c:c)}return c},Nx=(...e)=>{let t=0,r,o,n="";for(;t<e.length;)(r=e[t++])&&(o=Xd(r))&&(n&&(n+=" "),n+=o);return n},Xd=e=>{if(typeof e=="string")return e;let t,r="";for(let o=0;o<e.length;o++)e[o]&&(t=Xd(e[o]))&&(r&&(r+=" "),r+=t);return r},Jd=(e,...t)=>{let r,o,n,a;const l=c=>{const d=t.reduce((f,u)=>u(f),e());return r=wx(d),o=r.cache.get,n=r.cache.set,a=i,i(c)},i=c=>{const d=o(c);if(d)return d;const f=Cx(c,r);return n(c,f),f};return a=l,(...c)=>a(Nx(...c))},Ex=[],et=e=>{const t=r=>r[e]||Ex;return t.isThemeGetter=!0,t},Zd=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Rd=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kx=/^\d+\/\d+$/,_x=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Dx=/\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$/,Ax=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Tx=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Mx=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,go=e=>kx.test(e),xe=e=>!!e&&!Number.isNaN(Number(e)),Er=e=>!!e&&Number.isInteger(Number(e)),Ul=e=>e.endsWith("%")&&xe(e.slice(0,-1)),dr=e=>_x.test(e),Ix=()=>!0,Px=e=>Dx.test(e)&&!Ax.test(e),eu=()=>!1,Ox=e=>Tx.test(e),Lx=e=>Mx.test(e),$x=e=>!oe(e)&&!ne(e),Fx=e=>bo(e,au,eu),oe=e=>Zd.test(e),Qr=e=>bo(e,su,Px),Wl=e=>bo(e,Ux,xe),tu=e=>bo(e,ou,eu),Gx=e=>bo(e,nu,Lx),aa=e=>bo(e,lu,Ox),ne=e=>Rd.test(e),Qo=e=>yo(e,su),Vx=e=>yo(e,Wx),ru=e=>yo(e,ou),zx=e=>yo(e,au),Bx=e=>yo(e,nu),sa=e=>yo(e,lu,!0),bo=(e,t,r)=>{const o=Zd.exec(e);return o?o[1]?t(o[1]):r(o[2]):!1},yo=(e,t,r=!1)=>{const o=Rd.exec(e);return o?o[1]?t(o[1]):r:!1},ou=e=>e==="position"||e==="percentage",nu=e=>e==="image"||e==="url",au=e=>e==="length"||e==="size"||e==="bg-size",su=e=>e==="length",Ux=e=>e==="number",Wx=e=>e==="family-name",lu=e=>e==="shadow",iu=()=>{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"),f=et("shadow"),u=et("inset-shadow"),h=et("text-shadow"),m=et("drop-shadow"),y=et("blur"),b=et("perspective"),v=et("aspect"),w=et("ease"),x=et("animate"),S=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...C(),ne,oe],E=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],_=()=>[ne,oe,c],I=()=>[go,"full","auto",..._()],A=()=>[Er,"none","subgrid",ne,oe],W=()=>["auto",{span:["full",Er,ne,oe]},Er,ne,oe],$=()=>[Er,"auto",ne,oe],G=()=>["auto","min","max","fr",ne,oe],Q=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ee=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",..._()],K=()=>[go,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",..._()],O=()=>[e,ne,oe],B=()=>[...C(),ru,tu,{position:[ne,oe]}],fe=()=>["no-repeat",{repeat:["","x","y","space","round"]}],be=()=>["auto","cover","contain",zx,Fx,{size:[ne,oe]}],F=()=>[Ul,Qo,Qr],q=()=>["","none","full",d,ne,oe],re=()=>["",xe,Qo,Qr],he=()=>["solid","dashed","dotted","double"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J=()=>[xe,Ul,ru,tu],le=()=>["","none",y,ne,oe],ve=()=>["none",xe,ne,oe],ie=()=>["none",xe,ne,oe],j=()=>[xe,ne,oe],Y=()=>[go,"full",..._()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[dr],breakpoint:[dr],color:[Ix],container:[dr],"drop-shadow":[dr],ease:["in","out","in-out"],font:[$x],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[dr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[dr],shadow:[dr],spacing:["px",xe],text:[dr],"text-shadow":[dr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",go,oe,ne,v]}],container:["container"],columns:[{columns:[xe,oe,ne,i]}],"break-after":[{"break-after":S()}],"break-before":[{"break-before":S()}],"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:k()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{start:I()}],end:[{end:I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[Er,"auto",ne,oe]}],basis:[{basis:[go,"full","auto",i,..._()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[xe,go,"auto","initial","none",oe]}],grow:[{grow:["",xe,ne,oe]}],shrink:[{shrink:["",xe,ne,oe]}],order:[{order:[Er,"first","last","none",ne,oe]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:W()}],"col-start":[{"col-start":$()}],"col-end":[{"col-end":$()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:W()}],"row-start":[{"row-start":$()}],"row-end":[{"row-end":$()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":G()}],"auto-rows":[{"auto-rows":G()}],gap:[{gap:_()}],"gap-x":[{"gap-x":_()}],"gap-y":[{"gap-y":_()}],"justify-content":[{justify:[...Q(),"normal"]}],"justify-items":[{"justify-items":[...ee(),"normal"]}],"justify-self":[{"justify-self":["auto",...ee()]}],"align-content":[{content:["normal",...Q()]}],"align-items":[{items:[...ee(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ee(),{baseline:["","last"]}]}],"place-content":[{"place-content":Q()}],"place-items":[{"place-items":[...ee(),"baseline"]}],"place-self":[{"place-self":["auto",...ee()]}],p:[{p:_()}],px:[{px:_()}],py:[{py:_()}],ps:[{ps:_()}],pe:[{pe:_()}],pt:[{pt:_()}],pr:[{pr:_()}],pb:[{pb:_()}],pl:[{pl:_()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":_()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":_()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[i,"screen",...K()]}],"min-w":[{"min-w":[i,"screen","none",...K()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[l]},...K()]}],h:[{h:["screen","lh",...K()]}],"min-h":[{"min-h":["screen","lh","none",...K()]}],"max-h":[{"max-h":["screen","lh",...K()]}],"font-size":[{text:["base",r,Qo,Qr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,ne,Wl]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Ul,oe]}],"font-family":[{font:[Vx,oe,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,ne,oe]}],"line-clamp":[{"line-clamp":[xe,"none",ne,Wl]}],leading:[{leading:[a,..._()]}],"list-image":[{"list-image":["none",ne,oe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ne,oe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:O()}],"text-color":[{text:O()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[xe,"from-font","auto",ne,Qr]}],"text-decoration-color":[{decoration:O()}],"underline-offset":[{"underline-offset":[xe,"auto",ne,oe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ne,oe]}],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",ne,oe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:B()}],"bg-repeat":[{bg:fe()}],"bg-size":[{bg:be()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Er,ne,oe],radial:["",ne,oe],conic:[Er,ne,oe]},Bx,Gx]}],"bg-color":[{bg:O()}],"gradient-from-pos":[{from:F()}],"gradient-via-pos":[{via:F()}],"gradient-to-pos":[{to:F()}],"gradient-from":[{from:O()}],"gradient-via":[{via:O()}],"gradient-to":[{to:O()}],rounded:[{rounded:q()}],"rounded-s":[{"rounded-s":q()}],"rounded-e":[{"rounded-e":q()}],"rounded-t":[{"rounded-t":q()}],"rounded-r":[{"rounded-r":q()}],"rounded-b":[{"rounded-b":q()}],"rounded-l":[{"rounded-l":q()}],"rounded-ss":[{"rounded-ss":q()}],"rounded-se":[{"rounded-se":q()}],"rounded-ee":[{"rounded-ee":q()}],"rounded-es":[{"rounded-es":q()}],"rounded-tl":[{"rounded-tl":q()}],"rounded-tr":[{"rounded-tr":q()}],"rounded-br":[{"rounded-br":q()}],"rounded-bl":[{"rounded-bl":q()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:O()}],"border-color-x":[{"border-x":O()}],"border-color-y":[{"border-y":O()}],"border-color-s":[{"border-s":O()}],"border-color-e":[{"border-e":O()}],"border-color-t":[{"border-t":O()}],"border-color-r":[{"border-r":O()}],"border-color-b":[{"border-b":O()}],"border-color-l":[{"border-l":O()}],"divide-color":[{divide:O()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[xe,ne,oe]}],"outline-w":[{outline:["",xe,Qo,Qr]}],"outline-color":[{outline:O()}],shadow:[{shadow:["","none",f,sa,aa]}],"shadow-color":[{shadow:O()}],"inset-shadow":[{"inset-shadow":["none",u,sa,aa]}],"inset-shadow-color":[{"inset-shadow":O()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:O()}],"ring-offset-w":[{"ring-offset":[xe,Qr]}],"ring-offset-color":[{"ring-offset":O()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":O()}],"text-shadow":[{"text-shadow":["none",h,sa,aa]}],"text-shadow-color":[{"text-shadow":O()}],opacity:[{opacity:[xe,ne,oe]}],"mix-blend":[{"mix-blend":[...X(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":X()}],"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":[xe]}],"mask-image-linear-from-pos":[{"mask-linear-from":J()}],"mask-image-linear-to-pos":[{"mask-linear-to":J()}],"mask-image-linear-from-color":[{"mask-linear-from":O()}],"mask-image-linear-to-color":[{"mask-linear-to":O()}],"mask-image-t-from-pos":[{"mask-t-from":J()}],"mask-image-t-to-pos":[{"mask-t-to":J()}],"mask-image-t-from-color":[{"mask-t-from":O()}],"mask-image-t-to-color":[{"mask-t-to":O()}],"mask-image-r-from-pos":[{"mask-r-from":J()}],"mask-image-r-to-pos":[{"mask-r-to":J()}],"mask-image-r-from-color":[{"mask-r-from":O()}],"mask-image-r-to-color":[{"mask-r-to":O()}],"mask-image-b-from-pos":[{"mask-b-from":J()}],"mask-image-b-to-pos":[{"mask-b-to":J()}],"mask-image-b-from-color":[{"mask-b-from":O()}],"mask-image-b-to-color":[{"mask-b-to":O()}],"mask-image-l-from-pos":[{"mask-l-from":J()}],"mask-image-l-to-pos":[{"mask-l-to":J()}],"mask-image-l-from-color":[{"mask-l-from":O()}],"mask-image-l-to-color":[{"mask-l-to":O()}],"mask-image-x-from-pos":[{"mask-x-from":J()}],"mask-image-x-to-pos":[{"mask-x-to":J()}],"mask-image-x-from-color":[{"mask-x-from":O()}],"mask-image-x-to-color":[{"mask-x-to":O()}],"mask-image-y-from-pos":[{"mask-y-from":J()}],"mask-image-y-to-pos":[{"mask-y-to":J()}],"mask-image-y-from-color":[{"mask-y-from":O()}],"mask-image-y-to-color":[{"mask-y-to":O()}],"mask-image-radial":[{"mask-radial":[ne,oe]}],"mask-image-radial-from-pos":[{"mask-radial-from":J()}],"mask-image-radial-to-pos":[{"mask-radial-to":J()}],"mask-image-radial-from-color":[{"mask-radial-from":O()}],"mask-image-radial-to-color":[{"mask-radial-to":O()}],"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":C()}],"mask-image-conic-pos":[{"mask-conic":[xe]}],"mask-image-conic-from-pos":[{"mask-conic-from":J()}],"mask-image-conic-to-pos":[{"mask-conic-to":J()}],"mask-image-conic-from-color":[{"mask-conic-from":O()}],"mask-image-conic-to-color":[{"mask-conic-to":O()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:B()}],"mask-repeat":[{mask:fe()}],"mask-size":[{mask:be()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ne,oe]}],filter:[{filter:["","none",ne,oe]}],blur:[{blur:le()}],brightness:[{brightness:[xe,ne,oe]}],contrast:[{contrast:[xe,ne,oe]}],"drop-shadow":[{"drop-shadow":["","none",m,sa,aa]}],"drop-shadow-color":[{"drop-shadow":O()}],grayscale:[{grayscale:["",xe,ne,oe]}],"hue-rotate":[{"hue-rotate":[xe,ne,oe]}],invert:[{invert:["",xe,ne,oe]}],saturate:[{saturate:[xe,ne,oe]}],sepia:[{sepia:["",xe,ne,oe]}],"backdrop-filter":[{"backdrop-filter":["","none",ne,oe]}],"backdrop-blur":[{"backdrop-blur":le()}],"backdrop-brightness":[{"backdrop-brightness":[xe,ne,oe]}],"backdrop-contrast":[{"backdrop-contrast":[xe,ne,oe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",xe,ne,oe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[xe,ne,oe]}],"backdrop-invert":[{"backdrop-invert":["",xe,ne,oe]}],"backdrop-opacity":[{"backdrop-opacity":[xe,ne,oe]}],"backdrop-saturate":[{"backdrop-saturate":[xe,ne,oe]}],"backdrop-sepia":[{"backdrop-sepia":["",xe,ne,oe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":_()}],"border-spacing-x":[{"border-spacing-x":_()}],"border-spacing-y":[{"border-spacing-y":_()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ne,oe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[xe,"initial",ne,oe]}],ease:[{ease:["linear","initial",w,ne,oe]}],delay:[{delay:[xe,ne,oe]}],animate:[{animate:["none",x,ne,oe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,ne,oe]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:ve()}],"rotate-x":[{"rotate-x":ve()}],"rotate-y":[{"rotate-y":ve()}],"rotate-z":[{"rotate-z":ve()}],scale:[{scale:ie()}],"scale-x":[{"scale-x":ie()}],"scale-y":[{"scale-y":ie()}],"scale-z":[{"scale-z":ie()}],"scale-3d":["scale-3d"],skew:[{skew:j()}],"skew-x":[{"skew-x":j()}],"skew-y":[{"skew-y":j()}],transform:[{transform:[ne,oe,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Y()}],"translate-x":[{"translate-x":Y()}],"translate-y":[{"translate-y":Y()}],"translate-z":[{"translate-z":Y()}],"translate-none":["translate-none"],accent:[{accent:O()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:O()}],"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",ne,oe]}],"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":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"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",ne,oe]}],fill:[{fill:["none",...O()]}],"stroke-w":[{stroke:[xe,Qo,Qr,Wl]}],stroke:[{stroke:["none",...O()]}],"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"]}},Hx=(e,{cacheSize:t,prefix:r,experimentalParseClassName:o,extend:n={},override:a={}})=>(Ko(e,"cacheSize",t),Ko(e,"prefix",r),Ko(e,"experimentalParseClassName",o),la(e.theme,a.theme),la(e.classGroups,a.classGroups),la(e.conflictingClassGroups,a.conflictingClassGroups),la(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),Ko(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),ia(e.theme,n.theme),ia(e.classGroups,n.classGroups),ia(e.conflictingClassGroups,n.conflictingClassGroups),ia(e.conflictingClassGroupModifiers,n.conflictingClassGroupModifiers),cu(e,n,"orderSensitiveModifiers"),e),Ko=(e,t,r)=>{r!==void 0&&(e[t]=r)},la=(e,t)=>{if(t)for(const r in t)Ko(e,r,t[r])},ia=(e,t)=>{if(t)for(const r in t)cu(e,t,r)},cu=(e,t,r)=>{const o=t[r];o!==void 0&&(e[r]=e[r]?e[r].concat(o):o)},jx=((e,...t)=>typeof e=="function"?Jd(iu,e,...t):Jd(()=>Hx(iu(),e),...t))({prefix:""});function p(...e){const t=Wd(e);return jx(t)}const ca=({label:e,required:t,htmlFor:r,className:o=""})=>e?s.jsxs("label",{htmlFor:r,className:p("block text-sm font-medium text-gray-700",o),children:[e,t&&s.jsx("span",{className:p("text-red-500 ml-1"),children:"*"})]}):null,da=({description:e,className:t=""})=>e?s.jsx("p",{className:p("text-xs text-gray-500",t),children:e}):null,Xo=({errors:e,className:t=""})=>!e||e.length===0?null:s.jsx("div",{className:p("space-y-1",t),children:e.map((r,o)=>s.jsx("p",{className:p("text-xs text-red-500"),children:r},o))}),Yx=({label:e,description:t,required:r,errors:o,children:n})=>s.jsxs("div",{className:p("space-y-1.5"),children:[s.jsx(ca,{label:e,required:r}),s.jsx(da,{description:t}),n,s.jsx(Xo,{errors:o})]}),ae=({label:e,description:t,required:r,errors:o,labelPosition:n="top",className:a="",children:l})=>n==="hidden"?s.jsxs("div",{className:p("space-y-1.5",a),children:[l,s.jsx(Xo,{errors:o})]}):n==="left"?s.jsxs("div",{className:p("flex items-start gap-4",a),children:[s.jsxs("div",{className:p("w-1/3 pt-2"),children:[s.jsx(ca,{label:e,required:r}),s.jsx(da,{description:t})]}),s.jsxs("div",{className:p("flex-1 space-y-1.5"),children:[l,s.jsx(Xo,{errors:o})]})]}):s.jsxs("div",{className:p("space-y-1.5",a),children:[s.jsx(ca,{label:e,required:r}),s.jsx(da,{description:t}),l,s.jsx(Xo,{errors:o})]}),qx=({children:e,className:t=""})=>s.jsx("div",{className:p("pointer-events-none",t),children:e}),Qx=({icon:e="📋",message:t,subMessage:r})=>s.jsxs("div",{className:p("border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50"),children:[s.jsx("span",{className:p("text-4xl"),children:e}),s.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:t}),r&&s.jsx("p",{className:p("text-xs text-gray-400"),children:r})]}),Kr=({icon:e,children:t,iconPosition:r="left"})=>s.jsxs("div",{className:p("relative"),children:[s.jsx("span",{className:p("absolute top-1/2 -translate-y-1/2 text-gray-400",r==="left"?"left-3":"right-3"),children:e}),t]}),Hl=({prefix:e,suffix:t,children:r})=>s.jsxs("div",{className:p("flex"),children:[e&&s.jsx("span",{className:p("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:p("flex-1",!e&&"rounded-l-md",!t&&"rounded-r-md"),children:r}),t&&s.jsx("span",{className:p("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;return p("w-full","border","transition-colors","focus:outline-none","focus:ring-2","focus:ring-offset-0",{small:"px-2 py-1.5 text-sm",medium:"px-3 py-2 text-sm",large:"px-4 py-3 text-base"}[o],!l&&!i&&"rounded-md",l&&!i&&"rounded-r-md",!l&&i&&"rounded-l-md",n&&"pl-10",a&&"pr-10",r&&"bg-gray-50 text-gray-500 cursor-not-allowed border-gray-300",t&&!r&&"border-red-500 focus:ring-red-500 focus:border-red-500",!t&&!r&&"border-gray-300 focus:ring-blue-500 focus:border-blue-500")}function lt(e="medium"){return p("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")}function Kx(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"};return p("rounded-md","font-medium","transition-colors","focus:outline-none","focus:ring-2","focus:ring-offset-2",n[r],o&&"opacity-50 cursor-not-allowed",a[t])}function U(e){const{element:t,properties:r,layout:o,validation:n,config:a,mode:l,value:i,onChange:c,errors:d,readOnly:f,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||f||l==="canvas",value:i,onChange:c,errors:d,config:a,element:t}}const Xx=[{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}=U(e);return s.jsx(ae,{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}=U(e);return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsx("input",{type:"text",placeholder:o,value:l??"",onChange:f=>i==null?void 0:i(f.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}=U(e);return s.jsx(ae,{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:f}=U(e);return s.jsx(ae,{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:(f==null?void 0:f.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}=U(e);return s.jsx(ae,{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:f}=U(e);return s.jsx(ae,{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:(f==null?void 0:f.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}=U(e);return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,children:s.jsxs("div",{className:p("border border-gray-300 rounded-md bg-gray-50 overflow-hidden"),children:[s.jsxs("div",{className:p("flex items-center gap-1 p-2 border-b border-gray-200 bg-gray-100"),children:[s.jsx("button",{disabled:!0,className:p("p-1.5 rounded hover:bg-gray-200 text-gray-600"),children:s.jsx("strong",{children:"B"})}),s.jsx("button",{disabled:!0,className:p("p-1.5 rounded hover:bg-gray-200 text-gray-600"),children:s.jsx("em",{children:"I"})}),s.jsx("button",{disabled:!0,className:p("p-1.5 rounded hover:bg-gray-200 text-gray-600"),children:s.jsx("u",{children:"U"})}),s.jsx("span",{className:p("w-px h-4 bg-gray-300 mx-1")}),s.jsx("button",{disabled:!0,className:p("p-1.5 rounded hover:bg-gray-200 text-gray-600 text-xs"),children:"🔗"})]}),s.jsx("div",{className:p("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}=U(e);return s.jsx(ae,{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:p("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("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("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("p-1.5 rounded hover:bg-gray-200 text-gray-600 disabled:opacity-50"),children:s.jsx("u",{children:"U"})}),s.jsx("span",{className:p("w-px h-4 bg-gray-300 mx-1")}),s.jsx("button",{type:"button",disabled:c,className:p("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:f=>l==null?void 0:l(f.target.innerHTML),dangerouslySetInnerHTML:{__html:a??""},className:p("p-3 min-h-[120px] text-sm focus:outline-none"),style:{height:(d==null?void 0:d.height)||200}})]})})}}],Jx=[{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}=U(e),c=s.jsx("input",{type:"number",placeholder:o,disabled:!0,className:`${lt()} ${l?"":"rounded-l-md"} ${i?"":"rounded-r-md"}`});return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,children:l||i?s.jsx(Hl,{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:f,isDisabled:u,config:h}=U(e),m=b=>{const v=b.target.value===""?void 0:Number(b.target.value);d==null||d(v)},y=s.jsx("input",{type:"number",placeholder:o,value:c??"",onChange:m,disabled:u,step:(h==null?void 0:h.step)||1,className:`${bt({hasError:((f==null?void 0:f.length)??0)>0,disabled:u})} ${l?"rounded-l-none":""} ${i?"rounded-r-none":""}`});return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,errors:f,children:l||i?s.jsx(Hl,{prefix:l,suffix:i,children:y}):y})}},{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}=U(e),l=(a==null?void 0:a.min)??0,i=(a==null?void 0:a.max)??100;return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:p("flex items-center gap-3"),children:[s.jsx("span",{className:p("text-xs text-gray-500"),children:l}),s.jsx("input",{type:"range",min:l,max:i,disabled:!0,className:p("flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-not-allowed")}),s.jsx("span",{className:p("text-xs text-gray-500"),children:i}),(a==null?void 0:a.showValue)&&s.jsx("span",{className:p("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}=U(e),f=(d==null?void 0:d.min)??0,u=(d==null?void 0:d.max)??100,h=(d==null?void 0:d.step)??1,m=a??f;return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:p("flex items-center gap-3"),children:[s.jsx("span",{className:p("text-xs text-gray-500"),children:f}),s.jsx("input",{type:"range",min:f,max:u,step:h,value:m,onChange:y=>l==null?void 0:l(Number(y.target.value)),disabled:c,className:p("flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer disabled:cursor-not-allowed")}),s.jsx("span",{className:p("text-xs text-gray-500"),children:u}),(d==null?void 0:d.showValue)&&s.jsx("span",{className:p("text-sm font-medium text-gray-600 min-w-[40px] text-center"),children:m})]})})}},{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}=U(e),l=(a==null?void 0:a.min)??0,i=(a==null?void 0:a.max)??100;return s.jsxs(ae,{label:t,description:r,required:o,labelPosition:n,children:[s.jsxs("div",{className:p("flex items-center gap-3"),children:[s.jsx("span",{className:p("text-xs text-gray-500"),children:l}),s.jsxs("div",{className:p("flex-1 relative h-2 bg-gray-200 rounded-lg"),children:[s.jsx("div",{className:p("absolute h-full bg-blue-400 rounded-lg left-[20%] right-[30%]")}),s.jsx("div",{className:p("absolute w-4 h-4 bg-white border-2 border-blue-500 rounded-full -top-1 left-[20%] -ml-2")}),s.jsx("div",{className:p("absolute w-4 h-4 bg-white border-2 border-blue-500 rounded-full -top-1 right-[30%] -mr-2")})]}),s.jsx("span",{className:p("text-xs text-gray-500"),children:i})]}),(a==null?void 0:a.showValue)&&s.jsxs("div",{className:p("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}=U(e),f=(d==null?void 0:d.min)??0,u=(d==null?void 0:d.max)??100,h=(d==null?void 0:d.step)??1,m=(a==null?void 0:a.min)??Math.round(f+(u-f)*.2),y=(a==null?void 0:a.max)??Math.round(f+(u-f)*.8),b=S=>{const C=Number(S.target.value),k=Math.min(C,y-((d==null?void 0:d.minRange)??0));l==null||l({min:k,max:y})},v=S=>{const C=Number(S.target.value),k=Math.max(C,m+((d==null?void 0:d.minRange)??0));l==null||l({min:m,max:k})},w=(m-f)/(u-f)*100,x=100-(y-f)/(u-f)*100;return s.jsxs(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:[s.jsxs("div",{className:p("flex items-center gap-3"),children:[s.jsx("span",{className:p("text-xs text-gray-500"),children:f}),s.jsxs("div",{className:p("flex-1 relative h-2 bg-gray-200 rounded-lg"),children:[s.jsx("div",{className:p("absolute h-full bg-blue-400 rounded-lg"),style:{left:`${w}%`,right:`${x}%`}}),s.jsx("input",{type:"range",min:f,max:u,step:h,value:m,onChange:b,disabled:c,className:p("absolute w-full h-full appearance-none bg-transparent pointer-events-auto cursor-pointer disabled:cursor-not-allowed"),style:{zIndex:m>u-10?5:3}}),s.jsx("input",{type:"range",min:f,max:u,step:h,value:y,onChange:v,disabled:c,className:p("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:p("text-xs text-gray-500"),children:u})]}),(d==null?void 0:d.showValue)&&s.jsxs("div",{className:p("flex justify-between text-sm text-gray-600 mt-2"),children:[s.jsxs("span",{children:["Min: ",m]}),s.jsxs("span",{children:["Max: ",y]})]})]})}}],Zx=[{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}=U(e),l=(a==null?void 0:a.options)||[];return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:p("space-y-2"),children:[l.map((i,c)=>s.jsxs("label",{className:p("flex items-center gap-2"),children:[s.jsx("input",{type:"radio",disabled:!0,className:p("text-blue-600")}),s.jsx("span",{className:p("text-sm text-gray-700"),children:i.label})]},c)),(a==null?void 0:a.allowOther)&&s.jsxs("label",{className:p("flex items-center gap-2"),children:[s.jsx("input",{type:"radio",disabled:!0,className:p("text-blue-600")}),s.jsx("span",{className:p("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}=U(e),f=(d==null?void 0:d.options)||[];return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:p("space-y-2"),children:[f.map((u,h)=>s.jsxs("label",{className:p("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:p("text-blue-600")}),s.jsx("span",{className:p("text-sm text-gray-700"),children:u.label})]},h)),(d==null?void 0:d.allowOther)&&s.jsxs("label",{className:p("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:p("text-blue-600")}),s.jsx("span",{className:p("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}=U(e),l=(a==null?void 0:a.options)||[];return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:p("space-y-2"),children:[l.map((i,c)=>s.jsxs("label",{className:p("flex items-center gap-2"),children:[s.jsx("input",{type:"checkbox",disabled:!0,className:p("text-blue-600 rounded")}),s.jsx("span",{className:p("text-sm text-gray-700"),children:i.label})]},c)),(a==null?void 0:a.allowOther)&&s.jsxs("label",{className:p("flex items-center gap-2"),children:[s.jsx("input",{type:"checkbox",disabled:!0,className:p("text-blue-600 rounded")}),s.jsx("span",{className:p("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}=U(e),f=(d==null?void 0:d.options)||[],u=Array.isArray(a)?a:[],h=m=>{const y=u.includes(m)?u.filter(b=>b!==m):[...u,m];l==null||l(y)};return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:p("space-y-2"),children:[f.map((m,y)=>s.jsxs("label",{className:p("flex items-center gap-2 cursor-pointer"),children:[s.jsx("input",{type:"checkbox",checked:u.includes(m.value),onChange:()=>h(m.value),disabled:c,className:p("text-blue-600 rounded")}),s.jsx("span",{className:p("text-sm text-gray-700"),children:m.label})]},y)),(d==null?void 0:d.allowOther)&&s.jsxs("label",{className:p("flex items-center gap-2 cursor-pointer"),children:[s.jsx("input",{type:"checkbox",checked:u.includes("__other__"),onChange:()=>h("__other__"),disabled:c,className:p("text-blue-600 rounded")}),s.jsx("span",{className:p("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}=U(e),i=(l==null?void 0:l.options)||[];return s.jsx(ae,{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:f}=U(e),u=(f==null?void 0:f.options)||[];return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsxs("select",{value:l??"",onChange:h=>i==null?void 0:i(h.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((h,m)=>s.jsx("option",{value:h.value,children:h.label},m))]})})}},{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}=U(e);return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,children:s.jsxs("div",{className:p("flex flex-wrap gap-2 p-2 border border-gray-300 rounded-md bg-gray-50 min-h-[42px]"),children:[s.jsxs("span",{className:p("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:p("text-blue-600 hover:text-blue-800"),children:"×"})]}),s.jsxs("span",{className:p("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:p("text-blue-600 hover:text-blue-800"),children:"×"})]}),s.jsx("input",{type:"text",placeholder:o||"Add tag...",disabled:!0,className:p("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:f}=U(e),u=Array.isArray(l)?l:[],[h,m]=N.useState(""),y=v=>{v.key==="Enter"&&h.trim()&&(v.preventDefault(),!u.includes(h.trim())&&(!(f!=null&&f.maxTags)||u.length<f.maxTags)&&(i==null||i([...u,h.trim()])),m(""))},b=v=>{i==null||i(u.filter(w=>w!==v))};return s.jsx(ae,{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((v,w)=>s.jsxs("span",{className:p("inline-flex items-center gap-1 px-2 py-1 bg-blue-100 text-blue-800 text-sm rounded"),children:[v,!d&&s.jsx("button",{type:"button",onClick:()=>b(v),className:p("text-blue-600 hover:text-blue-800"),children:"×"})]},w)),!d&&(!(f!=null&&f.maxTags)||u.length<f.maxTags)&&s.jsx("input",{type:"text",placeholder:o||"Add tag...",value:h,onChange:v=>m(v.target.value),onKeyDown:y,disabled:d,className:p("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}=U(e);return s.jsx("div",{className:p("space-y-1.5"),children:s.jsxs("label",{className:p("flex items-start gap-3 cursor-pointer"),children:[s.jsx("input",{type:"checkbox",disabled:!0,className:p("mt-1 text-blue-600 rounded")}),s.jsxs("div",{children:[s.jsx("span",{className:p("text-sm text-gray-700"),children:t}),o&&s.jsx("span",{className:p("text-red-500 ml-1"),children:"*"}),r&&s.jsx("p",{className:p("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}=U(e);return s.jsxs("div",{className:p("space-y-1.5"),children:[s.jsxs("label",{className:p("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:p("mt-1 text-blue-600 rounded")}),s.jsxs("div",{children:[s.jsx("span",{className:p("text-sm text-gray-700"),children:t}),o&&s.jsx("span",{className:p("text-red-500 ml-1"),children:"*"}),r&&s.jsx("p",{className:p("text-xs text-gray-500 mt-0.5"),children:r})]})]}),l&&l.length>0&&s.jsx("div",{className:p("space-y-1"),children:l.map((c,d)=>s.jsx("p",{className:p("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}=U(e);return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:p("flex items-center gap-2"),children:[s.jsx("span",{className:p("text-sm text-gray-500"),children:(a==null?void 0:a.offLabel)||"Off"}),s.jsx("div",{className:p("relative w-11 h-6 bg-gray-300 rounded-full"),children:s.jsx("div",{className:p("absolute left-1 top-1 w-4 h-4 bg-white rounded-full transition-transform")})}),s.jsx("span",{className:p("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}=U(e),f=a??!1;return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:p("flex items-center gap-2"),children:[s.jsx("span",{className:p("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(!f)),disabled:c,className:`relative w-11 h-6 rounded-full transition-colors ${f?"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 ${f?"translate-x-6":"translate-x-1"}`})}),s.jsx("span",{className:p("text-sm text-gray-500"),children:(d==null?void 0:d.onLabel)||"On"})]})})}}];function du(e,[t,r]){return Math.min(r,Math.max(t,e))}function we(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 ur(e,t=[]){let r=[];function o(a,l){const i=g.createContext(l),c=r.length;r=[...r,l];const d=u=>{var w;const{scope:h,children:m,...y}=u,b=((w=h==null?void 0:h[e])==null?void 0:w[c])||i,v=g.useMemo(()=>y,Object.values(y));return s.jsx(b.Provider,{value:v,children:m})};d.displayName=a+"Provider";function f(u,h){var b;const m=((b=h==null?void 0:h[e])==null?void 0:b[c])||i,y=g.useContext(m);if(y)return y;if(l!==void 0)return l;throw new Error(`\`${u}\` must be used within \`${a}\``)}return[d,f]}const n=()=>{const a=r.map(l=>g.createContext(l));return function(i){const c=(i==null?void 0:i[e])||a;return g.useMemo(()=>({[`__scope${e}`]:{...i,[e]:c}}),[i,c])}};return n.scopeName=e,[o,Rx(n,...t)]}function Rx(...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 g.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return r.scopeName=t.scopeName,r}function uu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Jo(...e){return t=>{let r=!1;const o=e.map(n=>{const a=uu(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():uu(e[n],null)}}}}function Fe(...e){return g.useCallback(Jo(...e),e)}function pu(e){const t=ew(e),r=g.forwardRef((o,n)=>{const{children:a,...l}=o,i=g.Children.toArray(a),c=i.find(rw);if(c){const d=c.props.children,f=i.map(u=>u===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...l,ref:n,children:g.isValidElement(d)?g.cloneElement(d,void 0,f):null})}return s.jsx(t,{...l,ref:n,children:a})});return r.displayName=`${e}.Slot`,r}function ew(e){const t=g.forwardRef((r,o)=>{const{children:n,...a}=r;if(g.isValidElement(n)){const l=nw(n),i=ow(a,n.props);return n.type!==g.Fragment&&(i.ref=o?Jo(o,l):l),g.cloneElement(n,i)}return g.Children.count(n)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var tw=Symbol("radix.slottable");function rw(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===tw}function ow(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 nw(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 jl(e){const t=e+"CollectionProvider",[r,o]=ur(t),[n,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),l=b=>{const{scope:v,children:w}=b,x=N.useRef(null),S=N.useRef(new Map).current;return s.jsx(n,{scope:v,itemMap:S,collectionRef:x,children:w})};l.displayName=t;const i=e+"CollectionSlot",c=pu(i),d=N.forwardRef((b,v)=>{const{scope:w,children:x}=b,S=a(i,w),C=Fe(v,S.collectionRef);return s.jsx(c,{ref:C,children:x})});d.displayName=i;const f=e+"CollectionItemSlot",u="data-radix-collection-item",h=pu(f),m=N.forwardRef((b,v)=>{const{scope:w,children:x,...S}=b,C=N.useRef(null),k=Fe(v,C),E=a(f,w);return N.useEffect(()=>(E.itemMap.set(C,{ref:C,...S}),()=>void E.itemMap.delete(C))),s.jsx(h,{[u]:"",ref:k,children:x})});m.displayName=f;function y(b){const v=a(e+"CollectionConsumer",b);return N.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const S=Array.from(x.querySelectorAll(`[${u}]`));return Array.from(v.itemMap.values()).sort((E,M)=>S.indexOf(E.ref.current)-S.indexOf(M.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:l,Slot:d,ItemSlot:m},y,o]}var aw=g.createContext(void 0);function ua(e){const t=g.useContext(aw);return e||t||"ltr"}function sw(e){const t=lw(e),r=g.forwardRef((o,n)=>{const{children:a,...l}=o,i=g.Children.toArray(a),c=i.find(cw);if(c){const d=c.props.children,f=i.map(u=>u===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...l,ref:n,children:g.isValidElement(d)?g.cloneElement(d,void 0,f):null})}return s.jsx(t,{...l,ref:n,children:a})});return r.displayName=`${e}.Slot`,r}function lw(e){const t=g.forwardRef((r,o)=>{const{children:n,...a}=r;if(g.isValidElement(n)){const l=uw(n),i=dw(a,n.props);return n.type!==g.Fragment&&(i.ref=o?Jo(o,l):l),g.cloneElement(n,i)}return g.Children.count(n)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var iw=Symbol("radix.slottable");function cw(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===iw}function dw(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 uw(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 pw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ne=pw.reduce((e,t)=>{const r=sw(`Primitive.${t}`),o=g.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 fw(e,t){e&&Kn.flushSync(()=>e.dispatchEvent(t))}function kr(e){const t=g.useRef(e);return g.useEffect(()=>{t.current=e}),g.useMemo(()=>(...r)=>{var o;return(o=t.current)==null?void 0:o.call(t,...r)},[])}function hw(e,t=globalThis==null?void 0:globalThis.document){const r=kr(e);g.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 mw="DismissableLayer",Yl="dismissableLayer.update",gw="dismissableLayer.pointerDownOutside",bw="dismissableLayer.focusOutside",fu,hu=g.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ql=g.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:n,onFocusOutside:a,onInteractOutside:l,onDismiss:i,...c}=e,d=g.useContext(hu),[f,u]=g.useState(null),h=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=g.useState({}),y=Fe(t,M=>u(M)),b=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),w=b.indexOf(v),x=f?b.indexOf(f):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,C=x>=w,k=xw(M=>{const _=M.target,I=[...d.branches].some(A=>A.contains(_));!C||I||(n==null||n(M),l==null||l(M),M.defaultPrevented||i==null||i())},h),E=ww(M=>{const _=M.target;[...d.branches].some(A=>A.contains(_))||(a==null||a(M),l==null||l(M),M.defaultPrevented||i==null||i())},h);return hw(M=>{x===d.layers.size-1&&(o==null||o(M),!M.defaultPrevented&&i&&(M.preventDefault(),i()))},h),g.useEffect(()=>{if(f)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(fu=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),mu(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=fu)}},[f,h,r,d]),g.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),mu())},[f,d]),g.useEffect(()=>{const M=()=>m({});return document.addEventListener(Yl,M),()=>document.removeEventListener(Yl,M)},[]),s.jsx(Ne.div,{...c,ref:y,style:{pointerEvents:S?C?"auto":"none":void 0,...e.style},onFocusCapture:we(e.onFocusCapture,E.onFocusCapture),onBlurCapture:we(e.onBlurCapture,E.onBlurCapture),onPointerDownCapture:we(e.onPointerDownCapture,k.onPointerDownCapture)})});ql.displayName=mw;var yw="DismissableLayerBranch",vw=g.forwardRef((e,t)=>{const r=g.useContext(hu),o=g.useRef(null),n=Fe(t,o);return g.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})});vw.displayName=yw;function xw(e,t=globalThis==null?void 0:globalThis.document){const r=kr(e),o=g.useRef(!1),n=g.useRef(()=>{});return g.useEffect(()=>{const a=i=>{if(i.target&&!o.current){let c=function(){gu(gw,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 ww(e,t=globalThis==null?void 0:globalThis.document){const r=kr(e),o=g.useRef(!1);return g.useEffect(()=>{const n=a=>{a.target&&!o.current&&gu(bw,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 mu(){const e=new CustomEvent(Yl);document.dispatchEvent(e)}function gu(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?fw(n,a):n.dispatchEvent(a)}var Ql=0;function Sw(){g.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??bu()),document.body.insertAdjacentElement("beforeend",e[1]??bu()),Ql++,()=>{Ql===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ql--}},[])}function bu(){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 Kl="focusScope.autoFocusOnMount",Xl="focusScope.autoFocusOnUnmount",yu={bubbles:!1,cancelable:!0},Cw="FocusScope",vu=g.forwardRef((e,t)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:n,onUnmountAutoFocus:a,...l}=e,[i,c]=g.useState(null),d=kr(n),f=kr(a),u=g.useRef(null),h=Fe(t,b=>c(b)),m=g.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;g.useEffect(()=>{if(o){let b=function(S){if(m.paused||!i)return;const C=S.target;i.contains(C)?u.current=C:_r(u.current,{select:!0})},v=function(S){if(m.paused||!i)return;const C=S.relatedTarget;C!==null&&(i.contains(C)||_r(u.current,{select:!0}))},w=function(S){if(document.activeElement===document.body)for(const k of S)k.removedNodes.length>0&&_r(i)};document.addEventListener("focusin",b),document.addEventListener("focusout",v);const x=new MutationObserver(w);return i&&x.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",v),x.disconnect()}}},[o,i,m.paused]),g.useEffect(()=>{if(i){Su.add(m);const b=document.activeElement;if(!i.contains(b)){const w=new CustomEvent(Kl,yu);i.addEventListener(Kl,d),i.dispatchEvent(w),w.defaultPrevented||(Nw(Aw(xu(i)),{select:!0}),document.activeElement===b&&_r(i))}return()=>{i.removeEventListener(Kl,d),setTimeout(()=>{const w=new CustomEvent(Xl,yu);i.addEventListener(Xl,f),i.dispatchEvent(w),w.defaultPrevented||_r(b??document.body,{select:!0}),i.removeEventListener(Xl,f),Su.remove(m)},0)}}},[i,d,f,m]);const y=g.useCallback(b=>{if(!r&&!o||m.paused)return;const v=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,w=document.activeElement;if(v&&w){const x=b.currentTarget,[S,C]=Ew(x);S&&C?!b.shiftKey&&w===C?(b.preventDefault(),r&&_r(S,{select:!0})):b.shiftKey&&w===S&&(b.preventDefault(),r&&_r(C,{select:!0})):w===x&&b.preventDefault()}},[r,o,m.paused]);return s.jsx(Ne.div,{tabIndex:-1,...l,ref:h,onKeyDown:y})});vu.displayName=Cw;function Nw(e,{select:t=!1}={}){const r=document.activeElement;for(const o of e)if(_r(o,{select:t}),document.activeElement!==r)return}function Ew(e){const t=xu(e),r=wu(t,e),o=wu(t.reverse(),e);return[r,o]}function xu(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 wu(e,t){for(const r of e)if(!kw(r,{upTo:t}))return r}function kw(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 _w(e){return e instanceof HTMLInputElement&&"select"in e}function _r(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&_w(e)&&t&&e.select()}}var Su=Dw();function Dw(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Cu(e,t),e.unshift(t)},remove(t){var r;e=Cu(e,t),(r=e[0])==null||r.resume()}}}function Cu(e,t){const r=[...e],o=r.indexOf(t);return o!==-1&&r.splice(o,1),r}function Aw(e){return e.filter(t=>t.tagName!=="A")}var it=globalThis!=null&&globalThis.document?g.useLayoutEffect:()=>{},Tw=g[" useId ".trim().toString()]||(()=>{}),Mw=0;function Dr(e){const[t,r]=g.useState(Tw());return it(()=>{r(o=>o??String(Mw++))},[e]),e||(t?`radix-${t}`:"")}const Iw=["top","right","bottom","left"],Ar=Math.min,Dt=Math.max,pa=Math.round,fa=Math.floor,er=e=>({x:e,y:e}),Pw={left:"right",right:"left",bottom:"top",top:"bottom"},Ow={start:"end",end:"start"};function Jl(e,t,r){return Dt(e,Ar(t,r))}function pr(e,t){return typeof e=="function"?e(t):e}function fr(e){return e.split("-")[0]}function vo(e){return e.split("-")[1]}function Zl(e){return e==="x"?"y":"x"}function Rl(e){return e==="y"?"height":"width"}const Lw=new Set(["top","bottom"]);function tr(e){return Lw.has(fr(e))?"y":"x"}function ei(e){return Zl(tr(e))}function $w(e,t,r){r===void 0&&(r=!1);const o=vo(e),n=ei(e),a=Rl(n);let l=n==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(l=ha(l)),[l,ha(l)]}function Fw(e){const t=ha(e);return[ti(e),t,ti(t)]}function ti(e){return e.replace(/start|end/g,t=>Ow[t])}const Nu=["left","right"],Eu=["right","left"],Gw=["top","bottom"],Vw=["bottom","top"];function zw(e,t,r){switch(e){case"top":case"bottom":return r?t?Eu:Nu:t?Nu:Eu;case"left":case"right":return t?Gw:Vw;default:return[]}}function Bw(e,t,r,o){const n=vo(e);let a=zw(fr(e),r==="start",o);return n&&(a=a.map(l=>l+"-"+n),t&&(a=a.concat(a.map(ti)))),a}function ha(e){return e.replace(/left|right|bottom|top/g,t=>Pw[t])}function Uw(e){return{top:0,right:0,bottom:0,left:0,...e}}function ku(e){return typeof e!="number"?Uw(e):{top:e,right:e,bottom:e,left:e}}function ma(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 _u(e,t,r){let{reference:o,floating:n}=e;const a=tr(t),l=ei(t),i=Rl(l),c=fr(t),d=a==="y",f=o.x+o.width/2-n.width/2,u=o.y+o.height/2-n.height/2,h=o[i]/2-n[i]/2;let m;switch(c){case"top":m={x:f,y:o.y-n.height};break;case"bottom":m={x:f,y:o.y+o.height};break;case"right":m={x:o.x+o.width,y:u};break;case"left":m={x:o.x-n.width,y:u};break;default:m={x:o.x,y:o.y}}switch(vo(t)){case"start":m[l]-=h*(r&&d?-1:1);break;case"end":m[l]+=h*(r&&d?-1:1);break}return m}async function Ww(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:f="viewport",elementContext:u="floating",altBoundary:h=!1,padding:m=0}=pr(t,e),y=ku(m),v=i[h?u==="floating"?"reference":"floating":u],w=ma(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(v)))==null||r?v:v.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(i.floating)),boundary:d,rootBoundary:f,strategy:c})),x=u==="floating"?{x:o,y:n,width:l.floating.width,height:l.floating.height}:l.reference,S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(i.floating)),C=await(a.isElement==null?void 0:a.isElement(S))?await(a.getScale==null?void 0:a.getScale(S))||{x:1,y:1}:{x:1,y:1},k=ma(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:x,offsetParent:S,strategy:c}):x);return{top:(w.top-k.top+y.top)/C.y,bottom:(k.bottom-w.bottom+y.bottom)/C.y,left:(w.left-k.left+y.left)/C.x,right:(k.right-w.right+y.right)/C.x}}const Hw=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:f,y:u}=_u(d,o,c),h=o,m={},y=0;for(let v=0;v<i.length;v++){var b;const{name:w,fn:x}=i[v],{x:S,y:C,data:k,reset:E}=await x({x:f,y:u,initialPlacement:o,placement:h,strategy:n,middlewareData:m,rects:d,platform:{...l,detectOverflow:(b=l.detectOverflow)!=null?b:Ww},elements:{reference:e,floating:t}});f=S??f,u=C??u,m={...m,[w]:{...m[w],...k}},E&&y<=50&&(y++,typeof E=="object"&&(E.placement&&(h=E.placement),E.rects&&(d=E.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:n}):E.rects),{x:f,y:u}=_u(d,h,c)),v=-1)}return{x:f,y:u,placement:h,strategy:n,middlewareData:m}},jw=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:f=0}=pr(e,t)||{};if(d==null)return{};const u=ku(f),h={x:r,y:o},m=ei(n),y=Rl(m),b=await l.getDimensions(d),v=m==="y",w=v?"top":"left",x=v?"bottom":"right",S=v?"clientHeight":"clientWidth",C=a.reference[y]+a.reference[m]-h[m]-a.floating[y],k=h[m]-a.reference[m],E=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let M=E?E[S]:0;(!M||!await(l.isElement==null?void 0:l.isElement(E)))&&(M=i.floating[S]||a.floating[y]);const _=C/2-k/2,I=M/2-b[y]/2-1,A=Ar(u[w],I),W=Ar(u[x],I),$=A,G=M-b[y]-W,Q=M/2-b[y]/2+_,ee=Jl($,Q,G),H=!c.arrow&&vo(n)!=null&&Q!==ee&&a.reference[y]/2-(Q<$?A:W)-b[y]/2<0,K=H?Q<$?Q-$:Q-G:0;return{[m]:h[m]+K,data:{[m]:ee,centerOffset:Q-ee-K,...H&&{alignmentOffset:K}},reset:H}}}),Yw=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:f=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:b=!0,...v}=pr(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const w=fr(n),x=tr(i),S=fr(i)===i,C=await(c.isRTL==null?void 0:c.isRTL(d.floating)),k=h||(S||!b?[ha(i)]:Fw(i)),E=y!=="none";!h&&E&&k.push(...Bw(i,b,y,C));const M=[i,...k],_=await c.detectOverflow(t,v),I=[];let A=((o=a.flip)==null?void 0:o.overflows)||[];if(f&&I.push(_[w]),u){const Q=$w(n,l,C);I.push(_[Q[0]],_[Q[1]])}if(A=[...A,{placement:n,overflows:I}],!I.every(Q=>Q<=0)){var W,$;const Q=(((W=a.flip)==null?void 0:W.index)||0)+1,ee=M[Q];if(ee&&(!(u==="alignment"?x!==tr(ee):!1)||A.every(O=>tr(O.placement)===x?O.overflows[0]>0:!0)))return{data:{index:Q,overflows:A},reset:{placement:ee}};let H=($=A.filter(K=>K.overflows[0]<=0).sort((K,O)=>K.overflows[1]-O.overflows[1])[0])==null?void 0:$.placement;if(!H)switch(m){case"bestFit":{var G;const K=(G=A.filter(O=>{if(E){const B=tr(O.placement);return B===x||B==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(B=>B>0).reduce((B,fe)=>B+fe,0)]).sort((O,B)=>O[1]-B[1])[0])==null?void 0:G[0];K&&(H=K);break}case"initialPlacement":H=i;break}if(n!==H)return{reset:{placement:H}}}return{}}}};function Du(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Au(e){return Iw.some(t=>e[t]>=0)}const qw=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:o}=t,{strategy:n="referenceHidden",...a}=pr(e,t);switch(n){case"referenceHidden":{const l=await o.detectOverflow(t,{...a,elementContext:"reference"}),i=Du(l,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Au(i)}}}case"escaped":{const l=await o.detectOverflow(t,{...a,altBoundary:!0}),i=Du(l,r.floating);return{data:{escapedOffsets:i,escaped:Au(i)}}}default:return{}}}}},Tu=new Set(["left","top"]);async function Qw(e,t){const{placement:r,platform:o,elements:n}=e,a=await(o.isRTL==null?void 0:o.isRTL(n.floating)),l=fr(r),i=vo(r),c=tr(r)==="y",d=Tu.has(l)?-1:1,f=a&&c?-1:1,u=pr(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&typeof y=="number"&&(m=i==="end"?y*-1:y),c?{x:m*f,y:h*d}:{x:h*d,y:m*f}}const Kw=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 Qw(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}}}}},Xw=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:w=>{let{x,y:S}=w;return{x,y:S}}},...d}=pr(e,t),f={x:r,y:o},u=await a.detectOverflow(t,d),h=tr(fr(n)),m=Zl(h);let y=f[m],b=f[h];if(l){const w=m==="y"?"top":"left",x=m==="y"?"bottom":"right",S=y+u[w],C=y-u[x];y=Jl(S,y,C)}if(i){const w=h==="y"?"top":"left",x=h==="y"?"bottom":"right",S=b+u[w],C=b-u[x];b=Jl(S,b,C)}const v=c.fn({...t,[m]:y,[h]:b});return{...v,data:{x:v.x-r,y:v.y-o,enabled:{[m]:l,[h]:i}}}}}},Jw=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}=pr(e,t),f={x:r,y:o},u=tr(n),h=Zl(u);let m=f[h],y=f[u];const b=pr(i,t),v=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(c){const S=h==="y"?"height":"width",C=a.reference[h]-a.floating[S]+v.mainAxis,k=a.reference[h]+a.reference[S]-v.mainAxis;m<C?m=C:m>k&&(m=k)}if(d){var w,x;const S=h==="y"?"width":"height",C=Tu.has(fr(n)),k=a.reference[u]-a.floating[S]+(C&&((w=l.offset)==null?void 0:w[u])||0)+(C?0:v.crossAxis),E=a.reference[u]+a.reference[S]+(C?0:((x=l.offset)==null?void 0:x[u])||0)-(C?v.crossAxis:0);y<k?y=k:y>E&&(y=E)}return{[h]:m,[u]:y}}}},Zw=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}=pr(e,t),f=await l.detectOverflow(t,d),u=fr(n),h=vo(n),m=tr(n)==="y",{width:y,height:b}=a.floating;let v,w;u==="top"||u==="bottom"?(v=u,w=h===(await(l.isRTL==null?void 0:l.isRTL(i.floating))?"start":"end")?"left":"right"):(w=u,v=h==="end"?"top":"bottom");const x=b-f.top-f.bottom,S=y-f.left-f.right,C=Ar(b-f[v],x),k=Ar(y-f[w],S),E=!t.middlewareData.shift;let M=C,_=k;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(_=S),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(M=x),E&&!h){const A=Dt(f.left,0),W=Dt(f.right,0),$=Dt(f.top,0),G=Dt(f.bottom,0);m?_=y-2*(A!==0||W!==0?A+W:Dt(f.left,f.right)):M=b-2*($!==0||G!==0?$+G:Dt(f.top,f.bottom))}await c({...t,availableWidth:_,availableHeight:M});const I=await l.getDimensions(i.floating);return y!==I.width||b!==I.height?{reset:{rects:!0}}:{}}}};function ga(){return typeof window<"u"}function xo(e){return Mu(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=(Mu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Mu(e){return ga()?e instanceof Node||e instanceof At(e).Node:!1}function Wt(e){return ga()?e instanceof Element||e instanceof At(e).Element:!1}function or(e){return ga()?e instanceof HTMLElement||e instanceof At(e).HTMLElement:!1}function Iu(e){return!ga()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof At(e).ShadowRoot}const Rw=new Set(["inline","contents"]);function Zo(e){const{overflow:t,overflowX:r,overflowY:o,display:n}=Ht(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+r)&&!Rw.has(n)}const e0=new Set(["table","td","th"]);function t0(e){return e0.has(xo(e))}const r0=[":popover-open",":modal"];function ba(e){return r0.some(t=>{try{return e.matches(t)}catch{return!1}})}const o0=["transform","translate","scale","rotate","perspective"],n0=["transform","translate","scale","rotate","perspective","filter"],a0=["paint","layout","strict","content"];function ri(e){const t=oi(),r=Wt(e)?Ht(e):e;return o0.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)||n0.some(o=>(r.willChange||"").includes(o))||a0.some(o=>(r.contain||"").includes(o))}function s0(e){let t=Tr(e);for(;or(t)&&!wo(t);){if(ri(t))return t;if(ba(t))return null;t=Tr(t)}return null}function oi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const l0=new Set(["html","body","#document"]);function wo(e){return l0.has(xo(e))}function Ht(e){return At(e).getComputedStyle(e)}function ya(e){return Wt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Tr(e){if(xo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Iu(e)&&e.host||rr(e);return Iu(t)?t.host:t}function Pu(e){const t=Tr(e);return wo(t)?e.ownerDocument?e.ownerDocument.body:e.body:or(t)&&Zo(t)?t:Pu(t)}function Ro(e,t,r){var o;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=Pu(e),a=n===((o=e.ownerDocument)==null?void 0:o.body),l=At(n);if(a){const i=ni(l);return t.concat(l,l.visualViewport||[],Zo(n)?n:[],i&&r?Ro(i):[])}return t.concat(n,Ro(n,[],r))}function ni(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ou(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=pa(r)!==a||pa(o)!==l;return i&&(r=a,o=l),{width:r,height:o,$:i}}function ai(e){return Wt(e)?e:e.contextElement}function So(e){const t=ai(e);if(!or(t))return er(1);const r=t.getBoundingClientRect(),{width:o,height:n,$:a}=Ou(t);let l=(a?pa(r.width):r.width)/o,i=(a?pa(r.height):r.height)/n;return(!l||!Number.isFinite(l))&&(l=1),(!i||!Number.isFinite(i))&&(i=1),{x:l,y:i}}const i0=er(0);function Lu(e){const t=At(e);return!oi()||!t.visualViewport?i0:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function c0(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==At(e)?!1:t}function Xr(e,t,r,o){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),a=ai(e);let l=er(1);t&&(o?Wt(o)&&(l=So(o)):l=So(e));const i=c0(a,r,o)?Lu(a):er(0);let c=(n.left+i.x)/l.x,d=(n.top+i.y)/l.y,f=n.width/l.x,u=n.height/l.y;if(a){const h=At(a),m=o&&Wt(o)?At(o):o;let y=h,b=ni(y);for(;b&&o&&m!==y;){const v=So(b),w=b.getBoundingClientRect(),x=Ht(b),S=w.left+(b.clientLeft+parseFloat(x.paddingLeft))*v.x,C=w.top+(b.clientTop+parseFloat(x.paddingTop))*v.y;c*=v.x,d*=v.y,f*=v.x,u*=v.y,c+=S,d+=C,y=At(b),b=ni(y)}}return ma({width:f,height:u,x:c,y:d})}function va(e,t){const r=ya(e).scrollLeft;return t?t.left+r:Xr(rr(e)).left+r}function $u(e,t){const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-va(e,r),n=r.top+t.scrollTop;return{x:o,y:n}}function d0(e){let{elements:t,rect:r,offsetParent:o,strategy:n}=e;const a=n==="fixed",l=rr(o),i=t?ba(t.floating):!1;if(o===l||i&&a)return r;let c={scrollLeft:0,scrollTop:0},d=er(1);const f=er(0),u=or(o);if((u||!u&&!a)&&((xo(o)!=="body"||Zo(l))&&(c=ya(o)),or(o))){const m=Xr(o);d=So(o),f.x=m.x+o.clientLeft,f.y=m.y+o.clientTop}const h=l&&!u&&!a?$u(l,c):er(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+f.x+h.x,y:r.y*d.y-c.scrollTop*d.y+f.y+h.y}}function u0(e){return Array.from(e.getClientRects())}function p0(e){const t=rr(e),r=ya(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+va(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 Fu=25;function f0(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 f=oi();(!f||f&&t==="fixed")&&(i=n.offsetLeft,c=n.offsetTop)}const d=va(o);if(d<=0){const f=o.ownerDocument,u=f.body,h=getComputedStyle(u),m=f.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,y=Math.abs(o.clientWidth-u.clientWidth-m);y<=Fu&&(a-=y)}else d<=Fu&&(a+=d);return{width:a,height:l,x:i,y:c}}const h0=new Set(["absolute","fixed"]);function m0(e,t){const r=Xr(e,!0,t==="fixed"),o=r.top+e.clientTop,n=r.left+e.clientLeft,a=or(e)?So(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 Gu(e,t,r){let o;if(t==="viewport")o=f0(e,r);else if(t==="document")o=p0(rr(e));else if(Wt(t))o=m0(t,r);else{const n=Lu(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ma(o)}function Vu(e,t){const r=Tr(e);return r===t||!Wt(r)||wo(r)?!1:Ht(r).position==="fixed"||Vu(r,t)}function g0(e,t){const r=t.get(e);if(r)return r;let o=Ro(e,[],!1).filter(i=>Wt(i)&&xo(i)!=="body"),n=null;const a=Ht(e).position==="fixed";let l=a?Tr(e):e;for(;Wt(l)&&!wo(l);){const i=Ht(l),c=ri(l);!c&&i.position==="fixed"&&(n=null),(a?!c&&!n:!c&&i.position==="static"&&!!n&&h0.has(n.position)||Zo(l)&&!c&&Vu(e,l))?o=o.filter(f=>f!==l):n=i,l=Tr(l)}return t.set(e,o),o}function b0(e){let{element:t,boundary:r,rootBoundary:o,strategy:n}=e;const l=[...r==="clippingAncestors"?ba(t)?[]:g0(t,this._c):[].concat(r),o],i=l[0],c=l.reduce((d,f)=>{const u=Gu(t,f,n);return d.top=Dt(u.top,d.top),d.right=Ar(u.right,d.right),d.bottom=Ar(u.bottom,d.bottom),d.left=Dt(u.left,d.left),d},Gu(t,i,n));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function y0(e){const{width:t,height:r}=Ou(e);return{width:t,height:r}}function v0(e,t,r){const o=or(t),n=rr(t),a=r==="fixed",l=Xr(e,!0,a,t);let i={scrollLeft:0,scrollTop:0};const c=er(0);function d(){c.x=va(n)}if(o||!o&&!a)if((xo(t)!=="body"||Zo(n))&&(i=ya(t)),o){const m=Xr(t,!0,a,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else n&&d();a&&!o&&n&&d();const f=n&&!o&&!a?$u(n,i):er(0),u=l.left+i.scrollLeft-c.x-f.x,h=l.top+i.scrollTop-c.y-f.y;return{x:u,y:h,width:l.width,height:l.height}}function si(e){return Ht(e).position==="static"}function zu(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 Bu(e,t){const r=At(e);if(ba(e))return r;if(!or(e)){let n=Tr(e);for(;n&&!wo(n);){if(Wt(n)&&!si(n))return n;n=Tr(n)}return r}let o=zu(e,t);for(;o&&t0(o)&&si(o);)o=zu(o,t);return o&&wo(o)&&si(o)&&!ri(o)?r:o||s0(e)||r}const x0=async function(e){const t=this.getOffsetParent||Bu,r=this.getDimensions,o=await r(e.floating);return{reference:v0(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function w0(e){return Ht(e).direction==="rtl"}const S0={convertOffsetParentRelativeRectToViewportRelativeRect:d0,getDocumentElement:rr,getClippingRect:b0,getOffsetParent:Bu,getElementRects:x0,getClientRects:u0,getDimensions:y0,getScale:So,isElement:Wt,isRTL:w0};function Uu(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function C0(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:f,top:u,width:h,height:m}=d;if(i||t(),!h||!m)return;const y=fa(u),b=fa(n.clientWidth-(f+h)),v=fa(n.clientHeight-(u+m)),w=fa(f),S={rootMargin:-y+"px "+-b+"px "+-v+"px "+-w+"px",threshold:Dt(0,Ar(1,c))||1};let C=!0;function k(E){const M=E[0].intersectionRatio;if(M!==c){if(!C)return l();M?l(!1,M):o=setTimeout(()=>{l(!1,1e-7)},1e3)}M===1&&!Uu(d,e.getBoundingClientRect())&&l(),C=!1}try{r=new IntersectionObserver(k,{...S,root:n.ownerDocument})}catch{r=new IntersectionObserver(k,S)}r.observe(e)}return l(!0),a}function N0(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=ai(e),f=n||a?[...d?Ro(d):[],...Ro(t)]:[];f.forEach(w=>{n&&w.addEventListener("scroll",r,{passive:!0}),a&&w.addEventListener("resize",r)});const u=d&&i?C0(d,r):null;let h=-1,m=null;l&&(m=new ResizeObserver(w=>{let[x]=w;x&&x.target===d&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var S;(S=m)==null||S.observe(t)})),r()}),d&&!c&&m.observe(d),m.observe(t));let y,b=c?Xr(e):null;c&&v();function v(){const w=Xr(e);b&&!Uu(b,w)&&r(),b=w,y=requestAnimationFrame(v)}return r(),()=>{var w;f.forEach(x=>{n&&x.removeEventListener("scroll",r),a&&x.removeEventListener("resize",r)}),u==null||u(),(w=m)==null||w.disconnect(),m=null,c&&cancelAnimationFrame(y)}}const E0=Kw,k0=Xw,_0=Yw,D0=Zw,A0=qw,Wu=jw,T0=Jw,M0=(e,t,r)=>{const o=new Map,n={platform:S0,...r},a={...n.platform,_c:o};return Hw(e,t,{...n,platform:a})};var I0=typeof document<"u",P0=function(){},xa=I0?N.useLayoutEffect:P0;function wa(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(!wa(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)&&!wa(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function Hu(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ju(e,t){const r=Hu(e);return Math.round(t*r)/r}function li(e){const t=g.useRef(e);return xa(()=>{t.current=e}),t}function O0(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,[f,u]=g.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=g.useState(o);wa(h,o)||m(o);const[y,b]=g.useState(null),[v,w]=g.useState(null),x=g.useCallback(O=>{O!==E.current&&(E.current=O,b(O))},[]),S=g.useCallback(O=>{O!==M.current&&(M.current=O,w(O))},[]),C=a||y,k=l||v,E=g.useRef(null),M=g.useRef(null),_=g.useRef(f),I=c!=null,A=li(c),W=li(n),$=li(d),G=g.useCallback(()=>{if(!E.current||!M.current)return;const O={placement:t,strategy:r,middleware:h};W.current&&(O.platform=W.current),M0(E.current,M.current,O).then(B=>{const fe={...B,isPositioned:$.current!==!1};Q.current&&!wa(_.current,fe)&&(_.current=fe,Kn.flushSync(()=>{u(fe)}))})},[h,t,r,W,$]);xa(()=>{d===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,u(O=>({...O,isPositioned:!1})))},[d]);const Q=g.useRef(!1);xa(()=>(Q.current=!0,()=>{Q.current=!1}),[]),xa(()=>{if(C&&(E.current=C),k&&(M.current=k),C&&k){if(A.current)return A.current(C,k,G);G()}},[C,k,G,A,I]);const ee=g.useMemo(()=>({reference:E,floating:M,setReference:x,setFloating:S}),[x,S]),H=g.useMemo(()=>({reference:C,floating:k}),[C,k]),K=g.useMemo(()=>{const O={position:r,left:0,top:0};if(!H.floating)return O;const B=ju(H.floating,f.x),fe=ju(H.floating,f.y);return i?{...O,transform:"translate("+B+"px, "+fe+"px)",...Hu(H.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:B,top:fe}},[r,i,H.floating,f.x,f.y]);return g.useMemo(()=>({...f,update:G,refs:ee,elements:H,floatingStyles:K}),[f,G,ee,H,K])}const L0=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?Wu({element:o.current,padding:n}).fn(r):{}:o?Wu({element:o,padding:n}).fn(r):{}}}},$0=(e,t)=>({...E0(e),options:[e,t]}),F0=(e,t)=>({...k0(e),options:[e,t]}),G0=(e,t)=>({...T0(e),options:[e,t]}),V0=(e,t)=>({..._0(e),options:[e,t]}),z0=(e,t)=>({...D0(e),options:[e,t]}),B0=(e,t)=>({...A0(e),options:[e,t]}),U0=(e,t)=>({...L0(e),options:[e,t]});var W0="Arrow",Yu=g.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"})})});Yu.displayName=W0;var H0=Yu;function qu(e){const[t,r]=g.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 ii="Popper",[Qu,Sa]=ur(ii),[j0,Ku]=Qu(ii),Xu=e=>{const{__scopePopper:t,children:r}=e,[o,n]=g.useState(null);return s.jsx(j0,{scope:t,anchor:o,onAnchorChange:n,children:r})};Xu.displayName=ii;var Ju="PopperAnchor",Zu=g.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:o,...n}=e,a=Ku(Ju,r),l=g.useRef(null),i=Fe(t,l),c=g.useRef(null);return g.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})});Zu.displayName=Ju;var ci="PopperContent",[Y0,q0]=Qu(ci),Ru=g.forwardRef((e,t)=>{var J,le,ve,ie,j,Y;const{__scopePopper:r,side:o="bottom",sideOffset:n=0,align:a="center",alignOffset:l=0,arrowPadding:i=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:f=0,sticky:u="partial",hideWhenDetached:h=!1,updatePositionStrategy:m="optimized",onPlaced:y,...b}=e,v=Ku(ci,r),[w,x]=g.useState(null),S=Fe(t,de=>x(de)),[C,k]=g.useState(null),E=qu(C),M=(E==null?void 0:E.width)??0,_=(E==null?void 0:E.height)??0,I=o+(a!=="center"?"-"+a:""),A=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},W=Array.isArray(d)?d:[d],$=W.length>0,G={padding:A,boundary:W.filter(K0),altBoundary:$},{refs:Q,floatingStyles:ee,placement:H,isPositioned:K,middlewareData:O}=O0({strategy:"fixed",placement:I,whileElementsMounted:(...de)=>N0(...de,{animationFrame:m==="always"}),elements:{reference:v.anchor},middleware:[$0({mainAxis:n+_,alignmentAxis:l}),c&&F0({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?G0():void 0,...G}),c&&V0({...G}),z0({...G,apply:({elements:de,rects:Ee,availableWidth:Se,availableHeight:ze})=>{const{width:Ye,height:We}=Ee.reference,Re=de.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`)}}),C&&U0({element:C,padding:i}),X0({arrowWidth:M,arrowHeight:_}),h&&B0({strategy:"referenceHidden",...G})]}),[B,fe]=rp(H),be=kr(y);it(()=>{K&&(be==null||be())},[K,be]);const F=(J=O.arrow)==null?void 0:J.x,q=(le=O.arrow)==null?void 0:le.y,re=((ve=O.arrow)==null?void 0:ve.centerOffset)!==0,[he,X]=g.useState();return it(()=>{w&&X(window.getComputedStyle(w).zIndex)},[w]),s.jsx("div",{ref:Q.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:K?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[(ie=O.transformOrigin)==null?void 0:ie.x,(j=O.transformOrigin)==null?void 0:j.y].join(" "),...((Y=O.hide)==null?void 0:Y.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:s.jsx(Y0,{scope:r,placedSide:B,onArrowChange:k,arrowX:F,arrowY:q,shouldHideArrow:re,children:s.jsx(Ne.div,{"data-side":B,"data-align":fe,...b,ref:S,style:{...b.style,animation:K?void 0:"none"}})})})});Ru.displayName=ci;var ep="PopperArrow",Q0={top:"bottom",right:"left",bottom:"top",left:"right"},tp=g.forwardRef(function(t,r){const{__scopePopper:o,...n}=t,a=q0(ep,o),l=Q0[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(H0,{...n,ref:r,style:{...n.style,display:"block"}})})});tp.displayName=ep;function K0(e){return e!==null}var X0=e=>({name:"transformOrigin",options:e,fn(t){var v,w,x;const{placement:r,rects:o,middlewareData:n}=t,l=((v=n.arrow)==null?void 0:v.centerOffset)!==0,i=l?0:e.arrowWidth,c=l?0:e.arrowHeight,[d,f]=rp(r),u={start:"0%",center:"50%",end:"100%"}[f],h=(((w=n.arrow)==null?void 0:w.x)??0)+i/2,m=(((x=n.arrow)==null?void 0:x.y)??0)+c/2;let y="",b="";return d==="bottom"?(y=l?u:`${h}px`,b=`${-c}px`):d==="top"?(y=l?u:`${h}px`,b=`${o.floating.height+c}px`):d==="right"?(y=`${-c}px`,b=l?u:`${m}px`):d==="left"&&(y=`${o.floating.width+c}px`,b=l?u:`${m}px`),{data:{x:y,y:b}}}});function rp(e){const[t,r="center"]=e.split("-");return[t,r]}var op=Xu,np=Zu,ap=Ru,sp=tp,J0="Portal",di=g.forwardRef((e,t)=>{var i;const{container:r,...o}=e,[n,a]=g.useState(!1);it(()=>a(!0),[]);const l=r||n&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return l?xd.createPortal(s.jsx(Ne.div,{...o,ref:t}),l):null});di.displayName=J0;function Z0(e){const t=R0(e),r=g.forwardRef((o,n)=>{const{children:a,...l}=o,i=g.Children.toArray(a),c=i.find(tS);if(c){const d=c.props.children,f=i.map(u=>u===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...l,ref:n,children:g.isValidElement(d)?g.cloneElement(d,void 0,f):null})}return s.jsx(t,{...l,ref:n,children:a})});return r.displayName=`${e}.Slot`,r}function R0(e){const t=g.forwardRef((r,o)=>{const{children:n,...a}=r;if(g.isValidElement(n)){const l=oS(n),i=rS(a,n.props);return n.type!==g.Fragment&&(i.ref=o?Jo(o,l):l),g.cloneElement(n,i)}return g.Children.count(n)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var eS=Symbol("radix.slottable");function tS(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===eS}function rS(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 oS(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 nS=g[" useInsertionEffect ".trim().toString()]||it;function hr({prop:e,defaultProp:t,onChange:r=()=>{},caller:o}){const[n,a,l]=aS({defaultProp:t,onChange:r}),i=e!==void 0,c=i?e:n;{const f=g.useRef(e!==void 0);g.useEffect(()=>{const u=f.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.`),f.current=i},[i,o])}const d=g.useCallback(f=>{var u;if(i){const h=sS(f)?f(e):f;h!==e&&((u=l.current)==null||u.call(l,h))}else a(f)},[i,e,a,l]);return[c,d]}function aS({defaultProp:e,onChange:t}){const[r,o]=g.useState(e),n=g.useRef(r),a=g.useRef(t);return nS(()=>{a.current=t},[t]),g.useEffect(()=>{var l;n.current!==r&&((l=a.current)==null||l.call(a,r),n.current=r)},[r,n]),[r,o,a]}function sS(e){return typeof e=="function"}function lp(e){const t=g.useRef({value:e,previous:e});return g.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var ip=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"}),lS="VisuallyHidden",cp=g.forwardRef((e,t)=>s.jsx(Ne.span,{...e,ref:t,style:{...ip,...e.style}}));cp.displayName=lS;var iS=cp,cS=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Co=new WeakMap,Ca=new WeakMap,Na={},ui=0,dp=function(e){return e&&(e.host||dp(e.parentNode))},dS=function(e,t){return t.map(function(r){if(e.contains(r))return r;var o=dp(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})},uS=function(e,t,r,o){var n=dS(t,Array.isArray(e)?e:[e]);Na[r]||(Na[r]=new WeakMap);var a=Na[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 f=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(h){if(i.has(h))f(h);else try{var m=h.getAttribute(o),y=m!==null&&m!=="false",b=(Co.get(h)||0)+1,v=(a.get(h)||0)+1;Co.set(h,b),a.set(h,v),l.push(h),b===1&&y&&Ca.set(h,!0),v===1&&h.setAttribute(r,"true"),y||h.setAttribute(o,"true")}catch(w){console.error("aria-hidden: cannot operate on ",h,w)}})};return f(t),i.clear(),ui++,function(){l.forEach(function(u){var h=Co.get(u)-1,m=a.get(u)-1;Co.set(u,h),a.set(u,m),h||(Ca.has(u)||u.removeAttribute(o),Ca.delete(u)),m||u.removeAttribute(r)}),ui--,ui||(Co=new WeakMap,Co=new WeakMap,Ca=new WeakMap,Na={})}},pS=function(e,t,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),n=cS(e);return n?(o.push.apply(o,Array.from(n.querySelectorAll("[aria-live], script"))),uS(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 up(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 fS(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 Ea="right-scroll-bar-position",ka="width-before-scroll-bar",hS="with-scroll-bars-hidden",mS="--removed-body-scroll-bar-size";function pi(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function gS(e,t){var r=N.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 bS=typeof window<"u"?g.useLayoutEffect:g.useEffect,pp=new WeakMap;function yS(e,t){var r=gS(null,function(o){return e.forEach(function(n){return pi(n,o)})});return bS(function(){var o=pp.get(r);if(o){var n=new Set(o),a=new Set(e),l=r.current;n.forEach(function(i){a.has(i)||pi(i,null)}),a.forEach(function(i){n.has(i)||pi(i,l)})}pp.set(r,e)},[e]),r}function vS(e){return e}function xS(e,t){t===void 0&&(t=vS);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 f=l;l=[],f.forEach(a)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(f){l.push(f),d()},filter:function(f){return l=l.filter(f),r}}}};return n}function wS(e){e===void 0&&(e={});var t=xS(null);return t.options=nr({async:!0,ssr:!1},e),t}var fp=function(e){var t=e.sideCar,r=up(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 g.createElement(o,nr({},r))};fp.isSideCarExport=!0;function SS(e,t){return e.useMedium(t),fp}var hp=wS(),fi=function(){},_a=g.forwardRef(function(e,t){var r=g.useRef(null),o=g.useState({onScrollCapture:fi,onWheelCapture:fi,onTouchMoveCapture:fi}),n=o[0],a=o[1],l=e.forwardProps,i=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,u=e.shards,h=e.sideCar,m=e.noRelative,y=e.noIsolation,b=e.inert,v=e.allowPinchZoom,w=e.as,x=w===void 0?"div":w,S=e.gapMode,C=up(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=h,E=yS([r,t]),M=nr(nr({},C),n);return g.createElement(g.Fragment,null,f&&g.createElement(k,{sideCar:hp,removeScrollBar:d,shards:u,noRelative:m,noIsolation:y,inert:b,setCallbacks:a,allowPinchZoom:!!v,lockRef:r,gapMode:S}),l?g.cloneElement(g.Children.only(i),nr(nr({},M),{ref:E})):g.createElement(x,nr({},M,{className:c,ref:E}),i))});_a.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},_a.classNames={fullWidth:ka,zeroRight:Ea};var CS=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function NS(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=CS();return t&&e.setAttribute("nonce",t),e}function ES(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function kS(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var _S=function(){var e=0,t=null;return{add:function(r){e==0&&(t=NS())&&(ES(t,r),kS(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},DS=function(){var e=_S();return function(t,r){g.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},mp=function(){var e=DS(),t=function(r){var o=r.styles,n=r.dynamic;return e(o,n),null};return t},AS={left:0,top:0,right:0,gap:0},hi=function(e){return parseInt(e||"",10)||0},TS=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[hi(r),hi(o),hi(n)]},MS=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return AS;var t=TS(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])}},IS=mp(),No="data-scroll-locked",PS=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(hS,` {
3
+ overflow: hidden `).concat(o,`;
4
+ padding-right: `).concat(i,"px ").concat(o,`;
5
+ }
6
+ body[`).concat(No,`] {
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(Ea,` {
20
+ right: `).concat(i,"px ").concat(o,`;
21
+ }
22
+
23
+ .`).concat(ka,` {
24
+ margin-right: `).concat(i,"px ").concat(o,`;
25
+ }
26
+
27
+ .`).concat(Ea," .").concat(Ea,` {
28
+ right: 0 `).concat(o,`;
29
+ }
30
+
31
+ .`).concat(ka," .").concat(ka,` {
32
+ margin-right: 0 `).concat(o,`;
33
+ }
34
+
35
+ body[`).concat(No,`] {
36
+ `).concat(mS,": ").concat(i,`px;
37
+ }
38
+ `)},gp=function(){var e=parseInt(document.body.getAttribute(No)||"0",10);return isFinite(e)?e:0},OS=function(){g.useEffect(function(){return document.body.setAttribute(No,(gp()+1).toString()),function(){var e=gp()-1;e<=0?document.body.removeAttribute(No):document.body.setAttribute(No,e.toString())}},[])},LS=function(e){var t=e.noRelative,r=e.noImportant,o=e.gapMode,n=o===void 0?"margin":o;OS();var a=g.useMemo(function(){return MS(n)},[n]);return g.createElement(IS,{styles:PS(a,!t,n,r?"":"!important")})},mi=!1;if(typeof window<"u")try{var Da=Object.defineProperty({},"passive",{get:function(){return mi=!0,!0}});window.addEventListener("test",Da,Da),window.removeEventListener("test",Da,Da)}catch{mi=!1}var Eo=mi?{passive:!1}:!1,$S=function(e){return e.tagName==="TEXTAREA"},bp=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!$S(e)&&r[t]==="visible")},FS=function(e){return bp(e,"overflowY")},GS=function(e){return bp(e,"overflowX")},yp=function(e,t){var r=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var n=vp(e,o);if(n){var a=xp(e,o),l=a[1],i=a[2];if(l>i)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},VS=function(e){var t=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[t,r,o]},zS=function(e){var t=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[t,r,o]},vp=function(e,t){return e==="v"?FS(t):GS(t)},xp=function(e,t){return e==="v"?VS(t):zS(t)},BS=function(e,t){return e==="h"&&t==="rtl"?-1:1},US=function(e,t,r,o,n){var a=BS(e,window.getComputedStyle(t).direction),l=a*o,i=r.target,c=t.contains(i),d=!1,f=l>0,u=0,h=0;do{if(!i)break;var m=xp(e,i),y=m[0],b=m[1],v=m[2],w=b-v-a*y;(y||w)&&vp(e,i)&&(u+=w,h+=y);var x=i.parentNode;i=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&i!==document.body||c&&(t.contains(i)||t===i));return(f&&Math.abs(u)<1||!f&&Math.abs(h)<1)&&(d=!0),d},Aa=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},wp=function(e){return[e.deltaX,e.deltaY]},Sp=function(e){return e&&"current"in e?e.current:e},WS=function(e,t){return e[0]===t[0]&&e[1]===t[1]},HS=function(e){return`
39
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
40
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
41
+ `)},jS=0,ko=[];function YS(e){var t=g.useRef([]),r=g.useRef([0,0]),o=g.useRef(),n=g.useState(jS++)[0],a=g.useState(mp)[0],l=g.useRef(e);g.useEffect(function(){l.current=e},[e]),g.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var b=fS([e.lockRef.current],(e.shards||[]).map(Sp),!0).filter(Boolean);return b.forEach(function(v){return v.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),b.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var i=g.useCallback(function(b,v){if("touches"in b&&b.touches.length===2||b.type==="wheel"&&b.ctrlKey)return!l.current.allowPinchZoom;var w=Aa(b),x=r.current,S="deltaX"in b?b.deltaX:x[0]-w[0],C="deltaY"in b?b.deltaY:x[1]-w[1],k,E=b.target,M=Math.abs(S)>Math.abs(C)?"h":"v";if("touches"in b&&M==="h"&&E.type==="range")return!1;var _=window.getSelection(),I=_&&_.anchorNode,A=I?I===E||I.contains(E):!1;if(A)return!1;var W=yp(M,E);if(!W)return!0;if(W?k=M:(k=M==="v"?"h":"v",W=yp(M,E)),!W)return!1;if(!o.current&&"changedTouches"in b&&(S||C)&&(o.current=k),!k)return!0;var $=o.current||k;return US($,v,b,$==="h"?S:C)},[]),c=g.useCallback(function(b){var v=b;if(!(!ko.length||ko[ko.length-1]!==a)){var w="deltaY"in v?wp(v):Aa(v),x=t.current.filter(function(k){return k.name===v.type&&(k.target===v.target||v.target===k.shadowParent)&&WS(k.delta,w)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var S=(l.current.shards||[]).map(Sp).filter(Boolean).filter(function(k){return k.contains(v.target)}),C=S.length>0?i(v,S[0]):!l.current.noIsolation;C&&v.cancelable&&v.preventDefault()}}},[]),d=g.useCallback(function(b,v,w,x){var S={name:b,delta:v,target:w,should:x,shadowParent:qS(w)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(C){return C!==S})},1)},[]),f=g.useCallback(function(b){r.current=Aa(b),o.current=void 0},[]),u=g.useCallback(function(b){d(b.type,wp(b),b.target,i(b,e.lockRef.current))},[]),h=g.useCallback(function(b){d(b.type,Aa(b),b.target,i(b,e.lockRef.current))},[]);g.useEffect(function(){return ko.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Eo),document.addEventListener("touchmove",c,Eo),document.addEventListener("touchstart",f,Eo),function(){ko=ko.filter(function(b){return b!==a}),document.removeEventListener("wheel",c,Eo),document.removeEventListener("touchmove",c,Eo),document.removeEventListener("touchstart",f,Eo)}},[]);var m=e.removeScrollBar,y=e.inert;return g.createElement(g.Fragment,null,y?g.createElement(a,{styles:HS(n)}):null,m?g.createElement(LS,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function qS(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const QS=SS(hp,YS);var Cp=g.forwardRef(function(e,t){return g.createElement(_a,nr({},e,{ref:t,sideCar:QS}))});Cp.classNames=_a.classNames;var KS=[" ","Enter","ArrowUp","ArrowDown"],XS=[" ","Enter"],Jr="Select",[Ta,Ma,JS]=jl(Jr),[_o]=ur(Jr,[JS,Sa]),Ia=Sa(),[ZS,Mr]=_o(Jr),[RS,eC]=_o(Jr),Np=e=>{const{__scopeSelect:t,children:r,open:o,defaultOpen:n,onOpenChange:a,value:l,defaultValue:i,onValueChange:c,dir:d,name:f,autoComplete:u,disabled:h,required:m,form:y}=e,b=Ia(t),[v,w]=g.useState(null),[x,S]=g.useState(null),[C,k]=g.useState(!1),E=ua(d),[M,_]=hr({prop:o,defaultProp:n??!1,onChange:a,caller:Jr}),[I,A]=hr({prop:l,defaultProp:i,onChange:c,caller:Jr}),W=g.useRef(null),$=v?y||!!v.closest("form"):!0,[G,Q]=g.useState(new Set),ee=Array.from(G).map(H=>H.props.value).join(";");return s.jsx(op,{...b,children:s.jsxs(ZS,{required:m,scope:t,trigger:v,onTriggerChange:w,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:k,contentId:Dr(),value:I,onValueChange:A,open:M,onOpenChange:_,dir:E,triggerPointerDownPosRef:W,disabled:h,children:[s.jsx(Ta.Provider,{scope:t,children:s.jsx(RS,{scope:e.__scopeSelect,onNativeOptionAdd:g.useCallback(H=>{Q(K=>new Set(K).add(H))},[]),onNativeOptionRemove:g.useCallback(H=>{Q(K=>{const O=new Set(K);return O.delete(H),O})},[]),children:r})}),$?s.jsxs(Qp,{"aria-hidden":!0,required:m,tabIndex:-1,name:f,autoComplete:u,value:I,onChange:H=>A(H.target.value),disabled:h,form:y,children:[I===void 0?s.jsx("option",{value:""}):null,Array.from(G)]},ee):null]})})};Np.displayName=Jr;var Ep="SelectTrigger",kp=g.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:o=!1,...n}=e,a=Ia(r),l=Mr(Ep,r),i=l.disabled||o,c=Fe(t,l.onTriggerChange),d=Ma(r),f=g.useRef("touch"),[u,h,m]=Xp(b=>{const v=d().filter(S=>!S.disabled),w=v.find(S=>S.value===l.value),x=Jp(v,b,w);x!==void 0&&l.onValueChange(x.value)}),y=b=>{i||(l.onOpenChange(!0),m()),b&&(l.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})};return s.jsx(np,{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":Kp(l.value)?"":void 0,...n,ref:c,onClick:we(n.onClick,b=>{b.currentTarget.focus(),f.current!=="mouse"&&y(b)}),onPointerDown:we(n.onPointerDown,b=>{f.current=b.pointerType;const v=b.target;v.hasPointerCapture(b.pointerId)&&v.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(y(b),b.preventDefault())}),onKeyDown:we(n.onKeyDown,b=>{const v=u.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&h(b.key),!(v&&b.key===" ")&&KS.includes(b.key)&&(y(),b.preventDefault())})})})});kp.displayName=Ep;var _p="SelectValue",Dp=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:o,style:n,children:a,placeholder:l="",...i}=e,c=Mr(_p,r),{onValueNodeHasChildrenChange:d}=c,f=a!==void 0,u=Fe(t,c.onValueNodeChange);return it(()=>{d(f)},[d,f]),s.jsx(Ne.span,{...i,ref:u,style:{pointerEvents:"none"},children:Kp(c.value)?s.jsx(s.Fragment,{children:l}):a})});Dp.displayName=_p;var tC="SelectIcon",Ap=g.forwardRef((e,t)=>{const{__scopeSelect:r,children:o,...n}=e;return s.jsx(Ne.span,{"aria-hidden":!0,...n,ref:t,children:o||"▼"})});Ap.displayName=tC;var rC="SelectPortal",Tp=e=>s.jsx(di,{asChild:!0,...e});Tp.displayName=rC;var Zr="SelectContent",Mp=g.forwardRef((e,t)=>{const r=Mr(Zr,e.__scopeSelect),[o,n]=g.useState();if(it(()=>{n(new DocumentFragment)},[]),!r.open){const a=o;return a?Kn.createPortal(s.jsx(Ip,{scope:e.__scopeSelect,children:s.jsx(Ta.Slot,{scope:e.__scopeSelect,children:s.jsx("div",{children:e.children})})}),a):null}return s.jsx(Pp,{...e,ref:t})});Mp.displayName=Zr;var jt=10,[Ip,Ir]=_o(Zr),oC="SelectContentImpl",nC=Z0("SelectContent.RemoveScroll"),Pp=g.forwardRef((e,t)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:a,onPointerDownOutside:l,side:i,sideOffset:c,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:h,collisionPadding:m,sticky:y,hideWhenDetached:b,avoidCollisions:v,...w}=e,x=Mr(Zr,r),[S,C]=g.useState(null),[k,E]=g.useState(null),M=Fe(t,J=>C(J)),[_,I]=g.useState(null),[A,W]=g.useState(null),$=Ma(r),[G,Q]=g.useState(!1),ee=g.useRef(!1);g.useEffect(()=>{if(S)return pS(S)},[S]),Sw();const H=g.useCallback(J=>{const[le,...ve]=$().map(Y=>Y.ref.current),[ie]=ve.slice(-1),j=document.activeElement;for(const Y of J)if(Y===j||(Y==null||Y.scrollIntoView({block:"nearest"}),Y===le&&k&&(k.scrollTop=0),Y===ie&&k&&(k.scrollTop=k.scrollHeight),Y==null||Y.focus(),document.activeElement!==j))return},[$,k]),K=g.useCallback(()=>H([_,S]),[H,_,S]);g.useEffect(()=>{G&&K()},[G,K]);const{onOpenChange:O,triggerPointerDownPosRef:B}=x;g.useEffect(()=>{if(S){let J={x:0,y:0};const le=ie=>{var j,Y;J={x:Math.abs(Math.round(ie.pageX)-(((j=B.current)==null?void 0:j.x)??0)),y:Math.abs(Math.round(ie.pageY)-(((Y=B.current)==null?void 0:Y.y)??0))}},ve=ie=>{J.x<=10&&J.y<=10?ie.preventDefault():S.contains(ie.target)||O(!1),document.removeEventListener("pointermove",le),B.current=null};return B.current!==null&&(document.addEventListener("pointermove",le),document.addEventListener("pointerup",ve,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",le),document.removeEventListener("pointerup",ve,{capture:!0})}}},[S,O,B]),g.useEffect(()=>{const J=()=>O(!1);return window.addEventListener("blur",J),window.addEventListener("resize",J),()=>{window.removeEventListener("blur",J),window.removeEventListener("resize",J)}},[O]);const[fe,be]=Xp(J=>{const le=$().filter(j=>!j.disabled),ve=le.find(j=>j.ref.current===document.activeElement),ie=Jp(le,J,ve);ie&&setTimeout(()=>ie.ref.current.focus())}),F=g.useCallback((J,le,ve)=>{const ie=!ee.current&&!ve;(x.value!==void 0&&x.value===le||ie)&&(I(J),ie&&(ee.current=!0))},[x.value]),q=g.useCallback(()=>S==null?void 0:S.focus(),[S]),re=g.useCallback((J,le,ve)=>{const ie=!ee.current&&!ve;(x.value!==void 0&&x.value===le||ie)&&W(J)},[x.value]),he=o==="popper"?gi:Op,X=he===gi?{side:i,sideOffset:c,align:d,alignOffset:f,arrowPadding:u,collisionBoundary:h,collisionPadding:m,sticky:y,hideWhenDetached:b,avoidCollisions:v}:{};return s.jsx(Ip,{scope:r,content:S,viewport:k,onViewportChange:E,itemRefCallback:F,selectedItem:_,onItemLeave:q,itemTextRefCallback:re,focusSelectedItem:K,selectedItemText:A,position:o,isPositioned:G,searchRef:fe,children:s.jsx(Cp,{as:nC,allowPinchZoom:!0,children:s.jsx(vu,{asChild:!0,trapped:x.open,onMountAutoFocus:J=>{J.preventDefault()},onUnmountAutoFocus:we(n,J=>{var le;(le=x.trigger)==null||le.focus({preventScroll:!0}),J.preventDefault()}),children:s.jsx(ql,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:J=>J.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:s.jsx(he,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:J=>J.preventDefault(),...w,...X,onPlaced:()=>Q(!0),ref:M,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:we(w.onKeyDown,J=>{const le=J.ctrlKey||J.altKey||J.metaKey;if(J.key==="Tab"&&J.preventDefault(),!le&&J.key.length===1&&be(J.key),["ArrowUp","ArrowDown","Home","End"].includes(J.key)){let ie=$().filter(j=>!j.disabled).map(j=>j.ref.current);if(["ArrowUp","End"].includes(J.key)&&(ie=ie.slice().reverse()),["ArrowUp","ArrowDown"].includes(J.key)){const j=J.target,Y=ie.indexOf(j);ie=ie.slice(Y+1)}setTimeout(()=>H(ie)),J.preventDefault()}})})})})})})});Pp.displayName=oC;var aC="SelectItemAlignedPosition",Op=g.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:o,...n}=e,a=Mr(Zr,r),l=Ir(Zr,r),[i,c]=g.useState(null),[d,f]=g.useState(null),u=Fe(t,M=>f(M)),h=Ma(r),m=g.useRef(!1),y=g.useRef(!0),{viewport:b,selectedItem:v,selectedItemText:w,focusSelectedItem:x}=l,S=g.useCallback(()=>{if(a.trigger&&a.valueNode&&i&&d&&b&&v&&w){const M=a.trigger.getBoundingClientRect(),_=d.getBoundingClientRect(),I=a.valueNode.getBoundingClientRect(),A=w.getBoundingClientRect();if(a.dir!=="rtl"){const j=A.left-_.left,Y=I.left-j,de=M.left-Y,Ee=M.width+de,Se=Math.max(Ee,_.width),ze=window.innerWidth-jt,Ye=du(Y,[jt,Math.max(jt,ze-Se)]);i.style.minWidth=Ee+"px",i.style.left=Ye+"px"}else{const j=_.right-A.right,Y=window.innerWidth-I.right-j,de=window.innerWidth-M.right-Y,Ee=M.width+de,Se=Math.max(Ee,_.width),ze=window.innerWidth-jt,Ye=du(Y,[jt,Math.max(jt,ze-Se)]);i.style.minWidth=Ee+"px",i.style.right=Ye+"px"}const W=h(),$=window.innerHeight-jt*2,G=b.scrollHeight,Q=window.getComputedStyle(d),ee=parseInt(Q.borderTopWidth,10),H=parseInt(Q.paddingTop,10),K=parseInt(Q.borderBottomWidth,10),O=parseInt(Q.paddingBottom,10),B=ee+H+G+O+K,fe=Math.min(v.offsetHeight*5,B),be=window.getComputedStyle(b),F=parseInt(be.paddingTop,10),q=parseInt(be.paddingBottom,10),re=M.top+M.height/2-jt,he=$-re,X=v.offsetHeight/2,J=v.offsetTop+X,le=ee+H+J,ve=B-le;if(le<=re){const j=W.length>0&&v===W[W.length-1].ref.current;i.style.bottom="0px";const Y=d.clientHeight-b.offsetTop-b.offsetHeight,de=Math.max(he,X+(j?q:0)+Y+K),Ee=le+de;i.style.height=Ee+"px"}else{const j=W.length>0&&v===W[0].ref.current;i.style.top="0px";const de=Math.max(re,ee+b.offsetTop+(j?F:0)+X)+ve;i.style.height=de+"px",b.scrollTop=le-re+b.offsetTop}i.style.margin=`${jt}px 0`,i.style.minHeight=fe+"px",i.style.maxHeight=$+"px",o==null||o(),requestAnimationFrame(()=>m.current=!0)}},[h,a.trigger,a.valueNode,i,d,b,v,w,a.dir,o]);it(()=>S(),[S]);const[C,k]=g.useState();it(()=>{d&&k(window.getComputedStyle(d).zIndex)},[d]);const E=g.useCallback(M=>{M&&y.current===!0&&(S(),x==null||x(),y.current=!1)},[S,x]);return s.jsx(lC,{scope:r,contentWrapper:i,shouldExpandOnScrollRef:m,onScrollButtonChange:E,children:s.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:s.jsx(Ne.div,{...n,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});Op.displayName=aC;var sC="SelectPopperPosition",gi=g.forwardRef((e,t)=>{const{__scopeSelect:r,align:o="start",collisionPadding:n=jt,...a}=e,l=Ia(r);return s.jsx(ap,{...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)"}})});gi.displayName=sC;var[lC,bi]=_o(Zr,{}),yi="SelectViewport",Lp=g.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:o,...n}=e,a=Ir(yi,r),l=bi(yi,r),i=Fe(t,a.onViewportChange),c=g.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(Ta.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:we(n.onScroll,d=>{const f=d.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:h}=l;if(h!=null&&h.current&&u){const m=Math.abs(c.current-f.scrollTop);if(m>0){const y=window.innerHeight-jt*2,b=parseFloat(u.style.minHeight),v=parseFloat(u.style.height),w=Math.max(b,v);if(w<y){const x=w+m,S=Math.min(y,x),C=x-S;u.style.height=S+"px",u.style.bottom==="0px"&&(f.scrollTop=C>0?C:0,u.style.justifyContent="flex-end")}}}c.current=f.scrollTop})})})]})});Lp.displayName=yi;var $p="SelectGroup",[iC,cC]=_o($p),dC=g.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,n=Dr();return s.jsx(iC,{scope:r,id:n,children:s.jsx(Ne.div,{role:"group","aria-labelledby":n,...o,ref:t})})});dC.displayName=$p;var Fp="SelectLabel",Gp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,n=cC(Fp,r);return s.jsx(Ne.div,{id:n.id,...o,ref:t})});Gp.displayName=Fp;var Pa="SelectItem",[uC,Vp]=_o(Pa),zp=g.forwardRef((e,t)=>{const{__scopeSelect:r,value:o,disabled:n=!1,textValue:a,...l}=e,i=Mr(Pa,r),c=Ir(Pa,r),d=i.value===o,[f,u]=g.useState(a??""),[h,m]=g.useState(!1),y=Fe(t,x=>{var S;return(S=c.itemRefCallback)==null?void 0:S.call(c,x,o,n)}),b=Dr(),v=g.useRef("touch"),w=()=>{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(uC,{scope:r,value:o,disabled:n,textId:b,isSelected:d,onItemTextChange:g.useCallback(x=>{u(S=>S||((x==null?void 0:x.textContent)??"").trim())},[]),children:s.jsx(Ta.ItemSlot,{scope:r,value:o,disabled:n,textValue:f,children:s.jsx(Ne.div,{role:"option","aria-labelledby":b,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...l,ref:y,onFocus:we(l.onFocus,()=>m(!0)),onBlur:we(l.onBlur,()=>m(!1)),onClick:we(l.onClick,()=>{v.current!=="mouse"&&w()}),onPointerUp:we(l.onPointerUp,()=>{v.current==="mouse"&&w()}),onPointerDown:we(l.onPointerDown,x=>{v.current=x.pointerType}),onPointerMove:we(l.onPointerMove,x=>{var S;v.current=x.pointerType,n?(S=c.onItemLeave)==null||S.call(c):v.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:we(l.onPointerLeave,x=>{var S;x.currentTarget===document.activeElement&&((S=c.onItemLeave)==null||S.call(c))}),onKeyDown:we(l.onKeyDown,x=>{var C;((C=c.searchRef)==null?void 0:C.current)!==""&&x.key===" "||(XS.includes(x.key)&&w(),x.key===" "&&x.preventDefault())})})})})});zp.displayName=Pa;var en="SelectItemText",Bp=g.forwardRef((e,t)=>{const{__scopeSelect:r,className:o,style:n,...a}=e,l=Mr(en,r),i=Ir(en,r),c=Vp(en,r),d=eC(en,r),[f,u]=g.useState(null),h=Fe(t,w=>u(w),c.onItemTextChange,w=>{var x;return(x=i.itemTextRefCallback)==null?void 0:x.call(i,w,c.value,c.disabled)}),m=f==null?void 0:f.textContent,y=g.useMemo(()=>s.jsx("option",{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:b,onNativeOptionRemove:v}=d;return it(()=>(b(y),()=>v(y)),[b,v,y]),s.jsxs(s.Fragment,{children:[s.jsx(Ne.span,{id:c.textId,...a,ref:h}),c.isSelected&&l.valueNode&&!l.valueNodeHasChildren?Kn.createPortal(a.children,l.valueNode):null]})});Bp.displayName=en;var Up="SelectItemIndicator",Wp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e;return Vp(Up,r).isSelected?s.jsx(Ne.span,{"aria-hidden":!0,...o,ref:t}):null});Wp.displayName=Up;var vi="SelectScrollUpButton",Hp=g.forwardRef((e,t)=>{const r=Ir(vi,e.__scopeSelect),o=bi(vi,e.__scopeSelect),[n,a]=g.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(Yp,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop-c.offsetHeight)}}):null});Hp.displayName=vi;var xi="SelectScrollDownButton",jp=g.forwardRef((e,t)=>{const r=Ir(xi,e.__scopeSelect),o=bi(xi,e.__scopeSelect),[n,a]=g.useState(!1),l=Fe(t,o.onScrollButtonChange);return it(()=>{if(r.viewport&&r.isPositioned){let i=function(){const d=c.scrollHeight-c.clientHeight,f=Math.ceil(c.scrollTop)<d;a(f)};const c=r.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),n?s.jsx(Yp,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop+c.offsetHeight)}}):null});jp.displayName=xi;var Yp=g.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:o,...n}=e,a=Ir("SelectScrollButton",r),l=g.useRef(null),i=Ma(r),c=g.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return g.useEffect(()=>()=>c(),[c]),it(()=>{var f;const d=i().find(u=>u.ref.current===document.activeElement);(f=d==null?void 0:d.ref.current)==null||f.scrollIntoView({block:"nearest"})},[i]),s.jsx(Ne.div,{"aria-hidden":!0,...n,ref:t,style:{flexShrink:0,...n.style},onPointerDown:we(n.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(o,50))}),onPointerMove:we(n.onPointerMove,()=>{var d;(d=a.onItemLeave)==null||d.call(a),l.current===null&&(l.current=window.setInterval(o,50))}),onPointerLeave:we(n.onPointerLeave,()=>{c()})})}),pC="SelectSeparator",qp=g.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e;return s.jsx(Ne.div,{"aria-hidden":!0,...o,ref:t})});qp.displayName=pC;var wi="SelectArrow",fC=g.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,n=Ia(r),a=Mr(wi,r),l=Ir(wi,r);return a.open&&l.position==="popper"?s.jsx(sp,{...n,...o,ref:t}):null});fC.displayName=wi;var hC="SelectBubbleInput",Qp=g.forwardRef(({__scopeSelect:e,value:t,...r},o)=>{const n=g.useRef(null),a=Fe(o,n),l=lp(t);return g.useEffect(()=>{const i=n.current;if(!i)return;const c=window.HTMLSelectElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(l!==t&&f){const u=new Event("change",{bubbles:!0});f.call(i,t),i.dispatchEvent(u)}},[l,t]),s.jsx(Ne.select,{...r,style:{...ip,...r.style},ref:a,defaultValue:t})});Qp.displayName=hC;function Kp(e){return e===""||e===void 0}function Xp(e){const t=kr(e),r=g.useRef(""),o=g.useRef(0),n=g.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=g.useCallback(()=>{r.current="",window.clearTimeout(o.current)},[]);return g.useEffect(()=>()=>window.clearTimeout(o.current),[]),[r,n,a]}function Jp(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=mC(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 mC(e,t){return e.map((r,o)=>e[(t+o)%e.length])}var gC=Np,Zp=kp,bC=Dp,yC=Ap,vC=Tp,Rp=Mp,xC=Lp,ef=Gp,tf=zp,wC=Bp,SC=Wp,rf=Hp,of=jp,nf=qp;/**
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 af=(...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 CC=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 NC=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 sf=e=>{const t=NC(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 EC={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 kC=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 _C=N.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:n="",children:a,iconNode:l,...i},c)=>N.createElement("svg",{ref:c,...EC,width:t,height:t,stroke:e,strokeWidth:o?Number(r)*24/Number(t):r,className:af("lucide",n),...!a&&!kC(i)&&{"aria-hidden":"true"},...i},[...l.map(([d,f])=>N.createElement(d,f)),...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=N.forwardRef(({className:o,...n},a)=>N.createElement(_C,{ref:a,iconNode:t,className:af(`lucide-${CC(sf(e))}`,`lucide-${e}`,o),...n}));return r.displayName=sf(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 DC=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 lf=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 Do=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 cf=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 AC=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 TC=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 df=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 MC=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 uf=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 IC=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 Si=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 PC=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 OC=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 LC=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 Ci=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 $C=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 FC=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 Oa=nt("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),La=gC,$a=bC,tn=g.forwardRef(({className:e,children:t,...r},o)=>s.jsxs(Zp,{ref:o,className:p("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(yC,{asChild:!0,children:s.jsx(Do,{className:p("h-4 w-4 opacity-50")})})]}));tn.displayName=Zp.displayName;const pf=g.forwardRef(({className:e,...t},r)=>s.jsx(rf,{ref:r,className:p("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(cf,{className:p("h-4 w-4")})}));pf.displayName=rf.displayName;const ff=g.forwardRef(({className:e,...t},r)=>s.jsx(of,{ref:r,className:p("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Do,{className:p("h-4 w-4")})}));ff.displayName=of.displayName;const rn=g.forwardRef(({className:e,children:t,position:r="popper",...o},n)=>s.jsx(vC,{children:s.jsxs(Rp,{ref:n,className:p("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(pf,{}),s.jsx(xC,{className:p("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(ff,{})]})}));rn.displayName=Rp.displayName;const GC=g.forwardRef(({className:e,...t},r)=>s.jsx(ef,{ref:r,className:p("px-2 py-1.5 text-sm font-semibold",e),...t}));GC.displayName=ef.displayName;const Rr=g.forwardRef(({className:e,children:t,...r},o)=>s.jsxs(tf,{ref:o,className:p("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:p("absolute right-2 flex h-3.5 w-3.5 items-center justify-center"),children:s.jsx(SC,{children:s.jsx(lf,{className:p("h-4 w-4")})})}),s.jsx(wC,{children:t})]}));Rr.displayName=tf.displayName;const VC=g.forwardRef(({className:e,...t},r)=>s.jsx(nf,{ref:r,className:p("-mx-1 my-1 h-px bg-muted",e),...t}));VC.displayName=nf.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:"🇱🇹"}],zC=[...eo].sort((e,t)=>e.name.localeCompare(t.name)),on=e=>eo.find(t=>t.code===e),BC=(e,t="US")=>{const r=on(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(/^\+/,"")}},UC=({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=N.useMemo(()=>{if(!e){const x=on(o)||eo[0];return{countryCode:x.code,dialCode:x.dialCode,number:""}}return typeof e=="string"?BC(e,o):e},[e,o]),[f,u]=N.useState(d.countryCode),[h,m]=N.useState(d.number),y=N.useRef(null);N.useEffect(()=>{u(d.countryCode),m(d.number)},[d.countryCode,d.number]);const b=N.useMemo(()=>on(f)||eo[0],[f]),v=x=>{const S=on(x);if(S){u(x);const C={countryCode:S.code,dialCode:S.dialCode,number:h};t==null||t(C)}},w=x=>{const S=x.target.value.replace(/[^\d\s\-()]/g,"");m(S),t==null||t({countryCode:b.code,dialCode:b.dialCode,number:S})};return s.jsxs("div",{className:p("flex",i),children:[s.jsxs(La,{value:f,onValueChange:v,disabled:n,children:[s.jsx(tn,{className:p("w-[110px] rounded-r-none border-r-0 focus:z-10",l&&"border-red-500",n&&"opacity-50 cursor-not-allowed"),children:s.jsx($a,{children:s.jsxs("span",{className:p("flex items-center gap-1.5"),children:[s.jsx("span",{className:p("text-base"),children:b.flag}),s.jsx("span",{className:p("text-sm text-muted-foreground"),children:b.dialCode})]})})}),s.jsx(rn,{className:p("max-h-[300px]"),children:zC.map(x=>s.jsx(Rr,{value:x.code,className:p("cursor-pointer"),children:s.jsxs("span",{className:p("flex items-center gap-2"),children:[s.jsx("span",{className:p("text-base"),children:x.flag}),s.jsx("span",{className:p("flex-1"),children:x.name}),s.jsx("span",{className:p("text-muted-foreground text-sm"),children:x.dialCode})]})},x.code))})]}),s.jsx("input",{ref:y,type:"tel",value:h,onChange:w,onBlur:r,disabled:n,placeholder:a,className:p("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)})]})},WC=({defaultCountry:e="US",placeholder:t="Phone number",className:r})=>{const o=on(e)||eo[0];return s.jsxs("div",{className:p("flex",r),children:[s.jsxs("div",{className:p("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:p("text-base"),children:o.flag}),s.jsx("span",{className:p("text-muted-foreground"),children:o.dialCode}),s.jsx("svg",{className:p("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:p("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")})]})},HC=[{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}=U(e);return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,children:s.jsx(Kr,{icon:"✉️",children:s.jsx("input",{type:"email",placeholder:o||"email@example.com",disabled:!0,className:p(`${lt()} pl-10`)})})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:l,onChange:i,errors:c,isDisabled:d}=U(e);return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsx(Kr,{icon:"✉️",children:s.jsx("input",{type:"email",placeholder:o||"email@example.com",value:l??"",onChange:f=>i==null?void 0:i(f.target.value),disabled:d,className:p(`${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}=U(e),i=(l==null?void 0:l.defaultCountry)||"US";return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,children:s.jsx(WC,{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:f}=U(e),u=(f==null?void 0:f.defaultCountry)||"US",h=m=>{i==null||i(m)};return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsx(UC,{value:l,onChange:h,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}=U(e);return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,children:s.jsx(Kr,{icon:"🔗",children:s.jsx("input",{type:"url",placeholder:o||"https://example.com",disabled:!0,className:p(`${lt()} pl-10`)})})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:l,onChange:i,errors:c,isDisabled:d}=U(e);return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsx(Kr,{icon:"🔗",children:s.jsx("input",{type:"url",placeholder:o||"https://example.com",value:l??"",onChange:f=>i==null?void 0:i(f.target.value),disabled:d,className:p(`${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}=U(e);return s.jsxs(ae,{label:t,description:r,required:n,labelPosition:a,children:[s.jsx(Kr,{icon:"📍",children:s.jsx("input",{type:"text",placeholder:o||"Enter address...",disabled:!0,className:p(`${lt()} pl-10`)})}),(l==null?void 0:l.showMap)&&s.jsx("div",{className:p("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:f}=U(e);return s.jsx(ae,{label:t,description:r,required:n,labelPosition:a,errors:c,children:s.jsxs("div",{className:p("space-y-2"),children:[s.jsx(Kr,{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:p(`${bt({hasError:((c==null?void 0:c.length)??0)>0,disabled:d})} pl-10`)})}),(f==null?void 0:f.enableGeolocation)&&!d&&s.jsx("button",{type:"button",className:p("text-sm text-blue-600 hover:text-blue-700 flex items-center gap-1"),children:"📍 Use current location"}),(f==null?void 0:f.showMap)&&s.jsx("div",{className:p("h-32 bg-gray-200 rounded-md flex items-center justify-center text-gray-400 text-sm"),children:"🗺️ Map Preview"})]})})}}],jC=[{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}=U(e);return s.jsx(ae,{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}=U(e);return s.jsx(ae,{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}=U(e);return s.jsx(ae,{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}=U(e);return s.jsx(ae,{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}=U(e);return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:p("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 y;const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:l,errors:i,isDisabled:c}=U(e),d=typeof a=="object"?a==null?void 0:a.date:(a==null?void 0:a.split("T")[0])??"",f=typeof a=="object"?a==null?void 0:a.time:((y=a==null?void 0:a.split("T")[1])==null?void 0:y.substring(0,5))??"",u=b=>{typeof a=="object"?l==null||l({...a,date:b}):l==null||l(`${b}T${f||"00:00"}`)},h=b=>{typeof a=="object"?l==null||l({...a,time:b}):l==null||l(`${d||""}T${b}`)},m=bt({hasError:((i==null?void 0:i.length)??0)>0,disabled:c});return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:p("flex gap-2"),children:[s.jsx("input",{type:"date",value:d,onChange:b=>u(b.target.value),disabled:c,className:`flex-1 ${m}`}),s.jsx("input",{type:"time",value:f,onChange:b=>h(b.target.value),disabled:c,className:`w-32 ${m}`})]})})}},{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}=U(e);return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:p("space-y-2"),children:[s.jsxs("div",{className:p("flex flex-wrap gap-2"),children:[s.jsxs("span",{className:p("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:p("text-blue-600"),children:"×"})]}),s.jsxs("span",{className:p("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:p("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}=U(e),d=Array.isArray(a)?a:[],f=h=>{h&&!d.includes(h)&&(l==null||l([...d,h]))},u=h=>{l==null||l(d.filter(m=>m!==h))};return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:p("space-y-2"),children:[d.length>0&&s.jsx("div",{className:p("flex flex-wrap gap-2"),children:d.map((h,m)=>s.jsxs("span",{className:p("inline-flex items-center gap-1 px-2 py-1 bg-blue-100 text-blue-800 text-sm rounded"),children:[h,!c&&s.jsx("button",{type:"button",onClick:()=>u(h),className:p("text-blue-600 hover:text-blue-800"),children:"×"})]},m))}),s.jsx("input",{type:"date",onChange:h=>{f(h.target.value),h.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}=U(e);return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:p("flex items-center gap-2"),children:[s.jsx("input",{type:"date",disabled:!0,placeholder:"Start date",className:`flex-1 ${lt()}`}),s.jsx("span",{className:p("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}=U(e),d=(a==null?void 0:a.start)??"",f=(a==null?void 0:a.end)??"",u=y=>{l==null||l({start:y,end:f})},h=y=>{l==null||l({start:d,end:y})},m=bt({hasError:((i==null?void 0:i.length)??0)>0,disabled:c});return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{className:p("flex items-center gap-2"),children:[s.jsx("input",{type:"date",value:d,onChange:y=>u(y.target.value),disabled:c,placeholder:"Start date",className:`flex-1 ${m}`}),s.jsx("span",{className:p("text-gray-400"),children:"→"}),s.jsx("input",{type:"date",value:f,onChange:y=>h(y.target.value),disabled:c,min:d,placeholder:"End date",className:`flex-1 ${m}`})]})})}}],YC=[{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}=U(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:p("prose prose-sm max-w-none"),style:{textAlign:(r==null?void 0:r.textAlign)||"left"},children:s.jsx("p",{className:p("text-gray-700",n,a),children:o})})},render:e=>{const{element:t,config:r}=U(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:p("prose prose-sm max-w-none"),style:{textAlign:(r==null?void 0:r.textAlign)||"left"},children:s.jsx("p",{className:p("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}=U(e),o=t.properties.src,n=t.properties.alt||"Image";return o?s.jsx("div",{className:p("space-y-1.5"),children:s.jsx("img",{src:o,alt:n,className:p("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:p("border-2 border-dashed border-gray-300 rounded-lg p-8 text-center bg-gray-50"),children:[s.jsx("span",{className:p("text-4xl"),children:"🏞️"}),s.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"No image selected"}),s.jsx("p",{className:p("text-xs text-gray-400"),children:"Set image URL in properties"})]})},render:e=>{const{element:t,config:r}=U(e),o=t.properties.src,n=t.properties.alt||"Image";return o?s.jsx("div",{className:p("space-y-1.5"),children:s.jsx("img",{src:o,alt:n,className:p("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}=U(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:p("space-y-1"),children:[s.jsx("a",{href:"#",onClick:a=>a.preventDefault(),className:p("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:p("text-xs text-gray-400"),children:n})]}):s.jsxs("div",{className:p("space-y-1"),children:[s.jsx("a",{href:"#",onClick:a=>a.preventDefault(),className:p("text-blue-600 hover:text-blue-800 underline text-sm"),children:o}),s.jsx("p",{className:p("text-xs text-gray-400"),children:n})]})},render:e=>{const{element:t,config:r}=U(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:p("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:p("text-blue-600 hover:text-blue-800 underline text-sm transition-colors"),children:o})}}],qC=[{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}=U(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}=U(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}=U(e),r=(t==null?void 0:t.spacerHeight)||24;return s.jsx("div",{className:p("bg-gray-100/50 border border-dashed border-gray-300 rounded flex items-center justify-center"),style:{height:r},children:s.jsxs("span",{className:p("text-xs text-gray-400"),children:["↕️ Spacer (",r,"px)"]})})},render:e=>{const{config:t}=U(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}=U(e);return s.jsxs("div",{className:p(`text-${(o==null?void 0:o.alignment)||"left"}`),children:[s.jsx("h1",{className:p("text-2xl font-bold text-gray-900"),children:t}),r&&s.jsx("p",{className:p("text-gray-600 mt-1"),children:r})]})},render:e=>{const{label:t,description:r,config:o}=U(e);return s.jsxs("div",{className:p(`text-${(o==null?void 0:o.alignment)||"left"}`),children:[s.jsx("h1",{className:p("text-2xl font-bold text-gray-900"),children:t}),r&&s.jsx("p",{className:p("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}=U(e);return s.jsxs("div",{className:p(`text-${(o==null?void 0:o.alignment)||"left"}`),children:[s.jsx("h2",{className:p("text-xl font-semibold text-gray-800"),children:t}),r&&s.jsx("p",{className:p("text-gray-500 text-sm mt-1"),children:r})]})},render:e=>{const{label:t,description:r,config:o}=U(e);return s.jsxs("div",{className:p(`text-${(o==null?void 0:o.alignment)||"left"}`),children:[s.jsx("h2",{className:p("text-xl font-semibold text-gray-800"),children:t}),r&&s.jsx("p",{className:p("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}=U(e);return s.jsxs("div",{className:p(`text-${(o==null?void 0:o.alignment)||"left"}`),children:[s.jsx("h3",{className:p("text-lg font-medium text-gray-700"),children:t}),r&&s.jsx("p",{className:p("text-gray-500 text-sm mt-0.5"),children:r})]})},render:e=>{const{label:t,description:r,config:o}=U(e);return s.jsxs("div",{className:p(`text-${(o==null?void 0:o.alignment)||"left"}`),children:[s.jsx("h3",{className:p("text-lg font-medium text-gray-700"),children:t}),r&&s.jsx("p",{className:p("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}=U(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:p("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:p("mr-2"),children:"🚀"}),o,(r==null?void 0:r.showIcon)&&(r==null?void 0:r.iconPosition)==="right"&&s.jsx("span",{className:p("ml-2"),children:"🚀"})]})},render:e=>{const{label:t,config:r,isDisabled:o}=U(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:p("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:p("mr-2"),children:"🚀"}),n,(r==null?void 0:r.showIcon)&&(r==null?void 0:r.iconPosition)==="right"&&s.jsx("span",{className:p("ml-2"),children:"🚀"})]})}}],QC=[{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}=U(e),l=(a==null?void 0:a.matrixRows)||[],i=(a==null?void 0:a.matrixColumns)||[];return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,children:s.jsx("div",{className:p("overflow-x-auto"),children:s.jsxs("table",{className:p("w-full border-collapse text-sm"),children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:p("p-2 text-left")}),i.map(c=>s.jsx("th",{className:p("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:p("border-t border-gray-200"),children:[s.jsx("td",{className:p("p-2 text-gray-700"),children:c.label}),i.map(d=>s.jsx("td",{className:p("p-2 text-center"),children:s.jsx("input",{type:"radio",disabled:!0,name:c.id,className:p("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}=U(e),f=(d==null?void 0:d.matrixRows)||[],u=(d==null?void 0:d.matrixColumns)||[],h=a||{},m=(y,b)=>{c||l==null||l({...h,[y]:b})};return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsx("div",{className:p("overflow-x-auto"),children:s.jsxs("table",{className:p("w-full border-collapse text-sm"),children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:p("p-2 text-left")}),u.map(y=>s.jsx("th",{className:p("p-2 text-center font-medium text-gray-700"),children:y.label},y.id))]})}),s.jsx("tbody",{children:f.map(y=>s.jsxs("tr",{className:p("border-t border-gray-200"),children:[s.jsx("td",{className:p("p-2 text-gray-700"),children:y.label}),u.map(b=>s.jsx("td",{className:p("p-2 text-center"),children:s.jsx("input",{type:"radio",name:`${e.element.id}-${y.id}`,checked:h[y.id]===b.id,onChange:()=>m(y.id,b.id),disabled:c,className:p("text-blue-600 cursor-pointer disabled:cursor-not-allowed")})},b.id))]},y.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}=U(e),l=(a==null?void 0:a.matrixRows)||[],i=(a==null?void 0:a.matrixColumns)||[];return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,children:s.jsx("div",{className:p("overflow-x-auto"),children:s.jsxs("table",{className:p("w-full border-collapse text-sm"),children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:p("p-2 text-left")}),i.map(c=>s.jsx("th",{className:p("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:p("border-t border-gray-200"),children:[s.jsx("td",{className:p("p-2 text-gray-700"),children:c.label}),i.map(d=>s.jsx("td",{className:p("p-2 text-center"),children:s.jsx("input",{type:"checkbox",disabled:!0,className:p("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}=U(e),f=(d==null?void 0:d.matrixRows)||[],u=(d==null?void 0:d.matrixColumns)||[],h=a||{},m=(y,b)=>{if(c)return;const v=h[y]||[],w=v.includes(b)?v.filter(x=>x!==b):[...v,b];l==null||l({...h,[y]:w})};return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsx("div",{className:p("overflow-x-auto"),children:s.jsxs("table",{className:p("w-full border-collapse text-sm"),children:[s.jsx("thead",{children:s.jsxs("tr",{children:[s.jsx("th",{className:p("p-2 text-left")}),u.map(y=>s.jsx("th",{className:p("p-2 text-center font-medium text-gray-700"),children:y.label},y.id))]})}),s.jsx("tbody",{children:f.map(y=>s.jsxs("tr",{className:p("border-t border-gray-200"),children:[s.jsx("td",{className:p("p-2 text-gray-700"),children:y.label}),u.map(b=>s.jsx("td",{className:p("p-2 text-center"),children:s.jsx("input",{type:"checkbox",checked:(h[y.id]||[]).includes(b.id),onChange:()=>m(y.id,b.id),disabled:c,className:p("text-blue-600 rounded cursor-pointer disabled:cursor-not-allowed")})},b.id))]},y.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}=U(e),l=(a==null?void 0:a.matrixRows)||[],i=(a==null?void 0:a.matrixColumns)||[];return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,children:s.jsx("div",{className:p("overflow-x-auto"),children:s.jsxs("table",{className:p("w-full border-collapse text-sm border border-gray-200"),children:[s.jsx("thead",{children:s.jsxs("tr",{className:p("bg-gray-50"),children:[s.jsx("th",{className:p("p-2 text-left border border-gray-200")}),i.map(c=>s.jsx("th",{className:p("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("p-2 text-gray-700 border border-gray-200 bg-gray-50"),children:c.label}),i.map(d=>s.jsx("td",{className:p("p-2 border border-gray-200"),children:s.jsx("input",{type:d.type==="number"?"number":"text",disabled:!0,className:p("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}=U(e),f=(d==null?void 0:d.matrixRows)||[],u=(d==null?void 0:d.matrixColumns)||[],h=a||{},m=(y,b,v)=>{const w={...h,[y]:{...h[y]||{},[b]:v}};l==null||l(w)};return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsx("div",{className:p("overflow-x-auto"),children:s.jsxs("table",{className:p("w-full border-collapse text-sm border border-gray-200"),children:[s.jsx("thead",{children:s.jsxs("tr",{className:p("bg-gray-50"),children:[s.jsx("th",{className:p("p-2 text-left border border-gray-200")}),u.map(y=>s.jsx("th",{className:p("p-2 text-center font-medium text-gray-700 border border-gray-200"),children:y.label},y.id))]})}),s.jsx("tbody",{children:f.map(y=>s.jsxs("tr",{children:[s.jsx("td",{className:p("p-2 text-gray-700 border border-gray-200 bg-gray-50"),children:y.label}),u.map(b=>{var v;return s.jsx("td",{className:p("p-2 border border-gray-200"),children:s.jsx("input",{type:b.type==="number"?"number":"text",value:((v=h[y.id])==null?void 0:v[b.id])??"",onChange:w=>m(y.id,b.id,b.type==="number"?Number(w.target.value):w.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"}`})},b.id)})]},y.id))})]})})})}}],KC=[{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}=U(e);return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:p("border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50"),children:[s.jsx("svg",{className:p("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:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload"}),s.jsxs("p",{className:p("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}=U(e),f=y=>{var v;const b=(v=y.target.files)==null?void 0:v[0];b&&(l==null||l(b))},u=y=>{var v;y.preventDefault();const b=(v=y.dataTransfer.files)==null?void 0:v[0];b&&(l==null||l(b))},h=y=>{y.preventDefault()},m=a instanceof File?a.name:a==null?void 0:a.name;return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:s.jsxs("div",{onDrop:c?void 0:u,onDragOver:c?void 0:h,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:f,disabled:c,className:p("hidden"),id:`file-upload-${e.element.id}`}),s.jsx("label",{htmlFor:`file-upload-${e.element.id}`,className:c?"cursor-not-allowed":"cursor-pointer",children:m?s.jsxs("div",{className:p("flex items-center justify-center gap-2"),children:[s.jsx("span",{className:p("text-2xl"),children:"📄"}),s.jsx("span",{className:p("text-sm text-gray-700"),children:m}),!c&&s.jsx("button",{type:"button",onClick:y=>{y.preventDefault(),l==null||l(null)},className:p("text-red-500 hover:text-red-700"),children:"×"})]}):s.jsxs(s.Fragment,{children:[s.jsx("svg",{className:p("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:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload"}),s.jsxs("p",{className:p("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}=U(e);return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,children:s.jsxs("div",{className:p("border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50"),children:[s.jsx("span",{className:p("text-4xl"),children:"🖼️"}),s.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload image"}),s.jsxs("p",{className:p("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}=U(e),[f,u]=N.useState(null);N.useEffect(()=>{if(a instanceof File){const y=new FileReader;y.onloadend=()=>{u(y.result)},y.readAsDataURL(a)}else u(typeof a=="string"?a:null)},[a]);const h=y=>{var v;const b=(v=y.target.files)==null?void 0:v[0];b&&(l==null||l(b))},m=()=>{l==null||l(null),u(null)};return s.jsx(ae,{label:t,description:r,required:o,labelPosition:n,errors:i,children:f?s.jsxs("div",{className:p("relative inline-block"),children:[s.jsx("img",{src:f,alt:"Preview",className:p("max-w-full max-h-48 rounded-lg border border-gray-200")}),!c&&s.jsx("button",{type:"button",onClick:m,className:p("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:h,disabled:c,className:p("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:p("text-4xl"),children:"🖼️"}),s.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload image"}),s.jsxs("p",{className:p("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}=U(e);return s.jsxs(ae,{label:t,description:r,required:o,labelPosition:n,children:[s.jsxs("div",{className:p("border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50"),children:[s.jsx("span",{className:p("text-4xl"),children:"📁"}),s.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload files"}),s.jsxs("p",{className:p("text-xs text-gray-400"),children:["Up to ",(a==null?void 0:a.maxFiles)||10," files"]})]}),s.jsx("div",{className:p("space-y-2 mt-2"),children:s.jsxs("div",{className:p("flex items-center gap-2 p-2 bg-gray-100 rounded text-sm"),children:[s.jsx("span",{children:"📄"}),s.jsx("span",{className:p("flex-1 truncate"),children:"document.pdf"}),s.jsx("button",{disabled:!0,className:p("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}=U(e),f=Array.isArray(a)?a:[],u=(d==null?void 0:d.maxFiles)||10,h=y=>{const b=Array.from(y.target.files||[]),v=[...f,...b].slice(0,u);l==null||l(v)},m=y=>{const b=f.filter((v,w)=>w!==y);l==null||l(b)};return s.jsxs(ae,{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>=u?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[s.jsx("input",{type:"file",accept:d==null?void 0:d.accept,multiple:!0,onChange:h,disabled:c||f.length>=u,className:p("hidden"),id:`multi-file-upload-${e.element.id}`}),s.jsxs("label",{htmlFor:`multi-file-upload-${e.element.id}`,className:c||f.length>=u?"cursor-not-allowed":"cursor-pointer",children:[s.jsx("span",{className:p("text-4xl"),children:"📁"}),s.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload files"}),s.jsxs("p",{className:p("text-xs text-gray-400"),children:[f.length," / ",u," files"]})]})]}),f.length>0&&s.jsx("div",{className:p("space-y-2 mt-2"),children:f.map((y,b)=>s.jsxs("div",{className:p("flex items-center gap-2 p-2 bg-gray-100 rounded text-sm"),children:[s.jsx("span",{children:"📄"}),s.jsx("span",{className:p("flex-1 truncate"),children:y.name}),s.jsxs("span",{className:p("text-xs text-gray-500"),children:[(y.size/1024).toFixed(1)," KB"]}),!c&&s.jsx("button",{type:"button",onClick:()=>m(b),className:p("text-gray-400 hover:text-red-500"),children:"×"})]},b))})]})}},{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}=U(e);return s.jsxs(ae,{label:t,description:r,required:o,labelPosition:n,children:[s.jsxs("div",{className:p("border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50"),children:[s.jsx("span",{className:p("text-4xl"),children:"🖼️"}),s.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload images"}),s.jsxs("p",{className:p("text-xs text-gray-400"),children:["Up to ",(a==null?void 0:a.maxFiles)||10," images"]})]}),s.jsx("div",{className:p("flex gap-2 flex-wrap mt-2"),children:s.jsxs("div",{className:p("w-20 h-20 bg-gray-200 rounded-lg flex items-center justify-center relative"),children:[s.jsx("span",{className:p("text-2xl"),children:"🖼️"}),s.jsx("button",{disabled:!0,className:p("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}=U(e),[f,u]=N.useState([]),h=Array.isArray(a)?a:[],m=(d==null?void 0:d.maxFiles)||10;N.useEffect(()=>{(async()=>{const w=[];for(const x of h)if(x instanceof File){const S=new FileReader,C=await new Promise(k=>{S.onloadend=()=>k(S.result),S.readAsDataURL(x)});w.push(C)}u(w)})()},[h]);const y=v=>{const w=Array.from(v.target.files||[]),x=[...h,...w].slice(0,m);l==null||l(x)},b=v=>{const w=h.filter((x,S)=>S!==v);l==null||l(w)};return s.jsxs(ae,{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||h.length>=m?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:[s.jsx("input",{type:"file",accept:(d==null?void 0:d.accept)||"image/*",multiple:!0,onChange:y,disabled:c||h.length>=m,className:p("hidden"),id:`multi-image-upload-${e.element.id}`}),s.jsxs("label",{htmlFor:`multi-image-upload-${e.element.id}`,className:c||h.length>=m?"cursor-not-allowed":"cursor-pointer",children:[s.jsx("span",{className:p("text-4xl"),children:"🖼️"}),s.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload images"}),s.jsxs("p",{className:p("text-xs text-gray-400"),children:[h.length," / ",m," images"]})]})]}),f.length>0&&s.jsx("div",{className:p("flex gap-2 flex-wrap mt-2"),children:f.map((v,w)=>s.jsxs("div",{className:p("w-20 h-20 rounded-lg overflow-hidden relative border border-gray-200"),children:[s.jsx("img",{src:v,alt:`Preview ${w+1}`,className:p("w-full h-full object-cover")}),!c&&s.jsx("button",{type:"button",onClick:()=>b(w),className:p("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:"×"})]},w))})]})}}],XC=[{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}=U(e);return s.jsxs(ae,{label:t,description:r,required:n,labelPosition:a,children:[s.jsxs("div",{className:p("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:p("absolute right-3 top-1/2 -translate-y-1/2 text-gray-400"),children:"👁️"})]}),(l==null?void 0:l.showStrengthMeter)&&s.jsxs("div",{className:p("flex gap-1 mt-2"),children:[s.jsx("div",{className:p("h-1 flex-1 bg-gray-300 rounded")}),s.jsx("div",{className:p("h-1 flex-1 bg-gray-300 rounded")}),s.jsx("div",{className:p("h-1 flex-1 bg-gray-300 rounded")}),s.jsx("div",{className:p("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:f}=U(e),[u,h]=N.useState(!1),y=(v=>{if(!v)return 0;let w=0;return v.length>=8&&w++,/[a-z]/.test(v)&&/[A-Z]/.test(v)&&w++,/\d/.test(v)&&w++,/[^a-zA-Z0-9]/.test(v)&&w++,w})(l||""),b=["bg-red-500","bg-orange-500","bg-yellow-500","bg-green-500"];return s.jsxs(ae,{label:t,description:r,required:n,labelPosition:a,errors:c,children:[s.jsxs("div",{className:p("relative"),children:[s.jsx("input",{type:u?"text":"password",placeholder:o||"••••••••",value:l??"",onChange:v=>i==null?void 0:i(v.target.value),disabled:d,className:`${bt({hasError:((c==null?void 0:c.length)??0)>0,disabled:d})} pr-10`}),(f==null?void 0:f.showToggle)&&!d&&s.jsx("button",{type:"button",onClick:()=>h(!u),className:p("absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600"),children:u?"🙈":"👁️"})]}),(f==null?void 0:f.showStrengthMeter)&&l&&s.jsx("div",{className:p("flex gap-1 mt-2"),children:[0,1,2,3].map(v=>s.jsx("div",{className:`h-1 flex-1 rounded ${v<y?b[y-1]:"bg-gray-300"}`},v))})]})}},{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}=U(e);return s.jsxs(ae,{label:t,description:r,required:o,labelPosition:n,children:[s.jsx("div",{className:p("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:p("text-center text-gray-400"),children:[s.jsx("span",{className:p("text-3xl"),children:"✍️"}),s.jsx("p",{className:p("text-sm mt-2"),children:"Draw your signature here"})]})}),s.jsx("button",{disabled:!0,className:p("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}=U(e),f=N.useRef(null),[u,h]=N.useState(!1),m=w=>{if(c)return;h(!0);const x=f.current;if(!x)return;const S=x.getContext("2d");if(!S)return;const C=x.getBoundingClientRect();S.beginPath(),S.moveTo(w.clientX-C.left,w.clientY-C.top)},y=w=>{if(!u||c)return;const x=f.current;if(!x)return;const S=x.getContext("2d");if(!S)return;const C=x.getBoundingClientRect();S.lineWidth=(d==null?void 0:d.strokeWidth)||2,S.strokeStyle=(d==null?void 0:d.strokeColor)||"#000000",S.lineCap="round",S.lineTo(w.clientX-C.left,w.clientY-C.top),S.stroke()},b=()=>{u&&f.current&&(h(!1),l==null||l(f.current.toDataURL()))},v=()=>{const w=f.current;if(!w)return;const x=w.getContext("2d");x&&(x.fillStyle=(d==null?void 0:d.backgroundColor)||"#ffffff",x.fillRect(0,0,w.width,w.height),l==null||l(""))};return s.jsxs(ae,{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:f,width:(d==null?void 0:d.canvasWidth)||400,height:(d==null?void 0:d.canvasHeight)||200,onMouseDown:m,onMouseMove:y,onMouseUp:b,onMouseLeave:b,className:c?"cursor-not-allowed":"cursor-crosshair",style:{display:"block",width:"100%"}})}),!c&&s.jsx("button",{type:"button",onClick:v,className:p("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}=U(e);return s.jsxs("div",{className:p("space-y-1.5"),children:[t&&s.jsx("p",{className:p("text-xs text-gray-500"),children:t}),s.jsx("div",{className:p("border border-gray-300 rounded-md p-4 bg-gray-50 max-w-[300px]"),children:s.jsxs("div",{className:p("flex items-center gap-3"),children:[s.jsx("div",{className:p("w-7 h-7 border-2 border-gray-300 rounded flex items-center justify-center"),children:"☐"}),s.jsx("span",{className:p("text-sm text-gray-700"),children:"I'm not a robot"}),s.jsx("div",{className:p("ml-auto"),children:s.jsxs("div",{className:p("text-xs text-gray-400 text-center"),children:[s.jsx("div",{className:p("text-lg"),children:"🔄"}),s.jsx("span",{children:"reCAPTCHA"})]})})]})})]})},render:e=>{const{description:t,value:r,onChange:o,errors:n,isDisabled:a,config:l}=U(e),i=r===!0,c=()=>{a||o==null||o(!0)};return s.jsxs("div",{className:p("space-y-1.5"),children:[t&&s.jsx("p",{className:p("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:p("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:p("text-sm text-gray-700"),children:i?"Verified!":"I'm not a robot"}),s.jsx("div",{className:p("ml-auto"),children:s.jsxs("div",{className:p("text-xs text-gray-400 text-center"),children:[s.jsx("div",{className:p("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:p("space-y-1"),children:n.map((d,f)=>s.jsx("p",{className:p("text-xs text-red-500"),children:d},f))})]})}}],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}=U(e),n=(o==null?void 0:o.showBorder)??!0,a=(o==null?void 0:o.collapsible)??!1;return s.jsxs("div",{className:p("rounded-lg",n?"border border-gray-200":""),style:{padding:(o==null?void 0:o.padding)||16},children:[s.jsx("div",{className:p("flex items-center justify-between mb-2"),children:s.jsxs("div",{children:[s.jsxs("h3",{className:p("font-medium text-gray-800 flex items-center gap-2"),children:[a&&s.jsx("span",{className:p("text-gray-400 text-sm"),children:"▼"}),t||"Group"]}),r&&s.jsx("p",{className:p("text-sm text-gray-500 mt-0.5"),children:r})]})}),s.jsx("div",{className:p("border-2 border-dashed border-gray-200 rounded-md p-4 min-h-[80px] flex items-center justify-center"),children:s.jsx("span",{className:p("text-sm text-gray-400"),children:"Drop elements here"})})]})},render:e=>{const{label:t,description:r,config:o,element:n}=U(e),{renderChildren:a}=e,l=(o==null?void 0:o.showBorder)??!0,i=(o==null?void 0:o.collapsible)??!1,[c,d]=N.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:p("font-medium text-gray-800 flex items-center gap-2"),children:[i&&s.jsx("span",{className:p("text-gray-400 text-sm transition-transform",c?"-rotate-90":""),children:"▼"}),t||"Group"]}),r&&!c&&s.jsx("p",{className:p("text-sm text-gray-500 mt-0.5"),children:r})]})}),!c&&s.jsx("div",{className:p("mt-3"),children:a?a(n.id):s.jsx("div",{"data-container-id":n.id,className:p("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}=U(e),o=(r==null?void 0:r.gridColumns)||2,n=(r==null?void 0:r.gridGap)||16;return s.jsxs("div",{className:p("border border-gray-200 rounded-lg p-4"),children:[t&&s.jsx("div",{className:p("mb-3"),children:s.jsx("h3",{className:p("font-medium text-gray-800"),children:t})}),s.jsx("div",{className:p("grid"),style:{gridTemplateColumns:`repeat(${o}, 1fr)`,gap:n},children:Array.from({length:o}).map((a,l)=>s.jsx("div",{className:p("border-2 border-dashed border-gray-200 rounded-md p-4 min-h-[60px] flex items-center justify-center"),children:s.jsxs("span",{className:p("text-xs text-gray-400"),children:["Column ",l+1]})},l))})]})},render:e=>{const{label:t,config:r,element:o}=U(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:p("mb-3"),children:s.jsx("h3",{className:p("font-medium text-gray-800"),children:t})}),s.jsx("div",{className:p("grid"),style:{gridTemplateColumns:`repeat(${a}, 1fr)`,gap:l},children:n?n(o.id):s.jsx("div",{"data-container-id":o.id,className:p("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}=U(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:p("space-y-2"),children:[t&&s.jsxs("div",{children:[s.jsx("h3",{className:p("font-medium text-gray-800"),children:t}),r&&s.jsx("p",{className:p("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:p("min-w-full divide-y divide-gray-200"),children:[a&&s.jsx("thead",{className:p("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(f=>s.jsx("td",{className:`px-4 py-3 text-sm text-gray-500 text-${f.align||"left"}`,children:s.jsx("span",{className:p("text-gray-300"),children:"Sample data"})},f.id))},c))})]})}),s.jsx("p",{className:p("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=[]}=U(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:p("space-y-2"),children:[t&&s.jsxs("div",{children:[s.jsx("h3",{className:p("font-medium text-gray-800"),children:t}),r&&s.jsx("p",{className:p("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:p("min-w-full divide-y divide-gray-200"),children:[l&&s.jsx("thead",{className:p("bg-gray-50"),children:s.jsx("tr",{children:a.map(f=>s.jsx("th",{style:{width:f.width||"auto"},className:`px-4 py-3 text-xs font-medium text-gray-500 uppercase tracking-wider text-${f.align||"left"}`,children:f.header},f.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:p("px-4 py-8 text-sm text-gray-400 text-center"),children:"No data available"})}):d.map((f,u)=>s.jsx("tr",{className:i&&u%2===1?"bg-gray-50":"",children:a.map(h=>s.jsx("td",{className:`px-4 py-3 text-sm text-gray-700 text-${h.align||"left"}`,children:f[h.id]??"-"},h.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}=U(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:p("border border-gray-200 rounded-lg p-4 bg-white"),children:[a&&s.jsxs("div",{className:p("mb-6"),children:[s.jsx("div",{className:p("h-2 bg-gray-200 rounded-full overflow-hidden"),children:s.jsx("div",{className:p("h-full bg-blue-600 transition-all duration-300"),style:{width:`${(n+1)/r.length*100}%`}})}),l&&s.jsx("div",{className:p("flex justify-between mt-3"),children:r.map((d,f)=>{const u=f<n,h=f===n;return s.jsxs("div",{className:p("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":h?"bg-blue-600 text-white":"bg-gray-200 text-gray-500"}`,children:u?"✓":f+1}),s.jsx("span",{className:`text-xs mt-1 ${h?"text-blue-600 font-medium":"text-gray-500"}`,children:d.label})]},d.id)})})]}),s.jsx("div",{className:p("border-2 border-dashed border-gray-200 rounded-lg p-6 min-h-[150px] flex items-center justify-center"),children:s.jsxs("div",{className:p("text-center"),children:[s.jsxs("span",{className:p("text-gray-400 text-sm"),children:["Step ",n+1,":"," ",(c=r[n])==null?void 0:c.label]}),s.jsx("p",{className:p("text-gray-300 text-xs mt-1"),children:"Drop elements here for this step"})]})}),s.jsxs("div",{className:p("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:p("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}=U(e),o=(t==null?void 0:t.steps)||[];return s.jsx("div",{"data-wizard-id":r.id,"data-wizard-steps":o.length})}}],ZC=[{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}=U(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:p("space-y-3"),children:[s.jsxs("div",{children:[s.jsxs("label",{className:p("block text-sm font-medium text-gray-700"),children:[t||"Repeatable Field",n&&s.jsx("span",{className:p("text-red-500 ml-1"),children:"*"})]}),r&&s.jsx("p",{className:p("text-xs text-gray-500 mt-0.5"),children:r})]}),s.jsx("div",{className:p("space-y-2"),children:Array.from({length:Math.min(2,l)}).map((f,u)=>s.jsxs("div",{className:p("flex items-center gap-2"),children:[d&&s.jsxs("span",{className:p("text-xs text-gray-400 w-4"),children:[u+1,"."]}),s.jsx("input",{type:"text",placeholder:o||"Enter value",disabled:!0,className:p("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("p-2 text-gray-400 hover:text-red-500 disabled:opacity-50"),children:"✕"})]},u))}),s.jsxs("button",{type:"button",disabled:!0,className:p("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:p("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}=U(e),f=(a==null?void 0:a.minItems)||1,u=(a==null?void 0:a.maxItems)||10,h=(a==null?void 0:a.addButtonText)||"Add Item",m=(a==null?void 0:a.showItemNumber)??!0,y=Array.isArray(l)?l:[""],b=y.length<u,v=y.length>f,w=()=>{b&&i&&i([...y,""])},x=k=>{if(v&&i){const E=y.filter((M,_)=>_!==k);i(E)}},S=(k,E)=>{if(i){const M=[...y];M[k]=E,i(M)}},C=c&&c.length>0;return s.jsxs("div",{className:p("space-y-3"),children:[s.jsxs("div",{children:[s.jsxs("label",{className:p("block text-sm font-medium text-gray-700"),children:[t||"Repeatable Field",n&&s.jsx("span",{className:p("text-red-500 ml-1"),children:"*"})]}),r&&s.jsx("p",{className:p("text-xs text-gray-500 mt-0.5"),children:r})]}),s.jsx("div",{className:p("space-y-2"),children:y.map((k,E)=>s.jsxs("div",{className:p("flex items-center gap-2"),children:[m&&s.jsxs("span",{className:p("text-xs text-gray-400 w-4"),children:[E+1,"."]}),s.jsx("input",{type:"text",value:k,onChange:M=>S(E,M.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 ${C?"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:()=>x(E),disabled:!v||d,className:`p-2 transition-colors ${v&&!d?"text-gray-400 hover:text-red-500":"text-gray-300 cursor-not-allowed"}`,children:"✕"})]},E))}),b&&!d&&s.jsxs("button",{type:"button",onClick:w,className:p("flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700"),children:[s.jsx("span",{children:"+"}),s.jsx("span",{children:h})]}),c&&c.length>0&&s.jsx("div",{className:p("space-y-1"),children:c.map((k,E)=>s.jsx("p",{className:p("text-xs text-red-500"),children:k},E))})]})}},{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}=U(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:p("border border-gray-200 rounded-lg p-4 space-y-4"),children:[s.jsxs("div",{className:p("flex items-center justify-between"),children:[s.jsxs("div",{children:[s.jsxs("h3",{className:p("font-medium text-gray-800 flex items-center gap-2"),children:[s.jsx("span",{className:p("text-lg"),children:"📚"}),t||"Repeatable Section"]}),r&&s.jsx("p",{className:p("text-sm text-gray-500 mt-0.5"),children:r})]}),s.jsxs("span",{className:p("text-xs text-gray-400 bg-gray-100 px-2 py-1 rounded"),children:[n,"-",a," items"]})]}),s.jsxs("div",{className:p("border border-dashed border-gray-300 rounded-lg"),children:[s.jsxs("div",{className:p("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:p("text-sm font-medium text-gray-600"),children:[c&&"1. ",i]}),s.jsxs("div",{className:p("flex items-center gap-2"),children:[s.jsx("button",{type:"button",disabled:!0,className:p("text-gray-400 hover:text-gray-600 text-sm"),children:"▲"}),s.jsx("button",{type:"button",disabled:!0,className:p("text-gray-400 hover:text-gray-600 text-sm"),children:"▼"}),s.jsx("button",{type:"button",disabled:!0,className:p("text-gray-400 hover:text-red-500 text-sm"),children:"✕"})]})]}),s.jsx("div",{className:p("p-4 min-h-[80px] flex items-center justify-center"),children:s.jsx("span",{className:p("text-sm text-gray-400"),children:"Drop elements here to define the repeatable group structure"})})]}),s.jsxs("button",{type:"button",disabled:!0,className:p("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}=U(e),{renderChildren:d}=e,f=(o==null?void 0:o.minItems)||1,u=(o==null?void 0:o.maxItems)||10,h=(o==null?void 0:o.addButtonText)||"Add Entry",m=(o==null?void 0:o.removeButtonText)||"Remove",y=(o==null?void 0:o.itemLabel)||"Entry",b=(o==null?void 0:o.showItemNumber)??!0,v=Array.isArray(a)?a:Array.from({length:f},()=>({})),w=v.length<u,x=v.length>f,S=()=>{w&&l&&l([...v,{}])},C=_=>{if(x&&l){const I=v.filter((A,W)=>W!==_);l(I)}},k=_=>{if(_>0&&l){const I=[...v];[I[_-1],I[_]]=[I[_],I[_-1]],l(I)}},E=_=>{if(_<v.length-1&&l){const I=[...v];[I[_],I[_+1]]=[I[_+1],I[_]],l(I)}},M=i&&i.length>0;return s.jsxs("div",{className:`border rounded-lg p-4 space-y-4 ${M?"border-red-300":"border-gray-200"}`,children:[s.jsxs("div",{className:p("flex items-center justify-between"),children:[s.jsxs("div",{children:[s.jsx("h3",{className:p("font-medium text-gray-800"),children:t||"Repeatable Section"}),r&&s.jsx("p",{className:p("text-sm text-gray-500 mt-0.5"),children:r})]}),s.jsxs("span",{className:p("text-xs text-gray-400"),children:[v.length," of ",u]})]}),s.jsx("div",{className:p("space-y-3"),children:v.map((_,I)=>{var A;return s.jsxs("div",{className:p("border border-gray-200 rounded-lg overflow-hidden"),children:[s.jsxs("div",{className:p("flex items-center justify-between px-4 py-2 bg-gray-50 border-b border-gray-200"),children:[s.jsxs("span",{className:p("text-sm font-medium text-gray-600"),children:[b&&`${I+1}. `,y]}),!c&&s.jsxs("div",{className:p("flex items-center gap-1"),children:[s.jsx("button",{type:"button",onClick:()=>k(I),disabled:I===0,className:`p-1 rounded transition-colors ${I===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:()=>E(I),disabled:I===v.length-1,className:`p-1 rounded transition-colors ${I===v.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:()=>C(I),disabled:!x,className:`p-1 rounded transition-colors ${x?"text-gray-400 hover:text-red-500 hover:bg-red-50":"text-gray-300 cursor-not-allowed"}`,title:m,children:"✕"})]})]}),s.jsx("div",{className:p("p-4"),children:d?d(n.id,`${((A=n.attributes)==null?void 0:A.name)||n.id}[${I}]`):s.jsx("div",{"data-repeat-group-item":n.id,"data-repeat-index":I,className:p("text-sm text-gray-400 text-center py-4"),children:"Group fields render here"})})]},I)})}),w&&!c&&s.jsxs("button",{type:"button",onClick:S,className:p("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:h})]}),i&&i.length>0&&s.jsx("div",{className:p("space-y-1"),children:i.map((_,I)=>s.jsx("p",{className:p("text-xs text-red-500"),children:_},I))})]})}}],hf=[...Xx,...Jx,...Zx,...HC,...jC,...YC,...qC,...QC,...KC,...XC,...JC,...ZC];function RC(){for(const e of hf)Ke.register(e)}const eN=["shortText","longText","multiLineInput","textEditor"],tN=["number","slider","rangeSlider"],rN=["email","phone","url","location"],oN=["password","signature","captcha"],nN=["singleChoice","multipleChoice","dropdown","tags","decisionBox","toggleSwitch"],aN=["singleChoiceMatrix","multipleChoiceMatrix","matrixTable"],sN=["date","time","dateTime","multipleDates","dateRange"],lN=["fileUpload","imageUpload","multiFileUpload","multiImageUpload"],iN=["paragraph","image","link"],cN=[...eN,...tN,...rN,...oN,...nN,...aN,...sN,...lN,...iN],Ni={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"},Ei={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 dN(e){return cN.includes(e)}const uN=["singleChoice","multipleChoice","dropdown","tags"],pN=["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"],fN=["singleChoiceMatrix","multipleChoiceMatrix","matrixTable"];function hN(e){return uN.includes(e)}function mN(e){return pN.includes(e)}function gN(e){return fN.includes(e)}const Fa=({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(Ga,{element:e,error:n})}return s.jsx(Ga,{element:e})},mf=({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(Ga,{element:e,error:d})}return s.jsx(Ga,{element:e})},Ga=({element:e,error:t})=>{const r=Ei[e.type]||"❓",o=Ni[e.type]||e.type;return t?s.jsxs("div",{className:p("p-4 bg-red-50 border border-red-200 rounded text-red-600 text-sm"),children:[s.jsxs("div",{className:p("flex items-center gap-2"),children:[s.jsx("span",{children:"⚠️"}),s.jsxs("span",{children:["Error rendering: ",o]})]}),s.jsx("p",{className:p("text-xs mt-1 text-red-500"),children:t instanceof Error?t.message:"Unknown error"})]}):s.jsxs("div",{className:p("p-4 bg-gray-100 rounded text-gray-600 text-sm"),children:[s.jsxs("div",{className:p("flex items-center gap-2"),children:[s.jsx("span",{children:r}),s.jsx("span",{children:o})]}),s.jsx("p",{className:p("text-xs mt-1 text-gray-400"),children:"Element type not registered in the element registry"})]})};function bN(e){return Ke.has(e)}function gf(e){const t=Ke.get(e);return t?t.icon:Ei[e]}function ki(e){const t=Ke.get(e);return t?t.label:Ni[e]||e}function yN(e,t){return s.jsx(Fa,{element:e,isSelected:t})}function vN(e,t,r,o,n){return s.jsx(mf,{element:e,value:t,onChange:r,errors:o,formValues:n})}const Vt=g.forwardRef(({className:e,type:t,...r},o)=>s.jsx("input",{type:t,className:p("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 bf=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,yf=Wd,Va=(e,t)=>r=>{var o;if((t==null?void 0:t.variants)==null)return yf(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 f=r==null?void 0:r[d],u=a==null?void 0:a[d];if(f===null)return null;const h=bf(f)||bf(u);return n[d][h]}),i=r&&Object.entries(r).reduce((d,f)=>{let[u,h]=f;return h===void 0||(d[u]=h),d},{}),c=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((d,f)=>{let{class:u,className:h,...m}=f;return Object.entries(m).every(y=>{let[b,v]=y;return Array.isArray(v)?v.includes({...a,...i}[b]):{...a,...i}[b]===v})?[...d,u,h]:d},[]);return yf(e,l,c,r==null?void 0:r.class,r==null?void 0:r.className)},xN=Va("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 _i({className:e,variant:t,...r}){return s.jsx("div",{className:p(xN({variant:t}),e),...r})}var Di="rovingFocusGroup.onEntryFocus",wN={bubbles:!1,cancelable:!0},nn="RovingFocusGroup",[Ai,vf,SN]=jl(nn),[CN,xf]=ur(nn,[SN]),[NN,EN]=CN(nn),wf=g.forwardRef((e,t)=>s.jsx(Ai.Provider,{scope:e.__scopeRovingFocusGroup,children:s.jsx(Ai.Slot,{scope:e.__scopeRovingFocusGroup,children:s.jsx(kN,{...e,ref:t})})}));wf.displayName=nn;var kN=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:n=!1,dir:a,currentTabStopId:l,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:f=!1,...u}=e,h=g.useRef(null),m=Fe(t,h),y=ua(a),[b,v]=hr({prop:l,defaultProp:i??null,onChange:c,caller:nn}),[w,x]=g.useState(!1),S=kr(d),C=vf(r),k=g.useRef(!1),[E,M]=g.useState(0);return g.useEffect(()=>{const _=h.current;if(_)return _.addEventListener(Di,S),()=>_.removeEventListener(Di,S)},[S]),s.jsx(NN,{scope:r,orientation:o,dir:y,loop:n,currentTabStopId:b,onItemFocus:g.useCallback(_=>v(_),[v]),onItemShiftTab:g.useCallback(()=>x(!0),[]),onFocusableItemAdd:g.useCallback(()=>M(_=>_+1),[]),onFocusableItemRemove:g.useCallback(()=>M(_=>_-1),[]),children:s.jsx(Ne.div,{tabIndex:w||E===0?-1:0,"data-orientation":o,...u,ref:m,style:{outline:"none",...e.style},onMouseDown:we(e.onMouseDown,()=>{k.current=!0}),onFocus:we(e.onFocus,_=>{const I=!k.current;if(_.target===_.currentTarget&&I&&!w){const A=new CustomEvent(Di,wN);if(_.currentTarget.dispatchEvent(A),!A.defaultPrevented){const W=C().filter(H=>H.focusable),$=W.find(H=>H.active),G=W.find(H=>H.id===b),ee=[$,G,...W].filter(Boolean).map(H=>H.ref.current);Nf(ee,f)}}k.current=!1}),onBlur:we(e.onBlur,()=>x(!1))})})}),Sf="RovingFocusGroupItem",Cf=g.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:n=!1,tabStopId:a,children:l,...i}=e,c=Dr(),d=a||c,f=EN(Sf,r),u=f.currentTabStopId===d,h=vf(r),{onFocusableItemAdd:m,onFocusableItemRemove:y,currentTabStopId:b}=f;return g.useEffect(()=>{if(o)return m(),()=>y()},[o,m,y]),s.jsx(Ai.ItemSlot,{scope:r,id:d,focusable:o,active:n,children:s.jsx(Ne.span,{tabIndex:u?0:-1,"data-orientation":f.orientation,...i,ref:t,onMouseDown:we(e.onMouseDown,v=>{o?f.onItemFocus(d):v.preventDefault()}),onFocus:we(e.onFocus,()=>f.onItemFocus(d)),onKeyDown:we(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){f.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const w=AN(v,f.orientation,f.dir);if(w!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=h().filter(C=>C.focusable).map(C=>C.ref.current);if(w==="last")S.reverse();else if(w==="prev"||w==="next"){w==="prev"&&S.reverse();const C=S.indexOf(v.currentTarget);S=f.loop?TN(S,C+1):S.slice(C+1)}setTimeout(()=>Nf(S))}}),children:typeof l=="function"?l({isCurrentTabStop:u,hasTabStop:b!=null}):l})})});Cf.displayName=Sf;var _N={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function DN(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function AN(e,t,r){const o=DN(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return _N[o]}function Nf(e,t=!1){const r=document.activeElement;for(const o of e)if(o===r||(o.focus({preventScroll:t}),document.activeElement!==r))return}function TN(e,t){return e.map((r,o)=>e[(t+o)%e.length])}var MN=wf,IN=Cf;function PN(e,t){return g.useReducer((r,o)=>t[r][o]??r,e)}var Ao=e=>{const{present:t,children:r}=e,o=ON(t),n=typeof r=="function"?r({present:o.isPresent}):g.Children.only(r),a=Fe(o.ref,LN(n));return typeof r=="function"||o.isPresent?g.cloneElement(n,{ref:a}):null};Ao.displayName="Presence";function ON(e){const[t,r]=g.useState(),o=g.useRef(null),n=g.useRef(e),a=g.useRef("none"),l=e?"mounted":"unmounted",[i,c]=PN(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return g.useEffect(()=>{const d=za(o.current);a.current=i==="mounted"?d:"none"},[i]),it(()=>{const d=o.current,f=n.current;if(f!==e){const h=a.current,m=za(d);e?c("MOUNT"):m==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(f&&h!==m?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,c]),it(()=>{if(t){let d;const f=t.ownerDocument.defaultView??window,u=m=>{const b=za(o.current).includes(CSS.escape(m.animationName));if(m.target===t&&b&&(c("ANIMATION_END"),!n.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",d=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},h=m=>{m.target===t&&(a.current=za(o.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{f.clearTimeout(d),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:g.useCallback(d=>{o.current=d?getComputedStyle(d):null,r(d)},[])}}function za(e){return(e==null?void 0:e.animationName)||"none"}function LN(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 Ba="Tabs",[$N]=ur(Ba,[xf]),Ef=xf(),[FN,Ti]=$N(Ba),kf=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,onValueChange:n,defaultValue:a,orientation:l="horizontal",dir:i,activationMode:c="automatic",...d}=e,f=ua(i),[u,h]=hr({prop:o,onChange:n,defaultProp:a??"",caller:Ba});return s.jsx(FN,{scope:r,baseId:Dr(),value:u,onValueChange:h,orientation:l,dir:f,activationMode:c,children:s.jsx(Ne.div,{dir:f,"data-orientation":l,...d,ref:t})})});kf.displayName=Ba;var _f="TabsList",Df=g.forwardRef((e,t)=>{const{__scopeTabs:r,loop:o=!0,...n}=e,a=Ti(_f,r),l=Ef(r);return s.jsx(MN,{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})})});Df.displayName=_f;var Af="TabsTrigger",Tf=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,disabled:n=!1,...a}=e,l=Ti(Af,r),i=Ef(r),c=Pf(l.baseId,o),d=Of(l.baseId,o),f=o===l.value;return s.jsx(IN,{asChild:!0,...i,focusable:!n,active:f,children:s.jsx(Ne.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":d,"data-state":f?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:c,...a,ref:t,onMouseDown:we(e.onMouseDown,u=>{!n&&u.button===0&&u.ctrlKey===!1?l.onValueChange(o):u.preventDefault()}),onKeyDown:we(e.onKeyDown,u=>{[" ","Enter"].includes(u.key)&&l.onValueChange(o)}),onFocus:we(e.onFocus,()=>{const u=l.activationMode!=="manual";!f&&!n&&u&&l.onValueChange(o)})})})});Tf.displayName=Af;var Mf="TabsContent",If=g.forwardRef((e,t)=>{const{__scopeTabs:r,value:o,forceMount:n,children:a,...l}=e,i=Ti(Mf,r),c=Pf(i.baseId,o),d=Of(i.baseId,o),f=o===i.value,u=g.useRef(f);return g.useEffect(()=>{const h=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(h)},[]),s.jsx(Ao,{present:n||f,children:({present:h})=>s.jsx(Ne.div,{"data-state":f?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:d,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:h&&a})})});If.displayName=Mf;function Pf(e,t){return`${e}-trigger-${t}`}function Of(e,t){return`${e}-content-${t}`}var GN=kf,Lf=Df,$f=Tf,Ff=If;const VN=GN,Gf=g.forwardRef(({className:e,...t},r)=>s.jsx(Lf,{ref:r,className:p("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Gf.displayName=Lf.displayName;const Ua=g.forwardRef(({className:e,...t},r)=>s.jsx($f,{ref:r,className:p("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}));Ua.displayName=$f.displayName;const Wa=g.forwardRef(({className:e,...t},r)=>s.jsx(Ff,{ref:r,className:p("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Wa.displayName=Ff.displayName;var Ha="Collapsible",[zN,Vf]=ur(Ha),[BN,Mi]=zN(Ha),zf=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,open:o,defaultOpen:n,disabled:a,onOpenChange:l,...i}=e,[c,d]=hr({prop:o,defaultProp:n??!1,onChange:l,caller:Ha});return s.jsx(BN,{scope:r,disabled:a,contentId:Dr(),open:c,onOpenToggle:g.useCallback(()=>d(f=>!f),[d]),children:s.jsx(Ne.div,{"data-state":Li(c),"data-disabled":a?"":void 0,...i,ref:t})})});zf.displayName=Ha;var Bf="CollapsibleTrigger",Ii=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,...o}=e,n=Mi(Bf,r);return s.jsx(Ne.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":Li(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...o,ref:t,onClick:we(e.onClick,n.onOpenToggle)})});Ii.displayName=Bf;var Pi="CollapsibleContent",Oi=g.forwardRef((e,t)=>{const{forceMount:r,...o}=e,n=Mi(Pi,e.__scopeCollapsible);return s.jsx(Ao,{present:r||n.open,children:({present:a})=>s.jsx(UN,{...o,ref:t,present:a})})});Oi.displayName=Pi;var UN=g.forwardRef((e,t)=>{const{__scopeCollapsible:r,present:o,children:n,...a}=e,l=Mi(Pi,r),[i,c]=g.useState(o),d=g.useRef(null),f=Fe(t,d),u=g.useRef(0),h=u.current,m=g.useRef(0),y=m.current,b=l.open||i,v=g.useRef(b),w=g.useRef(void 0);return g.useEffect(()=>{const x=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(x)},[]),it(()=>{const x=d.current;if(x){w.current=w.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const S=x.getBoundingClientRect();u.current=S.height,m.current=S.width,v.current||(x.style.transitionDuration=w.current.transitionDuration,x.style.animationName=w.current.animationName),c(o)}},[l.open,o]),s.jsx(Ne.div,{"data-state":Li(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!b,...a,ref:f,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...e.style},children:b&&n})});function Li(e){return e?"open":"closed"}var Uf=zf,WN=Ii,HN=Oi;const Wf=Uf,Hf=Ii,jf=Oi;var jN=Symbol.for("react.lazy"),ja=g[" use ".trim().toString()];function YN(e){return typeof e=="object"&&e!==null&&"then"in e}function Yf(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===jN&&"_payload"in e&&YN(e._payload)}function qf(e){const t=QN(e),r=g.forwardRef((o,n)=>{let{children:a,...l}=o;Yf(a)&&typeof ja=="function"&&(a=ja(a._payload));const i=g.Children.toArray(a),c=i.find(XN);if(c){const d=c.props.children,f=i.map(u=>u===c?g.Children.count(d)>1?g.Children.only(null):g.isValidElement(d)?d.props.children:null:u);return s.jsx(t,{...l,ref:n,children:g.isValidElement(d)?g.cloneElement(d,void 0,f):null})}return s.jsx(t,{...l,ref:n,children:a})});return r.displayName=`${e}.Slot`,r}var qN=qf("Slot");function QN(e){const t=g.forwardRef((r,o)=>{let{children:n,...a}=r;if(Yf(n)&&typeof ja=="function"&&(n=ja(n._payload)),g.isValidElement(n)){const l=ZN(n),i=JN(a,n.props);return n.type!==g.Fragment&&(i.ref=o?Jo(o,l):l),g.cloneElement(n,i)}return g.Children.count(n)>1?g.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var KN=Symbol("radix.slottable");function XN(e){return g.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===KN}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 ZN(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 RN=Va("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=g.forwardRef(({className:e,variant:t,size:r,asChild:o=!1,...n},a)=>{const l=o?qN:"button";return s.jsx(l,{className:p(RN({variant:t,size:r,className:e})),ref:a,...n})});Be.displayName="Button";var eE=Symbol("radix.slottable");function tE(e){const t=({children:r})=>s.jsx(s.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=eE,t}var[Ya]=ur("Tooltip",[Sa]),qa=Sa(),Qf="TooltipProvider",rE=700,$i="tooltip.open",[oE,Fi]=Ya(Qf),Kf=e=>{const{__scopeTooltip:t,delayDuration:r=rE,skipDelayDuration:o=300,disableHoverableContent:n=!1,children:a}=e,l=g.useRef(!0),i=g.useRef(!1),c=g.useRef(0);return g.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),s.jsx(oE,{scope:t,isOpenDelayedRef:l,delayDuration:r,onOpen:g.useCallback(()=>{window.clearTimeout(c.current),l.current=!1},[]),onClose:g.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>l.current=!0,o)},[o]),isPointerInTransitRef:i,onPointerInTransitChange:g.useCallback(d=>{i.current=d},[]),disableHoverableContent:n,children:a})};Kf.displayName=Qf;var an="Tooltip",[nE,sn]=Ya(an),Xf=e=>{const{__scopeTooltip:t,children:r,open:o,defaultOpen:n,onOpenChange:a,disableHoverableContent:l,delayDuration:i}=e,c=Fi(an,e.__scopeTooltip),d=qa(t),[f,u]=g.useState(null),h=Dr(),m=g.useRef(0),y=l??c.disableHoverableContent,b=i??c.delayDuration,v=g.useRef(!1),[w,x]=hr({prop:o,defaultProp:n??!1,onChange:M=>{M?(c.onOpen(),document.dispatchEvent(new CustomEvent($i))):c.onClose(),a==null||a(M)},caller:an}),S=g.useMemo(()=>w?v.current?"delayed-open":"instant-open":"closed",[w]),C=g.useCallback(()=>{window.clearTimeout(m.current),m.current=0,v.current=!1,x(!0)},[x]),k=g.useCallback(()=>{window.clearTimeout(m.current),m.current=0,x(!1)},[x]),E=g.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{v.current=!0,x(!0),m.current=0},b)},[b,x]);return g.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),s.jsx(op,{...d,children:s.jsx(nE,{scope:t,contentId:h,open:w,stateAttribute:S,trigger:f,onTriggerChange:u,onTriggerEnter:g.useCallback(()=>{c.isOpenDelayedRef.current?E():C()},[c.isOpenDelayedRef,E,C]),onTriggerLeave:g.useCallback(()=>{y?k():(window.clearTimeout(m.current),m.current=0)},[k,y]),onOpen:C,onClose:k,disableHoverableContent:y,children:r})})};Xf.displayName=an;var Gi="TooltipTrigger",Jf=g.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=sn(Gi,r),a=Fi(Gi,r),l=qa(r),i=g.useRef(null),c=Fe(t,i,n.onTriggerChange),d=g.useRef(!1),f=g.useRef(!1),u=g.useCallback(()=>d.current=!1,[]);return g.useEffect(()=>()=>document.removeEventListener("pointerup",u),[u]),s.jsx(np,{asChild:!0,...l,children:s.jsx(Ne.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...o,ref:c,onPointerMove:we(e.onPointerMove,h=>{h.pointerType!=="touch"&&!f.current&&!a.isPointerInTransitRef.current&&(n.onTriggerEnter(),f.current=!0)}),onPointerLeave:we(e.onPointerLeave,()=>{n.onTriggerLeave(),f.current=!1}),onPointerDown:we(e.onPointerDown,()=>{n.open&&n.onClose(),d.current=!0,document.addEventListener("pointerup",u,{once:!0})}),onFocus:we(e.onFocus,()=>{d.current||n.onOpen()}),onBlur:we(e.onBlur,n.onClose),onClick:we(e.onClick,n.onClose)})})});Jf.displayName=Gi;var Vi="TooltipPortal",[aE,sE]=Ya(Vi,{forceMount:void 0}),Zf=e=>{const{__scopeTooltip:t,forceMount:r,children:o,container:n}=e,a=sn(Vi,t);return s.jsx(aE,{scope:t,forceMount:r,children:s.jsx(Ao,{present:r||a.open,children:s.jsx(di,{asChild:!0,container:n,children:o})})})};Zf.displayName=Vi;var To="TooltipContent",Rf=g.forwardRef((e,t)=>{const r=sE(To,e.__scopeTooltip),{forceMount:o=r.forceMount,side:n="top",...a}=e,l=sn(To,e.__scopeTooltip);return s.jsx(Ao,{present:o||l.open,children:l.disableHoverableContent?s.jsx(eh,{side:n,...a,ref:t}):s.jsx(lE,{side:n,...a,ref:t})})}),lE=g.forwardRef((e,t)=>{const r=sn(To,e.__scopeTooltip),o=Fi(To,e.__scopeTooltip),n=g.useRef(null),a=Fe(t,n),[l,i]=g.useState(null),{trigger:c,onClose:d}=r,f=n.current,{onPointerInTransitChange:u}=o,h=g.useCallback(()=>{i(null),u(!1)},[u]),m=g.useCallback((y,b)=>{const v=y.currentTarget,w={x:y.clientX,y:y.clientY},x=pE(w,v.getBoundingClientRect()),S=fE(w,x),C=hE(b.getBoundingClientRect()),k=gE([...S,...C]);i(k),u(!0)},[u]);return g.useEffect(()=>()=>h(),[h]),g.useEffect(()=>{if(c&&f){const y=v=>m(v,f),b=v=>m(v,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",b),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",b)}}},[c,f,m,h]),g.useEffect(()=>{if(l){const y=b=>{const v=b.target,w={x:b.clientX,y:b.clientY},x=(c==null?void 0:c.contains(v))||(f==null?void 0:f.contains(v)),S=!mE(w,l);x?h():S&&(h(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,l,d,h]),s.jsx(eh,{...e,ref:a})}),[iE,cE]=Ya(an,{isInside:!1}),dE=tE("TooltipContent"),eh=g.forwardRef((e,t)=>{const{__scopeTooltip:r,children:o,"aria-label":n,onEscapeKeyDown:a,onPointerDownOutside:l,...i}=e,c=sn(To,r),d=qa(r),{onClose:f}=c;return g.useEffect(()=>(document.addEventListener($i,f),()=>document.removeEventListener($i,f)),[f]),g.useEffect(()=>{if(c.trigger){const u=h=>{const m=h.target;m!=null&&m.contains(c.trigger)&&f()};return window.addEventListener("scroll",u,{capture:!0}),()=>window.removeEventListener("scroll",u,{capture:!0})}},[c.trigger,f]),s.jsx(ql,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:u=>u.preventDefault(),onDismiss:f,children:s.jsxs(ap,{"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(dE,{children:o}),s.jsx(iE,{scope:r,isInside:!0,children:s.jsx(iS,{id:c.contentId,role:"tooltip",children:n||o})})]})})});Rf.displayName=To;var th="TooltipArrow",uE=g.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=qa(r);return cE(th,r).isInside?null:s.jsx(sp,{...n,...o,ref:t})});uE.displayName=th;function pE(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 fE(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 hE(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 mE(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,f=i.y,u=c.x,h=c.y;f>o!=h>o&&r<(u-d)*(o-f)/(h-f)+d&&(n=!n)}return n}function gE(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),bE(t)}function bE(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 yE=Kf,vE=Xf,xE=Jf,wE=Zf,rh=Rf;const Qa=yE,ar=vE,sr=xE,Yt=g.forwardRef(({className:e,sideOffset:t=4,...r},o)=>s.jsx(wE,{children:s.jsx(rh,{ref:o,sideOffset:t,className:p("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=rh.displayName;const zi=g.forwardRef(({className:e,children:t,...r},o)=>s.jsx("div",{ref:o,className:p("relative overflow-hidden",e),...r,children:s.jsx("div",{className:p("h-full w-full overflow-auto rounded-[inherit]"),children:t})}));zi.displayName="ScrollArea";const SE=g.forwardRef(({className:e,orientation:t="vertical",...r},o)=>s.jsx("div",{ref:o,className:p("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:p("relative flex-1 rounded-full bg-border")})}));SE.displayName="ScrollBar";function oh(e){return{order:99,disabled:!1,hidden:!1,...e}}function CE(e){return e.map((t,r)=>oh({...t,order:t.order??100+r}))}function nh(e,t){return typeof e.disabled=="function"?e.disabled(t):e.disabled??!1}function ah(e,t){return typeof e.hidden=="function"?e.hidden(t):e.hidden??!1}const NE=({element:e,onAddElement:t,isDisabled:r=!1,disabledReason:o,wizardExists:n=!1})=>{const a=Z(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:p("text-lg flex-shrink-0"),children:e.icon});const u=e.icon;return s.jsx(u,{className:p("w-5 h-5 flex-shrink-0")})},f=s.jsxs("div",{draggable:!r,onDragStart:l,onDragEnd:i,onClick:c,className:p("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:p("flex-1 min-w-0"),children:[s.jsx("div",{className:p("text-xs font-medium text-foreground truncate"),children:e.label}),r&&s.jsx("div",{className:p("text-xs text-orange-500 truncate"),children:"Already added"})]})]});return r&&o?s.jsx(Qa,{children:s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:f}),s.jsx(Yt,{children:s.jsx("p",{children:o})})]})}):s.jsx(Qa,{children:s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:f}),s.jsx(Yt,{children:s.jsxs("div",{className:p("max-w-xs"),children:[s.jsx("p",{className:p("font-medium"),children:e.label}),s.jsx("p",{className:p("text-xs text-muted-foreground"),children:e.description}),s.jsx("p",{className:p("text-xs mt-1 text-muted-foreground/70"),children:n?"Drag into wizard step":"Drag or click to add"})]})})]})})},sh=({label:e,elements:t,searchQuery:r,onAddElement:o,defaultExpanded:n=!1,hasWizard:a=!1,wizardExists:l=!1})=>{const[i,c]=N.useState(n),d=N.useMemo(()=>{if(!r.trim())return t;const u=r.toLowerCase();return t.filter(h=>h.label.toLowerCase().includes(u)||h.description.toLowerCase().includes(u)||h.searchKeywords&&h.searchKeywords.some(m=>m.toLowerCase().includes(u)))},[t,r]);if(r&&d.length===0)return null;const f=r?!0:i;return s.jsxs(Wf,{open:f,onOpenChange:c,className:p("mb-2"),children:[s.jsx(Hf,{asChild:!0,children:s.jsxs(Be,{variant:"ghost",className:p("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:p("flex items-center gap-1"),children:[s.jsx(_i,{variant:"secondary",className:p("font-normal normal-case text-xs"),children:d.length}),s.jsx(Do,{className:p("h-4 w-4 transition-transform",f&&"rotate-180")})]})]})}),s.jsx(jf,{children:s.jsx("div",{className:p("grid grid-cols-2 gap-1.5 mt-1.5"),children:d.map(u=>s.jsx(NE,{element:u,onAddElement:o,isDisabled:u.type==="pages"&&a,disabledReason:"Only one wizard can be added per form",wizardExists:l},u.type))})})]})},lh=({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:p("text-center py-8 text-muted-foreground text-sm"),children:[s.jsx("div",{className:p("text-3xl mb-2"),children:"🔍"}),s.jsxs("p",{children:['No elements found for "',e,'"']}),s.jsx("p",{className:p("text-xs mt-1 text-muted-foreground/70"),children:"Try a different search term"})]}),EE=({sidebarTabs:e=[]})=>{const[t,r]=N.useState("fields"),[o,n]=N.useState(""),a=Z(A=>A.addElement),l=Z(A=>A.hasWizard),i=Z(A=>A.schema),c=Z(A=>A.mode),d=Z(A=>A.loadSchema),f=Z(A=>A.exportSchema),u=Z(A=>A.resetForm),h=Z(A=>A.updateFormTitle),m=Z(A=>A.updateFormDescription),y=Z(A=>A.updateElement),b=Z(A=>A.deleteElement),v=Z(A=>A.selectElement),w=Z(A=>A.setMode),x=A=>{S&&A!=="pages"||a(A)},S=l(),C=N.useMemo(()=>{const A=Ke.getGroups(),W=A.filter(G=>G.elements.some(Q=>Q.category==="field")),$=A.filter(G=>G.elements.some(Q=>Q.category==="page"));return{fieldGroups:W,pageGroups:$}},[]),k=N.useMemo(()=>Ke.getByCategory("field"),[]),E=N.useMemo(()=>Ke.getByCategory("page"),[]),M=["textInput","selection","heading","layout","special"],_=N.useMemo(()=>({schema:i,mode:c,actions:{addElement:a,loadSchema:d,exportSchema:f,resetForm:u,updateFormTitle:h,updateFormDescription:m,updateElement:y,deleteElement:b,selectElement:v,setMode:w}}),[i,c,a,d,f,u,h,m,y,b,v,w]),I=N.useMemo(()=>e.length?[...e].filter(A=>!ah(A,_)).sort((A,W)=>(A.order??99)-(W.order??99)):[],[e,_]);return s.jsxs("div",{className:p("w-72 bg-muted/50 border-r border-border flex flex-col h-full flex-shrink-0"),children:[S&&s.jsx("div",{className:p("p-2 bg-orange-50 border-b border-orange-200"),children:s.jsxs("div",{className:p("flex items-start gap-2 text-xs text-orange-700"),children:[s.jsx("span",{className:p("text-base"),children:"📑"}),s.jsxs("div",{children:[s.jsx("p",{className:p("font-medium"),children:"Wizard Mode Active"}),s.jsx("p",{className:p("text-orange-600"),children:"Drop elements inside wizard steps, not on the main canvas."})]})]})}),s.jsx("div",{className:p("p-3 border-b border-border bg-card"),children:s.jsxs("div",{className:p("relative"),children:[s.jsx(OC,{className:p("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:A=>n(A.target.value),className:p("pl-9 pr-8")}),o&&s.jsx(Be,{variant:"ghost",size:"icon",className:p("absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6"),onClick:()=>n(""),children:s.jsx(Oa,{className:p("h-4 w-4")})})]})}),s.jsxs(VN,{value:t,onValueChange:r,className:p("flex-1 flex flex-col min-h-0 overflow-hidden"),children:[s.jsx(zi,{"aria-disabled":!0,children:s.jsxs(Gf,{className:p("w-full rounded-none border-b border-border bg-card h-auto p-0 flex-shrink-0"),children:[s.jsxs(Ua,{value:"fields",className:p("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 (",k.length,")"]}),s.jsxs(Ua,{value:"pages",className:p("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 (",E.length,")"]}),I.map(A=>{const W=A.icon;return s.jsxs(Ua,{value:A.id,className:p("flex-1 rounded-none border-b-2 border-transparent data-[state=active]:border-primary data-[state=active]:bg-primary/5 py-2.5"),disabled:nh(A,_),children:[W&&s.jsx(W,{className:p("h-3.5 w-3.5 mr-1")}),A.label]},A.id)})]})}),s.jsxs("div",{className:p("flex-1 min-h-0 relative"),children:[s.jsx(Wa,{value:"fields",className:p("absolute inset-0 mt-0 data-[state=inactive]:hidden overflow-auto"),children:s.jsxs("div",{className:p("p-3"),children:[C.fieldGroups.map(A=>s.jsx(sh,{label:A.label,elements:A.elements.filter(W=>W.category==="field"),searchQuery:o,onAddElement:x,defaultExpanded:M.includes(A.id),wizardExists:S},A.id)),o&&s.jsx(lh,{searchQuery:o,elements:k})]})}),s.jsx(Wa,{value:"pages",className:p("absolute inset-0 mt-0 data-[state=inactive]:hidden overflow-auto"),children:s.jsxs("div",{className:p("p-3"),children:[C.pageGroups.map(A=>s.jsx(sh,{label:A.label,elements:A.elements.filter(W=>W.category==="page"),searchQuery:o,onAddElement:x,defaultExpanded:M.includes(A.id),hasWizard:S,wizardExists:S},A.id)),o&&s.jsx(lh,{searchQuery:o,elements:E})]})}),I.map(A=>{const W=A.content;return s.jsx(Wa,{value:A.id,className:p("absolute inset-0 mt-0 data-[state=inactive]:hidden overflow-auto"),children:s.jsx(W,{..._})},A.id)})]})]})]})},kE=["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 _E(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=DE(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=TE(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 DE(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)`}):kE.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=AE(l);return n.push(...i),n}function AE(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 TE(e,t){var a,l,i,c;const r=[],o=e.logic;if(!o)return r;const n=(d,f)=>{d&&d.forEach((u,h)=>{u.field?t.has(u.field)||r.push({type:"warning",elementId:e.id,message:`${f} rule ${h+1}: References unknown field "${u.field}"`}):r.push({type:"warning",elementId:e.id,message:`${f} rule ${h+1}: Missing field reference`}),u.operator||r.push({type:"warning",elementId:e.id,message:`${f} rule ${h+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 ME(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=_E(t);return{schema:r.valid?t:null,validation:r}}function IE(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 PE(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 ih(e){return{order:0,variant:"ghost",disabled:!1,hidden:!1,...e}}function OE(e){return e.map((t,r)=>ih({...t,order:t.order??r}))}function ch(e,t){return typeof e.disabled=="function"?e.disabled(t):e.disabled??!1}function Bi(e,t){return typeof e.hidden=="function"?e.hidden(t):e.hidden??!1}class LE{constructor(){kl(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 LE;function $E(e){Tt.register(e)}function FE(e){for(const t of e)Tt.register(t)}function GE(e){return Tt.unregister(e)}function VE(e){return Tt.get(e)}function zE(e){return Tt.has(e)}const to=({action:e,context:t})=>{const r=e.icon,o=ch(e,t),n=async()=>{o||await e.onClick(t)},a=p(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:p("h-5 w-5")})})}),s.jsx(Yt,{children:s.jsx("p",{children:e.label})})]})},BE=({schema:e,canUndo:t,canRedo:r,onUndo:o,onRedo:n,onExport:a,exportSchema:l,onImport:i,onReset:c,mode:d,onModeChange:f,toolbarConfig:u})=>{const h=N.useRef(null),m=N.useMemo(()=>({schema:e,mode:d,canUndo:t,canRedo:r,actions:{undo:o,redo:n,loadSchema:i,exportSchema:l,setMode:f,resetForm:c}}),[e,d,t,r,o,n,i,l,f,c]),y=()=>{var E;(E=h.current)==null||E.click()},b=E=>{var _;const M=(_=E.target.files)==null?void 0:_[0];if(M){const I=new FileReader;I.onload=A=>{var W;try{const $=(W=A.target)==null?void 0:W.result,{schema:G,validation:Q}=ME($);if(!Q.valid){const H=PE(Q),K=Q.errors.filter(B=>B.type==="error").slice(0,5).map(B=>`• ${B.message}`).join(`
172
+ `);if(window.confirm(`Schema validation failed (${H}):
173
+
174
+ ${K}
175
+
176
+ Would you like to attempt to import anyway? The schema will be sanitized.`)){const B=JSON.parse($),fe=IE(B);i(fe)}return}const ee=Q.errors.filter(H=>H.type==="warning");ee.length>0&&console.warn("Schema import warnings:",ee),i(G)}catch($){console.error("Failed to import schema:",$),alert("Invalid JSON file. Please select a valid form schema.")}},I.readAsText(M)}h.current&&(h.current.value="")},v=new Set((u==null?void 0:u.hideBuiltinActions)??[]);(u==null?void 0:u.showUndoRedo)===!1&&(v.add("undo"),v.add("redo")),(u==null?void 0:u.showModeToggle)===!1&&(v.add("design-mode"),v.add("preview-mode")),(u==null?void 0:u.showImportExport)===!1&&(v.add("import"),v.add("export")),(u==null?void 0:u.showReset)===!1&&v.add("reset");const w=new Map,x=(u==null?void 0:u.actions)??[];x.forEach(E=>{E.override&&w.set(E.override,E)});const S=N.useMemo(()=>{const E={left:[],center:[],right:[]};return x.filter(M=>!M.override&&!Bi(M,m)).forEach(M=>{E[M.position].push(M)}),Object.values(E).forEach(M=>{M.sort((_,I)=>(_.order??0)-(I.order??0))}),E},[x,m]),C=E=>!(v.has(E)||w.has(E)),k=(E,M)=>{if(v.has(E))return null;const _=w.get(E);return _&&!Bi(_,m)?s.jsx(to,{action:_,context:m},E):M()};return s.jsx(Qa,{children:s.jsxs("div",{className:p("flex items-center justify-between px-4 py-2 bg-card border-b border-border"),children:[s.jsxs("div",{className:p("flex items-center gap-1"),children:[S.left.filter(E=>(E.order??0)<0).map(E=>s.jsx(to,{action:E,context:m},E.id)),k("undo",()=>C("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($C,{className:p("h-5 w-5")})})}),s.jsx(Yt,{children:s.jsx("p",{children:"Undo (⌘Z)"})})]},"undo"):null),k("redo",()=>C("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(PC,{className:p("h-5 w-5")})})}),s.jsx(Yt,{children:s.jsx("p",{children:"Redo (⌘⇧Z)"})})]},"redo"):null),S.left.filter(E=>(E.order??0)>=0).map(E=>s.jsx(to,{action:E,context:m},E.id))]}),s.jsxs("div",{className:p("flex items-center gap-2"),children:[S.center.filter(E=>(E.order??0)<0).map(E=>s.jsx(to,{action:E,context:m},E.id)),(u==null?void 0:u.showModeToggle)!==!1&&Tt.getVisible().length>0&&s.jsx("div",{className:p("flex items-center bg-muted rounded-lg p-1"),children:Tt.getVisible().map(E=>{const M=`${E.id}-mode`;if(v.has(M))return null;const _=E.icon,I=d===E.id;return s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:I?"secondary":"ghost",size:"icon",onClick:()=>f(E.id),className:p(I&&"bg-background shadow-sm"),children:s.jsx(_,{className:p("h-5 w-5")})})}),s.jsx(Yt,{children:s.jsx("p",{children:E.description??E.label})})]},E.id)})}),S.center.filter(E=>(E.order??0)>=0).map(E=>s.jsx(to,{action:E,context:m},E.id))]}),s.jsxs("div",{className:p("flex items-center gap-1"),children:[S.right.filter(E=>(E.order??0)<0).map(E=>s.jsx(to,{action:E,context:m},E.id)),s.jsx("input",{ref:h,type:"file",accept:".json",onChange:b,className:p("hidden")}),k("import",()=>C("import")?s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:"ghost",size:"icon",onClick:y,children:s.jsx(FC,{className:p("h-5 w-5")})})}),s.jsx(Yt,{children:s.jsx("p",{children:"Import"})})]},"import"):null),k("export",()=>C("export")?s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:"ghost",size:"icon",onClick:a,children:s.jsx(TC,{className:p("h-5 w-5")})})}),s.jsx(Yt,{children:s.jsx("p",{children:"Export"})})]},"export"):null),k("reset",()=>C("reset")?s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:"ghost",size:"icon",className:p("text-destructive hover:text-destructive hover:bg-destructive/10"),onClick:c,children:s.jsx(Ci,{className:p("h-5 w-5")})})}),s.jsx(Yt,{children:s.jsx("p",{children:"Reset"})})]},"reset"):null),S.right.filter(E=>(E.order??0)>=0).map(E=>s.jsx(to,{action:E,context:m},E.id))]})]})})},ln=({containerId:e,stepId:t,label:r="Drop elements here",children:o,isEmpty:n=!0})=>{const[a,l]=N.useState(!1),i=N.useRef(null),c=Z(m=>m.addElementToContainer),d=Z(m=>m.setDraggedElementType),f=m=>{m.preventDefault();const b=m.currentTarget.querySelectorAll("[data-drop-zone]");for(const v of b){const w=v.getBoundingClientRect();if(m.clientX>=w.left&&m.clientX<=w.right&&m.clientY>=w.top&&m.clientY<=w.bottom){l(!1);return}}m.stopPropagation(),l(!0)},u=m=>{m.preventDefault();const y=m.relatedTarget,b=m.currentTarget;if(y&&b.contains(y)){const v=y.closest("[data-drop-zone]");v&&v!==b&&l(!1);return}m.stopPropagation(),l(!1)},h=m=>{m.preventDefault();const b=m.currentTarget.querySelectorAll("[data-drop-zone]");for(const w of b){const x=w.getBoundingClientRect();if(m.clientX>=x.left&&m.clientX<=x.right&&m.clientY>=x.top&&m.clientY<=x.bottom){l(!1);return}}m.stopPropagation(),l(!1);const v=m.dataTransfer.getData("elementType");v&&(c(v,e,t),d(null))};return s.jsx("div",{ref:i,"data-drop-zone":e,"data-step-id":t,onDragOver:f,onDragLeave:u,onDrop:h,className:p("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:p("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:p("space-y-2 p-2"),children:o})})},dh=e=>{const t=gf(e);if(!t)return"📋";if(typeof t=="string")return t;const r=t;return s.jsx(r,{className:p("w-4 h-4 inline-block")})},Ka=({element:e,isSelected:t,isHovered:r,onSelect:o,onHover:n,onDelete:a})=>{const l=()=>e.type==="group"?s.jsx(uh,{element:e}):e.type==="grid"?s.jsx(ph,{element:e}):e.type==="repeatGroup"?s.jsx(fh,{element:e}):s.jsx(Fa,{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:p("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:p("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:[dh(e.type)," ",ki(e.type)]}),(t||r)&&s.jsx("button",{onClick:c=>{c.stopPropagation(),a()},className:p("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()]})},UE=({element:e,index:t,isSelected:r,isHovered:o,onSelect:n,onHover:a,onDelete:l,onDuplicate:i,onDragStart:c,onDragOver:d,onDragEnd:f,isDragTarget:u})=>{const h=()=>e.type==="group"?s.jsx(uh,{element:e}):e.type==="grid"?s.jsx(ph,{element:e}):e.type==="repeatGroup"?s.jsx(fh,{element:e}):e.type==="pages"?s.jsx(WE,{element:e}):s.jsx(Fa,{element:e,isSelected:r}),m=v=>{v.dataTransfer.effectAllowed="move",v.dataTransfer.setData("elementId",e.id),c(t)},y=v=>{v.preventDefault(),v.dataTransfer.dropEffect="move",d(t)},b=()=>{f()};return s.jsxs("div",{draggable:!0,onDragStart:m,onDragOver:y,onDragEnd:b,onClick:n,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),className:p("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-gray-200 bg-white hover:border-gray-300"),children:[u&&s.jsx("div",{className:p("absolute -top-1 left-0 right-0 h-0.5 bg-blue-500 rounded")}),(r||o)&&s.jsxs("div",{className:p("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:[dh(e.type)," ",ki(e.type)]}),(r||o)&&s.jsxs("div",{className:p("absolute -top-3 right-3 flex gap-1"),children:[s.jsx("button",{onClick:v=>{v.stopPropagation(),i()},className:p("p-1 bg-white border border-gray-200 rounded shadow-sm hover:bg-gray-50 text-xs"),title:"Duplicate",children:"📋"}),s.jsx("button",{onClick:v=>{v.stopPropagation(),l()},className:p("p-1 bg-white border border-gray-200 rounded shadow-sm hover:bg-red-50 hover:border-red-200 text-xs"),title:"Delete",children:"🗑️"})]}),h(),(r||o)&&s.jsxs("div",{className:p("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:p("w-4 h-0.5 bg-gray-400 rounded")}),s.jsx("div",{className:p("w-4 h-0.5 bg-gray-400 rounded")}),s.jsx("div",{className:p("w-4 h-0.5 bg-gray-400 rounded")})]})]})},uh=({element:e})=>{var f;const t=e.properties.label||"Group",r=e.properties.description,o=Z(u=>u.schema.elements),n=Z(u=>u.selectedElementId),a=Z(u=>u.hoveredElementId),l=Z(u=>u.selectElement),i=Z(u=>u.setHoveredElementId),c=Z(u=>u.deleteElement),d=o.filter(u=>u.parentId===e.id).sort((u,h)=>u.order-h.order);return s.jsxs("div",{className:p("border border-gray-200 rounded-lg overflow-hidden"),style:{padding:((f=e.config)==null?void 0:f.padding)||16},children:[s.jsxs("div",{className:p("mb-3"),children:[s.jsx("h3",{className:p("font-medium text-gray-800"),children:t}),r&&s.jsx("p",{className:p("text-sm text-gray-500"),children:r})]}),s.jsx(ln,{containerId:e.id,label:"Drop elements into this group",isEmpty:d.length===0,children:d.map(u=>s.jsx(Ka,{element:u,isSelected:n===u.id,isHovered:a===u.id,onSelect:()=>l(u.id),onHover:h=>i(h?u.id:null),onDelete:()=>c(u.id)},u.id))})]})},ph=({element:e})=>{var f,u;const t=e.properties.label,r=((f=e.config)==null?void 0:f.gridColumns)||2,o=Z(h=>h.schema.elements),n=Z(h=>h.selectedElementId),a=Z(h=>h.hoveredElementId),l=Z(h=>h.selectElement),i=Z(h=>h.setHoveredElementId),c=Z(h=>h.deleteElement),d=o.filter(h=>h.parentId===e.id).sort((h,m)=>h.order-m.order);return s.jsxs("div",{className:p("border border-gray-200 rounded-lg p-4"),children:[t&&s.jsx("div",{className:p("mb-3"),children:s.jsx("h3",{className:p("font-medium text-gray-800"),children:t})}),s.jsx("div",{className:p("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((h,m)=>s.jsx(ln,{containerId:e.id,label:`Column ${m+1}`},m)):d.map(h=>s.jsx(Ka,{element:h,isSelected:n===h.id,isHovered:a===h.id,onSelect:()=>l(h.id),onHover:m=>i(m?h.id:null),onDelete:()=>c(h.id)},h.id))}),d.length>0&&d.length<r*3&&s.jsx("div",{className:p("mt-3"),children:s.jsx(ln,{containerId:e.id,label:"Add more elements"})})]})},fh=({element:e})=>{var f,u,h;const t=e.properties.label||"Repeat Group",r=e.properties.description,o=Z(m=>m.schema.elements),n=Z(m=>m.selectedElementId),a=Z(m=>m.hoveredElementId),l=Z(m=>m.selectElement),i=Z(m=>m.setHoveredElementId),c=Z(m=>m.deleteElement),d=o.filter(m=>m.parentId===e.id).sort((m,y)=>m.order-y.order);return s.jsxs("div",{className:p("border border-gray-200 rounded-lg p-4"),children:[s.jsxs("div",{className:p("mb-3"),children:[s.jsxs("div",{className:p("flex items-center gap-2"),children:[s.jsx("span",{className:p("text-lg"),children:"🔄"}),s.jsx("h3",{className:p("font-medium text-gray-800"),children:t})]}),r&&s.jsx("p",{className:p("text-sm text-gray-500"),children:r})]}),s.jsxs("div",{className:p("border border-dashed border-gray-300 rounded-lg p-3 bg-gray-50/50"),children:[s.jsx("div",{className:p("text-xs text-gray-500 mb-2 font-medium"),children:"📋 Item Template (will repeat)"}),s.jsx(ln,{containerId:e.id,label:"Drop elements to create the repeatable template",isEmpty:d.length===0,children:d.map(m=>s.jsx(Ka,{element:m,isSelected:n===m.id,isHovered:a===m.id,onSelect:()=>l(m.id),onHover:y=>i(y?m.id:null),onDelete:()=>c(m.id)},m.id))})]}),s.jsx("div",{className:p("mt-3"),children:s.jsxs("button",{disabled:!0,className:p("text-sm text-blue-600 hover:text-blue-700 flex items-center gap-1 opacity-70"),children:["➕ ",((f=e.config)==null?void 0:f.addButtonText)||"Add Item"]})}),s.jsxs("div",{className:p("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:"," ",((h=e.config)==null?void 0:h.maxItems)||10," items"]})]})},WE=({element:e})=>{var C,k,E,M;const t=Z(_=>_.schema.elements),r=Z(_=>_.selectedElementId),o=Z(_=>_.hoveredElementId),n=Z(_=>_.selectElement),a=Z(_=>_.setHoveredElementId),l=Z(_=>_.deleteElement),i=Z(_=>_.addWizardStep),c=Z(_=>_.updateWizardStep),d=Z(_=>_.removeWizardStep),f=Z(_=>_.setActiveWizardStep),u=((C=e.config)==null?void 0:C.steps)||[],h=((k=e.config)==null?void 0:k.activeStepId)||((E=u[0])==null?void 0:E.id),m=u.findIndex(_=>_.id===h),y=u[m],b=m===u.length-1,v=t.filter(_=>{var I;return _.parentId?_.parentId===`${e.id}:${h}`||_.parentId===e.id&&((I=_.config)==null?void 0:I.wizardStepId)===h:!1}).sort((_,I)=>_.order-I.order),w=()=>{const _={id:oa(),label:`Step ${u.length+1}`,description:""};i(e.id,_)},x=()=>{m>0&&f(e.id,u[m-1].id)},S=()=>{m<u.length-1&&f(e.id,u[m+1].id)};return s.jsxs("div",{className:p("border border-gray-200 rounded-lg overflow-hidden"),children:[s.jsxs("div",{className:p("bg-gray-50 border-b border-gray-200 p-3"),children:[s.jsxs("div",{className:p("flex items-center gap-2 mb-2"),children:[s.jsx("span",{className:p("text-lg"),children:"📑"}),s.jsx("h3",{className:p("font-medium text-gray-800"),children:e.properties.label||"Multi-Step Form"})]}),s.jsxs("div",{className:p("flex gap-1 flex-wrap"),children:[u.map((_,I)=>s.jsxs("button",{onClick:()=>f(e.id,_.id),className:p("px-3 py-1.5 text-sm rounded transition-colors",_.id===h?"bg-blue-500 text-white":"bg-white border border-gray-200 hover:bg-gray-100"),children:[I+1,". ",_.label]},_.id)),s.jsx("button",{onClick:w,className:p("px-3 py-1.5 text-sm border border-dashed border-gray-300 rounded hover:bg-gray-100 text-gray-500"),children:"+ Add Step"})]}),((M=e.config)==null?void 0:M.showProgressBar)&&s.jsxs("div",{className:p("mt-3"),children:[s.jsx("div",{className:p("h-2 bg-gray-200 rounded-full overflow-hidden"),children:s.jsx("div",{className:p("h-full bg-blue-500 transition-all"),style:{width:`${(m+1)/u.length*100}%`}})}),s.jsxs("div",{className:p("text-xs text-gray-500 mt-1"),children:["Step ",m+1," of ",u.length]})]})]}),s.jsx("div",{className:p("p-4"),children:y&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:p("mb-4"),children:[s.jsx("input",{type:"text",value:y.label,onChange:_=>c(e.id,h,{label:_.target.value}),className:p("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:y.description||"",onChange:_=>c(e.id,h,{description:_.target.value}),className:p("text-sm text-gray-500 border-none bg-transparent w-full focus:outline-none focus:ring-0"),placeholder:"Step description (optional)"})]}),s.jsx(ln,{containerId:e.id,stepId:h,label:"Drop elements for this step",isEmpty:v.length===0,children:v.map(_=>s.jsx(Ka,{element:_,isSelected:r===_.id,isHovered:o===_.id,onSelect:()=>n(_.id),onHover:I=>a(I?_.id:null),onDelete:()=>l(_.id)},_.id))}),s.jsxs("div",{className:p("flex justify-between mt-4 pt-4 border-t border-gray-200"),children:[s.jsx("button",{disabled:m===0,onClick:x,className:p("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:p("flex gap-2"),children:[u.length>1&&s.jsx("button",{onClick:()=>d(e.id,h),className:p("px-3 py-2 text-sm text-red-600 hover:bg-red-50 rounded"),children:"🗑️ Delete Step"}),s.jsx("button",{disabled:b,onClick:S,className:p("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:p("px-4 pb-4"),children:s.jsxs("div",{className:p("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."]})})]})},HE=()=>s.jsxs("div",{className:p("flex flex-col items-center justify-center h-full text-muted-foreground"),children:[s.jsx("div",{className:p("text-6xl mb-4"),children:"📝"}),s.jsx("h3",{className:p("text-lg font-medium text-foreground/70 mb-2"),children:"Start Building Your Form"}),s.jsx("p",{className:p("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."})]}),jE=({toolbarConfig:e})=>{const t=Z(F=>F.schema),r=Z(F=>F.selectedElementId),o=Z(F=>F.hoveredElementId),n=Z(F=>F.addElement),a=Z(F=>F.selectElement),l=Z(F=>F.deleteElement),i=Z(F=>F.duplicateElement),c=Z(F=>F.reorderElements),d=Z(F=>F.setHoveredElementId),f=Z(F=>F.undo),u=Z(F=>F.redo),h=Z(F=>F.canUndo),m=Z(F=>F.canRedo),y=Z(F=>F.exportSchema),b=Z(F=>F.loadSchema),v=Z(F=>F.resetForm),w=Z(F=>F.mode),x=Z(F=>F.setMode),S=Z(F=>F.hasWizard),[C,k]=N.useState(!1),[E,M]=N.useState(null),[_,I]=N.useState(null),A=S(),W=F=>{if(F.preventDefault(),A){F.dataTransfer.dropEffect="none";return}F.dataTransfer.dropEffect="copy",k(!0)},$=F=>{F.currentTarget.contains(F.relatedTarget)||k(!1)},G=F=>{if(F.preventDefault(),k(!1),A)return;const q=F.dataTransfer.getData("elementType");q&&n(q)},Q=()=>{const F=y(),q=new Blob([JSON.stringify(F,null,2)],{type:"application/json"}),re=URL.createObjectURL(q),he=document.createElement("a");he.href=re,he.download=`${t.title.replace(/\s+/g,"-").toLowerCase()}-schema.json`,document.body.appendChild(he),he.click(),document.body.removeChild(he),URL.revokeObjectURL(re)},ee=F=>{b(F)},H=()=>{(t.elements.length===0||window.confirm("Are you sure you want to reset the form? This will delete all elements."))&&v()},K=F=>{F.target===F.currentTarget&&a(null)},O=[...t.elements].filter(F=>!F.parentId).sort((F,q)=>F.order-q.order),B=F=>{M(F)},fe=F=>{E!==null&&E!==F&&I(F)},be=()=>{E!==null&&_!==null&&E!==_&&c(E,_),M(null),I(null)};return s.jsxs("div",{className:p("flex-1 flex flex-col bg-gray-100 overflow-hidden"),children:[s.jsx(BE,{schema:t,canUndo:h(),canRedo:m(),onUndo:f,onRedo:u,onExport:Q,exportSchema:y,onImport:ee,onReset:H,mode:w,onModeChange:x,toolbarConfig:e}),s.jsx("div",{className:p("flex-1 overflow-auto p-4",C&&!A?"bg-blue-50":""),onDragOver:W,onDragLeave:$,onDrop:G,onClick:K,children:s.jsxs("div",{className:p("max-w-4xl mx-auto p-2"),children:[s.jsx("div",{className:p("mb-0 text-center"),children:t.description&&s.jsx("p",{className:p("text-gray-500"),children:t.description})}),s.jsx("div",{className:p("bg-white rounded-xl shadow-sm border-2 transition-colors",C&&!A?"border-blue-400 border-dashed":"border-gray-200"),children:O.length===0?s.jsx("div",{className:p("p-2"),children:s.jsx(HE,{})}):s.jsx("div",{className:p("p-4 space-y-2"),children:O.map((F,q)=>s.jsx(UE,{element:F,index:q,isSelected:r===F.id,isHovered:o===F.id,onSelect:()=>a(F.id),onHover:re=>d(re?F.id:null),onDelete:()=>l(F.id),onDuplicate:()=>i(F.id),onDragStart:B,onDragOver:fe,onDragEnd:be,isDragTarget:_===q},F.id))})}),C&&!A&&s.jsx("div",{className:p("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"}),A&&C&&s.jsx("div",{className:p("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 hh=Symbol.for("immer-nothing"),mh=Symbol.for("immer-draftable"),yt=Symbol.for("immer-state"),YE=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=YE[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,Xa="constructor",Ja="prototype",Ui="configurable",Za="enumerable",Ra="writable",cn="value",Pr=e=>!!e&&!!e[yt];function mr(e){var t;return e?bh(e)||rs(e)||!!e[mh]||!!((t=e[Xa])!=null&&t[mh])||os(e)||ns(e):!1}var qE=It[Ja][Xa].toString(),gh=new WeakMap;function bh(e){if(!e||!Hi(e))return!1;const t=Mo(e);if(t===null||t===It[Ja])return!0;const r=It.hasOwnProperty.call(t,Xa)&&t[Xa];if(r===Object)return!0;if(!ro(r))return!1;let o=gh.get(r);return o===void 0&&(o=Function.toString.call(r),gh.set(r,o)),o===qE}function es(e,t,r=!0){dn(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 dn(e){const t=e[yt];return t?t.type_:rs(e)?1:os(e)?2:ns(e)?3:0}var yh=(e,t,r=dn(e))=>r===2?e.has(t):It[Ja].hasOwnProperty.call(e,t),Wi=(e,t,r=dn(e))=>r===2?e.get(t):e[t],ts=(e,t,r,o=dn(e))=>{o===2?e.set(t,r):o===3?e.add(r):e[t]=r};function QE(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var rs=Array.isArray,os=e=>e instanceof Map,ns=e=>e instanceof Set,Hi=e=>typeof e=="object",ro=e=>typeof e=="function",ji=e=>typeof e=="boolean";function KE(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var gr=e=>e.copy_||e.base_,Yi=e=>e.modified_?e.copy_:e.base_;function qi(e,t){if(os(e))return new Map(e);if(ns(e))return new Set(e);if(rs(e))return Array[Ja].slice.call(e);const r=bh(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[Ra]===!1&&(i[Ra]=!0,i[Ui]=!0),(i.get||i.set)&&(o[l]={[Ui]:!0,[Ra]:!0,[Za]:i[Za],[cn]: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 Qi(e,t=!1){return ss(e)||Pr(e)||!mr(e)||(dn(e)>1&&It.defineProperties(e,{set:as,add:as,clear:as,delete:as}),It.freeze(e),t&&es(e,(r,o)=>{Qi(o,!0)},!1)),e}function XE(){Mt(2)}var as={[cn]:XE};function ss(e){return e===null||!Hi(e)?!0:It.isFrozen(e)}var ls="MapSet",Ki="Patches",vh="ArrayMethods",xh={};function oo(e){const t=xh[e];return t||Mt(0,e),t}var wh=e=>!!xh[e],un,Sh=()=>un,JE=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:wh(ls)?oo(ls):void 0,arrayMethodsPlugin_:wh(vh)?oo(vh):void 0});function Ch(e,t){t&&(e.patchPlugin_=oo(Ki),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Xi(e){Ji(e),e.drafts_.forEach(ZE),e.drafts_=null}function Ji(e){e===un&&(un=e.parent_)}var Nh=e=>un=JE(un,e);function ZE(e){const t=e[yt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Eh(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[yt].modified_&&(Xi(t),Mt(4)),mr(e)&&(e=kh(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[yt].base_,e,t)}else e=kh(t,r);return RE(t,e,!0),Xi(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==hh?e:void 0}function kh(e,t){if(ss(t))return t;const r=t[yt];if(!r)return cs(t,e.handledSet_,e);if(!is(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);Ah(r,e)}return r.copy_}function RE(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Qi(t,r)}function _h(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var is=(e,t)=>e.scope_===t,ek=[];function Dh(e,t,r,o){const n=gr(e),a=e.type_;if(o!==void 0&&Wi(n,o,a)===t){ts(n,o,r,a);return}if(!e.draftLocations_){const i=e.draftLocations_=new Map;es(n,(c,d)=>{if(Pr(d)){const f=i.get(d)||[];f.push(c),i.set(d,f)}})}const l=e.draftLocations_.get(t)??ek;for(const i of l)ts(n,i,r,a)}function tk(e,t,r){e.callbacks_.push(function(n){var i;const a=t;if(!a||!is(a,n))return;(i=n.mapSetPlugin_)==null||i.fixSetContents(a);const l=Yi(a);Dh(e,a.draft_??a,l,r),Ah(a,n)})}function Ah(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)}_h(e)}}function rk(e,t,r){const{scope_:o}=e;if(Pr(r)){const n=r[yt];is(n,o)&&n.callbacks_.push(function(){us(e);const l=Yi(n);Dh(e,r,l,t)})}else mr(r)&&e.callbacks_.push(function(){const a=gr(e);e.type_===3?a.has(r)&&cs(r,o.handledSet_,o):Wi(a,t,e.type_)===r&&o.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&cs(Wi(e.copy_,t,e.type_),o.handledSet_,o)})}function cs(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Pr(e)||t.has(e)||!mr(e)||ss(e)||(t.add(e),es(e,(o,n)=>{if(Pr(n)){const a=n[yt];if(is(a,r)){const l=Yi(a);ts(e,o,l,e.type_),_h(a)}}else mr(n)&&cs(n,t,r)})),e}function ok(e,t){const r=rs(e),o={type_:r?1:0,scope_:t?t.scope_:Sh(),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=ds;r&&(n=[o],a=pn);const{revoke:l,proxy:i}=Proxy.revocable(n,a);return o.draft_=i,o.revoke_=l,[i,o]}var ds={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(!yh(n,t,e.type_))return nk(e,n,t);const a=n[t];if(e.finalized_||!mr(a)||o&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&KE(t))return a;if(a===Zi(e.base_,t)){us(e);const l=e.type_===1?+t:t,i=ec(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=Th(gr(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const n=Zi(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(QE(r,n)&&(r!==void 0||yh(e.base_,t,e.type_)))return!0;us(e),Ri(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),rk(e,t,r)),!0},deleteProperty(e,t){return us(e),Zi(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Ri(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&&{[Ra]:!0,[Ui]:e.type_!==1||t!=="length",[Za]:o[Za],[cn]:r[t]}},defineProperty(){Mt(11)},getPrototypeOf(e){return Mo(e.base_)},setPrototypeOf(){Mt(12)}},pn={};for(let e in ds){let t=ds[e];pn[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}pn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Mt(13),pn.set.call(this,e,t,void 0)},pn.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Mt(14),ds.set.call(this,e[0],t,r,e[0])};function Zi(e,t){const r=e[yt];return(r?gr(r):e)[t]}function nk(e,t,r){var n;const o=Th(t,r);return o?cn in o?o[cn]:(n=o.get)==null?void 0:n.call(e.draft_):void 0}function Th(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 Ri(e){e.modified_||(e.modified_=!0,e.parent_&&Ri(e.parent_))}function us(e){e.copy_||(e.assigned_=new Map,e.copy_=qi(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var ak=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,...f){return i.produce(d,u=>o.call(this,u,...f))}}ro(o)||Mt(6),n!==void 0&&!ro(n)&&Mt(7);let a;if(mr(r)){const l=Nh(this),i=ec(l,r,void 0);let c=!0;try{a=o(i),c=!1}finally{c?Xi(l):Ji(l)}return Ch(l,n),Eh(a,l)}else if(!r||!Hi(r)){if(a=o(r),a===void 0&&(a=r),a===hh&&(a=void 0),this.autoFreeze_&&Qi(a,!0),n){const l=[],i=[];oo(Ki).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]},ji(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),ji(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),ji(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){mr(t)||Mt(8),Pr(t)&&(t=sk(t));const r=Nh(this),o=ec(r,t,void 0);return o[yt].isManual_=!0,Ji(r),o}finishDraft(t,r){const o=t&&t[yt];(!o||!o.isManual_)&&Mt(9);const{scope_:n}=o;return Ch(n,r),Eh(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(Ki).applyPatches_;return Pr(t)?n(t,r):this.produce(t,a=>n(a,r))}};function ec(e,t,r,o){const[n,a]=os(t)?oo(ls).proxyMap_(t,r):ns(t)?oo(ls).proxySet_(t,r):ok(t,r);return((r==null?void 0:r.scope_)??Sh()).drafts_.push(n),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=o,r&&o!==void 0?tk(r,a,o):a.callbacks_.push(function(c){var f;(f=c.mapSetPlugin_)==null||f.fixSetContents(a);const{patchPlugin_:d}=c;a.modified_&&d&&d.generatePatches_(a,[],c)}),n}function sk(e){return Pr(e)||Mt(10,e),Mh(e)}function Mh(e){if(!mr(e)||ss(e))return e;const t=e[yt];let r,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=qi(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else r=qi(e,!0);return es(r,(n,a)=>{ts(r,n,Mh(a))},o),t&&(t.finalized_=!1),r}var lk=new ak,br=lk.produce,Ih={"¼":"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/"},tc=/^(?=-?\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)?)?$/,ik=new RegExp(tc.source.replace(/\$$/,"(?:\\s*[^\\.\\d\\/].*)?")),ck=new RegExp(`(${Object.keys(Ih).join("|")})`),ps={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},Ph={"Ⅰ":"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"},dk=new RegExp(`(${Object.keys(Ph).join("|")})`,"gi"),uk=/^(?=[MDCLXVI])(M{0,3})(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$/i,Oh={round:3,allowTrailingInvalid:!1,romanNumerals:!1,bigIntOnOverflow:!1},pk=e=>{const t=`${e}`.replace(dk,(i,c)=>Ph[c]).toUpperCase(),r=uk.exec(t);if(!r)return NaN;const[,o,n,a,l]=r;return(ps[o]??0)+(ps[n]??0)+(ps[a]??0)+(ps[l]??0)},fk=/^\s*\//;function hk(e,t=Oh){if(typeof e=="number"||typeof e=="bigint")return e;let r=NaN;const o=`${e}`.replace(ck,(h,m)=>` ${Ih[m]}`).replace("⁄","/").trim();if(o.length===0)return NaN;const n={...Oh,...t},a=(n.allowTrailingInvalid?ik:tc).exec(o);if(!a)return n.romanNumerals?pk(o):NaN;const[,l,i,c]=a,d=i.replace(/[,_]/g,""),f=c==null?void 0:c.replace(/[,_]/g,"");if(!d&&f&&f.startsWith("."))r=0;else{if(n.bigIntOnOverflow){const h=BigInt(l?`-${d}`:d);if(h>BigInt(Number.MAX_SAFE_INTEGER)||h<BigInt(Number.MIN_SAFE_INTEGER))return h}r=parseInt(d)}if(!f)return l?r*-1:r;const u=n.round===!1?NaN:parseFloat(`1e${Math.floor(Math.max(0,n.round))}`);if(f.startsWith(".")||f.startsWith("e")||f.startsWith("E")){const h=parseFloat(`${r}${f}`);r=isNaN(u)?h:Math.round(h*u)/u}else if(fk.test(f)){const h=parseInt(d),m=parseInt(f.replace("/",""));r=isNaN(u)?h/m:Math.round(h*u/m)/u}else{const h=f.split("/"),[m,y]=h.map(b=>parseInt(b));r+=isNaN(u)?m/y:Math.round(m*u/y)/u}return l?r*-1:r}const fs="~",Or="------",Le={fields:{title:"Field",placeholderName:fs,placeholderLabel:Or,placeholderGroupLabel:Or},operators:{title:"Operator",placeholderName:fs,placeholderLabel:Or,placeholderGroupLabel:Or},values:{title:"Values",placeholderName:fs,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"}},rc=",",Lh={"=":"=","!=":"!=","<":"<",">":">","<=":"<=",">=":">=",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"},mk={and:"AND",or:"OR",xor:"XOR"},gk=[{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"}],fn=[{name:"and",value:"and",label:"AND"},{name:"or",value:"or",label:"OR"}];[...fn];const $h=[{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"}],ue={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"},bk={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:""},pe={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"},Fh=[],yk={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},vk=(e,t=rc)=>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)],[]):[],oc=(e,t=rc)=>e.map(r=>`${r??""}`.replaceAll(t[0],`\\${t[0]}`)).join(t),xk=e=>typeof e=="string"?e.trim():e,hs=(e,{retainEmptyStrings:t}={})=>Array.isArray(e)?e.map(r=>xk(r)):typeof e=="string"?vk(e,rc).filter(t?()=>!0:r=>!/^\s*$/.test(r)).map(r=>r.trim()):typeof e=="number"?[e]:[];function Gh(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=Gh(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=Gh(r))&&(n&&(n+=" "),n+=o);return n}const hn=e=>typeof e=="string"?e.toLowerCase():e;new RegExp(tc.source.replace(/^\^/,String.raw`^\s*`).replace(/\$$/,String.raw`\s*$`));const Lr=e=>e===null||typeof e!="object"?!1:Object.getPrototypeOf(e)===Object.prototype,Ge=e=>Lr(e)&&Array.isArray(e.rules),mn=e=>Ge(e)&&typeof e.combinator=="string",gn=e=>Ge(e)&&e.combinator===void 0,wk=Object.keys,Vh=Object.entries,nc=e=>Lr(e)&&"name"in e&&typeof e.name=="string",ac=e=>Lr(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(nc(o)&&!ac(o)?(n.value=o.name,a=!0):!nc(o)&&ac(o)&&(n.name=o.value,a=!0),a)return Object.assign({},t,o,n)})(e)}function ms(e,t,r){return Array.isArray(e)?br(o=>{if($r(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 zh(e,t){return Object.fromEntries(Object.entries(e).map(([r,o])=>[r,lr(o,t)]))}const Bh=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},Sk=e=>Array.isArray(e)&&e.length>0&&Lr(e[0])&&"options"in e[0]&&Array.isArray(e[0].options),gs=e=>{let t=!1;if(Array.isArray(e))for(const r of e)if(nc(r)||ac(r))t=!0;else return!1;return t},$r=(e,{allowEmpty:t=!1}={})=>{let r=!1;if(Array.isArray(e))for(const o of e)if(Lr(o)&&"options"in o&&(gs(o.options)||t&&Array.isArray(o.options)&&o.options.length===0))r=!0;else return!1;return r};function Io(e,t){return($r(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($r(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 Uh=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},bn=e=>{const{optionList:t,baseOption:r={},labelMap:o={},placeholder:{placeholderName:n=fs,placeholderLabel:a=Or,placeholderGroupLabel:l=Or}={},autoSelectOption:i=!0}=e,c={id:n,name:n,value:n,label:a},d=t??[c];let f;const u=Array.isArray(d)?ms(d,r,o):wk(zh(d,r)).map(m=>({...d[m],name:m,value:m})).sort((m,y)=>m.label.localeCompare(y.label));$r(u)?f=Uh(i?u:[{label:l,options:[c]},...u]):f=Bh(i?u:[c,...u]);let h={};if(Array.isArray(d))if($r(f))for(const m of f)for(const y of m.options)h[y.value??y.name]=lr(y,r);else for(const m of f)h[m.value??m.name]=lr(m,r);else{const m=zh(d,r);h=i?m:{...m,[n]:c}}return{defaultOption:c,optionList:f,optionsMap:h}},Wh=(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},Hh=(e,t,r)=>{if(!e.comparator){const o=n=>(n.value??n.name)!==(e.value??e.name);return $r(t)?t.map(n=>({...n,options:n.options.filter(a=>o(a))})):t.filter(n=>o(n))}return $r(t)?t.map(o=>({...o,options:o.options.filter(n=>Wh(e,r,n))})).filter(o=>o.options.length>0):t.filter(o=>Wh(e,r,o))},bs=(e,{parseNumbers:t,bigIntOnOverflow:r}={})=>{if(!t||typeof e=="bigint"||typeof e=="number")return e;if(t==="native")return Number.parseFloat(e);const o=hk(e,{allowTrailingInvalid:t==="enhanced",bigIntOnOverflow:r,romanNumerals:!1,round:!1});return typeof o=="bigint"||!Number.isNaN(o)?o:e},Ck=({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},Nk=e=>{const{mode:t,threshold:r}=e.match??{};if(!t)return null;if(!Ge(e.value))return!1;const o=hn(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},jh=(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=jh(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]),Yh=(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]];Lr(a)&&(Ge(a)||"field"in a&&a.field)&&(r=!!a.disabled,o=a),n++}return r},Ek=e=>no([],e.path)?"Query builder":`Rule group at path ${e.path.join("-")}`,yn=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(yn){if(typeof yn.randomUUID=="function")zt=()=>yn.randomUUID();else if(typeof yn.getRandomValues=="function"){const e="89ab",t=new Uint32Array(32);zt=()=>{yn.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 kk={name:"name",value:"name",matchModes:null,label:"label"},_k=(e,t)=>{const r=e?lr(e):kk;let o=r.matchModes??!1;return!o&&t&&(o=t(r.value,{fieldData:r})),o===!0?$h:o===!1?[]:gs(o)?ms(o):(o==null?void 0:o.map(n=>$h.find(a=>a.value===hn(n))??{name:n,value:n,label:n}))??[]},qh=e=>{const t=typeof e=="boolean"?e:typeof e=="object"&&e!==null?e.valid:null;return typeof t=="boolean"?t?ue.valid:ue.invalid:""},Qh=[{name:"value",value:"value",label:"value"}],Dk={name:"name",value:"name",valueSources:null,label:"label"},Kh=(e,t,r)=>{const o=e?lr(e):Dk;let n=o.valueSources??!1;return typeof n=="function"&&(n=n(t)),!n&&r&&(n=r(o.value,t,{fieldData:o})),n?gs(n)?ms(n):n.map(a=>Qh.find(l=>l.value===hn(a))??{name:a,value:a,label:a}):Qh},$e=(e,t,r)=>{const o=Vh(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]))),Ak=(...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)}),Tk=(e,t)=>e===!1?!1:e?!0:t!==!1,Mk=(e,t)=>e?!0:e===!1?!1:!!t,Xh=(e,t,r,o)=>o?t??r:e?Tk(t,r):Mk(t,r),Ik=(e={},t={},r)=>Vh(yk).reduce((o,[n,a])=>(o[n]=Xh(a,e[n],t[n],!1),o),{}),Jh=(e,{idGenerator:t=zt}={})=>br(e,r=>{r.id||(r.id=t()),Nk(r)&&(r.value=ys(r.value,{idGenerator:t}))}),ys=(e,{idGenerator:t=zt}={})=>br(e,r=>{r.id||(r.id=t()),r.rules=r.rules.map(o=>typeof o=="string"?o:Ge(o)?ys(o,{idGenerator:t}):Jh(o,{idGenerator:t}))}),Zh=(e,{idGenerator:t=zt}={})=>Ge(e)?ys(e,{idGenerator:t}):Jh(e,{idGenerator:t}),Pk=(e,{idGenerator:t=zt}={})=>structuredClone({...e,id:t()}),sc=(e,{idGenerator:t=zt}={})=>{if(!Lr(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)?sc(o,{idGenerator:t}):Pk(o,{idGenerator:t}))),r},Rh=(e,t,r,{combinators:o=fn,combinatorPreceding:n,idGenerator:a=zt}={})=>br(e,l=>{const i=Array.isArray(r)?Xe(r,l):jh(r,l);if(!(!i||!Ge(i))){if(gn(i)&&i.rules.length>0){const c=i.rules.at(-2);i.rules.push(n??(typeof c=="string"?c:ct(o)))}i.rules.push(Zh(t,{idGenerator:a}))}}),Ok=(e,t,r,o,{resetOnFieldChange:n=!0,resetOnOperatorChange:a=!1,getRuleDefaultOperator:l=()=>"=",getValueSources:i=()=>["value"],getRuleDefaultValue:c=()=>"",getMatchModes:d=()=>[]}={})=>br(e,f=>{var w;const u=Array.isArray(o)?o:Po(o,f);if(!u)return;if(t==="combinator"&&!mn(f)){const x=Xe(qe(u),f).rules;u.at(-1)%2===1&&(x[u.at(-1)]=r);return}const h=Xe(u,f);if(!h)return;const m=Ge(h);if(h[t]===r||(t!=="valueSource"&&(h[t]=r),m))return;let y=!1,b=!1;if(t==="field"){const x=d(h.field),S=d(r);if(S.length===0)delete h.match;else{const C=(w=h.match)!=null&&w.mode&&Io(S,h.match.mode)?null:ct(S);C&&(h.match={mode:C,threshold:1})}(x.length>0||S.length>0)&&(n=!0)}n&&t==="field"&&(h.operator=l(r),y=!0,b=!0),a&&t==="operator"&&(y=!0,b=!0);const v=ct(Kh({name:h.field,value:h.field,label:""},h.operator,i));(y&&h.valueSource&&v!==h.valueSource||t==="valueSource"&&r!==h.valueSource)&&(b=!!h.valueSource||!h.valueSource&&r!==v,h.valueSource=y?v:r),b&&(h.value=c(h))}),Lk=(e,t)=>{const r=Array.isArray(t)?t:Po(t,e);return!r||r.length===0||!mn(e)&&!Xe(r,e)?e:br(e,o=>{const n=r.at(-1),a=Xe(qe(r),o);if(a&&Ge(a))if(!mn(a)&&a.rules.length>1){const l=n===0?0:n-1;a.rules.splice(l,2)}else a.rules.splice(n,1)})},em=(e,t,r)=>{if(Array.isArray(r))return r;const o=gn(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},$k=(e,t,r,{clone:o=!1,combinators:n=fn,idGenerator:a=zt}={})=>{const l=Array.isArray(t)?t:Po(t,e);if(!l)return e;const i=em(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?sc(c,{idGenerator:a}):c;return br(e,f=>{const u=gn(f),h=Xe(qe(l),f),m=l.at(-1),y=u&&m>0?h.rules[m-1]:null,b=u&&m<h.rules.length-1?h.rules[m+1]:null;if(!o){const k=u?Math.max(0,m-1):m,E=u?2:1;h.rules.splice(k,E)}const v=[...i],w=Yh(l,i);!o&&l.length===w.length+1&&i[w.length]>l[w.length]&&(v[w.length]-=u?2:1);const x=Xe(qe(v),f),S=v.at(-1),C=(...k)=>x.rules.splice(S,0,...k);x.rules.length===0||!u?C(d):S===0?m===0&&b?C(d,b):C(d,x.rules[1]??y??ct(n)):C(y||(x.rules[S-2]??b??ct(n)),d)})},Fk=(e,t,r,{clone:o=!1,combinators:n=fn,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=em(e,l,i);if(l.length===0||no(l,c)||!Xe(qe(c),e))return e;const d=Xe(l,e),f=Xe(i,e);if(!d||!f)return e;const u=o?sc(d,{idGenerator:a}):d;return br(e,h=>{const m=gn(h),y=Xe(qe(l),h),b=l.at(-1);if(!o){const C=m?Math.max(0,b-1):b,k=m?2:1;y.rules.splice(C,k)}const v=[...c],w=Yh(l,c);!o&&l.length===w.length+1&&c[w.length]>l[w.length]&&(v[w.length]-=m?2:1);const x=Xe(qe(v),h),S=v.at(-1);x.rules.splice(S,1,Zh(m?{rules:[f,ct(n),u]}:{combinator:ct(n),rules:[f,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 Gk=typeof Symbol=="function"&&Symbol.observable||"@@observable",tm=Gk,lc=()=>Math.random().toString(36).substring(7).split("").join("."),Vk={INIT:`@@redux/INIT${lc()}`,REPLACE:`@@redux/REPLACE${lc()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${lc()}`},ao=Vk;function vn(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 zk(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(Wk(e))return"date";if(Uk(e))return"error";const r=Bk(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 Bk(e){return typeof e.constructor=="function"?e.constructor.name:null}function Uk(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function Wk(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=zk(e)),t}function rm(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(rm)(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((v,w)=>{l.set(w,v)}))}function f(){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(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?dt(4):`Expected the listener to be a function. Instead, received: '${Fr(v)}'`);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 w=!0;d();const x=i++;return l.set(x,v),function(){if(w){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.");w=!1,d(),l.delete(x),a=null}}}function h(v){if(!vn(v))throw new Error(process.env.NODE_ENV==="production"?dt(7):`Actions must be plain objects. Instead, the actual type was: '${Fr(v)}'. 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 v.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 v.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(v.type)}'. Value was: '${v.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,v)}finally{c=!1}return(a=l).forEach(x=>{x()}),v}function m(v){if(typeof v!="function")throw new Error(process.env.NODE_ENV==="production"?dt(10):`Expected the nextReducer to be a function. Instead, received: '${Fr(v)}`);o=v,h({type:ao.REPLACE})}function y(){const v=u;return{subscribe(w){if(typeof w!="object"||w===null)throw new Error(process.env.NODE_ENV==="production"?dt(11):`Expected the observer to be an object. Instead, received: '${Fr(w)}'`);function x(){const C=w;C.next&&C.next(f())}return x(),{unsubscribe:v(x)}},[tm](){return this}}}return h({type:ao.INIT}),{dispatch:h,subscribe:u,getState:f,replaceReducer:m,[tm]:y}}function om(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function Hk(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(!vn(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 jk(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 nm(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"&&om(`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{jk(r)}catch(l){a=l}return function(i={},c){if(a)throw a;if(process.env.NODE_ENV!=="production"){const u=Hk(i,r,c,n);u&&om(u)}let d=!1;const f={};for(let u=0;u<o.length;u++){const h=o[u],m=r[h],y=i[h],b=m(y,c);if(typeof b>"u"){const v=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?dt(14):`When called with an action of type ${v?`"${String(v)}"`:"(unknown type)"}, the slice reducer for key "${h}" 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.`)}f[h]=b,d=d||b!==y}return d=d||o.length!==Object.keys(i).length,d?f:i}}function vs(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...o)=>t(r(...o)))}function Yk(...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=vs(...i)(n.dispatch),{...n,dispatch:a}}}function am(e){return vn(e)&&"type"in e&&typeof e.type=="string"}var sm=Symbol.for("immer-nothing"),lm=Symbol.for("immer-draftable"),vt=Symbol.for("immer-state"),qk=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=qk[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,Lo=Ot.getPrototypeOf,xs="constructor",ws="prototype",ic="configurable",Ss="enumerable",Cs="writable",xn="value",yr=e=>!!e&&!!e[vt];function qt(e){var t;return e?cm(e)||ks(e)||!!e[lm]||!!((t=e[xs])!=null&&t[lm])||_s(e)||Ds(e):!1}var Qk=Ot[ws][xs].toString(),im=new WeakMap;function cm(e){if(!e||!dc(e))return!1;const t=Lo(e);if(t===null||t===Ot[ws])return!0;const r=Ot.hasOwnProperty.call(t,xs)&&t[xs];if(r===Object)return!0;if(!so(r))return!1;let o=im.get(r);return o===void 0&&(o=Function.toString.call(r),im.set(r,o)),o===Qk}function Ns(e,t,r=!0){wn(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 wn(e){const t=e[vt];return t?t.type_:ks(e)?1:_s(e)?2:Ds(e)?3:0}var dm=(e,t,r=wn(e))=>r===2?e.has(t):Ot[ws].hasOwnProperty.call(e,t),cc=(e,t,r=wn(e))=>r===2?e.get(t):e[t],Es=(e,t,r,o=wn(e))=>{o===2?e.set(t,r):o===3?e.add(r):e[t]=r};function Kk(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var ks=Array.isArray,_s=e=>e instanceof Map,Ds=e=>e instanceof Set,dc=e=>typeof e=="object",so=e=>typeof e=="function",uc=e=>typeof e=="boolean";function Xk(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var vr=e=>e.copy_||e.base_,pc=e=>e.modified_?e.copy_:e.base_;function fc(e,t){if(_s(e))return new Map(e);if(Ds(e))return new Set(e);if(ks(e))return Array[ws].slice.call(e);const r=cm(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[Cs]===!1&&(i[Cs]=!0,i[ic]=!0),(i.get||i.set)&&(o[l]={[ic]:!0,[Cs]:!0,[Ss]:i[Ss],[xn]:e[l]})}return Ot.create(Lo(e),o)}else{const o=Lo(e);if(o!==null&&r)return{...e};const n=Ot.create(o);return Ot.assign(n,e)}}function hc(e,t=!1){return Ts(e)||yr(e)||!qt(e)||(wn(e)>1&&Ot.defineProperties(e,{set:As,add:As,clear:As,delete:As}),Ot.freeze(e),t&&Ns(e,(r,o)=>{hc(o,!0)},!1)),e}function Jk(){Pt(2)}var As={[xn]:Jk};function Ts(e){return e===null||!dc(e)?!0:Ot.isFrozen(e)}var Ms="MapSet",mc="Patches",um="ArrayMethods",pm={};function lo(e){const t=pm[e];return t||Pt(0,e),t}var fm=e=>!!pm[e],Sn,hm=()=>Sn,Zk=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:fm(Ms)?lo(Ms):void 0,arrayMethodsPlugin_:fm(um)?lo(um):void 0});function mm(e,t){t&&(e.patchPlugin_=lo(mc),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function gc(e){bc(e),e.drafts_.forEach(Rk),e.drafts_=null}function bc(e){e===Sn&&(Sn=e.parent_)}var gm=e=>Sn=Zk(Sn,e);function Rk(e){const t=e[vt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function bm(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[vt].modified_&&(gc(t),Pt(4)),qt(e)&&(e=ym(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[vt].base_,e,t)}else e=ym(t,r);return e1(t,e,!0),gc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==sm?e:void 0}function ym(e,t){if(Ts(t))return t;const r=t[vt];if(!r)return Ps(t,e.handledSet_,e);if(!Is(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);wm(r,e)}return r.copy_}function e1(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&hc(t,r)}function vm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Is=(e,t)=>e.scope_===t,t1=[];function xm(e,t,r,o){const n=vr(e),a=e.type_;if(o!==void 0&&cc(n,o,a)===t){Es(n,o,r,a);return}if(!e.draftLocations_){const i=e.draftLocations_=new Map;Ns(n,(c,d)=>{if(yr(d)){const f=i.get(d)||[];f.push(c),i.set(d,f)}})}const l=e.draftLocations_.get(t)??t1;for(const i of l)Es(n,i,r,a)}function r1(e,t,r){e.callbacks_.push(function(n){var i;const a=t;if(!a||!Is(a,n))return;(i=n.mapSetPlugin_)==null||i.fixSetContents(a);const l=pc(a);xm(e,a.draft_??a,l,r),wm(a,n)})}function wm(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)}vm(e)}}function o1(e,t,r){const{scope_:o}=e;if(yr(r)){const n=r[vt];Is(n,o)&&n.callbacks_.push(function(){Ls(e);const l=pc(n);xm(e,r,l,t)})}else qt(r)&&e.callbacks_.push(function(){const a=vr(e);e.type_===3?a.has(r)&&Ps(r,o.handledSet_,o):cc(a,t,e.type_)===r&&o.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Ps(cc(e.copy_,t,e.type_),o.handledSet_,o)})}function Ps(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||yr(e)||t.has(e)||!qt(e)||Ts(e)||(t.add(e),Ns(e,(o,n)=>{if(yr(n)){const a=n[vt];if(Is(a,r)){const l=pc(a);Es(e,o,l,e.type_),vm(a)}}else qt(n)&&Ps(n,t,r)})),e}function n1(e,t){const r=ks(e),o={type_:r?1:0,scope_:t?t.scope_:hm(),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=Os;r&&(n=[o],a=Cn);const{revoke:l,proxy:i}=Proxy.revocable(n,a);return o.draft_=i,o.revoke_=l,[i,o]}var Os={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(!dm(n,t,e.type_))return a1(e,n,t);const a=n[t];if(e.finalized_||!qt(a)||o&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&Xk(t))return a;if(a===yc(e.base_,t)){Ls(e);const l=e.type_===1?+t:t,i=xc(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=Sm(vr(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const n=yc(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(Kk(r,n)&&(r!==void 0||dm(e.base_,t,e.type_)))return!0;Ls(e),vc(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),o1(e,t,r)),!0},deleteProperty(e,t){return Ls(e),yc(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),vc(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&&{[Cs]:!0,[ic]:e.type_!==1||t!=="length",[Ss]:o[Ss],[xn]:r[t]}},defineProperty(){Pt(11)},getPrototypeOf(e){return Lo(e.base_)},setPrototypeOf(){Pt(12)}},Cn={};for(let e in Os){let t=Os[e];Cn[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Cn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Pt(13),Cn.set.call(this,e,t,void 0)},Cn.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Pt(14),Os.set.call(this,e[0],t,r,e[0])};function yc(e,t){const r=e[vt];return(r?vr(r):e)[t]}function a1(e,t,r){var n;const o=Sm(t,r);return o?xn in o?o[xn]:(n=o.get)==null?void 0:n.call(e.draft_):void 0}function Sm(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 vc(e){e.modified_||(e.modified_=!0,e.parent_&&vc(e.parent_))}function Ls(e){e.copy_||(e.assigned_=new Map,e.copy_=fc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var s1=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,...f){return i.produce(d,u=>o.call(this,u,...f))}}so(o)||Pt(6),n!==void 0&&!so(n)&&Pt(7);let a;if(qt(r)){const l=gm(this),i=xc(l,r,void 0);let c=!0;try{a=o(i),c=!1}finally{c?gc(l):bc(l)}return mm(l,n),bm(a,l)}else if(!r||!dc(r)){if(a=o(r),a===void 0&&(a=r),a===sm&&(a=void 0),this.autoFreeze_&&hc(a,!0),n){const l=[],i=[];lo(mc).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]},uc(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),uc(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),uc(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){qt(t)||Pt(8),yr(t)&&(t=l1(t));const r=gm(this),o=xc(r,t,void 0);return o[vt].isManual_=!0,bc(r),o}finishDraft(t,r){const o=t&&t[vt];(!o||!o.isManual_)&&Pt(9);const{scope_:n}=o;return mm(n,r),bm(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(mc).applyPatches_;return yr(t)?n(t,r):this.produce(t,a=>n(a,r))}};function xc(e,t,r,o){const[n,a]=_s(t)?lo(Ms).proxyMap_(t,r):Ds(t)?lo(Ms).proxySet_(t,r):n1(t,r);return((r==null?void 0:r.scope_)??hm()).drafts_.push(n),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=o,r&&o!==void 0?r1(r,a,o):a.callbacks_.push(function(c){var f;(f=c.mapSetPlugin_)==null||f.fixSetContents(a);const{patchPlugin_:d}=c;a.modified_&&d&&d.generatePatches_(a,[],c)}),n}function l1(e){return yr(e)||Pt(10,e),Cm(e)}function Cm(e){if(!qt(e)||Ts(e))return e;const t=e[vt];let r,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=fc(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else r=fc(e,!0);return Ns(r,(n,a)=>{Es(r,n,Cm(a))},o),t&&(t.finalized_=!1),r}var i1=new s1,Nm=i1.produce,c1=(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})}}},d1=(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(f){({stack:d}=f)}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})}},u1={inputStabilityCheck:"once",identityFunctionCheck:"once"};function p1(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function f1(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function h1(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 Em=e=>Array.isArray(e)?e:[e];function m1(e){const t=Array.isArray(e[0])?e[0]:e;return h1(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function km(e,t){const r=[],{length:o}=e;for(let n=0;n<o;n++)r.push(e[n].apply(null,t));return r}var g1=(e,t)=>{const{identityFunctionCheck:r,inputStabilityCheck:o}={...u1,...t};return{identityFunctionCheck:{shouldRun:r==="always"||r==="once"&&e,run:c1},inputStabilityCheck:{shouldRun:o==="always"||o==="once"&&e,run:d1}}},b1=class{constructor(e){this.value=e}deref(){return this.value}},y1=typeof WeakRef<"u"?WeakRef:b1,v1=0,_m=1;function $s(){return{s:v1,v:void 0,o:null,p:null}}function Dm(e,t={}){let r=$s();const{resultEqualityCheck:o}=t;let n,a=0;function l(){var u;let i=r;const{length:c}=arguments;for(let h=0,m=c;h<m;h++){const y=arguments[h];if(typeof y=="function"||typeof y=="object"&&y!==null){let b=i.o;b===null&&(i.o=b=new WeakMap);const v=b.get(y);v===void 0?(i=$s(),b.set(y,i)):i=v}else{let b=i.p;b===null&&(i.p=b=new Map);const v=b.get(y);v===void 0?(i=$s(),b.set(y,i)):i=v}}const d=i;let f;if(i.s===_m)f=i.v;else if(f=e.apply(null,arguments),a++,o){const h=((u=n==null?void 0:n.deref)==null?void 0:u.call(n))??n;h!=null&&o(h,f)&&(f=h,a!==0&&a--),n=typeof f=="object"&&f!==null||typeof f=="function"?new y1(f):f}return d.s=_m,d.v=f,f}return l.clearCache=()=>{r=$s(),l.resetResultsCount()},l.resultsCount=()=>a,l.resetResultsCount=()=>{a=0},l}function x1(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()),p1(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const f={...r,...c},{memoize:u,memoizeOptions:h=[],argsMemoize:m=Dm,argsMemoizeOptions:y=[],devModeChecks:b={}}=f,v=Em(h),w=Em(y),x=m1(n),S=u(function(){return a++,d.apply(null,arguments)},...v);let C=!0;const k=m(function(){l++;const M=km(x,arguments);if(i=S.apply(null,M),process.env.NODE_ENV!=="production"){const{identityFunctionCheck:_,inputStabilityCheck:I}=g1(C,b);if(_.shouldRun&&_.run(d,M,i),I.shouldRun){const A=km(x,arguments);I.run({inputSelectorResults:M,inputSelectorResultsCopy:A},{memoize:u,memoizeOptions:v},arguments)}C&&(C=!1)}return i},...w);return Object.assign(k,{resultFunc:d,memoizedResultFunc:S,dependencies:x,dependencyRecomputations:()=>l,resetDependencyRecomputations:()=>{l=0},lastResult:()=>i,recomputations:()=>a,resetRecomputations:()=>{a=0},memoize:u,argsMemoize:m})};return Object.assign(o,{withTypes:()=>o}),o}var w1=x1(Dm),S1=Object.assign((e,t=w1)=>{f1(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:()=>S1});function Am(e){return({dispatch:r,getState:o})=>n=>a=>typeof a=="function"?a(r,o,e):n(a)}var C1=Am(),N1=Am,E1=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?vs:vs.apply(null,arguments)},k1=e=>e&&typeof e.match=="function";function Tm(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=>am(o)&&o.type===e,r}function _1(e){return typeof e=="function"&&"type"in e&&k1(e)}function D1(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 A1(e={}){if(process.env.NODE_ENV==="production")return()=>r=>o=>r(o);const{isActionCreator:t=_1}=e;return()=>r=>o=>(t(o)&&console.warn(D1(o.type)),r(o))}function Mm(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 Im=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 Pm(e){return qt(e)?Nm(e,()=>{}):e}function Nn(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function T1(e){return typeof e!="object"||e==null||Object.isFrozen(e)}function M1(e,t,r){const o=Om(e,t,r);return{detectMutations(){return Lm(e,t,o,r)}}}function Om(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(f=>f instanceof RegExp?f.test(c):c===f)||(a.children[i]=Om(e,t,r[i],c))}}return a}function Lm(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 f in r.children)c[f]=!0;for(let f in o)c[f]=!0;const d=t.length>0;for(let f in c){const u=a?a+"."+f:f;if(d&&t.some(y=>y instanceof RegExp?y.test(u):u===y))continue;const h=Lm(e,t,r.children[f],o[f],i,u);if(h.wasMutated)return h}return{wasMutated:!1}}function I1(e={}){if(process.env.NODE_ENV==="production")return()=>t=>r=>t(r);{let t=function(i,c,d,f){return JSON.stringify(i,r(c,f),d)},r=function(i,c){let d=[],f=[];return c||(c=function(u,h){return d[0]===h?"[Circular ~]":"[Circular ~."+f.slice(0,d.indexOf(h)).join(".")+"]"}),function(u,h){if(d.length>0){var m=d.indexOf(this);~m?d.splice(m+1):d.push(this),~m?f.splice(m,1/0,u):f.push(u),~d.indexOf(h)&&(h=c.call(this,u,h))}else d.push(h);return i==null?h:i.call(this,u,h)}},{isImmutable:o=T1,ignoredPaths:n,warnAfter:a=32}=e;const l=M1.bind(null,o,n);return({getState:i})=>{let c=i(),d=l(c),f;return u=>h=>{const m=Mm(a,"ImmutableStateInvariantMiddleware");m.measureTime(()=>{if(c=i(),f=d.detectMutations(),d=l(c),f.wasMutated)throw new Error(process.env.NODE_ENV==="production"?Pe(19):`A state mutation was detected between dispatches, in the path '${f.path||""}'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)});const y=u(h);return m.measureTime(()=>{if(c=i(),f=d.detectMutations(),d=l(c),f.wasMutated)throw new Error(process.env.NODE_ENV==="production"?Pe(20):`A state mutation was detected inside a dispatch, in the path: ${f.path||""}. Take a look at the reducer(s) handling the action ${t(h)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`)}),m.warnIfExceeded(),y}}}}function $m(e){const t=typeof e;return e==null||t==="string"||t==="boolean"||t==="number"||Array.isArray(e)||vn(e)}function wc(e,t="",r=$m,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,f]of i){const u=t?t+"."+d:d;if(!(c&&n.some(m=>m instanceof RegExp?m.test(u):u===m))){if(!r(f))return{keyPath:u,value:f};if(typeof f=="object"&&(l=wc(f,u,r,o,n,a),l))return l}}return a&&Fm(e)&&a.add(e),!1}function Fm(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if(!(typeof t!="object"||t===null)&&!Fm(t))return!1;return!0}function P1(e={}){if(process.env.NODE_ENV==="production")return()=>t=>r=>t(r);{const{isSerializable:t=$m,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,f=!d&&WeakSet?new WeakSet:void 0;return u=>h=>m=>{if(!am(m))return h(m);const y=h(m),b=Mm(l,"SerializableStateInvariantMiddleware");return!c&&!(o.length&&o.indexOf(m.type)!==-1)&&b.measureTime(()=>{const v=wc(m,"",t,r,n,f);if(v){const{keyPath:w,value:x}=v;console.error(`A non-serializable value was detected in an action, in the path: \`${w}\`. Value:`,x,`
186
+ Take a look at the logic that dispatched this action: `,m,`
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||(b.measureTime(()=>{const v=u.getState(),w=wc(v,"",t,r,a,f);if(w){const{keyPath:x,value:S}=w;console.error(`A non-serializable value was detected in the state, in the path: \`${x}\`. Value:`,S,`
189
+ Take a look at the reducer(s) handling this action type: ${m.type}.
190
+ (See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}}),b.warnIfExceeded()),y}}}function Fs(e){return typeof e=="boolean"}var O1=()=>function(t){const{thunk:r=!0,immutableCheck:o=!0,serializableCheck:n=!0,actionCreatorCheck:a=!0}=t??{};let l=new Im;if(r&&(Fs(r)?l.push(C1):l.push(N1(r.extraArgument))),process.env.NODE_ENV!=="production"){if(o){let i={};Fs(o)||(i=o),l.unshift(I1(i))}if(n){let i={};Fs(n)||(i=n),l.push(P1(i))}if(a){let i={};Fs(a)||(i=a),l.unshift(A1(i))}}return l},L1="RTK_autoBatch",Gm=e=>t=>{setTimeout(t,e)},$1=(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:Gm(10):e.type==="callback"?e.queueNotification:Gm(e.timeout),d=()=>{l=!1,a&&(a=!1,i.forEach(f=>f()))};return Object.assign({},o,{subscribe(f){const u=()=>n&&f(),h=o.subscribe(u);return i.add(f),()=>{h(),i.delete(f)}},dispatch(f){var u;try{return n=!((u=f==null?void 0:f.meta)!=null&&u[L1]),a=!n,a&&(l||(l=!0,c(d))),o.dispatch(f)}finally{n=!0}}})},F1=e=>function(r){const{autoBatch:o=!0}=r??{};let n=new Im(e);return o&&n.push($1(typeof o=="object"?o:void 0)),n};function G1(e){const t=O1(),{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(vn(r))c=nm(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(b=>typeof b!="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 b=new Set;d.forEach(v=>{if(b.has(v))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.");b.add(v)})}let f=vs;n&&(f=E1({trace:process.env.NODE_ENV!=="production",...typeof n=="object"&&n}));const u=Yk(...d),h=F1(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 m=typeof i=="function"?i(h):h();if(process.env.NODE_ENV!=="production"&&!Array.isArray(m))throw new Error(process.env.NODE_ENV==="production"?Pe(6):"`enhancers` callback must return an array");if(process.env.NODE_ENV!=="production"&&m.some(b=>typeof b!="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&&!m.includes(u)&&console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");const y=f(...m);return rm(c,l,y)}function Vm(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 V1(e){return typeof e=="function"}function z1(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]=Vm(t),a;if(V1(e))a=()=>Pm(e());else{const i=Pm(e);a=()=>i}function l(i=a(),c){let d=[r[c.type],...o.filter(({matcher:f})=>f(c)).map(({reducer:f})=>f)];return d.filter(f=>!!f).length===0&&(d=[n]),d.reduce((f,u)=>{if(u)if(yr(f)){const m=u(f,c);return m===void 0?f:m}else{if(qt(f))return Nm(f,h=>u(h,c));{const h=u(f,c);if(h===void 0){if(f===null)return f;throw Error("A case reducer on a non-draftable value must not return undefined")}return h}}return f},i)}return l.getInitialState=a,l}var B1="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",U1=(e=21)=>{let t="",r=e;for(;r--;)t+=B1[Math.random()*64|0];return t},W1=Symbol.for("rtk-slice-createasyncthunk");function H1(e,t){return`${e}/${t}`}function j1({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[W1];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(q1()):n.reducers)||{},c=Object.keys(i),d={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},f={addCase(C,k){const E=typeof C=="string"?C:C.type;if(!E)throw new Error(process.env.NODE_ENV==="production"?Pe(12):"`context.addCase` cannot be called with an empty action type");if(E 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: "+E);return d.sliceCaseReducersByType[E]=k,f},addMatcher(C,k){return d.sliceMatchers.push({matcher:C,reducer:k}),f},exposeAction(C,k){return d.actionCreators[C]=k,f},exposeCaseReducer(C,k){return d.sliceCaseReducersByName[C]=k,f}};c.forEach(C=>{const k=i[C],E={reducerName:C,type:H1(a,C),createNotation:typeof n.reducers=="function"};K1(k)?J1(E,k,f,t):Q1(E,k,f)});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[C={},k=[],E=void 0]=typeof n.extraReducers=="function"?Vm(n.extraReducers):[n.extraReducers],M={...C,...d.sliceCaseReducersByType};return z1(n.initialState,_=>{for(let I in M)_.addCase(I,M[I]);for(let I of d.sliceMatchers)_.addMatcher(I.matcher,I.reducer);for(let I of k)_.addMatcher(I.matcher,I.reducer);E&&_.addDefaultCase(E)})}const h=C=>C,m=new Map,y=new WeakMap;let b;function v(C,k){return b||(b=u()),b(C,k)}function w(){return b||(b=u()),b.getInitialState()}function x(C,k=!1){function E(_){let I=_[C];if(typeof I>"u"){if(k)I=Nn(y,E,w);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 I}function M(_=h){const I=Nn(m,k,()=>new WeakMap);return Nn(I,_,()=>{const A={};for(const[W,$]of Object.entries(n.selectors??{}))A[W]=Y1($,_,()=>Nn(y,_,w),k);return A})}return{reducerPath:C,getSelectors:M,get selectors(){return M(E)},selectSlice:E}}const S={name:a,reducer:v,actions:d.actionCreators,caseReducers:d.sliceCaseReducersByName,getInitialState:w,...x(l),injectInto(C,{reducerPath:k,...E}={}){const M=k??l;return C.inject({reducerPath:M,reducer:v},E),{...S,...x(M,!0)}}};return S}}function Y1(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 zm=j1();function q1(){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 Q1({type:e,reducerName:t,createNotation:r},o,n){let a,l;if("reducer"in o){if(r&&!X1(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?Tm(e,l):Tm(e))}function K1(e){return e._reducerDefinitionType==="asyncThunk"}function X1(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:f}=r,u=n(e,a,f);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||Gs,pending:i||Gs,rejected:c||Gs,settled:d||Gs})}function Gs(){}var Z1=e=>"reducerPath"in e&&typeof e.reducerPath=="string",R1=e=>e.flatMap(t=>Z1(t)?[[t.reducerPath,t.reducer]]:Object.entries(t)),Sc=Symbol.for("rtk-state-proxy-original"),e_=e=>!!e&&!!e[Sc],t_=new WeakMap,r_=(e,t,r)=>Nn(t_,e,()=>new Proxy(e,{get:(o,n,a)=>{if(n===Sc)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:U1()});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}})),o_=e=>{if(!e_(e))throw new Error(process.env.NODE_ENV==="production"?Pe(25):"original must be used on state Proxy");return e[Sc]},n_={},a_=(e=n_)=>e;function s_(...e){const t=Object.fromEntries(R1(e)),r=()=>Object.keys(t).length?nm(t):a_;let o=r();function n(c,d){return o(c,d)}n.withLazyLoadedSlices=()=>n;const a={},l=(c,d={})=>{const{reducerPath:f,reducer:u}=c,h=t[f];return!d.overrideExisting&&h&&h!==u?(typeof process<"u"&&process.env.NODE_ENV==="development"&&console.error(`called \`inject\` to override already-existing reducer ${f} without specifying \`overrideExisting: true\``),n):(d.overrideExisting&&h!==u&&delete a[f],t[f]=u,o=r(),n)},i=Object.assign(function(d,f){return function(h,...m){return d(r_(f?f(h,...m):h,t,a),...m)}},{original:o_});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 Vs={exports:{}},Cc={};/**
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 Bm;function l_(){if(Bm)return Cc;Bm=1;var e=N;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 Cc.useSyncExternalStoreWithSelector=function(c,d,f,u,h){var m=n(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=l(function(){function v(k){if(!w){if(w=!0,x=k,k=u(k),h!==void 0&&y.hasValue){var E=y.value;if(h(E,k))return S=E}return S=k}if(E=S,r(x,k))return E;var M=u(k);return h!==void 0&&h(E,M)?(x=k,E):(x=k,S=M)}var w=!1,x,S,C=f===void 0?null:f;return[function(){return v(d())},C===null?void 0:function(){return v(C())}]},[d,f,u,h]);var b=o(c,m[0],m[1]);return a(function(){y.hasValue=!0,y.value=b},[b]),i(b),b},Cc}var Nc={};/**
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 Um;function i_(){return Um||(Um=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=N,r=typeof Object.is=="function"?Object.is:e,o=t.useSyncExternalStore,n=t.useRef,a=t.useEffect,l=t.useMemo,i=t.useDebugValue;Nc.useSyncExternalStoreWithSelector=function(c,d,f,u,h){var m=n(null);if(m.current===null){var y={hasValue:!1,value:null};m.current=y}else y=m.current;m=l(function(){function v(k){if(!w){if(w=!0,x=k,k=u(k),h!==void 0&&y.hasValue){var E=y.value;if(h(E,k))return S=E}return S=k}if(E=S,r(x,k))return E;var M=u(k);return h!==void 0&&h(E,M)?(x=k,E):(x=k,S=M)}var w=!1,x,S,C=f===void 0?null:f;return[function(){return v(d())},C===null?void 0:function(){return v(C())}]},[d,f,u,h]);var b=o(c,m[0],m[1]);return a(function(){y.hasValue=!0,y.value=b},[b]),i(b),b},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Nc}var Wm;function c_(){return Wm||(Wm=1,process.env.NODE_ENV==="production"?Vs.exports=l_():Vs.exports=i_()),Vs.exports}var d_=c_();function u_(e){e()}function p_(){let e=null,t=null;return{clear(){e=null,t=null},notify(){u_(()=>{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 Hm={notify(){},get:()=>[]};function f_(e,t){let r,o=Hm,n=0,a=!1;function l(b){f();const v=o.subscribe(b);let w=!1;return()=>{w||(w=!0,v(),u())}}function i(){o.notify()}function c(){y.onStateChange&&y.onStateChange()}function d(){return a}function f(){n++,r||(r=e.subscribe(c),o=p_())}function u(){n--,r&&n===0&&(r(),r=void 0,o.clear(),o=Hm)}function h(){a||(a=!0,f())}function m(){a&&(a=!1,u())}const y={addNestedSub:l,notifyNestedSubs:i,handleChangeWrapper:c,isSubscribed:d,trySubscribe:h,tryUnsubscribe:m,getListeners:()=>o};return y}var h_=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",m_=h_(),g_=()=>typeof navigator<"u"&&navigator.product==="ReactNative",b_=g_(),y_=()=>m_||b_?g.useLayoutEffect:g.useEffect,v_=y_(),Ec=Symbol.for("react-redux-context"),kc=typeof globalThis<"u"?globalThis:{};function x_(){if(!g.createContext)return{};const e=kc[Ec]??(kc[Ec]=new Map);let t=e.get(g.createContext);return t||(t=g.createContext(null),process.env.NODE_ENV!=="production"&&(t.displayName="ReactRedux"),e.set(g.createContext,t)),t}var Gr=x_();function w_(e){const{children:t,context:r,serverState:o,store:n}=e,a=g.useMemo(()=>{const c=f_(n),d={store:n,subscription:c,getServerState:o?()=>o:void 0};if(process.env.NODE_ENV==="production")return d;{const{identityFunctionCheck:f="once",stabilityCheck:u="once"}=e;return Object.assign(d,{stabilityCheck:u,identityFunctionCheck:f})}},[n,o]),l=g.useMemo(()=>n.getState(),[n]);v_(()=>{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 g.createElement(i.Provider,{value:a},t)}var S_=w_;function _c(e=Gr){return function(){const r=g.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 jm=_c();function Dc(e=Gr){const t=e===Gr?jm:_c(e),r=()=>{const{store:o}=t();return o};return Object.assign(r,{withTypes:()=>r}),r}var C_=Dc();function N_(e=Gr){const t=e===Gr?C_:Dc(e),r=()=>t().dispatch;return Object.assign(r,{withTypes:()=>r}),r}var E_=(e,t)=>e===t;function k_(e=Gr){const t=e===Gr?jm:_c(e),r=(o,n={})=>{const{equalityFn:a=E_}=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,f=g.useRef(!0),u=g.useCallback({[o.name](m){const y=o(m);if(process.env.NODE_ENV!=="production"){const{devModeChecks:b={}}=typeof n=="function"?{}:n,{identityFunctionCheck:v,stabilityCheck:w}=l,{identityFunctionCheck:x,stabilityCheck:S}={stabilityCheck:w,identityFunctionCheck:v,...b};if(S==="always"||S==="once"&&f.current){const C=o(m);if(!a(y,C)){let k;try{throw new Error}catch(E){({stack:k}=E)}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:m,selected:y,selected2:C,stack:k})}}if((x==="always"||x==="once"&&f.current)&&y===m){let C;try{throw new Error}catch(k){({stack:C}=k)}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:C})}f.current&&(f.current=!1)}return y}}[o.name],[o]),h=d_.useSyncExternalStoreWithSelector(c.addNestedSub,i.getState,d||i.getState,u,a);return g.useDebugValue(h),h};return Object.assign(r,{withTypes:()=>r}),r}var Ym=Symbol.for("immer-nothing"),qm=Symbol.for("immer-draftable"),xt=Symbol.for("immer-state"),__=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 Lt(e,...t){if(process.env.NODE_ENV!=="production"){const r=__[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 $t=Object,$o=$t.getPrototypeOf,zs="constructor",Bs="prototype",Ac="configurable",Us="enumerable",Ws="writable",En="value",Vr=e=>!!e&&!!e[xt];function xr(e){var t;return e?Km(e)||Ys(e)||!!e[qm]||!!((t=e[zs])!=null&&t[qm])||qs(e)||Qs(e):!1}var D_=$t[Bs][zs].toString(),Qm=new WeakMap;function Km(e){if(!e||!Mc(e))return!1;const t=$o(e);if(t===null||t===$t[Bs])return!0;const r=$t.hasOwnProperty.call(t,zs)&&t[zs];if(r===Object)return!0;if(!io(r))return!1;let o=Qm.get(r);return o===void 0&&(o=Function.toString.call(r),Qm.set(r,o)),o===D_}function Hs(e,t,r=!0){kn(e)===0?(r?Reflect.ownKeys(e):$t.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((o,n)=>t(n,o,e))}function kn(e){const t=e[xt];return t?t.type_:Ys(e)?1:qs(e)?2:Qs(e)?3:0}var Xm=(e,t,r=kn(e))=>r===2?e.has(t):$t[Bs].hasOwnProperty.call(e,t),Tc=(e,t,r=kn(e))=>r===2?e.get(t):e[t],js=(e,t,r,o=kn(e))=>{o===2?e.set(t,r):o===3?e.add(r):e[t]=r};function A_(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Ys=Array.isArray,qs=e=>e instanceof Map,Qs=e=>e instanceof Set,Mc=e=>typeof e=="object",io=e=>typeof e=="function",Ic=e=>typeof e=="boolean";function T_(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var wr=e=>e.copy_||e.base_,Pc=e=>e.modified_?e.copy_:e.base_;function Oc(e,t){if(qs(e))return new Map(e);if(Qs(e))return new Set(e);if(Ys(e))return Array[Bs].slice.call(e);const r=Km(e);if(t===!0||t==="class_only"&&!r){const o=$t.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[Ws]===!1&&(i[Ws]=!0,i[Ac]=!0),(i.get||i.set)&&(o[l]={[Ac]:!0,[Ws]:!0,[Us]:i[Us],[En]:e[l]})}return $t.create($o(e),o)}else{const o=$o(e);if(o!==null&&r)return{...e};const n=$t.create(o);return $t.assign(n,e)}}function Lc(e,t=!1){return Xs(e)||Vr(e)||!xr(e)||(kn(e)>1&&$t.defineProperties(e,{set:Ks,add:Ks,clear:Ks,delete:Ks}),$t.freeze(e),t&&Hs(e,(r,o)=>{Lc(o,!0)},!1)),e}function M_(){Lt(2)}var Ks={[En]:M_};function Xs(e){return e===null||!Mc(e)?!0:$t.isFrozen(e)}var Js="MapSet",$c="Patches",Jm="ArrayMethods",Zm={};function co(e){const t=Zm[e];return t||Lt(0,e),t}var Rm=e=>!!Zm[e],_n,eg=()=>_n,I_=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:Rm(Js)?co(Js):void 0,arrayMethodsPlugin_:Rm(Jm)?co(Jm):void 0});function tg(e,t){t&&(e.patchPlugin_=co($c),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Fc(e){Gc(e),e.drafts_.forEach(P_),e.drafts_=null}function Gc(e){e===_n&&(_n=e.parent_)}var rg=e=>_n=I_(_n,e);function P_(e){const t=e[xt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function og(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[xt].modified_&&(Fc(t),Lt(4)),xr(e)&&(e=ng(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[xt].base_,e,t)}else e=ng(t,r);return O_(t,e,!0),Fc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Ym?e:void 0}function ng(e,t){if(Xs(t))return t;const r=t[xt];if(!r)return Rs(t,e.handledSet_,e);if(!Zs(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);lg(r,e)}return r.copy_}function O_(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Lc(t,r)}function ag(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Zs=(e,t)=>e.scope_===t,L_=[];function sg(e,t,r,o){const n=wr(e),a=e.type_;if(o!==void 0&&Tc(n,o,a)===t){js(n,o,r,a);return}if(!e.draftLocations_){const i=e.draftLocations_=new Map;Hs(n,(c,d)=>{if(Vr(d)){const f=i.get(d)||[];f.push(c),i.set(d,f)}})}const l=e.draftLocations_.get(t)??L_;for(const i of l)js(n,i,r,a)}function $_(e,t,r){e.callbacks_.push(function(n){var i;const a=t;if(!a||!Zs(a,n))return;(i=n.mapSetPlugin_)==null||i.fixSetContents(a);const l=Pc(a);sg(e,a.draft_??a,l,r),lg(a,n)})}function lg(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)}ag(e)}}function F_(e,t,r){const{scope_:o}=e;if(Vr(r)){const n=r[xt];Zs(n,o)&&n.callbacks_.push(function(){tl(e);const l=Pc(n);sg(e,r,l,t)})}else xr(r)&&e.callbacks_.push(function(){const a=wr(e);e.type_===3?a.has(r)&&Rs(r,o.handledSet_,o):Tc(a,t,e.type_)===r&&o.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Rs(Tc(e.copy_,t,e.type_),o.handledSet_,o)})}function Rs(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Vr(e)||t.has(e)||!xr(e)||Xs(e)||(t.add(e),Hs(e,(o,n)=>{if(Vr(n)){const a=n[xt];if(Zs(a,r)){const l=Pc(a);js(e,o,l,e.type_),ag(a)}}else xr(n)&&Rs(n,t,r)})),e}function G_(e,t){const r=Ys(e),o={type_:r?1:0,scope_:t?t.scope_:eg(),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=el;r&&(n=[o],a=Dn);const{revoke:l,proxy:i}=Proxy.revocable(n,a);return o.draft_=i,o.revoke_=l,[i,o]}var el={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(!Xm(n,t,e.type_))return V_(e,n,t);const a=n[t];if(e.finalized_||!xr(a)||o&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&T_(t))return a;if(a===Vc(e.base_,t)){tl(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 wr(e)},ownKeys(e){return Reflect.ownKeys(wr(e))},set(e,t,r){const o=ig(wr(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const n=Vc(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(A_(r,n)&&(r!==void 0||Xm(e.base_,t,e.type_)))return!0;tl(e),zc(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),F_(e,t,r)),!0},deleteProperty(e,t){return tl(e),Vc(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),zc(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&&{[Ws]:!0,[Ac]:e.type_!==1||t!=="length",[Us]:o[Us],[En]:r[t]}},defineProperty(){Lt(11)},getPrototypeOf(e){return $o(e.base_)},setPrototypeOf(){Lt(12)}},Dn={};for(let e in el){let t=el[e];Dn[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Dn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Lt(13),Dn.set.call(this,e,t,void 0)},Dn.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Lt(14),el.set.call(this,e[0],t,r,e[0])};function Vc(e,t){const r=e[xt];return(r?wr(r):e)[t]}function V_(e,t,r){var n;const o=ig(t,r);return o?En in o?o[En]:(n=o.get)==null?void 0:n.call(e.draft_):void 0}function ig(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 zc(e){e.modified_||(e.modified_=!0,e.parent_&&zc(e.parent_))}function tl(e){e.copy_||(e.assigned_=new Map,e.copy_=Oc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var z_=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,f=>r.call(this,f,...d))}}io(r)||Lt(6),o!==void 0&&!io(o)&&Lt(7);let n;if(xr(t)){const a=rg(this),l=Bc(a,t,void 0);let i=!0;try{n=r(l),i=!1}finally{i?Fc(a):Gc(a)}return tg(a,o),og(n,a)}else if(!t||!Mc(t)){if(n=r(t),n===void 0&&(n=t),n===Ym&&(n=void 0),this.autoFreeze_&&Lc(n,!0),o){const a=[],l=[];co($c).generateReplacementPatches_(t,n,{patches_:a,inversePatches_:l}),o(a,l)}return n}else Lt(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]},Ic(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ic(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ic(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){xr(e)||Lt(8),Vr(e)&&(e=B_(e));const t=rg(this),r=Bc(t,e,void 0);return r[xt].isManual_=!0,Gc(t),r}finishDraft(e,t){const r=e&&e[xt];(!r||!r.isManual_)&&Lt(9);const{scope_:o}=r;return tg(o,t),og(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($c).applyPatches_;return Vr(e)?o(e,t):this.produce(e,n=>o(n,t))}};function Bc(e,t,r,o){const[n,a]=qs(t)?co(Js).proxyMap_(t,r):Qs(t)?co(Js).proxySet_(t,r):G_(t,r);return((r==null?void 0:r.scope_)??eg()).drafts_.push(n),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=o,r&&o!==void 0?$_(r,a,o):a.callbacks_.push(function(c){var f;(f=c.mapSetPlugin_)==null||f.fixSetContents(a);const{patchPlugin_:d}=c;a.modified_&&d&&d.generatePatches_(a,[],c)}),n}function B_(e){return Vr(e)||Lt(10,e),cg(e)}function cg(e){if(!xr(e)||Xs(e))return e;const t=e[xt];let r,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Oc(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else r=Oc(e,!0);return Hs(r,(n,a)=>{js(r,n,cg(a))},o),t&&(t.finalized_=!1),r}var U_=new z_,W_=U_.produce;const Qt=e=>g.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),H_=N.forwardRef((e,t)=>g.createElement("span",{"data-testid":e.testID,ref:t,className:e.className,title:e.title},e.label)),j_=e=>{const{component:t,...r}=e,o=De(r.schema.suppressStandardClassnames||ue.betweenRules,r.schema.classNames.betweenRules);return g.createElement("div",{className:o,"data-testid":pe.inlineCombinator},g.createElement(t,{...r,testID:pe.combinators}))},Y_={name:"",value:"",label:""},dg=e=>["atleast","atmost","exactly"].includes(hn(e)??""),ug=[],q_=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:f,thresholdRule:u,thresholdSchema:h,handleChangeMode:m,handleChangeThreshold:y}=Q_(e);return g.createElement(g.Fragment,null,g.createElement(c,{schema:i,testID:l,className:n,title:o,handleOnChange:m,disabled:a,value:t.mode,options:r,multiple:!1,listsAsArrays:!1,path:ug,level:0}),dg(t.mode)&&g.createElement(d,{skipHook:!0,testID:l,inputType:"number",title:o,className:n,disabled:a,handleOnChange:y,field:"",operator:"",value:f,valueSource:"value",fieldData:Y_,schema:h,path:ug,level:0,rule:u}))},Q_=e=>{const{match:t,handleOnChange:r}=e,o=g.useMemo(()=>typeof t.threshold=="number"?Math.max(0,t.threshold):1,[t.threshold]);return{thresholdNum:o,thresholdRule:g.useMemo(()=>({field:"",operator:"=",value:o}),[o]),thresholdSchema:g.useMemo(()=>({...e.schema,parseNumbers:!0}),[e.schema]),handleChangeMode:N.useCallback(n=>{dg(n)&&typeof t.threshold!="number"?r({...t,mode:n,threshold:1}):r({...t,mode:n})},[r,t]),handleChangeThreshold:N.useCallback(n=>{r({...t,threshold:bs(n,{parseNumbers:!0})})},[r,t])}},K_=e=>{const t=g.useId();return g.createElement("label",{"data-testid":e.testID,className:e.className,title:e.title,htmlFor:t},g.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."},An=zm({name:"queries",initialState:{},reducers:{setQueryState:(e,{payload:{qbId:t,query:r}})=>{e[t]=r}},selectors:{getQuerySelectorById:(e,t)=>e[t]}}),pg=g.createContext(null),X_={[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},Uc=zm({name:"warnings",initialState:X_,reducers:{rqbWarn:(e,{payload:t})=>{e[t]||(console.error(t),e[t]=!0)}}}),fg=s_(An,Uc).withLazyLoadedSlices(),J_=e=>N_(e),Z_=e=>Dc(e),R_=e=>k_(e),eD=e=>({useRQB_INTERNAL_QueryBuilderDispatch:J_(e),useRQB_INTERNAL_QueryBuilderStore:Z_(e),useRQB_INTERNAL_QueryBuilderSelector:R_(e)}),Wc=({payload:e,onQueryChange:t})=>r=>{r(An.actions.setQueryState(e)),typeof t=="function"&&t(e.query)},Hc=eD(pg),jc=Hc.useRQB_INTERNAL_QueryBuilderDispatch,tD=Hc.useRQB_INTERNAL_QueryBuilderStore,rD=Hc.useRQB_INTERNAL_QueryBuilderSelector,{rqbWarn:oD}=Uc.actions,uo=e=>t=>{setTimeout(()=>t(oD(e)))},nD={queries:An.getInitialState(),warnings:Uc.getInitialState()},aD={reducer:fg,preloadedState:nD,middleware:e=>e({serializableCheck:{ignoredActions:[An.actions.setQueryState.type],ignoredPaths:[/^queries\b.*\.rules\.\d+\.value$/]}})},sD=e=>{const t=N.useRef({value:e,prev:null}),r=t.current.value;return e!==r&&(t.current.prev=r,t.current.value=e),t.current.prev},lD=e=>{const t=jc(),{defaultQuery:r,queryProp:o}=e,n=sD(!!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 Yc(e,t,r){const o=jc();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 hg=e=>{const{optionList:t,optionsMap:r,defaultOption:o}=N.useMemo(()=>bn({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}},iD=e=>{const t=G1({...aD,devTools:e?{name:"React Query Builder"}:!1});return t.addSlice=r=>{fg.inject(r),t.dispatch({type:crypto.randomUUID().slice(0,8),meta:`Initializing state for slice "${r.name}"`})},t};let qc=null;function mg(e){return qc||(qc=iD(globalThis==null?void 0:globalThis.__RQB_DEVTOOLS__)),qc}const po=e=>t=>An.selectors.getQuerySelectorById({queries:t.queries},e),cD=(e,t)=>{const r=g.useContext(Qc);return rD(e,t)??(r==null?void 0:r.initialQuery)},dD={},uD={},pD=[],fD={},hD=()=>null,gg=()=>"",fo=()=>!0,mD=(...e)=>{console.log(...e)};function gD(e,t){const{query:r,defaultQuery:o,getValueEditorSeparator:n=hD,getRuleClassname:a=gg,getRuleGroupClassname:l=gg,onAddRule:i=fo,onAddGroup:c=fo,onMoveRule:d=fo,onMoveGroup:f=fo,onGroupRule:u=fo,onGroupGroup:h=fo,onRemove:m=fo,onQueryChange:y,showCombinatorsBetweenRules:b=!1,showNotToggle:v=!1,showShiftActions:w=!1,showCloneButtons:x=!1,showLockButtons:S=!1,showMuteButtons:C=!1,suppressStandardClassnames:k=!1,resetOnFieldChange:E=!0,resetOnOperatorChange:M=!1,autoSelectField:_=!0,autoSelectOperator:I=!0,autoSelectValue:A=!0,addRuleToNewGroups:W=!1,listsAsArrays:$=!1,parseNumbers:G=!1,disabled:Q=!1,validator:ee,onLog:H=mD,idGenerator:K,accessibleDescriptionGenerator:O=Ek}=e,{qbId:B,rqbContext:fe,fields:be,fieldMap:F,combinators:q,getOperatorsMain:re,getMatchModesMain:he,getRuleDefaultOperator:X,getSubQueryBuilderPropsMain:J,getValueEditorTypeMain:le,getValueSourcesMain:ve,getValuesMain:ie,getRuleDefaultValue:j,getInputTypeMain:Y,createRule:de,createRuleGroup:Ee}=t,{controlClassnames:Se,controlElements:ze,debugMode:Ye,enableDragAndDrop:We,enableMountQueryChange:Re,translations:me}=fe,D=!!b,T=!!v,P=!!w,z=!!x,V=!!S,L=!!C,R=!!E,ge=!!M,Ce=!!_,He=!!I,St=!!A,pt=!!W,Cr=!!$,ht=!!k,kt=(e.maxLevels??0)>0?Number(e.maxLevels):1/0,Te=N.useCallback((...ce)=>{Ye&&H(...ce)},[Ye,H]);lD({defaultQuery:o,queryProp:r});const je=tD(),Ct=jc(),Zt=N.useMemo(()=>po(B),[B]),Me=cD(Zt),at=N.useCallback(()=>Zt(je.getState()),[je,Zt]),Vo=N.useMemo(()=>Ee(),[Ee]),zo=r??Me??o??Vo,mt=zo.id?zo:ys(zo,{idGenerator:K}),[Ln]=N.useState(mt),bl=N.useMemo(()=>({...fe,initialQuery:Ln}),[fe,Ln]);N.useEffect(()=>{r&&!Object.is(r,Me)&&Ct(Wc({payload:{qbId:B,query:r},onQueryChange:void 0}))},[r,B,Me,Ct]);const Nr=N.useMemo(()=>gn(mt),[mt]),Bo=!!e.independentCombinators&&!Nr;Yc("independentCombinators",Bo||!Bo&&(e.independentCombinators??"not present")!=="not present",Bo?"invalid":"unnecessary");const $n=N.useRef(!1);N.useEffect(()=>{$n.current||($n.current=!0,Ct(Wc({payload:{qbId:B,query:mt},onQueryChange:Re&&typeof y=="function"?y:void 0})))},[Re,y,B,Ct,mt]);const ft=N.useCallback(ce=>{Ct(Wc({payload:{qbId:B,query:ce},onQueryChange:y}))},[y,B,Ct]),Uo=Array.isArray(Q)&&Q||pD,ot=Q===!0,yl=mt.disabled||Uo.some(ce=>ce.length===0),Fn=N.useCallback((ce,ke,Ie)=>{const Ae=po(B)(je.getState());if(!Ae)return;if(Oo(ke,Ae)||ot){Te({qbId:B,type:tt.parentPathDisabled,rule:ce,parentPath:ke,query:Ae});return}const _e=i(ce,ke,Ae,Ie);if(!_e){Te({qbId:B,type:tt.onAddRuleFalse,rule:ce,parentPath:ke,query:Ae});return}const st=_e===!0?ce:_e,gt=Rh(Ae,st,ke,{combinators:q,combinatorPreceding:st.combinatorPreceding??void 0,idGenerator:K});Te({qbId:B,type:tt.add,query:Ae,newQuery:gt,newRule:st,parentPath:ke}),ft(gt)},[q,ft,K,Te,i,B,je,ot]),Gn=N.useCallback((ce,ke,Ie)=>{if(ke.length>=kt)return;const Ae=po(B)(je.getState());if(!Ae)return;if(Oo(ke,Ae)||ot){Te({qbId:B,type:tt.parentPathDisabled,ruleGroup:ce,parentPath:ke,query:Ae});return}const _e=c(ce,ke,Ae,Ie);if(!_e){Te({qbId:B,type:tt.onAddGroupFalse,ruleGroup:ce,parentPath:ke,query:Ae});return}const st=_e===!0?ce:_e,gt=Rh(Ae,st,ke,{combinators:q,combinatorPreceding:st.combinatorPreceding??void 0,idGenerator:K});Te({qbId:B,type:tt.add,query:Ae,newQuery:gt,newGroup:st,parentPath:ke}),ft(gt)},[q,ft,K,Te,kt,c,B,je,ot]),Vn=N.useCallback((ce,ke,Ie)=>{const Ae=po(B)(je.getState());if(!Ae)return;if(Oo(Ie,Ae)&&ce!=="disabled"||ot){Te({qbId:B,type:tt.pathDisabled,path:Ie,prop:ce,value:ke,query:Ae});return}const _e=Ok(Ae,ce,ke,Ie,{resetOnFieldChange:R,resetOnOperatorChange:ge,getRuleDefaultOperator:X,getValueSources:ve,getRuleDefaultValue:j,getMatchModes:he});Te({qbId:B,type:tt.update,query:Ae,newQuery:_e,prop:ce,value:ke,path:Ie}),ft(_e)},[ft,he,X,j,ve,Te,B,je,ot,R,ge]),Wo=N.useCallback((ce,ke)=>{const Ie=po(B)(je.getState());if(!Ie)return;if(Oo(ce,Ie)||ot){Te({qbId:B,type:tt.pathDisabled,path:ce,query:Ie});return}const Ae=Xe(ce,Ie);if(Ae)if(m(Ae,ce,Ie,ke)){const _e=Lk(Ie,ce);Te({qbId:B,type:tt.remove,query:Ie,newQuery:_e,path:ce,ruleOrGroup:Ae}),ft(_e)}else Te({qbId:B,type:tt.onRemoveFalse,ruleOrGroup:Ae,path:ce,query:Ie})},[ft,Te,m,B,je,ot]),zn=N.useCallback((ce,ke,Ie,Ae)=>{const _e=po(B)(je.getState());if(!_e)return;if(Oo(ce,_e)||ot){Te({qbId:B,type:tt.pathDisabled,oldPath:ce,newPath:ke,query:_e});return}const st=$k(_e,ce,ke,{clone:Ie,combinators:q,idGenerator:K}),gt=Xe(ce,_e),Wr=Ge(gt),cr=(Wr?f:d)(gt,ce,ke,_e,st,{clone:Ie,combinators:q},Ae);if(!cr){Te({qbId:B,type:Wr?tt.onMoveGroupFalse:tt.onMoveRuleFalse,ruleOrGroup:gt,oldPath:ce,newPath:ke,clone:Ie,query:_e,nextQuery:st});return}const Hr=Ge(cr)?cr:st;Te({qbId:B,type:tt.move,query:_e,newQuery:Hr,oldPath:ce,newPath:ke,clone:Ie}),ft(Hr)},[q,ft,K,Te,f,d,B,je,ot]),Bn=N.useCallback((ce,ke,Ie,Ae)=>{const _e=po(B)(je.getState());if(!_e)return;if(Oo(ce,_e)||ot){Te({qbId:B,type:tt.pathDisabled,sourcePath:ce,targetPath:ke,query:_e});return}const st=Fk(_e,ce,ke,{clone:Ie,combinators:q,idGenerator:K}),gt=Xe(ce,_e),Wr=Ge(gt),cr=(Wr?h:u)(gt,ce,ke,_e,st,{clone:Ie,combinators:q},Ae);if(!cr){Te({qbId:B,type:Wr?tt.onGroupGroupFalse:tt.onGroupRuleFalse,ruleOrGroup:gt,sourcePath:ce,targetPath:ke,clone:Ie,query:_e,nextQuery:st});return}const Hr=Ge(cr)?cr:st;Te({qbId:B,type:tt.group,query:_e,newQuery:Hr,sourcePath:ce,targetPath:ke,clone:Ie}),ft(Hr)},[q,ft,K,Te,h,u,B,je,ot]),{validationResult:Ut,validationMap:Un}=N.useMemo(()=>{const ce=typeof ee=="function"&&mt?ee(mt):dD;return{validationResult:ce,validationMap:typeof ce=="boolean"?uD:ce}},[mt,ee]),vl=We?"enabled":"disabled",xl=Nr||D?"enabled":"disabled",wl=N.useMemo(()=>typeof mt.combinator=="string"?{combinator:mt.combinator}:fD,[mt.combinator]),Sl=N.useMemo(()=>De(ht||ue.queryBuilder,De(Se.queryBuilder),ot&&Se.disabled,typeof Ut=="boolean"&&Ut&&Se.valid,typeof Ut=="boolean"&&!Ut&&Se.invalid,ht||{[ue.disabled]:ot,[ue.valid]:typeof Ut=="boolean"&&Ut,[ue.invalid]:typeof Ut=="boolean"&&!Ut}),[Se.disabled,Se.invalid,Se.queryBuilder,Se.valid,ot,ht,Ut]),Wn=N.useCallback(ce=>Ee(ce??Nr),[Ee,Nr]),Cl=N.useMemo(()=>({addRuleToNewGroups:pt,accessibleDescriptionGenerator:O,autoSelectField:Ce,autoSelectOperator:He,autoSelectValue:St,classNames:Se,combinators:q,controls:ze,createRule:de,createRuleGroup:Wn,disabledPaths:Uo,enableDragAndDrop:We,fieldMap:F,fields:be,dispatchQuery:ft,getQuery:at,getInputType:Y,getOperators:re,getMatchModes:he,getRuleClassname:a,getRuleGroupClassname:l,getSubQueryBuilderProps:J,getValueEditorSeparator:n,getValueEditorType:le,getValues:ie,getValueSources:ve,independentCombinators:Nr,listsAsArrays:Cr,maxLevels:kt,parseNumbers:G,qbId:B,showCloneButtons:z,showCombinatorsBetweenRules:D,showLockButtons:V,showMuteButtons:L,showNotToggle:T,showShiftActions:P,suppressStandardClassnames:ht,validationMap:Un}),[O,pt,Ce,He,St,q,Se,ze,de,Wn,Uo,ft,We,F,be,Y,re,he,at,a,l,J,n,le,ie,ve,Nr,Cr,kt,G,B,z,D,V,L,T,P,ht,Un]);return{actions:N.useMemo(()=>({moveRule:zn,onGroupAdd:Gn,onGroupRemove:Wo,onPropChange:Vn,onRuleAdd:Fn,onRuleRemove:Wo,groupRule:Bn}),[Bn,zn,Gn,Vn,Fn,Wo]),rootGroup:mt,rootGroupDisabled:yl,queryDisabled:ot,rqbContext:bl,schema:Cl,translations:me,wrapperClassName:Sl,dndEnabledAttr:vl,inlineCombinatorsAttr:xl,combinatorPropObject:wl}}const bg=(e,t,r)=>{const o=ct(e);if(t.operator==="between"||t.operator==="notBetween"){const n=[o,o];return r?n:oc(n.map(a=>a??""),",")}return o},bD=e=>{const[t]=N.useState(zt),{fields:r,baseField:o,operators:n,baseOperator:a,combinators:l,baseCombinator:i,translations:c,enableMountQueryChange:d=!0,controlClassnames:f,controlElements:u,getDefaultField:h,getDefaultOperator:m,getDefaultValue:y,getMatchModes:b,getOperators:v,getSubQueryBuilderProps:w,getValueEditorType:x,getValueSources:S,getInputType:C,getValues:k,autoSelectField:E=!0,autoSelectOperator:M=!0,autoSelectValue:_=!0,addRuleToNewGroups:I=!1,enableDragAndDrop:A,listsAsArrays:W=!1,debugMode:$=!1,idGenerator:G=zt}=e,[Q]=N.useState(e.query??e.defaultQuery),ee=TD({controlClassnames:f,controlElements:u,debugMode:$,enableDragAndDrop:A,enableMountQueryChange:d,translations:c,initialQuery:Q,qbId:t,finalize:!0}),{translations:H}=ee,{fields:K,fieldMap:O}=hg({fields:r,baseField:o,autoSelectField:E,translations:H}),{optionList:B}=N.useMemo(()=>bn({optionList:l??fn,labelMap:mk,baseOption:i,autoSelectOption:!0}),[i,l]),{optionList:fe}=N.useMemo(()=>bn({optionList:n??gk,placeholder:H.operators,labelMap:Lh,baseOption:a,autoSelectOption:M}),[M,a,n,H.operators]),be=N.useCallback((j,{fieldData:Y})=>bn({optionList:(Y==null?void 0:Y.operators)??(v==null?void 0:v(j,{fieldData:Y}))??fe,placeholder:H.operators,baseOption:a,labelMap:Lh,autoSelectOption:M}).optionList,[M,a,v,fe,H.operators]),F=N.useCallback(j=>{const Y=O[j];return Y!=null&&Y.defaultOperator?Y.defaultOperator:m?typeof m=="function"?m(j,{fieldData:Y}):m:ct(be(j,{fieldData:Y})??[])??""},[O,m,be]),q=N.useCallback((j,Y,{fieldData:de})=>de.valueEditorType?typeof de.valueEditorType=="function"?de.valueEditorType(Y):de.valueEditorType:(x==null?void 0:x(j,Y,{fieldData:de}))??"text",[x]),re=N.useCallback((j,Y,de)=>Kh(O[j],Y,S),[O,S]),he=N.useCallback((j,Y)=>_k(O[j],b),[O,b]),X=N.useCallback((j,Y)=>(w==null?void 0:w(j,Y))??{},[w]),J=N.useCallback((j,Y,{fieldData:de})=>bn({optionList:(de==null?void 0:de.values)??(k==null?void 0:k(j,Y,{fieldData:de}))??[],placeholder:H.values,autoSelectOption:_}).optionList,[_,k,H.values]),le=N.useCallback(j=>{const Y=O[j.field]??{};if((Y==null?void 0:Y.defaultValue)!==void 0&&Y.defaultValue!==null)return Y.defaultValue;if(y)return y(j,{fieldData:Y});let de="";const Ee=J(j.field,j.operator,{fieldData:Y});if(j.valueSource==="field"){const Se=Hh(Y,K,j.operator);de=Se.length>0?bg(Se,j,W):""}else if(Ee.length>0){const Se=q(j.field,j.operator,{fieldData:Y});Se==="multiselect"?de=W?[]:"":(Se==="select"||Se==="radio")&&(de=bg(Ee,j,W))}else q(j.field,j.operator,{fieldData:Y})==="checkbox"&&(de=!1);return de},[O,K,y,q,J,W]),ve=N.useCallback((j,Y,{fieldData:de})=>{if(C){const Ee=C(j,Y,{fieldData:de});if(Ee)return Ee}return"text"},[C]),ie=N.useCallback(()=>{let j="";const Y=K;if((Y==null?void 0:Y.length)>0&&Y[0]){const We=ct(Y);We&&(j=We)}if(h)if(typeof h=="function"){const We=h(Y);We&&(j=We)}else j=h;const de=F(j),Ee=ct(re(j,de,{fieldData:Io(Y,j)}))??"value",Se=ct(he(j,{fieldData:Io(Y,j)})),ze={id:G(),field:j,operator:de,valueSource:Ee,value:"",...Se?{match:{mode:Se,threshold:1}}:null},Ye=le(ze);return{...ze,value:Ye}},[K,h,he,F,le,re,G]);return{qbId:t,rqbContext:ee,fields:K,fieldMap:O,combinators:B,getMatchModesMain:he,getOperatorsMain:be,getRuleDefaultOperator:F,getSubQueryBuilderPropsMain:X,getValueEditorTypeMain:q,getValueSourcesMain:re,getValuesMain:J,getRuleDefaultValue:le,getInputTypeMain:ve,createRule:ie,createRuleGroup:N.useCallback(j=>j?{id:G(),rules:I?[ie()]:[],not:!1}:{id:G(),rules:I?[ie()]:[],combinator:ct(B)??"",not:!1},[I,B,ie,G])}},yg=e=>gD(e,bD(e)),Qc=N.createContext({}),yD=g.memo(function(t){const r=vg(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),f=Qe(r.removeGroup),u=Qe(r.shiftGroupUp),h=Qe(r.shiftGroupDown),m=N.useMemo(()=>({addRule:a,addGroup:l,cloneGroup:i,toggleLockGroup:c,toggleMuteGroup:d,removeGroup:f,shiftGroupUp:u,shiftGroupDown:h}),[a,l,i,c,d,f,u,h]);return g.createElement("div",{ref:r.previewRef,title:r.accessibleDescription,className:r.outerClassName,"data-testid":pe.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)},g.createElement("div",{ref:r.dropRef,className:r.classNames.header},g.createElement(n,{...r,...m})),g.createElement("div",{className:r.classNames.body},g.createElement(o,{...r,...m})))}),vD=g.memo(function(t){const{schema:{controls:{shiftActions:r,dragHandle:o,combinatorSelector:n,notToggle:a,addRuleAction:l,addGroupAction:i,cloneGroupAction:c,lockGroupAction:d,muteGroupAction:f,removeGroupAction:u}}}=t,h=N.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]),m=N.useMemo(()=>t.schema.showShiftActions?{shiftUp:t.translations.shiftActionUp.title,shiftDown:t.translations.shiftActionDown.title}:void 0,[t.schema.showShiftActions,t.translations]),y=N.useMemo(()=>t.schema.showShiftActions?{shiftUp:t.translations.shiftActionUp.label,shiftDown:t.translations.shiftActionDown.label}:void 0,[t.schema.showShiftActions,t.translations]);return g.createElement(N.Fragment,null,t.schema.showShiftActions&&t.path.length>0&&g.createElement(r,{key:pe.shiftActions,...h,testID:pe.shiftActions,titles:m,labels:y,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&&g.createElement(o,{key:pe.dragHandle,...h,testID:pe.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&&g.createElement(n,{key:pe.combinators,...h,testID:pe.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&&g.createElement(a,{key:pe.notToggle,...h,testID:pe.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}),g.createElement(l,{key:pe.addRule,...h,testID:pe.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&&g.createElement(i,{key:pe.addGroup,...h,testID:pe.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&&g.createElement(c,{key:pe.cloneGroup,...h,testID:pe.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&&g.createElement(d,{key:pe.lockGroup,...h,testID:pe.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&&g.createElement(f,{key:pe.muteGroup,...h,testID:pe.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&&g.createElement(u,{key:pe.removeGroup,...h,testID:pe.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}))}),xD=g.memo(function(t){const{schema:{controls:{combinatorSelector:r,inlineCombinator:o,ruleGroup:n,rule:a}}}=t;return g.createElement(N.Fragment,null,t.ruleGroup.rules.map((l,i,{length:c})=>{const d=t.pathsMemo[i],f=d.path,u=d.disabled||typeof l!="string"&&l.disabled,h=no([0],f),m=t.path.length===0&&i===c-1,y=typeof l=="string"?[...f,l].join("-"):l.id;return g.createElement(N.Fragment,{key:y},i>0&&!t.schema.independentCombinators&&t.schema.showCombinatorsBetweenRules&&g.createElement(o,{key:pe.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:f,disabled:t.disabled,schema:t.schema,ruleGroup:t.ruleGroup}),typeof l=="string"?g.createElement(o,{key:`${pe.inlineCombinator}-independent`,options:t.schema.combinators,value:l,title:t.translations.combinators.title,className:t.classNames.combinators,handleOnChange:b=>t.onIndependentCombinatorChange(b,i),rules:t.ruleGroup.rules,level:t.path.length,context:t.context,validation:t.validationResult,component:r,path:f,disabled:u,schema:t.schema,ruleGroup:t.ruleGroup}):Ge(l)?g.createElement(n,{key:pe.ruleGroup,id:l.id,schema:t.schema,actions:t.actions,path:f,translations:t.translations,ruleGroup:l,rules:l.rules,combinator:mn(l)?l.combinator:void 0,not:!!l.not,disabled:u,parentDisabled:t.parentDisabled||t.disabled,parentMuted:t.parentMuted||t.muted,shiftUpDisabled:h,shiftDownDisabled:m,context:t.context}):g.createElement(a,{key:pe.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:f,disabled:u,parentDisabled:t.parentDisabled||t.disabled,parentMuted:t.parentMuted||t.muted,translations:t.translations,shiftUpDisabled:h,shiftDownDisabled:m,context:t.context}))}))}),vg=e=>{const{id:t,path:r,ruleGroup:o,schema:{qbId:n,accessibleDescriptionGenerator:a,classNames:l,combinators:i,createRule:c,createRuleGroup:d,disabledPaths:f,independentCombinators:u,validationMap:h,enableDragAndDrop:m,getRuleGroupClassname:y,suppressStandardClassnames:b},actions:{onGroupAdd:v,onGroupRemove:w,onPropChange:x,onRuleAdd:S,moveRule:C},disabled:k,parentDisabled:E,parentMuted:M,shiftUpDisabled:_,shiftDownDisabled:I,combinator:A,rules:W,not:$,dropEffect:G="move",groupItems:Q=!1,dragMonitorId:ee="",dropMonitorId:H="",previewRef:K=null,dragRef:O=null,dropRef:B=null,isDragging:fe=!1,isOver:be=!1,dropNotAllowed:F=!1}=e;Yc("ruleGroup",!o),wg(m,!!(ee||H||K||O||B));const q=!!E||!!k,re=!!M||!!(o!=null&&o.muted),he=N.useMemo(()=>o&&mn(o)?o.combinator:o?ct(i):A??ct(i),[A,i,o]),X=N.useMemo(()=>{if(o){if(o.combinator===he||u)return o;const L=structuredClone(o);return L.combinator=he,L}return{rules:W,not:$}},[he,u,$,o,W]),J=N.useMemo(()=>({header:De(b||ue.header,l.header,be&&G==="copy"&&l.dndCopy,F&&l.dndDropNotAllowed,b||{[ue.dndOver]:be,[ue.dndCopy]:be&&G==="copy",[ue.dndDropNotAllowed]:F}),shiftActions:De(b||ue.shiftActions,l.shiftActions),dragHandle:De(b||ue.dragHandle,l.dragHandle),combinators:De(b||ue.combinators,l.valueSelector,l.combinators),notToggle:De(b||ue.notToggle,l.notToggle),addRule:De(b||ue.addRule,l.actionElement,l.addRule),addGroup:De(b||ue.addGroup,l.actionElement,l.addGroup),cloneGroup:De(b||ue.cloneGroup,l.actionElement,l.cloneGroup),lockGroup:De(b||ue.lockGroup,l.actionElement,l.lockGroup),muteGroup:De(b||ue.muteGroup,l.actionElement,l.muteGroup),removeGroup:De(b||ue.removeGroup,l.actionElement,l.removeGroup),body:De(b||ue.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,G,F,be,b]),le=N.useCallback(L=>{q||x("combinator",L,r)},[q,x,r]),ve=N.useCallback((L,R,ge)=>{q||x("combinator",L,[...r,R])},[q,x,r]),ie=N.useCallback((L,R)=>{q||x("not",L,r)},[q,x,r]),j=N.useCallback((L,R)=>{q||S(c(),r,R)},[c,q,S,r]),Y=N.useCallback((L,R)=>{q||v(d(),r,R)},[d,q,v,r]),de=N.useCallback(()=>{q||C(r,[...qe(r),r.at(-1)+1],!0)},[q,C,r]),Ee=N.useCallback((L,R)=>{!q&&!_&&C(r,"up",L==null?void 0:L.altKey)},[q,C,r,_]),Se=N.useCallback((L,R)=>{!q&&!I&&C(r,"down",L==null?void 0:L.altKey)},[q,C,r,I]),ze=N.useCallback(()=>{x("disabled",!q,r)},[q,x,r]),Ye=N.useCallback(()=>{x("muted",!X.muted,r)},[X.muted,x,r]),We=N.useCallback(()=>{q||w(r)},[q,w,r]),Re=h[t??""],me=N.useMemo(()=>qh(Re),[Re]),D=N.useMemo(()=>{var L;return u?null:((L=Io(i,he))==null?void 0:L.className)??""},[he,i,u]),T=N.useMemo(()=>y(X),[y,X]),P=N.useMemo(()=>De(T,D,b||ue.ruleGroup,l.ruleGroup,q&&l.disabled,re&&l.muted,fe&&l.dndDragging,be&&Q&&l.dndGroup,b||{[ue.disabled]:q,[ue.muted]:re,[ue.dndDragging]:fe,[ue.dndGroup]:be&&Q},me),[l.disabled,l.muted,l.dndDragging,l.dndGroup,l.ruleGroup,D,q,re,Q,fe,be,T,b,me]),z=MD({disabled:q,disabledPaths:f,path:r,nestedArray:X.rules}),V=N.useMemo(()=>a({path:r,qbId:n}),[a,r,n]);return{...e,addGroup:Y,addRule:j,accessibleDescription:V,classNames:J,cloneGroup:de,combinator:he,disabled:q,dragMonitorId:ee,dragRef:O,dropMonitorId:H,dropRef:B,isDragging:fe,isOver:be,muted:re,onCombinatorChange:le,onGroupAdd:v,onIndependentCombinatorChange:ve,onNotToggleChange:ie,outerClassName:P,parentDisabled:E,pathsMemo:z,previewRef:K,removeGroup:We,ruleGroup:X,shiftGroupUp:Ee,shiftGroupDown:Se,toggleLockGroup:ze,toggleMuteGroup:Ye,validationClassName:me,validationResult:Re}},wD=e=>{var t,r,o,n;return g.createElement("div",{"data-testid":e.testID,className:e.className},g.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),g.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))},SD=({name:e,disabled:t,checked:r,label:o,handleOnChange:n})=>{const a=g.useId();return g.createElement("label",{htmlFor:a},g.createElement("input",{id:a,type:"radio",value:e,disabled:t,checked:r,onChange:l=>n(l.target.value)}),o)},CD=e=>{const{operator:t,value:r,handleOnChange:o,title:n,className:a,type:l="text",inputType:i,values:c=[],listsAsArrays:d,fieldData:f,disabled:u,separator:h=null,testID:m,selectorComponent:y=e.schema.controls.valueSelector,parseNumbers:b,skipHook:v,valueSource:w,...x}=e,{valueAsArray:S,multiValueHandler:C,bigIntValueHandler:k,parseNumberMethod:E,valueListItemClassName:M,inputTypeCoerced:_}=ND(e);if(t==="null"||t==="notNull")return null;const I=(f==null?void 0:f.placeholder)??"";if((t==="between"||t==="notBetween")&&(l==="select"||l==="text")){const A=["from","to"].map((W,$)=>l==="text"?g.createElement("input",{key:W,type:_,placeholder:I,value:S[$]??"",className:M,disabled:u,onChange:G=>C(G.target.value,$)}):g.createElement(y,{key:W,...x,schema:e.schema,className:M,handleOnChange:G=>C(G,$),disabled:u,value:S[$]??ct(c),options:c,listsAsArrays:d}));return g.createElement("span",{"data-testid":m,className:a,title:n},A[0],h,A[1])}switch(l){case"select":case"multiselect":return g.createElement(y,{...x,schema:e.schema,testID:m,className:a,title:n,handleOnChange:o,disabled:u,value:r,options:c,multiple:l==="multiselect",listsAsArrays:d});case"textarea":return g.createElement("textarea",{"data-testid":m,placeholder:I,value:r,title:n,className:a,disabled:u,onChange:A=>o(A.target.value)});case"switch":case"checkbox":return g.createElement("input",{"data-testid":m,type:"checkbox",className:a,title:n,onChange:A=>o(A.target.checked),checked:!!r,disabled:u});case"radio":return g.createElement("span",{"data-testid":m,className:a,title:n},c.map(A=>g.createElement(SD,{key:A.name,name:A.name,disabled:u,checked:r===A.name,handleOnChange:o,label:A.label})))}return i==="bigint"?g.createElement("input",{"data-testid":m,type:_,placeholder:I,value:`${r}`,title:n,className:a,disabled:u,onChange:A=>k(A.target.value)}):g.createElement("input",{"data-testid":m,type:_,placeholder:I,value:r,title:n,className:a,disabled:u,onChange:A=>o(bs(A.target.value,{parseNumbers:E}))})},ND=e=>{const{handleOnChange:t,inputType:r,operator:o,value:n,listsAsArrays:a,parseNumbers:l,values:i,type:c,skipHook:d,schema:{classNames:f,suppressStandardClassnames:u}}=e;N.useEffect(()=>{!d&&c!=="multiselect"&&!["between","notBetween","in","notIn"].includes(o)&&(Array.isArray(n)||r==="number"&&typeof n=="string"&&n.includes(","))&&t(hs(n,{retainEmptyStrings:!0})[0]??"")},[t,r,o,d,c,n]);const h=N.useMemo(()=>hs(n,{retainEmptyStrings:!0}),[n]),m=N.useMemo(()=>Ck({parseNumbers:l,inputType:r}),[r,l]);return{valueAsArray:h,multiValueHandler:N.useCallback((y,b)=>{const v=W_(h,w=>{w[b]=bs(y,{parseNumbers:m}),b===0&&(o==="between"||o==="notBetween")&&(w.length<2||w[1]===void 0)&&(w[1]=ct(i))});t(a?v:oc(v,","))},[t,a,o,m,h,i]),bigIntValueHandler:N.useCallback(y=>{const b=bs(y,{parseNumbers:m,bigIntOnOverflow:!0});let v;try{v=BigInt(b)}catch{t(b);return}t(v)},[t,m]),parseNumberMethod:m,valueListItemClassName:De(u||ue.valueListItem,f==null?void 0:f.valueListItem),inputTypeCoerced:r==="bigint"||o==="in"||o==="notIn"?"text":r||"text"}},ED=e=>{const{multiple:t,onChange:r}=e;return N.useMemo(()=>t?o=>r(Array.from(o.target.selectedOptions).map(n=>n.value)):o=>r(o.target.value),[t,r])},kD=e=>Sk(e)?e.map(t=>g.createElement("optgroup",{key:t.label,label:t.label},t.options.map(r=>g.createElement("option",{key:r.name,value:r.name,disabled:r.disabled},r.label)))):Array.isArray(e)?e.map(t=>g.createElement("option",{key:t.name,value:t.name,disabled:t.disabled},t.label)):null,Tn=e=>{const{onChange:t,val:r}=_D(e),o=ED({multiple:e.multiple,onChange:t});return g.createElement("select",{"data-testid":e.testID,className:e.className,value:r,title:e.title,disabled:e.disabled,multiple:!!e.multiple,onChange:o},kD(e.options))},_D=e=>{const{handleOnChange:t,listsAsArrays:r=!1,multiple:o=!1,value:n}=e;return{onChange:N.useCallback(a=>{if(o){const l=hs(a);t(r?l:oc(l,","))}else t(a)},[t,r,o]),val:N.useMemo(()=>o?hs(n):n,[o,n])}},DD=({props:e})=>{const t=yg(e),r=t.schema.controls.ruleGroup,o=Qc;return g.createElement(o.Provider,{key:t.dndEnabledAttr,value:t.rqbContext},g.createElement("div",{role:"form",className:t.wrapperClassName,"data-dnd":t.dndEnabledAttr,"data-inlinecombinators":t.inlineCombinatorsAttr},g.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:Fh,disabled:t.rootGroupDisabled,shiftUpDisabled:!0,shiftDownDisabled:!0,parentDisabled:t.queryDisabled,context:e.context})))},rl=()=>null,AD=N.forwardRef(rl),ol={},TD=({finalize:e,...t})=>{var y,b,v,w,x,S,C,k,E,M,_,I,A,W,$,G,Q,ee,H,K,O,B,fe,be,F,q,re,he,X,J,le,ve,ie,j,Y,de,Ee,Se,ze,Ye,We,Re,me,D,T,P,z,V,L,R,ge,Ce,He,St,pt,Cr,ht,kt,Te,je,Ct,Zt,Me,at,Vo,zo,mt,Ln,bl,Nr,Bo,$n,ft,Uo,ot,yl,Fn,Gn,Vn,Wo,zn,Bn,Ut,Un,vl,xl,wl,Sl,Wn,Cl,ce,ke,Ie,Ae,_e,st,gt,Wr,cr,Hr,Ab,Tb,Mb,Ib,Pb,Ob;const r=N.useContext(Qc),o=N.useMemo(()=>Ik(t,r),[t,r,e]),n=e?r.enableDragAndDrop!==!1&&Xh(!1,t.enableDragAndDrop,r.enableDragAndDrop):t.enableDragAndDrop??r.enableDragAndDrop,a=N.useMemo(()=>Ak(Object.assign({},bk),r.controlClassnames,t.controlClassnames),[r.controlClassnames,t.controlClassnames,e]),l=N.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??ol,c=t.controlElements??ol,d=N.useCallback((Rt,Hn,jn)=>{const Yn=Rt==="dragHandle"?AD:rl,Nl=(Rt.endsWith("Action")&&c.actionElement?c.actionElement:void 0)??(Rt.endsWith("Selector")&&c.valueSelector?c.valueSelector:void 0),El=(Rt.endsWith("Action")&&i.actionElement?i.actionElement:void 0)??(Rt.endsWith("Selector")&&i.valueSelector?i.valueSelector:void 0),qn=Hn===null?Yn:Hn??Nl??(jn===null?Yn:jn??El);return qn?{[Rt]:qn}:{[Rt]:nl[Rt]}},[i.actionElement,i.valueSelector,e,c.actionElement,c.valueSelector]),f=N.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?rl:c.valueEditor??(i.valueEditor===null?rl:i.valueEditor)??nl.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??nl.actionElement},{valueSelector:c.valueSelector??i.valueSelector??nl.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??ol,h=r.translations??ol,m=N.useMemo(()=>{var Rt,Hn,jn,Yn,Nl,El,qn,Lb,$b,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,Ly,$y,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,xv,wv,Sv,Cv,Nv,Ev;return Object.assign({},$e("addGroup",{label:[(Rt=u.addGroup)==null?void 0:Rt.label,(Hn=h.addGroup)==null?void 0:Hn.label],title:[(jn=u.addGroup)==null?void 0:jn.title,(Yn=h.addGroup)==null?void 0:Yn.title]},Le),$e("addRule",{label:[(Nl=u.addRule)==null?void 0:Nl.label,(El=h.addRule)==null?void 0:El.label],title:[(qn=u.addRule)==null?void 0:qn.title,(Lb=h.addRule)==null?void 0:Lb.title]},Le),$e("cloneRule",{label:[($b=u.cloneRule)==null?void 0:$b.label,(Fb=h.cloneRule)==null?void 0:Fb.label],title:[(Gb=u.cloneRule)==null?void 0:Gb.title,(Vb=h.cloneRule)==null?void 0:Vb.title]},Le),$e("cloneRuleGroup",{label:[(zb=u.cloneRuleGroup)==null?void 0:zb.label,(Bb=h.cloneRuleGroup)==null?void 0:Bb.label],title:[(Ub=u.cloneRuleGroup)==null?void 0:Ub.title,(Wb=h.cloneRuleGroup)==null?void 0:Wb.title]},Le),$e("combinators",{title:[(Hb=u.combinators)==null?void 0:Hb.title,(jb=h.combinators)==null?void 0:jb.title]},Le),$e("dragHandle",{label:[(Yb=u.dragHandle)==null?void 0:Yb.label,(qb=h.dragHandle)==null?void 0:qb.label],title:[(Qb=u.dragHandle)==null?void 0:Qb.title,(Kb=h.dragHandle)==null?void 0:Kb.title]},Le),$e("fields",{placeholderGroupLabel:[(Xb=u.fields)==null?void 0:Xb.placeholderGroupLabel,(Jb=h.fields)==null?void 0:Jb.placeholderGroupLabel],placeholderLabel:[(Zb=u.fields)==null?void 0:Zb.placeholderLabel,(Rb=h.fields)==null?void 0:Rb.placeholderLabel],placeholderName:[(ey=u.fields)==null?void 0:ey.placeholderName,(ty=h.fields)==null?void 0:ty.placeholderName],title:[(ry=u.fields)==null?void 0:ry.title,(oy=h.fields)==null?void 0:oy.title]},Le),$e("lockGroup",{label:[(ny=u.lockGroup)==null?void 0:ny.label,(ay=h.lockGroup)==null?void 0:ay.label],title:[(sy=u.lockGroup)==null?void 0:sy.title,(ly=h.lockGroup)==null?void 0:ly.title]},Le),$e("lockGroupDisabled",{label:[(iy=u.lockGroupDisabled)==null?void 0:iy.label,(cy=h.lockGroupDisabled)==null?void 0:cy.label],title:[(dy=u.lockGroupDisabled)==null?void 0:dy.title,(uy=h.lockGroupDisabled)==null?void 0:uy.title]},Le),$e("lockRule",{label:[(py=u.lockRule)==null?void 0:py.label,(fy=h.lockRule)==null?void 0:fy.label],title:[(hy=u.lockRule)==null?void 0:hy.title,(my=h.lockRule)==null?void 0:my.title]},Le),$e("lockRuleDisabled",{label:[(gy=u.lockRuleDisabled)==null?void 0:gy.label,(by=h.lockRuleDisabled)==null?void 0:by.label],title:[(yy=u.lockRuleDisabled)==null?void 0:yy.title,(vy=h.lockRuleDisabled)==null?void 0:vy.title]},Le),$e("muteGroup",{label:[(xy=u.muteGroup)==null?void 0:xy.label,(wy=h.muteGroup)==null?void 0:wy.label],title:[(Sy=u.muteGroup)==null?void 0:Sy.title,(Cy=h.muteGroup)==null?void 0:Cy.title]},Le),$e("unmuteGroup",{label:[(Ny=u.unmuteGroup)==null?void 0:Ny.label,(Ey=h.unmuteGroup)==null?void 0:Ey.label],title:[(ky=u.unmuteGroup)==null?void 0:ky.title,(_y=h.unmuteGroup)==null?void 0:_y.title]},Le),$e("muteRule",{label:[(Dy=u.muteRule)==null?void 0:Dy.label,(Ay=h.muteRule)==null?void 0:Ay.label],title:[(Ty=u.muteRule)==null?void 0:Ty.title,(My=h.muteRule)==null?void 0:My.title]},Le),$e("unmuteRule",{label:[(Iy=u.unmuteRule)==null?void 0:Iy.label,(Py=h.unmuteRule)==null?void 0:Py.label],title:[(Oy=u.unmuteRule)==null?void 0:Oy.title,(Ly=h.unmuteRule)==null?void 0:Ly.title]},Le),$e("notToggle",{label:[($y=u.notToggle)==null?void 0:$y.label,(Fy=h.notToggle)==null?void 0:Fy.label],title:[(Gy=u.notToggle)==null?void 0:Gy.title,(Vy=h.notToggle)==null?void 0:Vy.title]},Le),$e("operators",{placeholderGroupLabel:[(zy=u.operators)==null?void 0:zy.placeholderGroupLabel,(By=h.operators)==null?void 0:By.placeholderGroupLabel],placeholderLabel:[(Uy=u.operators)==null?void 0:Uy.placeholderLabel,(Wy=h.operators)==null?void 0:Wy.placeholderLabel],placeholderName:[(Hy=u.operators)==null?void 0:Hy.placeholderName,(jy=h.operators)==null?void 0:jy.placeholderName],title:[(Yy=u.operators)==null?void 0:Yy.title,(qy=h.operators)==null?void 0:qy.title]},Le),$e("values",{placeholderGroupLabel:[(Qy=u.values)==null?void 0:Qy.placeholderGroupLabel,(Ky=h.values)==null?void 0:Ky.placeholderGroupLabel],placeholderLabel:[(Xy=u.values)==null?void 0:Xy.placeholderLabel,(Jy=h.values)==null?void 0:Jy.placeholderLabel],placeholderName:[(Zy=u.values)==null?void 0:Zy.placeholderName,(Ry=h.values)==null?void 0:Ry.placeholderName],title:[(ev=u.values)==null?void 0:ev.title,(tv=h.values)==null?void 0:tv.title]},Le),$e("removeGroup",{label:[(rv=u.removeGroup)==null?void 0:rv.label,(ov=h.removeGroup)==null?void 0:ov.label],title:[(nv=u.removeGroup)==null?void 0:nv.title,(av=h.removeGroup)==null?void 0:av.title]},Le),$e("removeRule",{label:[(sv=u.removeRule)==null?void 0:sv.label,(lv=h.removeRule)==null?void 0:lv.label],title:[(iv=u.removeRule)==null?void 0:iv.title,(cv=h.removeRule)==null?void 0:cv.title]},Le),$e("shiftActionDown",{label:[(dv=u.shiftActionDown)==null?void 0:dv.label,(uv=h.shiftActionDown)==null?void 0:uv.label],title:[(pv=u.shiftActionDown)==null?void 0:pv.title,(fv=h.shiftActionDown)==null?void 0:fv.title]},Le),$e("shiftActionUp",{label:[(hv=u.shiftActionUp)==null?void 0:hv.label,(mv=h.shiftActionUp)==null?void 0:mv.label],title:[(gv=u.shiftActionUp)==null?void 0:gv.title,(bv=h.shiftActionUp)==null?void 0:bv.title]},Le),$e("matchMode",{title:[(yv=u.matchMode)==null?void 0:yv.title,(vv=h.matchMode)==null?void 0:vv.title]},Le),$e("matchThreshold",{title:[(xv=u.matchThreshold)==null?void 0:xv.title,(wv=h.matchThreshold)==null?void 0:wv.title]},Le),$e("value",{title:[(Sv=u.value)==null?void 0:Sv.title,(Cv=h.value)==null?void 0:Cv.title]},Le),$e("valueSourceSelector",{title:[(Nv=u.valueSourceSelector)==null?void 0:Nv.title,(Ev=h.valueSourceSelector)==null?void 0:Ev.title]},Le))},[(y=h.addGroup)==null?void 0:y.label,(b=h.addGroup)==null?void 0:b.title,(v=h.addRule)==null?void 0:v.label,(w=h.addRule)==null?void 0:w.title,(x=h.cloneRule)==null?void 0:x.label,(S=h.cloneRule)==null?void 0:S.title,(C=h.cloneRuleGroup)==null?void 0:C.label,(k=h.cloneRuleGroup)==null?void 0:k.title,(E=h.combinators)==null?void 0:E.title,(M=h.dragHandle)==null?void 0:M.label,(_=h.dragHandle)==null?void 0:_.title,(I=h.fields)==null?void 0:I.placeholderGroupLabel,(A=h.fields)==null?void 0:A.placeholderLabel,(W=h.fields)==null?void 0:W.placeholderName,($=h.fields)==null?void 0:$.title,(G=h.lockGroup)==null?void 0:G.label,(Q=h.lockGroup)==null?void 0:Q.title,(ee=h.lockGroupDisabled)==null?void 0:ee.label,(H=h.lockGroupDisabled)==null?void 0:H.title,(K=h.lockRule)==null?void 0:K.label,(O=h.lockRule)==null?void 0:O.title,(B=h.lockRuleDisabled)==null?void 0:B.label,(fe=h.lockRuleDisabled)==null?void 0:fe.title,(be=h.muteGroup)==null?void 0:be.label,(F=h.muteGroup)==null?void 0:F.title,(q=h.unmuteGroup)==null?void 0:q.label,(re=h.unmuteGroup)==null?void 0:re.title,(he=h.muteRule)==null?void 0:he.label,(X=h.muteRule)==null?void 0:X.title,(J=h.unmuteRule)==null?void 0:J.label,(le=h.unmuteRule)==null?void 0:le.title,(ve=h.matchMode)==null?void 0:ve.title,(ie=h.matchThreshold)==null?void 0:ie.title,(j=h.notToggle)==null?void 0:j.label,(Y=h.notToggle)==null?void 0:Y.title,(de=h.operators)==null?void 0:de.placeholderGroupLabel,(Ee=h.operators)==null?void 0:Ee.placeholderLabel,(Se=h.operators)==null?void 0:Se.placeholderName,(ze=h.operators)==null?void 0:ze.title,(Ye=h.removeGroup)==null?void 0:Ye.label,(We=h.removeGroup)==null?void 0:We.title,(Re=h.removeRule)==null?void 0:Re.label,(me=h.removeRule)==null?void 0:me.title,(D=h.shiftActionDown)==null?void 0:D.label,(T=h.shiftActionDown)==null?void 0:T.title,(P=h.shiftActionUp)==null?void 0:P.label,(z=h.shiftActionUp)==null?void 0:z.title,(V=h.value)==null?void 0:V.title,(L=h.values)==null?void 0:L.placeholderGroupLabel,(R=h.values)==null?void 0:R.placeholderLabel,(ge=h.values)==null?void 0:ge.placeholderName,(Ce=h.values)==null?void 0:Ce.title,(He=h.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,(Ln=u.fields)==null?void 0:Ln.title,(bl=u.lockGroup)==null?void 0:bl.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,(yl=u.lockRuleDisabled)==null?void 0:yl.title,(Fn=u.muteGroup)==null?void 0:Fn.label,(Gn=u.muteGroup)==null?void 0:Gn.title,(Vn=u.unmuteGroup)==null?void 0:Vn.label,(Wo=u.unmuteGroup)==null?void 0:Wo.title,(zn=u.muteRule)==null?void 0:zn.label,(Bn=u.muteRule)==null?void 0:Bn.title,(Ut=u.unmuteRule)==null?void 0:Ut.label,(Un=u.unmuteRule)==null?void 0:Un.title,(vl=u.matchMode)==null?void 0:vl.title,(xl=u.matchThreshold)==null?void 0:xl.title,(wl=u.notToggle)==null?void 0:wl.label,(Sl=u.notToggle)==null?void 0:Sl.title,(Wn=u.operators)==null?void 0:Wn.placeholderGroupLabel,(Cl=u.operators)==null?void 0:Cl.placeholderLabel,(ce=u.operators)==null?void 0:ce.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,(Ab=u.value)==null?void 0:Ab.title,(Tb=u.values)==null?void 0:Tb.placeholderGroupLabel,(Mb=u.values)==null?void 0:Mb.placeholderLabel,(Ib=u.values)==null?void 0:Ib.placeholderName,(Pb=u.values)==null?void 0:Pb.title,(Ob=u.valueSourceSelector)==null?void 0:Ob.title]);return{...o,controlClassnames:l,controlElements:f,enableDragAndDrop:n,translations:m,initialQuery:t.initialQuery,qbId:t.qbId}},MD=({disabled:e,path:t,nestedArray:r,disabledPaths:o})=>{const n=r.length;return N.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 xg=!1;const wg=(e,t)=>{process.env.NODE_ENV!=="production"&&!xg&&e&&!t&&(console.error(ut.errorEnabledDndWithoutReactDnD),xg=!0)},Qe=e=>N.useCallback((t,r)=>{t==null||t.preventDefault(),t==null||t.stopPropagation(),e(t,r)},[e]),ID={mode:"all"},PD=[{name:"",value:"",label:""}],OD=g.memo(function(t){const r=FD(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=N.useMemo(()=>({cloneRule:o,toggleLockRule:n,toggleMuteRule:a,removeRule:l,shiftRuleUp:i,shiftRuleDown:c}),[o,l,c,i,n,a]);return g.createElement("div",{ref:r.dndRef,"data-testid":pe.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?g.createElement($D,{...r,...d}):g.createElement(Sg,{...r,...d}))}),Sg=g.memo(function(t){const{schema:{controls:{shiftActions:r,dragHandle:o,fieldSelector:n,matchModeEditor:a,operatorSelector:l,valueSourceSelector:i,valueEditor:c,cloneRuleAction:d,lockRuleAction:f,muteRuleAction:u,removeRuleAction:h,ruleGroupBodyElements:m,ruleGroupHeaderElements:y}},groupComponentsWrapper:b=g.Fragment}=t,v=N.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]),w=N.useMemo(()=>!(t.schema.fields.length===1&&Lr(t.schema.fields[0])&&"value"in t.schema.fields[0]&&t.schema.fields[0].value===""),[t.schema.fields]),x=N.useMemo(()=>t.schema.showShiftActions?{shiftUp:t.translations.shiftActionUp.title,shiftDown:t.translations.shiftActionDown.title}:void 0,[t.schema.showShiftActions,t.translations]),S=N.useMemo(()=>t.schema.showShiftActions?{shiftUp:t.translations.shiftActionUp.label,shiftDown:t.translations.shiftActionDown.label}:void 0,[t.schema.showShiftActions,t.translations]);return g.createElement(g.Fragment,null,t.schema.showShiftActions&&g.createElement(r,{key:pe.shiftActions,...v,testID:pe.shiftActions,titles:x,labels:S,className:t.classNames.shiftActions,ruleOrGroup:t.rule,shiftUp:t.shiftRuleUp,shiftDown:t.shiftRuleDown,shiftUpDisabled:t.shiftUpDisabled,shiftDownDisabled:t.shiftDownDisabled}),t.schema.enableDragAndDrop&&g.createElement(o,{key:pe.dragHandle,...v,testID:pe.dragHandle,ref:t.dragRef,title:t.translations.dragHandle.title,label:t.translations.dragHandle.label,className:t.classNames.dragHandle,ruleOrGroup:t.rule}),w&&g.createElement(n,{key:pe.fields,...v,testID:pe.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?g.createElement(a,{key:pe.matchModeEditor,...v,testID:pe.matchModeEditor,field:t.rule.field,fieldData:t.fieldData,title:t.translations.matchMode.title,options:t.matchModes,match:t.rule.match??ID,className:t.classNames.matchMode,classNames:t.classNames,handleOnChange:t.onChangeMatchMode}):g.createElement(g.Fragment,null,g.createElement(l,{key:pe.operators,...v,testID:pe.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&&g.createElement(g.Fragment,null,!["null","notnull"].includes(hn(`${t.rule.operator}`))&&t.valueSources.length>1&&g.createElement(i,{key:pe.valueSourceSelector,...v,testID:pe.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}),g.createElement(c,{key:pe.valueEditor,...v,testID:pe.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&&g.createElement(b,{className:t.subQuery.classNames.header},g.createElement(y,t.subQuery)),t.schema.showCloneButtons&&g.createElement(d,{key:pe.cloneRule,...v,testID:pe.cloneRule,label:t.translations.cloneRule.label,title:t.translations.cloneRule.title,className:t.classNames.cloneRule,ruleOrGroup:t.rule,handleOnClick:t.cloneRule}),t.schema.showLockButtons&&g.createElement(f,{key:pe.lockRule,...v,testID:pe.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&&g.createElement(u,{key:pe.muteRule,...v,testID:pe.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}),g.createElement(h,{key:pe.removeRule,...v,testID:pe.removeRule,label:t.translations.removeRule.label,title:t.translations.removeRule.title,className:t.classNames.removeRule,ruleOrGroup:t.rule,handleOnClick:t.removeRule}),t.subQuery&&g.createElement(b,{className:t.subQuery.classNames.body},g.createElement(m,t.subQuery)))}),LD=e=>g.createElement("div",e),$D=g.memo(function(t){const r=N.useMemo(()=>t.schema.createRuleGroup(),[t.schema]),o=yg({...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=vg({...o,ruleGroup:o.rootGroup,path:Fh,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),f=Qe(n.shiftGroupUp),u=Qe(n.shiftGroupDown),h=N.useMemo(()=>({...n,addGroup:l,addRule:a,cloneGroup:i,removeGroup:d,shiftGroupDown:u,shiftGroupUp:f,toggleLockGroup:c}),[l,a,i,d,u,f,n,c]);return g.createElement(Sg,{...t,groupComponentsWrapper:t.groupComponentsWrapper??LD,subQuery:h})}),FD=e=>{const{id:t,path:r,rule:o,schema:{classNames:n,fields:a,fieldMap:l,getInputType:i,getMatchModes:c,getOperators:d,getSubQueryBuilderProps:f,getValueEditorType:u,getValueEditorSeparator:h,getValueSources:m,getValues:y,validationMap:b,enableDragAndDrop:v,getRuleClassname:w,suppressStandardClassnames:x},actions:{moveRule:S,onPropChange:C,onRuleRemove:k},disabled:E,parentDisabled:M,parentMuted:_,shiftUpDisabled:I,shiftDownDisabled:A,field:W,operator:$,value:G,valueSource:Q,dropEffect:ee="move",groupItems:H=!1,dragMonitorId:K="",dropMonitorId:O="",dndRef:B=null,dragRef:fe=null,isDragging:be=!1,isOver:F=!1,dropNotAllowed:q=!1}=e;Yc("rule",!o),wg(v,!!(K||O||B||fe));const re=!!M||!!E,he=!!_||!!(o!=null&&o.muted),X=N.useMemo(()=>o??{id:t,field:W??"",operator:$??"",value:G,valueSource:Q},[W,t,$,o,G,Q]),J=N.useMemo(()=>({shiftActions:De(x||ue.shiftActions,n.shiftActions),dragHandle:De(x||ue.dragHandle,n.dragHandle),fields:De(x||ue.fields,n.valueSelector,n.fields),matchMode:De(x||ue.matchMode,n.valueSelector,n.matchMode),matchThreshold:De(x||ue.matchThreshold,n.valueSelector,n.matchThreshold),operators:De(x||ue.operators,n.valueSelector,n.operators),valueSource:De(x||ue.valueSource,n.valueSelector,n.valueSource),value:De(x||ue.value,n.value),cloneRule:De(x||ue.cloneRule,n.actionElement,n.cloneRule),lockRule:De(x||ue.lockRule,n.actionElement,n.lockRule),muteRule:De(x||ue.muteRule,n.actionElement,n.muteRule),removeRule:De(x||ue.removeRule,n.actionElement,n.removeRule),valueListItem:De(x||ue.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,x]),le=N.useCallback(Me=>(at,Vo)=>{re||C(Me,at,r,Vo)},[re,C,r]),ve=N.useMemo(()=>le("field"),[le]),ie=N.useMemo(()=>le("operator"),[le]),j=N.useMemo(()=>le("match"),[le]),Y=N.useMemo(()=>le("valueSource"),[le]),de=N.useMemo(()=>le("value"),[le]),Ee=N.useCallback((Me,at)=>{re||S(r,[...qe(r),r.at(-1)+1],!0,at)},[re,S,r]),Se=N.useCallback((Me,at)=>C("disabled",!re,r,at),[re,C,r]),ze=N.useCallback((Me,at)=>C("muted",!X.muted,r,at),[X.muted,C,r]),Ye=N.useCallback((Me,at)=>{re||k(r)},[re,k,r]),We=N.useCallback((Me,at)=>{!re&&!I&&S(r,"up",Me==null?void 0:Me.altKey,at)},[re,S,r,I]),Re=N.useCallback((Me,at)=>{!re&&!A&&S(r,"down",Me==null?void 0:Me.altKey,at)},[re,S,r,A]),me=N.useMemo(()=>(l==null?void 0:l[X.field])??{name:X.field,value:X.field,label:X.field},[l,X.field]),D=N.useMemo(()=>me.inputType??i(X.field,X.operator,{fieldData:me}),[me,i,X.field,X.operator]),T=N.useMemo(()=>c(X.field,{fieldData:me}),[me,c,X.field]),P=N.useMemo(()=>d(X.field,{fieldData:me}),[me,d,X.field]),z=N.useMemo(()=>Io(P,X.operator),[P,X.operator]),V=z==null?void 0:z.arity,L=typeof V=="string"&&V==="unary"||typeof V=="number"&&V<2,R=N.useMemo(()=>{const Me=m(X.field,X.operator,{fieldData:me});return X.valueSource&&!Io(Me,X.valueSource)?[...Me,{name:X.valueSource,value:X.valueSource,label:X.valueSource}]:Me},[me,m,X.field,X.operator,X.valueSource]),ge=N.useMemo(()=>R.map(({value:Me})=>Me),[R]),Ce=N.useMemo(()=>X.valueSource==="field"?"select":u(X.field,X.operator,{fieldData:me}),[me,u,X.field,X.operator,X.valueSource]),He=N.useMemo(()=>h(X.field,X.operator,{fieldData:me}),[me,h,X.field,X.operator]),St=N.useMemo(()=>{const Me=X.valueSource==="field"?Hh(me,a,X.operator):y(X.field,X.operator,{fieldData:me});return gs(Me)||$r(Me)?ms(Me):Me},[me,a,y,X.field,X.operator,X.valueSource]),pt=N.useMemo(()=>f(X.field,{fieldData:me}),[me,f,X.field]),Cr=hg({translations:e.translations,fields:me.subproperties??pt.fields??PD,autoSelectField:e.schema.autoSelectField||!!me.subproperties}),ht=N.useMemo(()=>b[t??""]??(typeof me.validator=="function"?me.validator(X):null),[me,t,X,b]),kt=N.useMemo(()=>qh(ht),[ht]),Te=(me==null?void 0:me.className)??"",je=(z==null?void 0:z.className)??"",Ct=T.length>0,Zt=N.useMemo(()=>De(w(X,{fieldData:me}),Te,je,x||ue.rule,n.rule,re&&n.disabled,he&&n.muted,be&&n.dndDragging,F&&n.dndOver,F&&ee==="copy"&&n.dndCopy,F&&H&&n.dndGroup,q&&n.dndDropNotAllowed,Ct&&n.hasSubQuery,x||{[ue.disabled]:re,[ue.muted]:he,[ue.dndDragging]:be,[ue.dndOver]:F,[ue.dndCopy]:F&&ee==="copy",[ue.dndGroup]:F&&H,[ue.dndDropNotAllowed]:q,[ue.hasSubQuery]:Ct},kt),[n.disabled,n.muted,n.dndCopy,n.dndDragging,n.dndGroup,n.dndOver,n.dndDropNotAllowed,n.hasSubQuery,n.rule,re,ee,q,he,Te,me,w,H,Ct,be,F,je,X,x,kt]);return{...e,classNames:J,cloneRule:Ee,disabled:re,dndRef:B,dragMonitorId:K,dragRef:fe,dropMonitorId:O,fieldData:me,generateOnChangeHandler:le,onChangeField:ve,onChangeMatchMode:j,onChangeOperator:ie,onChangeValueSource:Y,onChangeValue:de,hideValueControls:L,inputType:D,matchModes:T,muted:he,operators:P,outerClassName:Zt,removeRule:Ye,rule:X,shiftRuleUp:We,shiftRuleDown:Re,subproperties:Cr,subQueryBuilderProps:pt,toggleLockRule:Se,toggleMuteRule:ze,validationResult:ht,valueEditorSeparator:He,valueEditorType:Ce,values:St,valueSourceOptions:R,valueSources:ge}},nl={actionElement:Qt,addGroupAction:Qt,addRuleAction:Qt,cloneGroupAction:Qt,cloneRuleAction:Qt,combinatorSelector:Tn,dragHandle:H_,fieldSelector:Tn,inlineCombinator:j_,lockGroupAction:Qt,lockRuleAction:Qt,matchModeEditor:q_,muteGroupAction:Qt,muteRuleAction:Qt,notToggle:K_,operatorSelector:Tn,removeGroupAction:Qt,removeRuleAction:Qt,rule:OD,ruleGroup:yD,ruleGroupBodyElements:xD,ruleGroupHeaderElements:vD,shiftActions:wD,valueEditor:CD,valueSelector:Tn,valueSourceSelector:Tn};mg();const GD=e=>g.createElement(S_,{context:pg,store:mg()},e.children),al=e=>g.createElement(GD,null,g.createElement(DD,{props:e}));function Cg(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=VD(e.logic,t,r),e.logic.requireWhen&&(o.required=sl(e.logic.requireWhen,t,r)),e.logic.disableWhen&&(o.disabled=sl(e.logic.disableWhen,t,r))),o}function VD(e,t,r){const{showWhen:o,hideWhen:n}=e;let a=!0;if(o&&o.rules&&o.rules.length>0&&(a=sl(o,t,r)),n&&n.rules&&n.rules.length>0){const l=sl(n,t,r);a=a&&!l}return a}function sl(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(f=>f.id===l.field||f.attributes.name===l.field),c=(i==null?void 0:i.attributes.name)||l.field,d=t[c];return zD(d,l.operator,l.value)});return o==="and"?a.every(l=>l):a.some(l=>l)}function zD(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 BD(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 UD(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 WD(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 ll(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 il(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 cl=({title:e,children:t,defaultOpen:r=!1,badge:o})=>{const[n,a]=N.useState(r);return s.jsxs(Wf,{open:n,onOpenChange:a,className:p("border border-border rounded-lg overflow-hidden"),children:[s.jsx(Hf,{asChild:!0,children:s.jsxs(Be,{variant:"ghost",className:p("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:p("flex items-center gap-2 text-sm font-medium text-foreground"),children:[e,o&&s.jsx(_i,{variant:"secondary",className:p("text-xs"),children:o})]}),s.jsx(Do,{className:p("h-4 w-4 transition-transform",n&&"rotate-180")})]})}),s.jsx(jf,{children:s.jsx("div",{className:p("p-3 bg-card"),children:t})})]})},HD=({element:e,elements:t,onUpdate:r})=>{var u,h,m,y,b,v,w,x,S,C,k,E,M,_,I,A,W,$,G,Q,ee,H,K,O,B,fe,be,F,q,re,he,X,J,le,ve,ie,j,Y,de,Ee,Se,ze,Ye,We,Re,me,D,T;const o=N.useMemo(()=>t.filter(P=>P.id!==e.id).filter(P=>!["divider","spacer","paragraph","image","link","formHeading","sectionHeading","subheading","submit"].includes(P.type)).map(P=>{var R;const z=BD(P.type),V=UD(P.type),L=WD(P);return{name:P.id,label:P.properties.label||P.attributes.name||`Field ${P.order+1}`,inputType:V,operators:z.map(ge=>({name:ge.name,label:ge.label})),values:L==null?void 0:L.map(ge=>({name:ge.name,label:ge.label})),defaultOperator:((R=z[0])==null?void 0:R.name)||"equals"}}),[t,e.id]),n=N.useCallback(P=>{const z=il(P),V={...e.logic,showWhen:z.rules.length>0?z:void 0};r({logic:V})},[e.logic,r]),a=N.useCallback(P=>{const z=il(P),V={...e.logic,hideWhen:z.rules.length>0?z:void 0};r({logic:V})},[e.logic,r]),l=N.useCallback(P=>{const z=il(P),V={...e.logic,requireWhen:z.rules.length>0?z:void 0};r({logic:V})},[e.logic,r]),i=N.useCallback(P=>{const z=il(P),V={...e.logic,disableWhen:z.rules.length>0?z:void 0};r({logic:V})},[e.logic,r]),c=N.useCallback(()=>{r({logic:void 0})},[r]),d=e.logic&&((((h=(u=e.logic.showWhen)==null?void 0:u.rules)==null?void 0:h.length)??0)>0||(((y=(m=e.logic.hideWhen)==null?void 0:m.rules)==null?void 0:y.length)??0)>0||(((v=(b=e.logic.requireWhen)==null?void 0:b.rules)==null?void 0:v.length)??0)>0||(((x=(w=e.logic.disableWhen)==null?void 0:w.rules)==null?void 0:x.length)??0)>0),f=(((k=(C=(S=e.logic)==null?void 0:S.showWhen)==null?void 0:C.rules)==null?void 0:k.length)??0)+(((_=(M=(E=e.logic)==null?void 0:E.hideWhen)==null?void 0:M.rules)==null?void 0:_.length)??0)+(((W=(A=(I=e.logic)==null?void 0:I.requireWhen)==null?void 0:A.rules)==null?void 0:W.length)??0)+(((Q=(G=($=e.logic)==null?void 0:$.disableWhen)==null?void 0:G.rules)==null?void 0:Q.length)??0);return o.length===0?s.jsxs("div",{className:p("text-sm text-muted-foreground p-4 text-center bg-muted/50 rounded-lg"),children:[s.jsx(uf,{className:p("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:p("text-xs mt-1"),children:"Logic rules require other fields to reference."})]}):s.jsxs("div",{className:p("space-y-3"),children:[s.jsxs("div",{className:p("flex items-center justify-between"),children:[s.jsx("div",{className:p("text-sm text-muted-foreground"),children:d?s.jsxs("span",{className:p("flex items-center gap-2"),children:[s.jsx("span",{className:p("w-2 h-2 bg-primary rounded-full")}),f," rule",f!==1?"s":""," ","configured"]}):s.jsx("span",{className:p("text-muted-foreground/70"),children:"No logic configured"})}),d&&s.jsxs(Be,{variant:"ghost",size:"sm",className:p("text-destructive hover:text-destructive hover:bg-destructive/10"),onClick:c,children:[s.jsx(Ci,{className:p("h-3 w-3 mr-1")}),"Clear all"]})]}),s.jsxs(cl,{title:"Show When",defaultOpen:!!((K=(H=(ee=e.logic)==null?void 0:ee.showWhen)==null?void 0:H.rules)!=null&&K.length),badge:(fe=(B=(O=e.logic)==null?void 0:O.showWhen)==null?void 0:B.rules)!=null&&fe.length?String(e.logic.showWhen.rules.length):void 0,children:[s.jsx("p",{className:p("text-xs text-muted-foreground mb-2"),children:"This element will only be visible when these conditions are met."}),s.jsx("div",{className:p("query-builder-wrapper"),children:s.jsx(al,{fields:o,query:ll((be=e.logic)==null?void 0:be.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(cl,{title:"Hide When",defaultOpen:!!((re=(q=(F=e.logic)==null?void 0:F.hideWhen)==null?void 0:q.rules)!=null&&re.length),badge:(J=(X=(he=e.logic)==null?void 0:he.hideWhen)==null?void 0:X.rules)!=null&&J.length?String(e.logic.hideWhen.rules.length):void 0,children:[s.jsx("p",{className:p("text-xs text-muted-foreground mb-2"),children:"This element will be hidden when these conditions are met."}),s.jsx("div",{className:p("query-builder-wrapper"),children:s.jsx(al,{fields:o,query:ll((le=e.logic)==null?void 0:le.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(cl,{title:"Required When",defaultOpen:!!((j=(ie=(ve=e.logic)==null?void 0:ve.requireWhen)==null?void 0:ie.rules)!=null&&j.length),badge:(Ee=(de=(Y=e.logic)==null?void 0:Y.requireWhen)==null?void 0:de.rules)!=null&&Ee.length?String(e.logic.requireWhen.rules.length):void 0,children:[s.jsx("p",{className:p("text-xs text-muted-foreground mb-2"),children:"This element will be required when these conditions are met."}),s.jsx("div",{className:p("query-builder-wrapper"),children:s.jsx(al,{fields:o,query:ll((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(cl,{title:"Disabled When",defaultOpen:!!((We=(Ye=(ze=e.logic)==null?void 0:ze.disableWhen)==null?void 0:Ye.rules)!=null&&We.length),badge:(D=(me=(Re=e.logic)==null?void 0:Re.disableWhen)==null?void 0:me.rules)!=null&&D.length?String(e.logic.disableWhen.rules.length):void 0,children:[s.jsx("p",{className:p("text-xs text-muted-foreground mb-2"),children:"This element will be disabled when these conditions are met."}),s.jsx("div",{className:p("query-builder-wrapper"),children:s.jsx(al,{fields:o,query:ll((T=e.logic)==null?void 0:T.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 jD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],YD=jD.reduce((e,t)=>{const r=qf(`Primitive.${t}`),o=g.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}},{}),qD="Label",Ng=g.forwardRef((e,t)=>s.jsx(YD.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())}}));Ng.displayName=qD;var Eg=Ng;const QD=Va("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Bt=g.forwardRef(({className:e,...t},r)=>s.jsx(Eg,{ref:r,className:p(QD(),e),...t}));Bt.displayName=Eg.displayName;const Kc=g.forwardRef(({className:e,...t},r)=>s.jsx("textarea",{className:p("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}));Kc.displayName="Textarea";var dl="Checkbox",[KD]=ur(dl),[XD,Xc]=KD(dl);function JD(e){const{__scopeCheckbox:t,checked:r,children:o,defaultChecked:n,disabled:a,form:l,name:i,onCheckedChange:c,required:d,value:f="on",internal_do_not_use_render:u}=e,[h,m]=hr({prop:r,defaultProp:n??!1,onChange:c,caller:dl}),[y,b]=g.useState(null),[v,w]=g.useState(null),x=g.useRef(!1),S=y?!!l||!!y.closest("form"):!0,C={checked:h,disabled:a,setChecked:m,control:y,setControl:b,name:i,form:l,value:f,hasConsumerStoppedPropagationRef:x,required:d,defaultChecked:zr(n)?!1:n,isFormControl:S,bubbleInput:v,setBubbleInput:w};return s.jsx(XD,{scope:t,...C,children:ZD(u)?u(C):o})}var kg="CheckboxTrigger",_g=g.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...o},n)=>{const{control:a,value:l,disabled:i,checked:c,required:d,setControl:f,setChecked:u,hasConsumerStoppedPropagationRef:h,isFormControl:m,bubbleInput:y}=Xc(kg,e),b=Fe(n,f),v=g.useRef(c);return g.useEffect(()=>{const w=a==null?void 0:a.form;if(w){const x=()=>u(v.current);return w.addEventListener("reset",x),()=>w.removeEventListener("reset",x)}},[a,u]),s.jsx(Ne.button,{type:"button",role:"checkbox","aria-checked":zr(c)?"mixed":c,"aria-required":d,"data-state":Ig(c),"data-disabled":i?"":void 0,disabled:i,value:l,...o,ref:b,onKeyDown:we(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:we(r,w=>{u(x=>zr(x)?!0:!x),y&&m&&(h.current=w.isPropagationStopped(),h.current||w.stopPropagation())})})});_g.displayName=kg;var Jc=g.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:o,checked:n,defaultChecked:a,required:l,disabled:i,value:c,onCheckedChange:d,form:f,...u}=e;return s.jsx(JD,{__scopeCheckbox:r,checked:n,defaultChecked:a,disabled:i,required:l,onCheckedChange:d,name:o,form:f,value:c,internal_do_not_use_render:({isFormControl:h})=>s.jsxs(s.Fragment,{children:[s.jsx(_g,{...u,ref:t,__scopeCheckbox:r}),h&&s.jsx(Mg,{__scopeCheckbox:r})]})})});Jc.displayName=dl;var Dg="CheckboxIndicator",Ag=g.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:o,...n}=e,a=Xc(Dg,r);return s.jsx(Ao,{present:o||zr(a.checked)||a.checked===!0,children:s.jsx(Ne.span,{"data-state":Ig(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t,style:{pointerEvents:"none",...e.style}})})});Ag.displayName=Dg;var Tg="CheckboxBubbleInput",Mg=g.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:o,hasConsumerStoppedPropagationRef:n,checked:a,defaultChecked:l,required:i,disabled:c,name:d,value:f,form:u,bubbleInput:h,setBubbleInput:m}=Xc(Tg,e),y=Fe(r,m),b=lp(a),v=qu(o);g.useEffect(()=>{const x=h;if(!x)return;const S=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(S,"checked").set,E=!n.current;if(b!==a&&k){const M=new Event("click",{bubbles:E});x.indeterminate=zr(a),k.call(x,zr(a)?!1:a),x.dispatchEvent(M)}},[h,b,a,n]);const w=g.useRef(zr(a)?!1:a);return s.jsx(Ne.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??w.current,required:i,disabled:c,name:d,value:f,form:u,...t,tabIndex:-1,ref:y,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Mg.displayName=Tg;function ZD(e){return typeof e=="function"}function zr(e){return e==="indeterminate"}function Ig(e){return zr(e)?"indeterminate":e?"checked":"unchecked"}const Zc=g.forwardRef(({className:e,...t},r)=>s.jsx(Jc,{ref:r,className:p("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(Ag,{className:p("grid place-content-center text-current"),children:s.jsx(lf,{className:p("h-4 w-4")})})}));Zc.displayName=Jc.displayName;var Kt="Accordion",RD=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Rc,eA,tA]=jl(Kt),[ul]=ur(Kt,[tA,Vf]),ed=Vf(),Pg=N.forwardRef((e,t)=>{const{type:r,...o}=e,n=o,a=o;return s.jsx(Rc.Provider,{scope:e.__scopeAccordion,children:r==="multiple"?s.jsx(aA,{...a,ref:t}):s.jsx(nA,{...n,ref:t})})});Pg.displayName=Kt;var[Og,rA]=ul(Kt),[Lg,oA]=ul(Kt,{collapsible:!1}),nA=N.forwardRef((e,t)=>{const{value:r,defaultValue:o,onValueChange:n=()=>{},collapsible:a=!1,...l}=e,[i,c]=hr({prop:r,defaultProp:o??"",onChange:n,caller:Kt});return s.jsx(Og,{scope:e.__scopeAccordion,value:N.useMemo(()=>i?[i]:[],[i]),onItemOpen:c,onItemClose:N.useCallback(()=>a&&c(""),[a,c]),children:s.jsx(Lg,{scope:e.__scopeAccordion,collapsible:a,children:s.jsx($g,{...l,ref:t})})})}),aA=N.forwardRef((e,t)=>{const{value:r,defaultValue:o,onValueChange:n=()=>{},...a}=e,[l,i]=hr({prop:r,defaultProp:o??[],onChange:n,caller:Kt}),c=N.useCallback(f=>i((u=[])=>[...u,f]),[i]),d=N.useCallback(f=>i((u=[])=>u.filter(h=>h!==f)),[i]);return s.jsx(Og,{scope:e.__scopeAccordion,value:l,onItemOpen:c,onItemClose:d,children:s.jsx(Lg,{scope:e.__scopeAccordion,collapsible:!0,children:s.jsx($g,{...a,ref:t})})})}),[sA,pl]=ul(Kt),$g=N.forwardRef((e,t)=>{const{__scopeAccordion:r,disabled:o,dir:n,orientation:a="vertical",...l}=e,i=N.useRef(null),c=Fe(i,t),d=eA(r),u=ua(n)==="ltr",h=we(e.onKeyDown,m=>{var _;if(!RD.includes(m.key))return;const y=m.target,b=d().filter(I=>{var A;return!((A=I.ref.current)!=null&&A.disabled)}),v=b.findIndex(I=>I.ref.current===y),w=b.length;if(v===-1)return;m.preventDefault();let x=v;const S=0,C=w-1,k=()=>{x=v+1,x>C&&(x=S)},E=()=>{x=v-1,x<S&&(x=C)};switch(m.key){case"Home":x=S;break;case"End":x=C;break;case"ArrowRight":a==="horizontal"&&(u?k():E());break;case"ArrowDown":a==="vertical"&&k();break;case"ArrowLeft":a==="horizontal"&&(u?E():k());break;case"ArrowUp":a==="vertical"&&E();break}const M=x%w;(_=b[M].ref.current)==null||_.focus()});return s.jsx(sA,{scope:r,disabled:o,direction:n,orientation:a,children:s.jsx(Rc.Slot,{scope:r,children:s.jsx(Ne.div,{...l,"data-orientation":a,ref:c,onKeyDown:o?void 0:h})})})}),fl="AccordionItem",[lA,td]=ul(fl),Fg=N.forwardRef((e,t)=>{const{__scopeAccordion:r,value:o,...n}=e,a=pl(fl,r),l=rA(fl,r),i=ed(r),c=Dr(),d=o&&l.value.includes(o)||!1,f=a.disabled||e.disabled;return s.jsx(lA,{scope:r,open:d,disabled:f,triggerId:c,children:s.jsx(Uf,{"data-orientation":a.orientation,"data-state":Wg(d),...i,...n,ref:t,disabled:f,open:d,onOpenChange:u=>{u?l.onItemOpen(o):l.onItemClose(o)}})})});Fg.displayName=fl;var Gg="AccordionHeader",Vg=N.forwardRef((e,t)=>{const{__scopeAccordion:r,...o}=e,n=pl(Kt,r),a=td(Gg,r);return s.jsx(Ne.h3,{"data-orientation":n.orientation,"data-state":Wg(a.open),"data-disabled":a.disabled?"":void 0,...o,ref:t})});Vg.displayName=Gg;var rd="AccordionTrigger",zg=N.forwardRef((e,t)=>{const{__scopeAccordion:r,...o}=e,n=pl(Kt,r),a=td(rd,r),l=oA(rd,r),i=ed(r);return s.jsx(Rc.ItemSlot,{scope:r,children:s.jsx(WN,{"aria-disabled":a.open&&!l.collapsible||void 0,"data-orientation":n.orientation,id:a.triggerId,...i,...o,ref:t})})});zg.displayName=rd;var Bg="AccordionContent",Ug=N.forwardRef((e,t)=>{const{__scopeAccordion:r,...o}=e,n=pl(Kt,r),a=td(Bg,r),l=ed(r);return s.jsx(HN,{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}})});Ug.displayName=Bg;function Wg(e){return e?"open":"closed"}var iA=Pg,cA=Fg,dA=Vg,Hg=zg,jg=Ug;const Yg=iA,od=g.forwardRef(({className:e,...t},r)=>s.jsx(cA,{ref:r,className:p("border-b",e),...t}));od.displayName="AccordionItem";const nd=g.forwardRef(({className:e,children:t,...r},o)=>s.jsx(dA,{className:p("flex"),children:s.jsxs(Hg,{ref:o,className:p("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(Do,{className:p("h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200")})]})}));nd.displayName=Hg.displayName;const ad=g.forwardRef(({className:e,children:t,...r},o)=>s.jsx(jg,{ref:o,className:p("overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"),...r,children:s.jsx("div",{className:p("pb-4 pt-0",e),children:t})}));ad.displayName=jg.displayName;function sd(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 uA(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 pA(e,t,r){const{field:o,value:n}=r;if(o.includes(".")){const[l,...i]=o.split("."),c=i.join(".");return sd(e,l,c)===n}return sd(e,t.section,o)===n}const qg=({field:e,element:t,onUpdate:r})=>{var a;const o=sd(t,e.section,e.key)??e.defaultValue,n=l=>{r(uA(e.section,t,e.key,l))};switch(e.type){case"text":case"url":case"color":return s.jsxs("div",{className:p("space-y-1.5"),children:[s.jsx(Bt,{className:p("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:p("text-[11px] text-muted-foreground"),children:e.description})]});case"textarea":return s.jsxs("div",{className:p("space-y-1.5"),children:[s.jsx(Bt,{className:p("text-xs font-medium text-muted-foreground"),children:e.label}),s.jsx(Kc,{value:o??"",onChange:l=>n(l.target.value),placeholder:e.placeholder,rows:e.rows??3}),e.description&&s.jsx("p",{className:p("text-[11px] text-muted-foreground"),children:e.description})]});case"number":return s.jsxs("div",{className:p("space-y-1.5"),children:[s.jsx(Bt,{className:p("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:p("text-[11px] text-muted-foreground"),children:e.description})]});case"checkbox":return s.jsxs("div",{className:p("flex items-start space-x-2"),children:[s.jsx(Zc,{id:`ds-${e.section}-${e.key}`,checked:!!o,onCheckedChange:l=>n(!!l)}),s.jsxs("div",{className:p("space-y-0.5 leading-none"),children:[s.jsx(Bt,{htmlFor:`ds-${e.section}-${e.key}`,className:p("text-xs font-medium text-foreground cursor-pointer"),children:e.label}),e.description&&s.jsx("p",{className:p("text-[11px] text-muted-foreground"),children:e.description})]})]});case"select":return s.jsxs("div",{className:p("space-y-1.5"),children:[s.jsx(Bt,{className:p("text-xs font-medium text-muted-foreground"),children:e.label}),s.jsxs(La,{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(tn,{children:s.jsx($a,{placeholder:e.placeholder||"Select..."})}),s.jsx(rn,{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:p("text-[11px] text-muted-foreground"),children:e.description})]});default:return null}},fA=({title:e,icon:t,defaultOpen:r=!0,children:o})=>s.jsx(Yg,{type:"single",collapsible:!0,defaultValue:r?"item":void 0,children:s.jsxs(od,{value:"item",className:p("border-b border-border"),children:[s.jsx(nd,{className:p("px-4 py-3 hover:bg-muted/50 hover:no-underline"),children:s.jsxs("span",{className:p("text-sm font-medium text-foreground flex items-center gap-2"),children:[t&&s.jsx("span",{children:t}),e]})}),s.jsx(ad,{className:p("px-4 pb-4 mb-4"),children:s.jsx("div",{className:p("space-y-4"),children:o})})]})}),hA=({element:e,schema:t,onUpdate:r})=>{const o=t.fields.filter(c=>c.showWhen?pA(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(fA,{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(qg,{field:u,element:e,onUpdate:r},`${u.section}.${u.key}`)}return s.jsx("div",{className:p("grid grid-cols-2 gap-2"),children:c.map(u=>s.jsx(qg,{field:u,element:e,onUpdate:r},`${u.section}.${u.key}`))},`row-${d}`)})})},Br=({title:e,children:t,defaultOpen:r=!0,icon:o})=>s.jsx(Yg,{type:"single",collapsible:!0,defaultValue:r?"item":void 0,children:s.jsxs(od,{value:"item",className:p("border-b border-border"),children:[s.jsx(nd,{className:p("px-4 py-3 hover:bg-muted/50 hover:no-underline"),children:s.jsxs("span",{className:p("text-sm font-medium text-foreground flex items-center gap-2"),children:[o&&s.jsx("span",{children:o}),e]})}),s.jsx(ad,{className:p("px-4 pb-4 mb-4"),children:s.jsx("div",{className:p("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:p("space-y-1.5"),children:[s.jsx(Bt,{className:p("text-sm font-medium"),children:e}),o==="textarea"?s.jsx(Kc,{value:t??"",onChange:f=>r(f.target.value),placeholder:n,rows:a,className:p("resize-none")}):o==="color"?s.jsxs("div",{className:p("flex gap-2"),children:[s.jsx("input",{type:"color",value:(t==null?void 0:t.toString())||"#000000",onChange:f=>r(f.target.value),className:p("w-10 h-9 border border-input rounded-md cursor-pointer")}),s.jsx(Vt,{type:"text",value:t??"",onChange:f=>r(f.target.value),placeholder:n||"#000000",className:p("flex-1")})]}):s.jsx(Vt,{type:o,value:t??"",onChange:f=>r(f.target.value),placeholder:n,min:l,max:i,step:c}),d&&s.jsx("p",{className:p("text-xs text-muted-foreground"),children:d})]}),Qg=({label:e,checked:t,onChange:r,description:o})=>s.jsxs("div",{className:p("flex items-start gap-3"),children:[s.jsx(Zc,{id:e,checked:t||!1,onCheckedChange:n=>r(n===!0),className:p("mt-0.5")}),s.jsxs("div",{className:p("grid gap-0.5 leading-none"),children:[s.jsx(Bt,{htmlFor:e,className:p("text-sm font-medium cursor-pointer"),children:e}),o&&s.jsx("p",{className:p("text-xs text-muted-foreground"),children:o})]})]}),ld=({label:e,value:t,onChange:r,options:o,helpText:n})=>s.jsxs("div",{className:p("space-y-1.5"),children:[s.jsx(Bt,{className:p("text-sm font-medium"),children:e}),s.jsxs(La,{value:(t==null?void 0:t.toString())??"",onValueChange:r,children:[s.jsx(tn,{className:p("w-full"),children:s.jsx($a,{placeholder:"Select..."})}),s.jsx(rn,{children:o.map(a=>s.jsx(Rr,{value:a.value,children:a.label},a.value))})]}),n&&s.jsx("p",{className:p("text-xs text-muted-foreground"),children:n})]}),mA=({options:e,onChange:t})=>{const r=(l,i,c)=>{const d=[...e];if(d[l]={...d[l],[i]:c},i==="label"){const f=d[l].value,u=e[l].label;(!f||f===Fl(u))&&(d[l].value=Fl(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:p("space-y-2"),children:[s.jsx(Bt,{className:p("text-sm font-medium"),children:"Options"}),s.jsx("div",{className:p("space-y-2"),children:e.map((l,i)=>s.jsxs("div",{className:p("flex items-center gap-1"),children:[s.jsxs("div",{className:p("flex flex-col gap-0.5"),children:[s.jsx(Be,{variant:"ghost",size:"icon",className:p("h-5 w-5"),onClick:()=>a(i,"up"),disabled:i===0,children:s.jsx(cf,{className:p("h-3 w-3")})}),s.jsx(Be,{variant:"ghost",size:"icon",className:p("h-5 w-5"),onClick:()=>a(i,"down"),disabled:i===e.length-1,children:s.jsx(Do,{className:p("h-3 w-3")})})]}),s.jsx(Vt,{type:"text",value:l.label,onChange:c=>r(i,"label",c.target.value),placeholder:"Label",className:p("flex-1 h-8")}),s.jsx(Vt,{type:"text",value:l.value,onChange:c=>r(i,"value",c.target.value),placeholder:"Value",className:p("w-20 h-8 text-muted-foreground")}),s.jsx(Qa,{children:s.jsxs(ar,{children:[s.jsx(sr,{asChild:!0,children:s.jsx(Be,{variant:"ghost",size:"icon",className:p("h-8 w-8"),onClick:()=>n(i),disabled:e.length<=1,children:s.jsx(Oa,{className:p("h-4 w-4")})})}),s.jsx(Yt,{children:"Remove option"})]})})]},i))}),s.jsxs(Be,{variant:"ghost",size:"sm",className:p("text-primary"),onClick:o,children:[s.jsx(Si,{className:p("h-4 w-4 mr-1")}),"Add option"]})]})},gA=({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((h,m)=>m!==u))},i=(u,h,m)=>{const y=[...e];y[u]={...y[u],[h]:m},r(y)},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((h,m)=>m!==u))},f=(u,h,m)=>{const y=[...t];y[u]={...y[u],[h]:m},o(y)};return s.jsxs("div",{className:p("space-y-4"),children:[s.jsxs("div",{className:p("space-y-2"),children:[s.jsx(Bt,{className:p("text-sm font-medium"),children:"Rows"}),s.jsx("div",{className:p("space-y-2"),children:e.map((u,h)=>s.jsxs("div",{className:p("flex items-center gap-2"),children:[s.jsx(Vt,{type:"text",value:u.id,onChange:m=>i(h,"id",m.target.value),placeholder:"Row ID",className:p("w-24 h-8 font-mono text-xs")}),s.jsx(Vt,{type:"text",value:u.label,onChange:m=>i(h,"label",m.target.value),placeholder:"Row label",className:p("flex-1 h-8")}),s.jsx(Be,{variant:"ghost",size:"icon",className:p("h-8 w-8"),onClick:()=>l(h),disabled:e.length<=1,children:s.jsx(Oa,{className:p("h-4 w-4")})})]},h))}),s.jsxs(Be,{variant:"ghost",size:"sm",className:p("text-primary"),onClick:a,children:[s.jsx(Si,{className:p("h-4 w-4 mr-1")}),"Add row"]})]}),s.jsxs("div",{className:p("space-y-2"),children:[s.jsx(Bt,{className:p("text-sm font-medium"),children:"Columns"}),s.jsx("div",{className:p("space-y-2"),children:t.map((u,h)=>s.jsxs("div",{className:p("flex items-center gap-2"),children:[s.jsx(Vt,{type:"text",value:u.id,onChange:m=>f(h,"id",m.target.value),placeholder:"Column ID",className:p("w-24 h-8 font-mono text-xs")}),s.jsx(Vt,{type:"text",value:u.label,onChange:m=>f(h,"label",m.target.value),placeholder:"Column label",className:p("flex-1 h-8")}),n&&s.jsxs(La,{value:u.type||"text",onValueChange:m=>f(h,"type",m),children:[s.jsx(tn,{className:p("w-24 h-8"),children:s.jsx($a,{})}),s.jsxs(rn,{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:p("h-8 w-8"),onClick:()=>d(h),disabled:t.length<=1,children:s.jsx(Oa,{className:p("h-4 w-4")})})]},h))}),s.jsxs(Be,{variant:"ghost",size:"sm",className:p("text-primary"),onClick:c,children:[s.jsx(Si,{className:p("h-4 w-4 mr-1")}),"Add column"]})]})]})},bA=({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(ld,{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:p("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"})]})]})},yA=({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(ld,{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(ld,{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"})]})},vA=({element:e,onUpdate:t})=>{var c,d,f,u,h,m,y,b,v,w,x;const r=(S,C)=>{t({validation:{...e.validation,[S]:C}})},o=Qv(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(Qg,{label:"Required",checked:(c=e.validation)==null?void 0:c.required,onChange:S=>r("required",S),description:"Field must be filled"}),n&&s.jsxs("div",{className:p("grid grid-cols-2 gap-2"),children:[s.jsx(Oe,{label:"Min Length",value:(d=e.validation)==null?void 0:d.minLength,onChange:S=>r("minLength",S?parseInt(S):void 0),type:"number",placeholder:"0",min:0}),s.jsx(Oe,{label:"Max Length",value:(f=e.validation)==null?void 0:f.maxLength,onChange:S=>r("maxLength",S?parseInt(S):void 0),type:"number",placeholder:"255",min:0})]}),a&&s.jsxs("div",{className:p("grid grid-cols-2 gap-2"),children:[s.jsx(Oe,{label:"Min Value",value:(u=e.validation)==null?void 0:u.min,onChange:S=>r("min",S?parseFloat(S):void 0),type:"number"}),s.jsx(Oe,{label:"Max Value",value:(h=e.validation)==null?void 0:h.max,onChange:S=>r("max",S?parseFloat(S):void 0),type:"number"})]}),o.supportsPattern&&s.jsx(Oe,{label:"Pattern (Regex)",value:(m=e.validation)==null?void 0:m.pattern,onChange:S=>r("pattern",S),placeholder:"^[a-zA-Z]+$",helpText:"Regular expression for validation"}),l&&s.jsxs("div",{className:p("grid grid-cols-2 gap-2"),children:[s.jsx(Oe,{label:"Min Files",value:(y=e.validation)==null?void 0:y.minFiles,onChange:S=>r("minFiles",S?parseInt(S):void 0),type:"number",min:0}),s.jsx(Oe,{label:"Max Files",value:(b=e.validation)==null?void 0:b.maxFiles,onChange:S=>r("maxFiles",S?parseInt(S):void 0),type:"number",min:1})]}),i&&s.jsxs("div",{className:p("grid grid-cols-2 gap-2"),children:[s.jsx(Oe,{label:"Min Dates",value:(v=e.validation)==null?void 0:v.minDates,onChange:S=>r("minDates",S?parseInt(S):void 0),type:"number",min:0}),s.jsx(Oe,{label:"Max Dates",value:(w=e.validation)==null?void 0:w.maxDates,onChange:S=>r("maxDates",S?parseInt(S):void 0),type:"number",min:1})]}),s.jsx(Oe,{label:"Error Message",value:(x=e.validation)==null?void 0:x.errorMessage,onChange:S=>r("errorMessage",S),placeholder:"Custom error message..."})]})},xA=({element:e,onUpdate:t,existingNames:r})=>{const[o,n]=N.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:p("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:p("w-full px-3 py-2 border rounded-md text-sm focus:outline-none focus:ring-2 focus:border-transparent",o?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-blue-500")}),o&&s.jsx("p",{className:p("mt-1 text-xs text-red-600"),children:o}),s.jsx("p",{className:p("mt-1 text-xs text-gray-500"),children:"Used as the key in JSON output"})]})})},wA=({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(mA,{options:((n=e.config)==null?void 0:n.options)||[],onChange:r}),s.jsx(Qg,{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..."})]})},SA=({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(gA,{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"})})},CA=()=>s.jsxs("div",{className:p("flex flex-col items-center justify-center h-full text-center px-6 py-12"),children:[s.jsx("div",{className:p("w-12 h-12 bg-muted rounded-full flex items-center justify-center mb-4"),children:s.jsx(LC,{className:p("w-6 h-6 text-muted-foreground")})}),s.jsx("h3",{className:p("text-sm font-medium text-foreground mb-1"),children:"No element selected"}),s.jsx("p",{className:p("text-xs text-muted-foreground"),children:"Click on an element in the canvas to edit its properties"})]}),NA=({element:e,onUpdate:t,propertyConfig:r})=>{const o=(f,u)=>{t({properties:{...e.properties,[f]: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:f=>o("label",f),placeholder:"Enter label..."}),l&&s.jsx(Oe,{label:"Placeholder",value:e.properties.placeholder,onChange:f=>o("placeholder",f),placeholder:"Enter placeholder..."}),i&&s.jsx(Oe,{label:"Description",value:e.properties.description,onChange:f=>o("description",f),type:"textarea",placeholder:"Enter description...",rows:2}),(c||d)&&s.jsxs("div",{className:p("grid grid-cols-2 gap-2"),children:[c&&s.jsx(Oe,{label:"Prefix",value:e.properties.prefix,onChange:f=>o("prefix",f),placeholder:"$"}),d&&s.jsx(Oe,{label:"Suffix",value:e.properties.suffix,onChange:f=>o("suffix",f),placeholder:".00"})]})]})},EA=()=>{const e=Zv(),t=Z(y=>y.updateElement),r=Z(y=>y.deleteElement),o=Z(y=>y.duplicateElement),n=Z(y=>y.schema.elements),a=N.useMemo(()=>new Set(n.map(y=>y.attributes.name).filter(Boolean)),[n]);if(!e)return s.jsx("div",{className:p("w-72 bg-card border-l border-border flex-col h-full hidden"),children:s.jsx(CA,{})});const l=y=>{t(e.id,y)},i=Ke.get(e.type),c=!!(i!=null&&i.renderSettings),d=i==null?void 0:i.settingsSchema,f=c||!!d,u=i!=null&&i.icon&&typeof i.icon=="string"?i.icon:Ei[e.type],h=(i==null?void 0:i.label)??Ni[e.type],m=d==null?void 0:d.showSections;return s.jsxs("div",{className:p("w-72 bg-card border-l border-border flex flex-col h-full flex-shrink-0"),children:[s.jsxs("div",{className:p("p-4 border-b border-border"),children:[s.jsxs("div",{className:p("flex items-center gap-2 mb-1"),children:[s.jsx("span",{className:p("text-xl"),children:u}),s.jsx("h2",{className:p("text-lg font-semibold text-foreground"),children:h})]}),s.jsxs("div",{className:p("flex gap-2 mt-3"),children:[s.jsxs(Be,{variant:"secondary",size:"sm",className:p("flex-1"),onClick:()=>o(e.id),children:[s.jsx(AC,{className:p("h-3 w-3 mr-1")}),"Duplicate"]}),s.jsxs(Be,{variant:"destructive",size:"sm",className:p("flex-1"),onClick:()=>{window.confirm("Are you sure you want to delete this element?")&&r(e.id)},children:[s.jsx(Ci,{className:p("h-3 w-3 mr-1")}),"Delete"]})]})]}),s.jsxs(zi,{className:p("flex-1"),children:[c&&i.renderSettings({element:e,onUpdate:l}),!c&&s.jsxs(s.Fragment,{children:[(m==null?void 0:m.properties)!==!1&&(f?s.jsx(NA,{element:e,onUpdate:l,propertyConfig:d==null?void 0:d.properties}):s.jsx(bA,{element:e,onUpdate:l})),(m==null?void 0:m.options)!==!1&&hN(e.type)&&s.jsx(wA,{element:e,onUpdate:l}),(m==null?void 0:m.matrix)!==!1&&gN(e.type)&&s.jsx(SA,{element:e,onUpdate:l}),d&&s.jsx(hA,{element:e,schema:d,onUpdate:l}),(m==null?void 0:m.layout)!==!1&&s.jsx(yA,{element:e,onUpdate:l}),(m==null?void 0:m.validation)!==!1&&((i==null?void 0:i.supportsValidation)??mN(e.type))&&!Vl(e.type)&&s.jsx(vA,{element:e,onUpdate:l}),(m==null?void 0:m.attributes)!==!1&&((i==null?void 0:i.structure)==="field"||dN(e.type))&&!Vl(e.type)&&s.jsx(xA,{element:e,onUpdate:l,existingNames:a}),(m==null?void 0:m.logic)!==!1&&!Vl(e.type)&&s.jsx(Br,{title:"Conditional Logic",icon:"⚡",children:s.jsx(HD,{element:e,elements:n,onUpdate:l})})]})]})]})};var Mn=e=>e.type==="checkbox",ho=e=>e instanceof Date,Et=e=>e==null;const Kg=e=>typeof e=="object";var Je=e=>!Et(e)&&!Array.isArray(e)&&Kg(e)&&!ho(e),kA=e=>Je(e)&&e.target?Mn(e.target)?e.target.checked:e.target.value:e,_A=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,DA=(e,t)=>e.has(_A(t)),AA=e=>{const t=e.constructor&&e.constructor.prototype;return Je(t)&&t.hasOwnProperty("isPrototypeOf")},id=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(id&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Je(e)&&AA(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 hl=e=>/^\w*$/.test(e),Ue=e=>e===void 0,cd=e=>Array.isArray(e)?e.filter(Boolean):[],dd=e=>cd(e.replace(/["|']|\]/g,"").split(/\.|\[/)),se=(e,t,r)=>{if(!t||!Je(e))return r;const o=(hl(t)?[t]:dd(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=hl(t)?[t]:dd(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 Xg={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=N.createContext(null);Jg.displayName="HookFormControlContext";var TA=(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 MA=typeof window<"u"?N.useLayoutEffect:N.useEffect;var Ft=e=>typeof e=="string",IA=(e,t,r,o,n)=>Ft(e)?(o&&t.watch.add(e),se(r,e,n)):Array.isArray(e)?e.map(a=>(o&&t.watch.add(a),se(r,a))):(o&&(t.watchAll=!0),r),ud=e=>Et(e)||!Kg(e);function Ur(e,t,r=new WeakSet){if(ud(e)||ud(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 pd=N.createContext(null);pd.displayName="HookFormContext";const fd=()=>N.useContext(pd),Zg=e=>{const{children:t,watch:r,getValues:o,getFieldState:n,setError:a,clearErrors:l,setValue:i,trigger:c,formState:d,resetField:f,reset:u,handleSubmit:h,unregister:m,control:y,register:b,setFocus:v,subscribe:w}=e;return N.createElement(pd.Provider,{value:N.useMemo(()=>({watch:r,getValues:o,getFieldState:n,setError:a,clearErrors:l,setValue:i,trigger:c,formState:d,resetField:f,reset:u,handleSubmit:h,unregister:m,control:y,register:b,setFocus:v,subscribe:w}),[l,y,d,n,o,h,b,u,f,a,v,i,w,c,m,r])},N.createElement(Jg.Provider,{value:y},t))};var PA=(e,t,r,o,n)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[o]:n||!0}}:{},In=e=>Array.isArray(e)?e:[e],Rg=()=>{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 eb(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=eb(n,a);Je(l)&&(r[o]=l)}else e[o]&&(r[o]=a)}return r}var wt=e=>Je(e)&&!Object.keys(e).length,hd=e=>e.type==="file",ml=e=>{if(!id)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},tb=e=>e.type==="select-multiple",md=e=>e.type==="radio",OA=e=>md(e)||Mn(e),gd=e=>ml(e)&&e.isConnected;function LA(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 $A(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:hl(t)?[t]:dd(t),o=r.length===1?e:LA(e,r),n=r.length-1,a=r[n];return o&&delete o[a],n!==0&&(Je(o)&&wt(o)||Array.isArray(o)&&$A(o))&&Ze(e,r.slice(0,-1)),e}var FA=e=>{for(const t in e)if(Xt(e[t]))return!0;return!1};function rb(e){return Array.isArray(e)||Je(e)&&!FA(e)}function bd(e,t={}){for(const r in e){const o=e[r];rb(o)?(t[r]=Array.isArray(o)?[]:{},bd(o,t[r])):Ue(o)||(t[r]=!0)}return t}function Fo(e,t,r){r||(r=bd(t));for(const o in e){const n=e[o];if(rb(n))Ue(t)||ud(r[o])?r[o]=bd(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 ob={value:!1,isValid:!1},nb={value:!0,isValid:!0};var ab=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===""?nb:{value:e[0].value,isValid:!0}:nb:ob}return ob},sb=(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 lb={isValid:!1,value:null};var ib=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,lb):lb;function cb(e){const t=e.ref;return hd(t)?t.files:md(t)?ib(e.refs).value:tb(t)?[...t.selectedOptions].map(({value:r})=>r):Mn(t)?ab(e.refs).value:sb(Ue(t.value)?e.ref.value:t.value,e)}var GA=(e,t,r,o)=>{const n={};for(const a of e){const l=se(t,a);l&&Ve(n,a,l._f)}return{criteriaMode:r,names:[...e],fields:n,shouldUseNativeValidation:o}},gl=e=>e instanceof RegExp,Pn=e=>Ue(e)?e:gl(e)?e.source:Je(e)?gl(e.value)?e.value.source:e.value:e,db=e=>({isOnSubmit:!e||e===Jt.onSubmit,isOnBlur:e===Jt.onBlur,isOnChange:e===Jt.onChange,isOnAll:e===Jt.all,isOnTouch:e===Jt.onTouched});const ub="AsyncFunction";var VA=e=>!!e&&!!e.validate&&!!(Xt(e.validate)&&e.validate.constructor.name===ub||Je(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===ub)),zA=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),pb=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(o=>e.startsWith(o)&&/^\.\w+/.test(e.slice(o.length))));const On=(e,t,r,o)=>{for(const n of r||Object.keys(e)){const a=se(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(On(i,t))break}else if(Je(i)&&On(i,t))break}}};function fb(e,t,r){const o=se(e,r);if(o||hl(r))return{error:o,name:r};const n=r.split(".");for(;n.length;){const a=n.join("."),l=se(t,a),i=se(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 BA=(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))},UA=(e,t,r)=>!e||!t||e===t||In(e).some(o=>o&&(r?o===t:o.startsWith(t)||t.startsWith(o))),WA=(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,HA=(e,t)=>!cd(se(e,t)).length&&Ze(e,t),jA=(e,t,r)=>{const o=In(se(e,r));return Ve(o,"root",t[r]),Ve(e,r,o),e};function hb(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)&&!gl(e)?e:{value:e,message:""},mb=async(e,t,r,o,n,a)=>{const{ref:l,refs:i,required:c,maxLength:d,minLength:f,min:u,max:h,pattern:m,validate:y,name:b,valueAsNumber:v,mount:w}=e._f,x=se(r,b);if(!w||t.has(b))return{};const S=i?i[0]:l,C=$=>{n&&S.reportValidity&&(S.setCustomValidity(ir($)?"":$||""),S.reportValidity())},k={},E=md(l),M=Mn(l),_=E||M,I=(v||hd(l))&&Ue(l.value)&&Ue(x)||ml(l)&&l.value===""||x===""||Array.isArray(x)&&!x.length,A=PA.bind(null,b,o,k),W=($,G,Q,ee=Sr.maxLength,H=Sr.minLength)=>{const K=$?G:Q;k[b]={type:$?ee:H,message:K,ref:l,...A($?ee:H,K)}};if(a?!Array.isArray(x)||!x.length:c&&(!_&&(I||Et(x))||ir(x)&&!x||M&&!ab(i).isValid||E&&!ib(i).isValid)){const{value:$,message:G}=Ft(c)?{value:!!c,message:c}:Go(c);if($&&(k[b]={type:Sr.required,message:G,ref:S,...A(Sr.required,G)},!o))return C(G),k}if(!I&&(!Et(u)||!Et(h))){let $,G;const Q=Go(h),ee=Go(u);if(!Et(x)&&!isNaN(x)){const H=l.valueAsNumber||x&&+x;Et(Q.value)||($=H>Q.value),Et(ee.value)||(G=H<ee.value)}else{const H=l.valueAsDate||new Date(x),K=fe=>new Date(new Date().toDateString()+" "+fe),O=l.type=="time",B=l.type=="week";Ft(Q.value)&&x&&($=O?K(x)>K(Q.value):B?x>Q.value:H>new Date(Q.value)),Ft(ee.value)&&x&&(G=O?K(x)<K(ee.value):B?x<ee.value:H<new Date(ee.value))}if(($||G)&&(W(!!$,Q.message,ee.message,Sr.max,Sr.min),!o))return C(k[b].message),k}if((d||f)&&!I&&(Ft(x)||a&&Array.isArray(x))){const $=Go(d),G=Go(f),Q=!Et($.value)&&x.length>+$.value,ee=!Et(G.value)&&x.length<+G.value;if((Q||ee)&&(W(Q,$.message,G.message),!o))return C(k[b].message),k}if(m&&!I&&Ft(x)){const{value:$,message:G}=Go(m);if(gl($)&&!x.match($)&&(k[b]={type:Sr.pattern,message:G,ref:l,...A(Sr.pattern,G)},!o))return C(G),k}if(y){if(Xt(y)){const $=await y(x,r),G=hb($,S);if(G&&(k[b]={...G,...A(Sr.validate,G.message)},!o))return C(G.message),k}else if(Je(y)){let $={};for(const G in y){if(!wt($)&&!o)break;const Q=hb(await y[G](x,r),S,G);Q&&($={...Q,...A(G,Q.message)},C(Q.message),o&&(k[b]=$))}if(!wt($)&&(k[b]={ref:S,...$},!o))return k}}return C(!0),k};const YA={mode:Jt.onSubmit,reValidateMode:Jt.onChange,shouldFocusError:!0};function qA(e={}){let t={...YA,...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 f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={...f};let h={...u};const m={array:Rg(),state:Rg()},y=t.criteriaMode===Jt.all,b=D=>T=>{clearTimeout(d),d=setTimeout(D,T)},v=async D=>{if(!l.keepIsValid&&!t.disabled&&(u.isValid||h.isValid||D)){let T;t.resolver?(T=wt((await _()).errors),w()):T=await A(o,!0),T!==r.isValid&&m.state.next({isValid:T})}},w=(D,T)=>{!t.disabled&&(u.isValidating||u.validatingFields||h.isValidating||h.validatingFields)&&((D||Array.from(i.mount)).forEach(P=>{P&&(T?Ve(r.validatingFields,P,T):Ze(r.validatingFields,P))}),m.state.next({validatingFields:r.validatingFields,isValidating:!wt(r.validatingFields)}))},x=(D,T=[],P,z,V=!0,L=!0)=>{if(z&&P&&!t.disabled){if(l.action=!0,L&&Array.isArray(se(o,D))){const R=P(se(o,D),z.argA,z.argB);V&&Ve(o,D,R)}if(L&&Array.isArray(se(r.errors,D))){const R=P(se(r.errors,D),z.argA,z.argB);V&&Ve(r.errors,D,R),HA(r.errors,D)}if((u.touchedFields||h.touchedFields)&&L&&Array.isArray(se(r.touchedFields,D))){const R=P(se(r.touchedFields,D),z.argA,z.argB);V&&Ve(r.touchedFields,D,R)}(u.dirtyFields||h.dirtyFields)&&(r.dirtyFields=Fo(n,a)),m.state.next({name:D,isDirty:$(D,T),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Ve(a,D,T)},S=(D,T)=>{Ve(r.errors,D,T),m.state.next({errors:r.errors})},C=D=>{r.errors=D,m.state.next({errors:r.errors,isValid:!1})},k=(D,T,P,z)=>{const V=se(o,D);if(V){const L=se(a,D,Ue(P)?se(n,D):P);Ue(L)||z&&z.defaultChecked||T?Ve(a,D,T?L:cb(V._f)):ee(D,L),l.mount&&!l.action&&v()}},E=(D,T,P,z,V)=>{let L=!1,R=!1;const ge={name:D};if(!t.disabled){if(!P||z){(u.isDirty||h.isDirty)&&(R=r.isDirty,r.isDirty=ge.isDirty=$(),L=R!==ge.isDirty);const Ce=Ur(se(n,D),T);R=!!se(r.dirtyFields,D),Ce?Ze(r.dirtyFields,D):Ve(r.dirtyFields,D,!0),ge.dirtyFields=r.dirtyFields,L=L||(u.dirtyFields||h.dirtyFields)&&R!==!Ce}if(P){const Ce=se(r.touchedFields,D);Ce||(Ve(r.touchedFields,D,P),ge.touchedFields=r.touchedFields,L=L||(u.touchedFields||h.touchedFields)&&Ce!==P)}L&&V&&m.state.next(ge)}return L?ge:{}},M=(D,T,P,z)=>{const V=se(r.errors,D),L=(u.isValid||h.isValid)&&ir(T)&&r.isValid!==T;if(t.delayError&&P?(c=b(()=>S(D,P)),c(t.delayError)):(clearTimeout(d),c=null,P?Ve(r.errors,D,P):Ze(r.errors,D)),(P?!Ur(V,P):V)||!wt(z)||L){const R={...z,...L&&ir(T)?{isValid:T}:{},errors:r.errors,name:D};r={...r,...R},m.state.next(R)}},_=async D=>(w(D,!0),await t.resolver(a,t.context,GA(D||i.mount,o,t.criteriaMode,t.shouldUseNativeValidation))),I=async D=>{const{errors:T}=await _(D);if(w(D),D)for(const P of D){const z=se(T,P);z?Ve(r.errors,P,z):Ze(r.errors,P)}else r.errors=T;return T},A=async(D,T,P={valid:!0})=>{for(const z in D){const V=D[z];if(V){const{_f:L,...R}=V;if(L){const ge=i.array.has(L.name),Ce=V._f&&VA(V._f);Ce&&u.validatingFields&&w([L.name],!0);const He=await mb(V,i.disabled,a,y,t.shouldUseNativeValidation&&!T,ge);if(Ce&&u.validatingFields&&w([L.name]),He[L.name]&&(P.valid=!1,T||e.shouldUseNativeValidation))break;!T&&(se(He,L.name)?ge?jA(r.errors,He,L.name):Ve(r.errors,L.name,He[L.name]):Ze(r.errors,L.name))}!wt(R)&&await A(R,T,P)}}return P.valid},W=()=>{for(const D of i.unMount){const T=se(o,D);T&&(T._f.refs?T._f.refs.every(P=>!gd(P)):!gd(T._f.ref))&&le(D)}i.unMount=new Set},$=(D,T)=>!t.disabled&&(D&&T&&Ve(a,D,T),!Ur(be(),n)),G=(D,T,P)=>IA(D,i,{...l.mount?a:Ue(T)?n:Ft(D)?{[D]:T}:T},P,T),Q=D=>cd(se(l.mount?a:n,D,t.shouldUnregister?se(n,D,[]):[])),ee=(D,T,P={})=>{const z=se(o,D);let V=T;if(z){const L=z._f;L&&(!L.disabled&&Ve(a,D,sb(T,L)),V=ml(L.ref)&&Et(T)?"":T,tb(L.ref)?[...L.ref.options].forEach(R=>R.selected=V.includes(R.value)):L.refs?Mn(L.ref)?L.refs.forEach(R=>{(!R.defaultChecked||!R.disabled)&&(Array.isArray(V)?R.checked=!!V.find(ge=>ge===R.value):R.checked=V===R.value||!!V)}):L.refs.forEach(R=>R.checked=R.value===V):hd(L.ref)?L.ref.value="":(L.ref.value=V,L.ref.type||m.state.next({name:D,values:rt(a)})))}(P.shouldDirty||P.shouldTouch)&&E(D,V,P.shouldTouch,P.shouldDirty,!0),P.shouldValidate&&fe(D)},H=(D,T,P)=>{for(const z in T){if(!T.hasOwnProperty(z))return;const V=T[z],L=D+"."+z,R=se(o,L);(i.array.has(D)||Je(V)||R&&!R._f)&&!ho(V)?H(L,V,P):ee(L,V,P)}},K=(D,T,P={})=>{const z=se(o,D),V=i.array.has(D),L=rt(T);Ve(a,D,L),V?(m.array.next({name:D,values:rt(a)}),(u.isDirty||u.dirtyFields||h.isDirty||h.dirtyFields)&&P.shouldDirty&&m.state.next({name:D,dirtyFields:Fo(n,a),isDirty:$(D,L)})):z&&!z._f&&!Et(L)?H(D,L,P):ee(D,L,P),pb(D,i)?m.state.next({...r,name:D,values:rt(a)}):m.state.next({name:l.mount?D:void 0,values:rt(a)})},O=async D=>{l.mount=!0;const T=D.target;let P=T.name,z=!0;const V=se(o,P),L=Ce=>{z=Number.isNaN(Ce)||ho(Ce)&&isNaN(Ce.getTime())||Ur(Ce,se(a,P,Ce))},R=db(t.mode),ge=db(t.reValidateMode);if(V){let Ce,He;const St=T.type?cb(V._f):kA(D),pt=D.type===Xg.BLUR||D.type===Xg.FOCUS_OUT,Cr=!zA(V._f)&&!t.resolver&&!se(r.errors,P)&&!V._f.deps||WA(pt,se(r.touchedFields,P),r.isSubmitted,ge,R),ht=pb(P,i,pt);Ve(a,P,St),pt?(!T||!T.readOnly)&&(V._f.onBlur&&V._f.onBlur(D),c&&c(0)):V._f.onChange&&V._f.onChange(D);const kt=E(P,St,pt),Te=!wt(kt)||ht;if(!pt&&m.state.next({name:P,type:D.type,values:rt(a)}),Cr)return(u.isValid||h.isValid)&&(t.mode==="onBlur"?pt&&v():pt||v()),Te&&m.state.next({name:P,...ht?{}:kt});if(!pt&&ht&&m.state.next({...r}),t.resolver){const{errors:je}=await _([P]);if(w([P]),L(St),z){const Ct=fb(r.errors,o,P),Zt=fb(je,o,Ct.name||P);Ce=Zt.error,P=Zt.name,He=wt(je)}}else w([P],!0),Ce=(await mb(V,i.disabled,a,y,t.shouldUseNativeValidation))[P],w([P]),L(St),z&&(Ce?He=!1:(u.isValid||h.isValid)&&(He=await A(o,!0)));z&&(V._f.deps&&(!Array.isArray(V._f.deps)||V._f.deps.length>0)&&fe(V._f.deps),M(P,He,Ce,kt))}},B=(D,T)=>{if(se(r.errors,T)&&D.focus)return D.focus(),1},fe=async(D,T={})=>{let P,z;const V=In(D);if(t.resolver){const L=await I(Ue(D)?D:V);P=wt(L),z=D?!V.some(R=>se(L,R)):P}else D?(z=(await Promise.all(V.map(async L=>{const R=se(o,L);return await A(R&&R._f?{[L]:R}:R)}))).every(Boolean),!(!z&&!r.isValid)&&v()):z=P=await A(o);return m.state.next({...!Ft(D)||(u.isValid||h.isValid)&&P!==r.isValid?{}:{name:D},...t.resolver||!D?{isValid:P}:{},errors:r.errors}),T.shouldFocus&&!z&&On(o,B,D?V:i.mount),z},be=(D,T)=>{let P={...l.mount?a:n};return T&&(P=eb(T.dirtyFields?r.dirtyFields:r.touchedFields,P)),Ue(D)?P:Ft(D)?se(P,D):D.map(z=>se(P,z))},F=(D,T)=>({invalid:!!se((T||r).errors,D),isDirty:!!se((T||r).dirtyFields,D),error:se((T||r).errors,D),isValidating:!!se(r.validatingFields,D),isTouched:!!se((T||r).touchedFields,D)}),q=D=>{D&&In(D).forEach(T=>Ze(r.errors,T)),m.state.next({errors:D?r.errors:{}})},re=(D,T,P)=>{const z=(se(o,D,{_f:{}})._f||{}).ref,V=se(r.errors,D)||{},{ref:L,message:R,type:ge,...Ce}=V;Ve(r.errors,D,{...Ce,...T,ref:z}),m.state.next({name:D,errors:r.errors,isValid:!1}),P&&P.shouldFocus&&z&&z.focus&&z.focus()},he=(D,T)=>Xt(D)?m.state.subscribe({next:P=>"values"in P&&D(G(void 0,T),P)}):G(D,T,!0),X=D=>m.state.subscribe({next:T=>{UA(D.name,T.name,D.exact)&&BA(T,D.formState||u,We,D.reRenderRoot)&&D.callback({values:{...a},...r,...T,defaultValues:n})}}).unsubscribe,J=D=>(l.mount=!0,h={...h,...D.formState},X({...D,formState:{...f,...D.formState}})),le=(D,T={})=>{for(const P of D?In(D):i.mount)i.mount.delete(P),i.array.delete(P),T.keepValue||(Ze(o,P),Ze(a,P)),!T.keepError&&Ze(r.errors,P),!T.keepDirty&&Ze(r.dirtyFields,P),!T.keepTouched&&Ze(r.touchedFields,P),!T.keepIsValidating&&Ze(r.validatingFields,P),!t.shouldUnregister&&!T.keepDefaultValue&&Ze(n,P);m.state.next({values:rt(a)}),m.state.next({...r,...T.keepDirty?{isDirty:$()}:{}}),!T.keepIsValid&&v()},ve=({disabled:D,name:T})=>{if(ir(D)&&l.mount||D||i.disabled.has(T)){const V=i.disabled.has(T)!==!!D;D?i.disabled.add(T):i.disabled.delete(T),V&&l.mount&&!l.action&&v()}},ie=(D,T={})=>{let P=se(o,D);const z=ir(T.disabled)||ir(t.disabled);return Ve(o,D,{...P||{},_f:{...P&&P._f?P._f:{ref:{name:D}},name:D,mount:!0,...T}}),i.mount.add(D),P?ve({disabled:ir(T.disabled)?T.disabled:t.disabled,name:D}):k(D,!0,T.value),{...z?{disabled:T.disabled||t.disabled}:{},...t.progressive?{required:!!T.required,min:Pn(T.min),max:Pn(T.max),minLength:Pn(T.minLength),maxLength:Pn(T.maxLength),pattern:Pn(T.pattern)}:{},name:D,onChange:O,onBlur:O,ref:V=>{if(V){ie(D,T),P=se(o,D);const L=Ue(V.value)&&V.querySelectorAll&&V.querySelectorAll("input,select,textarea")[0]||V,R=OA(L),ge=P._f.refs||[];if(R?ge.find(Ce=>Ce===L):L===P._f.ref)return;Ve(o,D,{_f:{...P._f,...R?{refs:[...ge.filter(gd),L,...Array.isArray(se(n,D))?[{}]:[]],ref:{type:L.type,name:D}}:{ref:L}}}),k(D,!1,void 0,L)}else P=se(o,D,{}),P._f&&(P._f.mount=!1),(t.shouldUnregister||T.shouldUnregister)&&!(DA(i.array,D)&&l.action)&&i.unMount.add(D)}}},j=()=>t.shouldFocusError&&On(o,B,i.mount),Y=D=>{ir(D)&&(m.state.next({disabled:D}),On(o,(T,P)=>{const z=se(o,P);z&&(T.disabled=z._f.disabled||D,Array.isArray(z._f.refs)&&z._f.refs.forEach(V=>{V.disabled=z._f.disabled||D}))},0,!1))},de=(D,T)=>async P=>{let z;P&&(P.preventDefault&&P.preventDefault(),P.persist&&P.persist());let V=rt(a);if(m.state.next({isSubmitting:!0}),t.resolver){const{errors:L,values:R}=await _();w(),r.errors=L,V=rt(R)}else await A(o);if(i.disabled.size)for(const L of i.disabled)Ze(V,L);if(Ze(r.errors,"root"),wt(r.errors)){m.state.next({errors:{}});try{await D(V,P)}catch(L){z=L}}else T&&await T({...r.errors},P),j(),setTimeout(j);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:wt(r.errors)&&!z,submitCount:r.submitCount+1,errors:r.errors}),z)throw z},Ee=(D,T={})=>{se(o,D)&&(Ue(T.defaultValue)?K(D,rt(se(n,D))):(K(D,T.defaultValue),Ve(n,D,rt(T.defaultValue))),T.keepTouched||Ze(r.touchedFields,D),T.keepDirty||(Ze(r.dirtyFields,D),r.isDirty=T.defaultValue?$(D,rt(se(n,D))):$()),T.keepError||(Ze(r.errors,D),u.isValid&&v()),m.state.next({...r}))},Se=(D,T={})=>{const P=D?rt(D):n,z=rt(P),V=wt(D),L=V?n:z;if(T.keepDefaultValues||(n=P),!T.keepValues){if(T.keepDirtyValues){const R=new Set([...i.mount,...Object.keys(Fo(n,a))]);for(const ge of Array.from(R)){const Ce=se(r.dirtyFields,ge),He=se(a,ge),St=se(L,ge);Ce&&!Ue(He)?Ve(L,ge,He):!Ce&&!Ue(St)&&K(ge,St)}}else{if(id&&Ue(D))for(const R of i.mount){const ge=se(o,R);if(ge&&ge._f){const Ce=Array.isArray(ge._f.refs)?ge._f.refs[0]:ge._f.ref;if(ml(Ce)){const He=Ce.closest("form");if(He){He.reset();break}}}}if(T.keepFieldsRef)for(const R of i.mount)K(R,se(L,R));else o={}}a=t.shouldUnregister?T.keepDefaultValues?rt(n):{}:rt(L),m.array.next({values:{...L}}),m.state.next({values:{...L}})}i={mount:T.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!u.isValid||!!T.keepIsValid||!!T.keepDirtyValues||!t.shouldUnregister&&!wt(L),l.watch=!!t.shouldUnregister,l.keepIsValid=!!T.keepIsValid,l.action=!1,T.keepErrors||(r.errors={}),m.state.next({submitCount:T.keepSubmitCount?r.submitCount:0,isDirty:V?!1:T.keepDirty?r.isDirty:!!(T.keepDefaultValues&&!Ur(D,n)),isSubmitted:T.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:V?{}:T.keepDirtyValues?T.keepDefaultValues&&a?Fo(n,a):r.dirtyFields:T.keepDefaultValues&&D?Fo(n,D):T.keepDirty?r.dirtyFields:{},touchedFields:T.keepTouched?r.touchedFields:{},errors:T.keepErrors?r.errors:{},isSubmitSuccessful:T.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:n})},ze=(D,T)=>Se(Xt(D)?D(a):D,{...t.resetOptions,...T}),Ye=(D,T={})=>{const P=se(o,D),z=P&&P._f;if(z){const V=z.refs?z.refs[0]:z.ref;V.focus&&setTimeout(()=>{V.focus(),T.shouldSelect&&Xt(V.select)&&V.select()})}},We=D=>{r={...r,...D}},me={control:{register:ie,unregister:le,getFieldState:F,handleSubmit:de,setError:re,_subscribe:X,_runSchema:_,_updateIsValidating:w,_focusError:j,_getWatch:G,_getDirty:$,_setValid:v,_setFieldArray:x,_setDisabledField:ve,_setErrors:C,_getFieldArray:Q,_reset:Se,_resetDefaultValues:()=>Xt(t.defaultValues)&&t.defaultValues().then(D=>{ze(D,t.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:W,_disableForm:Y,_subjects:m,_proxyFormState:u,get _fields(){return o},get _formValues(){return a},get _state(){return l},set _state(D){l=D},get _defaultValues(){return n},get _names(){return i},set _names(D){i=D},get _formState(){return r},get _options(){return t},set _options(D){t={...t,...D}}},subscribe:J,trigger:fe,register:ie,handleSubmit:de,watch:he,setValue:K,getValues:be,reset:ze,resetField:Ee,clearErrors:q,unregister:le,setError:re,setFocus:Ye,getFieldState:F};return{...me,formControl:me}}function gb(e={}){const t=N.useRef(void 0),r=N.useRef(void 0),[o,n]=N.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}=qA(e);t.current={...i,formState:o}}const a=t.current.control;return a._options=e,MA(()=>{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]),N.useEffect(()=>a._disableForm(e.disabled),[a,e.disabled]),N.useEffect(()=>{e.mode&&(a._options.mode=e.mode),e.reValidateMode&&(a._options.reValidateMode=e.reValidateMode)},[a,e.mode,e.reValidateMode]),N.useEffect(()=>{e.errors&&(a._setErrors(e.errors),a._focusError())},[a,e.errors]),N.useEffect(()=>{e.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,e.shouldUnregister]),N.useEffect(()=>{if(a._proxyFormState.isDirty){const l=a._getDirty();l!==o.isDirty&&a._subjects.state.next({isDirty:l})}},[a,o.isDirty]),N.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]),N.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=N.useMemo(()=>TA(o,a),[a,o]),t.current}function bb(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 yb(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=bb(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 yd(e,t,r="keyValue"){return r==="array"?yb(e,t):e}function QA(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=bb(i);(c==="field"||c==="container")&&(r[a]=l)}else r[a]=l}return r}const KA=({currentPage:e,totalPages:t,pages:r,showStepNumbers:o,onPageClick:n})=>{const a=(e+1)/t*100;return s.jsxs("div",{className:p("mb-8"),children:[s.jsx("div",{className:p("h-2 bg-gray-200 rounded-full overflow-hidden"),children:s.jsx("div",{className:p("h-full bg-blue-600 transition-all duration-300 ease-out"),style:{width:`${a}%`}})}),o&&s.jsx("div",{className:p("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:p(`flex flex-col items-center ${n&&i<=e?"cursor-pointer":"cursor-default"}`),children:[s.jsx("div",{className:p(`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:p("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:p(`mt-2 text-xs font-medium ${d?"text-blue-600":"text-gray-500"}`),children:l.title})]},l.id)})})]})},XA=({page:e,pageIndex:t,totalPages:r})=>s.jsxs("div",{className:p("mb-6"),children:[s.jsxs("div",{className:p("flex items-center justify-between mb-2"),children:[s.jsx("h2",{className:p("text-xl font-semibold text-gray-900"),children:e.title}),s.jsxs("span",{className:p("text-sm text-gray-500"),children:["Step ",t+1," of ",r]})]}),e.description&&s.jsx("p",{className:p("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:p("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:p("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:p("flex gap-3"),children:[r&&!c&&s.jsx("button",{type:"button",onClick:l,className:p("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:p("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:p("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 →"})]})]})},vb=({element:e,elements:t})=>{const{setValue:r,watch:o}=fd(),n=o(),{visible:a,required:l,disabled:i}=N.useMemo(()=>Cg(e,n,t),[e,n,t]);if(!a)return null;const c=e.attributes.name,d=o(c),f=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"},h=u[e.layout.size||"default"]||u.default,m=Ke.get(e.type),y=(S,C)=>{const k=t.filter(E=>E.parentId===S).sort((E,M)=>E.order-M.order);return s.jsx("div",{className:p("space-y-4"),children:k.map(E=>s.jsx(vb,{element:{...E,attributes:{...E.attributes,name:C?`${C}.${E.attributes.name}`:E.attributes.name}},elements:t},E.id))})},b={element:e,properties:e.properties,layout:e.layout,validation:{...e.validation,required:l},logic:e.logic,config:e.config,mode:"render",value:d,onChange:S=>r(c,S),errors:[],formValues:n,readOnly:!1,disabled:f,allElements:t,renderChildren:y},v=()=>m!=null&&m.render?m.render(b):s.jsxs("div",{className:p("p-3 bg-yellow-50 border border-yellow-200 rounded-md text-sm text-yellow-700"),children:[s.jsxs("p",{className:p("font-medium"),children:["Unknown element type: ",e.type]}),s.jsxs("p",{className:p("text-xs mt-1"),children:["This element is not registered in the element registry. Please register it using ",s.jsx("code",{children:"registerElement()"}),"."]})]});return(m==null?void 0:m.structure)==="page"&&["heading","layout","special"].includes(m.subCategory||"")||["paragraph","image","link","formHeading","sectionHeading","subheading","divider","spacer","captcha","submit"].includes(e.type)?s.jsx("div",{className:p(h,"mb-4"),children:v()}):s.jsx("div",{className:p(h,"mb-4"),children:v()})};function ZA(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 RA(e){const t={};return e.forEach(r=>{var o;(o=r.attributes)!=null&&o.name&&(t[r.attributes.name]=ZA(r))}),t}const vd=({schema:e,onSubmit:t,initialValues:r,onPageChange:o,submissionFormat:n="keyValue"})=>{const[a,l]=N.useState(0),[i,c]=N.useState(!1),[d,f]=N.useState(null),u=N.useMemo(()=>e.elements.find(I=>I.type==="pages"),[e.elements]),h=N.useMemo(()=>{var I,A,W,$,G;return{showProgressBar:((I=u==null?void 0:u.config)==null?void 0:I.showProgressBar)??!0,showStepNumbers:((A=u==null?void 0:u.config)==null?void 0:A.showStepNumbers)??!0,allowSkip:((W=u==null?void 0:u.config)==null?void 0:W.allowSkip)??!1,validateOnNext:(($=u==null?void 0:u.config)==null?void 0:$.validateOnNext)??!0,steps:((G=u==null?void 0:u.config)==null?void 0:G.steps)||[{id:"step1",label:"Step 1"}]}},[u]),m=N.useMemo(()=>u?h.steps.map(A=>{const W=e.elements.filter($=>{var G;return $.parentId===`${u.id}:${A.id}`||$.parentId===u.id&&((G=$.config)==null?void 0:G.wizardStepId)===A.id});return{id:A.id,title:A.label,description:A.description,elements:W.sort(($,G)=>$.order-G.order)}}):[],[u,h.steps,e.elements]),y=N.useMemo(()=>e.elements.filter(I=>I.type!=="pages"),[e.elements]),b=N.useMemo(()=>r||RA(y),[r,y]),v=gb({defaultValues:b,mode:"onChange"}),{handleSubmit:w,trigger:x}=v,S=N.useCallback(I=>{I>=0&&I<m.length&&(l(I),o==null||o(I))},[m.length,o]),C=N.useCallback(()=>{S(a-1)},[a,S]),k=N.useCallback(async()=>{if(h.validateOnNext){const I=m[a].elements.filter(W=>{var $;return($=W.attributes)==null?void 0:$.name}).map(W=>W.attributes.name);if(!await x(I))return}S(a+1)},[a,h.validateOnNext,m,x,S]),E=N.useCallback(()=>{S(a+1)},[a,S]),M=N.useCallback(async I=>{c(!0);try{const A=yd(I,e.elements,n);console.log("Wizard form submitted:",A),f(A),await(t==null?void 0:t(A))}catch(A){console.error("Form submission error:",A)}finally{c(!1)}},[t,e.elements,n]),_=m[a];return _?s.jsxs("div",{className:p("max-w-3xl mx-auto"),children:[s.jsx(Zg,{...v,children:s.jsxs("form",{onSubmit:w(M),className:p("space-y-1"),children:[h.showProgressBar&&s.jsx(KA,{currentPage:a,totalPages:m.length,pages:m,showStepNumbers:h.showStepNumbers,onPageClick:h.allowSkip?S:void 0}),s.jsx(XA,{page:_,pageIndex:a,totalPages:m.length}),s.jsx("div",{className:p("space-y-4"),children:_.elements.map(I=>s.jsx(vb,{element:I,elements:e.elements},I.id))}),s.jsx(JA,{currentPage:a,totalPages:m.length,allowSkip:h.allowSkip,isSubmitting:i,onPrevious:C,onNext:k,onSkip:E})]})}),d&&s.jsxs("div",{className:p("mt-8 p-4 bg-green-50 border border-green-200 rounded-lg"),children:[s.jsx("h3",{className:p("text-lg font-medium text-green-800 mb-2"),children:"Form Submitted Successfully!"}),s.jsx("pre",{className:p("text-sm text-green-700 overflow-x-auto"),children:JSON.stringify(d,null,2)})]})]}):s.jsxs("div",{className:p("p-8 text-center text-gray-500"),children:[s.jsx("p",{children:"No wizard steps configured."}),s.jsx("p",{className:p("text-sm mt-2"),children:"Add steps to the wizard element to create a multi-page form."})]})};function eT(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 tT(e){const t={};return e.forEach(r=>{var o;(o=r.attributes)!=null&&o.name&&(t[r.attributes.name]=eT(r))}),t}const xb=({element:e,elements:t})=>{const{watch:r}=fd(),o=r(),{visible:n,required:a,disabled:l}=N.useMemo(()=>Cg(e,o,t),[e,o,t]);return n?s.jsx(rT,{element:e,elements:t,dynamicRequired:a,dynamicDisabled:l}):null},rT=({element:e,elements:t,dynamicRequired:r,dynamicDisabled:o})=>{const{setValue:n,watch:a}=fd(),l=e.attributes.name,i=a(l),c=o||e.properties.disabled||!1,d=r,f={small:"max-w-xs",medium:"max-w-md",large:"max-w-lg",full:"w-full",default:"max-w-md"},u=f[e.layout.size||"default"]||f.default,h=Ke.get(e.type),m=(x,S)=>{const C=t.filter(k=>k.parentId===x).sort((k,E)=>k.order-E.order);return s.jsx("div",{className:p("space-y-4"),children:C.map(k=>s.jsx(xb,{element:{...k,attributes:{...k.attributes,name:S?`${S}.${k.attributes.name}`:k.attributes.name}},elements:t},k.id))})},y={element:e,properties:e.properties,layout:e.layout,validation:{...e.validation,required:d},logic:e.logic,config:e.config,mode:"render",value:i,onChange:x=>n(l,x),errors:[],formValues:a(),readOnly:!1,disabled:c,allElements:t,renderChildren:m},b=()=>h!=null&&h.render?h.render(y):s.jsxs("div",{className:p("p-3 bg-yellow-50 border border-yellow-200 rounded-md text-sm text-yellow-700"),children:[s.jsxs("p",{className:p("font-medium"),children:["Unknown element type: ",e.type]}),s.jsxs("p",{className:p("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:p(u,"mb-4"),children:b()}):s.jsx("div",{className:p(u,"mb-4"),children:b()})},wb=({schema:e,onSubmit:t,initialValues:r,submissionFormat:o="keyValue"})=>{const[n,a]=N.useState(null);if(N.useMemo(()=>e.elements.some(h=>h.type==="pages"),[e.elements]))return s.jsx(vd,{schema:e,onSubmit:t,initialValues:r,submissionFormat:o});const i=N.useMemo(()=>e.elements.filter(h=>!h.parentId),[e.elements]),c=N.useMemo(()=>r||tT(i),[r,i]),d=gb({defaultValues:c,mode:"onChange"}),f=N.useCallback(h=>{const m=yd(h,e.elements,o);console.log("Form submitted:",m),a(m),t==null||t(m)},[t,e.elements,o]),u=N.useMemo(()=>[...i].sort((h,m)=>h.order-m.order),[i]);return s.jsxs("div",{className:p("max-w-3xl mx-auto"),children:[s.jsx(Zg,{...d,children:s.jsxs("form",{onSubmit:d.handleSubmit(f),className:p("space-y-1"),children:[s.jsx("div",{className:p(""),children:e.description&&s.jsx("p",{className:p("mt-2 text-gray-600"),children:e.description})}),s.jsx("div",{className:p("space-y-4"),children:u.map(h=>s.jsx(xb,{element:h,elements:e.elements},h.id))})]})}),n&&s.jsxs("div",{className:p("mt-8 p-4 bg-green-50 border border-green-200 rounded-lg"),children:[s.jsx("h3",{className:p("text-lg font-medium text-green-800 mb-2"),children:"Submitted Data:"}),s.jsx("pre",{className:p("text-sm text-green-700 overflow-x-auto"),children:JSON.stringify(n,null,2)})]})]})},Sb=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:p("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Sb.displayName="Card";const oT=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:p("flex flex-col space-y-1.5 p-6",e),...t}));oT.displayName="CardHeader";const nT=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:p("font-semibold leading-none tracking-tight",e),...t}));nT.displayName="CardTitle";const aT=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:p("text-sm text-muted-foreground",e),...t}));aT.displayName="CardDescription";const Cb=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:p("p-6 pt-0",e),...t}));Cb.displayName="CardContent";const sT=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:p("flex items-center p-6 pt-0",e),...t}));sT.displayName="CardFooter";const lT=Va("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"}}),Nb=g.forwardRef(({className:e,variant:t,...r},o)=>s.jsx("div",{ref:o,role:"alert",className:p(lT({variant:t}),e),...r}));Nb.displayName="Alert";const Eb=g.forwardRef(({className:e,...t},r)=>s.jsx("h5",{ref:r,className:p("mb-1 font-medium leading-none tracking-tight",e),...t}));Eb.displayName="AlertTitle";const kb=g.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:p("text-sm [&_p]:leading-relaxed",e),...t}));kb.displayName="AlertDescription";const iT={id:"design",label:"Design Mode",icon:IC,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]})},cT={id:"preview",label:"Preview Mode",icon:df,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:p("flex-1 overflow-y-auto bg-muted/30"),children:s.jsxs("div",{className:p("py-8 px-4"),children:[s.jsx("div",{className:p("max-w-3xl mx-auto mb-6"),children:s.jsxs("div",{className:p("flex items-center justify-between"),children:[s.jsxs("div",{className:p("flex items-center gap-2 text-sm text-muted-foreground"),children:[s.jsx(df,{className:p("h-4","w-4")}),s.jsx("span",{children:"Preview Mode"}),l&&s.jsx(_i,{variant:"secondary",children:"Wizard Form"})]}),s.jsxs(Be,{variant:"ghost",size:"sm",onClick:()=>o("design"),children:[s.jsx(DC,{className:p("h-4","w-4","mr-1")}),"Back to Editor"]})]})}),s.jsx(Sb,{className:p("max-w-3xl mx-auto"),children:s.jsx(Cb,{className:p("p-8"),children:r.elements.length===0?s.jsxs("div",{className:p("text-center py-12 text-muted-foreground"),children:[s.jsx(MC,{className:p("h-12","w-12","mx-auto","mb-4","text-muted-foreground/50")}),s.jsx("p",{className:p("text-lg font-medium mb-2"),children:"No elements to preview"}),s.jsx("p",{className:p("text-sm"),children:"Switch to Design mode and add some elements to your form."})]}):l?s.jsx(vd,{schema:r,onSubmit:i,submissionFormat:n}):s.jsx(wb,{schema:r,onSubmit:i,submissionFormat:n})})}),r.elements.some(c=>c.logic)&&s.jsx("div",{className:p("max-w-3xl mx-auto mt-6"),children:s.jsxs(Nb,{children:[s.jsx(uf,{className:p("h-4","w-4")}),s.jsx(Eb,{children:"Conditional Logic Active"}),s.jsx(kb,{children:"This form has conditional logic rules. Some fields may show/hide based on your input."})]})})]})})}};function _b(){Tt.has("design")||Tt.register(iT),Tt.has("preview")||Tt.register(cT)}_b();const Db=({initialSchema:e,onSchemaChange:t,toolbarActions:r,toolbarConfig:o,sidebarTabs:n,sidebarConfig:a,onPreviewSubmit:l,showElementSidebar:i=!0,showPropertyPanel:c=!0,submissionFormat:d="array",className:f})=>{const u=Z(C=>C.mode),h=Z(C=>C.setMode),m=Z(C=>C.schema),y=Z(C=>C.loadSchema);N.useEffect(()=>Jv(),[]),N.useEffect(()=>{e&&y(e)},[e,y]),N.useEffect(()=>{t&&t(m)},[m,t]);const b=r||o?{...o,actions:[...(o==null?void 0:o.actions)??[],...r??[]]}:void 0,v=n||a!=null&&a.tabs?[...(a==null?void 0:a.tabs)??[],...n??[]]:void 0,w=Tt.get(u),x=N.useMemo(()=>({schema:m,currentMode:u,setMode:h,submissionFormat:d,onSubmit:l,showElementSidebar:i,showPropertyPanel:c,loadSchema:y}),[m,u,h,d,l,i,c,y]),S=N.useMemo(()=>({ElementSidebar:i?s.jsx(EE,{sidebarTabs:v}):void 0,Canvas:s.jsx(jE,{toolbarConfig:b}),PropertyPanel:c?s.jsx(EA,{}):void 0}),[i,v,b,c]);return s.jsx("div",{className:p("ep-main-layout h-screen flex flex-col bg-muted/50",f),children:s.jsx("div",{className:p("flex-1 flex overflow-hidden"),children:w?w.renderContent(x,S):null})})};te.AffixInput=Hl,te.CanvasElementRenderer=Fa,te.CanvasPreviewWrapper=qx,te.ElementDescription=da,te.ElementLabel=ca,te.EmptyState=Qx,te.EntryPulse=Db,te.ErrorMessages=Xo,te.FieldWrapper=Yx,te.FormElementRenderer=mf,te.FormPreview=wb,te.IconInput=Kr,te.InputWrapper=ae,te.WizardForm=vd,te.builtInElements=hf,te.createSidebarTab=oh,te.createSidebarTabs=CE,te.createToolbarAction=ih,te.createToolbarActions=OE,te.default=Db,te.elementRegistry=Ke,te.extractContextValues=U,te.filterFieldData=QA,te.getButtonClassName=Kx,te.getCanvasInputClassName=lt,te.getElementDefinition=ox,te.getElementIcon=gf,te.getElementLabel=ki,te.getInputClassName=bt,te.getModeDefinition=VE,te.hasElement=nx,te.hasMode=zE,te.isActionDisabled=ch,te.isActionHidden=Bi,te.isElementRegistered=bN,te.isSidebarTabDisabled=nh,te.isSidebarTabHidden=ah,te.modeRegistry=Tt,te.registerBuiltInElements=RC,te.registerBuiltinModes=_b,te.registerElement=ex,te.registerElements=tx,te.registerMode=$E,te.registerModes=FE,te.renderElement=vN,te.renderElementOnCanvas=yN,te.transformSubmissionData=yd,te.transformToArrayFormat=yb,te.unregisterElement=rx,te.unregisterMode=GE,te.useFormStore=Z,Object.defineProperties(te,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
209
+ //# sourceMappingURL=entry-pulse.umd.cjs.map