@entrypulse/builder 1.2.1 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entry-pulse.js +31042 -0
- package/dist/entry-pulse.js.map +1 -0
- package/dist/entry-pulse.umd.cjs +203 -0
- package/dist/entry-pulse.umd.cjs.map +1 -0
- package/dist/index.d.ts +1645 -0
- package/dist/style.css +1 -0
- package/package.json +2 -2
- package/dist/assets/index-BedJdyF6.js +0 -242
- package/dist/assets/index-CRYucjk4.css +0 -1
- package/dist/index.html +0 -18
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
(function(Z,l){typeof exports=="object"&&typeof module<"u"?l(exports,require("react/jsx-runtime"),require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","react-dom"],l):(Z=typeof globalThis<"u"?globalThis:Z||self,l(Z.EntryPulse={},Z.jsxRuntime,Z.React,Z.ReactDOM))})(this,(function(Z,l,D,sa){"use strict";var HA=Object.defineProperty;var Zy=Z=>{throw TypeError(Z)};var jA=(Z,l,D)=>l in Z?HA(Z,l,{enumerable:!0,configurable:!0,writable:!0,value:D}):Z[l]=D;var wl=(Z,l,D)=>jA(Z,typeof l!="symbol"?l+"":l,D),Ry=(Z,l,D)=>l.has(Z)||Zy("Cannot "+D);var Mt=(Z,l,D)=>(Ry(Z,l,"read from private field"),D?D.call(Z):l.get(Z)),ev=(Z,l,D)=>l.has(Z)?Zy("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(Z):l.set(Z,D),Cd=(Z,l,D,sa)=>(Ry(Z,l,"write to private field"),sa?sa.call(Z,D):l.set(Z,D),D);var pt,jt;function Sd(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 v=Sd(D),sn=Sd(sa),Nd=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},tv=(e=>e?Nd(e):Nd),rv=e=>e;function ov(e,t=rv){const r=D.useSyncExternalStore(e.subscribe,D.useCallback(()=>t(e.getState()),[e,t]),D.useCallback(()=>t(e.getInitialState()),[e,t]));return D.useDebugValue(r),r}const Ed=e=>{const t=tv(e),r=o=>ov(t,o);return Object.assign(r,t),r},nv=(e=>e?Ed(e):Ed);var kd=Symbol.for("immer-nothing"),_d=Symbol.for("immer-draftable"),Gt=Symbol.for("immer-state"),av=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 Ft(e,...t){if(process.env.NODE_ENV!=="production"){const r=av[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 ln=Object.getPrototypeOf;function Mo(e){return!!e&&!!e[Gt]}function ao(e){var t;return e?Ad(e)||Array.isArray(e)||!!e[_d]||!!((t=e.constructor)!=null&&t[_d])||cn(e)||ca(e):!1}var sv=Object.prototype.constructor.toString(),Dd=new WeakMap;function Ad(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=Dd.get(r);return o===void 0&&(o=Function.toString.call(r),Dd.set(r,o)),o===sv}function la(e,t,r=!0){ia(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 ia(e){const t=e[Gt];return t?t.type_:Array.isArray(e)?1:cn(e)?2:ca(e)?3:0}function Cl(e,t){return ia(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Td(e,t,r){const o=ia(e);o===2?e.set(t,r):o===3?e.add(r):e[t]=r}function lv(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function cn(e){return e instanceof Map}function ca(e){return e instanceof Set}function so(e){return e.copy_||e.base_}function Sl(e,t){if(cn(e))return new Map(e);if(ca(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=Ad(e);if(t===!0||t==="class_only"&&!r){const o=Object.getOwnPropertyDescriptors(e);delete o[Gt];let n=Reflect.ownKeys(o);for(let a=0;a<n.length;a++){const s=n[a],i=o[s];i.writable===!1&&(i.writable=!0,i.configurable=!0),(i.get||i.set)&&(o[s]={configurable:!0,writable:!0,enumerable:i.enumerable,value:e[s]})}return Object.create(ln(e),o)}else{const o=ln(e);if(o!==null&&r)return{...e};const n=Object.create(o);return Object.assign(n,e)}}function Nl(e,t=!1){return ua(e)||Mo(e)||!ao(e)||(ia(e)>1&&Object.defineProperties(e,{set:da,add:da,clear:da,delete:da}),Object.freeze(e),t&&Object.values(e).forEach(r=>Nl(r,!0))),e}function iv(){Ft(2)}var da={value:iv};function ua(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var cv={};function lo(e){const t=cv[e];return t||Ft(0,e),t}var dn;function Id(){return dn}function dv(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Pd(e,t){t&&(lo("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function El(e){kl(e),e.drafts_.forEach(uv),e.drafts_=null}function kl(e){e===dn&&(dn=e.parent_)}function Md(e){return dn=dv(dn,e)}function uv(e){const t=e[Gt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Od(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[Gt].modified_&&(El(t),Ft(4)),ao(e)&&(e=pa(t,e),t.parent_||fa(t,e)),t.patches_&&lo("Patches").generateReplacementPatches_(r[Gt].base_,e,t.patches_,t.inversePatches_)):e=pa(t,r,[]),El(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==kd?e:void 0}function pa(e,t,r){if(ua(t))return t;const o=e.immer_.shouldUseStrictIteration(),n=t[Gt];if(!n)return la(t,(a,s)=>Ld(e,n,t,a,s,r),o),t;if(n.scope_!==e)return t;if(!n.modified_)return fa(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const a=n.copy_;let s=a,i=!1;n.type_===3&&(s=new Set(a),a.clear(),i=!0),la(s,(c,d)=>Ld(e,n,a,c,d,r,i),o),fa(e,a,!1),r&&e.patches_&&lo("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function Ld(e,t,r,o,n,a,s){if(n==null||typeof n!="object"&&!s)return;const i=ua(n);if(!(i&&!s)){if(process.env.NODE_ENV!=="production"&&n===r&&Ft(5),Mo(n)){const c=a&&t&&t.type_!==3&&!Cl(t.assigned_,o)?a.concat(o):void 0,d=pa(e,n,c);if(Td(r,o,d),Mo(d))e.canAutoFreeze_=!1;else return}else s&&r.add(n);if(ao(n)&&!i){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[o]===n&&i)return;pa(e,n),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&(cn(r)?r.has(o):Object.prototype.propertyIsEnumerable.call(r,o))&&fa(e,n)}}}function fa(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Nl(t,r)}function pv(e,t){const r=Array.isArray(e),o={type_:r?1:0,scope_:t?t.scope_:Id(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=o,a=_l;r&&(n=[o],a=un);const{revoke:s,proxy:i}=Proxy.revocable(n,a);return o.draft_=i,o.revoke_=s,i}var _l={get(e,t){if(t===Gt)return e;const r=so(e);if(!Cl(r,t))return fv(e,r,t);const o=r[t];return e.finalized_||!ao(o)?o:o===Dl(e.base_,t)?(Tl(e),e.copy_[t]=Il(o,e)):o},has(e,t){return t in so(e)},ownKeys(e){return Reflect.ownKeys(so(e))},set(e,t,r){const o=Fd(so(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const n=Dl(so(e),t),a=n==null?void 0:n[Gt];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(lv(r,n)&&(r!==void 0||Cl(e.base_,t)))return!0;Tl(e),Al(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 Dl(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Tl(e),Al(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=so(e),o=Reflect.getOwnPropertyDescriptor(r,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:r[t]}},defineProperty(){Ft(11)},getPrototypeOf(e){return ln(e.base_)},setPrototypeOf(){Ft(12)}},un={};la(_l,(e,t)=>{un[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),un.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ft(13),un.set.call(this,e,t,void 0)},un.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ft(14),_l.set.call(this,e[0],t,r,e[0])};function Dl(e,t){const r=e[Gt];return(r?so(r):e)[t]}function fv(e,t,r){var n;const o=Fd(t,r);return o?"value"in o?o.value:(n=o.get)==null?void 0:n.call(e.draft_):void 0}function Fd(e,t){if(!(t in e))return;let r=ln(e);for(;r;){const o=Object.getOwnPropertyDescriptor(r,t);if(o)return o;r=ln(r)}}function Al(e){e.modified_||(e.modified_=!0,e.parent_&&Al(e.parent_))}function Tl(e){e.copy_||(e.copy_=Sl(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var hv=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 s=o;o=r;const i=this;return function(d=s,...f){return i.produce(d,u=>o.call(this,u,...f))}}typeof o!="function"&&Ft(6),n!==void 0&&typeof n!="function"&&Ft(7);let a;if(ao(r)){const s=Md(this),i=Il(r,void 0);let c=!0;try{a=o(i),c=!1}finally{c?El(s):kl(s)}return Pd(s,n),Od(a,s)}else if(!r||typeof r!="object"){if(a=o(r),a===void 0&&(a=r),a===kd&&(a=void 0),this.autoFreeze_&&Nl(a,!0),n){const s=[],i=[];lo("Patches").generateReplacementPatches_(r,a,s,i),n(s,i)}return a}else Ft(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){ao(t)||Ft(8),Mo(t)&&(t=mv(t));const r=Md(this),o=Il(t,void 0);return o[Gt].isManual_=!0,kl(r),o}finishDraft(t,r){const o=t&&t[Gt];(!o||!o.isManual_)&&Ft(9);const{scope_:n}=o;return Pd(n,r),Od(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("Patches").applyPatches_;return Mo(t)?n(t,r):this.produce(t,a=>n(a,r))}};function Il(e,t){const r=cn(e)?lo("MapSet").proxyMap_(e,t):ca(e)?lo("MapSet").proxySet_(e,t):pv(e,t);return(t?t.scope_:Id()).drafts_.push(r),r}function mv(e){return Mo(e)||Ft(10,e),$d(e)}function $d(e){if(!ao(e)||ua(e))return e;const t=e[Gt];let r,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Sl(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else r=Sl(e,!0);return la(r,(n,a)=>{Td(r,n,$d(a))},o),t&&(t.finalized_=!1),r}var gv=new hv,bv=gv.produce;const yv=e=>(t,r,o)=>(o.setState=(n,a,...s)=>{const i=typeof n=="function"?bv(n):n;return t(i,a,...s)},e(o.setState,r,o));function ha(){const e=Date.now().toString(36),t=Math.random().toString(36).substring(2,8);return`${e}-${t}`}function Pl(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 Gd(e,t){const r=t instanceof Set?t:new Set(t),o=Pl(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 Ml(e){return new Set(e.map(t=>t.attributes.name).filter(Boolean))}const vv={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"}},xv={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"}},Vd={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}},zd={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..."}},wv={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 Bd(e,t,r){const o=Gd(e,t),n={id:ha(),type:e,order:r,properties:{...vv[e]},layout:{...xv[e]},attributes:{name:o,dataType:wv[e]}};return Vd[e]&&(n.validation={...Vd[e]}),zd[e]&&(n.config=JSON.parse(JSON.stringify(zd[e]))),n}function Ud(){return{id:`form-${ha()}`,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 Cv(e,t){const r=JSON.parse(JSON.stringify(e));return r.id=ha(),r.attributes.name=Gd(e.type,t),r}function Ol(e){return["paragraph","image","link","formHeading","sectionHeading","subheading","divider","spacer"].includes(e)}function Sv(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 Nv=50;function qt(e,t){const r=e.history.slice(0,e.historyIndex+1);r.push(JSON.parse(JSON.stringify(t))),r.length>Nv&&r.shift(),e.history=r,e.historyIndex=r.length-1,e.schema=t}const Wd=Ud(),Ev={schema:Wd,selectedElementId:null,mode:"design",history:[JSON.parse(JSON.stringify(Wd))],historyIndex:0,hoveredElementId:null,draggedElementType:null},R=nv()(yv((e,t)=>({...Ev,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 s=Ml(n.schema.elements),i=o??n.schema.elements.length,c=Bd(r,s,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()},qt(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=Ml(a.schema.elements),d=a.schema.elements.filter(m=>n?m.parentId===`${o}:${n}`:m.parentId===o).length,f=Bd(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()},qt(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 s={...n.schema};s.elements=n.schema.elements.map(c=>c.id===r?{...c,...o}:c),s.metadata={...s.metadata,updatedAt:new Date().toISOString(),createdAt:((i=s.metadata)==null?void 0:i.createdAt)||new Date().toISOString()},qt(n,s)})},deleteElement:r=>{e(o=>{var c;const n=o.schema.elements.find(d=>d.id===r);if(!n)return;const a=new Set([r]),s=d=>{o.schema.elements.forEach(f=>{var u;(f.parentId===d||(u=f.parentId)!=null&&u.startsWith(`${d}:`))&&(a.add(f.id),s(f.id))})};s(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()},qt(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=Ml(o.schema.elements),s=Cv(n,a);s.order=n.order+1;const i={...o.schema},c=n.order+1;i.elements=[...o.schema.elements.slice(0,c),s,...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()},qt(o,i),o.selectedElementId=s.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 s=[...n.schema.elements],[i]=s.splice(a,1);s.splice(o,0,i),s.forEach((f,u)=>{f.order=u});const c={...n.schema,elements:s,metadata:{...n.schema.metadata,updatedAt:new Date().toISOString(),createdAt:((d=n.schema.metadata)==null?void 0:d.createdAt)||new Date().toISOString()}};qt(n,c)})},reorderElements:(r,o)=>{e(n=>{var c;if(r===o)return;const a=[...n.schema.elements],[s]=a.splice(r,1);a.splice(o,0,s),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()}};qt(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=Ud();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()}};qt(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()}};qt(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 s;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:((s=a.metadata)==null?void 0:s.createdAt)||new Date().toISOString()},qt(n,a)})},updateWizardStep:(r,o,n)=>{e(a=>{var i;const s={...a.schema};s.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}),s.metadata={...s.metadata,updatedAt:new Date().toISOString(),createdAt:((i=s.metadata)==null?void 0:i.createdAt)||new Date().toISOString()},qt(a,s)})},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 s=((u=a.config)==null?void 0:u.steps)||[];if(s.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(g=>{var y;(g.parentId===m||(y=g.parentId)!=null&&y.startsWith(`${m}:`))&&(c.add(g.id),d(g.id))})};d(i);const f={...n.schema};f.elements=n.schema.elements.map(m=>{var g,y,b;if(m.id===r){const C=s.filter(x=>x.id!==o),w=((g=m.config)==null?void 0:g.activeStepId)===o?(y=C[0])==null?void 0:y.id:(b=m.config)==null?void 0:b.activeStepId;return{...m,config:{...m.config,steps:C,activeStepId:w},children:(m.children||[]).filter(x=>!c.has(x))}}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()},qt(n,f)})},setActiveWizardStep:(r,o)=>{e(n=>{const a={...n.schema};a.elements=n.schema.elements.map(s=>s.id===r&&s.type==="pages"?{...s,config:{...s.config,activeStepId:o}}:s),n.schema=a})},getContainerChildren:(r,o)=>{const n=t(),a=o?`${r}:${o}`:r;return n.schema.elements.filter(s=>s.parentId===a).sort((s,i)=>s.order-i.order)},validateSchema:()=>{const r=t(),o=[],n=r.schema.elements.map(s=>s.attributes.name),a=n.filter((s,i)=>n.indexOf(s)!==i);return a.length>0&&a.forEach(s=>{o.push({type:"error",message:`Duplicate field name: "${s}"`})}),r.schema.elements.forEach(s=>{(!s.attributes.name||s.attributes.name.trim()==="")&&o.push({type:"error",elementId:s.id,message:`Element "${s.properties.label||s.type}" has no field name`})}),r.schema.elements.forEach(s=>{var i;(i=s.validation)!=null&&i.required&&(!s.properties.label||s.properties.label.trim()==="")&&o.push({type:"warning",elementId:s.id,message:"Required element has no label"})}),{valid:o.filter(s=>s.type==="error").length===0,errors:o}}})));function kv(){const e=t=>{const o=navigator.platform.toUpperCase().indexOf("MAC")>=0?t.metaKey:t.ctrlKey;o&&t.key==="z"&&!t.shiftKey?(t.preventDefault(),R.getState().undo()):(o&&t.shiftKey&&t.key==="z"||o&&t.key==="y")&&(t.preventDefault(),R.getState().redo())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)}const _v=()=>{const e=R(r=>r.selectedElementId);return R(r=>r.schema.elements).find(r=>r.id===e)};class Dv{constructor(){wl(this,"elements",new Map);wl(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 s=this.getAll().filter(i=>i.category==="field"&&i.subCategory===n);s.length>0&&t.push({id:n,label:a.label,elements:s,order:a.order})}for(const[n,a]of Object.entries(o)){const s=this.getAll().filter(i=>i.category==="page"&&i.subCategory===n);s.length>0&&t.push({id:n,label:a.label,elements:s,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 dt=new Dv;function Av(e,t){dt.register(e,t)}function Tv(e,t){for(const r of e)dt.register(r,t)}function Iv(e){return dt.unregister(e)}function Pv(e){return dt.get(e)}function Mv(e){return dt.has(e)}function Hd(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=Hd(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function jd(){for(var e,t,r=0,o="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=Hd(e))&&(o&&(o+=" "),o+=t);return o}const Ov=(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},Lv=(e,t)=>({classGroupId:e,validator:t}),Yd=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),ma="-",qd=[],Fv="arbitrary..",$v=e=>{const t=Vv(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:s=>{if(s.startsWith("[")&&s.endsWith("]"))return Gv(s);const i=s.split(ma),c=i[0]===""&&i.length>1?1:0;return Qd(i,c,t)},getConflictingClassGroupIds:(s,i)=>{if(i){const c=o[s],d=r[s];return c?d?Ov(d,c):c:d||qd}return r[s]||qd}}},Qd=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const n=e[t],a=r.nextPart.get(n);if(a){const d=Qd(e,t+1,a);if(d)return d}const s=r.validators;if(s===null)return;const i=t===0?e.join(ma):e.slice(t).join(ma),c=s.length;for(let d=0;d<c;d++){const f=s[d];if(f.validator(i))return f.classGroupId}},Gv=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?Fv+o:void 0})(),Vv=e=>{const{theme:t,classGroups:r}=e;return zv(r,t)},zv=(e,t)=>{const r=Yd();for(const o in e){const n=e[o];Ll(n,r,o,t)}return r},Ll=(e,t,r,o)=>{const n=e.length;for(let a=0;a<n;a++){const s=e[a];Bv(s,t,r,o)}},Bv=(e,t,r,o)=>{if(typeof e=="string"){Uv(e,t,r);return}if(typeof e=="function"){Wv(e,t,r,o);return}Hv(e,t,r,o)},Uv=(e,t,r)=>{const o=e===""?t:Kd(t,e);o.classGroupId=r},Wv=(e,t,r,o)=>{if(jv(e)){Ll(e(o),t,r,o);return}t.validators===null&&(t.validators=[]),t.validators.push(Lv(r,e))},Hv=(e,t,r,o)=>{const n=Object.entries(e),a=n.length;for(let s=0;s<a;s++){const[i,c]=n[s];Ll(c,Kd(t,i),r,o)}},Kd=(e,t)=>{let r=e;const o=t.split(ma),n=o.length;for(let a=0;a<n;a++){const s=o[a];let i=r.nextPart.get(s);i||(i=Yd(),r.nextPart.set(s,i)),r=i}return r},jv=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Yv=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),o=Object.create(null);const n=(a,s)=>{r[a]=s,t++,t>e&&(t=0,o=r,r=Object.create(null))};return{get(a){let s=r[a];if(s!==void 0)return s;if((s=o[a])!==void 0)return n(a,s),s},set(a,s){a in r?r[a]=s:n(a,s)}}},Fl="!",Xd=":",qv=[],Jd=(e,t,r,o,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:o,isExternal:n}),Qv=e=>{const{prefix:t,experimentalParseClassName:r}=e;let o=n=>{const a=[];let s=0,i=0,c=0,d;const f=n.length;for(let y=0;y<f;y++){const b=n[y];if(s===0&&i===0){if(b===Xd){a.push(n.slice(c,y)),c=y+1;continue}if(b==="/"){d=y;continue}}b==="["?s++:b==="]"?s--:b==="("?i++:b===")"&&i--}const u=a.length===0?n:n.slice(c);let h=u,m=!1;u.endsWith(Fl)?(h=u.slice(0,-1),m=!0):u.startsWith(Fl)&&(h=u.slice(1),m=!0);const g=d&&d>c?d-c:void 0;return Jd(a,m,h,g)};if(t){const n=t+Xd,a=o;o=s=>s.startsWith(n)?a(s.slice(n.length)):Jd(qv,!1,s,void 0,!0)}if(r){const n=o;o=a=>r({className:a,parseClassName:n})}return o},Kv=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 s=r[a],i=s[0]==="[",c=t.has(s);i||c?(n.length>0&&(n.sort(),o.push(...n),n=[]),o.push(s)):n.push(s)}return n.length>0&&(n.sort(),o.push(...n)),o}},Xv=e=>({cache:Yv(e.cacheSize),parseClassName:Qv(e),sortModifiers:Kv(e),postfixLookupClassGroupIds:Jv(e),...$v(e)}),Jv=e=>{const t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let o=0;o<r.length;o++)t[r[o]]=!0;return t},Zv=/\s+/,Rv=(e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:n,sortModifiers:a,postfixLookupClassGroupIds:s}=t,i=[],c=e.trim().split(Zv);let d="";for(let f=c.length-1;f>=0;f-=1){const u=c[f],{isExternal:h,modifiers:m,hasImportantModifier:g,baseClassName:y,maybePostfixModifierPosition:b}=r(u);if(h){d=u+(d.length>0?" "+d:d);continue}let C=!!b,w;if(C){const M=y.substring(0,b);w=o(M);const k=w&&s[w]?o(y):void 0;k&&k!==w&&(w=k,C=!1)}else w=o(y);if(!w){if(!C){d=u+(d.length>0?" "+d:d);continue}if(w=o(y),!w){d=u+(d.length>0?" "+d:d);continue}C=!1}const x=m.length===0?"":m.length===1?m[0]:a(m).join(":"),S=g?x+Fl:x,N=S+w;if(i.indexOf(N)>-1)continue;i.push(N);const E=n(w,C);for(let M=0;M<E.length;++M){const k=E[M];i.push(S+k)}d=u+(d.length>0?" "+d:d)}return d},ex=(...e)=>{let t=0,r,o,n="";for(;t<e.length;)(r=e[t++])&&(o=Zd(r))&&(n&&(n+=" "),n+=o);return n},Zd=e=>{if(typeof e=="string")return e;let t,r="";for(let o=0;o<e.length;o++)e[o]&&(t=Zd(e[o]))&&(r&&(r+=" "),r+=t);return r},Rd=(e,...t)=>{let r,o,n,a;const s=c=>{const d=t.reduce((f,u)=>u(f),e());return r=Xv(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=Rv(c,r);return n(c,f),f};return a=s,(...c)=>a(ex(...c))},tx=[],ft=e=>{const t=r=>r[e]||tx;return t.isThemeGetter=!0,t},eu=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,tu=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rx=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ox=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,nx=/\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)\(.+\)$/,sx=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lx=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Br=e=>rx.test(e),ke=e=>!!e&&!Number.isNaN(Number(e)),pr=e=>!!e&&Number.isInteger(Number(e)),$l=e=>e.endsWith("%")&&ke(e.slice(0,-1)),Ar=e=>ox.test(e),ru=()=>!0,ix=e=>nx.test(e)&&!ax.test(e),Gl=()=>!1,cx=e=>sx.test(e),dx=e=>lx.test(e),ux=e=>!ae(e)&&!se(e),px=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),fx=e=>Ur(e,iu,Gl),ae=e=>eu.test(e),io=e=>Ur(e,cu,ix),ou=e=>Ur(e,wx,ke),hx=e=>Ur(e,uu,ru),mx=e=>Ur(e,du,Gl),nu=e=>Ur(e,su,Gl),gx=e=>Ur(e,lu,dx),ga=e=>Ur(e,pu,cx),se=e=>tu.test(e),pn=e=>co(e,cu),bx=e=>co(e,du),au=e=>co(e,su),yx=e=>co(e,iu),vx=e=>co(e,lu),ba=e=>co(e,pu,!0),xx=e=>co(e,uu,!0),Ur=(e,t,r)=>{const o=eu.exec(e);return o?o[1]?t(o[1]):r(o[2]):!1},co=(e,t,r=!1)=>{const o=tu.exec(e);return o?o[1]?t(o[1]):r:!1},su=e=>e==="position"||e==="percentage",lu=e=>e==="image"||e==="url",iu=e=>e==="length"||e==="size"||e==="bg-size",cu=e=>e==="length",wx=e=>e==="number",du=e=>e==="family-name",uu=e=>e==="number"||e==="weight",pu=e=>e==="shadow",fu=()=>{const e=ft("color"),t=ft("font"),r=ft("text"),o=ft("font-weight"),n=ft("tracking"),a=ft("leading"),s=ft("breakpoint"),i=ft("container"),c=ft("spacing"),d=ft("radius"),f=ft("shadow"),u=ft("inset-shadow"),h=ft("text-shadow"),m=ft("drop-shadow"),g=ft("blur"),y=ft("perspective"),b=ft("aspect"),C=ft("ease"),w=ft("animate"),x=()=>["auto","avoid","all","avoid-page","page","left","right","column"],S=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...S(),se,ae],E=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],k=()=>[se,ae,c],T=()=>[Br,"full","auto",...k()],A=()=>[pr,"none","subgrid",se,ae],L=()=>["auto",{span:["full",pr,se,ae]},pr,se,ae],O=()=>[pr,"auto",se,ae],F=()=>["auto","min","max","fr",se,ae],V=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],re=()=>["start","end","center","stretch","center-safe","end-safe"],K=()=>["auto",...k()],H=()=>[Br,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],ee=()=>[Br,"screen","full","dvw","lvw","svw","min","max","fit",...k()],G=()=>[Br,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],z=()=>[e,se,ae],Ce=()=>[...S(),au,nu,{position:[se,ae]}],$=()=>["no-repeat",{repeat:["","x","y","space","round"]}],q=()=>["auto","cover","contain",yx,fx,{size:[se,ae]}],xe=()=>[$l,pn,io],oe=()=>["","none","full",d,se,ae],he=()=>["",ke,pn,io],Y=()=>["solid","dashed","dotted","double"],ce=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[ke,$l,au,nu],Ne=()=>["","none",g,se,ae],be=()=>["none",ke,se,ae],ue=()=>["none",ke,se,ae],X=()=>[ke,se,ae],ne=()=>[Br,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ar],breakpoint:[Ar],color:[ru],container:[Ar],"drop-shadow":[Ar],ease:["in","out","in-out"],font:[ux],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ar],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ar],shadow:[Ar],spacing:["px",ke],text:[Ar],"text-shadow":[Ar],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Br,ae,se,b]}],container:["container"],"container-type":[{"@container":["","normal","size",se,ae]}],"container-named":[px],columns:[{columns:[ke,ae,se,i]}],"break-after":[{"break-after":x()}],"break-before":[{"break-before":x()}],"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:N()}],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:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:["visible","invisible","collapse"],z:[{z:[pr,"auto",se,ae]}],basis:[{basis:[Br,"full","auto",i,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ke,Br,"auto","initial","none",ae]}],grow:[{grow:["",ke,se,ae]}],shrink:[{shrink:["",ke,se,ae]}],order:[{order:[pr,"first","last","none",se,ae]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:L()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:L()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":F()}],"auto-rows":[{"auto-rows":F()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...V(),"normal"]}],"justify-items":[{"justify-items":[...re(),"normal"]}],"justify-self":[{"justify-self":["auto",...re()]}],"align-content":[{content:["normal",...V()]}],"align-items":[{items:[...re(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...re(),{baseline:["","last"]}]}],"place-content":[{"place-content":V()}],"place-items":[{"place-items":[...re(),"baseline"]}],"place-self":[{"place-self":["auto",...re()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:K()}],mx:[{mx:K()}],my:[{my:K()}],ms:[{ms:K()}],me:[{me:K()}],mbs:[{mbs:K()}],mbe:[{mbe:K()}],mt:[{mt:K()}],mr:[{mr:K()}],mb:[{mb:K()}],ml:[{ml:K()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:H()}],"inline-size":[{inline:["auto",...ee()]}],"min-inline-size":[{"min-inline":["auto",...ee()]}],"max-inline-size":[{"max-inline":["none",...ee()]}],"block-size":[{block:["auto",...G()]}],"min-block-size":[{"min-block":["auto",...G()]}],"max-block-size":[{"max-block":["none",...G()]}],w:[{w:[i,"screen",...H()]}],"min-w":[{"min-w":[i,"screen","none",...H()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[s]},...H()]}],h:[{h:["screen","lh",...H()]}],"min-h":[{"min-h":["screen","lh","none",...H()]}],"max-h":[{"max-h":["screen","lh",...H()]}],"font-size":[{text:["base",r,pn,io]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,xx,hx]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",$l,ae]}],"font-family":[{font:[bx,mx,t]}],"font-features":[{"font-features":[ae]}],"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,se,ae]}],"line-clamp":[{"line-clamp":[ke,"none",se,ou]}],leading:[{leading:[a,...k()]}],"list-image":[{"list-image":["none",se,ae]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",se,ae]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:z()}],"text-color":[{text:z()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:[ke,"from-font","auto",se,io]}],"text-decoration-color":[{decoration:z()}],"underline-offset":[{"underline-offset":[ke,"auto",se,ae]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"tab-size":[{tab:[pr,se,ae]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",se,ae]}],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",se,ae]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:Ce()}],"bg-repeat":[{bg:$()}],"bg-size":[{bg:q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},pr,se,ae],radial:["",se,ae],conic:[pr,se,ae]},vx,gx]}],"bg-color":[{bg:z()}],"gradient-from-pos":[{from:xe()}],"gradient-via-pos":[{via:xe()}],"gradient-to-pos":[{to:xe()}],"gradient-from":[{from:z()}],"gradient-via":[{via:z()}],"gradient-to":[{to:z()}],rounded:[{rounded:oe()}],"rounded-s":[{"rounded-s":oe()}],"rounded-e":[{"rounded-e":oe()}],"rounded-t":[{"rounded-t":oe()}],"rounded-r":[{"rounded-r":oe()}],"rounded-b":[{"rounded-b":oe()}],"rounded-l":[{"rounded-l":oe()}],"rounded-ss":[{"rounded-ss":oe()}],"rounded-se":[{"rounded-se":oe()}],"rounded-ee":[{"rounded-ee":oe()}],"rounded-es":[{"rounded-es":oe()}],"rounded-tl":[{"rounded-tl":oe()}],"rounded-tr":[{"rounded-tr":oe()}],"rounded-br":[{"rounded-br":oe()}],"rounded-bl":[{"rounded-bl":oe()}],"border-w":[{border:he()}],"border-w-x":[{"border-x":he()}],"border-w-y":[{"border-y":he()}],"border-w-s":[{"border-s":he()}],"border-w-e":[{"border-e":he()}],"border-w-bs":[{"border-bs":he()}],"border-w-be":[{"border-be":he()}],"border-w-t":[{"border-t":he()}],"border-w-r":[{"border-r":he()}],"border-w-b":[{"border-b":he()}],"border-w-l":[{"border-l":he()}],"divide-x":[{"divide-x":he()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":he()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Y(),"hidden","none"]}],"divide-style":[{divide:[...Y(),"hidden","none"]}],"border-color":[{border:z()}],"border-color-x":[{"border-x":z()}],"border-color-y":[{"border-y":z()}],"border-color-s":[{"border-s":z()}],"border-color-e":[{"border-e":z()}],"border-color-bs":[{"border-bs":z()}],"border-color-be":[{"border-be":z()}],"border-color-t":[{"border-t":z()}],"border-color-r":[{"border-r":z()}],"border-color-b":[{"border-b":z()}],"border-color-l":[{"border-l":z()}],"divide-color":[{divide:z()}],"outline-style":[{outline:[...Y(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ke,se,ae]}],"outline-w":[{outline:["",ke,pn,io]}],"outline-color":[{outline:z()}],shadow:[{shadow:["","none",f,ba,ga]}],"shadow-color":[{shadow:z()}],"inset-shadow":[{"inset-shadow":["none",u,ba,ga]}],"inset-shadow-color":[{"inset-shadow":z()}],"ring-w":[{ring:he()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:z()}],"ring-offset-w":[{"ring-offset":[ke,io]}],"ring-offset-color":[{"ring-offset":z()}],"inset-ring-w":[{"inset-ring":he()}],"inset-ring-color":[{"inset-ring":z()}],"text-shadow":[{"text-shadow":["none",h,ba,ga]}],"text-shadow-color":[{"text-shadow":z()}],opacity:[{opacity:[ke,se,ae]}],"mix-blend":[{"mix-blend":[...ce(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ce()}],"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":[ke]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":z()}],"mask-image-linear-to-color":[{"mask-linear-to":z()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":z()}],"mask-image-t-to-color":[{"mask-t-to":z()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":z()}],"mask-image-r-to-color":[{"mask-r-to":z()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":z()}],"mask-image-b-to-color":[{"mask-b-to":z()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":z()}],"mask-image-l-to-color":[{"mask-l-to":z()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":z()}],"mask-image-x-to-color":[{"mask-x-to":z()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":z()}],"mask-image-y-to-color":[{"mask-y-to":z()}],"mask-image-radial":[{"mask-radial":[se,ae]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":z()}],"mask-image-radial-to-color":[{"mask-radial-to":z()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":S()}],"mask-image-conic-pos":[{"mask-conic":[ke]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":z()}],"mask-image-conic-to-color":[{"mask-conic-to":z()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:Ce()}],"mask-repeat":[{mask:$()}],"mask-size":[{mask:q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",se,ae]}],filter:[{filter:["","none",se,ae]}],blur:[{blur:Ne()}],brightness:[{brightness:[ke,se,ae]}],contrast:[{contrast:[ke,se,ae]}],"drop-shadow":[{"drop-shadow":["","none",m,ba,ga]}],"drop-shadow-color":[{"drop-shadow":z()}],grayscale:[{grayscale:["",ke,se,ae]}],"hue-rotate":[{"hue-rotate":[ke,se,ae]}],invert:[{invert:["",ke,se,ae]}],saturate:[{saturate:[ke,se,ae]}],sepia:[{sepia:["",ke,se,ae]}],"backdrop-filter":[{"backdrop-filter":["","none",se,ae]}],"backdrop-blur":[{"backdrop-blur":Ne()}],"backdrop-brightness":[{"backdrop-brightness":[ke,se,ae]}],"backdrop-contrast":[{"backdrop-contrast":[ke,se,ae]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ke,se,ae]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ke,se,ae]}],"backdrop-invert":[{"backdrop-invert":["",ke,se,ae]}],"backdrop-opacity":[{"backdrop-opacity":[ke,se,ae]}],"backdrop-saturate":[{"backdrop-saturate":[ke,se,ae]}],"backdrop-sepia":[{"backdrop-sepia":["",ke,se,ae]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",se,ae]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ke,"initial",se,ae]}],ease:[{ease:["linear","initial",C,se,ae]}],delay:[{delay:[ke,se,ae]}],animate:[{animate:["none",w,se,ae]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[y,se,ae]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:be()}],"rotate-x":[{"rotate-x":be()}],"rotate-y":[{"rotate-y":be()}],"rotate-z":[{"rotate-z":be()}],scale:[{scale:ue()}],"scale-x":[{"scale-x":ue()}],"scale-y":[{"scale-y":ue()}],"scale-z":[{"scale-z":ue()}],"scale-3d":["scale-3d"],skew:[{skew:X()}],"skew-x":[{"skew-x":X()}],"skew-y":[{"skew-y":X()}],transform:[{transform:[se,ae,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ne()}],"translate-x":[{"translate-x":ne()}],"translate-y":[{"translate-y":ne()}],"translate-z":[{"translate-z":ne()}],"translate-none":["translate-none"],zoom:[{zoom:[pr,se,ae]}],accent:[{accent:z()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:z()}],"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",se,ae]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":z()}],"scrollbar-track-color":[{"scrollbar-track":z()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",se,ae]}],fill:[{fill:["none",...z()]}],"stroke-w":[{stroke:[ke,pn,io,ou]}],stroke:[{stroke:["none",...z()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","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-bs","border-w-be","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-bs","border-color-be","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-mbs","scroll-mbe","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-pbs","scroll-pbe","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"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Cx=(e,{cacheSize:t,prefix:r,experimentalParseClassName:o,extend:n={},override:a={}})=>(Oo(e,"cacheSize",t),Oo(e,"prefix",r),Oo(e,"experimentalParseClassName",o),ya(e.theme,a.theme),ya(e.classGroups,a.classGroups),ya(e.conflictingClassGroups,a.conflictingClassGroups),ya(e.conflictingClassGroupModifiers,a.conflictingClassGroupModifiers),Oo(e,"postfixLookupClassGroups",a.postfixLookupClassGroups),Oo(e,"orderSensitiveModifiers",a.orderSensitiveModifiers),va(e.theme,n.theme),va(e.classGroups,n.classGroups),va(e.conflictingClassGroups,n.conflictingClassGroups),va(e.conflictingClassGroupModifiers,n.conflictingClassGroupModifiers),Vl(e,n,"postfixLookupClassGroups"),Vl(e,n,"orderSensitiveModifiers"),e),Oo=(e,t,r)=>{r!==void 0&&(e[t]=r)},ya=(e,t)=>{if(t)for(const r in t)Oo(e,r,t[r])},va=(e,t)=>{if(t)for(const r in t)Vl(e,t,r)},Vl=(e,t,r)=>{const o=t[r];o!==void 0&&(e[r]=e[r]?e[r].concat(o):o)},Sx=((e,...t)=>typeof e=="function"?Rd(fu,e,...t):Rd(()=>Cx(fu(),e),...t))({prefix:""});function p(...e){const t=jd(e);return Sx(t)}const xa=({label:e,required:t,htmlFor:r,className:o=""})=>e?l.jsxs("label",{htmlFor:r,className:p("block text-sm font-medium text-gray-700",o),children:[e,t&&l.jsx("span",{className:p("text-red-500 ml-1"),children:"*"})]}):null,wa=({description:e,className:t=""})=>e?l.jsx("p",{className:p("text-xs text-gray-500",t),children:e}):null,fn=({errors:e,className:t=""})=>!e||e.length===0?null:l.jsx("div",{className:p("space-y-1",t),children:e.map((r,o)=>l.jsx("p",{className:p("text-xs text-red-500"),children:r},o))}),Nx=({label:e,description:t,required:r,errors:o,children:n})=>l.jsxs("div",{className:p("space-y-1.5"),children:[l.jsx(xa,{label:e,required:r}),l.jsx(wa,{description:t}),n,l.jsx(fn,{errors:o})]}),de=({label:e,description:t,required:r,errors:o,labelPosition:n="top",className:a="",children:s})=>n==="hidden"?l.jsxs("div",{className:p("space-y-1.5",a),children:[s,l.jsx(fn,{errors:o})]}):n==="left"?l.jsxs("div",{className:p("flex items-start gap-4",a),children:[l.jsxs("div",{className:p("w-1/3 pt-2"),children:[l.jsx(xa,{label:e,required:r}),l.jsx(wa,{description:t})]}),l.jsxs("div",{className:p("flex-1 space-y-1.5"),children:[s,l.jsx(fn,{errors:o})]})]}):l.jsxs("div",{className:p("space-y-1.5",a),children:[l.jsx(xa,{label:e,required:r}),l.jsx(wa,{description:t}),s,l.jsx(fn,{errors:o})]}),Ex=({children:e,className:t=""})=>l.jsx("div",{className:p("pointer-events-none",t),children:e}),kx=({icon:e="📋",message:t,subMessage:r})=>l.jsxs("div",{className:p("border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50"),children:[l.jsx("span",{className:p("text-4xl"),children:e}),l.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:t}),r&&l.jsx("p",{className:p("text-xs text-gray-400"),children:r})]}),uo=({icon:e,children:t,iconPosition:r="left"})=>l.jsxs("div",{className:p("relative"),children:[l.jsx("span",{className:p("absolute top-1/2 -translate-y-1/2 text-gray-400",r==="left"?"left-3":"right-3"),children:e}),t]}),zl=({prefix:e,suffix:t,children:r})=>l.jsxs("div",{className:p("flex"),children:[e&&l.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}),l.jsx("div",{className:p("flex-1",!e&&"rounded-l-md",!t&&"rounded-r-md"),children:r}),t&&l.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 Ot(e={}){const{hasError:t=!1,disabled:r=!1,size:o="medium",hasLeftIcon:n=!1,hasRightIcon:a=!1,hasPrefix:s=!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],!s&&!i&&"rounded-md",s&&!i&&"rounded-r-md",!s&&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 Ct(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 _x(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 j(e){const{element:t,properties:r,layout:o,validation:n,config:a,mode:s,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:s==="canvas",isDisabled:u||f||s==="canvas",value:i,onChange:c,errors:d,config:a,element:t}}const Dx=[{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}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,children:l.jsx("input",{type:"text",placeholder:o,disabled:!0,className:Ct()})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:s,onChange:i,errors:c,isDisabled:d}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,errors:c,children:l.jsx("input",{type:"text",placeholder:o,value:s??"",onChange:f=>i==null?void 0:i(f.target.value),disabled:d,className:Ot({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:s}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,children:l.jsx("textarea",{placeholder:o,disabled:!0,rows:(s==null?void 0:s.rows)||3,className:`${Ct()} resize-none`})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:s,onChange:i,errors:c,isDisabled:d,config:f}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,errors:c,children:l.jsx("textarea",{placeholder:o,value:s??"",onChange:u=>i==null?void 0:i(u.target.value),disabled:d,rows:(f==null?void 0:f.rows)||3,className:`${Ot({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:s}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,children:l.jsx("textarea",{placeholder:o,disabled:!0,rows:(s==null?void 0:s.minRows)||2,className:`${Ct()} resize-none`})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:s,onChange:i,errors:c,isDisabled:d,config:f}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,errors:c,children:l.jsx("textarea",{placeholder:o,value:s??"",onChange:u=>i==null?void 0:i(u.target.value),disabled:d,rows:(f==null?void 0:f.minRows)||2,className:`${Ot({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:s}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,children:l.jsxs("div",{className:p("border border-gray-300 rounded-md bg-gray-50 overflow-hidden"),children:[l.jsxs("div",{className:p("flex items-center gap-1 p-2 border-b border-gray-200 bg-gray-100"),children:[l.jsx("button",{disabled:!0,className:p("p-1.5 rounded hover:bg-gray-200 text-gray-600"),children:l.jsx("strong",{children:"B"})}),l.jsx("button",{disabled:!0,className:p("p-1.5 rounded hover:bg-gray-200 text-gray-600"),children:l.jsx("em",{children:"I"})}),l.jsx("button",{disabled:!0,className:p("p-1.5 rounded hover:bg-gray-200 text-gray-600"),children:l.jsx("u",{children:"U"})}),l.jsx("span",{className:p("w-px h-4 bg-gray-300 mx-1")}),l.jsx("button",{disabled:!0,className:p("p-1.5 rounded hover:bg-gray-200 text-gray-600 text-xs"),children:"🔗"})]}),l.jsx("div",{className:p("p-3 min-h-[120px] text-gray-400 text-sm"),style:{height:(s==null?void 0:s.height)||200},children:o||"Start typing..."})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:s,errors:i,isDisabled:c,config:d}=j(e);return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsxs("div",{className:`border rounded-md overflow-hidden ${((i==null?void 0:i.length)??0)>0?"border-red-500":"border-gray-300"}`,children:[l.jsxs("div",{className:p("flex items-center gap-1 p-2 border-b border-gray-200 bg-gray-100"),children:[l.jsx("button",{type:"button",disabled:c,className:p("p-1.5 rounded hover:bg-gray-200 text-gray-600 disabled:opacity-50"),children:l.jsx("strong",{children:"B"})}),l.jsx("button",{type:"button",disabled:c,className:p("p-1.5 rounded hover:bg-gray-200 text-gray-600 disabled:opacity-50"),children:l.jsx("em",{children:"I"})}),l.jsx("button",{type:"button",disabled:c,className:p("p-1.5 rounded hover:bg-gray-200 text-gray-600 disabled:opacity-50"),children:l.jsx("u",{children:"U"})}),l.jsx("span",{className:p("w-px h-4 bg-gray-300 mx-1")}),l.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:"🔗"})]}),l.jsx("div",{contentEditable:!c,suppressContentEditableWarning:!0,onInput:f=>s==null?void 0:s(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}})]})})}}],Ax=[{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:s,suffix:i}=j(e),c=l.jsx("input",{type:"number",placeholder:o,disabled:!0,className:`${Ct()} ${s?"":"rounded-l-md"} ${i?"":"rounded-r-md"}`});return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,children:s||i?l.jsx(zl,{prefix:s,suffix:i,children:c}):c})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,prefix:s,suffix:i,value:c,onChange:d,errors:f,isDisabled:u,config:h}=j(e),m=y=>{const b=y.target.value===""?void 0:Number(y.target.value);d==null||d(b)},g=l.jsx("input",{type:"number",placeholder:o,value:c??"",onChange:m,disabled:u,step:(h==null?void 0:h.step)||1,className:`${Ot({hasError:((f==null?void 0:f.length)??0)>0,disabled:u})} ${s?"rounded-l-none":""} ${i?"rounded-r-none":""}`});return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,errors:f,children:s||i?l.jsx(zl,{prefix:s,suffix:i,children:g}):g})}},{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}=j(e),s=(a==null?void 0:a.min)??0,i=(a==null?void 0:a.max)??100;return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsxs("div",{className:p("flex items-center gap-3"),children:[l.jsx("span",{className:p("text-xs text-gray-500"),children:s}),l.jsx("input",{type:"range",min:s,max:i,disabled:!0,className:p("flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-not-allowed")}),l.jsx("span",{className:p("text-xs text-gray-500"),children:i}),(a==null?void 0:a.showValue)&&l.jsx("span",{className:p("text-sm font-medium text-gray-600 min-w-[40px] text-center"),children:Math.round((s+i)/2)})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:s,errors:i,isDisabled:c,config:d}=j(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 l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsxs("div",{className:p("flex items-center gap-3"),children:[l.jsx("span",{className:p("text-xs text-gray-500"),children:f}),l.jsx("input",{type:"range",min:f,max:u,step:h,value:m,onChange:g=>s==null?void 0:s(Number(g.target.value)),disabled:c,className:p("flex-1 h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer disabled:cursor-not-allowed")}),l.jsx("span",{className:p("text-xs text-gray-500"),children:u}),(d==null?void 0:d.showValue)&&l.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}=j(e),s=(a==null?void 0:a.min)??0,i=(a==null?void 0:a.max)??100;return l.jsxs(de,{label:t,description:r,required:o,labelPosition:n,children:[l.jsxs("div",{className:p("flex items-center gap-3"),children:[l.jsx("span",{className:p("text-xs text-gray-500"),children:s}),l.jsxs("div",{className:p("flex-1 relative h-2 bg-gray-200 rounded-lg"),children:[l.jsx("div",{className:p("absolute h-full bg-blue-400 rounded-lg left-[20%] right-[30%]")}),l.jsx("div",{className:p("absolute w-4 h-4 bg-white border-2 border-blue-500 rounded-full -top-1 left-[20%] -ml-2")}),l.jsx("div",{className:p("absolute w-4 h-4 bg-white border-2 border-blue-500 rounded-full -top-1 right-[30%] -mr-2")})]}),l.jsx("span",{className:p("text-xs text-gray-500"),children:i})]}),(a==null?void 0:a.showValue)&&l.jsxs("div",{className:p("flex justify-between text-sm text-gray-600 mt-2"),children:[l.jsxs("span",{children:["Min: ",Math.round(s+(i-s)*.2)]}),l.jsxs("span",{children:["Max: ",Math.round(s+(i-s)*.7)]})]})]})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:s,errors:i,isDisabled:c,config:d}=j(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),g=(a==null?void 0:a.max)??Math.round(f+(u-f)*.8),y=x=>{const S=Number(x.target.value),N=Math.min(S,g-((d==null?void 0:d.minRange)??0));s==null||s({min:N,max:g})},b=x=>{const S=Number(x.target.value),N=Math.max(S,m+((d==null?void 0:d.minRange)??0));s==null||s({min:m,max:N})},C=(m-f)/(u-f)*100,w=100-(g-f)/(u-f)*100;return l.jsxs(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:[l.jsxs("div",{className:p("flex items-center gap-3"),children:[l.jsx("span",{className:p("text-xs text-gray-500"),children:f}),l.jsxs("div",{className:p("flex-1 relative h-2 bg-gray-200 rounded-lg"),children:[l.jsx("div",{className:p("absolute h-full bg-blue-400 rounded-lg"),style:{left:`${C}%`,right:`${w}%`}}),l.jsx("input",{type:"range",min:f,max:u,step:h,value:m,onChange:y,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}}),l.jsx("input",{type:"range",min:f,max:u,step:h,value:g,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:4}})]}),l.jsx("span",{className:p("text-xs text-gray-500"),children:u})]}),(d==null?void 0:d.showValue)&&l.jsxs("div",{className:p("flex justify-between text-sm text-gray-600 mt-2"),children:[l.jsxs("span",{children:["Min: ",m]}),l.jsxs("span",{children:["Max: ",g]})]})]})}}],Tx=[{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}=j(e),s=(a==null?void 0:a.options)||[];return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsxs("div",{className:p("space-y-2"),children:[s.map((i,c)=>l.jsxs("label",{className:p("flex items-center gap-2"),children:[l.jsx("input",{type:"radio",disabled:!0,className:p("text-blue-600")}),l.jsx("span",{className:p("text-sm text-gray-700"),children:i.label})]},c)),(a==null?void 0:a.allowOther)&&l.jsxs("label",{className:p("flex items-center gap-2"),children:[l.jsx("input",{type:"radio",disabled:!0,className:p("text-blue-600")}),l.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:s,errors:i,isDisabled:c,config:d}=j(e),f=(d==null?void 0:d.options)||[];return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsxs("div",{className:p("space-y-2"),children:[f.map((u,h)=>l.jsxs("label",{className:p("flex items-center gap-2 cursor-pointer"),children:[l.jsx("input",{type:"radio",checked:a===u.value,onChange:()=>s==null?void 0:s(u.value),disabled:c,className:p("text-blue-600")}),l.jsx("span",{className:p("text-sm text-gray-700"),children:u.label})]},h)),(d==null?void 0:d.allowOther)&&l.jsxs("label",{className:p("flex items-center gap-2 cursor-pointer"),children:[l.jsx("input",{type:"radio",checked:a==="__other__",onChange:()=>s==null?void 0:s("__other__"),disabled:c,className:p("text-blue-600")}),l.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}=j(e),s=(a==null?void 0:a.options)||[];return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsxs("div",{className:p("space-y-2"),children:[s.map((i,c)=>l.jsxs("label",{className:p("flex items-center gap-2"),children:[l.jsx("input",{type:"checkbox",disabled:!0,className:p("text-blue-600 rounded")}),l.jsx("span",{className:p("text-sm text-gray-700"),children:i.label})]},c)),(a==null?void 0:a.allowOther)&&l.jsxs("label",{className:p("flex items-center gap-2"),children:[l.jsx("input",{type:"checkbox",disabled:!0,className:p("text-blue-600 rounded")}),l.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:s,errors:i,isDisabled:c,config:d}=j(e),f=(d==null?void 0:d.options)||[],u=Array.isArray(a)?a:[],h=m=>{const g=u.includes(m)?u.filter(y=>y!==m):[...u,m];s==null||s(g)};return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsxs("div",{className:p("space-y-2"),children:[f.map((m,g)=>l.jsxs("label",{className:p("flex items-center gap-2 cursor-pointer"),children:[l.jsx("input",{type:"checkbox",checked:u.includes(m.value),onChange:()=>h(m.value),disabled:c,className:p("text-blue-600 rounded")}),l.jsx("span",{className:p("text-sm text-gray-700"),children:m.label})]},g)),(d==null?void 0:d.allowOther)&&l.jsxs("label",{className:p("flex items-center gap-2 cursor-pointer"),children:[l.jsx("input",{type:"checkbox",checked:u.includes("__other__"),onChange:()=>h("__other__"),disabled:c,className:p("text-blue-600 rounded")}),l.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:s}=j(e),i=(s==null?void 0:s.options)||[];return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,children:l.jsxs("select",{disabled:!0,className:Ct(),children:[l.jsx("option",{children:o||"Select an option..."}),i.map((c,d)=>l.jsx("option",{value:c.value,children:c.label},d))]})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:s,onChange:i,errors:c,isDisabled:d,config:f}=j(e),u=(f==null?void 0:f.options)||[];return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,errors:c,children:l.jsxs("select",{value:s??"",onChange:h=>i==null?void 0:i(h.target.value||void 0),disabled:d,className:Ot({hasError:((c==null?void 0:c.length)??0)>0,disabled:d}),children:[l.jsx("option",{value:"",children:o||"Select an option..."}),u.map((h,m)=>l.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}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,children:l.jsxs("div",{className:p("flex flex-wrap gap-2 p-2 border border-gray-300 rounded-md bg-gray-50 min-h-[42px]"),children:[l.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",l.jsx("button",{disabled:!0,className:p("text-blue-600 hover:text-blue-800"),children:"×"})]}),l.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",l.jsx("button",{disabled:!0,className:p("text-blue-600 hover:text-blue-800"),children:"×"})]}),l.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:s,onChange:i,errors:c,isDisabled:d,config:f}=j(e),u=Array.isArray(s)?s:[],[h,m]=D.useState(""),g=b=>{b.key==="Enter"&&h.trim()&&(b.preventDefault(),!u.includes(h.trim())&&(!(f!=null&&f.maxTags)||u.length<f.maxTags)&&(i==null||i([...u,h.trim()])),m(""))},y=b=>{i==null||i(u.filter(C=>C!==b))};return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,errors:c,children:l.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((b,C)=>l.jsxs("span",{className:p("inline-flex items-center gap-1 px-2 py-1 bg-blue-100 text-blue-800 text-sm rounded"),children:[b,!d&&l.jsx("button",{type:"button",onClick:()=>y(b),className:p("text-blue-600 hover:text-blue-800"),children:"×"})]},C)),!d&&(!(f!=null&&f.maxTags)||u.length<f.maxTags)&&l.jsx("input",{type:"text",placeholder:o||"Add tag...",value:h,onChange:b=>m(b.target.value),onKeyDown:g,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}=j(e);return l.jsx("div",{className:p("space-y-1.5"),children:l.jsxs("label",{className:p("flex items-start gap-3 cursor-pointer"),children:[l.jsx("input",{type:"checkbox",disabled:!0,className:p("mt-1 text-blue-600 rounded")}),l.jsxs("div",{children:[l.jsx("span",{className:p("text-sm text-gray-700"),children:t}),o&&l.jsx("span",{className:p("text-red-500 ml-1"),children:"*"}),r&&l.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:s,isDisabled:i}=j(e);return l.jsxs("div",{className:p("space-y-1.5"),children:[l.jsxs("label",{className:p("flex items-start gap-3 cursor-pointer"),children:[l.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")}),l.jsxs("div",{children:[l.jsx("span",{className:p("text-sm text-gray-700"),children:t}),o&&l.jsx("span",{className:p("text-red-500 ml-1"),children:"*"}),r&&l.jsx("p",{className:p("text-xs text-gray-500 mt-0.5"),children:r})]})]}),s&&s.length>0&&l.jsx("div",{className:p("space-y-1"),children:s.map((c,d)=>l.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}=j(e);return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsxs("div",{className:p("flex items-center gap-2"),children:[l.jsx("span",{className:p("text-sm text-gray-500"),children:(a==null?void 0:a.offLabel)||"Off"}),l.jsx("div",{className:p("relative w-11 h-6 bg-gray-300 rounded-full"),children:l.jsx("div",{className:p("absolute left-1 top-1 w-4 h-4 bg-white rounded-full transition-transform")})}),l.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:s,errors:i,isDisabled:c,config:d}=j(e),f=a??!1;return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsxs("div",{className:p("flex items-center gap-2"),children:[l.jsx("span",{className:p("text-sm text-gray-500"),children:(d==null?void 0:d.offLabel)||"Off"}),l.jsx("button",{type:"button",onClick:()=>!c&&(s==null?void 0:s(!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:l.jsx("div",{className:`absolute top-1 w-4 h-4 bg-white rounded-full transition-transform ${f?"translate-x-6":"translate-x-1"}`})}),l.jsx("span",{className:p("text-sm text-gray-500"),children:(d==null?void 0:d.onLabel)||"On"})]})})}}];var Ix=Object.defineProperty,Px=(e,t)=>Ix(e,"name",{value:t,configurable:!0});function Bl(e,[t,r]){return Math.min(r,Math.max(t,e))}Px(Bl,"clamp");var Mx=Object.defineProperty,Lo=(e,t)=>Mx(e,"name",{value:t,configurable:!0}),hu=!!(typeof window<"u"&&window.document&&window.document.createElement);function we(e,t,{checkForDefaultPrevented:r=!0}={}){return Lo(function(n){if(e==null||e(n),r===!1||!n||!n.defaultPrevented)return t==null?void 0:t(n)},"handleEvent")}Lo(we,"composeEventHandlers");function Ox(e){var t;if(!hu)throw new Error("Cannot access window outside of the DOM");return((t=e==null?void 0:e.ownerDocument)==null?void 0:t.defaultView)??window}Lo(Ox,"getOwnerWindow");function Ul(e){if(!hu)throw new Error("Cannot access document outside of the DOM");return(e==null?void 0:e.ownerDocument)??document}Lo(Ul,"getOwnerDocument");function mu(e,t=!1){const{activeElement:r}=Ul(e);if(!(r!=null&&r.nodeName))return null;if(gu(r)&&r.contentDocument)return mu(r.contentDocument.body,t);if(t){const o=r.getAttribute("aria-activedescendant");if(o){const n=Ul(r).getElementById(o);if(n)return n}}return r}Lo(mu,"getActiveElement");function gu(e){return e.tagName==="IFRAME"}Lo(gu,"isFrame");var Lx=Object.defineProperty,Qt=(e,t)=>Lx(e,"name",{value:t,configurable:!0});function Fx(e,t){const r=v.createContext(t);r.displayName=e+"Context";const o=Qt(a=>{const{children:s,...i}=a,c=v.useMemo(()=>i,Object.values(i));return l.jsx(r.Provider,{value:c,children:s})},"Provider");o.displayName=e+"Provider";function n(a,s={}){const{optional:i=!1}=s,c=v.useContext(r);if(c)return c;if(t!==void 0)return t;if(!i)throw new Error(`\`${a}\` must be used within \`${e}\``)}return Qt(n,"useContext"),[o,n]}Qt(Fx,"createContext");function rr(e,t=[]){let r=[];function o(a,s){const i=v.createContext(s);i.displayName=a+"Context";const c=r.length;r=[...r,s];const d=Qt(u=>{var C;const{scope:h,children:m,...g}=u,y=((C=h==null?void 0:h[e])==null?void 0:C[c])||i,b=v.useMemo(()=>g,Object.values(g));return l.jsx(y.Provider,{value:b,children:m})},"Provider");d.displayName=a+"Provider";function f(u,h,m={}){var C;const{optional:g=!1}=m,y=((C=h==null?void 0:h[e])==null?void 0:C[c])||i,b=v.useContext(y);if(b)return b;if(s!==void 0)return s;if(!g)throw new Error(`\`${u}\` must be used within \`${a}\``)}return Qt(f,"useContext"),[d,f]}Qt(o,"createContext");const n=Qt(()=>{const a=r.map(s=>v.createContext(s));return Qt(function(i){const c=(i==null?void 0:i[e])||a;return v.useMemo(()=>({[`__scope${e}`]:{...i,[e]:c}}),[i,c])},"useScope")},"createScope");return n.scopeName=e,[o,bu(n,...t)]}Qt(rr,"createContextScope");function bu(...e){const t=e[0];if(e.length===1)return t;const r=Qt(()=>{const o=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return Qt(function(a){const s=o.reduce((i,{useScope:c,scopeName:d})=>{const u=c(a)[`__scope${d}`];return{...i,...u}},{});return v.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return r.scopeName=t.scopeName,r}Qt(bu,"composeContextScopes");var $x=Object.defineProperty,Wl=(e,t)=>$x(e,"name",{value:t,configurable:!0});function Hl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Wl(Hl,"setRef");function yu(...e){return t=>{let r=!1;const o=e.map(n=>{const a=Hl(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():Hl(e[n],null)}}}}Wl(yu,"composeRefs");function ze(...e){return v.useCallback(yu(...e),e)}Wl(ze,"useComposedRefs");var Gx=Object.defineProperty,or=(e,t)=>Gx(e,"name",{value:t,configurable:!0});function Wr(e){const t=v.forwardRef((r,o)=>{let{children:n,...a}=r,s=null,i=!1;const c=[];jl(n)&&typeof Ca=="function"&&(n=Ca(n._payload)),v.Children.forEach(n,h=>{var m;if(Su(h)){i=!0;const g=h;let y="child"in g.props?g.props.child:g.props.children;jl(y)&&typeof Ca=="function"&&(y=Ca(y._payload)),s=zx(g,y),c.push((m=s==null?void 0:s.props)==null?void 0:m.children)}else c.push(h)}),s?s=v.cloneElement(s,void 0,c):!i&&v.Children.count(n)===1&&v.isValidElement(n)&&(s=n);const d=s?Cu(s):void 0,f=ze(o,d);if(!s){if(n||n===0)throw new Error(i?Wx(e):Ux(e));return n}const u=wu(a,s.props??{});return s.type!==v.Fragment&&(u.ref=o?f:d),v.cloneElement(s,u)});return t.displayName=`${e}.Slot`,t}or(Wr,"createSlot");var Vx=Wr("Slot"),vu=Symbol.for("radix.slottable");function xu(e){const t=or(r=>"child"in r?r.children(r.child):r.children,"Slottable");return t.displayName=`${e}.Slottable`,t.__radixId=vu,t}or(xu,"createSlottable");var zx=or((e,t)=>{if("child"in e.props){const r=e.props.child;return v.isValidElement(r)?v.cloneElement(r,void 0,e.props.children(r.props.children)):null}return v.isValidElement(t)?t:null},"getSlottableElementFromSlottable");function wu(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}}or(wu,"mergeProps");function Cu(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)}or(Cu,"getElementRef");function Su(e){return v.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vu}or(Su,"isSlottable");var Bx=Symbol.for("react.lazy");function jl(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Bx&&"_payload"in e&&Nu(e._payload)}or(jl,"isLazyComponent");function Nu(e){return typeof e=="object"&&e!==null&&"then"in e}or(Nu,"isPromiseLike");var Ux=or(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),Wx=or(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),Ca=v[" use ".trim().toString()],Hx=Object.defineProperty,gt=(e,t)=>Hx(e,"name",{value:t,configurable:!0});function Sa(e){const t=e+"CollectionProvider",[r,o]=rr(t),[n,a]=r(t,{collectionRef:{current:null},itemMap:new Map}),s=gt(y=>{const{scope:b,children:C}=y,w=v.useRef(null),x=v.useRef(new Map).current;return l.jsx(n,{scope:b,itemMap:x,collectionRef:w,children:C})},"CollectionProvider");s.displayName=t;const i=e+"CollectionSlot",c=Wr(i),d=v.forwardRef((y,b)=>{const{scope:C,children:w}=y,x=a(i,C),S=ze(b,x.collectionRef);return l.jsx(c,{ref:S,children:w})});d.displayName=i;const f=e+"CollectionItemSlot",u="data-radix-collection-item",h=Wr(f),m=v.forwardRef((y,b)=>{const{scope:C,children:w,...x}=y,S=v.useRef(null),N=ze(b,S),E=a(f,C);return v.useEffect(()=>(E.itemMap.set(S,{ref:S,...x}),()=>void E.itemMap.delete(S))),l.jsx(h,{[u]:"",ref:N,children:w})});m.displayName=f;function g(y){const b=a(e+"CollectionConsumer",y);return v.useCallback(()=>{const w=b.collectionRef.current;if(!w)return[];const x=Array.from(w.querySelectorAll(`[${u}]`));return Array.from(b.itemMap.values()).sort((E,M)=>x.indexOf(E.ref.current)-x.indexOf(M.ref.current))},[b.collectionRef,b.itemMap])}return gt(g,"useCollection"),[{Provider:s,Slot:d,ItemSlot:m},g,o]}gt(Sa,"createCollection");var Eu=new WeakMap,Yl=(jt=class extends Map{constructor(r){super(r);ev(this,pt);Cd(this,pt,[...super.keys()]),Eu.set(this,!0)}set(r,o){return Eu.get(this)&&(this.has(r)?Mt(this,pt)[Mt(this,pt).indexOf(r)]=r:Mt(this,pt).push(r)),super.set(r,o),this}insert(r,o,n){const a=this.has(o),s=Mt(this,pt).length,i=ql(r);let c=i>=0?i:s+i;const d=c<0||c>=s?-1:c;if(d===this.size||a&&d===this.size-1||d===-1)return this.set(o,n),this;const f=this.size+(a?0:1);i<0&&c++;const u=[...Mt(this,pt)];let h,m=!1;for(let g=c;g<f;g++)if(c===g){let y=u[g];u[g]===o&&(y=u[g+1]),a&&this.delete(o),h=this.get(y),this.set(o,n)}else{!m&&u[g-1]===o&&(m=!0);const y=u[m?g:g-1],b=h;h=this.get(y),this.delete(y),this.set(y,b)}return this}with(r,o,n){const a=new jt(this);return a.insert(r,o,n),a}before(r){const o=Mt(this,pt).indexOf(r)-1;if(!(o<0))return this.entryAt(o)}setBefore(r,o,n){const a=Mt(this,pt).indexOf(r);return a===-1?this:this.insert(a,o,n)}after(r){let o=Mt(this,pt).indexOf(r);if(o=o===-1||o===this.size-1?-1:o+1,o!==-1)return this.entryAt(o)}setAfter(r,o,n){const a=Mt(this,pt).indexOf(r);return a===-1?this:this.insert(a+1,o,n)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return Cd(this,pt,[]),super.clear()}delete(r){const o=super.delete(r);return o&&Mt(this,pt).splice(Mt(this,pt).indexOf(r),1),o}deleteAt(r){const o=this.keyAt(r);return o!==void 0?this.delete(o):!1}at(r){const o=Na(Mt(this,pt),r);if(o!==void 0)return this.get(o)}entryAt(r){const o=Na(Mt(this,pt),r);if(o!==void 0)return[o,this.get(o)]}indexOf(r){return Mt(this,pt).indexOf(r)}keyAt(r){return Na(Mt(this,pt),r)}from(r,o){const n=this.indexOf(r);if(n===-1)return;let a=n+o;return a<0&&(a=0),a>=this.size&&(a=this.size-1),this.at(a)}keyFrom(r,o){const n=this.indexOf(r);if(n===-1)return;let a=n+o;return a<0&&(a=0),a>=this.size&&(a=this.size-1),this.keyAt(a)}find(r,o){let n=0;for(const a of this){if(Reflect.apply(r,o,[a,n,this]))return a;n++}}findIndex(r,o){let n=0;for(const a of this){if(Reflect.apply(r,o,[a,n,this]))return n;n++}return-1}filter(r,o){const n=[];let a=0;for(const s of this)Reflect.apply(r,o,[s,a,this])&&n.push(s),a++;return new jt(n)}map(r,o){const n=[];let a=0;for(const s of this)n.push([s[0],Reflect.apply(r,o,[s,a,this])]),a++;return new jt(n)}reduce(...r){const[o,n]=r;let a=0,s=n??this.at(0);for(const i of this)a===0&&r.length===1?s=i:s=Reflect.apply(o,this,[s,i,a,this]),a++;return s}reduceRight(...r){const[o,n]=r;let a=n??this.at(-1);for(let s=this.size-1;s>=0;s--){const i=this.at(s);s===this.size-1&&r.length===1?a=i:a=Reflect.apply(o,this,[a,i,s,this])}return a}toSorted(r){const o=[...this.entries()].sort(r);return new jt(o)}toReversed(){const r=new jt;for(let o=this.size-1;o>=0;o--){const n=this.keyAt(o),a=this.get(n);r.set(n,a)}return r}toSpliced(...r){const o=[...this.entries()];return o.splice(...r),new jt(o)}slice(r,o){const n=new jt;let a=this.size-1;if(r===void 0)return n;r<0&&(r=r+this.size),o!==void 0&&o>0&&(a=o-1);for(let s=r;s<=a;s++){const i=this.keyAt(s),c=this.get(i);n.set(i,c)}return n}every(r,o){let n=0;for(const a of this){if(!Reflect.apply(r,o,[a,n,this]))return!1;n++}return!0}some(r,o){let n=0;for(const a of this){if(Reflect.apply(r,o,[a,n,this]))return!0;n++}return!1}},pt=new WeakMap,gt(jt,"OrderedDict"),jt);function Na(e,t){if("at"in Array.prototype)return Array.prototype.at.call(e,t);const r=ku(e,t);return r===-1?void 0:e[r]}gt(Na,"at");function ku(e,t){const r=e.length,o=ql(t),n=o>=0?o:r+o;return n<0||n>=r?-1:n}gt(ku,"toSafeIndex");function ql(e){return e!==e||e===0?0:Math.trunc(e)}gt(ql,"toSafeInteger");function jx(e){const t=e+"CollectionProvider",[r,o]=rr(t),[n,a]=r(t,{collectionElement:null,collectionRef:{current:null},collectionRefObject:{current:null},itemMap:new Yl,setItemMap:gt(()=>{},"setItemMap")}),s=gt(({state:x,...S})=>x?l.jsx(c,{...S,state:x}):l.jsx(i,{...S}),"CollectionProvider");s.displayName=t;const i=gt(x=>{const S=b();return l.jsx(c,{...x,state:S})},"CollectionInit");i.displayName=t+"Init";const c=gt(x=>{const{scope:S,children:N,state:E}=x,M=v.useRef(null),[k,T]=v.useState(null),A=ze(M,T),[L,O]=E;return v.useEffect(()=>{if(!k)return;const F=Au(()=>{});return F.observe(k,{childList:!0,subtree:!0}),()=>{F.disconnect()}},[k]),l.jsx(n,{scope:S,itemMap:L,setItemMap:O,collectionRef:A,collectionRefObject:M,collectionElement:k,children:N})},"CollectionProviderImpl");c.displayName=t+"Impl";const d=e+"CollectionSlot",f=Wr(d),u=v.forwardRef((x,S)=>{const{scope:N,children:E}=x,M=a(d,N),k=ze(S,M.collectionRef);return l.jsx(f,{ref:k,children:E})});u.displayName=d;const h=e+"CollectionItemSlot",m="data-radix-collection-item",g=Wr(h),y=v.forwardRef((x,S)=>{const{scope:N,children:E,...M}=x,k=v.useRef(null),[T,A]=v.useState(null),L=ze(S,k,A),O=a(h,N),{setItemMap:F}=O,V=v.useRef(M);_u(V.current,M)||(V.current=M);const re=V.current;return v.useEffect(()=>{const K=re;return F(H=>T?H.has(T)?H.set(T,{...K,element:T}).toSorted(Ql):(H.set(T,{...K,element:T}),H.toSorted(Ql)):H),()=>{F(H=>!T||!H.has(T)?H:(H.delete(T),new Yl(H)))}},[T,re,F]),l.jsx(g,{[m]:"",ref:L,children:E})});y.displayName=h;function b(){return v.useState(new Yl)}gt(b,"useInitCollection");function C(x){const{itemMap:S}=a(e+"CollectionConsumer",x);return S}return gt(C,"useCollection"),[{Provider:s,Slot:u,ItemSlot:y},{createCollectionScope:o,useCollection:C,useInitCollection:b}]}gt(jx,"createCollection");function _u(e,t){if(e===t)return!0;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return!1;const r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(const n of r)if(!Object.prototype.hasOwnProperty.call(t,n)||e[n]!==t[n])return!1;return!0}gt(_u,"shallowEqual");function Du(e,t){return!!(t.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_PRECEDING)}gt(Du,"isElementPreceding");function Ql(e,t){return!e[1].element||!t[1].element?0:Du(e[1].element,t[1].element)?-1:1}gt(Ql,"sortByDocumentPosition");function Au(e){return new MutationObserver(r=>{for(const o of r)if(o.type==="childList"){e();return}})}gt(Au,"getChildListObserver");var Yx=Object.defineProperty,qx=(e,t)=>Yx(e,"name",{value:t,configurable:!0}),Qx=v.createContext(void 0);function hn(e){const t=v.useContext(Qx);return e||t||"ltr"}qx(hn,"useDirection");var Kx=Object.defineProperty,Xx=(e,t)=>Kx(e,"name",{value:t,configurable:!0}),Jx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ie=Jx.reduce((e,t)=>{const r=Wr(`Primitive.${t}`),o=v.forwardRef((n,a)=>{const{asChild:s,...i}=n,c=s?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...i,ref:a})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function Tu(e,t){e&&sn.flushSync(()=>e.dispatchEvent(t))}Xx(Tu,"dispatchDiscreteCustomEvent");var Zx=Object.defineProperty,Rx=(e,t)=>Zx(e,"name",{value:t,configurable:!0});function nr(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>((...r)=>{var o;return(o=t.current)==null?void 0:o.call(t,...r)}),[])}Rx(nr,"useCallbackRef");var ew=Object.defineProperty,bt=(e,t)=>ew(e,"name",{value:t,configurable:!0}),Kl="dismissableLayer.update",tw="dismissableLayer.pointerDownOutside",rw="dismissableLayer.focusOutside",Iu,Pu=v.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),Mu=v.forwardRef(bt(function(t,r){const{disableOutsidePointerEvents:o=!1,deferPointerDownOutside:n=!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:c,onDismiss:d,...f}=t,u=v.useContext(Pu),[h,m]=v.useState(null),g=(h==null?void 0:h.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=v.useState({}),b=ze(r,m),C=Array.from(u.layers),[w]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),x=w?C.indexOf(w):-1,S=h?C.indexOf(h):-1,N=u.layersWithOutsidePointerEventsDisabled.size>0,E=S>=x,M=v.useRef(!1),k=Ou(O=>{s==null||s(O),c==null||c(O),O.defaultPrevented||d==null||d()},{ownerDocument:g,deferPointerDownOutside:n,isDeferredPointerDownOutsideRef:M,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:v.useCallback(O=>{if(!(O instanceof Node))return!1;const F=[...u.branches].some(V=>V.contains(O));return E&&!F},[u.branches,E])}),T=Lu(O=>{if(n&&M.current)return;const F=O.target;[...u.branches].some(re=>re.contains(F))||(i==null||i(O),c==null||c(O),O.defaultPrevented||d==null||d())},g),A=h?S===C.length-1:!1,L=nr(O=>{O.key==="Escape"&&(a==null||a(O),!O.defaultPrevented&&d&&(O.preventDefault(),d()))});return v.useEffect(()=>{if(A)return g.addEventListener("keydown",L,{capture:!0}),()=>g.removeEventListener("keydown",L,{capture:!0})},[g,A,L]),v.useEffect(()=>{if(h)return o&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(Iu=g.body.style.pointerEvents,g.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(h)),u.layers.add(h),Xl(),()=>{o&&(u.layersWithOutsidePointerEventsDisabled.delete(h),u.layersWithOutsidePointerEventsDisabled.size===0&&(g.body.style.pointerEvents=Iu))}},[h,g,o,u]),v.useEffect(()=>()=>{h&&(u.layers.delete(h),u.layersWithOutsidePointerEventsDisabled.delete(h),Xl())},[h,u]),v.useEffect(()=>{const O=bt(()=>y({}),"handleUpdate");return document.addEventListener(Kl,O),()=>document.removeEventListener(Kl,O)},[]),l.jsx(Ie.div,{...f,ref:b,style:{pointerEvents:N?E?"auto":"none":void 0,...t.style},onFocusCapture:we(t.onFocusCapture,T.onFocusCapture),onBlurCapture:we(t.onBlurCapture,T.onBlurCapture),onPointerDownCapture:we(t.onPointerDownCapture,k.onPointerDownCapture)})},"DismissableLayer"));function ow(){const e=v.useContext(Pu),[t,r]=v.useState(null);return v.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}bt(ow,"useDismissableLayerSurface");var nw=bt(()=>!0,"IS_TRUE");function Ou(e,t){const{ownerDocument:r=globalThis==null?void 0:globalThis.document,deferPointerDownOutside:o=!1,isDeferredPointerDownOutsideRef:n,dismissableSurfaces:a,shouldHandlePointerDownOutside:s=nw}=t,i=nr(e),c=v.useRef(!1),d=v.useRef(!1),f=v.useRef(new Map),u=v.useRef(()=>{});return v.useEffect(()=>{function h(){d.current=!1,n.current=!1,f.current.clear()}bt(h,"resetOutsideInteraction");function m(){return Array.from(f.current.values()).some(Boolean)}bt(m,"isOutsideInteractionIntercepted");function g(x){if(!d.current)return;const S=x.target;S instanceof Node&&[...a].some(E=>E.contains(S))||f.current.set(x.type,!0),x.type==="click"&&window.setTimeout(()=>{d.current&&u.current()},0)}bt(g,"handleInteractionCapture");function y(x){d.current&&f.current.set(x.type,!1)}bt(y,"handleInteractionBubble");const b=bt(x=>{if(x.target&&!c.current){let S=function(){r.removeEventListener("click",u.current);const E=m();h(),E||Jl(tw,i,N,{discrete:!0})};if(bt(S,"handleAndDispatchPointerDownOutsideEvent"),!s(x.target)){r.removeEventListener("click",u.current),h(),c.current=!1;return}const N={originalEvent:x};d.current=!0,n.current=o&&x.button===0,f.current.clear(),!o||x.button!==0?S():(r.removeEventListener("click",u.current),u.current=S,r.addEventListener("click",u.current,{once:!0}))}else r.removeEventListener("click",u.current),h();c.current=!1},"handlePointerDown"),C=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const x of C)r.addEventListener(x,g,!0),r.addEventListener(x,y);const w=window.setTimeout(()=>{r.addEventListener("pointerdown",b)},0);return()=>{window.clearTimeout(w),r.removeEventListener("pointerdown",b),r.removeEventListener("click",u.current);for(const x of C)r.removeEventListener(x,g,!0),r.removeEventListener(x,y)}},[r,i,o,n,a,s]),{onPointerDownCapture:bt(()=>c.current=!0,"onPointerDownCapture")}}bt(Ou,"usePointerDownOutside");function Lu(e,t=globalThis==null?void 0:globalThis.document){const r=nr(e),o=v.useRef(!1);return v.useEffect(()=>{const n=bt(a=>{a.target&&!o.current&&Jl(rw,r,{originalEvent:a},{discrete:!1})},"handleFocus");return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:bt(()=>o.current=!0,"onFocusCapture"),onBlurCapture:bt(()=>o.current=!1,"onBlurCapture")}}bt(Lu,"useFocusOutside");function Xl(){const e=new CustomEvent(Kl);document.dispatchEvent(e)}bt(Xl,"dispatchUpdate");function Jl(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?Tu(n,a):n.dispatchEvent(a)}bt(Jl,"handleAndDispatchCustomEvent");var aw=Object.defineProperty,Zl=(e,t)=>aw(e,"name",{value:t,configurable:!0}),Ea=0,fr=null;function sw(e){return Rl(),e.children}Zl(sw,"FocusGuards");function Rl(){v.useEffect(()=>{fr||(fr={start:ei(),end:ei()});const{start:e,end:t}=fr;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Ea++,()=>{Ea===1&&(fr==null||fr.start.remove(),fr==null||fr.end.remove(),fr=null),Ea=Math.max(0,Ea-1)}},[])}Zl(Rl,"useFocusGuards");function ei(){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}Zl(ei,"createFocusGuard");var lw=Object.defineProperty,Lt=(e,t)=>lw(e,"name",{value:t,configurable:!0}),ti="focusScope.autoFocusOnMount",ri="focusScope.autoFocusOnUnmount",Fu={bubbles:!1,cancelable:!0},iw=v.forwardRef(Lt(function(t,r){const{loop:o=!1,trapped:n=!1,onMountAutoFocus:a,onUnmountAutoFocus:s,...i}=t,[c,d]=v.useState(null),f=nr(a),u=nr(s),h=v.useRef(null),m=ze(r,d),g=v.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;v.useEffect(()=>{if(n){let b=function(S){if(g.paused||!c)return;const N=S.target;c.contains(N)?h.current=N:Tr(h.current,{select:!0})},C=function(S){if(g.paused||!c)return;const N=S.relatedTarget;N!==null&&(c.contains(N)||Tr(h.current,{select:!0}))},w=function(S){if(document.activeElement===document.body)for(const E of S)E.removedNodes.length>0&&Tr(c)};Lt(b,"handleFocusIn"),Lt(C,"handleFocusOut"),Lt(w,"handleMutations"),document.addEventListener("focusin",b),document.addEventListener("focusout",C);const x=new MutationObserver(w);return c&&x.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",b),document.removeEventListener("focusout",C),x.disconnect()}}},[n,c,g.paused]),v.useEffect(()=>{if(c){Bu.add(g);const b=document.activeElement;if(!c.contains(b)){const w=new CustomEvent(ti,Fu);c.addEventListener(ti,f),c.dispatchEvent(w),w.defaultPrevented||($u(Wu(oi(c)),{select:!0}),document.activeElement===b&&Tr(c))}return()=>{c.removeEventListener(ti,f),setTimeout(()=>{const w=new CustomEvent(ri,Fu);c.addEventListener(ri,u),c.dispatchEvent(w),w.defaultPrevented||Tr(b??document.body,{select:!0}),c.removeEventListener(ri,u),Bu.remove(g)},0)}}},[c,f,u,g]);const y=v.useCallback(b=>{if(!o&&!n||g.paused)return;const C=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,w=document.activeElement;if(C&&w){const x=b.currentTarget,[S,N]=Gu(x);S&&N?!b.shiftKey&&w===N?(b.preventDefault(),o&&Tr(S,{select:!0})):b.shiftKey&&w===S&&(b.preventDefault(),o&&Tr(N,{select:!0})):w===x&&b.preventDefault()}},[o,n,g.paused]);return l.jsx(Ie.div,{tabIndex:-1,...i,ref:m,onKeyDown:y})},"FocusScope"));function $u(e,{select:t=!1}={}){const r=document.activeElement;for(const o of e)if(Tr(o,{select:t}),document.activeElement!==r)return}Lt($u,"focusFirst");function Gu(e){const t=oi(e),r=ni(t,e),o=ni(t.reverse(),e);return[r,o]}Lt(Gu,"getTabbableEdges");function oi(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:Lt(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},"acceptNode")});for(;r.nextNode();)t.push(r.currentNode);return t}Lt(oi,"getTabbableCandidates");function ni(e,t){const r=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const o of e)if(!(r?!o.checkVisibility({checkVisibilityCSS:!0}):Vu(o,{upTo:t})))return o}Lt(ni,"findVisible");function Vu(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}Lt(Vu,"isHidden");function zu(e){return e instanceof HTMLInputElement&&"select"in e}Lt(zu,"isSelectableInput");function Tr(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&zu(e)&&t&&e.select()}}Lt(Tr,"focus");var Bu=Uu();function Uu(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=ai(e,t),e.unshift(t)},remove(t){var r;e=ai(e,t),(r=e[0])==null||r.resume()}}}Lt(Uu,"createFocusScopesStack");function ai(e,t){const r=[...e],o=r.indexOf(t);return o!==-1&&r.splice(o,1),r}Lt(ai,"arrayRemove");function Wu(e){return e.filter(t=>t.tagName!=="A")}Lt(Wu,"removeLinks");var nt=globalThis!=null&&globalThis.document?v.useLayoutEffect:()=>{},cw=Object.defineProperty,dw=(e,t)=>cw(e,"name",{value:t,configurable:!0}),uw=v[" useId ".trim().toString()]||(()=>{}),pw=0;function Hr(e){const[t,r]=v.useState(uw());return nt(()=>{e||r(o=>o??String(pw++))},[e]),e||(t?`radix-${t}`:"")}dw(Hr,"useId");const fw=["top","right","bottom","left"],jr=Math.min,Ir=Math.max,ka=Math.round,_a=Math.floor,Pr=e=>({x:e,y:e}),hw={left:"right",right:"left",bottom:"top",top:"bottom"};function Hu(e,t,r){return Ir(e,jr(t,r))}function Mr(e,t){return typeof e=="function"?e(t):e}function Yr(e){return e.split("-")[0]}function Fo(e){return e.split("-")[1]}function si(e){return e==="x"?"y":"x"}function li(e){return e==="y"?"height":"width"}function hr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function ii(e){return si(hr(e))}function mw(e,t,r){r===void 0&&(r=!1);const o=Fo(e),n=ii(e),a=li(n);let s=n==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(s=Da(s)),[s,Da(s)]}function gw(e){const t=Da(e);return[ci(e),t,ci(t)]}function ci(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ju=["left","right"],Yu=["right","left"],bw=["top","bottom"],yw=["bottom","top"];function vw(e,t,r){switch(e){case"top":case"bottom":return r?t?Yu:ju:t?ju:Yu;case"left":case"right":return t?bw:yw;default:return[]}}function xw(e,t,r,o){const n=Fo(e);let a=vw(Yr(e),r==="start",o);return n&&(a=a.map(s=>s+"-"+n),t&&(a=a.concat(a.map(ci)))),a}function Da(e){const t=Yr(e);return hw[t]+e.slice(t.length)}function ww(e){var t,r,o,n;return{top:(t=e.top)!=null?t:0,right:(r=e.right)!=null?r:0,bottom:(o=e.bottom)!=null?o:0,left:(n=e.left)!=null?n:0}}function qu(e){return typeof e!="number"?ww(e):{top:e,right:e,bottom:e,left:e}}function Aa(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 Qu(e,t,r){let{reference:o,floating:n}=e;const a=hr(t),s=ii(t),i=li(s),c=Yr(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}}const g=Fo(t);return g&&(m[s]+=h*(g==="end"?1:-1)*(r&&d?-1:1)),m}async function Cw(e,t){var r;t===void 0&&(t={});const{x:o,y:n,platform:a,rects:s,elements:i,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:h=!1,padding:m=0}=Mr(t,e),g=qu(m),b=i[h?u==="floating"?"reference":"floating":u],C=Aa(await a.getClippingRect({element:(r=await(a.isElement==null?void 0:a.isElement(b)))==null||r?b:b.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(i.floating)),boundary:d,rootBoundary:f,strategy:c})),w=u==="floating"?{x:o,y:n,width:s.floating.width,height:s.floating.height}:s.reference,x=await(a.getOffsetParent==null?void 0:a.getOffsetParent(i.floating)),S=await(a.isElement==null?void 0:a.isElement(x))&&await(a.getScale==null?void 0:a.getScale(x))||{x:1,y:1},N=Aa(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:w,offsetParent:x,strategy:c}):w);return{top:(C.top-N.top+g.top)/S.y,bottom:(N.bottom-C.bottom+g.bottom)/S.y,left:(C.left-N.left+g.left)/S.x,right:(N.right-C.right+g.right)/S.x}}const Sw=50,Nw=async(e,t,r)=>{const{placement:o="bottom",strategy:n="absolute",middleware:a=[],platform:s}=r,i=s.detectOverflow?s:{...s,detectOverflow:Cw},c=await(s.isRTL==null?void 0:s.isRTL(t));let d=await s.getElementRects({reference:e,floating:t,strategy:n}),{x:f,y:u}=Qu(d,o,c),h=o,m=0;const g={};for(let y=0;y<a.length;y++){const b=a[y];if(!b)continue;const{name:C,fn:w}=b,{x,y:S,data:N,reset:E}=await w({x:f,y:u,initialPlacement:o,placement:h,strategy:n,middlewareData:g,rects:d,platform:i,elements:{reference:e,floating:t}});f=x??f,u=S??u,g[C]={...g[C],...N},E&&m<Sw&&(m++,typeof E=="object"&&(E.placement&&(h=E.placement),E.rects&&(d=E.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:n}):E.rects),{x:f,y:u}=Qu(d,h,c)),y=-1)}return{x:f,y:u,placement:h,strategy:n,middlewareData:g}},Ew=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:o,placement:n,rects:a,platform:s,elements:i,middlewareData:c}=t,{element:d,padding:f=0}=Mr(e,t)||{};if(d==null)return{};const u=qu(f),h={x:r,y:o},m=ii(n),g=li(m),y=await s.getDimensions(d),b=m==="y",C=b?"top":"left",w=b?"bottom":"right",x=b?"clientHeight":"clientWidth",S=a.reference[g]+a.reference[m]-h[m]-a.floating[g],N=h[m]-a.reference[m],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d));let M=E?E[x]:0;(!M||!await(s.isElement==null?void 0:s.isElement(E)))&&(M=i.floating[x]||a.floating[g]);const k=S/2-N/2,T=M/2-y[g]/2-1,A=jr(u[C],T),L=jr(u[w],T),O=M-y[g]-L,F=M/2-y[g]/2+k,V=Hu(A,F,O),re=!c.arrow&&Fo(n)!=null&&F!==V&&a.reference[g]/2-(F<A?A:L)-y[g]/2<0,K=re?F<A?F-A:F-O:0;return{[m]:h[m]+K,data:{[m]:V,centerOffset:F-V-K,...re&&{alignmentOffset:K}},reset:re}}}),kw=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,o;const{placement:n,middlewareData:a,rects:s,initialPlacement:i,platform:c,elements:d}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:y=!0,...b}=Mr(e,t);if((r=a.arrow)!=null&&r.alignmentOffset)return{};const C=Yr(n),w=hr(i),x=Yr(i)===i,S=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=h||(x||!y?[Da(i)]:gw(i)),E=g!=="none";!h&&E&&N.push(...xw(i,y,g,S));const M=[i,...N],k=await c.detectOverflow(t,b),T=[];let A=((o=a.flip)==null?void 0:o.overflows)||[];if(f&&T.push(k[C]),u){const V=mw(n,s,S);T.push(k[V[0]],k[V[1]])}if(A=[...A,{placement:n,overflows:T}],!T.every(V=>V<=0)){var L,O;const V=(((L=a.flip)==null?void 0:L.index)||0)+1,re=M[V];if(re&&(!(u==="alignment"?w!==hr(re):!1)||A.every(ee=>hr(ee.placement)===w?ee.overflows[0]>0:!0)))return{data:{index:V,overflows:A},reset:{placement:re}};let K=(O=A.filter(H=>H.overflows[0]<=0).sort((H,ee)=>H.overflows[1]-ee.overflows[1])[0])==null?void 0:O.placement;if(!K)switch(m){case"bestFit":{var F;const H=(F=A.filter(ee=>{if(E){const G=hr(ee.placement);return G===w||G==="y"}return!0}).map(ee=>[ee.placement,ee.overflows.filter(G=>G>0).reduce((G,z)=>G+z,0)]).sort((ee,G)=>ee[1]-G[1])[0])==null?void 0:F[0];H&&(K=H);break}case"initialPlacement":K=i;break}if(n!==K)return{reset:{placement:K}}}return{}}}};function Ku(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Xu(e){return fw.some(t=>e[t]>=0)}const _w=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:o}=t,{strategy:n="referenceHidden",...a}=Mr(e,t);switch(n){case"referenceHidden":{const s=await o.detectOverflow(t,{...a,elementContext:"reference"}),i=Ku(s,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:Xu(i)}}}case"escaped":{const s=await o.detectOverflow(t,{...a,altBoundary:!0}),i=Ku(s,r.floating);return{data:{escapedOffsets:i,escaped:Xu(i)}}}default:return{}}}}},Ju=new Set(["left","top"]);async function Dw(e,t){const{placement:r,platform:o,elements:n}=e,a=await(o.isRTL==null?void 0:o.isRTL(n.floating)),s=Yr(r),i=Fo(r),c=hr(r)==="y",d=Ju.has(s)?-1:1,f=a&&c?-1:1,u=Mr(t,e);let{mainAxis:h,crossAxis:m,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&typeof g=="number"&&(m=i==="end"?g*-1:g),c?{x:m*f,y:h*d}:{x:h*d,y:m*f}}const Aw=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,o;const{x:n,y:a,placement:s,middlewareData:i}=t,c=await Dw(t,e);return s===((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:s}}}}},Tw=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:s=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x,y:S}=w;return{x,y:S}}},...d}=Mr(e,t),f={x:r,y:o},u=await a.detectOverflow(t,d),h=hr(n),m=si(h);let g=f[m],y=f[h];const b=(w,x)=>Hu(x+u[w==="y"?"top":"left"],x,x-u[w==="y"?"bottom":"right"]);s&&(g=b(m,g)),i&&(y=b(h,y));const C=c.fn({...t,[m]:g,[h]:y});return{...C,data:{x:C.x-r,y:C.y-o,enabled:{[m]:s,[h]:i}}}}}},Iw=function(e){return e===void 0&&(e={}),{options:e,fn(t){var r,o;const{x:n,y:a,placement:s,rects:i,middlewareData:c}=t,{offset:d=0,mainAxis:f=!0,crossAxis:u=!0}=Mr(e,t),h={x:n,y:a},m=hr(s),g=si(m);let y=h[g],b=h[m];const C=Mr(d,t),w=typeof C=="number"?{mainAxis:C,crossAxis:0}:{mainAxis:(r=C.mainAxis)!=null?r:0,crossAxis:(o=C.crossAxis)!=null?o:0};if(f){const N=g==="y"?"height":"width",E=i.reference[g]-i.floating[N]+w.mainAxis,M=i.reference[g]+i.reference[N]-w.mainAxis;y<E?y=E:y>M&&(y=M)}if(u){var x,S;const N=g==="y"?"width":"height",E=Ju.has(Yr(s)),M=i.reference[m]-i.floating[N]+(E&&((x=c.offset)==null?void 0:x[m])||0)+(E?0:w.crossAxis),k=i.reference[m]+i.reference[N]+(E?0:((S=c.offset)==null?void 0:S[m])||0)-(E?w.crossAxis:0);b<M?b=M:b>k&&(b=k)}return{[g]:y,[m]:b}}}},Pw=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:o,platform:n,elements:a}=t,{apply:s=()=>{},...i}=Mr(e,t),c=await n.detectOverflow(t,i),d=Yr(r),f=Fo(r),u=hr(r)==="y",{width:h,height:m}=o.floating;let g,y;d==="top"||d==="bottom"?(g=d,y=f===(await(n.isRTL==null?void 0:n.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,g=f==="end"?"top":"bottom");const b=m-c.top-c.bottom,C=h-c.left-c.right,w=jr(m-c[g],b),x=jr(h-c[y],C),S=t.middlewareData.shift,N=!S;let E=w,M=x;S!=null&&S.enabled.x&&(M=C),S!=null&&S.enabled.y&&(E=b),N&&!f&&(u?M=h-2*Ir(c.left,c.right):E=m-2*Ir(c.top,c.bottom)),await s({...t,availableWidth:M,availableHeight:E});const k=await n.getDimensions(a.floating);return h!==k.width||m!==k.height?{reset:{rects:!0}}:{}}}};function Ta(){return typeof window<"u"}function $o(e){return Zu(e)?(e.nodeName||"").toLowerCase():"#document"}function $t(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Or(e){var t;return(t=(Zu(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Zu(e){return Ta()?e instanceof Node||e instanceof $t(e).Node:!1}function mr(e){return Ta()?e instanceof Element||e instanceof $t(e).Element:!1}function qr(e){return Ta()?e instanceof HTMLElement||e instanceof $t(e).HTMLElement:!1}function Ru(e){return!Ta()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof $t(e).ShadowRoot}function Ia(e){const{overflow:t,overflowX:r,overflowY:o,display:n}=gr(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+r)&&n!=="inline"&&n!=="contents"}function Mw(e){return/^(table|td|th)$/.test($o(e))}function Pa(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Ow=/transform|translate|scale|rotate|perspective|filter/,Lw=/paint|layout|strict|content/,po=e=>!!e&&e!=="none";let di;function ui(e){const t=mr(e)?gr(e):e;return po(t.transform)||po(t.translate)||po(t.scale)||po(t.rotate)||po(t.perspective)||!pi()&&(po(t.backdropFilter)||po(t.filter))||Ow.test(t.willChange||"")||Lw.test(t.contain||"")}function Fw(e){let t=fo(e);for(;qr(t)&&!mn(t);){if(ui(t))return t;if(Pa(t))return null;t=fo(t)}return null}function pi(){return di==null&&(di=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),di}function mn(e){return/^(html|body|#document)$/.test($o(e))}function gr(e){return $t(e).getComputedStyle(e)}function Ma(e){return mr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function fo(e){if($o(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ru(e)&&e.host||Or(e);return Ru(t)?t.host:t}function ep(e){const t=fo(e);return mn(t)?(e.ownerDocument||e).body:qr(t)&&Ia(t)?t:ep(t)}function gn(e,t,r){var o;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=ep(e),a=n===((o=e.ownerDocument)==null?void 0:o.body),s=$t(n);if(a){const i=fi(s);return t.concat(s,s.visualViewport||[],Ia(n)?n:[],i&&r?gn(i):[])}else return t.concat(n,gn(n,[],r))}function fi(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function tp(e){const t=gr(e);let r=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const n=qr(e),a=n?e.offsetWidth:r,s=n?e.offsetHeight:o,i=ka(r)!==a||ka(o)!==s;return i&&(r=a,o=s),{width:r,height:o,$:i}}function hi(e){return mr(e)?e:e.contextElement}function Go(e){const t=hi(e);if(!qr(t))return Pr(1);const r=t.getBoundingClientRect(),{width:o,height:n,$:a}=tp(t);let s=(a?ka(r.width):r.width)/o,i=(a?ka(r.height):r.height)/n;return(!s||!Number.isFinite(s))&&(s=1),(!i||!Number.isFinite(i))&&(i=1),{x:s,y:i}}const $w=Pr(0);function rp(e){const t=$t(e);return!pi()||!t.visualViewport?$w:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Gw(e,t,r){return t===void 0&&(t=!1),!!r&&t&&r===$t(e)}function ho(e,t,r,o){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),a=hi(e);let s=Pr(1);t&&(o?mr(o)&&(s=Go(o)):s=Go(e));const i=Gw(a,r,o)?rp(a):Pr(0);let c=(n.left+i.x)/s.x,d=(n.top+i.y)/s.y,f=n.width/s.x,u=n.height/s.y;if(a&&o){const h=$t(a),m=mr(o)?$t(o):o;let g=h,y=fi(g);for(;y&&m!==g;){const b=Go(y),C=y.getBoundingClientRect(),w=gr(y),x=C.left+(y.clientLeft+parseFloat(w.paddingLeft))*b.x,S=C.top+(y.clientTop+parseFloat(w.paddingTop))*b.y;c*=b.x,d*=b.y,f*=b.x,u*=b.y,c+=x,d+=S,g=$t(y),y=fi(g)}}return Aa({width:f,height:u,x:c,y:d})}function Oa(e,t){const r=Ma(e).scrollLeft;return t?t.left+r:ho(Or(e)).left+r}function op(e,t){const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-Oa(e,r),n=r.top+t.scrollTop;return{x:o,y:n}}function Vw(e){let{elements:t,rect:r,offsetParent:o,strategy:n}=e;const a=n==="fixed",s=Or(o),i=t?Pa(t.floating):!1;if(o===s||i&&a)return r;let c={scrollLeft:0,scrollTop:0},d=Pr(1);const f=Pr(0),u=qr(o);if((u||!a)&&(($o(o)!=="body"||Ia(s))&&(c=Ma(o)),u)){const m=ho(o);d=Go(o),f.x=m.x+o.clientLeft,f.y=m.y+o.clientTop}const h=s&&!u&&!a?op(s,c):Pr(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 zw(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Bw(e){const t=Ma(e),r=e.ownerDocument.body,o=Ir(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),n=Ir(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-t.scrollLeft+Oa(e);const s=-t.scrollTop;return gr(r).direction==="rtl"&&(a+=Ir(e.clientWidth,r.clientWidth)-o),{width:o,height:n,x:a,y:s}}const Uw=25;function Ww(e,t,r){r===void 0&&(r="viewport");const o=r==="layoutViewport",n=$t(e),a=Or(e),s=n.visualViewport;let i=a.clientWidth,c=a.clientHeight,d=0,f=0;if(s){const h=!pi()||t==="fixed";o?h||(d=-s.offsetLeft,f=-s.offsetTop):(i=s.width,c=s.height,h&&(d=s.offsetLeft,f=s.offsetTop))}if(Oa(a)<=0){const h=a.ownerDocument,m=h.body,g=getComputedStyle(m),y=h.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,b=Math.abs(a.clientWidth-m.clientWidth-y),C=getComputedStyle(a).scrollbarGutter==="stable both-edges"?b/2:b;C<=Uw&&(i-=C)}return{width:i,height:c,x:d,y:f}}function Hw(e,t){const r=ho(e,!0,t==="fixed"),o=r.top+e.clientTop,n=r.left+e.clientLeft,a=Go(e),s=e.clientWidth*a.x,i=e.clientHeight*a.y,c=n*a.x,d=o*a.y;return{width:s,height:i,x:c,y:d}}function np(e,t,r){let o;if(t==="viewport"||t==="layoutViewport")o=Ww(e,r,t);else if(t==="document")o=Bw(Or(e));else if(mr(t))o=Hw(t,r);else{const n=rp(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Aa(o)}function jw(e,t){const r=t.get(e);if(r)return r;let o=gn(e,[],!1).filter(i=>mr(i)&&$o(i)!=="body"),n=null;const a=gr(e).position==="fixed";let s=a?fo(e):e;for(;mr(s)&&!mn(s);){const i=gr(s),c=ui(s),d=n?n.position:a?"fixed":"";!c&&(d==="fixed"||d==="absolute"&&i.position==="static")?o=o.filter(u=>u!==s):n=i,s=fo(s)}return t.set(e,o),o}function Yw(e){let{element:t,boundary:r,rootBoundary:o,strategy:n}=e;const s=[...r==="clippingAncestors"?Pa(t)?[]:jw(t,this._c):[].concat(r),o],i=np(t,s[0],n);let c=i.top,d=i.right,f=i.bottom,u=i.left;for(let h=1;h<s.length;h++){const m=np(t,s[h],n);c=Ir(m.top,c),d=jr(m.right,d),f=jr(m.bottom,f),u=Ir(m.left,u)}return{width:d-u,height:f-c,x:u,y:c}}function qw(e){const{width:t,height:r}=tp(e);return{width:t,height:r}}function Qw(e,t,r){const o=qr(t),n=Or(t),a=r==="fixed",s=ho(e,!0,a,t);let i={scrollLeft:0,scrollTop:0};const c=Pr(0);if((o||!a)&&(($o(t)!=="body"||Ia(n))&&(i=Ma(t)),o)){const h=ho(t,!0,a,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}!o&&n&&(c.x=Oa(n));const d=n&&!o&&!a?op(n,i):Pr(0),f=s.left+i.scrollLeft-c.x-d.x,u=s.top+i.scrollTop-c.y-d.y;return{x:f,y:u,width:s.width,height:s.height}}function mi(e){return gr(e).position==="static"}function ap(e,t){if(!qr(e)||gr(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Or(e)===r&&(r=r.ownerDocument.body),r}function sp(e,t){const r=$t(e);if(Pa(e))return r;if(!qr(e)){let n=fo(e);for(;n&&!mn(n);){if(mr(n)&&!mi(n))return n;n=fo(n)}return r}let o=ap(e,t);for(;o&&Mw(o)&&mi(o);)o=ap(o,t);return o&&mn(o)&&mi(o)&&!ui(o)?r:o||Fw(e)||r}const Kw=async function(e){const t=this.getOffsetParent||sp,r=this.getDimensions,o=await r(e.floating);return{reference:Qw(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Xw(e){return gr(e).direction==="rtl"}const Jw={convertOffsetParentRelativeRectToViewportRelativeRect:Vw,getDocumentElement:Or,getClippingRect:Yw,getOffsetParent:sp,getElementRects:Kw,getClientRects:zw,getDimensions:qw,getScale:Go,isElement:mr,isRTL:Xw};function lp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Zw(e,t,r){let o=null,n;const a=Or(e);function s(){var f;clearTimeout(n),(f=o)==null||f.disconnect(),o=null}function i(f,u){f===void 0&&(f=!1),u===void 0&&(u=1),s();const h=e.getBoundingClientRect(),{left:m,top:g,width:y,height:b}=h;if(f||t(),!y||!b)return;const C=_a(g),w=_a(a.clientWidth-(m+y)),x=_a(a.clientHeight-(g+b)),S=_a(m),E={rootMargin:-C+"px "+-w+"px "+-x+"px "+-S+"px",threshold:Ir(0,jr(1,u))||1};let M=!0;function k(T){const A=T[0].intersectionRatio;if(!lp(h,e.getBoundingClientRect()))return i();if(A!==u){if(!M)return i();A?i(!1,A):n=setTimeout(()=>{i(!1,1e-7)},1e3)}M=!1}try{o=new IntersectionObserver(k,{...E,root:a.ownerDocument})}catch{o=new IntersectionObserver(k,E)}o.observe(e)}const c=$t(e),d=()=>i(r);return c.addEventListener("resize",d),i(!0),()=>{c.removeEventListener("resize",d),s()}}function Rw(e,t,r,o){o===void 0&&(o={});const{ancestorScroll:n=!0,ancestorResize:a=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,d=hi(e),f=n||a?[...d?gn(d):[],...t?gn(t):[]]:[];f.forEach(C=>{n&&C.addEventListener("scroll",r),a&&C.addEventListener("resize",r)});const u=d&&i?Zw(d,r,a):null;let h=-1,m=null;s&&(m=new ResizeObserver(C=>{let[w]=C;w&&w.target===d&&m&&t&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var x;(x=m)==null||x.observe(t)})),r()}),d&&!c&&m.observe(d),t&&m.observe(t));let g,y=c?ho(e):null;c&&b();function b(){const C=ho(e);y&&!lp(y,C)&&r(),y=C,g=requestAnimationFrame(b)}return r(),()=>{var C;f.forEach(w=>{n&&w.removeEventListener("scroll",r),a&&w.removeEventListener("resize",r)}),u==null||u(),(C=m)==null||C.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const e0=Aw,t0=Tw,r0=kw,o0=Pw,n0=_w,ip=Ew,a0=Iw,s0=(e,t,r)=>{const o=new Map,n=r??{},a={...Jw,...n.platform,_c:o};return Nw(e,t,{...n,platform:a})};var l0=typeof document<"u",i0=function(){},La=l0?D.useLayoutEffect:i0;function Fa(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(!Fa(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)&&!Fa(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function cp(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function dp(e,t){const r=cp(e);return Math.round(t*r)/r}function gi(e){const t=v.useRef(e);return La(()=>{t.current=e}),t}function c0(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:o=[],platform:n,elements:{reference:a,floating:s}={},transform:i=!0,whileElementsMounted:c,open:d}=e,[f,u]=v.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,m]=v.useState(o);Fa(h,o)||m(o);const[g,y]=v.useState(null),[b,C]=v.useState(null),w=v.useCallback(ee=>{ee!==E.current&&(E.current=ee,y(ee))},[]),x=v.useCallback(ee=>{ee!==M.current&&(M.current=ee,C(ee))},[]),S=a||g,N=s||b,E=v.useRef(null),M=v.useRef(null),k=v.useRef(f),T=c!=null,A=gi(c),L=gi(n),O=gi(d),F=v.useCallback(()=>{if(!E.current||!M.current)return;const ee={placement:t,strategy:r,middleware:h};L.current&&(ee.platform=L.current),s0(E.current,M.current,ee).then(G=>{const z={...G,isPositioned:O.current!==!1};V.current&&!Fa(k.current,z)&&(k.current=z,sn.flushSync(()=>{u(z)}))})},[h,t,r,L,O]);La(()=>{d===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,u(ee=>({...ee,isPositioned:!1})))},[d]);const V=v.useRef(!1);La(()=>(V.current=!0,()=>{V.current=!1}),[]),La(()=>{if(S&&(E.current=S),N&&(M.current=N),S&&N){if(A.current)return A.current(S,N,F);F()}},[S,N,F,A,T]);const re=v.useMemo(()=>({reference:E,floating:M,setReference:w,setFloating:x}),[w,x]),K=v.useMemo(()=>({reference:S,floating:N}),[S,N]),H=v.useMemo(()=>{const ee={position:r,left:0,top:0};if(!K.floating)return ee;const G=dp(K.floating,f.x),z=dp(K.floating,f.y);return i?{...ee,transform:"translate("+G+"px, "+z+"px)",...cp(K.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:G,top:z}},[r,i,K.floating,f.x,f.y]);return v.useMemo(()=>({...f,update:F,refs:re,elements:K,floatingStyles:H}),[f,F,re,K,H])}const d0=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?ip({element:o.current,padding:n}).fn(r):{}:o?ip({element:o,padding:n}).fn(r):{}}}},u0=(e,t)=>{const r=e0(e);return{name:r.name,fn:r.fn,options:[e,t]}},p0=(e,t)=>{const r=t0(e);return{name:r.name,fn:r.fn,options:[e,t]}},f0=(e,t)=>({fn:a0(e).fn,options:[e,t]}),h0=(e,t)=>{const r=r0(e);return{name:r.name,fn:r.fn,options:[e,t]}},m0=(e,t)=>{const r=o0(e);return{name:r.name,fn:r.fn,options:[e,t]}},g0=(e,t)=>{const r=n0(e);return{name:r.name,fn:r.fn,options:[e,t]}},b0=(e,t)=>{const r=d0(e);return{name:r.name,fn:r.fn,options:[e,t]}};var y0=Object.defineProperty,v0=(e,t)=>y0(e,"name",{value:t,configurable:!0});function bi(e){const[t,r]=v.useState(void 0);return nt(()=>{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 s,i;if("borderBoxSize"in a){const c=a.borderBoxSize,d=Array.isArray(c)?c[0]:c;s=d.inlineSize,i=d.blockSize}else s=e.offsetWidth,i=e.offsetHeight;r({width:s,height:i})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else r(void 0)},[e]),t}v0(bi,"useSize");var x0=Object.defineProperty,Qr=(e,t)=>x0(e,"name",{value:t,configurable:!0}),up="Popper",[pp,$a]=rr(up),[w0,fp]=pp(up),C0=Qr(e=>{const{__scopePopper:t,children:r}=e,[o,n]=v.useState(null),[a,s]=v.useState(void 0);return l.jsx(w0,{scope:t,anchor:o,onAnchorChange:n,placementState:a,setPlacementState:s,children:r})},"Popper"),S0="PopperAnchor",N0=v.forwardRef(Qr(function(t,r){const{__scopePopper:o,virtualRef:n,...a}=t,s=fp(S0,o),i=v.useRef(null),c=s.onAnchorChange,d=v.useCallback(y=>{i.current=y,y&&c(y)},[c]),f=ze(r,d),u=v.useRef(null);v.useEffect(()=>{if(!n)return;const y=u.current;u.current=n.current,y!==u.current&&c(u.current)});const h=s.placementState&&Ga(s.placementState),m=h==null?void 0:h[0],g=h==null?void 0:h[1];return n?null:l.jsx(Ie.div,{"data-radix-popper-side":m,"data-radix-popper-align":g,...a,ref:f})},"PopperAnchor")),hp="PopperContent",[E0,lT]=pp(hp),k0=v.forwardRef(Qr(function(t,r){var te,Ne,be,ue,X,ne,pe;const{__scopePopper:o,side:n="bottom",sideOffset:a=0,align:s="center",alignOffset:i=0,arrowPadding:c=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:u=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:y,...b}=t,C=fp(hp,o),[w,x]=v.useState(null),S=ze(r,x),[N,E]=v.useState(null),M=bi(N),k=(M==null?void 0:M.width)??0,T=(M==null?void 0:M.height)??0,A=n+(s!=="center"?"-"+s:""),L=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(f)?f:[f],F=O.length>0,V={padding:L,boundary:O.filter(mp),altBoundary:F},{refs:re,floatingStyles:K,placement:H,isPositioned:ee,middlewareData:G}=c0({strategy:"fixed",placement:A,whileElementsMounted:Qr((...Se)=>Rw(...Se,{animationFrame:g==="always"}),"whileElementsMounted"),elements:{reference:C.anchor},middleware:[u0({mainAxis:a+T,alignmentAxis:i}),d&&p0({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?f0():void 0,...V}),d&&h0({...V}),m0({...V,apply:Qr(({elements:Se,rects:je,availableWidth:Je,availableHeight:Re})=>{const{width:Ye,height:ye}=je.reference,rt=Se.floating.style;rt.setProperty("--radix-popper-available-width",`${Je}px`),rt.setProperty("--radix-popper-available-height",`${Re}px`),rt.setProperty("--radix-popper-anchor-width",`${Ye}px`),rt.setProperty("--radix-popper-anchor-height",`${ye}px`)},"apply")}),N&&b0({element:N,padding:c}),_0({arrowWidth:k,arrowHeight:T}),m&&g0({strategy:"referenceHidden",...V,boundary:F?V.boundary:void 0})]}),z=C.setPlacementState;nt(()=>(z(H),()=>{z(void 0)}),[H,z]);const[Ce,$]=Ga(H),q=nr(y);nt(()=>{ee&&(q==null||q())},[ee,q]);const xe=(te=G.arrow)==null?void 0:te.x,oe=(Ne=G.arrow)==null?void 0:Ne.y,he=((be=G.arrow)==null?void 0:be.centerOffset)!==0,[Y,ce]=v.useState();return nt(()=>{w&&ce(window.getComputedStyle(w).zIndex)},[w]),l.jsx("div",{ref:re.setFloating,"data-radix-popper-content-wrapper":"",style:{...K,transform:ee?K.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Y,"--radix-popper-transform-origin":[(ue=G.transformOrigin)==null?void 0:ue.x,(X=G.transformOrigin)==null?void 0:X.y].join(" "),...((ne=G.hide)==null?void 0:ne.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:l.jsx(E0,{scope:o,placedSide:Ce,placedAlign:$,onArrowChange:E,arrowX:xe,arrowY:oe,shouldHideArrow:he,children:l.jsx(Ie.div,{"data-side":Ce,"data-align":$,...b,ref:S,style:{...b.style,animation:ee?(pe=b.style)==null?void 0:pe.animation:"none"}})})})},"PopperContent"));function mp(e){return e!==null}Qr(mp,"isNotNull");var _0=Qr(e=>({name:"transformOrigin",options:e,fn(t){var b,C,w;const{placement:r,rects:o,middlewareData:n}=t,s=((b=n.arrow)==null?void 0:b.centerOffset)!==0,i=s?0:e.arrowWidth,c=s?0:e.arrowHeight,[d,f]=Ga(r),u={start:"0%",center:"50%",end:"100%"}[f],h=(((C=n.arrow)==null?void 0:C.x)??0)+i/2,m=(((w=n.arrow)==null?void 0:w.y)??0)+c/2;let g="",y="";return d==="bottom"?(g=s?u:`${h}px`,y=`${-c}px`):d==="top"?(g=s?u:`${h}px`,y=`${o.floating.height+c}px`):d==="right"?(g=`${-c}px`,y=s?u:`${m}px`):d==="left"&&(g=`${o.floating.width+c}px`,y=s?u:`${m}px`),{data:{x:g,y}}}}),"transformOrigin");function Ga(e){const[t,r="center"]=e.split("-");return[t,r]}Qr(Ga,"getSideAndAlignFromPlacement");var gp=C0,bp=N0,yp=k0,D0=Object.defineProperty,A0=(e,t)=>D0(e,"name",{value:t,configurable:!0}),vp=v.forwardRef(A0(function(t,r){var c;const{container:o,...n}=t,[a,s]=v.useState(!1);nt(()=>s(!0),[]);const i=o||a&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return i?sn.createPortal(l.jsx(Ie.div,{...n,ref:r}),i):null},"Portal")),T0=Object.defineProperty,Lr=(e,t)=>T0(e,"name",{value:t,configurable:!0});function xp(e,t){return v.useReducer((r,o)=>t[r][o]??r,e)}Lr(xp,"useStateMachine");var Vo=Lr(e=>{const{present:t,children:r}=e,o=wp(t),n=typeof r=="function"?r({present:o.isPresent}):v.Children.only(r),a=Cp(o.ref,Sp(n));return typeof r=="function"||o.isPresent?v.cloneElement(n,{ref:a}):null},"Presence");function wp(e){const[t,r]=v.useState(),o=v.useRef(null),n=v.useRef(e),a=v.useRef("none"),s=v.useRef(void 0),i=e?"mounted":"unmounted",[c,d]=xp(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return v.useEffect(()=>{c==="mounted"?(a.current=s.current??zo(o.current),s.current=void 0):a.current="none"},[c]),nt(()=>{const f=o.current,u=n.current;if(u!==e){const m=a.current,g=zo(f);e?(s.current=g,d("MOUNT")):g==="none"||(f==null?void 0:f.display)==="none"?d("UNMOUNT"):d(u&&m!==g?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,d]),nt(()=>{if(t){let f;const u=t.ownerDocument.defaultView??window,h=Lr(g=>{const b=zo(o.current).includes(CSS.escape(g.animationName));if(g.target===t&&b&&(d("ANIMATION_END"),!n.current)){const C=t.style.animationFillMode;t.style.animationFillMode="forwards",f=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=C)})}},"handleAnimationEnd"),m=Lr(g=>{g.target===t&&(a.current=zo(o.current))},"handleAnimationStart");return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{u.clearTimeout(f),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:v.useCallback(f=>{if(f){const u=getComputedStyle(f);o.current=u,s.current=zo(u)}else o.current=null;r(f)},[])}}Lr(wp,"usePresence");function yi(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}Lr(yi,"setRef");function Cp(...e){const t=v.useRef(e);return t.current=e,v.useCallback(r=>{const o=t.current;let n=!1;const a=o.map(s=>{const i=yi(s,r);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<a.length;s++){const i=a[s];typeof i=="function"?i():yi(o[s],null)}}},[])}Lr(Cp,"useStableComposedRefs");function zo(e){return(e==null?void 0:e.animationName)||"none"}Lr(zo,"getAnimationName");function Sp(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)}Lr(Sp,"getElementRef");var I0=Object.defineProperty,P0=(e,t)=>I0(e,"name",{value:t,configurable:!0}),Np=v[" useEffectEvent ".trim().toString()],Ep=v[" useInsertionEffect ".trim().toString()];function kp(e){if(typeof Np=="function")return Np(e);const t=v.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof Ep=="function"?Ep(()=>{t.current=e}):nt(()=>{t.current=e}),v.useMemo(()=>((...r)=>{var o;return(o=t.current)==null?void 0:o.call(t,...r)}),[])}P0(kp,"useEffectEvent");var M0=Object.defineProperty,bn=(e,t)=>M0(e,"name",{value:t,configurable:!0}),O0=v[" useInsertionEffect ".trim().toString()]||nt;function br({prop:e,defaultProp:t,onChange:r=bn(()=>{},"onChange"),caller:o}){const[n,a,s]=_p({defaultProp:t,onChange:r}),i=e!==void 0,c=i?e:n,d=v.useCallback(f=>{var u;if(i){const h=Dp(f)?f(e):f;h!==e&&((u=s.current)==null||u.call(s,h))}else a(f)},[i,e,a,s]);return[c,d]}bn(br,"useControllableState");function _p({defaultProp:e,onChange:t}){const[r,o]=v.useState(e),n=v.useRef(r),a=v.useRef(t);return O0(()=>{a.current=t},[t]),v.useEffect(()=>{var s;n.current!==r&&((s=a.current)==null||s.call(a,r),n.current=r)},[r,n]),[r,o,a]}bn(_p,"useUncontrolledState");function Dp(e){return typeof e=="function"}bn(Dp,"isFunction");var Ap=Symbol("RADIX:SYNC_STATE");function L0(e,t,r,o){const{prop:n,defaultProp:a,onChange:s,caller:i}=t,c=n!==void 0,d=kp(s),f=[{...r,state:a}];o&&f.push(o);const[u,h]=v.useReducer((b,C)=>{if(C.type===Ap)return{...b,state:C.state};const w=e(b,C);return c&&!Object.is(w.state,b.state)&&d(w.state),w},...f),m=u.state,g=v.useRef(m);v.useEffect(()=>{g.current!==m&&(g.current=m,c||d(m))},[m,g,c]);const y=v.useMemo(()=>n!==void 0?{...u,state:n}:u,[u,n]);return v.useEffect(()=>{c&&!Object.is(n,u.state)&&h({type:Ap,state:n})},[n,u.state,c]),[y,h]}bn(L0,"useControllableStateReducer");var F0=Object.defineProperty,$0=(e,t)=>F0(e,"name",{value:t,configurable:!0});function Tp(e){const t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}$0(Tp,"usePrevious");var G0=Object.defineProperty,V0=(e,t)=>G0(e,"name",{value:t,configurable:!0}),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"}),z0=v.forwardRef(V0(function(t,r){return l.jsx(Ie.span,{...t,ref:r,style:{...Ip,...t.style}})},"VisuallyHidden")),B0=z0,U0=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Bo=new WeakMap,Va=new WeakMap,za={},vi=0,Pp=function(e){return e&&(e.host||Pp(e.parentNode))},W0=function(e,t){return t.map(function(r){if(e.contains(r))return r;var o=Pp(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})},H0=function(e,t,r,o){var n=W0(t,Array.isArray(e)?e:[e]);za[r]||(za[r]=new WeakMap);var a=za[r],s=[],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),g=m!==null&&m!=="false",y=(Bo.get(h)||0)+1,b=(a.get(h)||0)+1;Bo.set(h,y),a.set(h,b),s.push(h),y===1&&g&&Va.set(h,!0),b===1&&h.setAttribute(r,"true"),g||h.setAttribute(o,"true")}catch(C){console.error("aria-hidden: cannot operate on ",h,C)}})};return f(t),i.clear(),vi++,function(){s.forEach(function(u){var h=Bo.get(u)-1,m=a.get(u)-1;Bo.set(u,h),a.set(u,m),h||(Va.has(u)||u.removeAttribute(o),Va.delete(u)),m||u.removeAttribute(r)}),vi--,vi||(Bo=new WeakMap,Bo=new WeakMap,Va=new WeakMap,za={})}},j0=function(e,t,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),n=U0(e);return n?(o.push.apply(o,Array.from(n.querySelectorAll("[aria-live], script"))),H0(o,n,r,"aria-hidden")):function(){return null}},yr=function(){return yr=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},yr.apply(this,arguments)};function Mp(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 Y0(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 Ba="right-scroll-bar-position",Ua="width-before-scroll-bar",q0="with-scroll-bars-hidden",Q0="--removed-body-scroll-bar-size";function xi(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function K0(e,t){var r=D.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 X0=typeof window<"u"?v.useLayoutEffect:v.useEffect,Op=new WeakMap;function J0(e,t){var r=K0(null,function(o){return e.forEach(function(n){return xi(n,o)})});return X0(function(){var o=Op.get(r);if(o){var n=new Set(o),a=new Set(e),s=r.current;n.forEach(function(i){a.has(i)||xi(i,null)}),a.forEach(function(i){n.has(i)||xi(i,s)})}Op.set(r,e)},[e]),r}function Z0(e){return e}function R0(e,t){t===void 0&&(t=Z0);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 s=t(a,o);return r.push(s),function(){r=r.filter(function(i){return i!==s})}},assignSyncMedium:function(a){for(o=!0;r.length;){var s=r;r=[],s.forEach(a)}r={push:function(i){return a(i)},filter:function(){return r}}},assignMedium:function(a){o=!0;var s=[];if(r.length){var i=r;r=[],i.forEach(a),s=r}var c=function(){var f=s;s=[],f.forEach(a)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(f){s.push(f),d()},filter:function(f){return s=s.filter(f),r}}}};return n}function eC(e){e===void 0&&(e={});var t=R0(null);return t.options=yr({async:!0,ssr:!1},e),t}var Lp=function(e){var t=e.sideCar,r=Mp(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 v.createElement(o,yr({},r))};Lp.isSideCarExport=!0;function tC(e,t){return e.useMedium(t),Lp}var Fp=eC(),wi=function(){},Wa=v.forwardRef(function(e,t){var r=v.useRef(null),o=v.useState({onScrollCapture:wi,onWheelCapture:wi,onTouchMoveCapture:wi}),n=o[0],a=o[1],s=e.forwardProps,i=e.children,c=e.className,d=e.removeScrollBar,f=e.enabled,u=e.shards,h=e.sideCar,m=e.noRelative,g=e.noIsolation,y=e.inert,b=e.allowPinchZoom,C=e.as,w=C===void 0?"div":C,x=e.gapMode,S=Mp(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=h,E=J0([r,t]),M=yr(yr({},S),n);return v.createElement(v.Fragment,null,f&&v.createElement(N,{sideCar:Fp,removeScrollBar:d,shards:u,noRelative:m,noIsolation:g,inert:y,setCallbacks:a,allowPinchZoom:!!b,lockRef:r,gapMode:x}),s?v.cloneElement(v.Children.only(i),yr(yr({},M),{ref:E})):v.createElement(w,yr({},M,{className:c,ref:E}),i))});Wa.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Wa.classNames={fullWidth:Ua,zeroRight:Ba};var rC=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function oC(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=rC();return t&&e.setAttribute("nonce",t),e}function nC(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function aC(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var sC=function(){var e=0,t=null;return{add:function(r){e==0&&(t=oC())&&(nC(t,r),aC(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},lC=function(){var e=sC();return function(t,r){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},$p=function(){var e=lC(),t=function(r){var o=r.styles,n=r.dynamic;return e(o,n),null};return t},iC={left:0,top:0,right:0,gap:0},Ci=function(e){return parseInt(e||"",10)||0},cC=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[Ci(r),Ci(o),Ci(n)]},dC=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return iC;var t=cC(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])}},uC=$p(),Uo="data-scroll-locked",pC=function(e,t,r,o){var n=e.left,a=e.top,s=e.right,i=e.gap;return r===void 0&&(r="margin"),`
|
|
2
|
+
.`.concat(q0,` {
|
|
3
|
+
overflow: hidden `).concat(o,`;
|
|
4
|
+
padding-right: `).concat(i,"px ").concat(o,`;
|
|
5
|
+
}
|
|
6
|
+
body[`).concat(Uo,`] {
|
|
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(s,`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(Ba,` {
|
|
20
|
+
right: `).concat(i,"px ").concat(o,`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.`).concat(Ua,` {
|
|
24
|
+
margin-right: `).concat(i,"px ").concat(o,`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.`).concat(Ba," .").concat(Ba,` {
|
|
28
|
+
right: 0 `).concat(o,`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.`).concat(Ua," .").concat(Ua,` {
|
|
32
|
+
margin-right: 0 `).concat(o,`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
body[`).concat(Uo,`] {
|
|
36
|
+
`).concat(Q0,": ").concat(i,`px;
|
|
37
|
+
}
|
|
38
|
+
`)},Gp=function(){var e=parseInt(document.body.getAttribute(Uo)||"0",10);return isFinite(e)?e:0},fC=function(){v.useEffect(function(){return document.body.setAttribute(Uo,(Gp()+1).toString()),function(){var e=Gp()-1;e<=0?document.body.removeAttribute(Uo):document.body.setAttribute(Uo,e.toString())}},[])},hC=function(e){var t=e.noRelative,r=e.noImportant,o=e.gapMode,n=o===void 0?"margin":o;fC();var a=v.useMemo(function(){return dC(n)},[n]);return v.createElement(uC,{styles:pC(a,!t,n,r?"":"!important")})},Si=!1;if(typeof window<"u")try{var Ha=Object.defineProperty({},"passive",{get:function(){return Si=!0,!0}});window.addEventListener("test",Ha,Ha),window.removeEventListener("test",Ha,Ha)}catch{Si=!1}var Wo=Si?{passive:!1}:!1,mC=function(e){return e.tagName==="TEXTAREA"},Vp=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!mC(e)&&r[t]==="visible")},gC=function(e){return Vp(e,"overflowY")},bC=function(e){return Vp(e,"overflowX")},zp=function(e,t){var r=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var n=Bp(e,o);if(n){var a=Up(e,o),s=a[1],i=a[2];if(s>i)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},yC=function(e){var t=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[t,r,o]},vC=function(e){var t=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[t,r,o]},Bp=function(e,t){return e==="v"?gC(t):bC(t)},Up=function(e,t){return e==="v"?yC(t):vC(t)},xC=function(e,t){return e==="h"&&t==="rtl"?-1:1},wC=function(e,t,r,o,n){var a=xC(e,window.getComputedStyle(t).direction),s=a*o,i=r.target,c=t.contains(i),d=!1,f=s>0,u=0,h=0;do{if(!i)break;var m=Up(e,i),g=m[0],y=m[1],b=m[2],C=y-b-a*g;(g||C)&&Bp(e,i)&&(u+=C,h+=g);var w=i.parentNode;i=w&&w.nodeType===Node.DOCUMENT_FRAGMENT_NODE?w.host:w}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},ja=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Wp=function(e){return[e.deltaX,e.deltaY]},Hp=function(e){return e&&"current"in e?e.current:e},CC=function(e,t){return e[0]===t[0]&&e[1]===t[1]},SC=function(e){return`
|
|
39
|
+
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
40
|
+
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
41
|
+
`)},NC=0,Ho=[];function EC(e){var t=v.useRef([]),r=v.useRef([0,0]),o=v.useRef(),n=v.useState(NC++)[0],a=v.useState($p)[0],s=v.useRef(e);v.useEffect(function(){s.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var y=Y0([e.lockRef.current],(e.shards||[]).map(Hp),!0).filter(Boolean);return y.forEach(function(b){return b.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),y.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var i=v.useCallback(function(y,b){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!s.current.allowPinchZoom;var C=ja(y),w=r.current,x="deltaX"in y?y.deltaX:w[0]-C[0],S="deltaY"in y?y.deltaY:w[1]-C[1],N,E=y.target,M=Math.abs(x)>Math.abs(S)?"h":"v";if("touches"in y&&M==="h"&&E.type==="range")return!1;var k=window.getSelection(),T=k&&k.anchorNode,A=T?T===E||T.contains(E):!1;if(A)return!1;var L=zp(M,E);if(!L)return!0;if(L?N=M:(N=M==="v"?"h":"v",L=zp(M,E)),!L)return!1;if(!o.current&&"changedTouches"in y&&(x||S)&&(o.current=N),!N)return!0;var O=o.current||N;return wC(O,b,y,O==="h"?x:S)},[]),c=v.useCallback(function(y){var b=y;if(!(!Ho.length||Ho[Ho.length-1]!==a)){var C="deltaY"in b?Wp(b):ja(b),w=t.current.filter(function(N){return N.name===b.type&&(N.target===b.target||b.target===N.shadowParent)&&CC(N.delta,C)})[0];if(w&&w.should){b.cancelable&&b.preventDefault();return}if(!w){var x=(s.current.shards||[]).map(Hp).filter(Boolean).filter(function(N){return N.contains(b.target)}),S=x.length>0?i(b,x[0]):!s.current.noIsolation;S&&b.cancelable&&b.preventDefault()}}},[]),d=v.useCallback(function(y,b,C,w){var x={name:y,delta:b,target:C,should:w,shadowParent:kC(C)};t.current.push(x),setTimeout(function(){t.current=t.current.filter(function(S){return S!==x})},1)},[]),f=v.useCallback(function(y){r.current=ja(y),o.current=void 0},[]),u=v.useCallback(function(y){d(y.type,Wp(y),y.target,i(y,e.lockRef.current))},[]),h=v.useCallback(function(y){d(y.type,ja(y),y.target,i(y,e.lockRef.current))},[]);v.useEffect(function(){return Ho.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Wo),document.addEventListener("touchmove",c,Wo),document.addEventListener("touchstart",f,Wo),function(){Ho=Ho.filter(function(y){return y!==a}),document.removeEventListener("wheel",c,Wo),document.removeEventListener("touchmove",c,Wo),document.removeEventListener("touchstart",f,Wo)}},[]);var m=e.removeScrollBar,g=e.inert;return v.createElement(v.Fragment,null,g?v.createElement(a,{styles:SC(n)}):null,m?v.createElement(hC,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function kC(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const _C=tC(Fp,EC);var jp=v.forwardRef(function(e,t){return v.createElement(Wa,yr({},e,{ref:t,sideCar:_C}))});jp.classNames=Wa.classNames;var DC=Object.defineProperty,Ae=(e,t)=>DC(e,"name",{value:t,configurable:!0}),AC=[" ","Enter","ArrowUp","ArrowDown"],TC=[" ","Enter"],jo="Select",[Ya,qa,IC]=Sa(jo),[mo,iT]=rr(jo,[IC,$a]),Ni=$a(),[PC,Kr]=mo(jo),[MC,OC]=mo(jo);function Yp(e){const{__scopeSelect:t,children:r,open:o,defaultOpen:n,onOpenChange:a,value:s,defaultValue:i,onValueChange:c,dir:d,name:f,autoComplete:u,disabled:h,required:m,form:g,internal_do_not_use_render:y}=e,b=Ni(t),[C,w]=v.useState(null),[x,S]=v.useState(null),[N,E]=v.useState(!1),M=hn(d),[k,T]=br({prop:o,defaultProp:n??!1,onChange:a,caller:jo}),[A,L]=br({prop:s,defaultProp:i,onChange:c,caller:jo}),O=v.useRef(null),F=v.useRef(A);v.useEffect(()=>{const $=g?C==null?void 0:C.ownerDocument.getElementById(g):C==null?void 0:C.form;if($ instanceof HTMLFormElement){const q=Ae(()=>L(F.current),"reset");return $.addEventListener("reset",q),()=>$.removeEventListener("reset",q)}},[g,C,L]);const V=C?!!g||!!C.closest("form"):!0,[re,K]=v.useState(new Set),H=Hr(),ee=Array.from(re).map($=>$.props.value).join(";"),G=v.useCallback($=>{K(q=>new Set(q).add($))},[]),z=v.useCallback($=>{K(q=>{const xe=new Set(q);return xe.delete($),xe})},[]),Ce={required:m,trigger:C,onTriggerChange:w,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:N,onValueNodeHasChildrenChange:E,contentId:H,value:A,onValueChange:L,open:k,onOpenChange:T,dir:M,triggerPointerDownPosRef:O,disabled:h,name:f,autoComplete:u,form:g,nativeOptions:re,nativeSelectKey:ee,isFormControl:V};return l.jsx(gp,{...b,children:l.jsx(PC,{scope:t,...Ce,children:l.jsx(Ya.Provider,{scope:t,children:l.jsx(MC,{scope:t,onNativeOptionAdd:G,onNativeOptionRemove:z,children:lf(y)?y(Ce):r})})})})}Ae(Yp,"SelectProvider");var LC=Ae(e=>{const{__scopeSelect:t,children:r,...o}=e;return l.jsx(Yp,{__scopeSelect:t,...o,internal_do_not_use_render:({isFormControl:n})=>l.jsxs(l.Fragment,{children:[r,n?l.jsx(nS,{__scopeSelect:t}):null]})})},"Select"),FC="SelectTrigger",qp=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,disabled:n=!1,...a}=t,s=Ni(o),i=Kr(FC,o),c=i.disabled||n,d=ze(r,i.onTriggerChange),f=qa(o),u=v.useRef("touch"),[h,m,g]=_i(b=>{const C=f().filter(S=>!S.disabled),w=C.find(S=>S.value===i.value),x=Di(C,b,w);x!==void 0&&i.onValueChange(x.value)}),y=Ae(b=>{c||(i.onOpenChange(!0),g()),b&&(i.triggerPointerDownPosRef.current={x:Math.round(b.pageX),y:Math.round(b.pageY)})},"handleOpen");return l.jsx(bp,{asChild:!0,...s,children:l.jsx(Ie.button,{type:"button",role:"combobox","aria-controls":i.open?i.contentId:void 0,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":yn(i.value)?"":void 0,...a,ref:d,onClick:we(a.onClick,b=>{b.currentTarget.focus(),u.current!=="mouse"&&y(b)}),onPointerDown:we(a.onPointerDown,b=>{u.current=b.pointerType;const C=b.target;C.hasPointerCapture(b.pointerId)&&C.releasePointerCapture(b.pointerId),b.button===0&&b.ctrlKey===!1&&b.pointerType==="mouse"&&(y(b),b.preventDefault())}),onKeyDown:we(a.onKeyDown,b=>{const C=h.current!=="";!(b.ctrlKey||b.altKey||b.metaKey)&&b.key.length===1&&m(b.key),!(C&&b.key===" ")&&AC.includes(b.key)&&(y(),b.preventDefault())})})})},"SelectTrigger")),$C="SelectValue",GC=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,className:n,style:a,children:s,placeholder:i="",...c}=t,d=Kr($C,o),{onValueNodeHasChildrenChange:f}=d,u=s!==void 0,h=ze(r,d.onValueNodeChange);nt(()=>{f(u)},[f,u]);const m=yn(d.value);return l.jsx(Ie.span,{...c,asChild:m?!1:c.asChild,ref:h,style:{pointerEvents:"none"},children:l.jsx(v.Fragment,{children:m?i:s},m?"placeholder":"value")})},"SelectValue")),VC=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,children:n,...a}=t;return l.jsx(Ie.span,{"aria-hidden":!0,...a,ref:r,children:n||"▼"})},"SelectIcon")),zC="SelectPortal",[BC,UC]=mo(zC,{forceMount:void 0}),WC=Ae(e=>{const{__scopeSelect:t,forceMount:r,...o}=e;return l.jsx(BC,{scope:e.__scopeSelect,forceMount:r,children:l.jsx(vp,{asChild:!0,...o})})},"SelectPortal"),go="SelectContent",Qp=v.forwardRef(Ae(function(t,r){const o=UC(go,t.__scopeSelect),{forceMount:n=o.forceMount,...a}=t,s=Kr(go,t.__scopeSelect),[i,c]=v.useState();return nt(()=>{c(new DocumentFragment)},[]),l.jsx(Vo,{present:n||s.open,children:({present:d})=>d?l.jsx(YC,{...a,ref:r}):l.jsx(HC,{...a,fragment:i})})},"SelectContent")),HC=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,children:n,fragment:a}=t;return a?sn.createPortal(l.jsx(Kp,{scope:o,children:l.jsx(Ya.Slot,{scope:o,children:l.jsx("div",{ref:r,children:n})})}),a):null},"SelectContentFragment")),ar=10,[Kp,bo]=mo(go),jC=Wr("SelectContent.RemoveScroll"),YC=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o}=t,{position:n="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:i,side:c,sideOffset:d,align:f,alignOffset:u,arrowPadding:h,collisionBoundary:m,collisionPadding:g,sticky:y,hideWhenDetached:b,avoidCollisions:C,...w}=t,x=Kr(go,o),[S,N]=v.useState(null),[E,M]=v.useState(null),k=ze(r,N),[T,A]=v.useState(null),[L,O]=v.useState(null),F=qa(o),[V,re]=v.useState(!1),K=v.useRef(!1);v.useEffect(()=>{if(S)return j0(S)},[S]),Rl();const H=v.useCallback(ce=>{const[te,...Ne]=F().map(X=>X.ref.current),[be]=Ne.slice(-1),ue=document.activeElement;for(const X of ce)if(X===ue||(X==null||X.scrollIntoView({block:"nearest"}),X===te&&E&&(E.scrollTop=0),X===be&&E&&(E.scrollTop=E.scrollHeight),X==null||X.focus(),document.activeElement!==ue))return},[F,E]),ee=v.useCallback(()=>H([T,S]),[H,T,S]);v.useEffect(()=>{V&&ee()},[V,ee]);const{onOpenChange:G,triggerPointerDownPosRef:z}=x;v.useEffect(()=>{if(S){let ce={x:0,y:0};const te=Ae(be=>{var ue,X;ce={x:Math.abs(Math.round(be.pageX)-(((ue=z.current)==null?void 0:ue.x)??0)),y:Math.abs(Math.round(be.pageY)-(((X=z.current)==null?void 0:X.y)??0))}},"handlePointerMove"),Ne=Ae(be=>{ce.x<=10&&ce.y<=10?be.preventDefault():be.composedPath().includes(S)||G(!1),document.removeEventListener("pointermove",te),z.current=null},"handlePointerUp");return z.current!==null&&(document.addEventListener("pointermove",te),document.addEventListener("pointerup",Ne,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",te),document.removeEventListener("pointerup",Ne,{capture:!0})}}},[S,G,z]),v.useEffect(()=>{const ce=Ae(()=>G(!1),"close");return window.addEventListener("blur",ce),window.addEventListener("resize",ce),()=>{window.removeEventListener("blur",ce),window.removeEventListener("resize",ce)}},[G]);const[Ce,$]=_i(ce=>{const te=F().filter(ue=>!ue.disabled),Ne=te.find(ue=>ue.ref.current===document.activeElement),be=Di(te,ce,Ne);be&&setTimeout(()=>{var ue;return(ue=be.ref.current)==null?void 0:ue.focus()})}),q=v.useCallback((ce,te,Ne)=>{const be=!K.current&&!Ne;(x.value!==void 0&&x.value===te||be)&&(A(ce),be&&(K.current=!0))},[x.value]),xe=v.useCallback(()=>S==null?void 0:S.focus(),[S]),oe=v.useCallback((ce,te,Ne)=>{const be=!K.current&&!Ne;(x.value!==void 0&&x.value===te||be)&&O(ce)},[x.value]),he=n==="popper"?Xp:qC,Y=he===Xp?{side:c,sideOffset:d,align:f,alignOffset:u,arrowPadding:h,collisionBoundary:m,collisionPadding:g,sticky:y,hideWhenDetached:b,avoidCollisions:C}:{};return l.jsx(Kp,{scope:o,content:S,viewport:E,onViewportChange:M,itemRefCallback:q,selectedItem:T,onItemLeave:xe,itemTextRefCallback:oe,focusSelectedItem:ee,selectedItemText:L,position:n,isPositioned:V,searchRef:Ce,children:l.jsx(jp,{as:jC,allowPinchZoom:!0,children:l.jsx(iw,{asChild:!0,trapped:x.open,onMountAutoFocus:ce=>{ce.preventDefault()},onUnmountAutoFocus:we(a,ce=>{var te;(te=x.trigger)==null||te.focus({preventScroll:!0}),ce.preventDefault()}),children:l.jsx(Mu,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:ce=>ce.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:l.jsx(he,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:ce=>ce.preventDefault(),...w,...Y,onPlaced:()=>re(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:we(w.onKeyDown,ce=>{const te=ce.ctrlKey||ce.altKey||ce.metaKey;if(ce.key==="Tab"&&ce.preventDefault(),!te&&ce.key.length===1&&$(ce.key),["ArrowUp","ArrowDown","Home","End"].includes(ce.key)){let be=F().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);if(["ArrowUp","End"].includes(ce.key)&&(be=be.slice().reverse()),["ArrowUp","ArrowDown"].includes(ce.key)){const ue=ce.target,X=be.indexOf(ue);be=be.slice(X+1)}setTimeout(()=>H(be)),ce.preventDefault()}})})})})})})},"SelectContentImpl")),qC=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,onPlaced:n,...a}=t,s=Kr(go,o),i=bo(go,o),[c,d]=v.useState(null),[f,u]=v.useState(null),h=ze(r,u),m=qa(o),g=v.useRef(!1),y=v.useRef(!0),{viewport:b,selectedItem:C,selectedItemText:w,focusSelectedItem:x}=i,S=v.useCallback(()=>{if(s.trigger&&s.valueNode&&c&&f&&b&&C&&w){const k=s.trigger.getBoundingClientRect(),T=f.getBoundingClientRect(),A=s.valueNode.getBoundingClientRect(),L=w.getBoundingClientRect();if(s.dir!=="rtl"){const ue=L.left-T.left,X=A.left-ue,ne=k.left-X,pe=k.width+ne,Se=Math.max(pe,T.width),je=window.innerWidth-ar,Je=Bl(X,[ar,Math.max(ar,je-Se)]);c.style.minWidth=pe+"px",c.style.left=Je+"px"}else{const ue=T.right-L.right,X=window.innerWidth-A.right-ue,ne=window.innerWidth-k.right-X,pe=k.width+ne,Se=Math.max(pe,T.width),je=window.innerWidth-ar,Je=Bl(X,[ar,Math.max(ar,je-Se)]);c.style.minWidth=pe+"px",c.style.right=Je+"px"}const O=m(),F=window.innerHeight-ar*2,V=b.scrollHeight,re=window.getComputedStyle(f),K=parseInt(re.borderTopWidth,10),H=parseInt(re.paddingTop,10),ee=parseInt(re.borderBottomWidth,10),G=parseInt(re.paddingBottom,10),z=K+H+V+G+ee,Ce=Math.min(C.offsetHeight*5,z),$=window.getComputedStyle(b),q=parseInt($.paddingTop,10),xe=parseInt($.paddingBottom,10),oe=k.top+k.height/2-ar,he=F-oe,Y=C.offsetHeight/2,ce=C.offsetTop+Y,te=K+H+ce,Ne=z-te;if(te<=oe){const ue=O.length>0&&C===O[O.length-1].ref.current;c.style.bottom="0px";const X=f.clientHeight-b.offsetTop-b.offsetHeight,ne=Math.max(he,Y+(ue?xe:0)+X+ee),pe=te+ne;c.style.height=pe+"px"}else{const ue=O.length>0&&C===O[0].ref.current;c.style.top="0px";const ne=Math.max(oe,K+b.offsetTop+(ue?q:0)+Y)+Ne;c.style.height=ne+"px",b.scrollTop=te-oe+b.offsetTop}c.style.margin=`${ar}px 0`,c.style.minHeight=Ce+"px",c.style.maxHeight=F+"px",n==null||n(),requestAnimationFrame(()=>g.current=!0)}},[m,s.trigger,s.valueNode,c,f,b,C,w,s.dir,n]);nt(()=>S(),[S]);const[N,E]=v.useState();nt(()=>{f&&E(window.getComputedStyle(f).zIndex)},[f]);const M=v.useCallback(k=>{k&&y.current===!0&&(S(),x==null||x(),y.current=!1)},[S,x]);return l.jsx(QC,{scope:o,contentWrapper:c,shouldExpandOnScrollRef:g,onScrollButtonChange:M,children:l.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:l.jsx(Ie.div,{...a,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})},"SelectItemAlignedPosition")),Xp=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,align:n="start",collisionPadding:a=ar,...s}=t,i=Ni(o);return l.jsx(yp,{...i,...s,ref:r,align:n,collisionPadding:a,style:{boxSizing:"border-box",...s.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)"}})},"SelectPopperPosition")),[QC,Ei]=mo(go,{}),Jp="SelectViewport",KC=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,nonce:n,...a}=t,s=bo(Jp,o),i=Ei(Jp,o),c=ze(r,s.onViewportChange),d=v.useRef(0);return l.jsxs(l.Fragment,{children:[l.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:n}),l.jsx(Ya.Slot,{scope:o,children:l.jsx(Ie.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:we(a.onScroll,f=>{const u=f.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&h){const g=Math.abs(d.current-u.scrollTop);if(g>0){const y=window.innerHeight-ar*2,b=parseFloat(h.style.minHeight),C=parseFloat(h.style.height),w=Math.max(b,C);if(w<y){const x=w+g,S=Math.min(y,x),N=x-S;h.style.height=S+"px",h.style.bottom==="0px"&&(u.scrollTop=N>0?N:0,h.style.justifyContent="flex-end")}}}d.current=u.scrollTop})})})]})},"SelectViewport")),XC="SelectGroup",[cT,JC]=mo(XC),ZC="SelectLabel",Zp=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,...n}=t,a=JC(ZC,o);return l.jsx(Ie.div,{id:a.id,...n,ref:r})},"SelectLabel")),ki="SelectItem",[RC,Rp]=mo(ki),ef=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,value:n,disabled:a=!1,textValue:s,...i}=t,c=Kr(ki,o),d=bo(ki,o),f=c.value===n,[u,h]=v.useState(s??""),[m,g]=v.useState(!1),y=nr(S=>{var N;return(N=d.itemRefCallback)==null?void 0:N.call(d,S,n,a)}),b=ze(r,y),C=Hr(),w=v.useRef("touch"),x=Ae(()=>{a||(c.onValueChange(n),c.onOpenChange(!1))},"handleSelect");return l.jsx(RC,{scope:o,value:n,disabled:a,textId:C,isSelected:f,onItemTextChange:v.useCallback(S=>{h(N=>N||((S==null?void 0:S.textContent)??"").trim())},[]),children:l.jsx(Ya.ItemSlot,{scope:o,value:n,disabled:a,textValue:u,children:l.jsx(Ie.div,{role:"option","aria-labelledby":C,"data-highlighted":m?"":void 0,"aria-selected":f&&m,"data-state":f?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...i,ref:b,onFocus:we(i.onFocus,()=>g(!0)),onBlur:we(i.onBlur,()=>g(!1)),onClick:we(i.onClick,()=>{w.current!=="mouse"&&x()}),onPointerUp:we(i.onPointerUp,()=>{w.current==="mouse"&&x()}),onPointerDown:we(i.onPointerDown,S=>{w.current=S.pointerType}),onPointerMove:we(i.onPointerMove,S=>{var N;w.current=S.pointerType,a?(N=d.onItemLeave)==null||N.call(d):w.current==="mouse"&&S.currentTarget.focus({preventScroll:!0})}),onPointerLeave:we(i.onPointerLeave,S=>{var N;S.currentTarget===document.activeElement&&((N=d.onItemLeave)==null||N.call(d))}),onKeyDown:we(i.onKeyDown,S=>{var E;a||S.target!==S.currentTarget||((E=d.searchRef)==null?void 0:E.current)!==""&&S.key===" "||(TC.includes(S.key)&&x(),S.key===" "&&S.preventDefault())})})})})},"SelectItem")),Qa="SelectItemText",eS=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,className:n,style:a,...s}=t,i=Kr(Qa,o),c=bo(Qa,o),d=Rp(Qa,o),f=OC(Qa,o),[u,h]=v.useState(null),m=nr(x=>{var S;return(S=c.itemTextRefCallback)==null?void 0:S.call(c,x,d.value,d.disabled)}),g=ze(r,h,d.onItemTextChange,m),y=u==null?void 0:u.textContent,b=v.useMemo(()=>l.jsx("option",{value:d.value,disabled:d.disabled,children:y},d.value),[d.disabled,d.value,y]),{onNativeOptionAdd:C,onNativeOptionRemove:w}=f;return nt(()=>(C(b),()=>w(b)),[C,w,b]),l.jsxs(l.Fragment,{children:[l.jsx(Ie.span,{id:d.textId,...s,ref:g}),d.isSelected&&i.valueNode&&!i.valueNodeHasChildren&&!yn(i.value)?sn.createPortal(s.children,i.valueNode):null]})},"SelectItemText")),tS="SelectItemIndicator",rS=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,...n}=t;return Rp(tS,o).isSelected?l.jsx(Ie.span,{"aria-hidden":!0,...n,ref:r}):null},"SelectItemIndicator")),tf="SelectScrollUpButton",rf=v.forwardRef(Ae(function(t,r){const o=bo(tf,t.__scopeSelect),n=Ei(tf,t.__scopeSelect),[a,s]=v.useState(!1),i=ze(r,n.onScrollButtonChange);return nt(()=>{if(o.viewport&&o.isPositioned){let c=function(){const f=d.scrollTop>0;s(f)};Ae(c,"handleScroll");const d=o.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[o.viewport,o.isPositioned]),a?l.jsx(af,{...t,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=o;c&&d&&(c.scrollTop=c.scrollTop-d.offsetHeight)}}):null},"SelectScrollUpButton")),of="SelectScrollDownButton",nf=v.forwardRef(Ae(function(t,r){const o=bo(of,t.__scopeSelect),n=Ei(of,t.__scopeSelect),[a,s]=v.useState(!1),i=ze(r,n.onScrollButtonChange);return nt(()=>{if(o.viewport&&o.isPositioned){let c=function(){const f=d.scrollHeight-d.clientHeight,u=Math.ceil(d.scrollTop)<f;s(u)};Ae(c,"handleScroll");const d=o.viewport;return c(),d.addEventListener("scroll",c),()=>d.removeEventListener("scroll",c)}},[o.viewport,o.isPositioned]),a?l.jsx(af,{...t,ref:i,onAutoScroll:()=>{const{viewport:c,selectedItem:d}=o;c&&d&&(c.scrollTop=c.scrollTop+d.offsetHeight)}}):null},"SelectScrollDownButton")),af=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,onAutoScroll:n,...a}=t,s=bo("SelectScrollButton",o),i=v.useRef(null),c=qa(o),d=v.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return v.useEffect(()=>()=>d(),[d]),nt(()=>{var u;const f=c().find(h=>h.ref.current===document.activeElement);(u=f==null?void 0:f.ref.current)==null||u.scrollIntoView({block:"nearest"})},[c]),l.jsx(Ie.div,{"aria-hidden":!0,...a,ref:r,style:{flexShrink:0,...a.style},onPointerDown:we(a.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(n,50))}),onPointerMove:we(a.onPointerMove,()=>{var f;(f=s.onItemLeave)==null||f.call(s),i.current===null&&(i.current=window.setInterval(n,50))}),onPointerLeave:we(a.onPointerLeave,()=>{d()})})},"SelectScrollButtonImpl")),sf=v.forwardRef(Ae(function(t,r){const{__scopeSelect:o,...n}=t;return l.jsx(Ie.div,{"aria-hidden":!0,...n,ref:r})},"SelectSeparator")),oS="SelectBubbleInput",nS=v.forwardRef(Ae(function({__scopeSelect:t,...r},o){const n=Kr(oS,t),{value:a,onValueChange:s,required:i,disabled:c,name:d,autoComplete:f,form:u}=n,{nativeOptions:h,nativeSelectKey:m}=n,g=v.useRef(null),y=ze(o,g),b=a??"",C=Tp(b),w=Array.from(h).some(x=>(x.props.value??"")==="");return v.useEffect(()=>{const x=g.current;if(!x)return;const S=window.HTMLSelectElement.prototype,E=Object.getOwnPropertyDescriptor(S,"value").set;if(C!==b&&E){const M=new Event("change",{bubbles:!0});E.call(x,b),x.dispatchEvent(M)}},[C,b]),l.jsxs(Ie.select,{"aria-hidden":!0,required:i,tabIndex:-1,name:d,autoComplete:f,disabled:c,form:u,onChange:x=>s(x.target.value),...r,style:{...Ip,...r.style},ref:y,defaultValue:b,children:[yn(a)&&!w?l.jsx("option",{value:""}):null,Array.from(h)]},m)},"SelectBubbleInput"));function lf(e){return typeof e=="function"}Ae(lf,"isFunction");function yn(e){return e===""||e===void 0}Ae(yn,"shouldShowPlaceholder");function _i(e){const t=nr(e),r=v.useRef(""),o=v.useRef(0),n=v.useCallback(s=>{const i=r.current+s;t(i),Ae((function c(d){r.current=d,window.clearTimeout(o.current),d!==""&&(o.current=window.setTimeout(()=>c(""),1e3))}),"updateSearch")(i)},[t]),a=v.useCallback(()=>{r.current="",window.clearTimeout(o.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(o.current),[]),[r,n,a]}Ae(_i,"useTypeaheadSearch");function Di(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 s=cf(e,Math.max(a,0));n.length===1&&(s=s.filter(d=>d!==r));const c=s.find(d=>d.textValue.toLowerCase().startsWith(n.toLowerCase()));return c!==r?c:void 0}Ae(Di,"findNextItem");function cf(e,t){return e.map((r,o)=>e[(t+o)%e.length])}Ae(cf,"wrapArray");/**
|
|
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 df=(...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 aS=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 sS=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 uf=e=>{const t=sS(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 lS={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 iS=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 cS=D.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:n="",children:a,iconNode:s,...i},c)=>D.createElement("svg",{ref:c,...lS,width:t,height:t,stroke:e,strokeWidth:o?Number(r)*24/Number(t):r,className:df("lucide",n),...!a&&!iS(i)&&{"aria-hidden":"true"},...i},[...s.map(([d,f])=>D.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 yt=(e,t)=>{const r=D.forwardRef(({className:o,...n},a)=>D.createElement(cS,{ref:a,iconNode:t,className:df(`lucide-${aS(uf(e))}`,`lucide-${e}`,o),...n}));return r.displayName=uf(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 dS=yt("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 pf=yt("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 Yo=yt("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 ff=yt("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 uS=yt("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 pS=yt("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 hf=yt("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 fS=yt("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 mf=yt("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 hS=yt("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 Ai=yt("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 mS=yt("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 gS=yt("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 bS=yt("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 Ti=yt("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 yS=yt("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 vS=yt("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 Ka=yt("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Xa=LC,Ja=GC,vn=v.forwardRef(({className:e,children:t,...r},o)=>l.jsxs(qp,{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,l.jsx(VC,{asChild:!0,children:l.jsx(Yo,{className:p("h-4 w-4 opacity-50")})})]}));vn.displayName=qp.displayName;const gf=v.forwardRef(({className:e,...t},r)=>l.jsx(rf,{ref:r,className:p("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(ff,{className:p("h-4 w-4")})}));gf.displayName=rf.displayName;const bf=v.forwardRef(({className:e,...t},r)=>l.jsx(nf,{ref:r,className:p("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(Yo,{className:p("h-4 w-4")})}));bf.displayName=nf.displayName;const xn=v.forwardRef(({className:e,children:t,position:r="popper",...o},n)=>l.jsx(WC,{children:l.jsxs(Qp,{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:[l.jsx(gf,{}),l.jsx(KC,{className:p("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),l.jsx(bf,{})]})}));xn.displayName=Qp.displayName;const xS=v.forwardRef(({className:e,...t},r)=>l.jsx(Zp,{ref:r,className:p("px-2 py-1.5 text-sm font-semibold",e),...t}));xS.displayName=Zp.displayName;const yo=v.forwardRef(({className:e,children:t,...r},o)=>l.jsxs(ef,{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:[l.jsx("span",{className:p("absolute right-2 flex h-3.5 w-3.5 items-center justify-center"),children:l.jsx(rS,{children:l.jsx(pf,{className:p("h-4 w-4")})})}),l.jsx(eS,{children:t})]}));yo.displayName=ef.displayName;const wS=v.forwardRef(({className:e,...t},r)=>l.jsx(sf,{ref:r,className:p("-mx-1 my-1 h-px bg-muted",e),...t}));wS.displayName=sf.displayName;const vo=[{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:"🇱🇹"}],CS=[...vo].sort((e,t)=>e.name.localeCompare(t.name)),wn=e=>vo.find(t=>t.code===e),SS=(e,t="US")=>{const r=wn(t)||vo[0];if(!e)return{countryCode:r.code,dialCode:r.dialCode,number:""};if(e.startsWith("+")){for(const o of vo)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(/^\+/,"")}},NS=({value:e,onChange:t,onBlur:r,defaultCountry:o="US",disabled:n=!1,placeholder:a="Phone number",hasError:s=!1,className:i,inputClassName:c})=>{const d=D.useMemo(()=>{if(!e){const w=wn(o)||vo[0];return{countryCode:w.code,dialCode:w.dialCode,number:""}}return typeof e=="string"?SS(e,o):e},[e,o]),[f,u]=D.useState(d.countryCode),[h,m]=D.useState(d.number),g=D.useRef(null);D.useEffect(()=>{u(d.countryCode),m(d.number)},[d.countryCode,d.number]);const y=D.useMemo(()=>wn(f)||vo[0],[f]),b=w=>{const x=wn(w);if(x){u(w);const S={countryCode:x.code,dialCode:x.dialCode,number:h};t==null||t(S)}},C=w=>{const x=w.target.value.replace(/[^\d\s\-()]/g,"");m(x),t==null||t({countryCode:y.code,dialCode:y.dialCode,number:x})};return l.jsxs("div",{className:p("flex",i),children:[l.jsxs(Xa,{value:f,onValueChange:b,disabled:n,children:[l.jsx(vn,{className:p("w-[110px] rounded-r-none border-r-0 focus:z-10",s&&"border-red-500",n&&"opacity-50 cursor-not-allowed"),children:l.jsx(Ja,{children:l.jsxs("span",{className:p("flex items-center gap-1.5"),children:[l.jsx("span",{className:p("text-base"),children:y.flag}),l.jsx("span",{className:p("text-sm text-muted-foreground"),children:y.dialCode})]})})}),l.jsx(xn,{className:p("max-h-[300px]"),children:CS.map(w=>l.jsx(yo,{value:w.code,className:p("cursor-pointer"),children:l.jsxs("span",{className:p("flex items-center gap-2"),children:[l.jsx("span",{className:p("text-base"),children:w.flag}),l.jsx("span",{className:p("flex-1"),children:w.name}),l.jsx("span",{className:p("text-muted-foreground text-sm"),children:w.dialCode})]})},w.code))})]}),l.jsx("input",{ref:g,type:"tel",value:h,onChange:C,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",s&&"border-red-500 focus:ring-red-500",c)})]})},ES=({defaultCountry:e="US",placeholder:t="Phone number",className:r})=>{const o=wn(e)||vo[0];return l.jsxs("div",{className:p("flex",r),children:[l.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:[l.jsx("span",{className:p("text-base"),children:o.flag}),l.jsx("span",{className:p("text-muted-foreground"),children:o.dialCode}),l.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:l.jsx("path",{d:"m6 9 6 6 6-6"})})]}),l.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")})]})},kS=[{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}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,children:l.jsx(uo,{icon:"✉️",children:l.jsx("input",{type:"email",placeholder:o||"email@example.com",disabled:!0,className:p(`${Ct()} pl-10`)})})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:s,onChange:i,errors:c,isDisabled:d}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,errors:c,children:l.jsx(uo,{icon:"✉️",children:l.jsx("input",{type:"email",placeholder:o||"email@example.com",value:s??"",onChange:f=>i==null?void 0:i(f.target.value),disabled:d,className:p(`${Ot({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:s}=j(e),i=(s==null?void 0:s.defaultCountry)||"US";return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,children:l.jsx(ES,{defaultCountry:i,placeholder:o||"Phone number"})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:s,onChange:i,errors:c,isDisabled:d,config:f}=j(e),u=(f==null?void 0:f.defaultCountry)||"US",h=m=>{i==null||i(m)};return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,errors:c,children:l.jsx(NS,{value:s,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}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,children:l.jsx(uo,{icon:"🔗",children:l.jsx("input",{type:"url",placeholder:o||"https://example.com",disabled:!0,className:p(`${Ct()} pl-10`)})})})},render:e=>{const{label:t,description:r,placeholder:o,required:n,labelPosition:a,value:s,onChange:i,errors:c,isDisabled:d}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,errors:c,children:l.jsx(uo,{icon:"🔗",children:l.jsx("input",{type:"url",placeholder:o||"https://example.com",value:s??"",onChange:f=>i==null?void 0:i(f.target.value),disabled:d,className:p(`${Ot({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:s}=j(e);return l.jsxs(de,{label:t,description:r,required:n,labelPosition:a,children:[l.jsx(uo,{icon:"📍",children:l.jsx("input",{type:"text",placeholder:o||"Enter address...",disabled:!0,className:p(`${Ct()} pl-10`)})}),(s==null?void 0:s.showMap)&&l.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:s,onChange:i,errors:c,isDisabled:d,config:f}=j(e);return l.jsx(de,{label:t,description:r,required:n,labelPosition:a,errors:c,children:l.jsxs("div",{className:p("space-y-2"),children:[l.jsx(uo,{icon:"📍",children:l.jsx("input",{type:"text",placeholder:o||"Enter address...",value:typeof s=="string"?s:(s==null?void 0:s.address)??"",onChange:u=>i==null?void 0:i(u.target.value),disabled:d,className:p(`${Ot({hasError:((c==null?void 0:c.length)??0)>0,disabled:d})} pl-10`)})}),(f==null?void 0:f.enableGeolocation)&&!d&&l.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)&&l.jsx("div",{className:p("h-32 bg-gray-200 rounded-md flex items-center justify-center text-gray-400 text-sm"),children:"🗺️ Map Preview"})]})})}}],_S=[{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}=j(e);return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsx("input",{type:"date",disabled:!0,className:Ct()})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:s,errors:i,isDisabled:c}=j(e);return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsx("input",{type:"date",value:a??"",onChange:d=>s==null?void 0:s(d.target.value),disabled:c,className:Ot({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}=j(e);return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsx("input",{type:"time",disabled:!0,className:Ct()})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:s,errors:i,isDisabled:c}=j(e);return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsx("input",{type:"time",value:a??"",onChange:d=>s==null?void 0:s(d.target.value),disabled:c,className:Ot({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}=j(e);return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsxs("div",{className:p("flex gap-2"),children:[l.jsx("input",{type:"date",disabled:!0,className:`flex-1 ${Ct()}`}),l.jsx("input",{type:"time",disabled:!0,className:`w-32 ${Ct()}`})]})})},render:e=>{var g;const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:s,errors:i,isDisabled:c}=j(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:((g=a==null?void 0:a.split("T")[1])==null?void 0:g.substring(0,5))??"",u=y=>{typeof a=="object"?s==null||s({...a,date:y}):s==null||s(`${y}T${f||"00:00"}`)},h=y=>{typeof a=="object"?s==null||s({...a,time:y}):s==null||s(`${d||""}T${y}`)},m=Ot({hasError:((i==null?void 0:i.length)??0)>0,disabled:c});return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsxs("div",{className:p("flex gap-2"),children:[l.jsx("input",{type:"date",value:d,onChange:y=>u(y.target.value),disabled:c,className:`flex-1 ${m}`}),l.jsx("input",{type:"time",value:f,onChange:y=>h(y.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}=j(e);return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsxs("div",{className:p("space-y-2"),children:[l.jsxs("div",{className:p("flex flex-wrap gap-2"),children:[l.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",l.jsx("button",{disabled:!0,className:p("text-blue-600"),children:"×"})]}),l.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",l.jsx("button",{disabled:!0,className:p("text-blue-600"),children:"×"})]})]}),l.jsx("input",{type:"date",disabled:!0,className:Ct()})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:s,errors:i,isDisabled:c}=j(e),d=Array.isArray(a)?a:[],f=h=>{h&&!d.includes(h)&&(s==null||s([...d,h]))},u=h=>{s==null||s(d.filter(m=>m!==h))};return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsxs("div",{className:p("space-y-2"),children:[d.length>0&&l.jsx("div",{className:p("flex flex-wrap gap-2"),children:d.map((h,m)=>l.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&&l.jsx("button",{type:"button",onClick:()=>u(h),className:p("text-blue-600 hover:text-blue-800"),children:"×"})]},m))}),l.jsx("input",{type:"date",onChange:h=>{f(h.target.value),h.target.value=""},disabled:c,className:Ot({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}=j(e);return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsxs("div",{className:p("flex items-center gap-2"),children:[l.jsx("input",{type:"date",disabled:!0,placeholder:"Start date",className:`flex-1 ${Ct()}`}),l.jsx("span",{className:p("text-gray-400"),children:"→"}),l.jsx("input",{type:"date",disabled:!0,placeholder:"End date",className:`flex-1 ${Ct()}`})]})})},render:e=>{const{label:t,description:r,required:o,labelPosition:n,value:a,onChange:s,errors:i,isDisabled:c}=j(e),d=(a==null?void 0:a.start)??"",f=(a==null?void 0:a.end)??"",u=g=>{s==null||s({start:g,end:f})},h=g=>{s==null||s({start:d,end:g})},m=Ot({hasError:((i==null?void 0:i.length)??0)>0,disabled:c});return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsxs("div",{className:p("flex items-center gap-2"),children:[l.jsx("input",{type:"date",value:d,onChange:g=>u(g.target.value),disabled:c,placeholder:"Start date",className:`flex-1 ${m}`}),l.jsx("span",{className:p("text-gray-400"),children:"→"}),l.jsx("input",{type:"date",value:f,onChange:g=>h(g.target.value),disabled:c,min:d,placeholder:"End date",className:`flex-1 ${m}`})]})})}}],DS=[{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}=j(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 l.jsx("div",{className:p("prose prose-sm max-w-none"),style:{textAlign:(r==null?void 0:r.textAlign)||"left"},children:l.jsx("p",{className:p("text-gray-700",n,a),children:o})})},render:e=>{const{element:t,config:r}=j(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 l.jsx("div",{className:p("prose prose-sm max-w-none"),style:{textAlign:(r==null?void 0:r.textAlign)||"left"},children:l.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}=j(e),o=t.properties.src,n=t.properties.alt||"Image";return o?l.jsx("div",{className:p("space-y-1.5"),children:l.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}})}):l.jsxs("div",{className:p("border-2 border-dashed border-gray-300 rounded-lg p-8 text-center bg-gray-50"),children:[l.jsx("span",{className:p("text-4xl"),children:"🏞️"}),l.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"No image selected"}),l.jsx("p",{className:p("text-xs text-gray-400"),children:"Set image URL in properties"})]})},render:e=>{const{element:t,config:r}=j(e),o=t.properties.src,n=t.properties.alt||"Image";return o?l.jsx("div",{className:p("space-y-1.5"),children:l.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}=j(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"?l.jsxs("div",{className:p("space-y-1"),children:[l.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}),l.jsx("p",{className:p("text-xs text-gray-400"),children:n})]}):l.jsxs("div",{className:p("space-y-1"),children:[l.jsx("a",{href:"#",onClick:a=>a.preventDefault(),className:p("text-blue-600 hover:text-blue-800 underline text-sm"),children:o}),l.jsx("p",{className:p("text-xs text-gray-400"),children:n})]})},render:e=>{const{element:t,config:r}=j(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"?l.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}):l.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})}}],AS=[{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}=j(e);return l.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}=j(e);return l.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}=j(e),r=(t==null?void 0:t.spacerHeight)||24;return l.jsx("div",{className:p("bg-gray-100/50 border border-dashed border-gray-300 rounded flex items-center justify-center"),style:{height:r},children:l.jsxs("span",{className:p("text-xs text-gray-400"),children:["↕️ Spacer (",r,"px)"]})})},render:e=>{const{config:t}=j(e),r=(t==null?void 0:t.spacerHeight)||24;return l.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}=j(e);return l.jsxs("div",{className:p(`text-${(o==null?void 0:o.alignment)||"left"}`),children:[l.jsx("h1",{className:p("text-2xl font-bold text-gray-900"),children:t}),r&&l.jsx("p",{className:p("text-gray-600 mt-1"),children:r})]})},render:e=>{const{label:t,description:r,config:o}=j(e);return l.jsxs("div",{className:p(`text-${(o==null?void 0:o.alignment)||"left"}`),children:[l.jsx("h1",{className:p("text-2xl font-bold text-gray-900"),children:t}),r&&l.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}=j(e);return l.jsxs("div",{className:p(`text-${(o==null?void 0:o.alignment)||"left"}`),children:[l.jsx("h2",{className:p("text-xl font-semibold text-gray-800"),children:t}),r&&l.jsx("p",{className:p("text-gray-500 text-sm mt-1"),children:r})]})},render:e=>{const{label:t,description:r,config:o}=j(e);return l.jsxs("div",{className:p(`text-${(o==null?void 0:o.alignment)||"left"}`),children:[l.jsx("h2",{className:p("text-xl font-semibold text-gray-800"),children:t}),r&&l.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}=j(e);return l.jsxs("div",{className:p(`text-${(o==null?void 0:o.alignment)||"left"}`),children:[l.jsx("h3",{className:p("text-lg font-medium text-gray-700"),children:t}),r&&l.jsx("p",{className:p("text-gray-500 text-sm mt-0.5"),children:r})]})},render:e=>{const{label:t,description:r,config:o}=j(e);return l.jsxs("div",{className:p(`text-${(o==null?void 0:o.alignment)||"left"}`),children:[l.jsx("h3",{className:p("text-lg font-medium text-gray-700"),children:t}),r&&l.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}=j(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",s={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 l.jsxs("button",{type:"button",disabled:!0,className:p("rounded-md font-medium transition-colors",s[n],i[a]),children:[(r==null?void 0:r.showIcon)&&(r==null?void 0:r.iconPosition)==="left"&&l.jsx("span",{className:p("mr-2"),children:"🚀"}),o,(r==null?void 0:r.showIcon)&&(r==null?void 0:r.iconPosition)==="right"&&l.jsx("span",{className:p("ml-2"),children:"🚀"})]})},render:e=>{const{label:t,config:r,isDisabled:o}=j(e),n=(r==null?void 0:r.buttonText)||t||"Submit",a=(r==null?void 0:r.buttonStyle)||"primary",s=(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 l.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[s],o&&"opacity-50 cursor-not-allowed"),children:[(r==null?void 0:r.showIcon)&&(r==null?void 0:r.iconPosition)==="left"&&l.jsx("span",{className:p("mr-2"),children:"🚀"}),n,(r==null?void 0:r.showIcon)&&(r==null?void 0:r.iconPosition)==="right"&&l.jsx("span",{className:p("ml-2"),children:"🚀"})]})}}],TS=[{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}=j(e),s=(a==null?void 0:a.matrixRows)||[],i=(a==null?void 0:a.matrixColumns)||[];return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsx("div",{className:p("overflow-x-auto"),children:l.jsxs("table",{className:p("w-full border-collapse text-sm"),children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{className:p("p-2 text-left")}),i.map(c=>l.jsx("th",{className:p("p-2 text-center font-medium text-gray-700"),children:c.label},c.id))]})}),l.jsx("tbody",{children:s.map(c=>l.jsxs("tr",{className:p("border-t border-gray-200"),children:[l.jsx("td",{className:p("p-2 text-gray-700"),children:c.label}),i.map(d=>l.jsx("td",{className:p("p-2 text-center"),children:l.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:s,errors:i,isDisabled:c,config:d}=j(e),f=(d==null?void 0:d.matrixRows)||[],u=(d==null?void 0:d.matrixColumns)||[],h=a||{},m=(g,y)=>{c||s==null||s({...h,[g]:y})};return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsx("div",{className:p("overflow-x-auto"),children:l.jsxs("table",{className:p("w-full border-collapse text-sm"),children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{className:p("p-2 text-left")}),u.map(g=>l.jsx("th",{className:p("p-2 text-center font-medium text-gray-700"),children:g.label},g.id))]})}),l.jsx("tbody",{children:f.map(g=>l.jsxs("tr",{className:p("border-t border-gray-200"),children:[l.jsx("td",{className:p("p-2 text-gray-700"),children:g.label}),u.map(y=>l.jsx("td",{className:p("p-2 text-center"),children:l.jsx("input",{type:"radio",name:`${e.element.id}-${g.id}`,checked:h[g.id]===y.id,onChange:()=>m(g.id,y.id),disabled:c,className:p("text-blue-600 cursor-pointer disabled:cursor-not-allowed")})},y.id))]},g.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}=j(e),s=(a==null?void 0:a.matrixRows)||[],i=(a==null?void 0:a.matrixColumns)||[];return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsx("div",{className:p("overflow-x-auto"),children:l.jsxs("table",{className:p("w-full border-collapse text-sm"),children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{className:p("p-2 text-left")}),i.map(c=>l.jsx("th",{className:p("p-2 text-center font-medium text-gray-700"),children:c.label},c.id))]})}),l.jsx("tbody",{children:s.map(c=>l.jsxs("tr",{className:p("border-t border-gray-200"),children:[l.jsx("td",{className:p("p-2 text-gray-700"),children:c.label}),i.map(d=>l.jsx("td",{className:p("p-2 text-center"),children:l.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:s,errors:i,isDisabled:c,config:d}=j(e),f=(d==null?void 0:d.matrixRows)||[],u=(d==null?void 0:d.matrixColumns)||[],h=a||{},m=(g,y)=>{if(c)return;const b=h[g]||[],C=b.includes(y)?b.filter(w=>w!==y):[...b,y];s==null||s({...h,[g]:C})};return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsx("div",{className:p("overflow-x-auto"),children:l.jsxs("table",{className:p("w-full border-collapse text-sm"),children:[l.jsx("thead",{children:l.jsxs("tr",{children:[l.jsx("th",{className:p("p-2 text-left")}),u.map(g=>l.jsx("th",{className:p("p-2 text-center font-medium text-gray-700"),children:g.label},g.id))]})}),l.jsx("tbody",{children:f.map(g=>l.jsxs("tr",{className:p("border-t border-gray-200"),children:[l.jsx("td",{className:p("p-2 text-gray-700"),children:g.label}),u.map(y=>l.jsx("td",{className:p("p-2 text-center"),children:l.jsx("input",{type:"checkbox",checked:(h[g.id]||[]).includes(y.id),onChange:()=>m(g.id,y.id),disabled:c,className:p("text-blue-600 rounded cursor-pointer disabled:cursor-not-allowed")})},y.id))]},g.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}=j(e),s=(a==null?void 0:a.matrixRows)||[],i=(a==null?void 0:a.matrixColumns)||[];return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsx("div",{className:p("overflow-x-auto"),children:l.jsxs("table",{className:p("w-full border-collapse text-sm border border-gray-200"),children:[l.jsx("thead",{children:l.jsxs("tr",{className:p("bg-gray-50"),children:[l.jsx("th",{className:p("p-2 text-left border border-gray-200")}),i.map(c=>l.jsx("th",{className:p("p-2 text-center font-medium text-gray-700 border border-gray-200"),children:c.label},c.id))]})}),l.jsx("tbody",{children:s.map(c=>l.jsxs("tr",{children:[l.jsx("td",{className:p("p-2 text-gray-700 border border-gray-200 bg-gray-50"),children:c.label}),i.map(d=>l.jsx("td",{className:p("p-2 border border-gray-200"),children:l.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:s,errors:i,isDisabled:c,config:d}=j(e),f=(d==null?void 0:d.matrixRows)||[],u=(d==null?void 0:d.matrixColumns)||[],h=a||{},m=(g,y,b)=>{const C={...h,[g]:{...h[g]||{},[y]:b}};s==null||s(C)};return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.jsx("div",{className:p("overflow-x-auto"),children:l.jsxs("table",{className:p("w-full border-collapse text-sm border border-gray-200"),children:[l.jsx("thead",{children:l.jsxs("tr",{className:p("bg-gray-50"),children:[l.jsx("th",{className:p("p-2 text-left border border-gray-200")}),u.map(g=>l.jsx("th",{className:p("p-2 text-center font-medium text-gray-700 border border-gray-200"),children:g.label},g.id))]})}),l.jsx("tbody",{children:f.map(g=>l.jsxs("tr",{children:[l.jsx("td",{className:p("p-2 text-gray-700 border border-gray-200 bg-gray-50"),children:g.label}),u.map(y=>{var b;return l.jsx("td",{className:p("p-2 border border-gray-200"),children:l.jsx("input",{type:y.type==="number"?"number":"text",value:((b=h[g.id])==null?void 0:b[y.id])??"",onChange:C=>m(g.id,y.id,y.type==="number"?Number(C.target.value):C.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"}`})},y.id)})]},g.id))})]})})})}}],IS=[{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}=j(e);return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsxs("div",{className:p("border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50"),children:[l.jsx("svg",{className:p("mx-auto h-8 w-8 text-gray-400"),stroke:"currentColor",fill:"none",viewBox:"0 0 48 48",children:l.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"})}),l.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload"}),l.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:s,errors:i,isDisabled:c,config:d}=j(e),f=g=>{var b;const y=(b=g.target.files)==null?void 0:b[0];y&&(s==null||s(y))},u=g=>{var b;g.preventDefault();const y=(b=g.dataTransfer.files)==null?void 0:b[0];y&&(s==null||s(y))},h=g=>{g.preventDefault()},m=a instanceof File?a.name:a==null?void 0:a.name;return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:l.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:[l.jsx("input",{type:"file",accept:d==null?void 0:d.accept,onChange:f,disabled:c,className:p("hidden"),id:`file-upload-${e.element.id}`}),l.jsx("label",{htmlFor:`file-upload-${e.element.id}`,className:c?"cursor-not-allowed":"cursor-pointer",children:m?l.jsxs("div",{className:p("flex items-center justify-center gap-2"),children:[l.jsx("span",{className:p("text-2xl"),children:"📄"}),l.jsx("span",{className:p("text-sm text-gray-700"),children:m}),!c&&l.jsx("button",{type:"button",onClick:g=>{g.preventDefault(),s==null||s(null)},className:p("text-red-500 hover:text-red-700"),children:"×"})]}):l.jsxs(l.Fragment,{children:[l.jsx("svg",{className:p("mx-auto h-8 w-8 text-gray-400"),stroke:"currentColor",fill:"none",viewBox:"0 0 48 48",children:l.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"})}),l.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload"}),l.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}=j(e);return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,children:l.jsxs("div",{className:p("border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50"),children:[l.jsx("span",{className:p("text-4xl"),children:"🖼️"}),l.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload image"}),l.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:s,errors:i,isDisabled:c,config:d}=j(e),[f,u]=D.useState(null);D.useEffect(()=>{if(a instanceof File){const g=new FileReader;g.onloadend=()=>{u(g.result)},g.readAsDataURL(a)}else u(typeof a=="string"?a:null)},[a]);const h=g=>{var b;const y=(b=g.target.files)==null?void 0:b[0];y&&(s==null||s(y))},m=()=>{s==null||s(null),u(null)};return l.jsx(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:f?l.jsxs("div",{className:p("relative inline-block"),children:[l.jsx("img",{src:f,alt:"Preview",className:p("max-w-full max-h-48 rounded-lg border border-gray-200")}),!c&&l.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:"×"})]}):l.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:[l.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}`}),l.jsxs("label",{htmlFor:`image-upload-${e.element.id}`,className:c?"cursor-not-allowed":"cursor-pointer",children:[l.jsx("span",{className:p("text-4xl"),children:"🖼️"}),l.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload image"}),l.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}=j(e);return l.jsxs(de,{label:t,description:r,required:o,labelPosition:n,children:[l.jsxs("div",{className:p("border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50"),children:[l.jsx("span",{className:p("text-4xl"),children:"📁"}),l.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload files"}),l.jsxs("p",{className:p("text-xs text-gray-400"),children:["Up to ",(a==null?void 0:a.maxFiles)||10," files"]})]}),l.jsx("div",{className:p("space-y-2 mt-2"),children:l.jsxs("div",{className:p("flex items-center gap-2 p-2 bg-gray-100 rounded text-sm"),children:[l.jsx("span",{children:"📄"}),l.jsx("span",{className:p("flex-1 truncate"),children:"document.pdf"}),l.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:s,errors:i,isDisabled:c,config:d}=j(e),f=Array.isArray(a)?a:[],u=(d==null?void 0:d.maxFiles)||10,h=g=>{const y=Array.from(g.target.files||[]),b=[...f,...y].slice(0,u);s==null||s(b)},m=g=>{const y=f.filter((b,C)=>C!==g);s==null||s(y)};return l.jsxs(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:[l.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:[l.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}`}),l.jsxs("label",{htmlFor:`multi-file-upload-${e.element.id}`,className:c||f.length>=u?"cursor-not-allowed":"cursor-pointer",children:[l.jsx("span",{className:p("text-4xl"),children:"📁"}),l.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload files"}),l.jsxs("p",{className:p("text-xs text-gray-400"),children:[f.length," / ",u," files"]})]})]}),f.length>0&&l.jsx("div",{className:p("space-y-2 mt-2"),children:f.map((g,y)=>l.jsxs("div",{className:p("flex items-center gap-2 p-2 bg-gray-100 rounded text-sm"),children:[l.jsx("span",{children:"📄"}),l.jsx("span",{className:p("flex-1 truncate"),children:g.name}),l.jsxs("span",{className:p("text-xs text-gray-500"),children:[(g.size/1024).toFixed(1)," KB"]}),!c&&l.jsx("button",{type:"button",onClick:()=>m(y),className:p("text-gray-400 hover:text-red-500"),children:"×"})]},y))})]})}},{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}=j(e);return l.jsxs(de,{label:t,description:r,required:o,labelPosition:n,children:[l.jsxs("div",{className:p("border-2 border-dashed border-gray-300 rounded-lg p-6 text-center bg-gray-50"),children:[l.jsx("span",{className:p("text-4xl"),children:"🖼️"}),l.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload images"}),l.jsxs("p",{className:p("text-xs text-gray-400"),children:["Up to ",(a==null?void 0:a.maxFiles)||10," images"]})]}),l.jsx("div",{className:p("flex gap-2 flex-wrap mt-2"),children:l.jsxs("div",{className:p("w-20 h-20 bg-gray-200 rounded-lg flex items-center justify-center relative"),children:[l.jsx("span",{className:p("text-2xl"),children:"🖼️"}),l.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:s,errors:i,isDisabled:c,config:d}=j(e),[f,u]=D.useState([]),h=Array.isArray(a)?a:[],m=(d==null?void 0:d.maxFiles)||10;D.useEffect(()=>{(async()=>{const C=[];for(const w of h)if(w instanceof File){const x=new FileReader,S=await new Promise(N=>{x.onloadend=()=>N(x.result),x.readAsDataURL(w)});C.push(S)}u(C)})()},[h]);const g=b=>{const C=Array.from(b.target.files||[]),w=[...h,...C].slice(0,m);s==null||s(w)},y=b=>{const C=h.filter((w,x)=>x!==b);s==null||s(C)};return l.jsxs(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:[l.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:[l.jsx("input",{type:"file",accept:(d==null?void 0:d.accept)||"image/*",multiple:!0,onChange:g,disabled:c||h.length>=m,className:p("hidden"),id:`multi-image-upload-${e.element.id}`}),l.jsxs("label",{htmlFor:`multi-image-upload-${e.element.id}`,className:c||h.length>=m?"cursor-not-allowed":"cursor-pointer",children:[l.jsx("span",{className:p("text-4xl"),children:"🖼️"}),l.jsx("p",{className:p("mt-2 text-sm text-gray-500"),children:"Click or drag to upload images"}),l.jsxs("p",{className:p("text-xs text-gray-400"),children:[h.length," / ",m," images"]})]})]}),f.length>0&&l.jsx("div",{className:p("flex gap-2 flex-wrap mt-2"),children:f.map((b,C)=>l.jsxs("div",{className:p("w-20 h-20 rounded-lg overflow-hidden relative border border-gray-200"),children:[l.jsx("img",{src:b,alt:`Preview ${C+1}`,className:p("w-full h-full object-cover")}),!c&&l.jsx("button",{type:"button",onClick:()=>y(C),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:"×"})]},C))})]})}}],PS=[{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:s}=j(e);return l.jsxs(de,{label:t,description:r,required:n,labelPosition:a,children:[l.jsxs("div",{className:p("relative"),children:[l.jsx("input",{type:"password",placeholder:o||"••••••••",disabled:!0,className:`${Ct()} pr-10`}),(s==null?void 0:s.showToggle)&&l.jsx("button",{disabled:!0,className:p("absolute right-3 top-1/2 -translate-y-1/2 text-gray-400"),children:"👁️"})]}),(s==null?void 0:s.showStrengthMeter)&&l.jsxs("div",{className:p("flex gap-1 mt-2"),children:[l.jsx("div",{className:p("h-1 flex-1 bg-gray-300 rounded")}),l.jsx("div",{className:p("h-1 flex-1 bg-gray-300 rounded")}),l.jsx("div",{className:p("h-1 flex-1 bg-gray-300 rounded")}),l.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:s,onChange:i,errors:c,isDisabled:d,config:f}=j(e),[u,h]=D.useState(!1),g=(b=>{if(!b)return 0;let C=0;return b.length>=8&&C++,/[a-z]/.test(b)&&/[A-Z]/.test(b)&&C++,/\d/.test(b)&&C++,/[^a-zA-Z0-9]/.test(b)&&C++,C})(s||""),y=["bg-red-500","bg-orange-500","bg-yellow-500","bg-green-500"];return l.jsxs(de,{label:t,description:r,required:n,labelPosition:a,errors:c,children:[l.jsxs("div",{className:p("relative"),children:[l.jsx("input",{type:u?"text":"password",placeholder:o||"••••••••",value:s??"",onChange:b=>i==null?void 0:i(b.target.value),disabled:d,className:`${Ot({hasError:((c==null?void 0:c.length)??0)>0,disabled:d})} pr-10`}),(f==null?void 0:f.showToggle)&&!d&&l.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)&&s&&l.jsx("div",{className:p("flex gap-1 mt-2"),children:[0,1,2,3].map(b=>l.jsx("div",{className:`h-1 flex-1 rounded ${b<g?y[g-1]:"bg-gray-300"}`},b))})]})}},{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}=j(e);return l.jsxs(de,{label:t,description:r,required:o,labelPosition:n,children:[l.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:l.jsxs("div",{className:p("text-center text-gray-400"),children:[l.jsx("span",{className:p("text-3xl"),children:"✍️"}),l.jsx("p",{className:p("text-sm mt-2"),children:"Draw your signature here"})]})}),l.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:s,errors:i,isDisabled:c,config:d}=j(e),f=D.useRef(null),[u,h]=D.useState(!1),m=C=>{if(c)return;h(!0);const w=f.current;if(!w)return;const x=w.getContext("2d");if(!x)return;const S=w.getBoundingClientRect();x.beginPath(),x.moveTo(C.clientX-S.left,C.clientY-S.top)},g=C=>{if(!u||c)return;const w=f.current;if(!w)return;const x=w.getContext("2d");if(!x)return;const S=w.getBoundingClientRect();x.lineWidth=(d==null?void 0:d.strokeWidth)||2,x.strokeStyle=(d==null?void 0:d.strokeColor)||"#000000",x.lineCap="round",x.lineTo(C.clientX-S.left,C.clientY-S.top),x.stroke()},y=()=>{u&&f.current&&(h(!1),s==null||s(f.current.toDataURL()))},b=()=>{const C=f.current;if(!C)return;const w=C.getContext("2d");w&&(w.fillStyle=(d==null?void 0:d.backgroundColor)||"#ffffff",w.fillRect(0,0,C.width,C.height),s==null||s(""))};return l.jsxs(de,{label:t,description:r,required:o,labelPosition:n,errors:i,children:[l.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:l.jsx("canvas",{ref:f,width:(d==null?void 0:d.canvasWidth)||400,height:(d==null?void 0:d.canvasHeight)||200,onMouseDown:m,onMouseMove:g,onMouseUp:y,onMouseLeave:y,className:c?"cursor-not-allowed":"cursor-crosshair",style:{display:"block",width:"100%"}})}),!c&&l.jsx("button",{type:"button",onClick:b,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}=j(e);return l.jsxs("div",{className:p("space-y-1.5"),children:[t&&l.jsx("p",{className:p("text-xs text-gray-500"),children:t}),l.jsx("div",{className:p("border border-gray-300 rounded-md p-4 bg-gray-50 max-w-[300px]"),children:l.jsxs("div",{className:p("flex items-center gap-3"),children:[l.jsx("div",{className:p("w-7 h-7 border-2 border-gray-300 rounded flex items-center justify-center"),children:"☐"}),l.jsx("span",{className:p("text-sm text-gray-700"),children:"I'm not a robot"}),l.jsx("div",{className:p("ml-auto"),children:l.jsxs("div",{className:p("text-xs text-gray-400 text-center"),children:[l.jsx("div",{className:p("text-lg"),children:"🔄"}),l.jsx("span",{children:"reCAPTCHA"})]})})]})})]})},render:e=>{const{description:t,value:r,onChange:o,errors:n,isDisabled:a,config:s}=j(e),i=r===!0,c=()=>{a||o==null||o(!0)};return l.jsxs("div",{className:p("space-y-1.5"),children:[t&&l.jsx("p",{className:p("text-xs text-gray-500"),children:t}),l.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:l.jsxs("div",{className:p("flex items-center gap-3"),children:[l.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?"✓":""}),l.jsx("span",{className:p("text-sm text-gray-700"),children:i?"Verified!":"I'm not a robot"}),l.jsx("div",{className:p("ml-auto"),children:l.jsxs("div",{className:p("text-xs text-gray-400 text-center"),children:[l.jsx("div",{className:p("text-lg"),children:(s==null?void 0:s.provider)==="hcaptcha"?"🛡️":"🔄"}),l.jsx("span",{children:(s==null?void 0:s.provider)==="hcaptcha"?"hCaptcha":(s==null?void 0:s.provider)==="turnstile"?"Turnstile":"reCAPTCHA"})]})})]})}),n&&n.length>0&&l.jsx("div",{className:p("space-y-1"),children:n.map((d,f)=>l.jsx("p",{className:p("text-xs text-red-500"),children:d},f))})]})}}],MS=[{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}=j(e),n=(o==null?void 0:o.showBorder)??!0,a=(o==null?void 0:o.collapsible)??!1;return l.jsxs("div",{className:p("rounded-lg",n?"border border-gray-200":""),style:{padding:(o==null?void 0:o.padding)||16},children:[l.jsx("div",{className:p("flex items-center justify-between mb-2"),children:l.jsxs("div",{children:[l.jsxs("h3",{className:p("font-medium text-gray-800 flex items-center gap-2"),children:[a&&l.jsx("span",{className:p("text-gray-400 text-sm"),children:"▼"}),t||"Group"]}),r&&l.jsx("p",{className:p("text-sm text-gray-500 mt-0.5"),children:r})]})}),l.jsx("div",{className:p("border-2 border-dashed border-gray-200 rounded-md p-4 min-h-[80px] flex items-center justify-center"),children:l.jsx("span",{className:p("text-sm text-gray-400"),children:"Drop elements here"})})]})},render:e=>{const{label:t,description:r,config:o,element:n}=j(e),{renderChildren:a}=e,s=(o==null?void 0:o.showBorder)??!0,i=(o==null?void 0:o.collapsible)??!1,[c,d]=D.useState((o==null?void 0:o.collapsed)??!1);return l.jsxs("div",{className:`rounded-lg ${s?"border border-gray-200":""}`,style:{padding:(o==null?void 0:o.padding)||16},children:[l.jsx("div",{className:`flex items-center justify-between ${i?"cursor-pointer":""}`,onClick:()=>i&&d(!c),children:l.jsxs("div",{children:[l.jsxs("h3",{className:p("font-medium text-gray-800 flex items-center gap-2"),children:[i&&l.jsx("span",{className:p("text-gray-400 text-sm transition-transform",c?"-rotate-90":""),children:"▼"}),t||"Group"]}),r&&!c&&l.jsx("p",{className:p("text-sm text-gray-500 mt-0.5"),children:r})]})}),!c&&l.jsx("div",{className:p("mt-3"),children:a?a(n.id):l.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}=j(e),o=(r==null?void 0:r.gridColumns)||2,n=(r==null?void 0:r.gridGap)||16;return l.jsxs("div",{className:p("border border-gray-200 rounded-lg p-4"),children:[t&&l.jsx("div",{className:p("mb-3"),children:l.jsx("h3",{className:p("font-medium text-gray-800"),children:t})}),l.jsx("div",{className:p("grid"),style:{gridTemplateColumns:`repeat(${o}, 1fr)`,gap:n},children:Array.from({length:o}).map((a,s)=>l.jsx("div",{className:p("border-2 border-dashed border-gray-200 rounded-md p-4 min-h-[60px] flex items-center justify-center"),children:l.jsxs("span",{className:p("text-xs text-gray-400"),children:["Column ",s+1]})},s))})]})},render:e=>{const{label:t,config:r,element:o}=j(e),{renderChildren:n}=e,a=(r==null?void 0:r.gridColumns)||2,s=(r==null?void 0:r.gridGap)||16;return l.jsxs("div",{children:[t&&l.jsx("div",{className:p("mb-3"),children:l.jsx("h3",{className:p("font-medium text-gray-800"),children:t})}),l.jsx("div",{className:p("grid"),style:{gridTemplateColumns:`repeat(${a}, 1fr)`,gap:s},children:n?n(o.id):l.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}=j(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,s=(o==null?void 0:o.striped)??!0,i=(o==null?void 0:o.bordered)??!0;return l.jsxs("div",{className:p("space-y-2"),children:[t&&l.jsxs("div",{children:[l.jsx("h3",{className:p("font-medium text-gray-800"),children:t}),r&&l.jsx("p",{className:p("text-sm text-gray-500"),children:r})]}),l.jsx("div",{className:`overflow-hidden rounded-lg ${i?"border border-gray-200":""}`,children:l.jsxs("table",{className:p("min-w-full divide-y divide-gray-200"),children:[a&&l.jsx("thead",{className:p("bg-gray-50"),children:l.jsx("tr",{children:n.map(c=>l.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))})}),l.jsx("tbody",{className:`bg-white ${s?"divide-y divide-gray-200":""}`,children:[1,2].map((c,d)=>l.jsx("tr",{className:s&&d%2===1?"bg-gray-50":"",children:n.map(f=>l.jsx("td",{className:`px-4 py-3 text-sm text-gray-500 text-${f.align||"left"}`,children:l.jsx("span",{className:p("text-gray-300"),children:"Sample data"})},f.id))},c))})]})}),l.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=[]}=j(e),a=(o==null?void 0:o.tableColumns)||[],s=(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 l.jsxs("div",{className:p("space-y-2"),children:[t&&l.jsxs("div",{children:[l.jsx("h3",{className:p("font-medium text-gray-800"),children:t}),r&&l.jsx("p",{className:p("text-sm text-gray-500"),children:r})]}),l.jsx("div",{className:`overflow-x-auto rounded-lg ${c?"border border-gray-200":""}`,children:l.jsxs("table",{className:p("min-w-full divide-y divide-gray-200"),children:[s&&l.jsx("thead",{className:p("bg-gray-50"),children:l.jsx("tr",{children:a.map(f=>l.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))})}),l.jsx("tbody",{className:`bg-white ${i?"divide-y divide-gray-200":""}`,children:d.length===0?l.jsx("tr",{children:l.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)=>l.jsx("tr",{className:i&&u%2===1?"bg-gray-50":"",children:a.map(h=>l.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}=j(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,s=(t==null?void 0:t.showStepNumbers)??!0;return l.jsxs("div",{className:p("border border-gray-200 rounded-lg p-4 bg-white"),children:[a&&l.jsxs("div",{className:p("mb-6"),children:[l.jsx("div",{className:p("h-2 bg-gray-200 rounded-full overflow-hidden"),children:l.jsx("div",{className:p("h-full bg-blue-600 transition-all duration-300"),style:{width:`${(n+1)/r.length*100}%`}})}),s&&l.jsx("div",{className:p("flex justify-between mt-3"),children:r.map((d,f)=>{const u=f<n,h=f===n;return l.jsxs("div",{className:p("flex flex-col items-center"),children:[l.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}),l.jsx("span",{className:`text-xs mt-1 ${h?"text-blue-600 font-medium":"text-gray-500"}`,children:d.label})]},d.id)})})]}),l.jsx("div",{className:p("border-2 border-dashed border-gray-200 rounded-lg p-6 min-h-[150px] flex items-center justify-center"),children:l.jsxs("div",{className:p("text-center"),children:[l.jsxs("span",{className:p("text-gray-400 text-sm"),children:["Step ",n+1,":"," ",(c=r[n])==null?void 0:c.label]}),l.jsx("p",{className:p("text-gray-300 text-xs mt-1"),children:"Drop elements here for this step"})]})}),l.jsxs("div",{className:p("flex justify-between mt-4 pt-4 border-t border-gray-200"),children:[l.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"}),l.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}=j(e),o=(t==null?void 0:t.steps)||[];return l.jsx("div",{"data-wizard-id":r.id,"data-wizard-steps":o.length})}}],OS=[{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}=j(e),s=(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 l.jsxs("div",{className:p("space-y-3"),children:[l.jsxs("div",{children:[l.jsxs("label",{className:p("block text-sm font-medium text-gray-700"),children:[t||"Repeatable Field",n&&l.jsx("span",{className:p("text-red-500 ml-1"),children:"*"})]}),r&&l.jsx("p",{className:p("text-xs text-gray-500 mt-0.5"),children:r})]}),l.jsx("div",{className:p("space-y-2"),children:Array.from({length:Math.min(2,s)}).map((f,u)=>l.jsxs("div",{className:p("flex items-center gap-2"),children:[d&&l.jsxs("span",{className:p("text-xs text-gray-400 w-4"),children:[u+1,"."]}),l.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")}),l.jsx("button",{type:"button",disabled:!0,className:p("p-2 text-gray-400 hover:text-red-500 disabled:opacity-50"),children:"✕"})]},u))}),l.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:[l.jsx("span",{children:"+"}),l.jsx("span",{children:c})]}),l.jsxs("p",{className:p("text-xs text-gray-400"),children:["Min: ",s," | Max: ",i," items"]})]})},render:e=>{const{label:t,description:r,placeholder:o,required:n,config:a,value:s=[],onChange:i,errors:c,isDisabled:d}=j(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,g=Array.isArray(s)?s:[""],y=g.length<u,b=g.length>f,C=()=>{y&&i&&i([...g,""])},w=N=>{if(b&&i){const E=g.filter((M,k)=>k!==N);i(E)}},x=(N,E)=>{if(i){const M=[...g];M[N]=E,i(M)}},S=c&&c.length>0;return l.jsxs("div",{className:p("space-y-3"),children:[l.jsxs("div",{children:[l.jsxs("label",{className:p("block text-sm font-medium text-gray-700"),children:[t||"Repeatable Field",n&&l.jsx("span",{className:p("text-red-500 ml-1"),children:"*"})]}),r&&l.jsx("p",{className:p("text-xs text-gray-500 mt-0.5"),children:r})]}),l.jsx("div",{className:p("space-y-2"),children:g.map((N,E)=>l.jsxs("div",{className:p("flex items-center gap-2"),children:[m&&l.jsxs("span",{className:p("text-xs text-gray-400 w-4"),children:[E+1,"."]}),l.jsx("input",{type:"text",value:N,onChange:M=>x(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 ${S?"border-red-500 focus:ring-red-500":"border-gray-300 focus:ring-blue-500 focus:border-blue-500"} ${d?"bg-gray-50 text-gray-500 cursor-not-allowed":""}`}),l.jsx("button",{type:"button",onClick:()=>w(E),disabled:!b||d,className:`p-2 transition-colors ${b&&!d?"text-gray-400 hover:text-red-500":"text-gray-300 cursor-not-allowed"}`,children:"✕"})]},E))}),y&&!d&&l.jsxs("button",{type:"button",onClick:C,className:p("flex items-center gap-1 text-sm text-blue-600 hover:text-blue-700"),children:[l.jsx("span",{children:"+"}),l.jsx("span",{children:h})]}),c&&c.length>0&&l.jsx("div",{className:p("space-y-1"),children:c.map((N,E)=>l.jsx("p",{className:p("text-xs text-red-500"),children:N},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}=j(e),n=(o==null?void 0:o.minItems)||1,a=(o==null?void 0:o.maxItems)||10,s=(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 l.jsxs("div",{className:p("border border-gray-200 rounded-lg p-4 space-y-4"),children:[l.jsxs("div",{className:p("flex items-center justify-between"),children:[l.jsxs("div",{children:[l.jsxs("h3",{className:p("font-medium text-gray-800 flex items-center gap-2"),children:[l.jsx("span",{className:p("text-lg"),children:"📚"}),t||"Repeatable Section"]}),r&&l.jsx("p",{className:p("text-sm text-gray-500 mt-0.5"),children:r})]}),l.jsxs("span",{className:p("text-xs text-gray-400 bg-gray-100 px-2 py-1 rounded"),children:[n,"-",a," items"]})]}),l.jsxs("div",{className:p("border border-dashed border-gray-300 rounded-lg"),children:[l.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:[l.jsxs("span",{className:p("text-sm font-medium text-gray-600"),children:[c&&"1. ",i]}),l.jsxs("div",{className:p("flex items-center gap-2"),children:[l.jsx("button",{type:"button",disabled:!0,className:p("text-gray-400 hover:text-gray-600 text-sm"),children:"▲"}),l.jsx("button",{type:"button",disabled:!0,className:p("text-gray-400 hover:text-gray-600 text-sm"),children:"▼"}),l.jsx("button",{type:"button",disabled:!0,className:p("text-gray-400 hover:text-red-500 text-sm"),children:"✕"})]})]}),l.jsx("div",{className:p("p-4 min-h-[80px] flex items-center justify-center"),children:l.jsx("span",{className:p("text-sm text-gray-400"),children:"Drop elements here to define the repeatable group structure"})})]}),l.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:[l.jsx("span",{children:"+"}),l.jsx("span",{children:s})]})]})},render:e=>{const{label:t,description:r,config:o,element:n,value:a=[],onChange:s,errors:i,isDisabled:c}=j(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",g=(o==null?void 0:o.itemLabel)||"Entry",y=(o==null?void 0:o.showItemNumber)??!0,b=Array.isArray(a)?a:Array.from({length:f},()=>({})),C=b.length<u,w=b.length>f,x=()=>{C&&s&&s([...b,{}])},S=k=>{if(w&&s){const T=b.filter((A,L)=>L!==k);s(T)}},N=k=>{if(k>0&&s){const T=[...b];[T[k-1],T[k]]=[T[k],T[k-1]],s(T)}},E=k=>{if(k<b.length-1&&s){const T=[...b];[T[k],T[k+1]]=[T[k+1],T[k]],s(T)}},M=i&&i.length>0;return l.jsxs("div",{className:`border rounded-lg p-4 space-y-4 ${M?"border-red-300":"border-gray-200"}`,children:[l.jsxs("div",{className:p("flex items-center justify-between"),children:[l.jsxs("div",{children:[l.jsx("h3",{className:p("font-medium text-gray-800"),children:t||"Repeatable Section"}),r&&l.jsx("p",{className:p("text-sm text-gray-500 mt-0.5"),children:r})]}),l.jsxs("span",{className:p("text-xs text-gray-400"),children:[b.length," of ",u]})]}),l.jsx("div",{className:p("space-y-3"),children:b.map((k,T)=>{var A;return l.jsxs("div",{className:p("border border-gray-200 rounded-lg overflow-hidden"),children:[l.jsxs("div",{className:p("flex items-center justify-between px-4 py-2 bg-gray-50 border-b border-gray-200"),children:[l.jsxs("span",{className:p("text-sm font-medium text-gray-600"),children:[y&&`${T+1}. `,g]}),!c&&l.jsxs("div",{className:p("flex items-center gap-1"),children:[l.jsx("button",{type:"button",onClick:()=>N(T),disabled:T===0,className:`p-1 rounded transition-colors ${T===0?"text-gray-300 cursor-not-allowed":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`,title:"Move up",children:"▲"}),l.jsx("button",{type:"button",onClick:()=>E(T),disabled:T===b.length-1,className:`p-1 rounded transition-colors ${T===b.length-1?"text-gray-300 cursor-not-allowed":"text-gray-400 hover:text-gray-600 hover:bg-gray-100"}`,title:"Move down",children:"▼"}),l.jsx("button",{type:"button",onClick:()=>S(T),disabled:!w,className:`p-1 rounded transition-colors ${w?"text-gray-400 hover:text-red-500 hover:bg-red-50":"text-gray-300 cursor-not-allowed"}`,title:m,children:"✕"})]})]}),l.jsx("div",{className:p("p-4"),children:d?d(n.id,`${((A=n.attributes)==null?void 0:A.name)||n.id}[${T}]`):l.jsx("div",{"data-repeat-group-item":n.id,"data-repeat-index":T,className:p("text-sm text-gray-400 text-center py-4"),children:"Group fields render here"})})]},T)})}),C&&!c&&l.jsxs("button",{type:"button",onClick:x,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:[l.jsx("span",{children:"+"}),l.jsx("span",{children:h})]}),i&&i.length>0&&l.jsx("div",{className:p("space-y-1"),children:i.map((k,T)=>l.jsx("p",{className:p("text-xs text-red-500"),children:k},T))})]})}}],yf=[...Dx,...Ax,...Tx,...kS,..._S,...DS,...AS,...TS,...IS,...PS,...MS,...OS];function LS(){for(const e of yf)dt.register(e)}const FS=["shortText","longText","multiLineInput","textEditor"],$S=["number","slider","rangeSlider"],GS=["email","phone","url","location"],VS=["password","signature","captcha"],zS=["singleChoice","multipleChoice","dropdown","tags","decisionBox","toggleSwitch"],BS=["singleChoiceMatrix","multipleChoiceMatrix","matrixTable"],US=["date","time","dateTime","multipleDates","dateRange"],WS=["fileUpload","imageUpload","multiFileUpload","multiImageUpload"],HS=["paragraph","image","link"],jS=[...FS,...$S,...GS,...VS,...zS,...BS,...US,...WS,...HS],Ii={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"},Pi={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 YS(e){return jS.includes(e)}const qS=["singleChoice","multipleChoice","dropdown","tags"],QS=["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"],KS=["singleChoiceMatrix","multipleChoiceMatrix","matrixTable"];function XS(e){return qS.includes(e)}function JS(e){return QS.includes(e)}function ZS(e){return KS.includes(e)}const Za=({element:e,isSelected:t=!1})=>{const r=dt.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 l.jsx(l.Fragment,{children:r.renderOnCanvas(o)})}catch(n){return console.error(`Error rendering element "${e.type}" on canvas:`,n),l.jsx(Ra,{element:e,error:n})}return l.jsx(Ra,{element:e})},vf=({element:e,value:t,onChange:r,errors:o=[],formValues:n={},readOnly:a=!1,disabled:s=!1})=>{const i=dt.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:s};if(i&&i.render)try{return l.jsx(l.Fragment,{children:i.render(c)})}catch(d){return console.error(`Error rendering element "${e.type}":`,d),l.jsx(Ra,{element:e,error:d})}return l.jsx(Ra,{element:e})},Ra=({element:e,error:t})=>{const r=Pi[e.type]||"❓",o=Ii[e.type]||e.type;return t?l.jsxs("div",{className:p("p-4 bg-red-50 border border-red-200 rounded text-red-600 text-sm"),children:[l.jsxs("div",{className:p("flex items-center gap-2"),children:[l.jsx("span",{children:"⚠️"}),l.jsxs("span",{children:["Error rendering: ",o]})]}),l.jsx("p",{className:p("text-xs mt-1 text-red-500"),children:t instanceof Error?t.message:"Unknown error"})]}):l.jsxs("div",{className:p("p-4 bg-gray-100 rounded text-gray-600 text-sm"),children:[l.jsxs("div",{className:p("flex items-center gap-2"),children:[l.jsx("span",{children:r}),l.jsx("span",{children:o})]}),l.jsx("p",{className:p("text-xs mt-1 text-gray-400"),children:"Element type not registered in the element registry"})]})};function RS(e){return dt.has(e)}function xf(e){const t=dt.get(e);return t?t.icon:Pi[e]}function Mi(e){const t=dt.get(e);return t?t.label:Ii[e]||e}function eN(e,t){return l.jsx(Za,{element:e,isSelected:t})}function tN(e,t,r,o,n){return l.jsx(vf,{element:e,value:t,onChange:r,errors:o,formValues:n})}const Kt=v.forwardRef(({className:e,type:t,...r},o)=>l.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}));Kt.displayName="Input";const wf=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Cf=jd,es=(e,t)=>r=>{var o;if((t==null?void 0:t.variants)==null)return Cf(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:a}=t,s=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=wf(f)||wf(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(g=>{let[y,b]=g;return Array.isArray(b)?b.includes({...a,...i}[y]):{...a,...i}[y]===b})?[...d,u,h]:d},[]);return Cf(e,s,c,r==null?void 0:r.class,r==null?void 0:r.className)},rN=es("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 Oi({className:e,variant:t,...r}){return l.jsx("div",{className:p(rN({variant:t}),e),...r})}var oN=Object.defineProperty,Li=(e,t)=>oN(e,"name",{value:t,configurable:!0}),Fi=!1;function Sf(){const[e,t]=v.useState(Fi);return v.useEffect(()=>{Fi||(Fi=!0,t(!0))},[]),e}Li(Sf,"useIsHydrated");var Nf=v[" useSyncExternalStore ".trim().toString()];function Ef(){return()=>{}}Li(Ef,"subscribe");function kf(){return Nf(Ef,()=>!0,()=>!1)}Li(kf,"useIsHydratedModern");var nN=typeof Nf=="function"?kf:Sf,aN=Object.defineProperty,xo=(e,t)=>aN(e,"name",{value:t,configurable:!0}),$i="rovingFocusGroup.onEntryFocus",sN={bubbles:!1,cancelable:!0},ts="RovingFocusGroup",[Gi,_f,lN]=Sa(ts),[iN,Df]=rr(ts,[lN]),[cN,dN]=iN(ts),uN=v.forwardRef(xo(function(t,r){return l.jsx(Gi.Provider,{scope:t.__scopeRovingFocusGroup,children:l.jsx(Gi.Slot,{scope:t.__scopeRovingFocusGroup,children:l.jsx(pN,{...t,ref:r})})})},"RovingFocusGroup")),pN=v.forwardRef(xo(function(t,r){const{__scopeRovingFocusGroup:o,orientation:n,loop:a=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:d,onEntryFocus:f,preventScrollOnEntryFocus:u=!1,...h}=t,m=v.useRef(null),g=ze(r,m),y=hn(s),[b,C]=br({prop:i,defaultProp:c??null,onChange:d,caller:ts}),[w,x]=v.useState(!1),S=nr(f),N=_f(o),E=v.useRef(!1),[M,k]=v.useState(0);return v.useEffect(()=>{const T=m.current;if(T)return T.addEventListener($i,S),()=>T.removeEventListener($i,S)},[S]),l.jsx(cN,{scope:o,orientation:n,dir:y,loop:a,currentTabStopId:b,onItemFocus:v.useCallback(T=>C(T),[C]),onItemShiftTab:v.useCallback(()=>x(!0),[]),onFocusableItemAdd:v.useCallback(()=>k(T=>T+1),[]),onFocusableItemRemove:v.useCallback(()=>k(T=>T-1),[]),children:l.jsx(Ie.div,{tabIndex:w||M===0?-1:0,"data-orientation":n,...h,ref:g,style:{outline:"none",...t.style},onMouseDown:we(t.onMouseDown,()=>{E.current=!0}),onFocus:we(t.onFocus,T=>{const A=!E.current;if(T.target===T.currentTarget&&A&&!w){const L=new CustomEvent($i,sN);if(T.currentTarget.dispatchEvent(L),!L.defaultPrevented){const O=N().filter(H=>H.focusable),F=O.find(H=>H.active),V=O.find(H=>H.id===b),K=[F,V,...O].filter(Boolean).map(H=>H.ref.current);Vi(K,u)}}E.current=!1}),onBlur:we(t.onBlur,()=>x(!1))})})},"RovingFocusGroupImpl")),fN="RovingFocusGroupItem",hN=v.forwardRef(xo(function(t,r){const{__scopeRovingFocusGroup:o,focusable:n=!0,active:a=!1,tabStopId:s,children:i,...c}=t,d=Hr(),f=s||d,u=dN(fN,o),h=u.currentTabStopId===f,m=_f(o),{onFocusableItemAdd:g,onFocusableItemRemove:y,currentTabStopId:b}=u,C=nN();return nt(()=>{if(!(!C||!n))return g(),()=>y()},[C,n,g,y]),v.useEffect(()=>{if(!(C||!n))return g(),()=>y()},[C,n,g,y]),l.jsx(Gi.ItemSlot,{scope:o,id:f,focusable:n,active:a,children:l.jsx(Ie.span,{tabIndex:h?0:-1,"data-orientation":u.orientation,...c,ref:r,onMouseDown:we(t.onMouseDown,w=>{n?u.onItemFocus(f):w.preventDefault()}),onFocus:we(t.onFocus,()=>u.onItemFocus(f)),onKeyDown:we(t.onKeyDown,w=>{if(w.key==="Tab"&&w.shiftKey){u.onItemShiftTab();return}if(w.target!==w.currentTarget)return;const x=Tf(w,u.orientation,u.dir);if(x!==void 0){if(w.metaKey||w.ctrlKey||w.altKey||w.shiftKey)return;w.preventDefault();let N=m().filter(E=>E.focusable).map(E=>E.ref.current);if(x==="last")N.reverse();else if(x==="prev"||x==="next"){x==="prev"&&N.reverse();const E=N.indexOf(w.currentTarget);N=u.loop?If(N,E+1):N.slice(E+1)}setTimeout(()=>Vi(N))}}),children:typeof i=="function"?i({isCurrentTabStop:h,hasTabStop:b!=null}):i})})},"RovingFocusGroupItem")),mN={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Af(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}xo(Af,"getDirectionAwareKey");function Tf(e,t,r){const o=Af(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return mN[o]}xo(Tf,"getFocusIntent");function Vi(e,t=!1){const r=document.activeElement;for(const o of e)if(o===r||(o.focus({preventScroll:t}),document.activeElement!==r))return}xo(Vi,"focusFirst");function If(e,t){return e.map((r,o)=>e[(t+o)%e.length])}xo(If,"wrapArray");var gN=uN,bN=hN,yN=Object.defineProperty,qo=(e,t)=>yN(e,"name",{value:t,configurable:!0}),zi="Tabs",[vN,iI]=rr(zi,[Df]),Pf=Df(),[xN,Bi]=vN(zi),wN=v.forwardRef(qo(function(t,r){const{__scopeTabs:o,value:n,onValueChange:a,defaultValue:s,orientation:i="horizontal",dir:c,activationMode:d="automatic",...f}=t,u=hn(c),[h,m]=br({prop:n,onChange:a,defaultProp:s??"",caller:zi});return l.jsx(xN,{scope:o,baseId:Hr(),value:h,onValueChange:m,orientation:i,dir:u,activationMode:d,children:l.jsx(Ie.div,{dir:u,"data-orientation":i,...f,ref:r})})},"Tabs")),CN="TabsList",SN=v.forwardRef(qo(function(t,r){const{__scopeTabs:o,loop:n=!0,...a}=t,s=Bi(CN,o),i=Pf(o);return l.jsx(gN,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:n,children:l.jsx(Ie.div,{role:"tablist","aria-orientation":s.orientation,...a,ref:r})})},"TabsList")),NN="TabsTrigger",EN=v.forwardRef(qo(function(t,r){const{__scopeTabs:o,value:n,disabled:a=!1,...s}=t,i=Bi(NN,o),c=Pf(o),d=Ui(i.baseId,n),f=Wi(i.baseId,n),u=n===i.value;return l.jsx(bN,{asChild:!0,...c,focusable:!a,active:u,children:l.jsx(Ie.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":f,"data-state":u?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:d,...s,ref:r,onMouseDown:we(t.onMouseDown,h=>{!a&&h.button===0&&h.ctrlKey===!1?i.onValueChange(n):h.preventDefault()}),onKeyDown:we(t.onKeyDown,h=>{a||h.target!==h.currentTarget||[" ","Enter"].includes(h.key)&&i.onValueChange(n)}),onFocus:we(t.onFocus,()=>{const h=i.activationMode!=="manual";!u&&!a&&h&&i.onValueChange(n)})})})},"TabsTrigger")),kN="TabsContent",_N=v.forwardRef(qo(function(t,r){const{__scopeTabs:o,value:n,forceMount:a,children:s,...i}=t,c=Bi(kN,o),d=Ui(c.baseId,n),f=Wi(c.baseId,n),u=n===c.value,h=v.useRef(u);return v.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(Vo,{present:a||u,children:({present:m})=>l.jsx(Ie.div,{"data-state":u?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":d,hidden:!m,id:f,tabIndex:0,...i,ref:r,style:{...t.style,animationDuration:h.current?"0s":void 0},children:m&&s})})},"TabsContent"));function Ui(e,t){return`${e}-trigger-${t}`}qo(Ui,"makeTriggerId");function Wi(e,t){return`${e}-content-${t}`}qo(Wi,"makeContentId");var DN=wN,Mf=SN,Of=EN,Lf=_N;const AN=DN,Ff=v.forwardRef(({className:e,...t},r)=>l.jsx(Mf,{ref:r,className:p("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Ff.displayName=Mf.displayName;const rs=v.forwardRef(({className:e,...t},r)=>l.jsx(Of,{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}));rs.displayName=Of.displayName;const os=v.forwardRef(({className:e,...t},r)=>l.jsx(Lf,{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}));os.displayName=Lf.displayName;var TN=Object.defineProperty,Cn=(e,t)=>TN(e,"name",{value:t,configurable:!0}),Hi="Collapsible",[IN,$f]=rr(Hi),[PN,ji]=IN(Hi),MN=v.forwardRef(Cn(function(t,r){const{__scopeCollapsible:o,open:n,defaultOpen:a,disabled:s,onOpenChange:i,...c}=t,[d,f]=br({prop:n,defaultProp:a??!1,onChange:i,caller:Hi});return l.jsx(PN,{scope:o,disabled:s,contentId:Hr(),open:d,onOpenToggle:v.useCallback(()=>f(u=>!u),[f]),children:l.jsx(Ie.div,{"data-state":ns(d),"data-disabled":s?"":void 0,...c,ref:r})})},"Collapsible")),ON="CollapsibleTrigger",Gf=v.forwardRef(Cn(function(t,r){const{__scopeCollapsible:o,...n}=t,a=ji(ON,o);return l.jsx(Ie.button,{type:"button","aria-controls":a.open?a.contentId:void 0,"aria-expanded":a.open||!1,"data-state":ns(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...n,ref:r,onClick:we(t.onClick,a.onOpenToggle)})},"CollapsibleTrigger")),Vf="CollapsibleContent",zf=v.forwardRef(Cn(function(t,r){const{forceMount:o,...n}=t,a=ji(Vf,t.__scopeCollapsible);return l.jsx(Vo,{present:o||a.open,children:({present:s})=>l.jsx(LN,{...n,ref:r,present:s})})},"CollapsibleContent")),LN=v.forwardRef(Cn(function(t,r){const{__scopeCollapsible:o,present:n,children:a,...s}=t,i=ji(Vf,o),[c,d]=v.useState(n),f=v.useRef(null),u=ze(r,f),h=v.useRef(0),m=h.current,g=v.useRef(0),y=g.current,b=i.open||c,C=v.useRef(b),w=v.useRef(void 0);return v.useEffect(()=>{const x=requestAnimationFrame(()=>C.current=!1);return()=>cancelAnimationFrame(x)},[]),nt(()=>{const x=f.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();h.current=S.height,g.current=S.width,C.current||(x.style.transitionDuration=w.current.transitionDuration,x.style.animationName=w.current.animationName),d(n)}},[i.open,n]),l.jsx(Ie.div,{"data-state":ns(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!b,...s,ref:u,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...t.style},children:b&&a})},"CollapsibleContentImpl"));function ns(e){return e?"open":"closed"}Cn(ns,"getState");var Bf=MN,FN=Gf,$N=zf;const Uf=Bf,Wf=Gf,Hf=zf,GN=es("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"}}),Ze=v.forwardRef(({className:e,variant:t,size:r,asChild:o=!1,...n},a)=>{const s=o?Vx:"button";return l.jsx(s,{className:p(GN({variant:t,size:r,className:e})),ref:a,...n})});Ze.displayName="Button";var VN=Object.defineProperty,vt=(e,t)=>VN(e,"name",{value:t,configurable:!0}),[Yi,cI]=rr("Tooltip",[$a]),qi=$a(),zN="TooltipProvider",BN=700,Qi="tooltip.open",[UN,Ki]=Yi(zN),WN=vt(e=>{const{__scopeTooltip:t,delayDuration:r=BN,skipDelayDuration:o=300,disableHoverableContent:n=!1,children:a}=e,s=v.useRef(!0),i=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),l.jsx(UN,{scope:t,isOpenDelayedRef:s,delayDuration:r,onOpen:v.useCallback(()=>{o<=0||(window.clearTimeout(c.current),s.current=!1)},[o]),onClose:v.useCallback(()=>{o<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>s.current=!0,o))},[o]),isPointerInTransitRef:i,onPointerInTransitChange:v.useCallback(d=>{i.current=d},[]),disableHoverableContent:n,children:a})},"TooltipProvider"),Xi="Tooltip",[HN,Sn]=Yi(Xi),jN=vt(e=>{const{__scopeTooltip:t,children:r,open:o,defaultOpen:n,onOpenChange:a,disableHoverableContent:s,delayDuration:i}=e,c=Ki(Xi,e.__scopeTooltip),d=qi(t),[f,u]=v.useState(null),[h,m]=v.useState(void 0),g=Hr(),y=v.useRef(0),b=s??c.disableHoverableContent,C=i??c.delayDuration,w=v.useRef(!1),[x,S]=br({prop:o,defaultProp:n??!1,onChange:vt(A=>{A?(c.onOpen(),document.dispatchEvent(new CustomEvent(Qi))):c.onClose(),a==null||a(A)},"onChange"),caller:Xi}),N=v.useMemo(()=>x?w.current?"delayed-open":"instant-open":"closed",[x]),E=v.useCallback(()=>{window.clearTimeout(y.current),y.current=0,w.current=!1,S(!0)},[S]),M=v.useCallback(()=>{window.clearTimeout(y.current),y.current=0,S(!1)},[S]),k=v.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{w.current=!0,S(!0),y.current=0},C)},[C,S]);v.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]);const T=h??g;return l.jsx(gp,{...d,children:l.jsx(HN,{scope:t,contentId:T,setContentId:m,open:x,stateAttribute:N,trigger:f,onTriggerChange:u,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?k():E()},[c.isOpenDelayedRef,k,E]),onTriggerLeave:v.useCallback(()=>{b?M():(window.clearTimeout(y.current),y.current=0)},[M,b]),onOpen:E,onClose:M,disableHoverableContent:b,children:r})})},"Tooltip"),jf="TooltipTrigger",YN=v.forwardRef(vt(function(t,r){const{__scopeTooltip:o,...n}=t,a=Sn(jf,o),s=Ki(jf,o),i=qi(o),c=v.useRef(null),d=ze(r,c,a.onTriggerChange),f=v.useRef(!1),u=v.useRef(!1),h=v.useCallback(()=>f.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),l.jsx(bp,{asChild:!0,...i,children:l.jsx(Ie.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...n,ref:d,onPointerMove:we(t.onPointerMove,m=>{m.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(a.onTriggerEnter(),u.current=!0)}),onPointerLeave:we(t.onPointerLeave,()=>{a.onTriggerLeave(),u.current=!1}),onPointerDown:we(t.onPointerDown,()=>{a.open&&a.onClose(),f.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:we(t.onFocus,()=>{f.current||a.onOpen()}),onBlur:we(t.onBlur,a.onClose),onClick:we(t.onClick,a.onClose)})})},"TooltipTrigger")),Yf="TooltipPortal",[qN,QN]=Yi(Yf,{forceMount:void 0}),KN=vt(e=>{const{__scopeTooltip:t,forceMount:r,children:o,container:n}=e,a=Sn(Yf,t);return l.jsx(qN,{scope:t,forceMount:r,children:l.jsx(Vo,{present:r||a.open,children:l.jsx(vp,{asChild:!0,container:n,children:o})})})},"TooltipPortal"),Nn="TooltipContent",XN=v.forwardRef(vt(function(t,r){const o=QN(Nn,t.__scopeTooltip),{forceMount:n=o.forceMount,side:a="top",...s}=t,i=Sn(Nn,t.__scopeTooltip);return l.jsx(Vo,{present:n||i.open,children:i.disableHoverableContent?l.jsx(qf,{side:a,...s,ref:r}):l.jsx(JN,{side:a,...s,ref:r})})},"TooltipContent")),JN=v.forwardRef(vt(function(t,r){const o=Sn(Nn,t.__scopeTooltip),n=Ki(Nn,t.__scopeTooltip),a=v.useRef(null),s=ze(r,a),[i,c]=v.useState(null),{trigger:d,onClose:f}=o,u=a.current,{onPointerInTransitChange:h}=n,m=v.useCallback(()=>{c(null),h(!1)},[h]),g=v.useCallback((y,b)=>{const C=y.currentTarget,w={x:y.clientX,y:y.clientY},x=Qf(w,C.getBoundingClientRect()),S=Kf(w,x),N=Xf(b.getBoundingClientRect()),E=Zf([...S,...N]);c(E),h(!0)},[h]);return v.useEffect(()=>()=>m(),[m]),v.useEffect(()=>{if(d&&u){const y=vt(C=>g(C,u),"handleTriggerLeave"),b=vt(C=>g(C,d),"handleContentLeave");return d.addEventListener("pointerleave",y),u.addEventListener("pointerleave",b),()=>{d.removeEventListener("pointerleave",y),u.removeEventListener("pointerleave",b)}}},[d,u,g,m]),v.useEffect(()=>{if(i){const y=vt(b=>{const C=b.target,w={x:b.clientX,y:b.clientY},x=(d==null?void 0:d.contains(C))||(u==null?void 0:u.contains(C)),S=!Jf(w,i);x?m():S&&(m(),f())},"handleTrackPointerGrace");return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[d,u,i,f,m]),l.jsx(qf,{...t,ref:s})},"TooltipContentHoverable")),ZN=xu("TooltipContent"),qf=v.forwardRef(vt(function(t,r){const{__scopeTooltip:o,children:n,"aria-label":a,id:s,onEscapeKeyDown:i,onPointerDownOutside:c,...d}=t,f=Sn(Nn,o),u=qi(o),{onClose:h}=f;v.useEffect(()=>(document.addEventListener(Qi,h),()=>document.removeEventListener(Qi,h)),[h]),v.useEffect(()=>{if(f.trigger){const g=vt(y=>{y.target instanceof Node&&y.target.contains(f.trigger)&&h()},"handleScroll");return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[f.trigger,h]);const{setContentId:m}=f;return nt(()=>(m(s),()=>{m(void 0)}),[s,m]),l.jsx(Mu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:g=>g.preventDefault(),onDismiss:h,children:l.jsxs(yp,{"data-state":f.stateAttribute,role:a?void 0:"tooltip",id:a?void 0:f.contentId,...u,...d,ref:r,style:{...d.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:[l.jsx(ZN,{children:n}),a?l.jsx(B0,{id:f.contentId,role:"tooltip",children:a}):null]})})},"TooltipContentImpl"));function Qf(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")}}vt(Qf,"getExitSideFromRect");function Kf(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}vt(Kf,"getPaddedExitPoints");function Xf(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}]}vt(Xf,"getPointsFromRect");function Jf(e,t){const{x:r,y:o}=e;let n=!1;for(let a=0,s=t.length-1;a<t.length;s=a++){const i=t[a],c=t[s],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}vt(Jf,"isPointInPolygon");function Zf(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),Rf(t)}vt(Zf,"getHull");function Rf(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],s=t[t.length-2];if((a.x-s.x)*(n.y-s.y)>=(a.y-s.y)*(n.x-s.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],s=r[r.length-2];if((a.x-s.x)*(n.y-s.y)>=(a.y-s.y)*(n.x-s.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)}vt(Rf,"getHullPresorted");var RN=WN,eE=jN,tE=YN,rE=KN,eh=XN;const as=RN,vr=eE,xr=tE,sr=v.forwardRef(({className:e,sideOffset:t=4,...r},o)=>l.jsx(rE,{children:l.jsx(eh,{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})}));sr.displayName=eh.displayName;const Ji=v.forwardRef(({className:e,children:t,...r},o)=>l.jsx("div",{ref:o,className:p("relative overflow-hidden",e),...r,children:l.jsx("div",{className:p("h-full w-full overflow-auto rounded-[inherit]"),children:t})}));Ji.displayName="ScrollArea";const oE=v.forwardRef(({className:e,orientation:t="vertical",...r},o)=>l.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:l.jsx("div",{className:p("relative flex-1 rounded-full bg-border")})}));oE.displayName="ScrollBar";function th(e){return{order:99,disabled:!1,hidden:!1,...e}}function nE(e){return e.map((t,r)=>th({...t,order:t.order??100+r}))}function rh(e,t){return typeof e.disabled=="function"?e.disabled(t):e.disabled??!1}function oh(e,t){return typeof e.hidden=="function"?e.hidden(t):e.hidden??!1}const aE=({element:e,onAddElement:t,isDisabled:r=!1,disabledReason:o,wizardExists:n=!1})=>{const a=R(u=>u.setDraggedElementType),s=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 l.jsx("span",{className:p("text-lg flex-shrink-0"),children:e.icon});const u=e.icon;return l.jsx(u,{className:p("w-5 h-5 flex-shrink-0")})},f=l.jsxs("div",{draggable:!r,onDragStart:s,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(),l.jsxs("div",{className:p("flex-1 min-w-0"),children:[l.jsx("div",{className:p("text-xs font-medium text-foreground truncate"),children:e.label}),r&&l.jsx("div",{className:p("text-xs text-orange-500 truncate"),children:"Already added"})]})]});return r&&o?l.jsx(as,{children:l.jsxs(vr,{children:[l.jsx(xr,{asChild:!0,children:f}),l.jsx(sr,{children:l.jsx("p",{children:o})})]})}):l.jsx(as,{children:l.jsxs(vr,{children:[l.jsx(xr,{asChild:!0,children:f}),l.jsx(sr,{children:l.jsxs("div",{className:p("max-w-xs"),children:[l.jsx("p",{className:p("font-medium"),children:e.label}),l.jsx("p",{className:p("text-xs text-muted-foreground"),children:e.description}),l.jsx("p",{className:p("text-xs mt-1 text-muted-foreground/70"),children:n?"Drag into wizard step":"Drag or click to add"})]})})]})})},nh=({label:e,elements:t,searchQuery:r,onAddElement:o,defaultExpanded:n=!1,hasWizard:a=!1,wizardExists:s=!1})=>{const[i,c]=D.useState(n),d=D.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 l.jsxs(Uf,{open:f,onOpenChange:c,className:p("mb-2"),children:[l.jsx(Wf,{asChild:!0,children:l.jsxs(Ze,{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:[l.jsx("span",{children:e}),l.jsxs("span",{className:p("flex items-center gap-1"),children:[l.jsx(Oi,{variant:"secondary",className:p("font-normal normal-case text-xs"),children:d.length}),l.jsx(Yo,{className:p("h-4 w-4 transition-transform",f&&"rotate-180")})]})]})}),l.jsx(Hf,{children:l.jsx("div",{className:p("grid grid-cols-2 gap-1.5 mt-1.5"),children:d.map(u=>l.jsx(aE,{element:u,onAddElement:o,isDisabled:u.type==="pages"&&a,disabledReason:"Only one wizard can be added per form",wizardExists:s},u.type))})})]})},ah=({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:l.jsxs("div",{className:p("text-center py-8 text-muted-foreground text-sm"),children:[l.jsx("div",{className:p("text-3xl mb-2"),children:"🔍"}),l.jsxs("p",{children:['No elements found for "',e,'"']}),l.jsx("p",{className:p("text-xs mt-1 text-muted-foreground/70"),children:"Try a different search term"})]}),sE=({sidebarTabs:e=[]})=>{const[t,r]=D.useState("fields"),[o,n]=D.useState(""),a=R(A=>A.addElement),s=R(A=>A.hasWizard),i=R(A=>A.schema),c=R(A=>A.mode),d=R(A=>A.loadSchema),f=R(A=>A.exportSchema),u=R(A=>A.resetForm),h=R(A=>A.updateFormTitle),m=R(A=>A.updateFormDescription),g=R(A=>A.updateElement),y=R(A=>A.deleteElement),b=R(A=>A.selectElement),C=R(A=>A.setMode),w=A=>{x&&A!=="pages"||a(A)},x=s(),S=D.useMemo(()=>{const A=dt.getGroups(),L=A.filter(F=>F.elements.some(V=>V.category==="field")),O=A.filter(F=>F.elements.some(V=>V.category==="page"));return{fieldGroups:L,pageGroups:O}},[]),N=D.useMemo(()=>dt.getByCategory("field"),[]),E=D.useMemo(()=>dt.getByCategory("page"),[]),M=["textInput","selection","heading","layout","special"],k=D.useMemo(()=>({schema:i,mode:c,actions:{addElement:a,loadSchema:d,exportSchema:f,resetForm:u,updateFormTitle:h,updateFormDescription:m,updateElement:g,deleteElement:y,selectElement:b,setMode:C}}),[i,c,a,d,f,u,h,m,g,y,b,C]),T=D.useMemo(()=>e.length?[...e].filter(A=>!oh(A,k)).sort((A,L)=>(A.order??99)-(L.order??99)):[],[e,k]);return l.jsxs("div",{className:p("w-72 bg-muted/50 border-r border-border flex flex-col h-full flex-shrink-0"),children:[x&&l.jsx("div",{className:p("p-2 bg-orange-50 border-b border-orange-200"),children:l.jsxs("div",{className:p("flex items-start gap-2 text-xs text-orange-700"),children:[l.jsx("span",{className:p("text-base"),children:"📑"}),l.jsxs("div",{children:[l.jsx("p",{className:p("font-medium"),children:"Wizard Mode Active"}),l.jsx("p",{className:p("text-orange-600"),children:"Drop elements inside wizard steps, not on the main canvas."})]})]})}),l.jsx("div",{className:p("p-3 border-b border-border bg-card"),children:l.jsxs("div",{className:p("relative"),children:[l.jsx(gS,{className:p("absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground")}),l.jsx(Kt,{type:"text",placeholder:"Search elements...",value:o,onChange:A=>n(A.target.value),className:p("pl-9 pr-8")}),o&&l.jsx(Ze,{variant:"ghost",size:"icon",className:p("absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6"),onClick:()=>n(""),children:l.jsx(Ka,{className:p("h-4 w-4")})})]})}),l.jsxs(AN,{value:t,onValueChange:r,className:p("flex-1 flex flex-col min-h-0 overflow-hidden"),children:[l.jsx(Ji,{"aria-disabled":!0,children:l.jsxs(Ff,{className:p("w-full rounded-none border-b border-border bg-card h-auto p-0 flex-shrink-0"),children:[l.jsxs(rs,{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 (",N.length,")"]}),l.jsxs(rs,{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,")"]}),T.map(A=>{const L=A.icon;return l.jsxs(rs,{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:rh(A,k),children:[L&&l.jsx(L,{className:p("h-3.5 w-3.5 mr-1")}),A.label]},A.id)})]})}),l.jsxs("div",{className:p("flex-1 min-h-0 relative"),children:[l.jsx(os,{value:"fields",className:p("absolute inset-0 mt-0 data-[state=inactive]:hidden overflow-auto"),children:l.jsxs("div",{className:p("p-3"),children:[S.fieldGroups.map(A=>l.jsx(nh,{label:A.label,elements:A.elements.filter(L=>L.category==="field"),searchQuery:o,onAddElement:w,defaultExpanded:M.includes(A.id),wizardExists:x},A.id)),o&&l.jsx(ah,{searchQuery:o,elements:N})]})}),l.jsx(os,{value:"pages",className:p("absolute inset-0 mt-0 data-[state=inactive]:hidden overflow-auto"),children:l.jsxs("div",{className:p("p-3"),children:[S.pageGroups.map(A=>l.jsx(nh,{label:A.label,elements:A.elements.filter(L=>L.category==="page"),searchQuery:o,onAddElement:w,defaultExpanded:M.includes(A.id),hasWizard:x,wizardExists:x},A.id)),o&&l.jsx(ah,{searchQuery:o,elements:E})]})}),T.map(A=>{const L=A.content;return l.jsx(os,{value:A.id,className:p("absolute inset-0 mt-0 data-[state=inactive]:hidden overflow-auto"),children:l.jsx(L,{...k})},A.id)})]})]})]})},lE=["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 iE(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=cE(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=uE(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 cE(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 s=e;if(!s.id||typeof s.id!="string"?n.push({type:"error",message:`${a}: Must have a valid "id" field (string)`}):(r.has(s.id)&&n.push({type:"error",message:`${a}: Duplicate element ID "${s.id}"`}),r.add(s.id)),!s.type||typeof s.type!="string"?n.push({type:"error",message:`${a}: Must have a valid "type" field (string)`}):lE.includes(s.type)||n.push({type:"error",message:`${a}: Invalid element type "${s.type}"`}),typeof s.order!="number"&&n.push({type:"warning",elementId:s.id,message:`${a}: Missing or invalid "order" field`}),(!s.properties||typeof s.properties!="object")&&n.push({type:"warning",elementId:s.id,message:`${a}: Missing "properties" object`}),(!s.layout||typeof s.layout!="object")&&n.push({type:"warning",elementId:s.id,message:`${a}: Missing "layout" object`}),!s.attributes||typeof s.attributes!="object")n.push({type:"warning",elementId:s.id,message:`${a}: Missing "attributes" object`});else{const c=s.attributes;if(!c.name||typeof c.name!="string")n.push({type:"error",elementId:s.id,message:`${a}: Missing or invalid "attributes.name" field`});else{const d=o.get(c.name)||[];d.push(s.id),o.set(c.name,d)}}const i=dE(s);return n.push(...i),n}function dE(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 uE(e,t){var a,s,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"),(s=o.hideWhen)!=null&&s.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 pE(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=iE(t);return{schema:r.valid?t:null,validation:r}}function fE(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 hE(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 sh(e){return{order:0,variant:"ghost",disabled:!1,hidden:!1,...e}}function mE(e){return e.map((t,r)=>sh({...t,order:t.order??r}))}function lh(e,t){return typeof e.disabled=="function"?e.disabled(t):e.disabled??!1}function Zi(e,t){return typeof e.hidden=="function"?e.hidden(t):e.hidden??!1}class gE{constructor(){wl(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 Vt=new gE;function bE(e){Vt.register(e)}function yE(e){for(const t of e)Vt.register(t)}function vE(e){return Vt.unregister(e)}function xE(e){return Vt.get(e)}function wE(e){return Vt.has(e)}const wo=({action:e,context:t})=>{const r=e.icon,o=lh(e,t),n=async()=>{o||await e.onClick(t)},a=p(e.variant==="destructive"?"text-destructive hover:text-destructive hover:bg-destructive/10":"");return l.jsxs(vr,{children:[l.jsx(xr,{asChild:!0,children:l.jsx(Ze,{variant:"ghost",size:"icon",onClick:n,disabled:o,className:a,children:l.jsx(r,{className:p("h-5 w-5")})})}),l.jsx(sr,{children:l.jsx("p",{children:e.label})})]})},CE=({schema:e,canUndo:t,canRedo:r,onUndo:o,onRedo:n,onExport:a,exportSchema:s,onImport:i,onReset:c,mode:d,onModeChange:f,toolbarConfig:u})=>{const h=D.useRef(null),m=D.useMemo(()=>({schema:e,mode:d,canUndo:t,canRedo:r,actions:{undo:o,redo:n,loadSchema:i,exportSchema:s,setMode:f,resetForm:c}}),[e,d,t,r,o,n,i,s,f,c]),g=()=>{var E;(E=h.current)==null||E.click()},y=E=>{var k;const M=(k=E.target.files)==null?void 0:k[0];if(M){const T=new FileReader;T.onload=A=>{var L;try{const O=(L=A.target)==null?void 0:L.result,{schema:F,validation:V}=pE(O);if(!V.valid){const K=hE(V),H=V.errors.filter(G=>G.type==="error").slice(0,5).map(G=>`• ${G.message}`).join(`
|
|
172
|
+
`);if(window.confirm(`Schema validation failed (${K}):
|
|
173
|
+
|
|
174
|
+
${H}
|
|
175
|
+
|
|
176
|
+
Would you like to attempt to import anyway? The schema will be sanitized.`)){const G=JSON.parse(O),z=fE(G);i(z)}return}const re=V.errors.filter(K=>K.type==="warning");re.length>0&&console.warn("Schema import warnings:",re),i(F)}catch(O){console.error("Failed to import schema:",O),alert("Invalid JSON file. Please select a valid form schema.")}},T.readAsText(M)}h.current&&(h.current.value="")},b=new Set((u==null?void 0:u.hideBuiltinActions)??[]);(u==null?void 0:u.showUndoRedo)===!1&&(b.add("undo"),b.add("redo")),(u==null?void 0:u.showModeToggle)===!1&&(b.add("design-mode"),b.add("preview-mode")),(u==null?void 0:u.showImportExport)===!1&&(b.add("import"),b.add("export")),(u==null?void 0:u.showReset)===!1&&b.add("reset");const C=new Map,w=(u==null?void 0:u.actions)??[];w.forEach(E=>{E.override&&C.set(E.override,E)});const x=D.useMemo(()=>{const E={left:[],center:[],right:[]};return w.filter(M=>!M.override&&!Zi(M,m)).forEach(M=>{E[M.position].push(M)}),Object.values(E).forEach(M=>{M.sort((k,T)=>(k.order??0)-(T.order??0))}),E},[w,m]),S=E=>!(b.has(E)||C.has(E)),N=(E,M)=>{if(b.has(E))return null;const k=C.get(E);return k&&!Zi(k,m)?l.jsx(wo,{action:k,context:m},E):M()};return l.jsx(as,{children:l.jsxs("div",{className:p("flex items-center justify-between px-4 py-2 bg-card border-b border-border"),children:[l.jsxs("div",{className:p("flex items-center gap-1"),children:[x.left.filter(E=>(E.order??0)<0).map(E=>l.jsx(wo,{action:E,context:m},E.id)),N("undo",()=>S("undo")?l.jsxs(vr,{children:[l.jsx(xr,{asChild:!0,children:l.jsx(Ze,{variant:"ghost",size:"icon",onClick:o,disabled:!t,children:l.jsx(yS,{className:p("h-5 w-5")})})}),l.jsx(sr,{children:l.jsx("p",{children:"Undo (⌘Z)"})})]},"undo"):null),N("redo",()=>S("redo")?l.jsxs(vr,{children:[l.jsx(xr,{asChild:!0,children:l.jsx(Ze,{variant:"ghost",size:"icon",onClick:n,disabled:!r,children:l.jsx(mS,{className:p("h-5 w-5")})})}),l.jsx(sr,{children:l.jsx("p",{children:"Redo (⌘⇧Z)"})})]},"redo"):null),x.left.filter(E=>(E.order??0)>=0).map(E=>l.jsx(wo,{action:E,context:m},E.id))]}),l.jsxs("div",{className:p("flex items-center gap-2"),children:[x.center.filter(E=>(E.order??0)<0).map(E=>l.jsx(wo,{action:E,context:m},E.id)),(u==null?void 0:u.showModeToggle)!==!1&&Vt.getVisible().length>0&&l.jsx("div",{className:p("flex items-center bg-muted rounded-lg p-1"),children:Vt.getVisible().map(E=>{const M=`${E.id}-mode`;if(b.has(M))return null;const k=E.icon,T=d===E.id;return l.jsxs(vr,{children:[l.jsx(xr,{asChild:!0,children:l.jsx(Ze,{variant:T?"secondary":"ghost",size:"icon",onClick:()=>f(E.id),className:p(T&&"bg-background shadow-sm"),children:l.jsx(k,{className:p("h-5 w-5")})})}),l.jsx(sr,{children:l.jsx("p",{children:E.description??E.label})})]},E.id)})}),x.center.filter(E=>(E.order??0)>=0).map(E=>l.jsx(wo,{action:E,context:m},E.id))]}),l.jsxs("div",{className:p("flex items-center gap-1"),children:[x.right.filter(E=>(E.order??0)<0).map(E=>l.jsx(wo,{action:E,context:m},E.id)),l.jsx("input",{ref:h,type:"file",accept:".json",onChange:y,className:p("hidden")}),N("import",()=>S("import")?l.jsxs(vr,{children:[l.jsx(xr,{asChild:!0,children:l.jsx(Ze,{variant:"ghost",size:"icon",onClick:g,children:l.jsx(vS,{className:p("h-5 w-5")})})}),l.jsx(sr,{children:l.jsx("p",{children:"Import"})})]},"import"):null),N("export",()=>S("export")?l.jsxs(vr,{children:[l.jsx(xr,{asChild:!0,children:l.jsx(Ze,{variant:"ghost",size:"icon",onClick:a,children:l.jsx(pS,{className:p("h-5 w-5")})})}),l.jsx(sr,{children:l.jsx("p",{children:"Export"})})]},"export"):null),N("reset",()=>S("reset")?l.jsxs(vr,{children:[l.jsx(xr,{asChild:!0,children:l.jsx(Ze,{variant:"ghost",size:"icon",className:p("text-destructive hover:text-destructive hover:bg-destructive/10"),onClick:c,children:l.jsx(Ti,{className:p("h-5 w-5")})})}),l.jsx(sr,{children:l.jsx("p",{children:"Reset"})})]},"reset"):null),x.right.filter(E=>(E.order??0)>=0).map(E=>l.jsx(wo,{action:E,context:m},E.id))]})]})})},En=({containerId:e,stepId:t,label:r="Drop elements here",children:o,isEmpty:n=!0})=>{const[a,s]=D.useState(!1),i=D.useRef(null),c=R(m=>m.addElementToContainer),d=R(m=>m.setDraggedElementType),f=m=>{m.preventDefault();const y=m.currentTarget.querySelectorAll("[data-drop-zone]");for(const b of y){const C=b.getBoundingClientRect();if(m.clientX>=C.left&&m.clientX<=C.right&&m.clientY>=C.top&&m.clientY<=C.bottom){s(!1);return}}m.stopPropagation(),s(!0)},u=m=>{m.preventDefault();const g=m.relatedTarget,y=m.currentTarget;if(g&&y.contains(g)){const b=g.closest("[data-drop-zone]");b&&b!==y&&s(!1);return}m.stopPropagation(),s(!1)},h=m=>{m.preventDefault();const y=m.currentTarget.querySelectorAll("[data-drop-zone]");for(const C of y){const w=C.getBoundingClientRect();if(m.clientX>=w.left&&m.clientX<=w.right&&m.clientY>=w.top&&m.clientY<=w.bottom){s(!1);return}}m.stopPropagation(),s(!1);const b=m.dataTransfer.getData("elementType");b&&(c(b,e,t),d(null))};return l.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?l.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}):l.jsx("div",{className:p("space-y-2 p-2"),children:o})})},ih=e=>{const t=xf(e);if(!t)return"📋";if(typeof t=="string")return t;const r=t;return l.jsx(r,{className:p("w-4 h-4 inline-block")})},ss=({element:e,isSelected:t,isHovered:r,onSelect:o,onHover:n,onDelete:a})=>{const s=()=>e.type==="group"?l.jsx(ch,{element:e}):e.type==="grid"?l.jsx(dh,{element:e}):e.type==="repeatGroup"?l.jsx(uh,{element:e}):l.jsx(Za,{element:e,isSelected:t}),i=e.type==="group"||e.type==="grid"||e.type==="repeatGroup";return l.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)&&l.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:[ih(e.type)," ",Mi(e.type)]}),(t||r)&&l.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:"×"}),s()]})},SE=({element:e,index:t,isSelected:r,isHovered:o,onSelect:n,onHover:a,onDelete:s,onDuplicate:i,onDragStart:c,onDragOver:d,onDragEnd:f,isDragTarget:u})=>{const h=()=>e.type==="group"?l.jsx(ch,{element:e}):e.type==="grid"?l.jsx(dh,{element:e}):e.type==="repeatGroup"?l.jsx(uh,{element:e}):e.type==="pages"?l.jsx(NE,{element:e}):l.jsx(Za,{element:e,isSelected:r}),m=b=>{b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("elementId",e.id),c(t)},g=b=>{b.preventDefault(),b.dataTransfer.dropEffect="move",d(t)},y=()=>{f()};return l.jsxs("div",{draggable:!0,onDragStart:m,onDragOver:g,onDragEnd:y,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&&l.jsx("div",{className:p("absolute -top-1 left-0 right-0 h-0.5 bg-blue-500 rounded")}),(r||o)&&l.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:[ih(e.type)," ",Mi(e.type)]}),(r||o)&&l.jsxs("div",{className:p("absolute -top-3 right-3 flex gap-1"),children:[l.jsx("button",{onClick:b=>{b.stopPropagation(),i()},className:p("p-1 bg-white border border-gray-200 rounded shadow-sm hover:bg-gray-50 text-xs"),title:"Duplicate",children:"📋"}),l.jsx("button",{onClick:b=>{b.stopPropagation(),s()},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)&&l.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:[l.jsx("div",{className:p("w-4 h-0.5 bg-gray-400 rounded")}),l.jsx("div",{className:p("w-4 h-0.5 bg-gray-400 rounded")}),l.jsx("div",{className:p("w-4 h-0.5 bg-gray-400 rounded")})]})]})},ch=({element:e})=>{var f;const t=e.properties.label||"Group",r=e.properties.description,o=R(u=>u.schema.elements),n=R(u=>u.selectedElementId),a=R(u=>u.hoveredElementId),s=R(u=>u.selectElement),i=R(u=>u.setHoveredElementId),c=R(u=>u.deleteElement),d=o.filter(u=>u.parentId===e.id).sort((u,h)=>u.order-h.order);return l.jsxs("div",{className:p("border border-gray-200 rounded-lg overflow-hidden"),style:{padding:((f=e.config)==null?void 0:f.padding)||16},children:[l.jsxs("div",{className:p("mb-3"),children:[l.jsx("h3",{className:p("font-medium text-gray-800"),children:t}),r&&l.jsx("p",{className:p("text-sm text-gray-500"),children:r})]}),l.jsx(En,{containerId:e.id,label:"Drop elements into this group",isEmpty:d.length===0,children:d.map(u=>l.jsx(ss,{element:u,isSelected:n===u.id,isHovered:a===u.id,onSelect:()=>s(u.id),onHover:h=>i(h?u.id:null),onDelete:()=>c(u.id)},u.id))})]})},dh=({element:e})=>{var f,u;const t=e.properties.label,r=((f=e.config)==null?void 0:f.gridColumns)||2,o=R(h=>h.schema.elements),n=R(h=>h.selectedElementId),a=R(h=>h.hoveredElementId),s=R(h=>h.selectElement),i=R(h=>h.setHoveredElementId),c=R(h=>h.deleteElement),d=o.filter(h=>h.parentId===e.id).sort((h,m)=>h.order-m.order);return l.jsxs("div",{className:p("border border-gray-200 rounded-lg p-4"),children:[t&&l.jsx("div",{className:p("mb-3"),children:l.jsx("h3",{className:p("font-medium text-gray-800"),children:t})}),l.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)=>l.jsx(En,{containerId:e.id,label:`Column ${m+1}`},m)):d.map(h=>l.jsx(ss,{element:h,isSelected:n===h.id,isHovered:a===h.id,onSelect:()=>s(h.id),onHover:m=>i(m?h.id:null),onDelete:()=>c(h.id)},h.id))}),d.length>0&&d.length<r*3&&l.jsx("div",{className:p("mt-3"),children:l.jsx(En,{containerId:e.id,label:"Add more elements"})})]})},uh=({element:e})=>{var f,u,h;const t=e.properties.label||"Repeat Group",r=e.properties.description,o=R(m=>m.schema.elements),n=R(m=>m.selectedElementId),a=R(m=>m.hoveredElementId),s=R(m=>m.selectElement),i=R(m=>m.setHoveredElementId),c=R(m=>m.deleteElement),d=o.filter(m=>m.parentId===e.id).sort((m,g)=>m.order-g.order);return l.jsxs("div",{className:p("border border-gray-200 rounded-lg p-4"),children:[l.jsxs("div",{className:p("mb-3"),children:[l.jsxs("div",{className:p("flex items-center gap-2"),children:[l.jsx("span",{className:p("text-lg"),children:"🔄"}),l.jsx("h3",{className:p("font-medium text-gray-800"),children:t})]}),r&&l.jsx("p",{className:p("text-sm text-gray-500"),children:r})]}),l.jsxs("div",{className:p("border border-dashed border-gray-300 rounded-lg p-3 bg-gray-50/50"),children:[l.jsx("div",{className:p("text-xs text-gray-500 mb-2 font-medium"),children:"📋 Item Template (will repeat)"}),l.jsx(En,{containerId:e.id,label:"Drop elements to create the repeatable template",isEmpty:d.length===0,children:d.map(m=>l.jsx(ss,{element:m,isSelected:n===m.id,isHovered:a===m.id,onSelect:()=>s(m.id),onHover:g=>i(g?m.id:null),onDelete:()=>c(m.id)},m.id))})]}),l.jsx("div",{className:p("mt-3"),children:l.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"]})}),l.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"]})]})},NE=({element:e})=>{var S,N,E,M;const t=R(k=>k.schema.elements),r=R(k=>k.selectedElementId),o=R(k=>k.hoveredElementId),n=R(k=>k.selectElement),a=R(k=>k.setHoveredElementId),s=R(k=>k.deleteElement),i=R(k=>k.addWizardStep),c=R(k=>k.updateWizardStep),d=R(k=>k.removeWizardStep),f=R(k=>k.setActiveWizardStep),u=((S=e.config)==null?void 0:S.steps)||[],h=((N=e.config)==null?void 0:N.activeStepId)||((E=u[0])==null?void 0:E.id),m=u.findIndex(k=>k.id===h),g=u[m],y=m===u.length-1,b=t.filter(k=>{var T;return k.parentId?k.parentId===`${e.id}:${h}`||k.parentId===e.id&&((T=k.config)==null?void 0:T.wizardStepId)===h:!1}).sort((k,T)=>k.order-T.order),C=()=>{const k={id:ha(),label:`Step ${u.length+1}`,description:""};i(e.id,k)},w=()=>{m>0&&f(e.id,u[m-1].id)},x=()=>{m<u.length-1&&f(e.id,u[m+1].id)};return l.jsxs("div",{className:p("border border-gray-200 rounded-lg overflow-hidden"),children:[l.jsxs("div",{className:p("bg-gray-50 border-b border-gray-200 p-3"),children:[l.jsxs("div",{className:p("flex items-center gap-2 mb-2"),children:[l.jsx("span",{className:p("text-lg"),children:"📑"}),l.jsx("h3",{className:p("font-medium text-gray-800"),children:e.properties.label||"Multi-Step Form"})]}),l.jsxs("div",{className:p("flex gap-1 flex-wrap"),children:[u.map((k,T)=>l.jsxs("button",{onClick:()=>f(e.id,k.id),className:p("px-3 py-1.5 text-sm rounded transition-colors",k.id===h?"bg-blue-500 text-white":"bg-white border border-gray-200 hover:bg-gray-100"),children:[T+1,". ",k.label]},k.id)),l.jsx("button",{onClick:C,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)&&l.jsxs("div",{className:p("mt-3"),children:[l.jsx("div",{className:p("h-2 bg-gray-200 rounded-full overflow-hidden"),children:l.jsx("div",{className:p("h-full bg-blue-500 transition-all"),style:{width:`${(m+1)/u.length*100}%`}})}),l.jsxs("div",{className:p("text-xs text-gray-500 mt-1"),children:["Step ",m+1," of ",u.length]})]})]}),l.jsx("div",{className:p("p-4"),children:g&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:p("mb-4"),children:[l.jsx("input",{type:"text",value:g.label,onChange:k=>c(e.id,h,{label:k.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"}),l.jsx("input",{type:"text",value:g.description||"",onChange:k=>c(e.id,h,{description:k.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)"})]}),l.jsx(En,{containerId:e.id,stepId:h,label:"Drop elements for this step",isEmpty:b.length===0,children:b.map(k=>l.jsx(ss,{element:k,isSelected:r===k.id,isHovered:o===k.id,onSelect:()=>n(k.id),onHover:T=>a(T?k.id:null),onDelete:()=>s(k.id)},k.id))}),l.jsxs("div",{className:p("flex justify-between mt-4 pt-4 border-t border-gray-200"),children:[l.jsx("button",{disabled:m===0,onClick:w,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"}),l.jsxs("div",{className:p("flex gap-2"),children:[u.length>1&&l.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"}),l.jsx("button",{disabled:y,onClick:x,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 →"})]})]})]})}),l.jsx("div",{className:p("px-4 pb-4"),children:l.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."]})})]})},EE=()=>l.jsxs("div",{className:p("flex flex-col items-center justify-center h-full text-muted-foreground"),children:[l.jsx("div",{className:p("text-6xl mb-4"),children:"📝"}),l.jsx("h3",{className:p("text-lg font-medium text-foreground/70 mb-2"),children:"Start Building Your Form"}),l.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."})]}),kE=({toolbarConfig:e})=>{const t=R($=>$.schema),r=R($=>$.selectedElementId),o=R($=>$.hoveredElementId),n=R($=>$.addElement),a=R($=>$.selectElement),s=R($=>$.deleteElement),i=R($=>$.duplicateElement),c=R($=>$.reorderElements),d=R($=>$.setHoveredElementId),f=R($=>$.undo),u=R($=>$.redo),h=R($=>$.canUndo),m=R($=>$.canRedo),g=R($=>$.exportSchema),y=R($=>$.loadSchema),b=R($=>$.resetForm),C=R($=>$.mode),w=R($=>$.setMode),x=R($=>$.hasWizard),[S,N]=D.useState(!1),[E,M]=D.useState(null),[k,T]=D.useState(null),A=x(),L=$=>{if($.preventDefault(),A){$.dataTransfer.dropEffect="none";return}$.dataTransfer.dropEffect="copy",N(!0)},O=$=>{$.currentTarget.contains($.relatedTarget)||N(!1)},F=$=>{if($.preventDefault(),N(!1),A)return;const q=$.dataTransfer.getData("elementType");q&&n(q)},V=()=>{const $=g(),q=new Blob([JSON.stringify($,null,2)],{type:"application/json"}),xe=URL.createObjectURL(q),oe=document.createElement("a");oe.href=xe,oe.download=`${t.title.replace(/\s+/g,"-").toLowerCase()}-schema.json`,document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),URL.revokeObjectURL(xe)},re=$=>{y($)},K=()=>{(t.elements.length===0||window.confirm("Are you sure you want to reset the form? This will delete all elements."))&&b()},H=$=>{$.target===$.currentTarget&&a(null)},ee=[...t.elements].filter($=>!$.parentId).sort(($,q)=>$.order-q.order),G=$=>{M($)},z=$=>{E!==null&&E!==$&&T($)},Ce=()=>{E!==null&&k!==null&&E!==k&&c(E,k),M(null),T(null)};return l.jsxs("div",{className:p("flex-1 flex flex-col bg-gray-100 overflow-hidden"),children:[l.jsx(CE,{schema:t,canUndo:h(),canRedo:m(),onUndo:f,onRedo:u,onExport:V,exportSchema:g,onImport:re,onReset:K,mode:C,onModeChange:w,toolbarConfig:e}),l.jsx("div",{className:p("flex-1 overflow-auto p-4",S&&!A?"bg-blue-50":""),onDragOver:L,onDragLeave:O,onDrop:F,onClick:H,children:l.jsxs("div",{className:p("max-w-4xl mx-auto p-2"),children:[l.jsx("div",{className:p("mb-0 text-center"),children:t.description&&l.jsx("p",{className:p("text-gray-500"),children:t.description})}),l.jsx("div",{className:p("bg-white rounded-xl shadow-sm border-2 transition-colors",S&&!A?"border-blue-400 border-dashed":"border-gray-200"),children:ee.length===0?l.jsx("div",{className:p("p-2"),children:l.jsx(EE,{})}):l.jsx("div",{className:p("p-4 space-y-2"),children:ee.map(($,q)=>l.jsx(SE,{element:$,index:q,isSelected:r===$.id,isHovered:o===$.id,onSelect:()=>a($.id),onHover:xe=>d(xe?$.id:null),onDelete:()=>s($.id),onDuplicate:()=>i($.id),onDragStart:G,onDragOver:z,onDragEnd:Ce,isDragTarget:k===q},$.id))})}),S&&!A&&l.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&&S&&l.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"})]})})]})},Ri=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296,66720,68912,68928,69734,69872,69942,70096,70384,70736,70864,71248,71360,71376,71386,71472,71904,72016,72688,72784,73040,73120,73184,73552,90416,92768,92864,93008,93552,118e3,120782,120792,120802,120812,120822,123200,123632,124144,124401,125264,130032],_E=e=>e.replace(new RegExp("\\p{Nd}","gu"),t=>{const r=t.codePointAt(0);if(r<=57)return t;let o=0,n=Ri.length-1;for(;o<n;){const a=o+n+1>>>1;Ri[a]<=r?o=a:n=a-1}return String(r-Ri[o])}),DE={"⁰":"0","¹":"1","²":"2","³":"3","⁴":"4","⁵":"5","⁶":"6","⁷":"7","⁸":"8","⁹":"9","₀":"0","₁":"1","₂":"2","₃":"3","₄":"4","₅":"5","₆":"6","₇":"7","₈":"8","₉":"9"},AE=/[⁰¹²³⁴⁵⁶⁷⁸⁹₀₁₂₃₄₅₆₇₈₉]/g,TE={"¼":"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/"},IE=/^(?=[-+]?\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)*)?$/,PE=/^(?=[-+]?\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)*)?(\s*[^.\d/].*)?/,ME=/([¼½¾⅐⅑⅒⅓⅔⅕⅖⅗⅘⅙⅚⅛⅜⅝⅞⅟}])/g,ls={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},OE={"Ⅰ":"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"},LE=/([ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅬⅭⅮⅯⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹⅺⅻⅼⅽⅾⅿ])/gi,FE=/^(?=[MDCLXVI])(M{0,3})(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$/i,ph={round:3,allowTrailingInvalid:!1,romanNumerals:!1,bigIntOnOverflow:!1,decimalSeparator:".",allowCurrency:!1,percentage:!1,verbose:!1},$E=e=>{const t=`${e}`.replace(LE,(i,c)=>OE[c]).toUpperCase(),r=FE.exec(t);if(!r)return NaN;const[,o,n,a,s]=r;return(ls[o]??0)+(ls[n]??0)+(ls[a]??0)+(ls[s]??0)},GE=/^\s*\//,VE=new RegExp("^([-+]?)\\s*(\\p{Sc}+)\\s*","u"),zE=new RegExp("\\s*(\\p{Sc}+)$","u"),BE=/%$/;function UE(e,t=ph){const r={...ph,...t},o=typeof e=="string"?e:`${e}`;let n,a,s,i,c,d,f,u;const h=A=>{const L={value:A,input:o};return n&&(L.currencyPrefix=n),a&&(L.currencySuffix=a),s&&(L.percentageSuffix=s),i&&(L.trailingInvalid=i),c&&(L.sign=c),d!==void 0&&(L.whole=d),f!==void 0&&(L.numerator=f),u!==void 0&&(L.denominator=u),L},m=A=>r.verbose?h(A):A;if(typeof e=="number"||typeof e=="bigint")return m(e);let g=NaN,y=o;if(r.allowCurrency){const A=VE.exec(y);A&&A[2]&&(n=A[2],y=(A[1]||"")+y.slice(A[0].length))}if(r.allowCurrency){const A=zE.exec(y);A&&(a=A[1],y=y.slice(0,-A[0].length))}r.percentage&&BE.test(y)&&(s=!0,y=y.slice(0,-1));const b=_E(y.replace(ME,(A,L)=>` ${TE[L]}`).replace(AE,A=>DE[A]).replace("⁄","/").trim());if(b.length===0)return m(NaN);let C=b;if(r.decimalSeparator===","){const A=(b.match(/,/g)||[]).length;if(A===1)C=b.replaceAll(".","_").replace(",",".");else if(A>1){if(!r.allowTrailingInvalid)return m(NaN);const L=b.indexOf(","),O=b.indexOf(",",L+1),F=b.substring(0,O).replaceAll(".","_").replace(",","."),V=b.substring(O+1);C=r.allowTrailingInvalid?F+"&"+V:F}else C=b.replaceAll(".","_")}const w=PE.exec(C);if(!w)return m(r.romanNumerals?$E(b):NaN);const x=(w[7]||C.slice(w[0].length)).trim();if(x&&(i=x,!r.allowTrailingInvalid))return m(NaN);const[,S,N,E]=w;(S==="-"||S==="+")&&(c=S);const M=N.replaceAll(",","").replaceAll("_",""),k=E==null?void 0:E.replaceAll(",","").replaceAll("_","");if(!M&&k&&k.startsWith("."))g=0;else{if(r.bigIntOnOverflow){const A=BigInt(S==="-"?`-${M}`:M);if(A>BigInt(Number.MAX_SAFE_INTEGER)||A<BigInt(Number.MIN_SAFE_INTEGER))return m(A)}g=parseInt(M)}if(!k)return g=S==="-"?g*-1:g,s&&r.percentage!=="number"&&(g=g/100),m(g);const T=r.round===!1?NaN:parseFloat(`1e${Math.floor(Math.max(0,r.round))}`);if(k.startsWith(".")||k.startsWith("e")||k.startsWith("E")){const A=parseFloat(`${g}${k}`);g=isNaN(T)?A:Math.round(A*T)/T}else if(GE.test(k)){const A=parseInt(M),L=parseInt(k.replace("/",""));f=A,u=L,g=isNaN(T)?A/L:Math.round(A*T/L)/T}else{const[A,L]=k.split("/").map(O=>parseInt(O));d=g,f=A,u=L,g+=isNaN(T)?A/L:Math.round(A*T/L)/T}return g=S==="-"?g*-1:g,s&&r.percentage!=="number"&&(g=isNaN(T)?g/100:Math.round(g/100*T)/T),m(g)}var fh=Symbol.for("immer-nothing"),hh=Symbol.for("immer-draftable"),Tt=Symbol.for("immer-state"),WE=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 zt(e,...t){if(process.env.NODE_ENV!=="production"){const r=WE[e],o=Co(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 Bt=Object,Qo=Bt.getPrototypeOf,is="constructor",cs="prototype",ec="configurable",ds="enumerable",us="writable",kn="value",wr=e=>!!e&&!!e[Tt];function Cr(e){var t;return e?gh(e)||hs(e)||!!e[hh]||!!((t=e[is])!=null&&t[hh])||ms(e)||gs(e):!1}var HE=Bt[cs][is].toString(),mh=new WeakMap;function gh(e){if(!e||!oc(e))return!1;const t=Qo(e);if(t===null||t===Bt[cs])return!0;const r=Bt.hasOwnProperty.call(t,is)&&t[is];if(r===Object)return!0;if(!Co(r))return!1;let o=mh.get(r);return o===void 0&&(o=Function.toString.call(r),mh.set(r,o)),o===HE}function ps(e,t,r=!0){_n(e)===0?(r?Reflect.ownKeys(e):Bt.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((o,n)=>t(n,o,e))}function _n(e){const t=e[Tt];return t?t.type_:hs(e)?1:ms(e)?2:gs(e)?3:0}var tc=(e,t,r=_n(e))=>r===2?e.has(t):Bt[cs].hasOwnProperty.call(e,t),rc=(e,t,r=_n(e))=>r===2?e.get(t):e[t],fs=(e,t,r,o=_n(e))=>{o===2?e.set(t,r):o===3?e.add(r):e[t]=r};function jE(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var hs=Array.isArray,ms=e=>e instanceof Map,gs=e=>e instanceof Set,oc=e=>typeof e=="object",Co=e=>typeof e=="function",nc=e=>typeof e=="boolean";function YE(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Fr=e=>e.copy_||e.base_,ac=e=>e.modified_?e.copy_:e.base_;function sc(e,t){if(ms(e))return new Map(e);if(gs(e))return new Set(e);if(hs(e))return Array[cs].slice.call(e);const r=gh(e);if(t===!0||t==="class_only"&&!r){const o=Bt.getOwnPropertyDescriptors(e);delete o[Tt];let n=Reflect.ownKeys(o);for(let a=0;a<n.length;a++){const s=n[a],i=o[s];i[us]===!1&&(i[us]=!0,i[ec]=!0),(i.get||i.set)&&(o[s]={[ec]:!0,[us]:!0,[ds]:i[ds],[kn]:e[s]})}return Bt.create(Qo(e),o)}else{const o=Qo(e);if(o!==null&&r)return{...e};const n=Bt.create(o);return Bt.assign(n,e)}}function lc(e,t=!1){return ys(e)||wr(e)||!Cr(e)||(_n(e)>1&&Bt.defineProperties(e,{set:bs,add:bs,clear:bs,delete:bs}),Bt.freeze(e),t&&ps(e,(r,o)=>{lc(o,!0)},!1)),e}function qE(){zt(2)}var bs={[kn]:qE};function ys(e){return e===null||!oc(e)?!0:Bt.isFrozen(e)}var vs="MapSet",ic="Patches",bh="ArrayMethods",yh={};function So(e){const t=yh[e];return t||zt(0,e),t}var vh=e=>!!yh[e],Dn,xh=()=>Dn,QE=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:vh(vs)?So(vs):void 0,arrayMethodsPlugin_:vh(bh)?So(bh):void 0});function wh(e,t){t&&(e.patchPlugin_=So(ic),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function cc(e){dc(e),e.drafts_.forEach(KE),e.drafts_=null}function dc(e){e===Dn&&(Dn=e.parent_)}var Ch=e=>Dn=QE(Dn,e);function KE(e){const t=e[Tt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Sh(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[Tt].modified_&&(cc(t),zt(4)),Cr(e)&&(e=Nh(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[Tt].base_,e,t)}else e=Nh(t,r);return XE(t,e,!0),cc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==fh?e:void 0}function Nh(e,t){if(ys(t))return t;const r=t[Tt];if(!r)return ws(t,e.handledSet_,e);if(!xs(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);_h(r,e)}return r.copy_}function XE(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&lc(t,r)}function Eh(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var xs=(e,t)=>e.scope_===t,JE=[];function kh(e,t,r,o){const n=Fr(e),a=e.type_;if(o!==void 0&&rc(n,o,a)===t){fs(n,o,r,a);return}if(!e.draftLocations_){const i=e.draftLocations_=new Map;ps(n,(c,d)=>{if(wr(d)){const f=i.get(d)||[];f.push(c),i.set(d,f)}})}const s=e.draftLocations_.get(t)??JE;for(const i of s)fs(n,i,r,a)}function ZE(e,t,r){e.callbacks_.push(function(n){var i;const a=t;if(!a||!xs(a,n))return;(i=n.mapSetPlugin_)==null||i.fixSetContents(a);const s=ac(a);kh(e,a.draft_??a,s,r),_h(a,n)})}function _h(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)}Eh(e)}}function RE(e,t,r){const{scope_:o}=e;if(wr(r)){const n=r[Tt];xs(n,o)&&n.callbacks_.push(function(){Ss(e);const s=ac(n);kh(e,r,s,t)})}else Cr(r)&&e.callbacks_.push(function(){const a=Fr(e);e.type_===3?a.has(r)&&ws(r,o.handledSet_,o):rc(a,t,e.type_)===r&&o.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&ws(rc(e.copy_,t,e.type_),o.handledSet_,o)})}function ws(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||wr(e)||t.has(e)||!Cr(e)||ys(e)||(t.add(e),ps(e,(o,n)=>{if(wr(n)){const a=n[Tt];if(xs(a,r)){const s=ac(a);fs(e,o,s,e.type_),Eh(a)}}else Cr(n)&&ws(n,t,r)})),e}function ek(e,t){const r=hs(e),o={type_:r?1:0,scope_:t?t.scope_:xh(),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=Cs;r&&(n=[o],a=An);const{revoke:s,proxy:i}=Proxy.revocable(n,a);return o.draft_=i,o.revoke_=s,[i,o]}var Cs={get(e,t){if(t===Tt)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=Fr(e);if(!tc(n,t,e.type_))return rk(e,n,t);const a=n[t];if(e.finalized_||!Cr(a)||o&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&YE(t))return a;if(a===uc(e.base_,t)||tk(e,t,a)){Ss(e);const s=e.type_===1?+t:t,i=fc(e.scope_,a,e,s);return e.copy_[s]=i}return a},has(e,t){return t in Fr(e)},ownKeys(e){return Reflect.ownKeys(Fr(e))},set(e,t,r){const o=Dh(Fr(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const n=uc(Fr(e),t),a=n==null?void 0:n[Tt];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(jE(r,n)&&(r!==void 0||tc(e.base_,t,e.type_)))return!0;Ss(e),pc(e)}return e.copy_[t]===r&&(r!==void 0||tc(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),RE(e,t,r)),!0},deleteProperty(e,t){return Ss(e),uc(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),pc(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Fr(e),o=Reflect.getOwnPropertyDescriptor(r,t);return o&&{[us]:!0,[ec]:e.type_!==1||t!=="length",[ds]:o[ds],[kn]:r[t]}},defineProperty(){zt(11)},getPrototypeOf(e){return Qo(e.base_)},setPrototypeOf(){zt(12)}},An={};for(let e in Cs){let t=Cs[e];An[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}An.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&zt(13),An.set.call(this,e,t,void 0)},An.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&zt(14),Cs.set.call(this,e[0],t,r,e[0])};function uc(e,t){const r=e[Tt];return(r?Fr(r):e)[t]}function tk(e,t,r){var o;return e.type_!==1||!e.allIndicesReassigned_||(o=e.assigned_)!=null&&o.get(t)||!Cr(r)||r[Tt]?!1:e.baseRefs_.has(r)}function rk(e,t,r){var n;const o=Dh(t,r);return o?kn in o?o[kn]:(n=o.get)==null?void 0:n.call(e.draft_):void 0}function Dh(e,t){if(!(t in e))return;let r=Qo(e);for(;r;){const o=Object.getOwnPropertyDescriptor(r,t);if(o)return o;r=Qo(r)}}function pc(e){e.modified_||(e.modified_=!0,e.parent_&&pc(e.parent_))}function Ss(e){e.copy_||(e.assigned_=new Map,e.copy_=sc(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var ok=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,o,n)=>{if(Co(r)&&!Co(o)){const s=o;o=r;const i=this;return function(d=s,...f){return i.produce(d,u=>o.call(this,u,...f))}}Co(o)||zt(6),n!==void 0&&!Co(n)&&zt(7);let a;if(Cr(r)){const s=Ch(this),i=fc(s,r,void 0);let c=!0;try{a=o(i),c=!1}finally{c?cc(s):dc(s)}return wh(s,n),Sh(a,s)}else if(!r||!oc(r)){if(a=o(r),a===void 0&&(a=r),a===fh&&(a=void 0),this.autoFreeze_&&lc(a,!0),n){const s=[],i=[];So(ic).generateReplacementPatches_(r,a,{patches_:s,inversePatches_:i}),n(s,i)}return a}else zt(1,r)},this.produceWithPatches=(r,o)=>{if(Co(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]},nc(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),nc(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),nc(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Cr(t)||zt(8),wr(t)&&(t=hc(t));const r=Ch(this),o=fc(r,t,void 0);return o[Tt].isManual_=!0,dc(r),o}finishDraft(t,r){const o=t&&t[Tt];(!o||!o.isManual_)&&zt(9);const{scope_:n}=o;return wh(n,r),Sh(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=So(ic).applyPatches_;return wr(t)?n(t,r):this.produce(t,a=>n(a,r))}};function fc(e,t,r,o){const[n,a]=ms(t)?So(vs).proxyMap_(t,r):gs(t)?So(vs).proxySet_(t,r):ek(t,r);return((r==null?void 0:r.scope_)??xh()).drafts_.push(n),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=o,r&&o!==void 0?ZE(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 hc(e){return wr(e)||zt(10,e),Ah(e)}function Ah(e){if(!Cr(e)||ys(e))return e;const t=e[Tt];let r,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=sc(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else r=sc(e,!0);return ps(r,(n,a)=>{fs(r,n,Ah(a))},o),t&&(t.finalized_=!1),r}var nk=new ok,Tn=nk.produce;const Xr="------",We={fields:{title:"Field",placeholderName:"~",placeholderLabel:Xr,placeholderGroupLabel:Xr},operators:{title:"Operator",placeholderName:"~",placeholderLabel:Xr,placeholderGroupLabel:Xr},values:{title:"Values",placeholderName:"~",placeholderLabel:Xr,placeholderGroupLabel:Xr},matchMode:{title:"Match mode"},matchThreshold:{title:"Match threshold",placeholderName:"#"},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"}},Th={"=":"=","!=":"!=","<":"<",">":">","<=":"<=",">=":">=",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"},ak={and:"AND",or:"OR",xor:"XOR"},sk=[{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"}],In=[{name:"and",value:"and",label:"AND"},{name:"or",value:"or",label:"OR"}];[...In];const Ih=[{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"}],me={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"},ge={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"},ht={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"},Ph=[],lk={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},ik=(e,t=",")=>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)],[]):[],Ns=(e,t=",")=>e.map(r=>`${r??""}`.replaceAll(t[0],`\\${t[0]}`)).join(t),ck=e=>typeof e=="string"?e.trim():e,Es=(e,{retainEmptyStrings:t}={})=>Array.isArray(e)?e.map(ck):typeof e=="string"?ik(e,",").filter(t?()=>!0:r=>!/^\s*$/.test(r)).map(r=>r.trim()):typeof e=="number"?[e]:[];function Mh(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=Mh(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function Oe(){for(var e,t,r=0,o="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=Mh(e))&&(o&&(o+=" "),o+=t);return o}const No=e=>typeof e=="string"?e.toLowerCase():e;new RegExp(IE.source.replace(/^\^/,String.raw`^\s*`).replace(/\$$/,String.raw`\s*$`));const Jr=e=>e!==null&&typeof e=="object"&&Object.getPrototypeOf(e)===Object.prototype,Xe=e=>Jr(e)&&Array.isArray(e.rules),Pn=e=>Xe(e)&&typeof e.combinator=="string",Mn=e=>Xe(e)&&e.combinator===void 0,dk=Object.keys,Oh=Object.entries,Lh=e=>e==="__proto__"||e==="constructor"||e==="prototype",mc=e=>Jr(e)&&"name"in e&&typeof e.name=="string",gc=e=>Jr(e)&&"value"in e&&typeof e.value=="string";function Sr(e,t,r){if(typeof e=="string")return{...t,name:e,value:e,label:(r==null?void 0:r[e])??e};const o={};let n=!!t;return mc(e)&&!gc(e)?(o.value=e.name,n=!0):!mc(e)&&gc(e)&&(o.name=e.value,n=!0),n?Object.assign({},t,e,o):e}function ks(e,t,r){if(!Array.isArray(e))return[];const o=e;return Zr(o)?o.map(n=>({...n,options:n.options.map(a=>Sr(a,t,r))})):o.map(n=>Sr(n,t,r))}function Fh(e,t){return Object.fromEntries(Object.entries(e).map(([r,o])=>[r,Sr(o,t)]))}const $h=e=>{const t=new Set,r=[];for(const o of e)t.has(o.value??o.name)||(t.add(o.value??o.name),r.push(o));return e.length===r.length?e:r},uk=e=>Array.isArray(e)&&e.length>0&&Jr(e[0])&&"options"in e[0]&&Array.isArray(e[0].options),_s=e=>{let t=!1;if(Array.isArray(e))for(const r of e)if(mc(r)||gc(r))t=!0;else return!1;return t},Zr=(e,{allowEmpty:t=!1}={})=>{let r=!1;if(Array.isArray(e))for(const o of e)if(Jr(o)&&"options"in o&&(_s(o.options)||t&&Array.isArray(o.options)&&o.options.length===0))r=!0;else return!1;return r};function Ko(e,t){return(Zr(e,{allowEmpty:!0})?e.flatMap(r=>r.options):e).find(r=>r.value===t||r.name===t)}function xt(e){if(!Array.isArray(e)||e.length===0)return null;if(Zr(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 Gh=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 s of n.options)r.has(s.value??s.name)||(r.add(s.value??s.name),a.push(Sr(s)));o.push({...n,options:a})}return o},Xo=e=>{const{optionList:t,baseOption:r={},labelMap:o={},placeholder:{placeholderName:n="~",placeholderLabel:a=Xr,placeholderGroupLabel:s=Xr}={},autoSelectOption:i=!0}=e,c={id:n,name:n,value:n,label:a},d=t??[c];let f;const u=Array.isArray(d)?ks(d,r,o):dk(Fh(d,r)).map(m=>({...d[m],name:m,value:m})).sort((m,g)=>m.label.localeCompare(g.label));Zr(u)?f=Gh(i?u:[{label:s,options:[c]},...u]):f=$h(i?u:[c,...u]);let h={};if(Array.isArray(d))if(Zr(f))for(const m of f)for(const g of m.options)h[g.value??g.name]=Sr(g,r);else for(const m of f)h[m.value??m.name]=Sr(m,r);else{const m=Fh(d,r);h=i?m:{...m,[n]:c}}return{defaultOption:c,optionList:f,optionsMap:h}},Vh=(e,t,r)=>{var a;const o=Sr(e),n=Sr(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},zh=(e,t,r)=>{if(!e.comparator){const o=n=>(n.value??n.name)!==(e.value??e.name);return Zr(t)?t.map(n=>({...n,options:n.options.filter(a=>o(a))})):t.filter(n=>o(n))}return Zr(t)?t.map(o=>({...o,options:o.options.filter(n=>Vh(e,r,n))})).filter(o=>o.options.length>0):t.filter(o=>Vh(e,r,o))},Ds=(e,{parseNumbers:t,bigIntOnOverflow:r}={})=>{if(!t||typeof e=="bigint"||typeof e=="number")return e;if(t==="native")return Number.parseFloat(e);const o=UE(e,{allowTrailingInvalid:t==="enhanced",bigIntOnOverflow:r,romanNumerals:!1,round:!1});return typeof o=="bigint"||!Number.isNaN(o)?o:e},pk=({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},fk=e=>{const{mode:t,threshold:r}=e.match??{};if(!t)return null;if(!Xe(e.value))return!1;const o=No(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}},ut=(e,t)=>{let r=t,o=0;for(;o<e.length&&r&&Xe(r);){const n=r.rules[e[o]];r=typeof n=="string"?null:n,o++}return o<e.length?null:r},Bh=(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(Xe(r)){const o=Bh(e,r);if(o)return o}}return null},Jo=(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(Xe(n)){const a=Jo(e,n);if(Array.isArray(a))return[Number.parseInt(o),...a]}return null},at=e=>e.slice(0,-1),Eo=(e,t)=>e.length===t.length&&e.every((r,o)=>r===t[o]),Uh=(e,t)=>{const r=[],o=at(e),n=at(t);let a=0;for(;a<o.length&&a<n.length&&o[a]===n[a];)r.push(n[a]),a++;return r},Zo=(e,t)=>{let r=!!t.disabled,o=t,n=0;for(;n<e.length&&!r&&Xe(o);){const a=o.rules[e[n]];Jr(a)&&(Xe(a)||"field"in a&&a.field)&&(r=!!a.disabled,o=a),n++}return r},hk=e=>Eo([],e.path)?"Query builder":`Rule group at path ${e.path.join("-")}`,On=globalThis.crypto;let Xt=()=>"00-0-4-2-000".replaceAll(/[^-]/g,e=>((Math.random()+Math.trunc(e))*65536>>Number.parseInt(e)).toString(16).padStart(4,"0"));if(On){if(typeof On.randomUUID=="function")Xt=()=>On.randomUUID();else if(typeof On.getRandomValues=="function"){const e="89ab",t=new Uint32Array(32);Xt=()=>{On.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 mk={name:"name",value:"name",matchModes:null,label:"label"},gk=(e,t)=>{const r=e?Sr(e):mk;let o=r.matchModes??!1;return!o&&t&&(o=t(r.value,{fieldData:r})),o===!0?Ih:o===!1?[]:_s(o)?ks(o):(o==null?void 0:o.map(n=>Ih.find(a=>a.value===No(n))??{name:n,value:n,label:n}))??[]},Wh=(e,t,r)=>{const o=xt(e);if(t.operator==="between"||t.operator==="notBetween"){const n=[o,o];return r?n:Ns(n.map(a=>a??""),",")}return o},bk=(e,t)=>{const{fieldData:r,fields:o,getValueEditorType:n,getValues:a,getDefaultValue:s,getParameters:i,listsAsArrays:c}=t;if((r==null?void 0:r.defaultValue)!==void 0&&r.defaultValue!==null)return r.defaultValue;if(s)return s(e,{fieldData:r});let d="";const f=a(e.field,e.operator,{fieldData:r});if(e.valueSource==="field"){const u=zh(r,o,e.operator);d=u.length>0?Wh(u,e,c):""}else if(e.valueSource==="parameter"){const u=i?i(e.field,e.operator,{fieldData:r}):null;d=u&&u.length>0?xt(u):""}else if(f.length>0){const u=n(e.field,e.operator,{fieldData:r});u==="multiselect"?d=c?[]:"":(u==="select"||u==="radio")&&(d=Wh(f,e,c))}else n(e.field,e.operator,{fieldData:r})==="checkbox"&&(d=!1);return d},Hh=e=>{const t=typeof e=="boolean"?e:typeof e=="object"&&e!==null?e.valid:null;return typeof t=="boolean"?t?me.valid:me.invalid:""},jh=[{name:"value",value:"value",label:"value"}],yk={name:"name",value:"name",valueSources:null,label:"label"},Yh=(e,t,r)=>{const o=e?Sr(e):yk;let n=o.valueSources??!1;return typeof n=="function"&&(n=n(t)),!n&&r&&(n=r(o.value,t,{fieldData:o})),n?_s(n)?ks(n):n.map(a=>jh.find(s=>s.value===No(a))??{name:a,value:a,label:a}):jh},He=(e,t,r)=>{if(Lh(e))return;const o=Oh(t).map(([n,[a,s]])=>{var i;return[n,a??s??((i=r==null?void 0:r[e])==null?void 0:i[n])]}).filter(n=>!Lh(n[0])&&!!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}}},ve=(e,t)=>{var o;let r="";for(let n=0;n<t.length;n++){const a=(o=t[n])==null?void 0:o[e];if(!a)continue;const s=typeof a=="string"?a:Oe(a);s&&(r=r?`${r} ${s}`:s)}return r},vk=(...e)=>({queryBuilder:ve("queryBuilder",e),ruleGroup:ve("ruleGroup",e),header:ve("header",e),body:ve("body",e),combinators:ve("combinators",e),addRule:ve("addRule",e),addGroup:ve("addGroup",e),cloneRule:ve("cloneRule",e),cloneGroup:ve("cloneGroup",e),removeGroup:ve("removeGroup",e),rule:ve("rule",e),fields:ve("fields",e),operators:ve("operators",e),value:ve("value",e),removeRule:ve("removeRule",e),notToggle:ve("notToggle",e),shiftActions:ve("shiftActions",e),dragHandle:ve("dragHandle",e),lockRule:ve("lockRule",e),lockGroup:ve("lockGroup",e),muteRule:ve("muteRule",e),muteGroup:ve("muteGroup",e),muted:ve("muted",e),valueSource:ve("valueSource",e),actionElement:ve("actionElement",e),valueSelector:ve("valueSelector",e),betweenRules:ve("betweenRules",e),valid:ve("valid",e),invalid:ve("invalid",e),dndDragging:ve("dndDragging",e),dndOver:ve("dndOver",e),dndCopy:ve("dndCopy",e),dndGroup:ve("dndGroup",e),dndDropNotAllowed:ve("dndDropNotAllowed",e),dndPreviewPosition:ve("dndPreviewPosition",e),dndHidden:ve("dndHidden",e),disabled:ve("disabled",e),valueListItem:ve("valueListItem",e),matchMode:ve("matchMode",e),matchThreshold:ve("matchThreshold",e),branches:ve("branches",e),hasSubQuery:ve("hasSubQuery",e),loading:ve("loading",e),valueDateTimeRelative:ve("valueDateTimeRelative",e)}),xk=(e,t)=>e===!1?!1:e?!0:t!==!1,wk=(e,t)=>e?!0:e===!1?!1:!!t,qh=(e,t,r,o)=>o?t??r:e?xk(t,r):wk(t,r),Ck=(e={},t={},r)=>Oh(lk).reduce((o,[n,a])=>(o[n]=qh(a,e[n],t[n],!1),o),{}),Qh=(e,{idGenerator:t=Xt}={})=>{const r=!e.id,o=fk(e);return!r&&!o?e:{...e,...r&&{id:t()},...o&&{value:As(e.value,{idGenerator:t})}}},As=(e,{idGenerator:t=Xt}={})=>{const r=!e.id;let o=!1;const n=[];for(let a=0;a<e.rules.length;a++){const s=e.rules[a];if(typeof s=="string")n.push(s);else{const i=Xe(s)?As(s,{idGenerator:t}):Qh(s,{idGenerator:t});n.push(i),i!==s&&(o=!0)}}return!r&&!o?e:{...e,...r&&{id:t()},rules:n}},Kh=(e,{idGenerator:t=Xt}={})=>Xe(e)?As(e,{idGenerator:t}):Qh(e,{idGenerator:t}),Sk=(e,{idGenerator:t=Xt}={})=>structuredClone({...e,id:t()}),bc=(e,{idGenerator:t=Xt}={})=>{if(!Jr(e))return e;if(!Xe(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:Xe(o)?bc(o,{idGenerator:t}):Sk(o,{idGenerator:t}))),r},Xh=(e,t,r,o={})=>Tn(e,n=>Nk(n,t,r,o)),Nk=(e,t,r,o={})=>{const{combinators:n=In,combinatorPreceding:a,idGenerator:s=Xt}=o,i=Array.isArray(r)?ut(r,e):Bh(r,e);if(!i||!Xe(i))return e;if(Mn(i)&&i.rules.length>0){const c=i.rules.at(-2);i.rules.push(a??(typeof c=="string"?c:xt(n)))}return i.rules.push(Kh(t,{idGenerator:s})),e},Jh={field:0,operator:1,valueSource:2,value:4},Zh=e=>e.sort((t,r)=>(Jh[t[0]]??3)-(Jh[r[0]]??3)),Ek=(e,t,r,o)=>{if(typeof e=="string")return{entries:[[e,t]],pathOrID:r,options:o??{}};if(Array.isArray(e)){const n=t;return{entries:Zh(e.map((a,s)=>[a,n[s]])),pathOrID:r,options:o??{}}}return{entries:Zh(Object.entries(e)),pathOrID:t,options:r??{}}},kk=(e,t,r,o,n)=>{const{entries:a,pathOrID:s,options:i}=Ek(t,r,o,n);for(const[c,d]of a)Dk(e,c,d,s,i);return e},_k=((e,t,r,o,n)=>Tn(e,a=>{kk(a,t,r,o,n)})),Dk=(e,t,r,o,n={})=>{var w;const{resetOnFieldChange:a=!0,resetOnOperatorChange:s=!1,getRuleDefaultOperator:i=()=>"=",getValueSources:c=()=>["value"],getRuleDefaultValue:d=()=>"",getMatchModes:f=()=>[]}=n;let u=a;const h=Array.isArray(o)?o:Jo(o,e);if(!h)return e;if(t==="combinator"&&!Pn(e)){const x=ut(at(h),e).rules;return h.at(-1)%2===1&&(x[h.at(-1)]=r),e}const m=ut(h,e);if(!m)return e;const g=Xe(m);if(m[t]===r||(t!=="valueSource"&&(m[t]=r),g))return e;let y=!1,b=!1;if(t==="field"){const x=f(m.field),S=f(r);if(S.length===0)delete m.match;else{const N=(w=m.match)!=null&&w.mode&&Ko(S,m.match.mode)?null:xt(S);N&&(m.match={mode:N,threshold:1})}(x.length>0||S.length>0)&&(u=!0)}u&&t==="field"&&(m.operator=i(r),y=!0,b=!0),s&&t==="operator"&&(y=!0,b=!0);const C=xt(Yh({name:m.field,value:m.field,label:""},m.operator,c));return(y&&m.valueSource&&C!==m.valueSource||t==="valueSource"&&r!==m.valueSource)&&(b=!!m.valueSource||!m.valueSource&&r!==C,m.valueSource=y?C:r),b&&(m.value=d(m)),e},Ak=(e,t)=>Tn(e,r=>Tk(r,t)),Tk=(e,t)=>{const r=Array.isArray(t)?t:Jo(t,e);if(!r||r.length===0||!Pn(e)&&!ut(r,e))return e;const o=r.at(-1),n=ut(at(r),e);if(n&&Xe(n))if(!Pn(n)&&n.rules.length>1){const a=o===0?0:o-1;n.rules.splice(a,2)}else n.rules.splice(o,1);return e},Rh=(e,t,r)=>{if(Array.isArray(r))return r;const o=Mn(e);if(r==="up"){if(Eo(t,[0]))return t;if(t.at(-1)===0){const n=at(t);return[...at(n),Math.max(0,n.at(-1)-(o?1:0))]}else{const n=[...at(t),Math.max(0,t.at(-1)-(o?2:1))],a=ut(n,e);return Xe(a)?[...n,a.rules.length]:[...at(t),Math.max(0,t.at(-1)-(o?3:1))]}}else if(r==="down"){if(Eo([e.rules.length-1],t))return t;if(t.at(-1)===ut(at(t),e).rules.length-1){const n=at(t);return[...at(n),n.at(-1)+1]}else{const n=[...at(t),t.at(-1)+(o?2:1)];return Xe(ut(n,e))?[...n,0]:[...at(t),t.at(-1)+(o?3:2)]}}return t},Ik=(e,t,r,o={})=>Tn(e,n=>Pk(n,t,r,o)),Pk=(e,t,r,o={})=>{const{clone:n=!1,combinators:a=In,idGenerator:s=Xt}=o,i=Array.isArray(t)?t:Jo(t,e);if(!i)return e;const c=Rh(e,i,r);if(i.length===0||Eo(i,c)||!ut(at(c),e))return e;const d=ut(i,e);if(!d)return e;const f=n?bc(wr(d)?hc(d):d,{idGenerator:s}):d,u=Mn(e),h=ut(at(i),e),m=i.at(-1),g=u&&m>0?h.rules[m-1]:null,y=u&&m<h.rules.length-1?h.rules[m+1]:null;if(!n){const N=u?Math.max(0,m-1):m,E=u?2:1;h.rules.splice(N,E)}const b=[...c],C=Uh(i,c);!n&&i.length===C.length+1&&c[C.length]>i[C.length]&&(b[C.length]-=u?2:1);const w=ut(at(b),e),x=b.at(-1),S=(...N)=>w.rules.splice(x,0,...N);return w.rules.length===0||!u?S(f):x===0?m===0&&y?S(f,y):S(f,w.rules[1]??g??xt(a)):S(g||(w.rules[x-2]??y??xt(a)),f),e},Mk=(e,t,r,o={})=>Tn(e,n=>Ok(n,t,r,o)),Ok=(e,t,r,o={})=>{const{clone:n=!1,combinators:a=In,idGenerator:s=Xt}=o,i=Array.isArray(t)?t:Jo(t,e),c=Array.isArray(r)?r:Jo(r,e);if(!i||!c)return e;const d=Rh(e,i,c);if(i.length===0||Eo(i,d)||!ut(at(d),e))return e;const f=ut(i,e),u=ut(c,e);if(!f||!u)return e;const h=n?bc(wr(f)?hc(f):f,{idGenerator:s}):f,m=Mn(e),g=ut(at(i),e),y=i.at(-1);if(!n){const S=m?Math.max(0,y-1):y,N=m?2:1;g.rules.splice(S,N)}const b=[...d],C=Uh(i,d);!n&&i.length===C.length+1&&d[C.length]>i[C.length]&&(b[C.length]-=m?2:1);const w=ut(at(b),e),x=b.at(-1);return w.rules.splice(x,1,Kh(m?{rules:[u,xt(a),h]}:{combinator:xt(a),rules:[u,h]},{idGenerator:s})),e};function St(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 Lk=typeof Symbol=="function"&&Symbol.observable||"@@observable",em=Lk,yc=()=>Math.random().toString(36).substring(7).split("").join("."),Fk={INIT:`@@redux/INIT${yc()}`,REPLACE:`@@redux/REPLACE${yc()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${yc()}`},ko=Fk;function Ln(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 $k(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(zk(e))return"date";if(Vk(e))return"error";const r=Gk(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 Gk(e){return typeof e.constructor=="function"?e.constructor.name:null}function Vk(e){return e instanceof Error||typeof e.message=="string"&&e.constructor&&typeof e.constructor.stackTraceLimit=="number"}function zk(e){return e instanceof Date?!0:typeof e.toDateString=="function"&&typeof e.getDate=="function"&&typeof e.setDate=="function"}function Rr(e){let t=typeof e;return process.env.NODE_ENV!=="production"&&(t=$k(e)),t}function tm(e,t,r){if(typeof e!="function")throw new Error(process.env.NODE_ENV==="production"?St(2):`Expected the root reducer to be a function. Instead, received: '${Rr(e)}'`);if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(process.env.NODE_ENV==="production"?St(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"?St(1):`Expected the enhancer to be a function. Instead, received: '${Rr(r)}'`);return r(tm)(e,t)}let o=e,n=t,a=new Map,s=a,i=0,c=!1;function d(){s===a&&(s=new Map,a.forEach((b,C)=>{s.set(C,b)}))}function f(){if(c)throw new Error(process.env.NODE_ENV==="production"?St(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(b){if(typeof b!="function")throw new Error(process.env.NODE_ENV==="production"?St(4):`Expected the listener to be a function. Instead, received: '${Rr(b)}'`);if(c)throw new Error(process.env.NODE_ENV==="production"?St(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 C=!0;d();const w=i++;return s.set(w,b),function(){if(C){if(c)throw new Error(process.env.NODE_ENV==="production"?St(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.");C=!1,d(),s.delete(w),a=null}}}function h(b){if(!Ln(b))throw new Error(process.env.NODE_ENV==="production"?St(7):`Actions must be plain objects. Instead, the actual type was: '${Rr(b)}'. 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 b.type>"u")throw new Error(process.env.NODE_ENV==="production"?St(8):'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.');if(typeof b.type!="string")throw new Error(process.env.NODE_ENV==="production"?St(17):`Action "type" property must be a string. Instead, the actual type was: '${Rr(b.type)}'. Value was: '${b.type}' (stringified)`);if(c)throw new Error(process.env.NODE_ENV==="production"?St(9):"Reducers may not dispatch actions.");try{c=!0,n=o(n,b)}finally{c=!1}return(a=s).forEach(w=>{w()}),b}function m(b){if(typeof b!="function")throw new Error(process.env.NODE_ENV==="production"?St(10):`Expected the nextReducer to be a function. Instead, received: '${Rr(b)}`);o=b,h({type:ko.REPLACE})}function g(){const b=u;return{subscribe(C){if(typeof C!="object"||C===null)throw new Error(process.env.NODE_ENV==="production"?St(11):`Expected the observer to be an object. Instead, received: '${Rr(C)}'`);function w(){const S=C;S.next&&S.next(f())}return w(),{unsubscribe:b(w)}},[em](){return this}}}return h({type:ko.INIT}),{dispatch:h,subscribe:u,getState:f,replaceReducer:m,[em]:g}}function rm(e){typeof console<"u"&&typeof console.error=="function"&&console.error(e);try{throw new Error(e)}catch{}}function Bk(e,t,r,o){const n=Object.keys(t),a=r&&r.type===ko.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(!Ln(e))return`The ${a} has unexpected type of "${Rr(e)}". Expected argument to be an object with the following keys: "${n.join('", "')}"`;const s=Object.keys(e).filter(i=>!t.hasOwnProperty(i)&&!o[i]);if(s.forEach(i=>{o[i]=!0}),!(r&&r.type===ko.REPLACE)&&s.length>0)return`Unexpected ${s.length>1?"keys":"key"} "${s.join('", "')}" found in ${a}. Expected to find one of the known reducer keys instead: "${n.join('", "')}". Unexpected keys will be ignored.`}function Uk(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:ko.INIT})>"u")throw new Error(process.env.NODE_ENV==="production"?St(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:ko.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(process.env.NODE_ENV==="production"?St(13):`The slice reducer for key "${t}" returned undefined when probed with a random type. Don't try to handle '${ko.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 om(e){const t=Object.keys(e),r={};for(let s=0;s<t.length;s++){const i=t[s];process.env.NODE_ENV!=="production"&&typeof e[i]>"u"&&rm(`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{Uk(r)}catch(s){a=s}return function(i={},c){if(a)throw a;if(process.env.NODE_ENV!=="production"){const u=Bk(i,r,c,n);u&&rm(u)}let d=!1;const f={};for(let u=0;u<o.length;u++){const h=o[u],m=r[h],g=i[h],y=m(g,c);if(typeof y>"u"){const b=c&&c.type;throw new Error(process.env.NODE_ENV==="production"?St(14):`When called with an action of type ${b?`"${String(b)}"`:"(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]=y,d=d||y!==g}return d=d||o.length!==Object.keys(i).length,d?f:i}}function Ts(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...o)=>t(r(...o)))}function Wk(...e){return t=>(r,o)=>{const n=t(r,o);let a=()=>{throw new Error(process.env.NODE_ENV==="production"?St(15):"Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.")};const s={getState:n.getState,dispatch:(c,...d)=>a(c,...d)},i=e.map(c=>c(s));return a=Ts(...i)(n.dispatch),{...n,dispatch:a}}}function nm(e){return Ln(e)&&"type"in e&&typeof e.type=="string"}var am=Symbol.for("immer-nothing"),sm=Symbol.for("immer-draftable"),It=Symbol.for("immer-state"),Hk=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 Ut(e,...t){if(process.env.NODE_ENV!=="production"){const r=Hk[e],o=_o(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 Wt=Object,Ro=Wt.getPrototypeOf,Is="constructor",Ps="prototype",vc="configurable",Ms="enumerable",Os="writable",Fn="value",$r=e=>!!e&&!!e[It];function Jt(e){var t;return e?im(e)||$s(e)||!!e[sm]||!!((t=e[Is])!=null&&t[sm])||Gs(e)||Vs(e):!1}var jk=Wt[Ps][Is].toString(),lm=new WeakMap;function im(e){if(!e||!Cc(e))return!1;const t=Ro(e);if(t===null||t===Wt[Ps])return!0;const r=Wt.hasOwnProperty.call(t,Is)&&t[Is];if(r===Object)return!0;if(!_o(r))return!1;let o=lm.get(r);return o===void 0&&(o=Function.toString.call(r),lm.set(r,o)),o===jk}function Ls(e,t,r=!0){$n(e)===0?(r?Reflect.ownKeys(e):Wt.keys(e)).forEach(n=>{t(n,e[n],e)}):e.forEach((o,n)=>t(n,o,e))}function $n(e){const t=e[It];return t?t.type_:$s(e)?1:Gs(e)?2:Vs(e)?3:0}var xc=(e,t,r=$n(e))=>r===2?e.has(t):Wt[Ps].hasOwnProperty.call(e,t),wc=(e,t,r=$n(e))=>r===2?e.get(t):e[t],Fs=(e,t,r,o=$n(e))=>{o===2?e.set(t,r):o===3?e.add(r):e[t]=r};function Yk(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var $s=Array.isArray,Gs=e=>e instanceof Map,Vs=e=>e instanceof Set,Cc=e=>typeof e=="object",_o=e=>typeof e=="function",Sc=e=>typeof e=="boolean";function qk(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Gr=e=>e.copy_||e.base_,Nc=e=>e.modified_?e.copy_:e.base_;function Ec(e,t){if(Gs(e))return new Map(e);if(Vs(e))return new Set(e);if($s(e))return Array[Ps].slice.call(e);const r=im(e);if(t===!0||t==="class_only"&&!r){const o=Wt.getOwnPropertyDescriptors(e);delete o[It];let n=Reflect.ownKeys(o);for(let a=0;a<n.length;a++){const s=n[a],i=o[s];i[Os]===!1&&(i[Os]=!0,i[vc]=!0),(i.get||i.set)&&(o[s]={[vc]:!0,[Os]:!0,[Ms]:i[Ms],[Fn]:e[s]})}return Wt.create(Ro(e),o)}else{const o=Ro(e);if(o!==null&&r)return{...e};const n=Wt.create(o);return Wt.assign(n,e)}}function kc(e,t=!1){return Bs(e)||$r(e)||!Jt(e)||($n(e)>1&&Wt.defineProperties(e,{set:zs,add:zs,clear:zs,delete:zs}),Wt.freeze(e),t&&Ls(e,(r,o)=>{kc(o,!0)},!1)),e}function Qk(){Ut(2)}var zs={[Fn]:Qk};function Bs(e){return e===null||!Cc(e)?!0:Wt.isFrozen(e)}var Us="MapSet",_c="Patches",cm="ArrayMethods",dm={};function Do(e){const t=dm[e];return t||Ut(0,e),t}var um=e=>!!dm[e],Gn,pm=()=>Gn,Kk=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:um(Us)?Do(Us):void 0,arrayMethodsPlugin_:um(cm)?Do(cm):void 0});function fm(e,t){t&&(e.patchPlugin_=Do(_c),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Dc(e){Ac(e),e.drafts_.forEach(Xk),e.drafts_=null}function Ac(e){e===Gn&&(Gn=e.parent_)}var hm=e=>Gn=Kk(Gn,e);function Xk(e){const t=e[It];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function mm(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[It].modified_&&(Dc(t),Ut(4)),Jt(e)&&(e=gm(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[It].base_,e,t)}else e=gm(t,r);return Jk(t,e,!0),Dc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==am?e:void 0}function gm(e,t){if(Bs(t))return t;const r=t[It];if(!r)return Hs(t,e.handledSet_,e);if(!Ws(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);vm(r,e)}return r.copy_}function Jk(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&kc(t,r)}function bm(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Ws=(e,t)=>e.scope_===t,Zk=[];function ym(e,t,r,o){const n=Gr(e),a=e.type_;if(o!==void 0&&wc(n,o,a)===t){Fs(n,o,r,a);return}if(!e.draftLocations_){const i=e.draftLocations_=new Map;Ls(n,(c,d)=>{if($r(d)){const f=i.get(d)||[];f.push(c),i.set(d,f)}})}const s=e.draftLocations_.get(t)??Zk;for(const i of s)Fs(n,i,r,a)}function Rk(e,t,r){e.callbacks_.push(function(n){var i;const a=t;if(!a||!Ws(a,n))return;(i=n.mapSetPlugin_)==null||i.fixSetContents(a);const s=Nc(a);ym(e,a.draft_??a,s,r),vm(a,n)})}function vm(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)}bm(e)}}function e1(e,t,r){const{scope_:o}=e;if($r(r)){const n=r[It];Ws(n,o)&&n.callbacks_.push(function(){Ys(e);const s=Nc(n);ym(e,r,s,t)})}else Jt(r)&&e.callbacks_.push(function(){const a=Gr(e);e.type_===3?a.has(r)&&Hs(r,o.handledSet_,o):wc(a,t,e.type_)===r&&o.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&Hs(wc(e.copy_,t,e.type_),o.handledSet_,o)})}function Hs(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||$r(e)||t.has(e)||!Jt(e)||Bs(e)||(t.add(e),Ls(e,(o,n)=>{if($r(n)){const a=n[It];if(Ws(a,r)){const s=Nc(a);Fs(e,o,s,e.type_),bm(a)}}else Jt(n)&&Hs(n,t,r)})),e}function t1(e,t){const r=$s(e),o={type_:r?1:0,scope_:t?t.scope_:pm(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let n=o,a=js;r&&(n=[o],a=Vn);const{revoke:s,proxy:i}=Proxy.revocable(n,a);return o.draft_=i,o.revoke_=s,[i,o]}var js={get(e,t){if(t===It)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(!xc(n,t,e.type_))return o1(e,n,t);const a=n[t];if(e.finalized_||!Jt(a)||o&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&qk(t))return a;if(a===Tc(e.base_,t)||r1(e,t,a)){Ys(e);const s=e.type_===1?+t:t,i=Pc(e.scope_,a,e,s);return e.copy_[s]=i}return a},has(e,t){return t in Gr(e)},ownKeys(e){return Reflect.ownKeys(Gr(e))},set(e,t,r){const o=xm(Gr(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const n=Tc(Gr(e),t),a=n==null?void 0:n[It];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(Yk(r,n)&&(r!==void 0||xc(e.base_,t,e.type_)))return!0;Ys(e),Ic(e)}return e.copy_[t]===r&&(r!==void 0||xc(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),e1(e,t,r)),!0},deleteProperty(e,t){return Ys(e),Tc(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),Ic(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&&{[Os]:!0,[vc]:e.type_!==1||t!=="length",[Ms]:o[Ms],[Fn]:r[t]}},defineProperty(){Ut(11)},getPrototypeOf(e){return Ro(e.base_)},setPrototypeOf(){Ut(12)}},Vn={};for(let e in js){let t=js[e];Vn[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Vn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ut(13),Vn.set.call(this,e,t,void 0)},Vn.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ut(14),js.set.call(this,e[0],t,r,e[0])};function Tc(e,t){const r=e[It];return(r?Gr(r):e)[t]}function r1(e,t,r){var o;return e.type_!==1||!e.allIndicesReassigned_||(o=e.assigned_)!=null&&o.get(t)||!Jt(r)||r[It]?!1:e.baseRefs_.has(r)}function o1(e,t,r){var n;const o=xm(t,r);return o?Fn in o?o[Fn]:(n=o.get)==null?void 0:n.call(e.draft_):void 0}function xm(e,t){if(!(t in e))return;let r=Ro(e);for(;r;){const o=Object.getOwnPropertyDescriptor(r,t);if(o)return o;r=Ro(r)}}function Ic(e){e.modified_||(e.modified_=!0,e.parent_&&Ic(e.parent_))}function Ys(e){e.copy_||(e.assigned_=new Map,e.copy_=Ec(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var n1=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(t,r,o)=>{if(_o(t)&&!_o(r)){const a=r;r=t;const s=this;return function(c=a,...d){return s.produce(c,f=>r.call(this,f,...d))}}_o(r)||Ut(6),o!==void 0&&!_o(o)&&Ut(7);let n;if(Jt(t)){const a=hm(this),s=Pc(a,t,void 0);let i=!0;try{n=r(s),i=!1}finally{i?Dc(a):Ac(a)}return fm(a,o),mm(n,a)}else if(!t||!Cc(t)){if(n=r(t),n===void 0&&(n=t),n===am&&(n=void 0),this.autoFreeze_&&kc(n,!0),o){const a=[],s=[];Do(_c).generateReplacementPatches_(t,n,{patches_:a,inversePatches_:s}),o(a,s)}return n}else Ut(1,t)},this.produceWithPatches=(t,r)=>{if(_o(t))return(s,...i)=>this.produceWithPatches(s,c=>t(c,...i));let o,n;return[this.produce(t,r,(s,i)=>{o=s,n=i}),o,n]},Sc(e==null?void 0:e.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Sc(e==null?void 0:e.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Sc(e==null?void 0:e.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){Jt(e)||Ut(8),$r(e)&&(e=a1(e));const t=hm(this),r=Pc(t,e,void 0);return r[It].isManual_=!0,Ac(t),r}finishDraft(e,t){const r=e&&e[It];(!r||!r.isManual_)&&Ut(9);const{scope_:o}=r;return fm(o,t),mm(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=Do(_c).applyPatches_;return $r(e)?o(e,t):this.produce(e,n=>o(n,t))}};function Pc(e,t,r,o){const[n,a]=Gs(t)?Do(Us).proxyMap_(t,r):Vs(t)?Do(Us).proxySet_(t,r):t1(t,r);return((r==null?void 0:r.scope_)??pm()).drafts_.push(n),a.callbacks_=(r==null?void 0:r.callbacks_)??[],a.key_=o,r&&o!==void 0?Rk(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 a1(e){return $r(e)||Ut(10,e),wm(e)}function wm(e){if(!Jt(e)||Bs(e))return e;const t=e[It];let r,o=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ec(e,t.scope_.immer_.useStrictShallowCopy_),o=t.scope_.immer_.shouldUseStrictIteration()}else r=Ec(e,!0);return Ls(r,(n,a)=>{Fs(r,n,wm(a))},o),t&&(t.finalized_=!1),r}var s1=new n1,Cm=s1.produce;function Sm(e){return({dispatch:r,getState:o})=>n=>a=>typeof a=="function"?a(r,o,e):n(a)}var l1=Sm(),i1=Sm,c1=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Ts:Ts.apply(null,arguments)},d1=e=>e&&typeof e.match=="function";function Nm(e,t){function r(...o){if(t){let n=t(...o);if(!n)throw new Error(process.env.NODE_ENV==="production"?$e(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=>nm(o)&&o.type===e,r}function u1(e){return typeof e=="function"&&"type"in e&&d1(e)}function p1(e){const t=e?`${e}`.split("/"):[],r=t[t.length-1]||"actionCreator";return`Detected an action creator with type "${e||"unknown"}" being dispatched.
|
|
177
|
+
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 f1(e={}){if(process.env.NODE_ENV==="production")return()=>r=>o=>r(o);const{isActionCreator:t=u1}=e;return()=>r=>o=>(t(o)&&console.warn(p1(o.type)),r(o))}function Em(e,t){let r=0;return{measureTime(o){const n=Date.now();try{return o()}finally{const a=Date.now();r+=a-n}},warnIfExceeded(){r>e&&console.warn(`${t} took ${r}ms, which is more than the warning threshold of ${e}ms.
|
|
178
|
+
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.
|
|
179
|
+
It is disabled in production builds, so you don't need to worry about that.`)}}}var km=class aa extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,aa.prototype)}static get[Symbol.species](){return aa}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new aa(...t[0].concat(this)):new aa(...t.concat(this))}};function _m(e){return Jt(e)?Cm(e,()=>{}):e}function zn(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function h1(e){return typeof e!="object"||e==null||Object.isFrozen(e)}function m1(e,t,r){const o=Dm(e,t,r);return{detectMutations(){return Am(e,t,o,r)}}}function Dm(e,t=[],r,o="",n=new Set){const a={value:r};if(!e(r)&&!n.has(r)){n.add(r),a.children={};const s=t.length>0;for(const i in r){const c=o?o+"."+i:i;s&&t.some(f=>f instanceof RegExp?f.test(c):c===f)||(a.children[i]=Dm(e,t,r[i],c))}}return a}function Am(e,t=[],r,o,n=!1,a=""){const s=r?r.value:void 0,i=s===o;if(n&&!i&&!Number.isNaN(o))return{wasMutated:!0,path:a};if(e(s)||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(g=>g instanceof RegExp?g.test(u):u===g))continue;const h=Am(e,t,r.children[f],o[f],i,u);if(h.wasMutated)return h}return{wasMutated:!1}}function g1(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=h1,ignoredPaths:n,warnAfter:a=32}=e;const s=m1.bind(null,o,n);return({getState:i})=>{let c=i(),d=s(c),f;return u=>h=>{const m=Em(a,"ImmutableStateInvariantMiddleware");m.measureTime(()=>{if(c=i(),f=d.detectMutations(),d=s(c),f.wasMutated)throw new Error(process.env.NODE_ENV==="production"?$e(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 g=u(h);return m.measureTime(()=>{if(c=i(),f=d.detectMutations(),d=s(c),f.wasMutated)throw new Error(process.env.NODE_ENV==="production"?$e(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(),g}}}}function Tm(e){const t=typeof e;return e==null||t==="string"||t==="boolean"||t==="number"||Array.isArray(e)||Ln(e)}function Mc(e,t="",r=Tm,o,n=[],a){let s;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"&&(s=Mc(f,u,r,o,n,a),s))return s}}return a&&Im(e)&&a.add(e),!1}function Im(e){if(!Object.isFrozen(e))return!1;for(const t of Object.values(e))if(!(typeof t!="object"||t===null)&&!Im(t))return!1;return!0}function b1(e={}){if(process.env.NODE_ENV==="production")return()=>t=>r=>t(r);{const{isSerializable:t=Tm,getEntries:r,ignoredActions:o=[],ignoredActionPaths:n=["meta.arg","meta.baseQueryMeta"],ignoredPaths:a=[],warnAfter:s=32,ignoreState:i=!1,ignoreActions:c=!1,disableCache:d=!1}=e,f=!d&&WeakSet?new WeakSet:void 0;return u=>h=>m=>{if(!nm(m))return h(m);const g=h(m),y=Em(s,"SerializableStateInvariantMiddleware");return!c&&!(o.length&&o.indexOf(m.type)!==-1)&&y.measureTime(()=>{const b=Mc(m,"",t,r,n,f);if(b){const{keyPath:C,value:w}=b;console.error(`A non-serializable value was detected in an action, in the path: \`${C}\`. Value:`,w,`
|
|
180
|
+
Take a look at the logic that dispatched this action: `,m,`
|
|
181
|
+
(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)`,`
|
|
182
|
+
(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)`)}}),i||(y.measureTime(()=>{const b=u.getState(),C=Mc(b,"",t,r,a,f);if(C){const{keyPath:w,value:x}=C;console.error(`A non-serializable value was detected in the state, in the path: \`${w}\`. Value:`,x,`
|
|
183
|
+
Take a look at the reducer(s) handling this action type: ${m.type}.
|
|
184
|
+
(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`)}}),y.warnIfExceeded()),g}}}function qs(e){return typeof e=="boolean"}var y1=()=>function(t){const{thunk:r=!0,immutableCheck:o=!0,serializableCheck:n=!0,actionCreatorCheck:a=!0}=t??{};let s=new km;if(r&&(qs(r)?s.push(l1):s.push(i1(r.extraArgument))),process.env.NODE_ENV!=="production"){if(o){let i={};qs(o)||(i=o),s.unshift(g1(i))}if(n){let i={};qs(n)||(i=n),s.push(b1(i))}if(a){let i={};qs(a)||(i=a),s.unshift(f1(i))}}return s},v1="RTK_autoBatch",Pm=e=>t=>{setTimeout(t,e)},x1=(e,t)=>r=>{let o=!1;const n=()=>{o||(o=!0,cancelAnimationFrame(a),clearTimeout(s),r())},a=e(n),s=setTimeout(n,t)},w1=(e={type:"raf"})=>t=>(...r)=>{const o=t(...r);let n=!0,a=!1,s=!1;const i=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?x1(window.requestAnimationFrame,100):Pm(10):e.type==="callback"?e.queueNotification:Pm(e.timeout),d=()=>{s=!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[v1]),a=!n,a&&(s||(s=!0,c(d))),o.dispatch(f)}finally{n=!0}}})},C1=e=>function(r){const{autoBatch:o=!0}=r??{};let n=new km(e);return o&&n.push(w1(typeof o=="object"?o:void 0)),n};function S1(e){const t=y1(),{reducer:r=void 0,middleware:o,devTools:n=!0,duplicateMiddlewareCheck:a=!0,preloadedState:s=void 0,enhancers:i=void 0}=e||{};let c;if(typeof r=="function")c=r;else if(Ln(r))c=om(r);else throw new Error(process.env.NODE_ENV==="production"?$e(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"?$e(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"?$e(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(y=>typeof y!="function"))throw new Error(process.env.NODE_ENV==="production"?$e(4):"each middleware provided to configureStore must be a function");if(process.env.NODE_ENV!=="production"&&a){let y=new Set;d.forEach(b=>{if(y.has(b))throw new Error(process.env.NODE_ENV==="production"?$e(42):"Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.");y.add(b)})}let f=Ts;n&&(f=c1({trace:process.env.NODE_ENV!=="production",...typeof n=="object"&&n}));const u=Wk(...d),h=C1(u);if(process.env.NODE_ENV!=="production"&&i&&typeof i!="function")throw new Error(process.env.NODE_ENV==="production"?$e(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"?$e(6):"`enhancers` callback must return an array");if(process.env.NODE_ENV!=="production"&&m.some(y=>typeof y!="function"))throw new Error(process.env.NODE_ENV==="production"?$e(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 g=f(...m);return tm(c,s,g)}function Mm(e){const t={},r=[];let o;const n={addCase(a,s){if(process.env.NODE_ENV!=="production"){if(r.length>0)throw new Error(process.env.NODE_ENV==="production"?$e(26):"`builder.addCase` should only be called before calling `builder.addMatcher`");if(o)throw new Error(process.env.NODE_ENV==="production"?$e(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"?$e(28):"`builder.addCase` cannot be called with an empty action type");if(i in t)throw new Error(process.env.NODE_ENV==="production"?$e(29):`\`builder.addCase\` cannot be called with two reducers for the same action type '${i}'`);return t[i]=s,n},addAsyncThunk(a,s){if(process.env.NODE_ENV!=="production"&&o)throw new Error(process.env.NODE_ENV==="production"?$e(43):"`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");return s.pending&&(t[a.pending.type]=s.pending),s.rejected&&(t[a.rejected.type]=s.rejected),s.fulfilled&&(t[a.fulfilled.type]=s.fulfilled),s.settled&&r.push({matcher:a.settled,reducer:s.settled}),n},addMatcher(a,s){if(process.env.NODE_ENV!=="production"&&o)throw new Error(process.env.NODE_ENV==="production"?$e(30):"`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");return r.push({matcher:a,reducer:s}),n},addDefaultCase(a){if(process.env.NODE_ENV!=="production"&&o)throw new Error(process.env.NODE_ENV==="production"?$e(31):"`builder.addDefaultCase` can only be called once");return o=a,n}};return e(n),[t,r,o]}function N1(e){return typeof e=="function"}function E1(e,t){if(process.env.NODE_ENV!=="production"&&typeof t=="object")throw new Error(process.env.NODE_ENV==="production"?$e(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]=Mm(t),a;if(N1(e))a=()=>_m(e());else{const i=_m(e);a=()=>i}function s(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($r(f)){const m=u(f,c);return m===void 0?f:m}else{if(Jt(f))return Cm(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 s.getInitialState=a,s}var k1="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",_1=(e=21)=>{let t="",r=e;for(;r--;)t+=k1[Math.random()*64|0];return t},D1=Symbol.for("rtk-slice-createasyncthunk");function A1(e,t){return`${e}/${t}`}function T1({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[D1];return function(n){const{name:a,reducerPath:s=a}=n;if(!a)throw new Error(process.env.NODE_ENV==="production"?$e(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(P1()):n.reducers)||{},c=Object.keys(i),d={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},f={addCase(S,N){const E=typeof S=="string"?S:S.type;if(!E)throw new Error(process.env.NODE_ENV==="production"?$e(12):"`context.addCase` cannot be called with an empty action type");if(E in d.sliceCaseReducersByType)throw new Error(process.env.NODE_ENV==="production"?$e(13):"`context.addCase` cannot be called with two reducers for the same action type: "+E);return d.sliceCaseReducersByType[E]=N,f},addMatcher(S,N){return d.sliceMatchers.push({matcher:S,reducer:N}),f},exposeAction(S,N){return d.actionCreators[S]=N,f},exposeCaseReducer(S,N){return d.sliceCaseReducersByName[S]=N,f}};c.forEach(S=>{const N=i[S],E={reducerName:S,type:A1(a,S),createNotation:typeof n.reducers=="function"};O1(N)?F1(E,N,f,t):M1(E,N,f)});function u(){if(process.env.NODE_ENV!=="production"&&typeof n.extraReducers=="object")throw new Error(process.env.NODE_ENV==="production"?$e(14):"The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");const[S={},N=[],E=void 0]=typeof n.extraReducers=="function"?Mm(n.extraReducers):[n.extraReducers],M={...S,...d.sliceCaseReducersByType};return E1(n.initialState,k=>{for(let T in M)k.addCase(T,M[T]);for(let T of d.sliceMatchers)k.addMatcher(T.matcher,T.reducer);for(let T of N)k.addMatcher(T.matcher,T.reducer);E&&k.addDefaultCase(E)})}const h=S=>S,m=new Map,g=new WeakMap;let y;function b(S,N){return y||(y=u()),y(S,N)}function C(){return y||(y=u()),y.getInitialState()}function w(S,N=!1){function E(k){let T=k[S];if(typeof T>"u"){if(N)T=zn(g,E,C);else if(process.env.NODE_ENV!=="production")throw new Error(process.env.NODE_ENV==="production"?$e(15):"selectSlice returned undefined for an uninjected slice reducer")}return T}function M(k=h){const T=zn(m,N,()=>new WeakMap);return zn(T,k,()=>{const A={};for(const[L,O]of Object.entries(n.selectors??{}))A[L]=I1(O,k,()=>zn(g,k,C),N);return A})}return{reducerPath:S,getSelectors:M,get selectors(){return M(E)},selectSlice:E}}const x={name:a,reducer:b,actions:d.actionCreators,caseReducers:d.sliceCaseReducersByName,getInitialState:C,...w(s),injectInto(S,{reducerPath:N,...E}={}){const M=N??s;return S.inject({reducerPath:M,reducer:b},E),{...x,...w(M,!0)}}};return x}}function I1(e,t,r,o){function n(a,...s){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"?$e(16):"selectState returned undefined for an uninjected slice reducer")}return e(i,...s)}return n.unwrapped=e,n}var Om=T1();function P1(){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 M1({type:e,reducerName:t,createNotation:r},o,n){let a,s;if("reducer"in o){if(r&&!L1(o))throw new Error(process.env.NODE_ENV==="production"?$e(17):"Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");a=o.reducer,s=o.prepare}else a=o;n.addCase(e,a).exposeCaseReducer(t,a).exposeAction(t,s?Nm(e,s):Nm(e))}function O1(e){return e._reducerDefinitionType==="asyncThunk"}function L1(e){return e._reducerDefinitionType==="reducerWithPrepare"}function F1({type:e,reducerName:t},r,o,n){if(!n)throw new Error(process.env.NODE_ENV==="production"?$e(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:s,pending:i,rejected:c,settled:d,options:f}=r,u=n(e,a,f);o.exposeAction(t,u),s&&o.addCase(u.fulfilled,s),i&&o.addCase(u.pending,i),c&&o.addCase(u.rejected,c),d&&o.addMatcher(u.settled,d),o.exposeCaseReducer(t,{fulfilled:s||Qs,pending:i||Qs,rejected:c||Qs,settled:d||Qs})}function Qs(){}var $1=e=>"reducerPath"in e&&typeof e.reducerPath=="string",G1=e=>e.flatMap(t=>$1(t)?[[t.reducerPath,t.reducer]]:Object.entries(t)),Oc=Symbol.for("rtk-state-proxy-original"),V1=e=>!!e&&!!e[Oc],z1=new WeakMap,B1=(e,t,r)=>zn(z1,e,()=>new Proxy(e,{get:(o,n,a)=>{if(n===Oc)return o;const s=Reflect.get(o,n,a);if(typeof s>"u"){const i=r[n];if(typeof i<"u")return i;const c=t[n];if(c){const d=c(void 0,{type:_1()});if(typeof d>"u")throw new Error(process.env.NODE_ENV==="production"?$e(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 s}})),U1=e=>{if(!V1(e))throw new Error(process.env.NODE_ENV==="production"?$e(25):"original must be used on state Proxy");return e[Oc]},W1={},H1=(e=W1)=>e;function j1(...e){const t=Object.fromEntries(G1(e)),r=()=>Object.keys(t).length?om(t):H1;let o=r();function n(c,d){return o(c,d)}n.withLazyLoadedSlices=()=>n;const a={},s=(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(B1(f?f(h,...m):h,t,a),...m)}},{original:U1});return Object.assign(n,{inject:s,selector:i})}function $e(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 Ks={exports:{}},Lc={};/**
|
|
185
|
+
* @license React
|
|
186
|
+
* use-sync-external-store-with-selector.production.js
|
|
187
|
+
*
|
|
188
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
189
|
+
*
|
|
190
|
+
* This source code is licensed under the MIT license found in the
|
|
191
|
+
* LICENSE file in the root directory of this source tree.
|
|
192
|
+
*/var Lm;function Y1(){if(Lm)return Lc;Lm=1;var e=D;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,s=e.useMemo,i=e.useDebugValue;return Lc.useSyncExternalStoreWithSelector=function(c,d,f,u,h){var m=n(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=s(function(){function b(N){if(!C){if(C=!0,w=N,N=u(N),h!==void 0&&g.hasValue){var E=g.value;if(h(E,N))return x=E}return x=N}if(E=x,r(w,N))return E;var M=u(N);return h!==void 0&&h(E,M)?(w=N,E):(w=N,x=M)}var C=!1,w,x,S=f===void 0?null:f;return[function(){return b(d())},S===null?void 0:function(){return b(S())}]},[d,f,u,h]);var y=o(c,m[0],m[1]);return a(function(){g.hasValue=!0,g.value=y},[y]),i(y),y},Lc}var Fc={};/**
|
|
193
|
+
* @license React
|
|
194
|
+
* use-sync-external-store-with-selector.development.js
|
|
195
|
+
*
|
|
196
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
197
|
+
*
|
|
198
|
+
* This source code is licensed under the MIT license found in the
|
|
199
|
+
* LICENSE file in the root directory of this source tree.
|
|
200
|
+
*/var Fm;function q1(){return Fm||(Fm=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=D,r=typeof Object.is=="function"?Object.is:e,o=t.useSyncExternalStore,n=t.useRef,a=t.useEffect,s=t.useMemo,i=t.useDebugValue;Fc.useSyncExternalStoreWithSelector=function(c,d,f,u,h){var m=n(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=s(function(){function b(N){if(!C){if(C=!0,w=N,N=u(N),h!==void 0&&g.hasValue){var E=g.value;if(h(E,N))return x=E}return x=N}if(E=x,r(w,N))return E;var M=u(N);return h!==void 0&&h(E,M)?(w=N,E):(w=N,x=M)}var C=!1,w,x,S=f===void 0?null:f;return[function(){return b(d())},S===null?void 0:function(){return b(S())}]},[d,f,u,h]);var y=o(c,m[0],m[1]);return a(function(){g.hasValue=!0,g.value=y},[y]),i(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Fc}var $m;function Q1(){return $m||($m=1,process.env.NODE_ENV==="production"?Ks.exports=Y1():Ks.exports=q1()),Ks.exports}var K1=Q1();function X1(e){e()}function J1(){let e=null,t=null;return{clear(){e=null,t=null},notify(){X1(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let o=e;for(;o;)r.push(o),o=o.next;return r},subscribe(r){let o=!0;const n=t={callback:r,next:null,prev:t};return n.prev?n.prev.next=n:e=n,function(){!o||e===null||(o=!1,n.next?n.next.prev=n.prev:t=n.prev,n.prev?n.prev.next=n.next:e=n.next)}}}}var Gm={notify(){},get:()=>[]};function Z1(e,t){let r,o=Gm,n=0,a=!1;function s(y){f();const b=o.subscribe(y);let C=!1;return()=>{C||(C=!0,b(),u())}}function i(){o.notify()}function c(){g.onStateChange&&g.onStateChange()}function d(){return a}function f(){n++,r||(r=e.subscribe(c),o=J1())}function u(){n--,r&&n===0&&(r(),r=void 0,o.clear(),o=Gm)}function h(){a||(a=!0,f())}function m(){a&&(a=!1,u())}const g={addNestedSub:s,notifyNestedSubs:i,handleChangeWrapper:c,isSubscribed:d,trySubscribe:h,tryUnsubscribe:m,getListeners:()=>o};return g}var R1=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",e_=R1(),t_=()=>typeof navigator<"u"&&navigator.product==="ReactNative",r_=t_(),o_=()=>e_||r_?v.useLayoutEffect:v.useEffect,n_=o_(),$c=Symbol.for("react-redux-context"),Gc=typeof globalThis<"u"?globalThis:{};function a_(){if(!v.createContext)return{};const e=Gc[$c]??(Gc[$c]=new Map);let t=e.get(v.createContext);return t||(t=v.createContext(null),process.env.NODE_ENV!=="production"&&(t.displayName="ReactRedux"),e.set(v.createContext,t)),t}var eo=a_();function s_(e){const{children:t,context:r,serverState:o,store:n}=e,a=v.useMemo(()=>{const c=Z1(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]),s=v.useMemo(()=>n.getState(),[n]);n_(()=>{const{subscription:c}=a;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),s!==n.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[a,s]);const i=r||eo;return v.createElement(i.Provider,{value:a},t)}var l_=s_;function Vc(e=eo){return function(){const r=v.useContext(e);if(process.env.NODE_ENV!=="production"&&!r)throw new Error("could not find react-redux context value; please ensure the component is wrapped in a <Provider>");return r}}var Vm=Vc();function zc(e=eo){const t=e===eo?Vm:Vc(e),r=()=>{const{store:o}=t();return o};return Object.assign(r,{withTypes:()=>r}),r}var i_=zc();function c_(e=eo){const t=e===eo?i_:zc(e),r=()=>t().dispatch;return Object.assign(r,{withTypes:()=>r}),r}var d_=(e,t)=>e===t;function u_(e=eo){const t=e===eo?Vm:Vc(e),r=(o,n={})=>{const{equalityFn:a=d_}=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 s=t(),{store:i,subscription:c,getServerState:d}=s,f=v.useRef(!0),u=v.useCallback({[o.name](m){const g=o(m);if(process.env.NODE_ENV!=="production"){const{devModeChecks:y={}}=typeof n=="function"?{}:n,{identityFunctionCheck:b,stabilityCheck:C}=s,{identityFunctionCheck:w,stabilityCheck:x}={stabilityCheck:C,identityFunctionCheck:b,...y};if(x==="always"||x==="once"&&f.current){const S=o(m);if(!a(g,S)){let N;try{throw new Error}catch(E){({stack:N}=E)}console.warn("Selector "+(o.name||"unknown")+` returned a different result when called with the same parameters. This can lead to unnecessary rerenders.
|
|
201
|
+
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:g,selected2:S,stack:N})}}if((w==="always"||w==="once"&&f.current)&&g===m){let S;try{throw new Error}catch(N){({stack:S}=N)}console.warn("Selector "+(o.name||"unknown")+` returned the root state when called. This can lead to unnecessary rerenders.
|
|
202
|
+
Selectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.`,{stack:S})}f.current&&(f.current=!1)}return g}}[o.name],[o]),h=K1.useSyncExternalStoreWithSelector(c.addNestedSub,i.getState,d||i.getState,u,a);return v.useDebugValue(h),h};return Object.assign(r,{withTypes:()=>r}),r}const lr=e=>v.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),p_=D.forwardRef((e,t)=>v.createElement("span",{...e.dragHandleAttributes,"data-testid":e.testID,ref:t,className:e.className,title:e.title},e.label)),f_=e=>{const{component:t,...r}=e,o=Oe(r.schema.suppressStandardClassnames||me.betweenRules,r.schema.classNames.betweenRules);return v.createElement("div",{className:o,"data-testid":ge.inlineCombinator},v.createElement(t,{...r,testID:ge.combinators}))},zm={name:"",value:"",label:""},Bm=e=>["atleast","atmost","exactly"].includes(No(e)??""),Um=[],h_=e=>{const{match:t,options:r,title:o,className:n,disabled:a,testID:s,schema:i,thresholdPlaceholder:c,selectorComponent:d=e.schema.controls.valueSelector,numericEditorComponent:f=e.schema.controls.valueEditor}=e,{thresholdNum:u,thresholdRule:h,thresholdSchema:m,handleChangeMode:g,handleChangeThreshold:y}=m_(e),b=D.useMemo(()=>c?{...zm,placeholder:c}:zm,[c]);return v.createElement(v.Fragment,null,v.createElement(d,{schema:i,testID:s,className:n,title:o,handleOnChange:g,disabled:a,value:t.mode,options:r,multiple:!1,listsAsArrays:!1,path:Um,level:0}),Bm(t.mode)&&v.createElement(f,{skipHook:!0,testID:s,inputType:"number",title:o,className:n,disabled:a,handleOnChange:y,field:"",operator:"",value:u,valueSource:"value",fieldData:b,schema:m,path:Um,level:0,rule:h}))},m_=e=>{const{match:t,handleOnChange:r}=e,o=v.useMemo(()=>typeof t.threshold=="number"?Math.max(0,t.threshold):1,[t.threshold]);return{thresholdNum:o,thresholdRule:v.useMemo(()=>({field:"",operator:"=",value:o}),[o]),thresholdSchema:v.useMemo(()=>({...e.schema,parseNumbers:!0}),[e.schema]),handleChangeMode:D.useCallback(n=>{Bm(n)&&typeof t.threshold!="number"?r({...t,mode:n,threshold:1}):r({...t,mode:n})},[r,t]),handleChangeThreshold:D.useCallback(n=>{r({...t,threshold:Ds(n,{parseNumbers:!0})})},[r,t])}},g_=e=>{const t=v.useId();return v.createElement("label",{"data-testid":e.testID,className:e.className,title:e.title,htmlFor:t},v.createElement("input",{id:t,type:"checkbox",onChange:r=>e.handleOnChange(r.target.checked),checked:!!e.checked,disabled:e.disabled}),e.label)},Nt={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."},Bn=Om({name:"queries",initialState:{},reducers:{setQueryState:(e,{payload:{qbId:t,query:r}})=>{e[t]=r}},selectors:{getQuerySelectorById:(e,t)=>e[t]}}),Wm=v.createContext(null),Bc=Om({name:"warnings",initialState:{[Nt.errorInvalidIndependentCombinatorsProp]:!1,[Nt.errorUnnecessaryIndependentCombinatorsProp]:!1,[Nt.errorDeprecatedRuleGroupProps]:!1,[Nt.errorDeprecatedRuleProps]:!1,[Nt.errorBothQueryDefaultQuery]:!1,[Nt.errorUncontrolledToControlled]:!1,[Nt.errorControlledToUncontrolled]:!1,[Nt.errorEnabledDndWithoutReactDnD]:!1,[Nt.errorDeprecatedDebugImport]:!1},reducers:{rqbWarn:(e,{payload:t})=>{e[t]||(console.error(t),e[t]=!0)}}}),Hm=j1(Bn,Bc).withLazyLoadedSlices(),b_=e=>c_(e),y_=e=>zc(e),v_=e=>u_(e),x_=e=>({useRQB_INTERNAL_QueryBuilderDispatch:b_(e),useRQB_INTERNAL_QueryBuilderStore:y_(e),useRQB_INTERNAL_QueryBuilderSelector:v_(e)}),Uc=({payload:e,onQueryChange:t})=>r=>{r(Bn.actions.setQueryState(e)),typeof t=="function"&&t(e.query)},Wc=x_(Wm),Hc=Wc.useRQB_INTERNAL_QueryBuilderDispatch,w_=Wc.useRQB_INTERNAL_QueryBuilderStore,C_=Wc.useRQB_INTERNAL_QueryBuilderSelector,{rqbWarn:S_}=Bc.actions,Ao=e=>t=>{setTimeout(()=>t(S_(e)))},N_={reducer:Hm,preloadedState:{queries:Bn.getInitialState(),warnings:Bc.getInitialState()},middleware:e=>e({serializableCheck:{ignoredActions:[Bn.actions.setQueryState.type],ignoredPaths:[/^queries\b.*\.rules\.\d+\.value$/]}})},E_=e=>{const[t,r]=D.useState(e),[o,n]=D.useState(null);return e!==t&&(n(t),r(e)),o},k_=e=>{const t=Hc(),{defaultQuery:r,queryProp:o}=e,n=E_(!!o);process.env.NODE_ENV!=="production"&&(o&&r?t(Ao(Nt.errorBothQueryDefaultQuery)):n===!0&&!o&&r?t(Ao(Nt.errorControlledToUncontrolled)):n===!1&&o&&!r&&t(Ao(Nt.errorUncontrolledToControlled)))};function jc(e,t,r){const o=Hc();process.env.NODE_ENV!=="production"&&t&&(e==="independentCombinators"&&(r==="invalid"&&o(Ao(Nt.errorInvalidIndependentCombinatorsProp)),r==="unnecessary"&&o(Ao(Nt.errorUnnecessaryIndependentCombinatorsProp))),e==="rule"&&o(Ao(Nt.errorDeprecatedRuleProps)),e==="ruleGroup"&&o(Ao(Nt.errorDeprecatedRuleGroupProps)))}const jm=e=>{const{optionList:t,optionsMap:r,defaultOption:o}=D.useMemo(()=>Xo({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}},__=e=>{const t=S1({...N_,devTools:e?{name:"React Query Builder"}:!1});return t.addSlice=r=>{Hm.inject(r),t.dispatch({type:crypto.randomUUID().slice(0,8),meta:`Initializing state for slice "${r.name}"`})},t};let Yc=null;function Ym(e){return Yc||(Yc=__(globalThis==null?void 0:globalThis.__RQB_DEVTOOLS__)),Yc}const To=e=>t=>Bn.selectors.getQuerySelectorById({queries:t.queries},e),D_=(e,t)=>{const r=v.useContext(qc);return C_(e,t)??(r==null?void 0:r.initialQuery)},A_={},T_={},I_=[],P_={},M_=()=>null,qm=()=>"",Io=()=>!0,O_=(...e)=>{console.log(...e)};function L_(e,t){const{query:r,defaultQuery:o,getValueEditorSeparator:n=M_,getRuleClassname:a=qm,getRuleGroupClassname:s=qm,onAddRule:i=Io,onAddGroup:c=Io,onMoveRule:d=Io,onMoveGroup:f=Io,onGroupRule:u=Io,onGroupGroup:h=Io,onRemove:m=Io,onQueryChange:g,showCombinatorsBetweenRules:y=!1,showNotToggle:b=!1,showShiftActions:C=!1,showCloneButtons:w=!1,showLockButtons:x=!1,showMuteButtons:S=!1,suppressStandardClassnames:N=!1,resetOnFieldChange:E=!0,resetOnOperatorChange:M=!1,autoSelectField:k=!0,autoSelectOperator:T=!0,autoSelectValue:A=!0,addRuleToNewGroups:L=!1,listsAsArrays:O=!1,parseNumbers:F=!1,disabled:V=!1,validator:re,onLog:K=O_,idGenerator:H,accessibleDescriptionGenerator:ee=hk}=e,{qbId:G,rqbContext:z,fields:Ce,fieldMap:$,combinators:q,getParameters:xe,getOperatorsMain:oe,getMatchModesMain:he,getRuleDefaultOperator:Y,getSubQueryBuilderPropsMain:ce,getValueEditorTypeMain:te,getValueSourcesMain:Ne,getValuesMain:be,getRuleDefaultValue:ue,getInputTypeMain:X,createRule:ne,createRuleGroup:pe}=t,{controlClassnames:Se,controlElements:je,debugMode:Je,enableDragAndDrop:Re,enableMountQueryChange:Ye,translations:ye}=z,rt=!!y,Le=!!b,Ge=!!C,Ue=!!w,Ee=!!x,ct=!!S,et=!!E,_r=!!M,Yt=!!k,_=!!T,I=!!A,P=!!L,W=!!O,U=!!N,J=(e.maxLevels??0)>0?Number(e.maxLevels):1/0,B=D.useCallback((...fe)=>{Je&&K(...fe)},[Je,K]);k_({defaultQuery:o,queryProp:r});const Q=w_(),ie=Hc(),De=D.useMemo(()=>To(G),[G]),Ve=D_(De),Dt=D.useCallback(()=>De(Q.getState()),[Q,De]),_e=D.useMemo(()=>pe(),[pe]),Ke=r??Ve??o??_e,ot=Ke.id?Ke:As(Ke,{idGenerator:H}),[dr]=D.useState(ot),rn=D.useMemo(()=>({...z,initialQuery:dr}),[z,dr]);D.useEffect(()=>{r&&!Object.is(r,Ve)&&ie(Uc({payload:{qbId:G,query:r},onQueryChange:void 0}))},[r,G,Ve,ie]);const er=D.useMemo(()=>Mn(ot),[ot]),on=!!e.independentCombinators&&!er;jc("independentCombinators",on||!on&&(e.independentCombinators??"not present")!=="not present",on?"invalid":"unnecessary");const qn=D.useRef(!1);D.useEffect(()=>{qn.current||(qn.current=!0,ie(Uc({payload:{qbId:G,query:ot},onQueryChange:Ye&&typeof g=="function"?g:void 0})))},[Ye,g,G,ie,ot]);const At=D.useCallback(fe=>{ie(Uc({payload:{qbId:G,query:fe},onQueryChange:g}))},[g,G,ie]),nn=Array.isArray(V)&&V||I_,mt=V===!0,fl=ot.disabled||nn.some(fe=>fe.length===0),Qn=D.useCallback((fe,Te,Fe)=>{const Me=To(G)(Q.getState());if(!Me)return;if(Zo(Te,Me)||mt){B({qbId:G,type:ht.parentPathDisabled,rule:fe,parentPath:Te,query:Me});return}const Pe=i(fe,Te,Me,Fe);if(!Pe){B({qbId:G,type:ht.onAddRuleFalse,rule:fe,parentPath:Te,query:Me});return}const wt=Pe===!0?fe:Pe,Pt=Xh(Me,wt,Te,{combinators:q,combinatorPreceding:wt.combinatorPreceding??void 0,idGenerator:H});B({qbId:G,type:ht.add,query:Me,newQuery:Pt,newRule:wt,parentPath:Te}),At(Pt)},[q,At,H,B,i,G,Q,mt]),Kn=D.useCallback((fe,Te,Fe)=>{if(Te.length>=J)return;const Me=To(G)(Q.getState());if(!Me)return;if(Zo(Te,Me)||mt){B({qbId:G,type:ht.parentPathDisabled,ruleGroup:fe,parentPath:Te,query:Me});return}const Pe=c(fe,Te,Me,Fe);if(!Pe){B({qbId:G,type:ht.onAddGroupFalse,ruleGroup:fe,parentPath:Te,query:Me});return}const wt=Pe===!0?fe:Pe,Pt=Xh(Me,wt,Te,{combinators:q,combinatorPreceding:wt.combinatorPreceding??void 0,idGenerator:H});B({qbId:G,type:ht.add,query:Me,newQuery:Pt,newGroup:wt,parentPath:Te}),At(Pt)},[q,At,H,B,J,c,G,Q,mt]),Xn=D.useCallback((fe,Te,Fe)=>{const Me=To(G)(Q.getState());if(!Me)return;if(Zo(Fe,Me)&&fe!=="disabled"||mt){B({qbId:G,type:ht.pathDisabled,path:Fe,prop:fe,value:Te,query:Me});return}const Pe=_k(Me,fe,Te,Fe,{resetOnFieldChange:et,resetOnOperatorChange:_r,getRuleDefaultOperator:Y,getValueSources:Ne,getRuleDefaultValue:ue,getMatchModes:he});B({qbId:G,type:ht.update,query:Me,newQuery:Pe,prop:fe,value:Te,path:Fe}),At(Pe)},[At,he,Y,ue,Ne,B,G,Q,mt,et,_r]),an=D.useCallback((fe,Te)=>{const Fe=To(G)(Q.getState());if(!Fe)return;if(Zo(fe,Fe)||mt){B({qbId:G,type:ht.pathDisabled,path:fe,query:Fe});return}const Me=ut(fe,Fe);if(Me)if(m(Me,fe,Fe,Te)){const Pe=Ak(Fe,fe);B({qbId:G,type:ht.remove,query:Fe,newQuery:Pe,path:fe,ruleOrGroup:Me}),At(Pe)}else B({qbId:G,type:ht.onRemoveFalse,ruleOrGroup:Me,path:fe,query:Fe})},[At,B,m,G,Q,mt]),Jn=D.useCallback((fe,Te,Fe,Me)=>{const Pe=To(G)(Q.getState());if(!Pe)return;if(Zo(fe,Pe)||mt){B({qbId:G,type:ht.pathDisabled,oldPath:fe,newPath:Te,query:Pe});return}const wt=Ik(Pe,fe,Te,{clone:Fe,combinators:q,idGenerator:H}),Pt=ut(fe,Pe),oo=Xe(Pt),Dr=(oo?f:d)(Pt,fe,Te,Pe,wt,{clone:Fe,combinators:q},Me);if(!Dr){B({qbId:G,type:oo?ht.onMoveGroupFalse:ht.onMoveRuleFalse,ruleOrGroup:Pt,oldPath:fe,newPath:Te,clone:Fe,query:Pe,nextQuery:wt});return}const no=Xe(Dr)?Dr:wt;B({qbId:G,type:ht.move,query:Pe,newQuery:no,oldPath:fe,newPath:Te,clone:Fe}),At(no)},[q,At,H,B,f,d,G,Q,mt]),Zn=D.useCallback((fe,Te,Fe,Me)=>{const Pe=To(G)(Q.getState());if(!Pe)return;if(Zo(fe,Pe)||mt){B({qbId:G,type:ht.pathDisabled,sourcePath:fe,targetPath:Te,query:Pe});return}const wt=Mk(Pe,fe,Te,{clone:Fe,combinators:q,idGenerator:H}),Pt=ut(fe,Pe),oo=Xe(Pt),Dr=(oo?h:u)(Pt,fe,Te,Pe,wt,{clone:Fe,combinators:q},Me);if(!Dr){B({qbId:G,type:oo?ht.onGroupGroupFalse:ht.onGroupRuleFalse,ruleOrGroup:Pt,sourcePath:fe,targetPath:Te,clone:Fe,query:Pe,nextQuery:wt});return}const no=Xe(Dr)?Dr:wt;B({qbId:G,type:ht.group,query:Pe,newQuery:no,sourcePath:fe,targetPath:Te,clone:Fe}),At(no)},[q,At,H,B,h,u,G,Q,mt]),{validationResult:tr,validationMap:Rn}=D.useMemo(()=>{const fe=typeof re=="function"&&ot?re(ot):A_;return{validationResult:fe,validationMap:typeof fe=="boolean"?T_:fe}},[ot,re]),hl=Re?"enabled":"disabled",ml=er||rt?"enabled":"disabled",gl=D.useMemo(()=>typeof ot.combinator=="string"?{combinator:ot.combinator}:P_,[ot.combinator]),bl=D.useMemo(()=>Oe(U||me.queryBuilder,Oe(Se.queryBuilder),mt&&Se.disabled,typeof tr=="boolean"&&tr&&Se.valid,typeof tr=="boolean"&&!tr&&Se.invalid,U||{[me.disabled]:mt,[me.valid]:typeof tr=="boolean"&&tr,[me.invalid]:typeof tr=="boolean"&&!tr}),[Se.disabled,Se.invalid,Se.queryBuilder,Se.valid,mt,U,tr]),ea=D.useCallback(fe=>pe(fe??er),[pe,er]),yl=D.useMemo(()=>({addRuleToNewGroups:P,accessibleDescriptionGenerator:ee,autoSelectField:Yt,autoSelectOperator:_,autoSelectValue:I,classNames:Se,combinators:q,getParameters:xe,controls:je,createRule:ne,createRuleGroup:ea,disabledPaths:nn,enableDragAndDrop:Re,fieldMap:$,fields:Ce,dispatchQuery:At,getQuery:Dt,getInputType:X,getOperators:oe,getMatchModes:he,getRuleClassname:a,getRuleDefaultOperator:Y,getRuleDefaultValue:ue,getRuleGroupClassname:s,getSubQueryBuilderProps:ce,getValueEditorSeparator:n,getValueEditorType:te,getValues:be,getValueSources:Ne,independentCombinators:er,listsAsArrays:W,maxLevels:J,parseNumbers:F,qbId:G,resetOnFieldChange:et,resetOnOperatorChange:_r,showCloneButtons:Ue,showCombinatorsBetweenRules:rt,showLockButtons:Ee,showMuteButtons:ct,showNotToggle:Le,showShiftActions:Ge,suppressStandardClassnames:U,validationMap:Rn}),[ee,P,Yt,_,I,q,Se,je,ne,ea,nn,At,Re,$,Ce,X,oe,he,Dt,a,Y,ue,s,ce,n,te,be,Ne,xe,er,W,J,F,G,et,_r,Ue,rt,Ee,ct,Le,Ge,U,Rn]);return{actions:D.useMemo(()=>({moveRule:Jn,onGroupAdd:Kn,onGroupRemove:an,onPropChange:Xn,onRuleAdd:Qn,onRuleRemove:an,groupRule:Zn}),[Zn,Jn,Kn,Xn,Qn,an]),rootGroup:ot,rootGroupDisabled:fl,queryDisabled:mt,rqbContext:rn,schema:yl,translations:ye,wrapperClassName:bl,dndEnabledAttr:hl,inlineCombinatorsAttr:ml,combinatorPropObject:gl}}const F_=e=>{const[t]=D.useState(Xt),{fields:r,baseField:o,operators:n,baseOperator:a,combinators:s,baseCombinator:i,getParameters:c,translations:d,enableMountQueryChange:f=!0,controlClassnames:u,controlElements:h,getDefaultField:m,getDefaultOperator:g,getDefaultValue:y,getMatchModes:b,getOperators:C,getSubQueryBuilderProps:w,getValueEditorType:x,getValueSources:S,getInputType:N,getValues:E,autoSelectField:M=!0,autoSelectOperator:k=!0,autoSelectValue:T=!0,addRuleToNewGroups:A=!1,enableDragAndDrop:L,listsAsArrays:O=!1,debugMode:F=!1,idGenerator:V=Xt}=e,[re]=D.useState(e.query??e.defaultQuery),K=K_({controlClassnames:u,controlElements:h,debugMode:F,enableDragAndDrop:L,enableMountQueryChange:f,translations:d,initialQuery:re,qbId:t,finalize:!0}),{translations:H}=K,{fields:ee,fieldMap:G}=jm({fields:r,baseField:o,autoSelectField:M,translations:H}),{optionList:z}=D.useMemo(()=>Xo({optionList:s??In,labelMap:ak,baseOption:i,autoSelectOption:!0}),[i,s]),Ce=D.useCallback((X,ne,pe)=>Xo({optionList:(c==null?void 0:c(X,ne,pe))??[],autoSelectOption:!0}).optionList,[c]),{optionList:$}=D.useMemo(()=>Xo({optionList:n??sk,placeholder:H.operators,labelMap:Th,baseOption:a,autoSelectOption:k}),[k,a,n,H.operators]),q=D.useCallback((X,{fieldData:ne})=>Xo({optionList:(ne==null?void 0:ne.operators)??(C==null?void 0:C(X,{fieldData:ne}))??$,placeholder:H.operators,baseOption:a,labelMap:Th,autoSelectOption:k}).optionList,[k,a,C,$,H.operators]),xe=D.useCallback(X=>{const ne=G[X];return ne!=null&&ne.defaultOperator?ne.defaultOperator:g?typeof g=="function"?g(X,{fieldData:ne}):g:xt(q(X,{fieldData:ne})??[])??""},[G,g,q]),oe=D.useCallback((X,ne,{fieldData:pe})=>pe.valueEditorType?typeof pe.valueEditorType=="function"?pe.valueEditorType(ne):pe.valueEditorType:(x==null?void 0:x(X,ne,{fieldData:pe}))??"text",[x]),he=D.useCallback((X,ne,pe)=>Yh(G[X],ne,S),[G,S]),Y=D.useCallback((X,ne)=>gk(G[X],b),[G,b]),ce=D.useCallback((X,ne)=>(w==null?void 0:w(X,ne))??{},[w]),te=D.useCallback((X,ne,{fieldData:pe})=>Xo({optionList:(pe==null?void 0:pe.values)??(E==null?void 0:E(X,ne,{fieldData:pe}))??[],placeholder:H.values,autoSelectOption:T}).optionList,[T,E,H.values]),Ne=D.useCallback(X=>bk(X,{fieldData:G[X.field]??{},fields:ee,getParameters:(ne,pe,Se)=>Ce(ne,pe,Se),listsAsArrays:O,getValueEditorType:(ne,pe,Se)=>oe(ne,pe,Se),getValues:(ne,pe,Se)=>te(ne,pe,Se),getDefaultValue:y&&((ne,pe)=>y(ne,pe))}),[G,ee,y,oe,te,O,Ce]),be=D.useCallback((X,ne,{fieldData:pe})=>{if(N){const Se=N(X,ne,{fieldData:pe});if(Se)return Se}return"text"},[N]),ue=D.useCallback(()=>{let X="";const ne=ee;/* v8 ignore else -- @preserve */if((ne==null?void 0:ne.length)>0&&ne[0]){const Ye=xt(ne);/* v8 ignore else -- @preserve */Ye&&(X=Ye)}if(m)if(typeof m=="function"){const Ye=m(ne);/* v8 ignore else -- @preserve */Ye&&(X=Ye)}else X=m;const pe=xe(X),Se=xt(he(X,pe,{fieldData:Ko(ne,X)}))??"value",je=xt(Y(X,{fieldData:Ko(ne,X)})),Je={id:V(),field:X,operator:pe,valueSource:Se,value:"",...je?{match:{mode:je,threshold:1}}:null},Re=Ne(Je);return{...Je,value:Re}},[ee,m,Y,xe,Ne,he,V]);return{qbId:t,rqbContext:K,fields:ee,fieldMap:G,combinators:z,getParameters:Ce,getMatchModesMain:Y,getOperatorsMain:q,getRuleDefaultOperator:xe,getSubQueryBuilderPropsMain:ce,getValueEditorTypeMain:oe,getValueSourcesMain:he,getValuesMain:te,getRuleDefaultValue:Ne,getInputTypeMain:be,createRule:ue,createRuleGroup:D.useCallback(X=>X?{id:V(),rules:A?[ue()]:[],not:!1}:{id:V(),rules:A?[ue()]:[],combinator:xt(z)??"",not:!1},[A,z,ue,V])}},Qm=e=>L_(e,F_(e)),qc=D.createContext({}),$_=v.memo(function(t){const r=Km(t),{previewRef:o,dropRef:n,schema:{controls:{ruleGroupBodyElements:a,ruleGroupHeaderElements:s}}}=r,i=st(r.addRule),c=st(r.addGroup),d=st(r.cloneGroup),f=st(r.toggleLockGroup),u=st(r.toggleMuteGroup),h=st(r.removeGroup),m=st(r.shiftGroupUp),g=st(r.shiftGroupDown),y=D.useMemo(()=>({addRule:i,addGroup:c,cloneGroup:d,toggleLockGroup:f,toggleMuteGroup:u,removeGroup:h,shiftGroupUp:m,shiftGroupDown:g}),[i,c,d,f,u,h,m,g]);return v.createElement("div",{ref:o,title:r.accessibleDescription,className:r.outerClassName,"data-testid":ge.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)},v.createElement("div",{ref:n,className:r.classNames.header},v.createElement(s,{...r,...y})),v.createElement("div",{className:r.classNames.body},v.createElement(a,{...r,...y})))}),G_=v.memo(function(t){const{dragRef:r,schema:{controls:{shiftActions:o,dragHandle:n,combinatorSelector:a,notToggle:s,addRuleAction:i,addGroupAction:c,cloneGroupAction:d,lockGroupAction:f,muteGroupAction:u,removeGroupAction:h}}}=t,m=D.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]),g=D.useMemo(()=>t.schema.showShiftActions?{shiftUp:t.translations.shiftActionUp.title,shiftDown:t.translations.shiftActionDown.title}:void 0,[t.schema.showShiftActions,t.translations]),y=D.useMemo(()=>t.schema.showShiftActions?{shiftUp:t.translations.shiftActionUp.label,shiftDown:t.translations.shiftActionDown.label}:void 0,[t.schema.showShiftActions,t.translations]);return v.createElement(D.Fragment,null,t.schema.showShiftActions&&t.path.length>0&&v.createElement(o,{key:ge.shiftActions,...m,testID:ge.shiftActions,titles:g,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&&v.createElement(n,{key:ge.dragHandle,...m,testID:ge.dragHandle,ref:r,title:t.translations.dragHandle.title,label:t.translations.dragHandle.label,className:t.classNames.dragHandle,dragHandleAttributes:t.dragHandleAttributes,ruleOrGroup:t.ruleGroup}),!t.schema.showCombinatorsBetweenRules&&!t.schema.independentCombinators&&v.createElement(a,{key:ge.combinators,...m,testID:ge.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&&v.createElement(s,{key:ge.notToggle,...m,testID:ge.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}),v.createElement(i,{key:ge.addRule,...m,testID:ge.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&&v.createElement(c,{key:ge.addGroup,...m,testID:ge.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&&v.createElement(d,{key:ge.cloneGroup,...m,testID:ge.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&&v.createElement(f,{key:ge.lockGroup,...m,testID:ge.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&&v.createElement(u,{key:ge.muteGroup,...m,testID:ge.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&&v.createElement(h,{key:ge.removeGroup,...m,testID:ge.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}))}),V_=v.memo(function(t){const{schema:{controls:{combinatorSelector:r,inlineCombinator:o,ruleGroup:n,rule:a}}}=t;return v.createElement(D.Fragment,null,t.ruleGroup.rules.map((s,i,{length:c})=>{const d=t.pathsMemo[i],f=d.path,u=d.disabled||typeof s!="string"&&s.disabled,h=Eo([0],f),m=t.path.length===0&&i===c-1,g=typeof s=="string"?[...f,s].join("-"):s.id;return v.createElement(D.Fragment,{key:g},i>0&&!t.schema.independentCombinators&&t.schema.showCombinatorsBetweenRules&&v.createElement(o,{key:ge.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 s=="string"?v.createElement(o,{key:`${ge.inlineCombinator}-independent`,options:t.schema.combinators,value:s,title:t.translations.combinators.title,className:t.classNames.combinators,handleOnChange:y=>t.onIndependentCombinatorChange(y,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}):Xe(s)?v.createElement(n,{key:ge.ruleGroup,id:s.id,schema:t.schema,actions:t.actions,path:f,translations:t.translations,ruleGroup:s,rules:s.rules,combinator:Pn(s)?s.combinator:void 0,not:!!s.not,disabled:u,parentDisabled:t.parentDisabled||t.disabled,parentMuted:t.parentMuted||t.muted,shiftUpDisabled:h,shiftDownDisabled:m,context:t.context}):v.createElement(a,{key:ge.rule,id:s.id,rule:s,field:s.field,operator:s.operator,value:s.value,valueSource:s.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}))}))}),Km=e=>{const{id:t,path:r,ruleGroup:o,schema:{qbId:n,accessibleDescriptionGenerator:a,classNames:s,combinators:i,createRule:c,createRuleGroup:d,disabledPaths:f,independentCombinators:u,validationMap:h,enableDragAndDrop:m,getRuleGroupClassname:g,suppressStandardClassnames:y},actions:{onGroupAdd:b,onGroupRemove:C,onPropChange:w,onRuleAdd:x,moveRule:S},disabled:N,parentDisabled:E,parentMuted:M,shiftUpDisabled:k,shiftDownDisabled:T,combinator:A,rules:L,not:O,dropEffect:F="move",groupItems:V=!1,dragMonitorId:re="",dropMonitorId:K="",previewRef:H=null,dragRef:ee=null,dropRef:G=null,isDragging:z=!1,isOver:Ce=!1,dropNotAllowed:$=!1}=e;jc("ruleGroup",!o),Jm(m,!!(re||K||H||ee||G));const q=!!E||!!N,xe=!!M||!!(o!=null&&o.muted),oe=D.useMemo(()=>o&&Pn(o)?o.combinator:o?xt(i):A??xt(i),[A,i,o]),he=D.useMemo(()=>{if(o){if(o.combinator===oe||u)return o;const Ee=structuredClone(o);return Ee.combinator=oe,Ee}return{rules:L,not:O}},[oe,u,O,o,L]),Y=D.useMemo(()=>({header:Oe(y||me.header,s.header,Ce&&F==="copy"&&s.dndCopy,$&&s.dndDropNotAllowed,y||{[me.dndOver]:Ce,[me.dndCopy]:Ce&&F==="copy",[me.dndDropNotAllowed]:$}),shiftActions:Oe(y||me.shiftActions,s.shiftActions),dragHandle:Oe(y||me.dragHandle,s.dragHandle),combinators:Oe(y||me.combinators,s.valueSelector,s.combinators),notToggle:Oe(y||me.notToggle,s.notToggle),addRule:Oe(y||me.addRule,s.actionElement,s.addRule),addGroup:Oe(y||me.addGroup,s.actionElement,s.addGroup),cloneGroup:Oe(y||me.cloneGroup,s.actionElement,s.cloneGroup),lockGroup:Oe(y||me.lockGroup,s.actionElement,s.lockGroup),muteGroup:Oe(y||me.muteGroup,s.actionElement,s.muteGroup),removeGroup:Oe(y||me.removeGroup,s.actionElement,s.removeGroup),body:Oe(y||me.body,s.body)}),[s.actionElement,s.addGroup,s.addRule,s.body,s.cloneGroup,s.combinators,s.dndCopy,s.dndDropNotAllowed,s.dragHandle,s.header,s.lockGroup,s.muteGroup,s.notToggle,s.removeGroup,s.shiftActions,s.valueSelector,F,$,Ce,y]),ce=D.useCallback(Ee=>{q||w("combinator",Ee,r)},[q,w,r]),te=D.useCallback((Ee,ct,et)=>{q||w("combinator",Ee,[...r,ct])},[q,w,r]),Ne=D.useCallback((Ee,ct)=>{q||w("not",Ee,r)},[q,w,r]),be=D.useCallback((Ee,ct)=>{if(!q){const et=c();x(et,r,ct)}},[c,q,x,r]),ue=D.useCallback((Ee,ct)=>{if(!q){const et=d();b(et,r,ct)}},[d,q,b,r]),X=D.useCallback(()=>{if(!q){const Ee=[...at(r),r.at(-1)+1];S(r,Ee,!0)}},[q,S,r]),ne=D.useCallback((Ee,ct)=>{!q&&!k&&S(r,"up",Ee==null?void 0:Ee.altKey)},[q,S,r,k]),pe=D.useCallback((Ee,ct)=>{!q&&!T&&S(r,"down",Ee==null?void 0:Ee.altKey)},[q,S,r,T]),Se=D.useCallback(()=>{w("disabled",!q,r)},[q,w,r]),je=D.useCallback(()=>{w("muted",!he.muted,r)},[he.muted,w,r]),Je=D.useCallback(()=>{q||C(r)},[q,C,r]),Re=h[t??""],Ye=D.useMemo(()=>Hh(Re),[Re]),ye=D.useMemo(()=>{var Ee;return u?null:((Ee=Ko(i,oe))==null?void 0:Ee.className)??""},[oe,i,u]),rt=D.useMemo(()=>g(he),[g,he]),Le=D.useMemo(()=>Oe(rt,ye,y||me.ruleGroup,s.ruleGroup,q&&s.disabled,xe&&s.muted,z&&s.dndDragging,Ce&&V&&s.dndGroup,y||{[me.disabled]:q,[me.muted]:xe,[me.dndDragging]:z,[me.dndGroup]:Ce&&V},Ye),[s.disabled,s.muted,s.dndDragging,s.dndGroup,s.ruleGroup,ye,q,xe,V,z,Ce,rt,y,Ye]),Ge=X_({disabled:q,disabledPaths:f,path:r,nestedArray:he.rules}),Ue=D.useMemo(()=>a({path:r,qbId:n}),[a,r,n]);return{...e,addGroup:ue,addRule:be,accessibleDescription:Ue,classNames:Y,cloneGroup:X,combinator:oe,disabled:q,dragMonitorId:re,dragRef:ee,dropMonitorId:K,dropRef:G,isDragging:z,isOver:Ce,muted:xe,onCombinatorChange:ce,onGroupAdd:b,onIndependentCombinatorChange:te,onNotToggleChange:Ne,outerClassName:Le,parentDisabled:E,pathsMemo:Ge,previewRef:H,removeGroup:Je,ruleGroup:he,shiftGroupUp:ne,shiftGroupDown:pe,toggleLockGroup:Se,toggleMuteGroup:je,validationClassName:Ye,validationResult:Re}},z_=e=>{var t,r,o,n;return v.createElement("div",{"data-testid":e.testID,className:e.className},v.createElement("button",{type:"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),v.createElement("button",{type:"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))},B_=({name:e,disabled:t,checked:r,label:o,handleOnChange:n})=>{const a=v.useId();return v.createElement("label",{htmlFor:a},v.createElement("input",{id:a,type:"radio",value:e,disabled:t,checked:r,onChange:s=>n(s.target.value)}),o)},U_=e=>{const{operator:t,value:r,handleOnChange:o,title:n,className:a,type:s="text",inputType:i,values:c=[],listsAsArrays:d,fieldData:f,disabled:u,separator:h=null,testID:m,selectorComponent:g=e.schema.controls.valueSelector,parseNumbers:y,skipHook:b,valueSource:C,...w}=e,{valueAsArray:x,multiValueHandler:S,bigIntValueHandler:N,parseNumberMethod:E,valueListItemClassName:M,inputTypeCoerced:k}=W_(e);if(t==="null"||t==="notNull")return null;const T=(f==null?void 0:f.placeholder)??"";if((t==="between"||t==="notBetween")&&(s==="select"||s==="text")){const A=["from","to"].map((L,O)=>s==="text"?v.createElement("input",{key:L,type:k,placeholder:T,value:x[O]??"",className:M,disabled:u,onChange:F=>S(F.target.value,O)}):v.createElement(g,{key:L,...w,schema:e.schema,className:M,handleOnChange:F=>S(F,O),disabled:u,value:x[O]??xt(c),options:c,listsAsArrays:d}));return v.createElement("span",{"data-testid":m,className:a,title:n},A[0],h,A[1])}switch(s){case"select":case"multiselect":return v.createElement(g,{...w,schema:e.schema,testID:m,className:a,title:n,handleOnChange:o,disabled:u,value:r,options:c,multiple:s==="multiselect",listsAsArrays:d});case"textarea":return v.createElement("textarea",{"data-testid":m,placeholder:T,value:r,title:n,className:a,disabled:u,onChange:A=>o(A.target.value)});case"switch":case"checkbox":return v.createElement("input",{"data-testid":m,type:"checkbox",className:a,title:n,onChange:A=>o(A.target.checked),checked:!!r,disabled:u});case"radio":return v.createElement("span",{"data-testid":m,className:a,title:n},c.map(A=>v.createElement(B_,{key:A.name,name:A.name,disabled:u,checked:r===A.name,handleOnChange:o,label:A.label})))}return i==="bigint"?v.createElement("input",{"data-testid":m,type:k,placeholder:T,value:`${r}`,title:n,className:a,disabled:u,onChange:A=>N(A.target.value)}):v.createElement("input",{"data-testid":m,type:k,placeholder:T,value:r,title:n,className:a,disabled:u,onChange:A=>o(Ds(A.target.value,{parseNumbers:E}))})},W_=e=>{const{handleOnChange:t,inputType:r,operator:o,value:n,listsAsArrays:a,parseNumbers:s,values:i,type:c,skipHook:d,schema:{classNames:f,suppressStandardClassnames:u}}=e;D.useEffect(()=>{!d&&c!=="multiselect"&&!["between","notBetween","in","notIn"].includes(o)&&(Array.isArray(n)||r==="number"&&typeof n=="string"&&n.includes(","))&&t(Es(n,{retainEmptyStrings:!0})[0]??"")},[t,r,o,d,c,n]);const h=D.useMemo(()=>Es(n,{retainEmptyStrings:!0}),[n]),m=D.useMemo(()=>pk({parseNumbers:s,inputType:r}),[r,s]);return{valueAsArray:h,multiValueHandler:D.useCallback((g,y)=>{const b=Ds(g,{parseNumbers:m}),C=y===0&&(o==="between"||o==="notBetween")&&(h.length<2||h[1]===void 0);if(h[y]===b&&!C){t(a?h:Ns(h,","));return}const w=[...h];w[y]=b,C&&(w[1]=xt(i)),t(a?w:Ns(w,","))},[t,a,o,m,h,i]),bigIntValueHandler:D.useCallback(g=>{const y=Ds(g,{parseNumbers:m,bigIntOnOverflow:!0});let b;try{b=BigInt(y)}catch{t(y);return}t(b)},[t,m]),parseNumberMethod:m,valueListItemClassName:Oe(u||me.valueListItem,f==null?void 0:f.valueListItem),inputTypeCoerced:r==="bigint"||o==="in"||o==="notIn"?"text":r||"text"}},H_=e=>{const{multiple:t,onChange:r}=e;return D.useMemo(()=>t?o=>r(Array.from(o.target.selectedOptions).map(n=>n.value)):o=>r(o.target.value),[t,r])},j_=e=>uk(e)?e.map(t=>v.createElement("optgroup",{key:t.label,label:t.label},t.options.map(r=>v.createElement("option",{key:r.name,value:r.name,disabled:r.disabled},r.label)))):Array.isArray(e)?e.map(t=>v.createElement("option",{key:t.name,value:t.name,disabled:t.disabled},t.label)):null,Un=e=>{const{onChange:t,val:r}=Y_(e),o=H_({multiple:e.multiple,onChange:t});return v.createElement("select",{"data-testid":e.testID,className:e.className,value:r,title:e.title,disabled:e.disabled,multiple:!!e.multiple,onChange:o},j_(e.options))},Y_=e=>{const{handleOnChange:t,listsAsArrays:r=!1,multiple:o=!1,value:n}=e;return{onChange:D.useCallback(a=>{if(o){const s=Es(a);t(r?s:Ns(s,","))}else t(a)},[t,r,o]),val:D.useMemo(()=>o?Es(n).map(String):n,[o,n])}},q_=({props:e})=>{const t=Qm(e),r=t.schema.controls.ruleGroup,o=qc;return v.createElement(o.Provider,{key:t.dndEnabledAttr,value:t.rqbContext},v.createElement("div",{role:"form",className:t.wrapperClassName,"data-dnd":t.dndEnabledAttr,"data-inlinecombinators":t.inlineCombinatorsAttr},v.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:Ph,disabled:t.rootGroupDisabled,shiftUpDisabled:!0,shiftDownDisabled:!0,parentDisabled:t.queryDisabled,context:e.context})))},Xs=()=>null,Q_=D.forwardRef(Xs),Js={},K_=({finalize:e,...t})=>{var g,y,b,C,w,x,S,N,E,M,k,T,A,L,O,F,V,re,K,H,ee,G,z,Ce,$,q,xe,oe,he,Y,ce,te,Ne,be,ue,X,ne,pe,Se,je,Je,Re,Ye,ye,rt,Le,Ge,Ue,Ee,ct,et,_r,Yt,_,I,P,W,U,J,B,Q,ie,De,Ve,Dt,_e,Ke,ot,dr,rn,er,on,qn,At,nn,mt,fl,Qn,Kn,Xn,an,Jn,Zn,tr,Rn,hl,ml,gl,bl,ea,yl,fe,Te,Fe,Me,Pe,wt,Pt,oo,Dr,no,Zg,Rg,eb,tb,rb,ob,nb;const r=D.useContext(qc),o=D.useMemo(()=>Ck(t,r),[t,r,e]),n=e?r.enableDragAndDrop!==!1&&qh(!1,t.enableDragAndDrop,r.enableDragAndDrop):t.enableDragAndDrop??r.enableDragAndDrop,a=D.useMemo(()=>vk(r.controlClassnames,t.controlClassnames),[r.controlClassnames,t.controlClassnames]),s=D.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,dndPreviewPosition:a.dndPreviewPosition,dndHidden:a.dndHidden,disabled:a.disabled,valueListItem:a.valueListItem,matchMode:a.matchMode,matchThreshold:a.matchThreshold,branches:a.branches,hasSubQuery:a.hasSubQuery,loading:a.loading,valueDateTimeRelative:a.valueDateTimeRelative}),[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.dndPreviewPosition,a.dndHidden,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.valueDateTimeRelative,a.valueListItem,a.valueSelector,a.valueSource]),i=r.controlElements??Js,c=t.controlElements??Js,d=D.useCallback((ur,ta,ra)=>{const oa=ur==="dragHandle"?Q_:Xs,vl=(ur.endsWith("Action")&&c.actionElement?c.actionElement:void 0)??(ur.endsWith("Selector")&&c.valueSelector?c.valueSelector:void 0),xl=(ur.endsWith("Action")&&i.actionElement?i.actionElement:void 0)??(ur.endsWith("Selector")&&i.valueSelector?i.valueSelector:void 0),na=ta===null?oa:ta??vl??(ra===null?oa:ra??xl);return na?{[ur]:na}:{[ur]:Zs[ur]}},[i.actionElement,i.valueSelector,e,c.actionElement,c.valueSelector]),f=D.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?Xs:c.valueEditor??(i.valueEditor===null?Xs:i.valueEditor)??Zs.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??Zs.actionElement},{valueSelector:c.valueSelector??i.valueSelector??Zs.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??Js,h=r.translations??Js,m=D.useMemo(()=>{var ur,ta,ra,oa,vl,xl,na,ab,sb,lb,ib,cb,db,ub,pb,fb,hb,mb,gb,bb,yb,vb,xb,wb,Cb,Sb,Nb,Eb,kb,_b,Db,Ab,Tb,Ib,Pb,Mb,Ob,Lb,Fb,$b,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,Cy,Sy,Ny,Ey,ky,_y,Dy,Ay,Ty,Iy,Py,My,Oy,Ly,Fy,$y,Gy,Vy,zy,By,Uy,Wy,Hy,jy,Yy,qy,Qy,Ky,Xy,Jy;return Object.assign({},He("addGroup",{label:[(ur=u.addGroup)==null?void 0:ur.label,(ta=h.addGroup)==null?void 0:ta.label],title:[(ra=u.addGroup)==null?void 0:ra.title,(oa=h.addGroup)==null?void 0:oa.title]},We),He("addRule",{label:[(vl=u.addRule)==null?void 0:vl.label,(xl=h.addRule)==null?void 0:xl.label],title:[(na=u.addRule)==null?void 0:na.title,(ab=h.addRule)==null?void 0:ab.title]},We),He("cloneRule",{label:[(sb=u.cloneRule)==null?void 0:sb.label,(lb=h.cloneRule)==null?void 0:lb.label],title:[(ib=u.cloneRule)==null?void 0:ib.title,(cb=h.cloneRule)==null?void 0:cb.title]},We),He("cloneRuleGroup",{label:[(db=u.cloneRuleGroup)==null?void 0:db.label,(ub=h.cloneRuleGroup)==null?void 0:ub.label],title:[(pb=u.cloneRuleGroup)==null?void 0:pb.title,(fb=h.cloneRuleGroup)==null?void 0:fb.title]},We),He("combinators",{title:[(hb=u.combinators)==null?void 0:hb.title,(mb=h.combinators)==null?void 0:mb.title]},We),He("dragHandle",{label:[(gb=u.dragHandle)==null?void 0:gb.label,(bb=h.dragHandle)==null?void 0:bb.label],title:[(yb=u.dragHandle)==null?void 0:yb.title,(vb=h.dragHandle)==null?void 0:vb.title]},We),He("fields",{placeholderGroupLabel:[(xb=u.fields)==null?void 0:xb.placeholderGroupLabel,(wb=h.fields)==null?void 0:wb.placeholderGroupLabel],placeholderLabel:[(Cb=u.fields)==null?void 0:Cb.placeholderLabel,(Sb=h.fields)==null?void 0:Sb.placeholderLabel],placeholderName:[(Nb=u.fields)==null?void 0:Nb.placeholderName,(Eb=h.fields)==null?void 0:Eb.placeholderName],title:[(kb=u.fields)==null?void 0:kb.title,(_b=h.fields)==null?void 0:_b.title]},We),He("lockGroup",{label:[(Db=u.lockGroup)==null?void 0:Db.label,(Ab=h.lockGroup)==null?void 0:Ab.label],title:[(Tb=u.lockGroup)==null?void 0:Tb.title,(Ib=h.lockGroup)==null?void 0:Ib.title]},We),He("lockGroupDisabled",{label:[(Pb=u.lockGroupDisabled)==null?void 0:Pb.label,(Mb=h.lockGroupDisabled)==null?void 0:Mb.label],title:[(Ob=u.lockGroupDisabled)==null?void 0:Ob.title,(Lb=h.lockGroupDisabled)==null?void 0:Lb.title]},We),He("lockRule",{label:[(Fb=u.lockRule)==null?void 0:Fb.label,($b=h.lockRule)==null?void 0:$b.label],title:[(Gb=u.lockRule)==null?void 0:Gb.title,(Vb=h.lockRule)==null?void 0:Vb.title]},We),He("lockRuleDisabled",{label:[(zb=u.lockRuleDisabled)==null?void 0:zb.label,(Bb=h.lockRuleDisabled)==null?void 0:Bb.label],title:[(Ub=u.lockRuleDisabled)==null?void 0:Ub.title,(Wb=h.lockRuleDisabled)==null?void 0:Wb.title]},We),He("muteGroup",{label:[(Hb=u.muteGroup)==null?void 0:Hb.label,(jb=h.muteGroup)==null?void 0:jb.label],title:[(Yb=u.muteGroup)==null?void 0:Yb.title,(qb=h.muteGroup)==null?void 0:qb.title]},We),He("unmuteGroup",{label:[(Qb=u.unmuteGroup)==null?void 0:Qb.label,(Kb=h.unmuteGroup)==null?void 0:Kb.label],title:[(Xb=u.unmuteGroup)==null?void 0:Xb.title,(Jb=h.unmuteGroup)==null?void 0:Jb.title]},We),He("muteRule",{label:[(Zb=u.muteRule)==null?void 0:Zb.label,(Rb=h.muteRule)==null?void 0:Rb.label],title:[(ey=u.muteRule)==null?void 0:ey.title,(ty=h.muteRule)==null?void 0:ty.title]},We),He("unmuteRule",{label:[(ry=u.unmuteRule)==null?void 0:ry.label,(oy=h.unmuteRule)==null?void 0:oy.label],title:[(ny=u.unmuteRule)==null?void 0:ny.title,(ay=h.unmuteRule)==null?void 0:ay.title]},We),He("notToggle",{label:[(sy=u.notToggle)==null?void 0:sy.label,(ly=h.notToggle)==null?void 0:ly.label],title:[(iy=u.notToggle)==null?void 0:iy.title,(cy=h.notToggle)==null?void 0:cy.title]},We),He("operators",{placeholderGroupLabel:[(dy=u.operators)==null?void 0:dy.placeholderGroupLabel,(uy=h.operators)==null?void 0:uy.placeholderGroupLabel],placeholderLabel:[(py=u.operators)==null?void 0:py.placeholderLabel,(fy=h.operators)==null?void 0:fy.placeholderLabel],placeholderName:[(hy=u.operators)==null?void 0:hy.placeholderName,(my=h.operators)==null?void 0:my.placeholderName],title:[(gy=u.operators)==null?void 0:gy.title,(by=h.operators)==null?void 0:by.title]},We),He("values",{placeholderGroupLabel:[(yy=u.values)==null?void 0:yy.placeholderGroupLabel,(vy=h.values)==null?void 0:vy.placeholderGroupLabel],placeholderLabel:[(xy=u.values)==null?void 0:xy.placeholderLabel,(wy=h.values)==null?void 0:wy.placeholderLabel],placeholderName:[(Cy=u.values)==null?void 0:Cy.placeholderName,(Sy=h.values)==null?void 0:Sy.placeholderName],title:[(Ny=u.values)==null?void 0:Ny.title,(Ey=h.values)==null?void 0:Ey.title]},We),He("removeGroup",{label:[(ky=u.removeGroup)==null?void 0:ky.label,(_y=h.removeGroup)==null?void 0:_y.label],title:[(Dy=u.removeGroup)==null?void 0:Dy.title,(Ay=h.removeGroup)==null?void 0:Ay.title]},We),He("removeRule",{label:[(Ty=u.removeRule)==null?void 0:Ty.label,(Iy=h.removeRule)==null?void 0:Iy.label],title:[(Py=u.removeRule)==null?void 0:Py.title,(My=h.removeRule)==null?void 0:My.title]},We),He("shiftActionDown",{label:[(Oy=u.shiftActionDown)==null?void 0:Oy.label,(Ly=h.shiftActionDown)==null?void 0:Ly.label],title:[(Fy=u.shiftActionDown)==null?void 0:Fy.title,($y=h.shiftActionDown)==null?void 0:$y.title]},We),He("shiftActionUp",{label:[(Gy=u.shiftActionUp)==null?void 0:Gy.label,(Vy=h.shiftActionUp)==null?void 0:Vy.label],title:[(zy=u.shiftActionUp)==null?void 0:zy.title,(By=h.shiftActionUp)==null?void 0:By.title]},We),He("matchMode",{title:[(Uy=u.matchMode)==null?void 0:Uy.title,(Wy=h.matchMode)==null?void 0:Wy.title]},We),He("matchThreshold",{title:[(Hy=u.matchThreshold)==null?void 0:Hy.title,(jy=h.matchThreshold)==null?void 0:jy.title],placeholderName:[(Yy=u.matchThreshold)==null?void 0:Yy.placeholderName,(qy=h.matchThreshold)==null?void 0:qy.placeholderName]},We),He("value",{title:[(Qy=u.value)==null?void 0:Qy.title,(Ky=h.value)==null?void 0:Ky.title]},We),He("valueSourceSelector",{title:[(Xy=u.valueSourceSelector)==null?void 0:Xy.title,(Jy=h.valueSourceSelector)==null?void 0:Jy.title]},We))},[(g=h.addGroup)==null?void 0:g.label,(y=h.addGroup)==null?void 0:y.title,(b=h.addRule)==null?void 0:b.label,(C=h.addRule)==null?void 0:C.title,(w=h.cloneRule)==null?void 0:w.label,(x=h.cloneRule)==null?void 0:x.title,(S=h.cloneRuleGroup)==null?void 0:S.label,(N=h.cloneRuleGroup)==null?void 0:N.title,(E=h.combinators)==null?void 0:E.title,(M=h.dragHandle)==null?void 0:M.label,(k=h.dragHandle)==null?void 0:k.title,(T=h.fields)==null?void 0:T.placeholderGroupLabel,(A=h.fields)==null?void 0:A.placeholderLabel,(L=h.fields)==null?void 0:L.placeholderName,(O=h.fields)==null?void 0:O.title,(F=h.lockGroup)==null?void 0:F.label,(V=h.lockGroup)==null?void 0:V.title,(re=h.lockGroupDisabled)==null?void 0:re.label,(K=h.lockGroupDisabled)==null?void 0:K.title,(H=h.lockRule)==null?void 0:H.label,(ee=h.lockRule)==null?void 0:ee.title,(G=h.lockRuleDisabled)==null?void 0:G.label,(z=h.lockRuleDisabled)==null?void 0:z.title,(Ce=h.muteGroup)==null?void 0:Ce.label,($=h.muteGroup)==null?void 0:$.title,(q=h.unmuteGroup)==null?void 0:q.label,(xe=h.unmuteGroup)==null?void 0:xe.title,(oe=h.muteRule)==null?void 0:oe.label,(he=h.muteRule)==null?void 0:he.title,(Y=h.unmuteRule)==null?void 0:Y.label,(ce=h.unmuteRule)==null?void 0:ce.title,(te=h.matchMode)==null?void 0:te.title,(Ne=h.matchThreshold)==null?void 0:Ne.title,(be=h.matchThreshold)==null?void 0:be.placeholderName,(ue=h.notToggle)==null?void 0:ue.label,(X=h.notToggle)==null?void 0:X.title,(ne=h.operators)==null?void 0:ne.placeholderGroupLabel,(pe=h.operators)==null?void 0:pe.placeholderLabel,(Se=h.operators)==null?void 0:Se.placeholderName,(je=h.operators)==null?void 0:je.title,(Je=h.removeGroup)==null?void 0:Je.label,(Re=h.removeGroup)==null?void 0:Re.title,(Ye=h.removeRule)==null?void 0:Ye.label,(ye=h.removeRule)==null?void 0:ye.title,(rt=h.shiftActionDown)==null?void 0:rt.label,(Le=h.shiftActionDown)==null?void 0:Le.title,(Ge=h.shiftActionUp)==null?void 0:Ge.label,(Ue=h.shiftActionUp)==null?void 0:Ue.title,(Ee=h.value)==null?void 0:Ee.title,(ct=h.values)==null?void 0:ct.placeholderGroupLabel,(et=h.values)==null?void 0:et.placeholderLabel,(_r=h.values)==null?void 0:_r.placeholderName,(Yt=h.values)==null?void 0:Yt.title,(_=h.valueSourceSelector)==null?void 0:_.title,e,(I=u.addGroup)==null?void 0:I.label,(P=u.addGroup)==null?void 0:P.title,(W=u.addRule)==null?void 0:W.label,(U=u.addRule)==null?void 0:U.title,(J=u.cloneRule)==null?void 0:J.label,(B=u.cloneRule)==null?void 0:B.title,(Q=u.cloneRuleGroup)==null?void 0:Q.label,(ie=u.cloneRuleGroup)==null?void 0:ie.title,(De=u.combinators)==null?void 0:De.title,(Ve=u.dragHandle)==null?void 0:Ve.label,(Dt=u.dragHandle)==null?void 0:Dt.title,(_e=u.fields)==null?void 0:_e.placeholderGroupLabel,(Ke=u.fields)==null?void 0:Ke.placeholderLabel,(ot=u.fields)==null?void 0:ot.placeholderName,(dr=u.fields)==null?void 0:dr.title,(rn=u.lockGroup)==null?void 0:rn.label,(er=u.lockGroup)==null?void 0:er.title,(on=u.lockGroupDisabled)==null?void 0:on.label,(qn=u.lockGroupDisabled)==null?void 0:qn.title,(At=u.lockRule)==null?void 0:At.label,(nn=u.lockRule)==null?void 0:nn.title,(mt=u.lockRuleDisabled)==null?void 0:mt.label,(fl=u.lockRuleDisabled)==null?void 0:fl.title,(Qn=u.muteGroup)==null?void 0:Qn.label,(Kn=u.muteGroup)==null?void 0:Kn.title,(Xn=u.unmuteGroup)==null?void 0:Xn.label,(an=u.unmuteGroup)==null?void 0:an.title,(Jn=u.muteRule)==null?void 0:Jn.label,(Zn=u.muteRule)==null?void 0:Zn.title,(tr=u.unmuteRule)==null?void 0:tr.label,(Rn=u.unmuteRule)==null?void 0:Rn.title,(hl=u.matchMode)==null?void 0:hl.title,(ml=u.matchThreshold)==null?void 0:ml.title,(gl=u.matchThreshold)==null?void 0:gl.placeholderName,(bl=u.notToggle)==null?void 0:bl.label,(ea=u.notToggle)==null?void 0:ea.title,(yl=u.operators)==null?void 0:yl.placeholderGroupLabel,(fe=u.operators)==null?void 0:fe.placeholderLabel,(Te=u.operators)==null?void 0:Te.placeholderName,(Fe=u.operators)==null?void 0:Fe.title,(Me=u.removeGroup)==null?void 0:Me.label,(Pe=u.removeGroup)==null?void 0:Pe.title,(wt=u.removeRule)==null?void 0:wt.label,(Pt=u.removeRule)==null?void 0:Pt.title,(oo=u.shiftActionDown)==null?void 0:oo.label,(Dr=u.shiftActionDown)==null?void 0:Dr.title,(no=u.shiftActionUp)==null?void 0:no.label,(Zg=u.shiftActionUp)==null?void 0:Zg.title,(Rg=u.value)==null?void 0:Rg.title,(eb=u.values)==null?void 0:eb.placeholderGroupLabel,(tb=u.values)==null?void 0:tb.placeholderLabel,(rb=u.values)==null?void 0:rb.placeholderName,(ob=u.values)==null?void 0:ob.title,(nb=u.valueSourceSelector)==null?void 0:nb.title]);return{...o,controlClassnames:s,controlElements:f,enableDragAndDrop:n,translations:m,initialQuery:t.initialQuery,qbId:t.qbId}},X_=({disabled:e,path:t,nestedArray:r,disabledPaths:o})=>{const n=r.length;return D.useMemo(()=>{const a=[];for(let s=0;s<n;s++){const i=[...t,s];a[s]={path:i,disabled:e||o.some(c=>Eo(i,c))}}return a},[e,t,n,o])};let Xm=!1;const Jm=(e,t)=>{process.env.NODE_ENV!=="production"&&!Xm&&e&&!t&&(console.error(Nt.errorEnabledDndWithoutReactDnD),Xm=!0)},st=e=>D.useCallback((t,r)=>{t==null||t.preventDefault(),t==null||t.stopPropagation(),e(t,r)},[e]),J_={mode:"all"},Z_=[{name:"",value:"",label:""}],R_=v.memo(function(t){const r=rD(t),{dndRef:o}=r,n=st(r.cloneRule),a=st(r.toggleLockRule),s=st(r.toggleMuteRule),i=st(r.removeRule),c=st(r.shiftRuleUp),d=st(r.shiftRuleDown),f=D.useMemo(()=>({cloneRule:n,toggleLockRule:a,toggleMuteRule:s,removeRule:i,shiftRuleUp:c,shiftRuleDown:d}),[n,i,d,c,a,s]);return v.createElement("div",{ref:o,"data-testid":ge.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?v.createElement(tD,{...r,...f}):v.createElement(Zm,{...r,...f}))}),Zm=v.memo(function(t){const{dragRef:r,schema:{controls:{shiftActions:o,dragHandle:n,fieldSelector:a,matchModeEditor:s,operatorSelector:i,valueSourceSelector:c,valueEditor:d,cloneRuleAction:f,lockRuleAction:u,muteRuleAction:h,removeRuleAction:m,ruleGroupBodyElements:g,ruleGroupHeaderElements:y}},groupComponentsWrapper:b=v.Fragment}=t,C=D.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=D.useMemo(()=>!(t.schema.fields.length===1&&Jr(t.schema.fields[0])&&"value"in t.schema.fields[0]&&t.schema.fields[0].value===""),[t.schema.fields]),x=D.useMemo(()=>t.schema.showShiftActions?{shiftUp:t.translations.shiftActionUp.title,shiftDown:t.translations.shiftActionDown.title}:void 0,[t.schema.showShiftActions,t.translations]),S=D.useMemo(()=>t.schema.showShiftActions?{shiftUp:t.translations.shiftActionUp.label,shiftDown:t.translations.shiftActionDown.label}:void 0,[t.schema.showShiftActions,t.translations]);return v.createElement(v.Fragment,null,t.schema.showShiftActions&&v.createElement(o,{key:ge.shiftActions,...C,testID:ge.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&&v.createElement(n,{key:ge.dragHandle,...C,testID:ge.dragHandle,ref:r,title:t.translations.dragHandle.title,label:t.translations.dragHandle.label,className:t.classNames.dragHandle,dragHandleAttributes:t.dragHandleAttributes,ruleOrGroup:t.rule}),w&&v.createElement(a,{key:ge.fields,...C,testID:ge.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?v.createElement(s,{key:ge.matchModeEditor,...C,testID:ge.matchModeEditor,field:t.rule.field,fieldData:t.fieldData,title:t.translations.matchMode.title,options:t.matchModes,thresholdPlaceholder:t.translations.matchThreshold.placeholderName,match:t.rule.match??J_,className:t.classNames.matchMode,classNames:t.classNames,handleOnChange:t.onChangeMatchMode}):v.createElement(v.Fragment,null,v.createElement(i,{key:ge.operators,...C,testID:ge.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&&v.createElement(v.Fragment,null,!["null","notnull"].includes(No(`${t.rule.operator}`))&&t.valueSources.length>1&&v.createElement(c,{key:ge.valueSourceSelector,...C,testID:ge.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}),v.createElement(d,{key:ge.valueEditor,...C,testID:ge.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&&v.createElement(b,{className:t.subQuery.classNames.header},v.createElement(y,t.subQuery)),t.schema.showCloneButtons&&v.createElement(f,{key:ge.cloneRule,...C,testID:ge.cloneRule,label:t.translations.cloneRule.label,title:t.translations.cloneRule.title,className:t.classNames.cloneRule,ruleOrGroup:t.rule,handleOnClick:t.cloneRule}),t.schema.showLockButtons&&v.createElement(u,{key:ge.lockRule,...C,testID:ge.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&&v.createElement(h,{key:ge.muteRule,...C,testID:ge.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}),v.createElement(m,{key:ge.removeRule,...C,testID:ge.removeRule,label:t.translations.removeRule.label,title:t.translations.removeRule.title,className:t.classNames.removeRule,ruleOrGroup:t.rule,handleOnClick:t.removeRule}),t.subQuery&&v.createElement(b,{className:t.subQuery.classNames.body},v.createElement(g,t.subQuery)))}),eD=e=>v.createElement("div",e),tD=v.memo(function(t){const r=D.useMemo(()=>t.schema.createRuleGroup(),[t.schema]),o=Qm({...t.subQueryBuilderProps,enableDragAndDrop:!1,disabled:t.disabled,fields:t.subproperties.fields,enableMountQueryChange:!Xe(t.rule.value)||!t.rule.value.id,query:Xe(t.rule.value)?t.rule.value:r,onQueryChange:t.onChangeValue}),n=Km({...o,ruleGroup:o.rootGroup,path:Ph,disabled:t.disabled,parentDisabled:o.queryDisabled,id:o.rootGroup.id,shiftUpDisabled:!0,shiftDownDisabled:!0}),a=st(n.addRule),s=st(n.addGroup),i=st(n.cloneGroup),c=st(n.toggleLockGroup),d=st(n.removeGroup),f=st(n.shiftGroupUp),u=st(n.shiftGroupDown),h=D.useMemo(()=>({...n,addGroup:s,addRule:a,cloneGroup:i,removeGroup:d,shiftGroupDown:u,shiftGroupUp:f,toggleLockGroup:c}),[s,a,i,d,u,f,n,c]);return v.createElement(Zm,{...t,groupComponentsWrapper:t.groupComponentsWrapper??eD,subQuery:h})}),rD=e=>{const{id:t,path:r,rule:o,schema:{classNames:n,fields:a,fieldMap:s,getParameters:i,getInputType:c,getMatchModes:d,getOperators:f,getSubQueryBuilderProps:u,getValueEditorType:h,getValueEditorSeparator:m,getValueSources:g,getValues:y,validationMap:b,enableDragAndDrop:C,getRuleClassname:w,suppressStandardClassnames:x},actions:{moveRule:S,onPropChange:N,onRuleRemove:E},disabled:M,parentDisabled:k,parentMuted:T,shiftUpDisabled:A,shiftDownDisabled:L,field:O,operator:F,value:V,valueSource:re,dropEffect:K="move",groupItems:H=!1,dragMonitorId:ee="",dropMonitorId:G="",dndRef:z=null,dragRef:Ce=null,isDragging:$=!1,isOver:q=!1,dropNotAllowed:xe=!1}=e;jc("rule",!o),Jm(C,!!(ee||G||z||Ce));const oe=!!k||!!M,he=!!T||!!(o!=null&&o.muted),Y=D.useMemo(()=>o??{id:t,field:O??"",operator:F??"",value:V,valueSource:re},[O,t,F,o,V,re]),ce=D.useMemo(()=>({shiftActions:Oe(x||me.shiftActions,n.shiftActions),dragHandle:Oe(x||me.dragHandle,n.dragHandle),fields:Oe(x||me.fields,n.valueSelector,n.fields),matchMode:Oe(x||me.matchMode,n.valueSelector,n.matchMode),matchThreshold:Oe(x||me.matchThreshold,n.valueSelector,n.matchThreshold),operators:Oe(x||me.operators,n.valueSelector,n.operators),valueSource:Oe(x||me.valueSource,n.valueSelector,n.valueSource),value:Oe(x||me.value,n.value),cloneRule:Oe(x||me.cloneRule,n.actionElement,n.cloneRule),lockRule:Oe(x||me.lockRule,n.actionElement,n.lockRule),muteRule:Oe(x||me.muteRule,n.actionElement,n.muteRule),removeRule:Oe(x||me.removeRule,n.actionElement,n.removeRule),valueListItem:Oe(x||me.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]),te=D.useCallback(_e=>(Ke,ot)=>{oe||N(_e,Ke,r,ot)},[oe,N,r]),Ne=D.useMemo(()=>te("field"),[te]),be=D.useMemo(()=>te("operator"),[te]),ue=D.useMemo(()=>te("match"),[te]),X=D.useMemo(()=>te("valueSource"),[te]),ne=D.useMemo(()=>te("value"),[te]),pe=D.useCallback((_e,Ke)=>{if(!oe){const ot=[...at(r),r.at(-1)+1];S(r,ot,!0,Ke)}},[oe,S,r]),Se=D.useCallback((_e,Ke)=>N("disabled",!oe,r,Ke),[oe,N,r]),je=D.useCallback((_e,Ke)=>N("muted",!Y.muted,r,Ke),[Y.muted,N,r]),Je=D.useCallback((_e,Ke)=>{oe||E(r)},[oe,E,r]),Re=D.useCallback((_e,Ke)=>{!oe&&!A&&S(r,"up",_e==null?void 0:_e.altKey,Ke)},[oe,S,r,A]),Ye=D.useCallback((_e,Ke)=>{!oe&&!L&&S(r,"down",_e==null?void 0:_e.altKey,Ke)},[oe,S,r,L]),ye=D.useMemo(()=>(s==null?void 0:s[Y.field])??{name:Y.field,value:Y.field,label:Y.field},[s,Y.field]),rt=D.useMemo(()=>ye.inputType??c(Y.field,Y.operator,{fieldData:ye}),[ye,c,Y.field,Y.operator]),Le=D.useMemo(()=>d(Y.field,{fieldData:ye}),[ye,d,Y.field]),Ge=D.useMemo(()=>f(Y.field,{fieldData:ye}),[ye,f,Y.field]),Ue=D.useMemo(()=>Ko(Ge,Y.operator),[Ge,Y.operator]),Ee=Ue==null?void 0:Ue.arity,ct=typeof Ee=="string"&&Ee==="unary"||typeof Ee=="number"&&Ee<2,et=D.useMemo(()=>{const _e=g(Y.field,Y.operator,{fieldData:ye});return Y.valueSource&&!Ko(_e,Y.valueSource)?[..._e,{name:Y.valueSource,value:Y.valueSource,label:Y.valueSource}]:_e},[ye,g,Y.field,Y.operator,Y.valueSource]),_r=D.useMemo(()=>et.map(({value:_e})=>_e),[et]),Yt=D.useMemo(()=>i(Y.field,Y.operator,{fieldData:ye}),[ye,i,Y.field,Y.operator]),_=D.useMemo(()=>Yt&&Yt.length>0?Yt:null,[Yt]),I=D.useMemo(()=>Y.valueSource==="field"?"select":Y.valueSource==="parameter"?_?No(Y.operator)==="in"||No(Y.operator)==="notin"?"multiselect":"select":"text":h(Y.field,Y.operator,{fieldData:ye}),[ye,h,_,Y.field,Y.operator,Y.valueSource]),P=D.useMemo(()=>m(Y.field,Y.operator,{fieldData:ye}),[ye,m,Y.field,Y.operator]),W=D.useMemo(()=>{const _e=Y.valueSource==="field"?zh(ye,a,Y.operator):Y.valueSource==="parameter"?_??[]:y(Y.field,Y.operator,{fieldData:ye});return _s(_e)||Zr(_e)?ks(_e):_e},[ye,a,y,_,Y.field,Y.operator,Y.valueSource]),U=D.useMemo(()=>u(Y.field,{fieldData:ye}),[ye,u,Y.field]),J=jm({translations:e.translations,fields:ye.subproperties??U.fields??Z_,autoSelectField:e.schema.autoSelectField||!!ye.subproperties}),B=D.useMemo(()=>b[t??""]??(typeof ye.validator=="function"?ye.validator(Y):null),[ye,t,Y,b]),Q=D.useMemo(()=>Hh(B),[B]),ie=(ye==null?void 0:ye.className)??"",De=(Ue==null?void 0:Ue.className)??"",Ve=Le.length>0,Dt=D.useMemo(()=>Oe(w(Y,{fieldData:ye}),ie,De,x||me.rule,n.rule,oe&&n.disabled,he&&n.muted,$&&n.dndDragging,q&&n.dndOver,q&&K==="copy"&&n.dndCopy,q&&H&&n.dndGroup,xe&&n.dndDropNotAllowed,Ve&&n.hasSubQuery,x||{[me.disabled]:oe,[me.muted]:he,[me.dndDragging]:$,[me.dndOver]:q,[me.dndCopy]:q&&K==="copy",[me.dndGroup]:q&&H,[me.dndDropNotAllowed]:xe,[me.hasSubQuery]:Ve},Q),[n.disabled,n.muted,n.dndCopy,n.dndDragging,n.dndGroup,n.dndOver,n.dndDropNotAllowed,n.hasSubQuery,n.rule,oe,K,xe,he,ie,ye,w,H,Ve,$,q,De,Y,x,Q]);return{...e,classNames:ce,cloneRule:pe,disabled:oe,dndRef:z,dragMonitorId:ee,dragRef:Ce,dropMonitorId:G,fieldData:ye,generateOnChangeHandler:te,onChangeField:Ne,onChangeMatchMode:ue,onChangeOperator:be,onChangeValueSource:X,onChangeValue:ne,hideValueControls:ct,inputType:rt,matchModes:Le,muted:he,operators:Ge,outerClassName:Dt,removeRule:Je,rule:Y,shiftRuleUp:Re,shiftRuleDown:Ye,subproperties:J,subQueryBuilderProps:U,toggleLockRule:Se,toggleMuteRule:je,validationResult:B,valueEditorSeparator:P,valueEditorType:I,values:W,valueSourceOptions:et,valueSources:_r}},Zs={actionElement:lr,addGroupAction:lr,addRuleAction:lr,cloneGroupAction:lr,cloneRuleAction:lr,combinatorSelector:Un,dragHandle:p_,fieldSelector:Un,inlineCombinator:f_,lockGroupAction:lr,lockRuleAction:lr,matchModeEditor:h_,muteGroupAction:lr,muteRuleAction:lr,notToggle:g_,operatorSelector:Un,removeGroupAction:lr,removeRuleAction:lr,rule:R_,ruleGroup:$_,ruleGroupBodyElements:V_,ruleGroupHeaderElements:G_,shiftActions:z_,valueEditor:U_,valueSelector:Un,valueSourceSelector:Un};Ym();const oD=e=>v.createElement(l_,{context:Wm,store:Ym()},e.children),Rs=e=>v.createElement(oD,null,v.createElement(q_,{props:e}));function Rm(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=nD(e.logic,t,r),e.logic.requireWhen&&(o.required=el(e.logic.requireWhen,t,r)),e.logic.disableWhen&&(o.disabled=el(e.logic.disableWhen,t,r))),o}function nD(e,t,r){const{showWhen:o,hideWhen:n}=e;let a=!0;if(o&&o.rules&&o.rules.length>0&&(a=el(o,t,r)),n&&n.rules&&n.rules.length>0){const s=el(n,t,r);a=a&&!s}return a}function el(e,t,r){if(!e||!e.rules||e.rules.length===0)return!0;const{combinator:o,rules:n}=e,a=n.map(s=>{const i=r.find(f=>f.id===s.field||f.attributes.name===s.field),c=(i==null?void 0:i.attributes.name)||s.field,d=t[c];return aD(d,s.operator,s.value)});return o==="and"?a.every(s=>s):a.some(s=>s)}function aD(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 sD(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"}],s=[...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 s;case"multipleChoice":case"tags":return i;case"date":case"time":case"dateTime":case"dateRange":case"multipleDates":return[...r,{name:"greaterThan",label:"is after"},{name:"lessThan",label:"is before"},{name:"between",label:"is between"},...t];case"fileUpload":case"imageUpload":case"multiFileUpload":case"multiImageUpload":return t;case"singleChoiceMatrix":case"multipleChoiceMatrix":case"matrixTable":return t;default:return[...r,...t]}}function lD(e){switch(e){case"number":case"slider":case"rangeSlider":return"number";case"decisionBox":case"toggleSwitch":return"checkbox";case"date":case"dateRange":case"multipleDates":return"date";case"time":return"time";case"dateTime":return"datetime-local";case"singleChoice":case"dropdown":case"multipleChoice":case"tags":return"select";case"email":return"email";default:return"text"}}function iD(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 tl(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 rl(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 ol=({title:e,children:t,defaultOpen:r=!1,badge:o})=>{const[n,a]=D.useState(r);return l.jsxs(Uf,{open:n,onOpenChange:a,className:p("border border-border rounded-lg overflow-hidden"),children:[l.jsx(Wf,{asChild:!0,children:l.jsxs(Ze,{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:[l.jsxs("span",{className:p("flex items-center gap-2 text-sm font-medium text-foreground"),children:[e,o&&l.jsx(Oi,{variant:"secondary",className:p("text-xs"),children:o})]}),l.jsx(Yo,{className:p("h-4 w-4 transition-transform",n&&"rotate-180")})]})}),l.jsx(Hf,{children:l.jsx("div",{className:p("p-3 bg-card"),children:t})})]})},cD=({element:e,elements:t,onUpdate:r})=>{var u,h,m,g,y,b,C,w,x,S,N,E,M,k,T,A,L,O,F,V,re,K,H,ee,G,z,Ce,$,q,xe,oe,he,Y,ce,te,Ne,be,ue,X,ne,pe,Se,je,Je,Re,Ye,ye,rt;const o=D.useMemo(()=>t.filter(Le=>Le.id!==e.id).filter(Le=>!["divider","spacer","paragraph","image","link","formHeading","sectionHeading","subheading","submit"].includes(Le.type)).map(Le=>{var ct;const Ge=sD(Le.type),Ue=lD(Le.type),Ee=iD(Le);return{name:Le.id,label:Le.properties.label||Le.attributes.name||`Field ${Le.order+1}`,inputType:Ue,operators:Ge.map(et=>({name:et.name,label:et.label})),values:Ee==null?void 0:Ee.map(et=>({name:et.name,label:et.label})),defaultOperator:((ct=Ge[0])==null?void 0:ct.name)||"equals"}}),[t,e.id]),n=D.useCallback(Le=>{const Ge=rl(Le),Ue={...e.logic,showWhen:Ge.rules.length>0?Ge:void 0};r({logic:Ue})},[e.logic,r]),a=D.useCallback(Le=>{const Ge=rl(Le),Ue={...e.logic,hideWhen:Ge.rules.length>0?Ge:void 0};r({logic:Ue})},[e.logic,r]),s=D.useCallback(Le=>{const Ge=rl(Le),Ue={...e.logic,requireWhen:Ge.rules.length>0?Ge:void 0};r({logic:Ue})},[e.logic,r]),i=D.useCallback(Le=>{const Ge=rl(Le),Ue={...e.logic,disableWhen:Ge.rules.length>0?Ge:void 0};r({logic:Ue})},[e.logic,r]),c=D.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||(((g=(m=e.logic.hideWhen)==null?void 0:m.rules)==null?void 0:g.length)??0)>0||(((b=(y=e.logic.requireWhen)==null?void 0:y.rules)==null?void 0:b.length)??0)>0||(((w=(C=e.logic.disableWhen)==null?void 0:C.rules)==null?void 0:w.length)??0)>0),f=(((N=(S=(x=e.logic)==null?void 0:x.showWhen)==null?void 0:S.rules)==null?void 0:N.length)??0)+(((k=(M=(E=e.logic)==null?void 0:E.hideWhen)==null?void 0:M.rules)==null?void 0:k.length)??0)+(((L=(A=(T=e.logic)==null?void 0:T.requireWhen)==null?void 0:A.rules)==null?void 0:L.length)??0)+(((V=(F=(O=e.logic)==null?void 0:O.disableWhen)==null?void 0:F.rules)==null?void 0:V.length)??0);return o.length===0?l.jsxs("div",{className:p("text-sm text-muted-foreground p-4 text-center bg-muted/50 rounded-lg"),children:[l.jsx(mf,{className:p("w-8 h-8 mx-auto mb-2 text-muted-foreground/50")}),l.jsx("p",{children:"Add more fields to enable conditional logic."}),l.jsx("p",{className:p("text-xs mt-1"),children:"Logic rules require other fields to reference."})]}):l.jsxs("div",{className:p("space-y-3"),children:[l.jsxs("div",{className:p("flex items-center justify-between"),children:[l.jsx("div",{className:p("text-sm text-muted-foreground"),children:d?l.jsxs("span",{className:p("flex items-center gap-2"),children:[l.jsx("span",{className:p("w-2 h-2 bg-primary rounded-full")}),f," rule",f!==1?"s":""," ","configured"]}):l.jsx("span",{className:p("text-muted-foreground/70"),children:"No logic configured"})}),d&&l.jsxs(Ze,{variant:"ghost",size:"sm",className:p("text-destructive hover:text-destructive hover:bg-destructive/10"),onClick:c,children:[l.jsx(Ti,{className:p("h-3 w-3 mr-1")}),"Clear all"]})]}),l.jsxs(ol,{title:"Show When",defaultOpen:!!((H=(K=(re=e.logic)==null?void 0:re.showWhen)==null?void 0:K.rules)!=null&&H.length),badge:(z=(G=(ee=e.logic)==null?void 0:ee.showWhen)==null?void 0:G.rules)!=null&&z.length?String(e.logic.showWhen.rules.length):void 0,children:[l.jsx("p",{className:p("text-xs text-muted-foreground mb-2"),children:"This element will only be visible when these conditions are met."}),l.jsx("div",{className:p("query-builder-wrapper"),children:l.jsx(Rs,{fields:o,query:tl((Ce=e.logic)==null?void 0:Ce.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"}})})]}),l.jsxs(ol,{title:"Hide When",defaultOpen:!!((xe=(q=($=e.logic)==null?void 0:$.hideWhen)==null?void 0:q.rules)!=null&&xe.length),badge:(Y=(he=(oe=e.logic)==null?void 0:oe.hideWhen)==null?void 0:he.rules)!=null&&Y.length?String(e.logic.hideWhen.rules.length):void 0,children:[l.jsx("p",{className:p("text-xs text-muted-foreground mb-2"),children:"This element will be hidden when these conditions are met."}),l.jsx("div",{className:p("query-builder-wrapper"),children:l.jsx(Rs,{fields:o,query:tl((ce=e.logic)==null?void 0:ce.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"}})})]}),l.jsxs(ol,{title:"Required When",defaultOpen:!!((be=(Ne=(te=e.logic)==null?void 0:te.requireWhen)==null?void 0:Ne.rules)!=null&&be.length),badge:(ne=(X=(ue=e.logic)==null?void 0:ue.requireWhen)==null?void 0:X.rules)!=null&&ne.length?String(e.logic.requireWhen.rules.length):void 0,children:[l.jsx("p",{className:p("text-xs text-muted-foreground mb-2"),children:"This element will be required when these conditions are met."}),l.jsx("div",{className:p("query-builder-wrapper"),children:l.jsx(Rs,{fields:o,query:tl((pe=e.logic)==null?void 0:pe.requireWhen),onQueryChange:s,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"}})})]}),l.jsxs(ol,{title:"Disabled When",defaultOpen:!!((Je=(je=(Se=e.logic)==null?void 0:Se.disableWhen)==null?void 0:je.rules)!=null&&Je.length),badge:(ye=(Ye=(Re=e.logic)==null?void 0:Re.disableWhen)==null?void 0:Ye.rules)!=null&&ye.length?String(e.logic.disableWhen.rules.length):void 0,children:[l.jsx("p",{className:p("text-xs text-muted-foreground mb-2"),children:"This element will be disabled when these conditions are met."}),l.jsx("div",{className:p("query-builder-wrapper"),children:l.jsx(Rs,{fields:o,query:tl((rt=e.logic)==null?void 0:rt.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 dD=Object.defineProperty,uD=(e,t)=>dD(e,"name",{value:t,configurable:!0}),pD=v.forwardRef(uD(function(t,r){return l.jsx(Ie.label,{...t,ref:r,onMouseDown:o=>{var a;o.target.closest("button, input, select, textarea")||((a=t.onMouseDown)==null||a.call(t,o),!o.defaultPrevented&&o.detail>1&&o.preventDefault())}})},"Label")),eg=pD;const fD=es("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Zt=v.forwardRef(({className:e,...t},r)=>l.jsx(eg,{ref:r,className:p(fD(),e),...t}));Zt.displayName=eg.displayName;const Qc=v.forwardRef(({className:e,...t},r)=>l.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}));Qc.displayName="Textarea";var hD=Object.defineProperty,Vr=(e,t)=>hD(e,"name",{value:t,configurable:!0}),Kc="Checkbox",[mD,gI]=rr(Kc),[gD,Xc]=mD(Kc);function tg(e){const{__scopeCheckbox:t,checked:r,children:o,defaultChecked:n,disabled:a,form:s,name:i,onCheckedChange:c,required:d,value:f="on",internal_do_not_use_render:u}=e,[h,m]=br({prop:r,defaultProp:n??!1,onChange:c,caller:Kc}),[g,y]=v.useState(null),[b,C]=v.useState(null),w=v.useRef(!1),[x,S]=v.useReducer(M=>M+1,0),N=g?!!s||!!g.closest("form"):!0,E={checked:h,disabled:a,setChecked:m,control:g,setControl:y,name:i,form:s,value:f,hasConsumerStoppedPropagationRef:w,userInteractionCount:x,onUserInteraction:S,required:d,defaultChecked:zr(n)?!1:n,isFormControl:N,bubbleInput:b,setBubbleInput:C};return l.jsx(gD,{scope:t,...E,children:og(u)?u(E):o})}Vr(tg,"CheckboxProvider");var bD="CheckboxTrigger",yD=v.forwardRef(Vr(function({__scopeCheckbox:t,onKeyDown:r,onClick:o,...n},a){const{control:s,value:i,disabled:c,checked:d,required:f,setControl:u,setChecked:h,hasConsumerStoppedPropagationRef:m,onUserInteraction:g,isFormControl:y,bubbleInput:b}=Xc(bD,t),C=ze(a,u),w=v.useRef(d);return v.useEffect(()=>{const x=s==null?void 0:s.form;if(x){const S=Vr(()=>h(w.current),"reset");return x.addEventListener("reset",S),()=>x.removeEventListener("reset",S)}},[s,h]),l.jsx(Ie.button,{type:"button",role:"checkbox","aria-checked":zr(d)?"mixed":d,"aria-required":f,"data-state":Jc(d),"data-disabled":c?"":void 0,disabled:c,value:i,...n,ref:C,onKeyDown:we(r,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:we(o,x=>{g(),h(S=>zr(S)?!0:!S),b&&y&&(m.current=x.isPropagationStopped(),m.current||x.stopPropagation())})})},"CheckboxTrigger")),rg=v.forwardRef(Vr(function(t,r){const{__scopeCheckbox:o,name:n,checked:a,defaultChecked:s,required:i,disabled:c,value:d,onCheckedChange:f,form:u,...h}=t;return l.jsx(tg,{__scopeCheckbox:o,checked:a,defaultChecked:s,disabled:c,required:i,onCheckedChange:f,name:n,form:u,value:d,internal_do_not_use_render:({isFormControl:m})=>l.jsxs(l.Fragment,{children:[l.jsx(yD,{...h,ref:r,__scopeCheckbox:o}),m&&l.jsx(CD,{__scopeCheckbox:o})]})})},"Checkbox")),vD="CheckboxIndicator",xD=v.forwardRef(Vr(function(t,r){const{__scopeCheckbox:o,forceMount:n,...a}=t,s=Xc(vD,o);return l.jsx(Vo,{present:n||zr(s.checked)||s.checked===!0,children:l.jsx(Ie.span,{"data-state":Jc(s.checked),"data-disabled":s.disabled?"":void 0,...a,ref:r,style:{pointerEvents:"none",...t.style}})})},"CheckboxIndicator")),wD="CheckboxBubbleInput",CD=v.forwardRef(Vr(function({__scopeCheckbox:t,onClick:r,...o},n){const{control:a,hasConsumerStoppedPropagationRef:s,userInteractionCount:i,checked:c,defaultChecked:d,required:f,disabled:u,name:h,value:m,form:g,bubbleInput:y,setBubbleInput:b}=Xc(wD,t),C=ze(n,b),w=bi(a),x=v.useRef(!1),S=v.useRef(c),N=v.useRef(i);v.useEffect(()=>{const M=y;if(!M)return;const k=window.HTMLInputElement.prototype,A=Object.getOwnPropertyDescriptor(k,"checked").set,L=i!==N.current;N.current=i;const O=S.current!==c;S.current=c;const F=!(L&&s.current);if(O&&A){x.current=!L;const V=new Event("click",{bubbles:F});M.indeterminate=zr(c),A.call(M,zr(c)?!1:c),M.dispatchEvent(V),x.current=!1}},[y,c,s,i]);const E=v.useRef(zr(c)?!1:c);return l.jsx(Ie.input,{type:"checkbox","aria-hidden":!0,defaultChecked:d??E.current,required:f,disabled:u,name:h,value:m,form:g,...o,tabIndex:-1,ref:C,onClick:we(r,M=>{x.current&&M.stopPropagation()}),style:{...o.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function og(e){return typeof e=="function"}Vr(og,"isFunction");function zr(e){return e==="indeterminate"}Vr(zr,"isIndeterminate");function Jc(e){return zr(e)?"indeterminate":e?"checked":"unchecked"}Vr(Jc,"getState");const Zc=v.forwardRef(({className:e,...t},r)=>l.jsx(rg,{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:l.jsx(xD,{className:p("grid place-content-center text-current"),children:l.jsx(pf,{className:p("h-4 w-4")})})}));Zc.displayName=rg.displayName;var SD=Object.defineProperty,Ht=(e,t)=>SD(e,"name",{value:t,configurable:!0}),Nr="Accordion",ND=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[Rc,ED,kD]=Sa(Nr),[nl,bI]=rr(Nr,[kD,$f]),ed=$f(),_D=v.forwardRef(Ht(function(t,r){const{type:o,...n}=t,a=n,s=n;return l.jsx(Rc.Provider,{scope:t.__scopeAccordion,children:o==="multiple"?l.jsx(ID,{...s,ref:r}):l.jsx(TD,{...a,ref:r})})},"Accordion")),[ng,DD]=nl(Nr),[ag,AD]=nl(Nr,{collapsible:!1}),TD=v.forwardRef(Ht(function(t,r){const{value:o,defaultValue:n,onValueChange:a=Ht(()=>{},"onValueChange"),collapsible:s=!1,...i}=t,[c,d]=br({prop:o,defaultProp:n??"",onChange:a,caller:Nr});return l.jsx(ng,{scope:t.__scopeAccordion,value:v.useMemo(()=>c?[c]:[],[c]),onItemOpen:d,onItemClose:v.useCallback(()=>s&&d(""),[s,d]),children:l.jsx(ag,{scope:t.__scopeAccordion,collapsible:s,children:l.jsx(sg,{...i,ref:r})})})},"AccordionImplSingle")),ID=v.forwardRef(Ht(function(t,r){const{value:o,defaultValue:n,onValueChange:a=Ht(()=>{},"onValueChange"),...s}=t,[i,c]=br({prop:o,defaultProp:n??[],onChange:a,caller:Nr}),d=v.useCallback(u=>c((h=[])=>[...h,u]),[c]),f=v.useCallback(u=>c((h=[])=>h.filter(m=>m!==u)),[c]);return l.jsx(ng,{scope:t.__scopeAccordion,value:i,onItemOpen:d,onItemClose:f,children:l.jsx(ag,{scope:t.__scopeAccordion,collapsible:!0,children:l.jsx(sg,{...s,ref:r})})})},"AccordionImplMultiple")),[PD,al]=nl(Nr),sg=v.forwardRef(Ht(function(t,r){const{__scopeAccordion:o,disabled:n,dir:a,orientation:s="vertical",...i}=t,c=v.useRef(null),d=ze(c,r),f=ED(o),h=hn(a)==="ltr",m=we(t.onKeyDown,g=>{var T;if(!ND.includes(g.key))return;const y=g.target,b=f().filter(A=>{var L;return!((L=A.ref.current)!=null&&L.disabled)}),C=b.findIndex(A=>A.ref.current===y),w=b.length;if(C===-1)return;g.preventDefault();let x=C;const S=0,N=w-1,E=Ht(()=>{x=C+1,x>N&&(x=S)},"moveNext"),M=Ht(()=>{x=C-1,x<S&&(x=N)},"movePrev");switch(g.key){case"Home":x=S;break;case"End":x=N;break;case"ArrowRight":s==="horizontal"&&(h?E():M());break;case"ArrowDown":s==="vertical"&&E();break;case"ArrowLeft":s==="horizontal"&&(h?M():E());break;case"ArrowUp":s==="vertical"&&M();break}const k=x%w;(T=b[k].ref.current)==null||T.focus()});return l.jsx(PD,{scope:o,disabled:n,direction:a,orientation:s,children:l.jsx(Rc.Slot,{scope:o,children:l.jsx(Ie.div,{...i,"data-orientation":s,ref:d,onKeyDown:n?void 0:m})})})},"AccordionImpl")),td="AccordionItem",[MD,rd]=nl(td),OD=v.forwardRef(Ht(function(t,r){const{__scopeAccordion:o,value:n,...a}=t,s=al(td,o),i=DD(td,o),c=ed(o),d=Hr(),f=n&&i.value.includes(n)||!1,u=s.disabled||t.disabled;return l.jsx(MD,{scope:o,open:f,disabled:u,triggerId:d,children:l.jsx(Bf,{"data-orientation":s.orientation,"data-state":od(f),...c,...a,ref:r,disabled:u,open:f,onOpenChange:h=>{h?i.onItemOpen(n):i.onItemClose(n)}})})},"AccordionItem")),LD="AccordionHeader",FD=v.forwardRef(Ht(function(t,r){const{__scopeAccordion:o,...n}=t,a=al(Nr,o),s=rd(LD,o);return l.jsx(Ie.h3,{"data-orientation":a.orientation,"data-state":od(s.open),"data-disabled":s.disabled?"":void 0,...n,ref:r})},"AccordionHeader")),lg="AccordionTrigger",$D=v.forwardRef(Ht(function(t,r){const{__scopeAccordion:o,...n}=t,a=al(Nr,o),s=rd(lg,o),i=AD(lg,o),c=ed(o);return l.jsx(Rc.ItemSlot,{scope:o,children:l.jsx(FN,{"aria-disabled":s.open&&!i.collapsible||void 0,"data-orientation":a.orientation,id:s.triggerId,...c,...n,ref:r})})},"AccordionTrigger")),GD="AccordionContent",VD=v.forwardRef(Ht(function(t,r){const{__scopeAccordion:o,...n}=t,a=al(Nr,o),s=rd(GD,o),i=ed(o);return l.jsx($N,{role:"region","aria-labelledby":s.triggerId,"data-orientation":a.orientation,...i,...n,ref:r,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})},"AccordionContent"));function od(e){return e?"open":"closed"}Ht(od,"getState");var zD=_D,BD=OD,UD=FD,ig=$D,cg=VD;const dg=zD,nd=v.forwardRef(({className:e,...t},r)=>l.jsx(BD,{ref:r,className:p("border-b",e),...t}));nd.displayName="AccordionItem";const ad=v.forwardRef(({className:e,children:t,...r},o)=>l.jsx(UD,{className:p("flex"),children:l.jsxs(ig,{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,l.jsx(Yo,{className:p("h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200")})]})}));ad.displayName=ig.displayName;const sd=v.forwardRef(({className:e,children:t,...r},o)=>l.jsx(cg,{ref:o,className:p("overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"),...r,children:l.jsx("div",{className:p("pb-4 pt-0",e),children:t})}));sd.displayName=cg.displayName;function ld(e,t,r){var o,n,a,s;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(s=e.validation)==null?void 0:s[r];default:return}}function WD(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 HD(e,t,r){const{field:o,value:n}=r;if(o.includes(".")){const[s,...i]=o.split("."),c=i.join(".");return ld(e,s,c)===n}return ld(e,t.section,o)===n}const ug=({field:e,element:t,onUpdate:r})=>{var a;const o=ld(t,e.section,e.key)??e.defaultValue,n=s=>{r(WD(e.section,t,e.key,s))};switch(e.type){case"text":case"url":case"color":return l.jsxs("div",{className:p("space-y-1.5"),children:[l.jsx(Zt,{className:p("text-xs font-medium text-muted-foreground"),children:e.label}),l.jsx(Kt,{type:e.type==="color"?"color":e.type==="url"?"url":"text",value:o??"",onChange:s=>n(s.target.value),placeholder:e.placeholder}),e.description&&l.jsx("p",{className:p("text-[11px] text-muted-foreground"),children:e.description})]});case"textarea":return l.jsxs("div",{className:p("space-y-1.5"),children:[l.jsx(Zt,{className:p("text-xs font-medium text-muted-foreground"),children:e.label}),l.jsx(Qc,{value:o??"",onChange:s=>n(s.target.value),placeholder:e.placeholder,rows:e.rows??3}),e.description&&l.jsx("p",{className:p("text-[11px] text-muted-foreground"),children:e.description})]});case"number":return l.jsxs("div",{className:p("space-y-1.5"),children:[l.jsx(Zt,{className:p("text-xs font-medium text-muted-foreground"),children:e.label}),l.jsx(Kt,{type:"number",value:o??"",onChange:s=>{const i=s.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&&l.jsx("p",{className:p("text-[11px] text-muted-foreground"),children:e.description})]});case"checkbox":return l.jsxs("div",{className:p("flex items-start space-x-2"),children:[l.jsx(Zc,{id:`ds-${e.section}-${e.key}`,checked:!!o,onCheckedChange:s=>n(!!s)}),l.jsxs("div",{className:p("space-y-0.5 leading-none"),children:[l.jsx(Zt,{htmlFor:`ds-${e.section}-${e.key}`,className:p("text-xs font-medium text-foreground cursor-pointer"),children:e.label}),e.description&&l.jsx("p",{className:p("text-[11px] text-muted-foreground"),children:e.description})]})]});case"select":return l.jsxs("div",{className:p("space-y-1.5"),children:[l.jsx(Zt,{className:p("text-xs font-medium text-muted-foreground"),children:e.label}),l.jsxs(Xa,{value:o!=null?String(o):"",onValueChange:s=>{var c;const i=(c=e.options)==null?void 0:c.find(d=>typeof d.value=="number"&&String(d.value)===s);n(i?i.value:s)},children:[l.jsx(vn,{children:l.jsx(Ja,{placeholder:e.placeholder||"Select..."})}),l.jsx(xn,{children:(a=e.options)==null?void 0:a.map(s=>l.jsx(yo,{value:String(s.value),children:s.label},String(s.value)))})]}),e.description&&l.jsx("p",{className:p("text-[11px] text-muted-foreground"),children:e.description})]});default:return null}},jD=({title:e,icon:t,defaultOpen:r=!0,children:o})=>l.jsx(dg,{type:"single",collapsible:!0,defaultValue:r?"item":void 0,children:l.jsxs(nd,{value:"item",className:p("border-b border-border"),children:[l.jsx(ad,{className:p("px-4 py-3 hover:bg-muted/50 hover:no-underline"),children:l.jsxs("span",{className:p("text-sm font-medium text-foreground flex items-center gap-2"),children:[t&&l.jsx("span",{children:t}),e]})}),l.jsx(sd,{className:p("px-4 pb-4 mb-4"),children:l.jsx("div",{className:p("space-y-4"),children:o})})]})}),YD=({element:e,schema:t,onUpdate:r})=>{const o=t.fields.filter(c=>c.showWhen?HD(e,c,c.showWhen):!0),n=[];let a=[];const s=()=>{a.length>0&&(n.push(a),a=[])};for(const c of o)c.colSpan===1?(a.push(c),a.length===2&&s()):(s(),n.push([c]));s();const{configSection:i}=t;return l.jsx(jD,{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 l.jsx(ug,{field:u,element:e,onUpdate:r},`${u.section}.${u.key}`)}return l.jsx("div",{className:p("grid grid-cols-2 gap-2"),children:c.map(u=>l.jsx(ug,{field:u,element:e,onUpdate:r},`${u.section}.${u.key}`))},`row-${d}`)})})},to=({title:e,children:t,defaultOpen:r=!0,icon:o})=>l.jsx(dg,{type:"single",collapsible:!0,defaultValue:r?"item":void 0,children:l.jsxs(nd,{value:"item",className:p("border-b border-border"),children:[l.jsx(ad,{className:p("px-4 py-3 hover:bg-muted/50 hover:no-underline"),children:l.jsxs("span",{className:p("text-sm font-medium text-foreground flex items-center gap-2"),children:[o&&l.jsx("span",{children:o}),e]})}),l.jsx(sd,{className:p("px-4 pb-4 mb-4"),children:l.jsx("div",{className:p("space-y-4"),children:t})})]})}),Be=({label:e,value:t,onChange:r,type:o="text",placeholder:n,rows:a=3,min:s,max:i,step:c,helpText:d})=>l.jsxs("div",{className:p("space-y-1.5"),children:[l.jsx(Zt,{className:p("text-sm font-medium"),children:e}),o==="textarea"?l.jsx(Qc,{value:t??"",onChange:f=>r(f.target.value),placeholder:n,rows:a,className:p("resize-none")}):o==="color"?l.jsxs("div",{className:p("flex gap-2"),children:[l.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")}),l.jsx(Kt,{type:"text",value:t??"",onChange:f=>r(f.target.value),placeholder:n||"#000000",className:p("flex-1")})]}):l.jsx(Kt,{type:o,value:t??"",onChange:f=>r(f.target.value),placeholder:n,min:s,max:i,step:c}),d&&l.jsx("p",{className:p("text-xs text-muted-foreground"),children:d})]}),pg=({label:e,checked:t,onChange:r,description:o})=>l.jsxs("div",{className:p("flex items-start gap-3"),children:[l.jsx(Zc,{id:e,checked:t||!1,onCheckedChange:n=>r(n===!0),className:p("mt-0.5")}),l.jsxs("div",{className:p("grid gap-0.5 leading-none"),children:[l.jsx(Zt,{htmlFor:e,className:p("text-sm font-medium cursor-pointer"),children:e}),o&&l.jsx("p",{className:p("text-xs text-muted-foreground"),children:o})]})]}),id=({label:e,value:t,onChange:r,options:o,helpText:n})=>l.jsxs("div",{className:p("space-y-1.5"),children:[l.jsx(Zt,{className:p("text-sm font-medium"),children:e}),l.jsxs(Xa,{value:(t==null?void 0:t.toString())??"",onValueChange:r,children:[l.jsx(vn,{className:p("w-full"),children:l.jsx(Ja,{placeholder:"Select..."})}),l.jsx(xn,{children:o.map(a=>l.jsx(yo,{value:a.value,children:a.label},a.value))})]}),n&&l.jsx("p",{className:p("text-xs text-muted-foreground"),children:n})]}),qD=({options:e,onChange:t})=>{const r=(s,i,c)=>{const d=[...e];if(d[s]={...d[s],[i]:c},i==="label"){const f=d[s].value,u=e[s].label;(!f||f===Pl(u))&&(d[s].value=Pl(c))}t(d)},o=()=>{const s=e.length+1;t([...e,{label:`Option ${s}`,value:`option${s}`}])},n=s=>{e.length>1&&t(e.filter((i,c)=>c!==s))},a=(s,i)=>{const c=i==="up"?s-1:s+1;if(c<0||c>=e.length)return;const d=[...e];[d[s],d[c]]=[d[c],d[s]],t(d)};return l.jsxs("div",{className:p("space-y-2"),children:[l.jsx(Zt,{className:p("text-sm font-medium"),children:"Options"}),l.jsx("div",{className:p("space-y-2"),children:e.map((s,i)=>l.jsxs("div",{className:p("flex items-center gap-1"),children:[l.jsxs("div",{className:p("flex flex-col gap-0.5"),children:[l.jsx(Ze,{variant:"ghost",size:"icon",className:p("h-5 w-5"),onClick:()=>a(i,"up"),disabled:i===0,children:l.jsx(ff,{className:p("h-3 w-3")})}),l.jsx(Ze,{variant:"ghost",size:"icon",className:p("h-5 w-5"),onClick:()=>a(i,"down"),disabled:i===e.length-1,children:l.jsx(Yo,{className:p("h-3 w-3")})})]}),l.jsx(Kt,{type:"text",value:s.label,onChange:c=>r(i,"label",c.target.value),placeholder:"Label",className:p("flex-1 h-8")}),l.jsx(Kt,{type:"text",value:s.value,onChange:c=>r(i,"value",c.target.value),placeholder:"Value",className:p("w-20 h-8 text-muted-foreground")}),l.jsx(as,{children:l.jsxs(vr,{children:[l.jsx(xr,{asChild:!0,children:l.jsx(Ze,{variant:"ghost",size:"icon",className:p("h-8 w-8"),onClick:()=>n(i),disabled:e.length<=1,children:l.jsx(Ka,{className:p("h-4 w-4")})})}),l.jsx(sr,{children:"Remove option"})]})})]},i))}),l.jsxs(Ze,{variant:"ghost",size:"sm",className:p("text-primary"),onClick:o,children:[l.jsx(Ai,{className:p("h-4 w-4 mr-1")}),"Add option"]})]})},QD=({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}`}])},s=u=>{e.length>1&&r(e.filter((h,m)=>m!==u))},i=(u,h,m)=>{const g=[...e];g[u]={...g[u],[h]:m},r(g)},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 g=[...t];g[u]={...g[u],[h]:m},o(g)};return l.jsxs("div",{className:p("space-y-4"),children:[l.jsxs("div",{className:p("space-y-2"),children:[l.jsx(Zt,{className:p("text-sm font-medium"),children:"Rows"}),l.jsx("div",{className:p("space-y-2"),children:e.map((u,h)=>l.jsxs("div",{className:p("flex items-center gap-2"),children:[l.jsx(Kt,{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")}),l.jsx(Kt,{type:"text",value:u.label,onChange:m=>i(h,"label",m.target.value),placeholder:"Row label",className:p("flex-1 h-8")}),l.jsx(Ze,{variant:"ghost",size:"icon",className:p("h-8 w-8"),onClick:()=>s(h),disabled:e.length<=1,children:l.jsx(Ka,{className:p("h-4 w-4")})})]},h))}),l.jsxs(Ze,{variant:"ghost",size:"sm",className:p("text-primary"),onClick:a,children:[l.jsx(Ai,{className:p("h-4 w-4 mr-1")}),"Add row"]})]}),l.jsxs("div",{className:p("space-y-2"),children:[l.jsx(Zt,{className:p("text-sm font-medium"),children:"Columns"}),l.jsx("div",{className:p("space-y-2"),children:t.map((u,h)=>l.jsxs("div",{className:p("flex items-center gap-2"),children:[l.jsx(Kt,{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")}),l.jsx(Kt,{type:"text",value:u.label,onChange:m=>f(h,"label",m.target.value),placeholder:"Column label",className:p("flex-1 h-8")}),n&&l.jsxs(Xa,{value:u.type||"text",onValueChange:m=>f(h,"type",m),children:[l.jsx(vn,{className:p("w-24 h-8"),children:l.jsx(Ja,{})}),l.jsxs(xn,{children:[l.jsx(yo,{value:"text",children:"Text"}),l.jsx(yo,{value:"number",children:"Number"}),l.jsx(yo,{value:"dropdown",children:"Dropdown"})]})]}),l.jsx(Ze,{variant:"ghost",size:"icon",className:p("h-8 w-8"),onClick:()=>d(h),disabled:t.length<=1,children:l.jsx(Ka,{className:p("h-4 w-4")})})]},h))}),l.jsxs(Ze,{variant:"ghost",size:"sm",className:p("text-primary"),onClick:c,children:[l.jsx(Ai,{className:p("h-4 w-4 mr-1")}),"Add column"]})]})]})},KD=({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),s=["link"].includes(e.type),i=["image"].includes(e.type);return l.jsxs(to,{title:"Properties",icon:"📝",children:[!["divider","spacer"].includes(e.type)&&l.jsx(Be,{label:"Label",value:e.properties.label,onChange:c=>r("label",c),placeholder:"Enter label..."}),o&&l.jsx(Be,{label:"Placeholder",value:e.properties.placeholder,onChange:c=>r("placeholder",c),placeholder:"Enter placeholder..."}),n&&l.jsx(Be,{label:"Description",value:e.properties.description,onChange:c=>r("description",c),type:"textarea",placeholder:"Enter description...",rows:2}),a&&l.jsx(Be,{label:"Content",value:e.properties.content,onChange:c=>r("content",c),type:"textarea",placeholder:"Enter paragraph text...",rows:4}),s&&l.jsxs(l.Fragment,{children:[l.jsx(Be,{label:"Link Text",value:e.properties.content,onChange:c=>r("content",c),placeholder:"Click here"}),l.jsx(Be,{label:"URL",value:e.properties.href,onChange:c=>r("href",c),type:"url",placeholder:"https://example.com"}),l.jsx(id,{label:"Target",value:e.properties.target,onChange:c=>r("target",c),options:[{value:"_blank",label:"New Tab"},{value:"_self",label:"Same Tab"}]})]}),i&&l.jsxs(l.Fragment,{children:[l.jsx(Be,{label:"Image URL",value:e.properties.src,onChange:c=>r("src",c),type:"url",placeholder:"https://example.com/image.jpg"}),l.jsx(Be,{label:"Alt Text",value:e.properties.alt,onChange:c=>r("alt",c),placeholder:"Image description"})]}),["shortText","number"].includes(e.type)&&l.jsxs("div",{className:p("grid grid-cols-2 gap-2"),children:[l.jsx(Be,{label:"Prefix",value:e.properties.prefix,onChange:c=>r("prefix",c),placeholder:"$"}),l.jsx(Be,{label:"Suffix",value:e.properties.suffix,onChange:c=>r("suffix",c),placeholder:".00"})]})]})},XD=({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 l.jsxs(to,{title:"Layout",icon:"📐",defaultOpen:!1,children:[o&&l.jsx(id,{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"}]}),l.jsx(id,{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"}]}),l.jsx(Be,{label:"Custom Width",value:e.layout.width,onChange:n=>r("width",n),placeholder:"e.g., 50%, 300px"}),l.jsx(Be,{label:"CSS Class",value:e.layout.className,onChange:n=>r("className",n),placeholder:"custom-class",helpText:"Additional CSS classes"})]})},JD=({element:e,onUpdate:t})=>{var c,d,f,u,h,m,g,y,b,C,w;const r=(x,S)=>{t({validation:{...e.validation,[x]:S}})},o=Sv(e.type),n=["shortText","longText","multiLineInput","textEditor","password"].includes(e.type),a=["number","slider","rangeSlider"].includes(e.type),s=["multiFileUpload","multiImageUpload"].includes(e.type),i=["multipleDates"].includes(e.type);return l.jsxs(to,{title:"Validation",icon:"✅",defaultOpen:!1,children:[o.supportsRequired&&l.jsx(pg,{label:"Required",checked:(c=e.validation)==null?void 0:c.required,onChange:x=>r("required",x),description:"Field must be filled"}),n&&l.jsxs("div",{className:p("grid grid-cols-2 gap-2"),children:[l.jsx(Be,{label:"Min Length",value:(d=e.validation)==null?void 0:d.minLength,onChange:x=>r("minLength",x?parseInt(x):void 0),type:"number",placeholder:"0",min:0}),l.jsx(Be,{label:"Max Length",value:(f=e.validation)==null?void 0:f.maxLength,onChange:x=>r("maxLength",x?parseInt(x):void 0),type:"number",placeholder:"255",min:0})]}),a&&l.jsxs("div",{className:p("grid grid-cols-2 gap-2"),children:[l.jsx(Be,{label:"Min Value",value:(u=e.validation)==null?void 0:u.min,onChange:x=>r("min",x?parseFloat(x):void 0),type:"number"}),l.jsx(Be,{label:"Max Value",value:(h=e.validation)==null?void 0:h.max,onChange:x=>r("max",x?parseFloat(x):void 0),type:"number"})]}),o.supportsPattern&&l.jsx(Be,{label:"Pattern (Regex)",value:(m=e.validation)==null?void 0:m.pattern,onChange:x=>r("pattern",x),placeholder:"^[a-zA-Z]+$",helpText:"Regular expression for validation"}),s&&l.jsxs("div",{className:p("grid grid-cols-2 gap-2"),children:[l.jsx(Be,{label:"Min Files",value:(g=e.validation)==null?void 0:g.minFiles,onChange:x=>r("minFiles",x?parseInt(x):void 0),type:"number",min:0}),l.jsx(Be,{label:"Max Files",value:(y=e.validation)==null?void 0:y.maxFiles,onChange:x=>r("maxFiles",x?parseInt(x):void 0),type:"number",min:1})]}),i&&l.jsxs("div",{className:p("grid grid-cols-2 gap-2"),children:[l.jsx(Be,{label:"Min Dates",value:(b=e.validation)==null?void 0:b.minDates,onChange:x=>r("minDates",x?parseInt(x):void 0),type:"number",min:0}),l.jsx(Be,{label:"Max Dates",value:(C=e.validation)==null?void 0:C.maxDates,onChange:x=>r("maxDates",x?parseInt(x):void 0),type:"number",min:1})]}),l.jsx(Be,{label:"Error Message",value:(w=e.validation)==null?void 0:w.errorMessage,onChange:x=>r("errorMessage",x),placeholder:"Custom error message..."})]})},ZD=({element:e,onUpdate:t,existingNames:r})=>{const[o,n]=D.useState(null),a=(s,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,[s]:i}})};return l.jsx(to,{title:"Attributes",icon:"🏷️",defaultOpen:!1,children:l.jsxs("div",{children:[l.jsx("label",{className:p("block text-sm font-medium text-gray-700 mb-1"),children:"Field Name"}),l.jsx("input",{type:"text",value:e.attributes.name||"",onChange:s=>a("name",s.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&&l.jsx("p",{className:p("mt-1 text-xs text-red-600"),children:o}),l.jsx("p",{className:p("mt-1 text-xs text-gray-500"),children:"Used as the key in JSON output"})]})})},RD=({element:e,onUpdate:t})=>{var n,a,s,i;const r=c=>{t({config:{...e.config,options:c}})},o=(c,d)=>{t({config:{...e.config,[c]:d}})};return l.jsxs(to,{title:"Options",icon:"📋",children:[l.jsx(qD,{options:((n=e.config)==null?void 0:n.options)||[],onChange:r}),l.jsx(pg,{label:"Allow 'Other' option",checked:(a=e.config)==null?void 0:a.allowOther,onChange:c=>o("allowOther",c),description:"Let users enter custom value"}),((s=e.config)==null?void 0:s.allowOther)&&l.jsx(Be,{label:"Other Label",value:(i=e.config)==null?void 0:i.otherLabel,onChange:c=>o("otherLabel",c),placeholder:"Other..."})]})},eA=({element:e,onUpdate:t})=>{var o,n;const r=(a,s)=>{t({config:{...e.config,[a]:s}})};return l.jsx(to,{title:"Matrix Configuration",icon:"📊",children:l.jsx(QD,{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"})})},tA=()=>l.jsxs("div",{className:p("flex flex-col items-center justify-center h-full text-center px-6 py-12"),children:[l.jsx("div",{className:p("w-12 h-12 bg-muted rounded-full flex items-center justify-center mb-4"),children:l.jsx(bS,{className:p("w-6 h-6 text-muted-foreground")})}),l.jsx("h3",{className:p("text-sm font-medium text-foreground mb-1"),children:"No element selected"}),l.jsx("p",{className:p("text-xs text-muted-foreground"),children:"Click on an element in the canvas to edit its properties"})]}),rA=({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,s=n.showPlaceholder===!0,i=n.showDescription!==!1,c=n.showPrefix===!0,d=n.showSuffix===!0;return!a&&!s&&!i&&!c&&!d?null:l.jsxs(to,{title:"Properties",icon:"📝",children:[a&&l.jsx(Be,{label:"Label",value:e.properties.label,onChange:f=>o("label",f),placeholder:"Enter label..."}),s&&l.jsx(Be,{label:"Placeholder",value:e.properties.placeholder,onChange:f=>o("placeholder",f),placeholder:"Enter placeholder..."}),i&&l.jsx(Be,{label:"Description",value:e.properties.description,onChange:f=>o("description",f),type:"textarea",placeholder:"Enter description...",rows:2}),(c||d)&&l.jsxs("div",{className:p("grid grid-cols-2 gap-2"),children:[c&&l.jsx(Be,{label:"Prefix",value:e.properties.prefix,onChange:f=>o("prefix",f),placeholder:"$"}),d&&l.jsx(Be,{label:"Suffix",value:e.properties.suffix,onChange:f=>o("suffix",f),placeholder:".00"})]})]})},oA=()=>{const e=_v(),t=R(g=>g.updateElement),r=R(g=>g.deleteElement),o=R(g=>g.duplicateElement),n=R(g=>g.schema.elements),a=D.useMemo(()=>new Set(n.map(g=>g.attributes.name).filter(Boolean)),[n]);if(!e)return l.jsx("div",{className:p("w-72 bg-card border-l border-border flex-col h-full hidden"),children:l.jsx(tA,{})});const s=g=>{t(e.id,g)},i=dt.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:Pi[e.type],h=(i==null?void 0:i.label)??Ii[e.type],m=d==null?void 0:d.showSections;return l.jsxs("div",{className:p("w-72 bg-card border-l border-border flex flex-col h-full flex-shrink-0"),children:[l.jsxs("div",{className:p("p-4 border-b border-border"),children:[l.jsxs("div",{className:p("flex items-center gap-2 mb-1"),children:[l.jsx("span",{className:p("text-xl"),children:u}),l.jsx("h2",{className:p("text-lg font-semibold text-foreground"),children:h})]}),l.jsxs("div",{className:p("flex gap-2 mt-3"),children:[l.jsxs(Ze,{variant:"secondary",size:"sm",className:p("flex-1"),onClick:()=>o(e.id),children:[l.jsx(uS,{className:p("h-3 w-3 mr-1")}),"Duplicate"]}),l.jsxs(Ze,{variant:"destructive",size:"sm",className:p("flex-1"),onClick:()=>{window.confirm("Are you sure you want to delete this element?")&&r(e.id)},children:[l.jsx(Ti,{className:p("h-3 w-3 mr-1")}),"Delete"]})]})]}),l.jsxs(Ji,{className:p("flex-1"),children:[c&&i.renderSettings({element:e,onUpdate:s}),!c&&l.jsxs(l.Fragment,{children:[(m==null?void 0:m.properties)!==!1&&(f?l.jsx(rA,{element:e,onUpdate:s,propertyConfig:d==null?void 0:d.properties}):l.jsx(KD,{element:e,onUpdate:s})),(m==null?void 0:m.options)!==!1&&XS(e.type)&&l.jsx(RD,{element:e,onUpdate:s}),(m==null?void 0:m.matrix)!==!1&&ZS(e.type)&&l.jsx(eA,{element:e,onUpdate:s}),d&&l.jsx(YD,{element:e,schema:d,onUpdate:s}),(m==null?void 0:m.layout)!==!1&&l.jsx(XD,{element:e,onUpdate:s}),(m==null?void 0:m.validation)!==!1&&((i==null?void 0:i.supportsValidation)??JS(e.type))&&!Ol(e.type)&&l.jsx(JD,{element:e,onUpdate:s}),(m==null?void 0:m.attributes)!==!1&&((i==null?void 0:i.structure)==="field"||YS(e.type))&&!Ol(e.type)&&l.jsx(ZD,{element:e,onUpdate:s,existingNames:a}),(m==null?void 0:m.logic)!==!1&&!Ol(e.type)&&l.jsx(to,{title:"Conditional Logic",icon:"⚡",children:l.jsx(cD,{element:e,elements:n,onUpdate:s})})]})]})]})};var Wn=e=>e.type==="checkbox",sl=e=>e.type==="file",ro=e=>e instanceof Date,Et=e=>e==null;const cd=e=>typeof e=="object";var tt=e=>!Et(e)&&!Array.isArray(e)&&cd(e)&&!ro(e),nA=e=>tt(e)&&e.target?Wn(e.target)?e.target.checked:sl(e.target)?e.target.files:e.target.value:e,aA=(e,t)=>t.split(".").some((r,o,n)=>!isNaN(Number(r))&&e.has(n.slice(0,o).join("."))),fg=e=>{const t=e.constructor&&e.constructor.prototype;return tt(t)&&t.hasOwnProperty("isPrototypeOf")},ll=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function lt(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(ll&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(tt(e)&&fg(e)))return e;const o=r?[]:Object.create(Object.getPrototypeOf(e));for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=lt(e[n]));return o}const en={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},ir={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},cr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},hg="root",dd=["__proto__","constructor","prototype"],sA=/^\w*$/;var Hn=e=>sA.test(e),qe=e=>e===void 0;const lA=/[.[\]'"]/;var il=e=>e.split(lA).filter(Boolean),le=(e,t,r)=>{if(!t||!tt(e))return r;const o=Hn(t)?[t]:il(t);if(o.some(a=>dd.includes(a)))return r;const n=o.reduce((a,s)=>Et(a)?void 0:a[s],e);return qe(n)||n===e?qe(e[t])?r:e[t]:n},Er=e=>typeof e=="boolean",Rt=e=>typeof e=="function",Qe=(e,t,r)=>{let o=-1;const n=Hn(t)?[t]:il(t),a=n.length,s=a-1;for(;++o<a;){const i=n[o];let c=r;if(o!==s){const d=e[i];c=tt(d)||Array.isArray(d)?d:isNaN(+n[o+1])?{}:[]}if(dd.includes(i))return;e[i]=c,e=e[i]}};const mg=D.createContext(null);mg.displayName="HookFormControlContext";var iA=(e,t,r,o=!0)=>{const n={};for(const a in e)Object.defineProperty(n,a,{get:()=>{const s=a;return t._proxyFormState[s]!==ir.all&&(t._proxyFormState[s]=!o||ir.all),e[s]}});return n};const cA=ll?D.useLayoutEffect:D.useEffect;var kt=e=>typeof e=="string",dA=(e,t,r,o,n)=>kt(e)?(o&&t.watch.add(e),le(r,e,n)):Array.isArray(e)?e.map(a=>(o&&t.watch.add(a),le(r,a))):(o&&(t.watchAll=!0),r),ud=e=>Et(e)||!cd(e);const gg=(e,t)=>t.length===0&&!Array.isArray(e)&&!fg(e);function kr(e,t,r=new WeakMap){if(e===t)return!0;if(ud(e)||ud(t))return Object.is(e,t);if(ro(e)&&ro(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(gg(e,o)||gg(t,n))return Object.is(e,t);if(!o.length&&Array.isArray(e)!==Array.isArray(t))return!1;const a=r.get(e);if(a&&a.has(t))return!0;if(a)a.add(t);else{const s=new WeakSet;s.add(t),r.set(e,s)}for(const s of o){const i=e[s];if(!(s in t))return!1;if(s!=="ref"){const c=t[s];if(ro(i)&&ro(c)||(tt(i)||Array.isArray(i))&&(tt(c)||Array.isArray(c))?!kr(i,c,r):!Object.is(i,c))return!1}}return!0}var cl=e=>({isOnSubmit:!e||e===ir.onSubmit,isOnBlur:e===ir.onBlur,isOnChange:e===ir.onChange,isOnAll:e===ir.all,isOnTouch:e===ir.onTouched}),pd=(e,t,r)=>{if(r)return!1;if(t.watchAll||t.watch.has(e))return!0;for(const o of t.watch)if(e.startsWith(o)&&e.charAt(o.length)===".")return!0;return!1};const jn=(e,t,r,o)=>{for(const n of r||Object.keys(e)){const a=le(e,n);if(a){const{_f:s,...i}=a;if(s){if(s.refs&&s.refs[0]&&t(s.refs[0],n)&&!o)return!0;if(s.ref&&t(s.ref,s.name)&&!o)return!0;if(jn(i,t))break}else if(tt(i)&&jn(i,t))break}}};var bg=(e,t,r)=>{const o=le(e,r),n=Array.isArray(o)?o:[];return Qe(n,hg,t[r]),Qe(e,r,n),e},_t=e=>tt(e)&&!Object.keys(e).length,dl=e=>{if(!ll)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},fd=e=>e.type==="radio",ul=e=>e instanceof RegExp,uA=(e,t,r,o,n)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[o]:n||!0}}:{};const yg={value:!1,isValid:!1},vg={value:!0,isValid:!0};var xg=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&&!qe(e[0].attributes.value)?qe(e[0].value)||e[0].value===""?vg:{value:e[0].value,isValid:!0}:vg:yg}return yg};const wg={isValid:!1,value:null};var Cg=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,wg):wg;function Sg(e,t,r="validate"){if(kt(e)||Array.isArray(e)&&e.every(kt)||Er(e)&&!e)return{type:r,message:kt(e)?e:"",ref:t}}var tn=e=>tt(e)&&!ul(e)?e:{value:e,message:""},Ng=async(e,t,r,o,n,a)=>{const{ref:s,refs:i,required:c,maxLength:d,minLength:f,min:u,max:h,pattern:m,validate:g,name:y,valueAsNumber:b,mount:C}=e._f,w=le(r,y);if(!C||t.has(y))return{};const x=i?i[0]:s,S=O=>{if(n&&x.reportValidity){const F=Er(O)?"":O||"";i?i.forEach(V=>V.setCustomValidity(F)):x.setCustomValidity(F),x.reportValidity()}},N={},E=fd(s),M=Wn(s),k=E||M,T=(b||sl(s))&&qe(s.value)&&qe(w)||dl(s)&&s.value===""||w===""||Array.isArray(w)&&!w.length,A=uA.bind(null,y,o,N),L=(O,F,V,re=cr.maxLength,K=cr.minLength)=>{const H=O?F:V;N[y]={type:O?re:K,message:H,ref:s,...A(O?re:K,H)}};if(a?!Array.isArray(w)||!w.length:c&&(!k&&(T||Et(w))||Er(w)&&!w||M&&!xg(i).isValid||E&&!Cg(i).isValid)){const{value:O,message:F}=kt(c)?{value:!!c,message:c}:tn(c);if(O&&(N[y]={type:cr.required,message:F,ref:x,...A(cr.required,F)},!o))return S(F),N}if(!T&&(!Et(u)||!Et(h))){let O,F;const V=tn(h),re=tn(u);if(!Et(w)&&!isNaN(w)){const K=s.valueAsNumber||w&&+w;Et(V.value)||(O=K>V.value),Et(re.value)||(F=K<re.value)}else{const K=s.valueAsDate||new Date(w),H=z=>new Date(new Date().toDateString()+" "+z),ee=s.type=="time",G=s.type=="week";kt(V.value)&&w&&(O=ee?H(w)>H(V.value):G?w>V.value:K>new Date(V.value)),kt(re.value)&&w&&(F=ee?H(w)<H(re.value):G?w<re.value:K<new Date(re.value))}if((O||F)&&(L(!!O,V.message,re.message,cr.max,cr.min),!o))return S(N[y].message),N}if((d||f)&&!T&&(kt(w)||a&&Array.isArray(w))){const O=tn(d),F=tn(f),V=!Et(O.value)&&w.length>+O.value,re=!Et(F.value)&&w.length<+F.value;if((V||re)&&(L(V,O.message,F.message),!o))return S(N[y].message),N}if(m&&!T&&kt(w)){const{value:O,message:F}=tn(m);if(ul(O)&&!w.match(O)&&(N[y]={type:cr.pattern,message:F,ref:s,...A(cr.pattern,F)},!o))return S(F),N}if(g){if(Rt(g)){const O=await g(w,r),F=Sg(O,x);if(F&&(N[y]={...F,...A(cr.validate,F.message)},!o))return S(F.message),N}else if(tt(g)){let O={};for(const F in g){if(!_t(O)&&!o)break;const V=Sg(await g[F](w,r),x,F);V&&(O={...V,...A(F,V.message)},S(V.message),o&&(N[y]=O))}if(!_t(O)&&(N[y]={ref:x,...O},!o))return N}}return S(!0),N},pl=e=>Array.isArray(e)?e:[e],Eg=e=>Array.isArray(e)?e.filter(Boolean):[];function pA(e,t){const r=t.slice(0,-1).length;let o=0;for(;o<r;){if(Et(e)){e=void 0;break}e=e[t[o]],o++}return e}function fA(e){for(const t in e)if(e.hasOwnProperty(t)&&!qe(e[t]))return!1;return!0}function it(e,t){if(kt(t)&&Object.prototype.hasOwnProperty.call(e,t))return delete e[t],e;const r=Array.isArray(t)?t:Hn(t)?[t]:il(t);if(r.some(s=>dd.includes(String(s))))return e;const o=r.length===1?e:pA(e,r),n=r.length-1,a=r[n];return o&&delete o[a],n!==0&&(tt(o)&&_t(o)||Array.isArray(o)&&fA(o))&&it(e,r.slice(0,-1)),e}const kg=e=>{const t={};for(const r of Object.keys(e))if(cd(e[r])&&e[r]!==null&&!ro(e[r])){const o=kg(e[r]);for(const n of Object.keys(o))t[`${r}.${n}`]=o[n]}else t[r]=e[r];return t},hd=D.createContext(null);hd.displayName="HookFormContext";const md=()=>D.useContext(hd),_g=({children:e,watch:t,getValues:r,getFieldState:o,setError:n,clearErrors:a,setValue:s,setValues:i,trigger:c,formState:d,resetField:f,reset:u,resetDefaultValues:h,handleSubmit:m,unregister:g,control:y,register:b,setFocus:C,subscribe:w})=>{const x=D.useMemo(()=>({watch:t,getValues:r,getFieldState:o,setError:n,clearErrors:a,setValue:s,setValues:i,trigger:c,formState:d,resetField:f,reset:u,resetDefaultValues:h,handleSubmit:m,unregister:g,control:y,register:b,setFocus:C,subscribe:w}),[a,y,d,o,r,m,b,u,h,f,n,C,s,i,w,c,g,t]);return D.createElement(hd.Provider,{value:x},D.createElement(mg.Provider,{value:x.control},e))};var Dg=()=>{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 Ag(e,t){const r={};for(const o in e)if(e.hasOwnProperty(o)){const n=e[o],a=t[o];if(n&&tt(n)&&a){const s=Ag(n,a);tt(s)&&(r[o]=s)}else e[o]&&(r[o]=a)}return r}var Tg=e=>e.type==="select-multiple",hA=e=>fd(e)||Wn(e),gd=e=>dl(e)&&e.isConnected,mA=e=>{for(const t in e)if(Rt(e[t]))return!0;return!1};function Ig(e){return Array.isArray(e)||tt(e)&&!mA(e)}function Pg(e){return!!(e&&"_f"in e)}function Mg(e){return Array.isArray(e)?!e.some(t=>!qe(t)):!Object.keys(e).length}function bd(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function yd(e,t={},r){for(const o in e){const n=e[o],a=r&&r[o];Ig(n)&&(!Array.isArray(n)||!Pg(a))?(t[o]=Array.isArray(n)?[]:{},yd(n,t[o],a),Mg(t[o])&&bd(t,o)):qe(n)||(t[o]=!0)}return t}function Po(e,t,r,o){r||(r=yd(t,{},o));for(const n in e){const a=e[n],s=o&&o[n];Ig(a)&&(!Array.isArray(a)||!Pg(s))?(qe(t)||ud(r[n])?r[n]=yd(a,Array.isArray(a)?[]:{},s):Po(a,Et(t)?{}:t[n],r[n],s),Mg(r[n])&&bd(r,n)):kr(a,t[n])?bd(r,n):r[n]=!0}return r}var Og=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:o})=>qe(e)?e:t?e===""?NaN:e&&+e:r&&kt(e)?new Date(e):o?o(e):e;function Lg(e){const t=e.ref;return sl(t)?t.files:fd(t)?Cg(e.refs).value:Tg(t)?[...t.selectedOptions].map(({value:r})=>r):Wn(t)?xg(e.refs).value:Og(qe(t.value)?e.ref.value:t.value,e)}var gA=(e,t,r,o)=>{const n={};for(const a of e){const s=le(t,a);s&&Qe(n,a,s._f)}return{criteriaMode:r,names:[...e],fields:n,shouldUseNativeValidation:o}},Yn=e=>qe(e)?e:ul(e)?e.source:tt(e)?ul(e.value)?e.value.source:e.value:e;const Fg="AsyncFunction";var bA=e=>{if(!e||!e.validate)return!1;if(Rt(e.validate))return e.validate.constructor.name===Fg;if(tt(e.validate)){for(const t in e.validate)if(e.validate[t].constructor.name===Fg)return!0}return!1},yA=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function $g(e,t,r){const o=le(e,r);if(o||Hn(r))return{error:o,name:r};const n=r.split(".");for(;n.length;){const a=n.join("."),s=le(t,a),i=le(e,a);if(s&&!Array.isArray(s)&&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 vA=(e,t,r,o)=>{r(e);const{name:n,...a}=e,s=Object.keys(a);return!s.length||o&&s.length>=Object.keys(t).length||s.find(i=>t[i]===(!o||ir.all))},xA=(e,t,r)=>!e||!t||e===t||pl(e).some(o=>o&&(r?o===t||o.startsWith(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,CA=(e,t)=>!Eg(le(e,t)).length&&it(e,t);const SA={mode:ir.onSubmit,reValidateMode:ir.onChange,shouldFocusError:!0},vd="form",NA=(e,t)=>{for(const r in e)r in t||delete e[r];Object.assign(e,t)},Gg={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function EA(e={}){let t={...SA,...e},r={...lt(Gg),isLoading:Rt(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},o={},n=tt(t.defaultValues)||tt(t.values)?lt(t.defaultValues||t.values)||{}:{},a=t.shouldUnregister?{}:lt(n),s={action:!1,mount:!1,watch:!1,keepIsValid:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const c={},d={};let f=0,u=cl(t.mode),h=cl(t.reValidateMode);const m={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},g={...m};let y={...g};const b={array:Dg(),state:Dg()};let C=0;const w=t.criteriaMode===ir.all,x=(_,I)=>P=>{clearTimeout(d[_]),d[_]=setTimeout(I,P)},S=async _=>{if(!s.keepIsValid&&!t.disabled&&(g.isValid||y.isValid||_)){const I=++C;let P;t.resolver?(P=_t((await V()).errors),I===C&&N()):P=await H({fields:o,onlyCheckValid:!0,eventType:en.VALID}),I===C&&P!==r.isValid&&b.state.next({isValid:P})}},N=(_,I)=>{!t.disabled&&(g.isValidating||g.validatingFields||y.isValidating||y.validatingFields)&&((_||Array.from(i.mount)).forEach(P=>{P&&(I?Qe(r.validatingFields,P,I):it(r.validatingFields,P))}),b.state.next({validatingFields:r.validatingFields,isValidating:!_t(r.validatingFields)}))},E=()=>{r.dirtyFields=Po(n,a,void 0,o)},M=(_,I=[],P,W,U=!0,J=!0)=>{if(W&&P&&!t.disabled){if(s.action=!0,J&&Array.isArray(le(o,_))){const B=P(le(o,_),W.argA,W.argB);U&&Qe(o,_,B)}if(J&&Array.isArray(le(r.errors,_))){const B=P(le(r.errors,_),W.argA,W.argB);U&&Qe(r.errors,_,B),CA(r.errors,_)}if((g.touchedFields||y.touchedFields)&&J&&Array.isArray(le(r.touchedFields,_))){const B=P(le(r.touchedFields,_),W.argA,W.argB);U&&Qe(r.touchedFields,_,B)}(g.dirtyFields||y.dirtyFields)&&E(),b.state.next({name:_,isDirty:G(_,I),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Qe(a,_,I)},k=(_,I)=>{Qe(r.errors,_,I),r.errors={...r.errors},b.state.next({errors:r.errors})},T=_=>{r.errors=_,b.state.next({errors:r.errors,isValid:!1})},A=_=>{const I=Hn(_)?[_]:il(_);let P=a,W=n;for(let U=0;U<I.length-1;U++){const J=I[U];if(P=Et(P)?P:P[J],W=Et(W)?W:W[J],P===null&&W!==null)return!0}return!1},L=(_,I,P,W)=>{const U=le(o,_);if(U){if(A(_))return;const J=qe(le(a,_)),B=le(a,_,qe(P)?le(n,_):P);qe(B)||W&&W.defaultChecked||I?Qe(a,_,I?B:Lg(U._f)):$(_,B),s.mount&&!s.action&&(S(),J&&r.isDirty&&(g.isDirty||y.isDirty)&&(G()||(r.isDirty=!1,b.state.next({...r}))),e.shouldUnregister&&J&&!qe(le(a,_))&&pd(_,i)&&(s.watch=!0))}},O=(_,I,P,W,U)=>{let J=!1,B=!1;const Q={name:_};if(!t.disabled||W===!0){if(!P||W){const ie=kr(le(n,_),I);(g.isDirty||y.isDirty)&&(B=r.isDirty,r.isDirty=Q.isDirty=!ie||G(),J=B!==Q.isDirty),B=!!le(r.dirtyFields,_),ie!==r.isDirty?NA(r.dirtyFields,Po(n,a,void 0,o)):ie?it(r.dirtyFields,_):Qe(r.dirtyFields,_,!0),Q.dirtyFields=r.dirtyFields,J=J||(g.dirtyFields||y.dirtyFields)&&B!==!ie}if(P){const ie=le(r.touchedFields,_);ie||(Qe(r.touchedFields,_,P),Q.touchedFields=r.touchedFields,J=J||(g.touchedFields||y.touchedFields)&&ie!==P)}J&&U&&b.state.next(Q)}return J?Q:{}},F=(_,I,P,W)=>{const U=le(r.errors,_),J=(g.isValid||y.isValid)&&Er(I)&&r.isValid!==I;if(t.delayError&&P?(c[_]=x(_,()=>k(_,P)),c[_](t.delayError)):(clearTimeout(d[_]),delete c[_],P?Qe(r.errors,_,P):it(r.errors,_),r.errors={...r.errors}),(P?!kr(U,P):U)||!_t(W)||J){const B={...W,...J&&Er(I)?{isValid:I}:{},errors:r.errors,name:_};r={...r,...B},b.state.next(B)}},V=async _=>(N(_,!0),await t.resolver(a,t.context,gA(_||i.mount,o,t.criteriaMode,t.shouldUseNativeValidation))),re=async _=>{const{errors:I}=await V(_);if(N(_),_){for(const P of _){const W=le(I,P);W?i.array.has(P)&&tt(W)&&!Object.keys(W).some(U=>!Number.isNaN(Number(U)))?bg(r.errors,{[P]:W},P):Qe(r.errors,P,W):it(r.errors,P)}r.errors={...r.errors}}else r.errors=I;return I},K=async({name:_,eventType:I})=>{if(e.validate){const P=await e.validate({formValues:a,formState:r,name:_,eventType:I});if(tt(P))for(const W in P){const U=P[W];U&&X(`${vd}.${W}`,{message:kt(U.message)?U.message:"",type:U.type||cr.validate})}else kt(P)||!P?X(vd,{message:P||"",type:cr.validate}):ue(vd);return P}return!0},H=async({fields:_,onlyCheckValid:I,name:P,eventType:W,context:U={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(U.runRootValidation=!0,!await K({name:P,eventType:W})&&(U.valid=!1,I)))return U.valid;for(const J in _){const B=_[J];if(B){const{_f:Q,...ie}=B;if(Q){const De=i.array.has(Q.name),Ve=B._f&&bA(B._f),Dt=g.validatingFields||g.isValidating||y.validatingFields||y.isValidating;Ve&&Dt&&N([Q.name],!0);const _e=await Ng(B,i.disabled,a,w,t.shouldUseNativeValidation&&!I,De);if(Ve&&Dt&&N([Q.name]),_e[Q.name]&&(U.valid=!1,I)||(!I&&(le(_e,Q.name)?De?bg(r.errors,_e,Q.name):Qe(r.errors,Q.name,_e[Q.name]):it(r.errors,Q.name)),e.shouldUseNativeValidation&&_e[Q.name]))break}!_t(ie)&&await H({context:U,onlyCheckValid:I,fields:ie,name:J,eventType:W})}}return U.valid},ee=()=>{for(const _ of i.unMount){const I=le(o,_);I&&(I._f.refs?I._f.refs.every(P=>!gd(P)):!gd(I._f.ref))&&je(_)}i.unMount=new Set},G=(_,I)=>(_&&I&&Qe(a,_,I),!kr(s.mount?a:n,n)),z=(_,I,P)=>dA(_,i,{...s.mount?a:qe(I)?n:kt(_)?{[_]:I}:I},P,I),Ce=_=>Eg(le(s.mount?a:n,_,t.shouldUnregister?le(n,_,[]):[])),$=(_,I,P={},W=!1,U=!1)=>{const J=le(o,_);let B=I;if(J){const Q=J._f;Q&&(!Q.disabled&&Qe(a,_,Og(I,Q)),B=dl(Q.ref)&&Et(I)?"":I,Tg(Q.ref)?[...Q.ref.options].forEach(ie=>ie.selected=B.includes(ie.value)):Q.refs?Wn(Q.ref)?Q.refs.forEach(ie=>{(!ie.defaultChecked||!ie.disabled)&&(Array.isArray(B)?ie.checked=!!B.find(De=>De===ie.value):ie.checked=B===ie.value||!!B)}):Q.refs.forEach(ie=>ie.checked=ie.value===B):sl(Q.ref)?Q.ref.value="":(Q.ref.value=B,!Q.ref.type&&!U&&b.state.next({name:_,values:W?a:lt(a)})))}(P.shouldDirty||P.shouldTouch)&&O(_,B,P.shouldTouch,P.shouldDirty,!U),P.shouldValidate&&te(_,{delayError:P.delayError})},q=(_,I,P,W=!1,U=!1)=>{for(const J in I){if(!I.hasOwnProperty(J))return;const B=I[J],Q=_+"."+J,ie=le(o,Q);(i.array.has(_)||tt(B)||ie&&!ie._f)&&!ro(B)?q(Q,B,P,W,U):$(Q,B,P,W,U)}},xe=(_,I,P,W,U=!1)=>{const J=le(o,_),B=i.array.has(_),Q=W?I:lt(I),ie=le(a,_),De=kr(ie,Q);if(De||Qe(a,_,Q),B)b.array.next({name:_,values:W?a:lt(a)}),(g.isDirty||g.dirtyFields||y.isDirty||y.dirtyFields)&&P.shouldDirty&&(E(),U||b.state.next({name:_,dirtyFields:r.dirtyFields,isDirty:G(_,Q)}));else{const Ve=Array.isArray(Q)&&!Q.length||_t(Q);!J||J._f||Et(Q)||Ve?$(_,Q,P,W,U):q(_,Q,P,W,U)}if(!De&&!U){const Ve=pd(_,i),Dt=W?a:lt(a);b.state.next({...Ve&&r,name:s.mount||Ve?_:void 0,values:Dt})}},oe=(_,I,P={})=>xe(_,I,P,!1),he=(_,I={})=>{const P=Rt(_)?_(a):_;if(!kr(a,P)){a={...a,...P};const W=kg(P);for(const U of i.mount)U in W&&xe(U,W[U],I,!0,!0);b.state.next({...r,name:void 0,type:void 0,...f?{values:a}:{}}),I.shouldValidate&&S()}},Y=async _=>{s.mount=!0;const I=_.target;let P=I.name,W=!0;const U=le(o,P),J=B=>{W=Number.isNaN(B)||ro(B)&&isNaN(B.getTime())||kr(B,le(a,P,B))};if(U){let B,Q;const ie=I.type?Lg(U._f):nA(_),De=_.type===en.BLUR||_.type===en.FOCUS_OUT,Ve=!yA(U._f)&&!e.validate&&!t.resolver&&!le(r.errors,P)&&!U._f.deps,Dt=Ve||wA(De,le(r.touchedFields,P),r.isSubmitted,h,u),_e=pd(P,i,De);if(Qe(a,P,ie),De){if(!I||!I.readOnly){U._f.onBlur&&U._f.onBlur(_);const dr=c[P];dr&&dr(0)}}else U._f.onChange&&U._f.onChange(_);const Ke=O(P,ie,De),ot=!_t(Ke)||_e;if(!De&&b.state.next({name:P,type:_.type,...f?{values:lt(a)}:{}}),Dt)return(!Ve||!r.isValid)&&(g.isValid||y.isValid)&&(t.mode==="onBlur"?De&&S():De||S()),ot&&b.state.next({name:P,..._e?{}:Ke});if(!t.resolver&&e.validate&&await K({name:P,eventType:_.type}),!De&&_e&&b.state.next({...r}),t.resolver){const{errors:dr}=await V([P]);if(N([P]),J(ie),!W){!_t(Ke)&&b.state.next(Ke);return}const rn=$g(r.errors,o,P),er=$g(dr,o,rn.name||P);B=er.error,P=er.name,Q=_t(dr)}else N([P],!0),B=(await Ng(U,i.disabled,a,w,t.shouldUseNativeValidation))[P],N([P]),J(ie),W&&(B?Q=!1:(g.isValid||y.isValid)&&(Q=await H({fields:o,onlyCheckValid:!0,name:P,eventType:_.type})));W&&(U._f.deps&&(!Array.isArray(U._f.deps)||U._f.deps.length>0)&&te(U._f.deps),F(P,Q,B,Ke))}},ce=(_,I)=>{if(le(r.errors,I)&&_.focus)return _.focus(),1},te=async(_,I={})=>{let P,W;const U=pl(_);if(t.resolver){const J=await re(qe(_)?_:U);P=_t(J),W=_?!U.some(B=>le(J,B)):P}else _?(W=(await Promise.all(U.map(async J=>{const B=le(o,J);return await H({fields:B&&B._f?{[J]:B}:B,eventType:en.TRIGGER})}))).every(Boolean),!(!W&&!r.isValid)&&S()):W=P=await H({fields:o,name:_,eventType:en.TRIGGER});if(I.delayError&&t.delayError&&kt(_)){const J=le(r.errors,_);J?(it(r.errors,_),c[_]=x(_,()=>k(_,J)),c[_](t.delayError)):(clearTimeout(d[_]),delete c[_])}return b.state.next({...!kt(_)||(g.isValid||y.isValid)&&P!==r.isValid?{}:{name:_},...t.resolver||!_?{isValid:P}:{},errors:r.errors}),I.shouldFocus&&!W&&jn(o,ce,_?U:i.mount),W},Ne=(_,I)=>{let P={...s.mount?a:n};return I&&(P=Ag(I.dirtyFields?r.dirtyFields:r.touchedFields,P)),qe(_)?P:kt(_)?le(P,_):_.map(W=>le(P,W))},be=(_,I)=>({invalid:!!le((I||r).errors,_),isDirty:!!le((I||r).dirtyFields,_),error:le((I||r).errors,_),isValidating:!!le(r.validatingFields,_),isTouched:!!le((I||r).touchedFields,_)}),ue=_=>{const I=_?pl(_):void 0;I==null||I.forEach(P=>it(r.errors,P)),I?I.forEach(P=>{b.state.next({name:P,errors:r.errors})}):(r.errors={},b.state.next({errors:r.errors}))},X=(_,I,P)=>{const W=(le(o,_,{_f:{}})._f||{}).ref,U=le(r.errors,_)||{},{ref:J,message:B,type:Q,...ie}=U;Qe(r.errors,_,{...ie,...I,ref:W}),b.state.next({name:_,errors:r.errors,isValid:!1}),P&&P.shouldFocus&&W&&W.focus&&W.focus()},ne=(_,I)=>{if(Rt(_)){f++;const{unsubscribe:P}=b.state.subscribe({next:U=>"values"in U&&_(U.values||z(void 0,I),U)});let W=!1;return{unsubscribe:()=>{W||(W=!0,f--,P())}}}return z(_,I,!0)},pe=_=>{var I;const P=!!(!((I=_.formState)===null||I===void 0)&&I.values);P&&f++;const{unsubscribe:W}=b.state.subscribe({next:J=>{if(xA(_.name,J.name,_.exact)&&vA(J,_.formState||g,ct,_.reRenderRoot)){const B={...a};_.callback({values:B,...r,...J,defaultValues:n})}}});if(!P)return W;let U=!1;return()=>{U||(U=!0,f--,W())}},Se=_=>(s.mount=!0,y={...y,..._.formState},pe({..._,formState:{...m,..._.formState}})),je=(_,I={})=>{for(const P of _?pl(_):i.mount)i.mount.delete(P),i.array.delete(P),I.keepValue||(it(o,P),it(a,P)),!I.keepError&&it(r.errors,P),!I.keepDirty&&it(r.dirtyFields,P),!I.keepTouched&&it(r.touchedFields,P),!I.keepIsValidating&&it(r.validatingFields,P),!t.shouldUnregister&&!I.keepDefaultValue&&it(n,P);b.state.next({values:lt(a)}),b.state.next({...r,...I.keepDirty?{isDirty:G()}:{}}),!I.keepIsValid&&S()},Je=({disabled:_,name:I})=>{if(Er(_)&&s.mount||_||i.disabled.has(I)){const U=i.disabled.has(I)!==!!_;_?i.disabled.add(I):i.disabled.delete(I),U&&s.mount&&!s.action&&S()}},Re=(_,I={})=>{let P=le(o,_);const W=Er(I.disabled)||Er(t.disabled),U=!i.registerName.has(_)&&P&&P._f&&!P._f.mount;return Qe(o,_,{...P||{},_f:{...P&&P._f?P._f:{ref:{name:_}},name:_,mount:!0,...I}}),i.mount.add(_),P&&!U?Je({disabled:Er(I.disabled)?I.disabled:t.disabled,name:_}):L(_,!0,I.value),{...W?{disabled:I.disabled||t.disabled}:{},...t.progressive?{required:!!I.required,min:Yn(I.min),max:Yn(I.max),minLength:Yn(I.minLength),maxLength:Yn(I.maxLength),pattern:Yn(I.pattern)}:{},name:_,onChange:Y,onBlur:Y,ref:J=>{if(J){i.registerName.add(_),Re(_,I),i.registerName.delete(_),P=le(o,_);const B=qe(J.value)&&J.querySelectorAll&&J.querySelectorAll("input,select,textarea")[0]||J,Q=hA(B),ie=P._f.refs||[];if(Q?ie.find(Ve=>Ve===B):B===P._f.ref)return;const De={...P._f};Q?(De.refs=[...ie.filter(gd),B,...Array.isArray(le(n,_))?[{}]:[]],De.ref={type:B.type,name:_}):(De.ref=B,delete De.refs),Qe(o,_,{_f:De}),L(_,!1,void 0,B)}else P=le(o,_,{}),P._f&&(P._f.mount=!1),(t.shouldUnregister||I.shouldUnregister)&&!(aA(i.array,_)&&s.action)&&i.unMount.add(_)}}},Ye=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&jn(o,ce,i.mount),ye=_=>{Er(_)&&(b.state.next({disabled:_}),jn(o,(I,P)=>{const W=le(o,P);W&&(I.disabled=W._f.disabled||_,Array.isArray(W._f.refs)&&W._f.refs.forEach(U=>{U.disabled=W._f.disabled||_}))},0,!1))},rt=(_,I)=>async P=>{let W;P&&(P.preventDefault&&P.preventDefault(),P.persist&&P.persist());let U=lt(a);if(b.state.next({isSubmitting:!0}),t.resolver){const{errors:J,values:B}=await V();N(),r.errors=J,U=lt(B)}else await H({fields:o,eventType:en.SUBMIT});if(i.disabled.size)for(const J of i.disabled)it(U,J);if(it(r.errors,hg),_t(r.errors)){b.state.next({errors:{}});try{await _(U,P)}catch(J){W=J}}else I&&await I({...r.errors},P),Ye(),setTimeout(Ye);if(b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:_t(r.errors)&&!W,submitCount:r.submitCount+1,errors:r.errors}),W)throw W},Le=(_,I={})=>{le(o,_)&&(qe(I.defaultValue)?oe(_,lt(le(n,_))):(oe(_,I.defaultValue),Qe(n,_,lt(I.defaultValue))),I.keepTouched||it(r.touchedFields,_),I.keepDirty||(it(r.dirtyFields,_),r.isDirty=I.defaultValue?G(_,lt(le(n,_))):G()),I.keepError||(it(r.errors,_),g.isValid&&S()),b.state.next({...r}))},Ge=(_,I={})=>{const P=_?lt(_):n,W=lt(P),U=_t(_),J=W,B=o;if(I.keepDefaultValues||(n=P),!I.keepValues){if(I.keepDirtyValues){const Q=new Set([...i.mount,...Object.keys(Po(n,a,void 0,B))]);for(const ie of Array.from(Q)){const De=le(r.dirtyFields,ie),Ve=le(a,ie),Dt=le(J,ie);De&&!qe(Ve)?Qe(J,ie,Ve):!De&&!qe(Dt)&&oe(ie,Dt)}}else{if(ll&&qe(_))for(const Q of i.mount){const ie=le(o,Q);if(ie&&ie._f){const De=Array.isArray(ie._f.refs)?ie._f.refs[0]:ie._f.ref;if(dl(De)){const Ve=De.closest("form");if(Ve){Ve.reset();break}}}}if(I.keepFieldsRef)for(const Q of i.mount)oe(Q,le(J,Q));else o={}}if(t.shouldUnregister){if(a=I.keepDefaultValues?lt(n):{},I.keepFieldsRef)for(const Q of i.mount)Qe(a,Q,le(J,Q))}else a=lt(J);b.array.next({values:{...J}}),b.state.next({name:void 0,type:void 0,values:{...J}})}i={mount:I.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!g.isValid||!!I.keepIsValid||!!I.keepDirtyValues||!t.shouldUnregister&&!_t(J),s.watch=!!t.shouldUnregister,s.keepIsValid=!!I.keepIsValid,s.action=!1,I.keepErrors||(r.errors={}),b.state.next({submitCount:I.keepSubmitCount?r.submitCount:0,isDirty:U?!1:I.keepDirty?r.isDirty:I.keepValues?G():!!(I.keepDefaultValues&&!kr(_,n)),isSubmitted:I.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:U?{}:I.keepDirtyValues?I.keepDefaultValues&&a?Po(n,a,void 0,B):r.dirtyFields:I.keepDefaultValues&&_?Po(n,_,void 0,B):I.keepDirty?r.dirtyFields:{},touchedFields:I.keepTouched?r.touchedFields:{},errors:I.keepErrors?r.errors:{},isSubmitSuccessful:I.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:n})},Ue=(_,I)=>Ge(Rt(_)?_(a):_,{...t.resetOptions,...I}),Ee=(_,I={})=>{const P=le(o,_),W=P&&P._f;if(W){const U=W.refs?W.refs[0]:W.ref;U.focus&&setTimeout(()=>{U.focus(),I.shouldSelect&&Rt(U.select)&&U.select()})}},ct=_=>{const{name:I,type:P,values:W,...U}=_;r={...r,...U}},Yt={control:{register:Re,unregister:je,getFieldState:be,handleSubmit:rt,setError:X,_subscribe:pe,_runSchema:V,_updateIsValidating:N,_focusError:Ye,_getWatch:z,_getDirty:G,_setValid:S,_setFieldArray:M,_setDisabledField:Je,_setErrors:T,_getFieldArray:Ce,_reset:Ge,_resetDefaultValues:()=>Rt(t.defaultValues)&&t.defaultValues().then(_=>{Ue(_,t.resetOptions),b.state.next({isLoading:!1})}),_removeUnmounted:ee,_disableForm:ye,_subjects:b,_proxyFormState:g,get _fields(){return o},get _formValues(){return a},get _state(){return s},set _state(_){s=_},get _defaultValues(){return n},get _names(){return i},set _names(_){i=_},get _formState(){return r},get _options(){return t},set _options(_){t={...t,..._},u=cl(t.mode),h=cl(t.reValidateMode)}},subscribe:Se,trigger:te,register:Re,handleSubmit:rt,watch:ne,setValue:oe,setValues:he,getValues:Ne,reset:Ue,resetField:Le,resetDefaultValues:(_,I={})=>{if(n=lt(_),!I.keepDirty){const P=Po(n,a,void 0,o);r.dirtyFields=P,r.isDirty=!_t(P)}I.keepIsValid||S(),b.state.next({...r,defaultValues:n})},clearErrors:ue,unregister:je,setError:X,setFocus:Ee,getFieldState:be};return{...Yt,formControl:Yt}}function Vg(e={}){const t=D.useRef(void 0),r=D.useRef(void 0),o=D.useRef(e.formControl),[n,a]=D.useState(()=>({...lt(Gg),isLoading:Rt(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Rt(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&o.current!==e.formControl)if(o.current=e.formControl,e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!Rt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...c}=EA(e);t.current={...c,formState:n}}const s=t.current.control;return s._options=e,cA(()=>{const i=s._subscribe({formState:s._proxyFormState,callback:()=>a({...s._formState,defaultValues:s._defaultValues}),reRenderRoot:!0});return a(c=>({...c,isReady:!0})),s._formState.isReady=!0,i},[s]),D.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),D.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),D.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),D.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),D.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==n.isDirty&&s._subjects.state.next({isDirty:i})}},[s,n.isDirty]),D.useEffect(()=>{var i;e.values&&!kr(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),!((i=s._options.resetOptions)===null||i===void 0)&&i.keepIsValid||s._setValid(),r.current=e.values,a(c=>({...c}))):s._resetDefaultValues()},[s,e.values]),D.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=D.useMemo(()=>iA(n,s),[s,n]),t.current}function zg(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 Bg(e,t){var n;const r=[],o=new Map;for(const a of t){const s=((n=a.attributes)==null?void 0:n.name)||a.id;o.set(s,a)}for(const[a,s]of Object.entries(e)){const i=o.get(a);if(i){const c=zg(i);if(c==="layout"||c==="action")continue;r.push({id:a,value:s,type:i.type,category:c})}else r.push({id:a,value:s,type:"unknown",category:"field"})}return r}function xd(e,t,r="keyValue"){return r==="array"?Bg(e,t):e}function kA(e,t){var n;const r={},o=new Map;for(const a of t){const s=((n=a.attributes)==null?void 0:n.name)||a.id;o.set(s,a)}for(const[a,s]of Object.entries(e)){const i=o.get(a);if(i){const c=zg(i);(c==="field"||c==="container")&&(r[a]=s)}else r[a]=s}return r}const _A=({currentPage:e,totalPages:t,pages:r,showStepNumbers:o,onPageClick:n})=>{const a=(e+1)/t*100;return l.jsxs("div",{className:p("mb-8"),children:[l.jsx("div",{className:p("h-2 bg-gray-200 rounded-full overflow-hidden"),children:l.jsx("div",{className:p("h-full bg-blue-600 transition-all duration-300 ease-out"),style:{width:`${a}%`}})}),o&&l.jsx("div",{className:p("flex justify-between mt-4"),children:r.map((s,i)=>{const c=i<e,d=i===e;return l.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:[l.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?l.jsx("svg",{className:p("w-4 h-4"),fill:"currentColor",viewBox:"0 0 20 20",children:l.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}),l.jsx("span",{className:p(`mt-2 text-xs font-medium ${d?"text-blue-600":"text-gray-500"}`),children:s.title})]},s.id)})})]})},DA=({page:e,pageIndex:t,totalPages:r})=>l.jsxs("div",{className:p("mb-6"),children:[l.jsxs("div",{className:p("flex items-center justify-between mb-2"),children:[l.jsx("h2",{className:p("text-xl font-semibold text-gray-900"),children:e.title}),l.jsxs("span",{className:p("text-sm text-gray-500"),children:["Step ",t+1," of ",r]})]}),e.description&&l.jsx("p",{className:p("text-gray-600"),children:e.description})]}),AA=({currentPage:e,totalPages:t,allowSkip:r,isSubmitting:o,onPrevious:n,onNext:a,onSkip:s})=>{const i=e===0,c=e===t-1;return l.jsxs("div",{className:p("flex items-center justify-between mt-8 pt-6 border-t border-gray-200"),children:[l.jsx("div",{children:!i&&l.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"})}),l.jsxs("div",{className:p("flex gap-3"),children:[r&&!c&&l.jsx("button",{type:"button",onClick:s,className:p("px-4 py-2 text-sm font-medium text-gray-500 hover:text-gray-700"),children:"Skip"}),c?l.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"}):l.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 →"})]})]})},Ug=({element:e,elements:t})=>{const{setValue:r,watch:o,register:n,unregister:a}=md(),s=o(),{visible:i,required:c,disabled:d}=D.useMemo(()=>Rm(e,s,t),[e,s,t]),f=e.attributes.name;if(D.useEffect(()=>{var N,E,M,k,T,A;if(f){if(!i){a(f,{keepValue:!0});return}return n(f,{required:c?((N=e.validation)==null?void 0:N.errorMessage)||"This field is required":void 0,minLength:(E=e.validation)==null?void 0:E.minLength,maxLength:(M=e.validation)==null?void 0:M.maxLength,min:(k=e.validation)==null?void 0:k.min,max:(T=e.validation)==null?void 0:T.max,pattern:IA((A=e.validation)==null?void 0:A.pattern),disabled:d||e.properties.disabled||void 0}),()=>a(f,{keepValue:!0})}},[f,i,c,d,e.validation,e.properties.disabled,n,a]),!i)return null;const u=o(f),h=d||e.properties.disabled||!1,m={small:"max-w-xs",medium:"max-w-md",large:"max-w-lg",full:"w-full",default:"max-w-md"},g=m[e.layout.size||"default"]||m.default,y=dt.get(e.type),b=(N,E)=>{const M=t.filter(k=>k.parentId===N).sort((k,T)=>k.order-T.order);return l.jsx("div",{className:p("space-y-4"),children:M.map(k=>l.jsx(Ug,{element:{...k,attributes:{...k.attributes,name:E?`${E}.${k.attributes.name}`:k.attributes.name}},elements:t},k.id))})},C={element:e,properties:e.properties,layout:e.layout,validation:{...e.validation,required:c},logic:e.logic,config:e.config,mode:"render",value:u,onChange:N=>r(f,N),errors:[],formValues:s,readOnly:!1,disabled:h,allElements:t,renderChildren:b},w=()=>y!=null&&y.render?y.render(C):l.jsxs("div",{className:p("p-3 bg-yellow-50 border border-yellow-200 rounded-md text-sm text-yellow-700"),children:[l.jsxs("p",{className:p("font-medium"),children:["Unknown element type: ",e.type]}),l.jsxs("p",{className:p("text-xs mt-1"),children:["This element is not registered in the element registry. Please register it using ",l.jsx("code",{children:"registerElement()"}),"."]})]});return(y==null?void 0:y.structure)==="page"&&["heading","layout","special"].includes(y.subCategory||"")||["paragraph","image","link","formHeading","sectionHeading","subheading","divider","spacer","captcha","submit"].includes(e.type)?l.jsx("div",{className:p(g,"mb-4"),children:w()}):l.jsx("div",{className:p(g,"mb-4"),children:w()})};function TA(e){var o,n,a;if(e.attributes.defaultValue!==void 0)return e.attributes.defaultValue;const t=dt.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 IA(e){if(e)try{return new RegExp(e)}catch{return}}function PA(e){const t={};return e.forEach(r=>{var o;(o=r.attributes)!=null&&o.name&&(t[r.attributes.name]=TA(r))}),t}function MA(e,t){const r=[],o=n=>{var a;for(const s of n)(a=s.attributes)!=null&&a.name&&r.push(s.attributes.name),o(t.filter(i=>i.parentId===s.id))};return o(e),r}const wd=({schema:e,onSubmit:t,initialValues:r,onPageChange:o,submissionFormat:n="keyValue"})=>{const[a,s]=D.useState(0),[i,c]=D.useState(!1),[d,f]=D.useState(null),u=D.useMemo(()=>e.elements.find(A=>A.type==="pages"),[e.elements]),h=D.useMemo(()=>{var A,L,O,F,V;return{showProgressBar:((A=u==null?void 0:u.config)==null?void 0:A.showProgressBar)??!0,showStepNumbers:((L=u==null?void 0:u.config)==null?void 0:L.showStepNumbers)??!0,allowSkip:((O=u==null?void 0:u.config)==null?void 0:O.allowSkip)??!1,validateOnNext:((F=u==null?void 0:u.config)==null?void 0:F.validateOnNext)??!0,steps:((V=u==null?void 0:u.config)==null?void 0:V.steps)||[{id:"step1",label:"Step 1"}]}},[u]),m=D.useMemo(()=>u?h.steps.map(L=>{const O=e.elements.filter(F=>{var V;return F.parentId===`${u.id}:${L.id}`||F.parentId===u.id&&((V=F.config)==null?void 0:V.wizardStepId)===L.id});return{id:L.id,title:L.label,description:L.description,elements:O.sort((F,V)=>F.order-V.order)}}):[],[u,h.steps,e.elements]),g=D.useMemo(()=>e.elements.filter(A=>A.type!=="pages"),[e.elements]),y=D.useMemo(()=>r||PA(g),[r,g]),b=Vg({defaultValues:y,mode:"onChange"}),{handleSubmit:C,trigger:w}=b,x=D.useCallback(A=>{A>=0&&A<m.length&&(s(A),o==null||o(A))},[m.length,o]),S=D.useCallback(()=>{x(a-1)},[a,x]),N=D.useCallback(async()=>{if(h.validateOnNext){const A=MA(m[a].elements,e.elements);if(!await w(A))return}x(a+1)},[a,h.validateOnNext,m,e.elements,w,x]),E=D.useCallback(()=>{x(a+1)},[a,x]),M=D.useCallback(async A=>{c(!0);try{const L=xd(A,e.elements,n);console.log("Wizard form submitted:",L),f(L),await(t==null?void 0:t(L))}catch(L){console.error("Form submission error:",L)}finally{c(!1)}},[t,e.elements,n]),k=D.useCallback(A=>{if(a<m.length-1){A.preventDefault(),N();return}C(M)(A)},[a,m.length,N,C,M]),T=m[a];return T?l.jsxs("div",{className:p("max-w-3xl mx-auto"),children:[l.jsx(_g,{...b,children:l.jsxs("form",{onSubmit:k,className:p("space-y-1"),children:[h.showProgressBar&&l.jsx(_A,{currentPage:a,totalPages:m.length,pages:m,showStepNumbers:h.showStepNumbers,onPageClick:h.allowSkip?x:void 0}),l.jsx(DA,{page:T,pageIndex:a,totalPages:m.length}),l.jsx("div",{className:p("space-y-4"),children:T.elements.map(A=>l.jsx(Ug,{element:A,elements:e.elements},A.id))}),l.jsx(AA,{currentPage:a,totalPages:m.length,allowSkip:h.allowSkip,isSubmitting:i,onPrevious:S,onNext:N,onSkip:E})]})}),d&&l.jsxs("div",{className:p("mt-8 p-4 bg-green-50 border border-green-200 rounded-lg"),children:[l.jsx("h3",{className:p("text-lg font-medium text-green-800 mb-2"),children:"Form Submitted Successfully!"}),l.jsx("pre",{className:p("text-sm text-green-700 overflow-x-auto"),children:JSON.stringify(d,null,2)})]})]}):l.jsxs("div",{className:p("p-8 text-center text-gray-500"),children:[l.jsx("p",{children:"No wizard steps configured."}),l.jsx("p",{className:p("text-sm mt-2"),children:"Add steps to the wizard element to create a multi-page form."})]})};function OA(e){var o,n,a;if(e.attributes.defaultValue!==void 0)return e.attributes.defaultValue;const t=dt.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 LA(e){const t={};return e.forEach(r=>{var o;(o=r.attributes)!=null&&o.name&&(t[r.attributes.name]=OA(r))}),t}const Wg=({element:e,elements:t})=>{const{watch:r}=md(),o=r(),{visible:n,required:a,disabled:s}=D.useMemo(()=>Rm(e,o,t),[e,o,t]);return n?l.jsx(FA,{element:e,elements:t,dynamicRequired:a,dynamicDisabled:s}):null},FA=({element:e,elements:t,dynamicRequired:r,dynamicDisabled:o})=>{const{setValue:n,watch:a}=md(),s=e.attributes.name,i=a(s),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=dt.get(e.type),m=(w,x)=>{const S=t.filter(N=>N.parentId===w).sort((N,E)=>N.order-E.order);return l.jsx("div",{className:p("space-y-4"),children:S.map(N=>l.jsx(Wg,{element:{...N,attributes:{...N.attributes,name:x?`${x}.${N.attributes.name}`:N.attributes.name}},elements:t},N.id))})},g={element:e,properties:e.properties,layout:e.layout,validation:{...e.validation,required:d},logic:e.logic,config:e.config,mode:"render",value:i,onChange:w=>n(s,w),errors:[],formValues:a(),readOnly:!1,disabled:c,allElements:t,renderChildren:m},y=()=>h!=null&&h.render?h.render(g):l.jsxs("div",{className:p("p-3 bg-yellow-50 border border-yellow-200 rounded-md text-sm text-yellow-700"),children:[l.jsxs("p",{className:p("font-medium"),children:["Unknown element type: ",e.type]}),l.jsxs("p",{className:p("text-xs mt-1"),children:["This element is not registered in the element registry. Please register it using ",l.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)?l.jsx("div",{className:p(u,"mb-4"),children:y()}):l.jsx("div",{className:p(u,"mb-4"),children:y()})},Hg=({schema:e,onSubmit:t,initialValues:r,submissionFormat:o="keyValue"})=>{const[n,a]=D.useState(null);if(D.useMemo(()=>e.elements.some(h=>h.type==="pages"),[e.elements]))return l.jsx(wd,{schema:e,onSubmit:t,initialValues:r,submissionFormat:o});const i=D.useMemo(()=>e.elements.filter(h=>!h.parentId),[e.elements]),c=D.useMemo(()=>r||LA(i),[r,i]),d=Vg({defaultValues:c,mode:"onChange"}),f=D.useCallback(h=>{const m=xd(h,e.elements,o);console.log("Form submitted:",m),a(m),t==null||t(m)},[t,e.elements,o]),u=D.useMemo(()=>[...i].sort((h,m)=>h.order-m.order),[i]);return l.jsxs("div",{className:p("max-w-3xl mx-auto"),children:[l.jsx(_g,{...d,children:l.jsxs("form",{onSubmit:d.handleSubmit(f),className:p("space-y-1"),children:[l.jsx("div",{className:p(""),children:e.description&&l.jsx("p",{className:p("mt-2 text-gray-600"),children:e.description})}),l.jsx("div",{className:p("space-y-4"),children:u.map(h=>l.jsx(Wg,{element:h,elements:e.elements},h.id))})]})}),n&&l.jsxs("div",{className:p("mt-8 p-4 bg-green-50 border border-green-200 rounded-lg"),children:[l.jsx("h3",{className:p("text-lg font-medium text-green-800 mb-2"),children:"Submitted Data:"}),l.jsx("pre",{className:p("text-sm text-green-700 overflow-x-auto"),children:JSON.stringify(n,null,2)})]})]})},jg=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:p("rounded-xl border bg-card text-card-foreground shadow",e),...t}));jg.displayName="Card";const $A=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:p("flex flex-col space-y-1.5 p-6",e),...t}));$A.displayName="CardHeader";const GA=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:p("font-semibold leading-none tracking-tight",e),...t}));GA.displayName="CardTitle";const VA=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:p("text-sm text-muted-foreground",e),...t}));VA.displayName="CardDescription";const Yg=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:p("p-6 pt-0",e),...t}));Yg.displayName="CardContent";const zA=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:p("flex items-center p-6 pt-0",e),...t}));zA.displayName="CardFooter";const BA=es("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"}}),qg=v.forwardRef(({className:e,variant:t,...r},o)=>l.jsx("div",{ref:o,role:"alert",className:p(BA({variant:t}),e),...r}));qg.displayName="Alert";const Qg=v.forwardRef(({className:e,...t},r)=>l.jsx("h5",{ref:r,className:p("mb-1 font-medium leading-none tracking-tight",e),...t}));Qg.displayName="AlertTitle";const Kg=v.forwardRef(({className:e,...t},r)=>l.jsx("div",{ref:r,className:p("text-sm [&_p]:leading-relaxed",e),...t}));Kg.displayName="AlertDescription";const UA={id:"design",label:"Design Mode",icon:hS,order:0,keyboardShortcut:"d",description:"Edit your form layout and properties",renderContent:(e,t)=>l.jsxs(l.Fragment,{children:[t==null?void 0:t.ElementSidebar,t==null?void 0:t.Canvas,t==null?void 0:t.PropertyPanel]})},WA={id:"preview",label:"Preview Mode",icon:hf,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,s=r.elements.some(c=>c.type==="pages"),i=c=>{console.log("Form submitted:",c),a==null||a(c)};return l.jsx("div",{className:p("flex-1 overflow-y-auto bg-muted/30"),children:l.jsxs("div",{className:p("py-8 px-4"),children:[l.jsx("div",{className:p("max-w-3xl mx-auto mb-6"),children:l.jsxs("div",{className:p("flex items-center justify-between"),children:[l.jsxs("div",{className:p("flex items-center gap-2 text-sm text-muted-foreground"),children:[l.jsx(hf,{className:p("h-4","w-4")}),l.jsx("span",{children:"Preview Mode"}),s&&l.jsx(Oi,{variant:"secondary",children:"Wizard Form"})]}),l.jsxs(Ze,{variant:"ghost",size:"sm",onClick:()=>o("design"),children:[l.jsx(dS,{className:p("h-4","w-4","mr-1")}),"Back to Editor"]})]})}),l.jsx(jg,{className:p("max-w-3xl mx-auto"),children:l.jsx(Yg,{className:p("p-8"),children:r.elements.length===0?l.jsxs("div",{className:p("text-center py-12 text-muted-foreground"),children:[l.jsx(fS,{className:p("h-12","w-12","mx-auto","mb-4","text-muted-foreground/50")}),l.jsx("p",{className:p("text-lg font-medium mb-2"),children:"No elements to preview"}),l.jsx("p",{className:p("text-sm"),children:"Switch to Design mode and add some elements to your form."})]}):s?l.jsx(wd,{schema:r,onSubmit:i,submissionFormat:n}):l.jsx(Hg,{schema:r,onSubmit:i,submissionFormat:n})})}),r.elements.some(c=>c.logic)&&l.jsx("div",{className:p("max-w-3xl mx-auto mt-6"),children:l.jsxs(qg,{children:[l.jsx(mf,{className:p("h-4","w-4")}),l.jsx(Qg,{children:"Conditional Logic Active"}),l.jsx(Kg,{children:"This form has conditional logic rules. Some fields may show/hide based on your input."})]})})]})})}};function Xg(){Vt.has("design")||Vt.register(UA),Vt.has("preview")||Vt.register(WA)}Xg();const Jg=({initialSchema:e,onSchemaChange:t,toolbarActions:r,toolbarConfig:o,sidebarTabs:n,sidebarConfig:a,onPreviewSubmit:s,showElementSidebar:i=!0,showPropertyPanel:c=!0,submissionFormat:d="array",className:f})=>{const u=R(S=>S.mode),h=R(S=>S.setMode),m=R(S=>S.schema),g=R(S=>S.loadSchema);D.useEffect(()=>kv(),[]),D.useEffect(()=>{e&&g(e)},[e,g]),D.useEffect(()=>{t&&t(m)},[m,t]);const y=r||o?{...o,actions:[...(o==null?void 0:o.actions)??[],...r??[]]}:void 0,b=n||a!=null&&a.tabs?[...(a==null?void 0:a.tabs)??[],...n??[]]:void 0,C=Vt.get(u),w=D.useMemo(()=>({schema:m,currentMode:u,setMode:h,submissionFormat:d,onSubmit:s,showElementSidebar:i,showPropertyPanel:c,loadSchema:g}),[m,u,h,d,s,i,c,g]),x=D.useMemo(()=>({ElementSidebar:i?l.jsx(sE,{sidebarTabs:b}):void 0,Canvas:l.jsx(kE,{toolbarConfig:y}),PropertyPanel:c?l.jsx(oA,{}):void 0}),[i,b,y,c]);return l.jsx("div",{className:p("ep-main-layout h-screen flex flex-col bg-muted/50",f),children:l.jsx("div",{className:p("flex-1 flex overflow-hidden"),children:C?C.renderContent(w,x):null})})};Z.AffixInput=zl,Z.CanvasElementRenderer=Za,Z.CanvasPreviewWrapper=Ex,Z.ElementDescription=wa,Z.ElementLabel=xa,Z.EmptyState=kx,Z.EntryPulse=Jg,Z.ErrorMessages=fn,Z.FieldWrapper=Nx,Z.FormElementRenderer=vf,Z.FormPreview=Hg,Z.IconInput=uo,Z.InputWrapper=de,Z.WizardForm=wd,Z.builtInElements=yf,Z.createSidebarTab=th,Z.createSidebarTabs=nE,Z.createToolbarAction=sh,Z.createToolbarActions=mE,Z.default=Jg,Z.elementRegistry=dt,Z.extractContextValues=j,Z.filterFieldData=kA,Z.getButtonClassName=_x,Z.getCanvasInputClassName=Ct,Z.getElementDefinition=Pv,Z.getElementIcon=xf,Z.getElementLabel=Mi,Z.getInputClassName=Ot,Z.getModeDefinition=xE,Z.hasElement=Mv,Z.hasMode=wE,Z.isActionDisabled=lh,Z.isActionHidden=Zi,Z.isElementRegistered=RS,Z.isSidebarTabDisabled=rh,Z.isSidebarTabHidden=oh,Z.modeRegistry=Vt,Z.registerBuiltInElements=LS,Z.registerBuiltinModes=Xg,Z.registerElement=Av,Z.registerElements=Tv,Z.registerMode=bE,Z.registerModes=yE,Z.renderElement=tN,Z.renderElementOnCanvas=eN,Z.transformSubmissionData=xd,Z.transformToArrayFormat=Bg,Z.unregisterElement=Iv,Z.unregisterMode=vE,Z.useFormStore=R,Object.defineProperties(Z,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
203
|
+
//# sourceMappingURL=entry-pulse.umd.cjs.map
|