@schema-forms-data/react 0.3.21 → 0.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +14 -14
- package/dist/index.js +2723 -2597
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react"),o=require("react/jsx-runtime"),ce=require("react-hook-form"),P=require("lucide-react"),Bo=require("react-dom"),xt=require("@dnd-kit/sortable"),Cr=require("@dnd-kit/utilities"),cr=require("@dnd-kit/core");function Uo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const x=Uo(E),ct=Uo(P),da=Uo(Bo);var O=(e=>(e.TEXTO="texto",e.TEXTAREA="textarea",e.NUMBER="number",e.EMAIL="email",e.PASSWORD="password",e.TELEFONE="telefone",e.CPF="cpf",e.CEP="cep",e.DATE="date",e.DATETIME="datetime",e.TIME="time",e.DATE_RANGE="date_range",e.SELECT="select",e.AUTOCOMPLETE="autocomplete",e.RADIO="radio",e.CHECKBOX="checkbox",e.CHECKBOX_GROUP="checkbox_group",e.SWITCH="switch",e.SLIDER="slider",e.RATING="rating",e.COLOR="color",e.FILE="file",e.HIDDEN="hidden",e.FIELD_ARRAY="field_array",e.PARTICIPATION_TYPE="participation_type",e.PAYMENT_METHOD="payment_method",e.TERMS="terms",e.SUB_FORM="sub_form",e))(O||{}),gi=(e=>(e.RASCUNHO="rascunho",e.ATIVO="ativo",e.INATIVO="inativo",e))(gi||{}),vi=(e=>(e.CPF="cpf",e.TELEFONE="telefone",e.CEP="cep",e.CUSTOM="custom",e))(vi||{});const ep={texto:"Texto",textarea:"Área de texto",number:"Número",email:"E-mail",password:"Senha",telefone:"Telefone",cpf:"CPF",cep:"CEP",date:"Data",datetime:"Data e hora",time:"Horário",date_range:"Período (data inicial/final)",select:"Seleção",autocomplete:"Autocomplete",radio:"Radio",checkbox:"Checkbox",checkbox_group:"Grupo de checkboxes",switch:"Switch (toggle)",slider:"Slider",rating:"Avaliação (estrelas)",color:"Cor",file:"Arquivo",hidden:"Oculto",field_array:"Lista de itens",participation_type:"Tipo de participação",payment_method:"Forma de pagamento",terms:"Termos e condições",sub_form:"Sub-formulário"},tp={texto:"Type",textarea:"AlignLeft",number:"Hash",email:"Mail",password:"Lock",telefone:"Phone",cpf:"CreditCard",cep:"MapPin",date:"Calendar",datetime:"Clock",time:"Timer",date_range:"CalendarRange",select:"ChevronDown",autocomplete:"Search",radio:"CircleDot",checkbox:"CheckSquare",checkbox_group:"ListChecks",switch:"ToggleLeft",slider:"SlidersHorizontal",rating:"Star",color:"Palette",file:"Upload",hidden:"EyeOff",field_array:"List",participation_type:"CalendarDays",payment_method:"Wallet",terms:"ScrollText",sub_form:"LayoutList"},bi=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Fe=bi,ze={primary:"#3b82f6",primaryHover:"#2563eb",accent:"#8b5cf6",background:"hsl(var(--background))",surface:"hsl(var(--card))",text:"hsl(var(--foreground))",textMuted:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",error:"hsl(var(--destructive))"},rp={primary:"#f97316",primaryHover:"#ea580c",accent:"#ef4444",background:"#09090b",surface:"rgba(24,24,27,0.9)",text:"#ffffff",textMuted:"#a1a1aa",border:"rgba(249,115,22,0.2)",error:"#f87171"},ap={...ze,primary:"#18181b",primaryHover:"#27272a",accent:"#71717a",border:"#e4e4e7"},op={...ze,primary:"#1e3a5f",primaryHover:"#162d4a",accent:"#c9a84c"},np={...ze,primary:"#ec4899",primaryHover:"#db2777",accent:"#8b5cf6",background:"#0f0f1a",text:"#ffffff",textMuted:"#a78bfa"},sp={...ze,primary:"#059669",primaryHover:"#047857",accent:"#6ee7b7"},ip={...ze,primary:"#0ea5e9",primaryHover:"#0284c7",accent:"#38bdf8"},lp={...ze,primary:"#6366f1",primaryHover:"#4f46e5",accent:"#818cf8"},cp={...ze,primary:"#d97706",primaryHover:"#b45309",accent:"#fbbf24"},dp={...ze,primary:"#10b981",primaryHover:"#059669",accent:"#34d399"},up={...ze,primary:"#b45309",primaryHover:"#92400e",accent:"#f59e0b",background:"#0c0c0c",text:"#fafafa",textMuted:"#d4af37"},pp={...ze,primary:"#dc2626",primaryHover:"#b91c1c",accent:"#f97316"},mp={...ze,primary:"#7c3aed",primaryHover:"#6d28d9",accent:"#a78bfa"},fp={primary:"#374151",primaryHover:"#1f2937",accent:"#6b7280",background:"#ffffff",surface:"#f9fafb",text:"#111827",textMuted:"#6b7280",border:"#e5e7eb",error:"#ef4444"},hp={primary:"#16a34a",primaryHover:"#15803d",accent:"#4ade80",background:"#fefce8",surface:"#ffffff",text:"#1c1917",textMuted:"#78716c",border:"#d6d3d1",error:"#dc2626"},xp={primary:"#d4af37",primaryHover:"#b8962e",accent:"#f0d060",background:"#0a0a0f",surface:"rgba(20,20,30,0.95)",text:"#f8f8f0",textMuted:"#9990aa",border:"rgba(212,175,55,0.25)",error:"#f87171"},zt={moderno:{id:"moderno",displayName:"Moderno",colors:{...ze},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/30"},minimalista:{id:"minimalista",displayName:"Minimalista",colors:ap,layout:{stepNavigation:"wizard",containerStyle:"flat",spacing:"relaxed",roundness:"rounded-lg",showProgressBar:!1,showStepIndicators:!1},wrapperClass:"bg-background"},card:{id:"card",displayName:"Card",colors:{...ze},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/40"},banner:{id:"banner",displayName:"Banner",colors:{...ze},layout:{stepNavigation:"tabs",containerStyle:"bordered",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},acampamento:{id:"acampamento",displayName:"Acampamento",colors:rp,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorPosition:"top-center",stepIndicatorOrientation:"horizontal",eventTitleStyle:"inline"},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-white",stepDescClass:"text-sm text-zinc-400",labelClass:"font-medium text-zinc-200"},wrapperClass:"bg-[#09090b]"},acampamento_imersivo:{id:"acampamento_imersivo",displayName:"Acampamento Imersivo",colors:{primary:"#f97316",primaryHover:"#ea580c",accent:"#fb923c",background:"#09090b",surface:"rgba(20,20,22,0.85)",text:"#ffffff",textMuted:"#a1a1aa",border:"rgba(249,115,22,0.25)",error:"#f87171"},layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorPosition:"top-center",stepIndicatorOrientation:"horizontal",eventTitleStyle:"inline"},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-white",stepDescClass:"text-sm text-zinc-400",labelClass:"font-medium text-zinc-200"},wrapperClass:"bg-[#09090b]"},corporativo:{id:"corporativo",displayName:"Corporativo",colors:op,layout:{stepNavigation:"wizard",containerStyle:"bordered",spacing:"normal",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-slate-50 dark:bg-slate-950"},festival:{id:"festival",displayName:"Festival",colors:np,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0f0f1a]"},webinar:{id:"webinar",displayName:"Webinar",colors:ip,layout:{stepNavigation:"tabs",containerStyle:"card",spacing:"compact",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},retiro:{id:"retiro",displayName:"Retiro",colors:sp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-emerald-50 dark:bg-emerald-950/20"},conferencia:{id:"conferencia",displayName:"Conferência",colors:lp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},social:{id:"social",displayName:"Social",colors:dp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},workshop:{id:"workshop",displayName:"Workshop",colors:cp,layout:{stepNavigation:"vertical",containerStyle:"bordered",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorOrientation:"vertical",eventTitleStyle:"bar"},wrapperClass:"bg-amber-50 dark:bg-amber-950/10"},gala:{id:"gala",displayName:"Gala",colors:up,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0c0c0c]"},acao:{id:"acao",displayName:"Ação",colors:pp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},podcast:{id:"podcast",displayName:"Podcast",colors:mp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},classico:{id:"classico",displayName:"Clássico",colors:fp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-white dark:bg-background"},comunitario:{id:"comunitario",displayName:"Comunitário",colors:hp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-yellow-50 dark:bg-background"},noturno:{id:"noturno",displayName:"Noturno",colors:xp,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-[#f8f8f0]",stepDescClass:"text-sm text-[#9990aa]",labelClass:"font-medium text-[#d4d4c8]"},wrapperClass:"bg-[#0a0a0f]"}},ua=e=>e&&e in zt?zt[e]:zt.moderno,gp=()=>Object.values(zt),vp=e=>e.layout.containerStyle==="glassmorphism",yi=e=>e.colors.background.startsWith("#0")||e.colors.background.startsWith("rgba(0")||e.colors.text==="#ffffff";var go={exports:{}},xr={};/**
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react"),o=require("react/jsx-runtime"),ce=require("react-hook-form"),P=require("lucide-react"),Bo=require("react-dom"),xt=require("@dnd-kit/sortable"),Cr=require("@dnd-kit/utilities"),cr=require("@dnd-kit/core");function Uo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const h=Uo(E),ct=Uo(P),da=Uo(Bo);var O=(e=>(e.TEXTO="texto",e.TEXTAREA="textarea",e.NUMBER="number",e.EMAIL="email",e.PASSWORD="password",e.TELEFONE="telefone",e.CPF="cpf",e.CEP="cep",e.DATE="date",e.DATETIME="datetime",e.TIME="time",e.DATE_RANGE="date_range",e.SELECT="select",e.AUTOCOMPLETE="autocomplete",e.RADIO="radio",e.CHECKBOX="checkbox",e.CHECKBOX_GROUP="checkbox_group",e.SWITCH="switch",e.SLIDER="slider",e.RATING="rating",e.COLOR="color",e.FILE="file",e.HIDDEN="hidden",e.FIELD_ARRAY="field_array",e.PARTICIPATION_TYPE="participation_type",e.PAYMENT_METHOD="payment_method",e.TERMS="terms",e.SUB_FORM="sub_form",e))(O||{}),vi=(e=>(e.RASCUNHO="rascunho",e.ATIVO="ativo",e.INATIVO="inativo",e))(vi||{}),bi=(e=>(e.CPF="cpf",e.TELEFONE="telefone",e.CEP="cep",e.CUSTOM="custom",e))(bi||{});const ap={texto:"Texto",textarea:"Área de texto",number:"Número",email:"E-mail",password:"Senha",telefone:"Telefone",cpf:"CPF",cep:"CEP",date:"Data",datetime:"Data e hora",time:"Horário",date_range:"Período (data inicial/final)",select:"Seleção",autocomplete:"Autocomplete",radio:"Radio",checkbox:"Checkbox",checkbox_group:"Grupo de checkboxes",switch:"Switch (toggle)",slider:"Slider",rating:"Avaliação (estrelas)",color:"Cor",file:"Arquivo",hidden:"Oculto",field_array:"Lista de itens",participation_type:"Tipo de participação",payment_method:"Forma de pagamento",terms:"Termos e condições",sub_form:"Sub-formulário"},op={texto:"Type",textarea:"AlignLeft",number:"Hash",email:"Mail",password:"Lock",telefone:"Phone",cpf:"CreditCard",cep:"MapPin",date:"Calendar",datetime:"Clock",time:"Timer",date_range:"CalendarRange",select:"ChevronDown",autocomplete:"Search",radio:"CircleDot",checkbox:"CheckSquare",checkbox_group:"ListChecks",switch:"ToggleLeft",slider:"SlidersHorizontal",rating:"Star",color:"Palette",file:"Upload",hidden:"EyeOff",field_array:"List",participation_type:"CalendarDays",payment_method:"Wallet",terms:"ScrollText",sub_form:"LayoutList"},yi=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Fe=yi,ze={primary:"#3b82f6",primaryHover:"#2563eb",accent:"#8b5cf6",background:"hsl(var(--background))",surface:"hsl(var(--card))",text:"hsl(var(--foreground))",textMuted:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",error:"hsl(var(--destructive))"},np={primary:"#f97316",primaryHover:"#ea580c",accent:"#ef4444",background:"#09090b",surface:"rgba(24,24,27,0.9)",text:"#ffffff",textMuted:"#a1a1aa",border:"rgba(249,115,22,0.2)",error:"#f87171"},sp={...ze,primary:"#18181b",primaryHover:"#27272a",accent:"#71717a",border:"#e4e4e7"},ip={...ze,primary:"#1e3a5f",primaryHover:"#162d4a",accent:"#c9a84c"},lp={...ze,primary:"#ec4899",primaryHover:"#db2777",accent:"#8b5cf6",background:"#0f0f1a",text:"#ffffff",textMuted:"#a78bfa"},cp={...ze,primary:"#059669",primaryHover:"#047857",accent:"#6ee7b7"},dp={...ze,primary:"#0ea5e9",primaryHover:"#0284c7",accent:"#38bdf8"},up={...ze,primary:"#6366f1",primaryHover:"#4f46e5",accent:"#818cf8"},pp={...ze,primary:"#d97706",primaryHover:"#b45309",accent:"#fbbf24"},mp={...ze,primary:"#10b981",primaryHover:"#059669",accent:"#34d399"},fp={...ze,primary:"#b45309",primaryHover:"#92400e",accent:"#f59e0b",background:"#0c0c0c",text:"#fafafa",textMuted:"#d4af37"},hp={...ze,primary:"#dc2626",primaryHover:"#b91c1c",accent:"#f97316"},xp={...ze,primary:"#7c3aed",primaryHover:"#6d28d9",accent:"#a78bfa"},gp={primary:"#374151",primaryHover:"#1f2937",accent:"#6b7280",background:"#ffffff",surface:"#f9fafb",text:"#111827",textMuted:"#6b7280",border:"#e5e7eb",error:"#ef4444"},vp={primary:"#16a34a",primaryHover:"#15803d",accent:"#4ade80",background:"#fefce8",surface:"#ffffff",text:"#1c1917",textMuted:"#78716c",border:"#d6d3d1",error:"#dc2626"},bp={primary:"#d4af37",primaryHover:"#b8962e",accent:"#f0d060",background:"#0a0a0f",surface:"rgba(20,20,30,0.95)",text:"#f8f8f0",textMuted:"#9990aa",border:"rgba(212,175,55,0.25)",error:"#f87171"},zt={moderno:{id:"moderno",displayName:"Moderno",colors:{...ze},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/30"},minimalista:{id:"minimalista",displayName:"Minimalista",colors:sp,layout:{stepNavigation:"wizard",containerStyle:"flat",spacing:"relaxed",roundness:"rounded-lg",showProgressBar:!1,showStepIndicators:!1},wrapperClass:"bg-background"},card:{id:"card",displayName:"Card",colors:{...ze},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/40"},banner:{id:"banner",displayName:"Banner",colors:{...ze},layout:{stepNavigation:"tabs",containerStyle:"bordered",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},acampamento:{id:"acampamento",displayName:"Acampamento",colors:np,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorPosition:"top-center",stepIndicatorOrientation:"horizontal",eventTitleStyle:"inline"},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-white",stepDescClass:"text-sm text-zinc-400",labelClass:"font-medium text-zinc-200"},wrapperClass:"bg-[#09090b]"},acampamento_imersivo:{id:"acampamento_imersivo",displayName:"Acampamento Imersivo",colors:{primary:"#f97316",primaryHover:"#ea580c",accent:"#fb923c",background:"#09090b",surface:"rgba(20,20,22,0.85)",text:"#ffffff",textMuted:"#a1a1aa",border:"rgba(249,115,22,0.25)",error:"#f87171"},layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorPosition:"top-center",stepIndicatorOrientation:"horizontal",eventTitleStyle:"inline"},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-white",stepDescClass:"text-sm text-zinc-400",labelClass:"font-medium text-zinc-200"},wrapperClass:"bg-[#09090b]"},corporativo:{id:"corporativo",displayName:"Corporativo",colors:ip,layout:{stepNavigation:"wizard",containerStyle:"bordered",spacing:"normal",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-slate-50 dark:bg-slate-950"},festival:{id:"festival",displayName:"Festival",colors:lp,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0f0f1a]"},webinar:{id:"webinar",displayName:"Webinar",colors:dp,layout:{stepNavigation:"tabs",containerStyle:"card",spacing:"compact",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},retiro:{id:"retiro",displayName:"Retiro",colors:cp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-emerald-50 dark:bg-emerald-950/20"},conferencia:{id:"conferencia",displayName:"Conferência",colors:up,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},social:{id:"social",displayName:"Social",colors:mp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},workshop:{id:"workshop",displayName:"Workshop",colors:pp,layout:{stepNavigation:"vertical",containerStyle:"bordered",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorOrientation:"vertical",eventTitleStyle:"bar"},wrapperClass:"bg-amber-50 dark:bg-amber-950/10"},gala:{id:"gala",displayName:"Gala",colors:fp,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0c0c0c]"},acao:{id:"acao",displayName:"Ação",colors:hp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},podcast:{id:"podcast",displayName:"Podcast",colors:xp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},classico:{id:"classico",displayName:"Clássico",colors:gp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-white dark:bg-background"},comunitario:{id:"comunitario",displayName:"Comunitário",colors:vp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-yellow-50 dark:bg-background"},noturno:{id:"noturno",displayName:"Noturno",colors:bp,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-[#f8f8f0]",stepDescClass:"text-sm text-[#9990aa]",labelClass:"font-medium text-[#d4d4c8]"},wrapperClass:"bg-[#0a0a0f]"}},ua=e=>e&&e in zt?zt[e]:zt.moderno,yp=()=>Object.values(zt),wp=e=>e.layout.containerStyle==="glassmorphism",wi=e=>e.colors.background.startsWith("#0")||e.colors.background.startsWith("rgba(0")||e.colors.text==="#ffffff";var go={exports:{}},xr={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var rs;function
|
|
9
|
+
*/var rs;function jp(){if(rs)return xr;rs=1;var e=E,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,n=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,c,d){var u,p={},m=null,x=null;d!==void 0&&(m=""+d),c.key!==void 0&&(m=""+c.key),c.ref!==void 0&&(x=c.ref);for(u in c)a.call(c,u)&&!s.hasOwnProperty(u)&&(p[u]=c[u]);if(l&&l.defaultProps)for(u in c=l.defaultProps,c)p[u]===void 0&&(p[u]=c[u]);return{$$typeof:t,type:l,key:m,ref:x,props:p,_owner:n.current}}return xr.Fragment=r,xr.jsx=i,xr.jsxs=i,xr}var Or={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,23 +14,23 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var as;function
|
|
17
|
+
*/var as;function Np(){return as||(as=1,process.env.NODE_ENV!=="production"&&function(){var e=E,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function v(S){if(S===null||typeof S!="object")return null;var B=g&&S[g]||S[f];return typeof B=="function"?B:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(S){{for(var B=arguments.length,Z=new Array(B>1?B-1:0),ne=1;ne<B;ne++)Z[ne-1]=arguments[ne];y("error",S,Z)}}function y(S,B,Z){{var ne=b.ReactDebugCurrentFrame,ge=ne.getStackAddendum();ge!==""&&(B+="%s",Z=Z.concat([ge]));var ve=Z.map(function(xe){return String(xe)});ve.unshift("Warning: "+B),Function.prototype.apply.call(console[S],console,ve)}}var N=!1,C=!1,k=!1,_=!1,w=!1,R;R=Symbol.for("react.module.reference");function A(S){return!!(typeof S=="string"||typeof S=="function"||S===a||S===s||w||S===n||S===d||S===u||_||S===x||N||C||k||typeof S=="object"&&S!==null&&(S.$$typeof===m||S.$$typeof===p||S.$$typeof===i||S.$$typeof===l||S.$$typeof===c||S.$$typeof===R||S.getModuleId!==void 0))}function I(S,B,Z){var ne=S.displayName;if(ne)return ne;var ge=B.displayName||B.name||"";return ge!==""?Z+"("+ge+")":Z}function F(S){return S.displayName||"Context"}function V(S){if(S==null)return null;if(typeof S.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof S=="function")return S.displayName||S.name||null;if(typeof S=="string")return S;switch(S){case a:return"Fragment";case r:return"Portal";case s:return"Profiler";case n:return"StrictMode";case d:return"Suspense";case u:return"SuspenseList"}if(typeof S=="object")switch(S.$$typeof){case l:var B=S;return F(B)+".Consumer";case i:var Z=S;return F(Z._context)+".Provider";case c:return I(S,S.render,"ForwardRef");case p:var ne=S.displayName||null;return ne!==null?ne:V(S.type)||"Memo";case m:{var ge=S,ve=ge._payload,xe=ge._init;try{return V(xe(ve))}catch{return null}}}return null}var M=Object.assign,U=0,$,T,D,z,L,ee,Y;function J(){}J.__reactDisabledLog=!0;function q(){{if(U===0){$=console.log,T=console.info,D=console.warn,z=console.error,L=console.group,ee=console.groupCollapsed,Y=console.groupEnd;var S={configurable:!0,enumerable:!0,value:J,writable:!0};Object.defineProperties(console,{info:S,log:S,warn:S,error:S,group:S,groupCollapsed:S,groupEnd:S})}U++}}function se(){{if(U--,U===0){var S={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},S,{value:$}),info:M({},S,{value:T}),warn:M({},S,{value:D}),error:M({},S,{value:z}),group:M({},S,{value:L}),groupCollapsed:M({},S,{value:ee}),groupEnd:M({},S,{value:Y})})}U<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var me=b.ReactCurrentDispatcher,H;function ie(S,B,Z){{if(H===void 0)try{throw Error()}catch(ge){var ne=ge.stack.trim().match(/\n( *(at )?)/);H=ne&&ne[1]||""}return`
|
|
18
18
|
`+H+S}}var te=!1,re;{var Q=typeof WeakMap=="function"?WeakMap:Map;re=new Q}function fe(S,B){if(!S||te)return"";{var Z=re.get(S);if(Z!==void 0)return Z}var ne;te=!0;var ge=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ve;ve=me.current,me.current=null,q();try{if(B){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(Ie){ne=Ie}Reflect.construct(S,[],xe)}else{try{xe.call()}catch(Ie){ne=Ie}S.call(xe.prototype)}}else{try{throw Error()}catch(Ie){ne=Ie}S()}}catch(Ie){if(Ie&&ne&&typeof Ie.stack=="string"){for(var he=Ie.stack.split(`
|
|
19
19
|
`),Te=ne.stack.split(`
|
|
20
20
|
`),Ce=he.length-1,ke=Te.length-1;Ce>=1&&ke>=0&&he[Ce]!==Te[ke];)ke--;for(;Ce>=1&&ke>=0;Ce--,ke--)if(he[Ce]!==Te[ke]){if(Ce!==1||ke!==1)do if(Ce--,ke--,ke<0||he[Ce]!==Te[ke]){var qe=`
|
|
21
|
-
`+he[Ce].replace(" at new "," at ");return S.displayName&&qe.includes("<anonymous>")&&(qe=qe.replace("<anonymous>",S.displayName)),typeof S=="function"&&re.set(S,qe),qe}while(Ce>=1&&ke>=0);break}}}finally{te=!1,me.current=ve,se(),Error.prepareStackTrace=ge}var Xt=S?S.displayName||S.name:"",At=Xt?ie(Xt):"";return typeof S=="function"&&re.set(S,At),At}function we(S,B,Z){return fe(S,!1)}function je(S){var B=S.prototype;return!!(B&&B.isReactComponent)}function Me(S,B,Z){if(S==null)return"";if(typeof S=="function")return fe(S,je(S));if(typeof S=="string")return ie(S);switch(S){case d:return ie("Suspense");case u:return ie("SuspenseList")}if(typeof S=="object")switch(S.$$typeof){case c:return we(S.render);case p:return Me(S.type,B,Z);case m:{var ne=S,ge=ne._payload,ve=ne._init;try{return Me(ve(ge),B,Z)}catch{}}}return""}var Ae=Object.prototype.hasOwnProperty,$r={},Rr=b.ReactDebugCurrentFrame;function mt(S){if(S){var B=S._owner,Z=Me(S.type,S._source,B?B.type:null);Rr.setExtraStackFrame(Z)}else Rr.setExtraStackFrame(null)}function
|
|
21
|
+
`+he[Ce].replace(" at new "," at ");return S.displayName&&qe.includes("<anonymous>")&&(qe=qe.replace("<anonymous>",S.displayName)),typeof S=="function"&&re.set(S,qe),qe}while(Ce>=1&&ke>=0);break}}}finally{te=!1,me.current=ve,se(),Error.prepareStackTrace=ge}var Xt=S?S.displayName||S.name:"",At=Xt?ie(Xt):"";return typeof S=="function"&&re.set(S,At),At}function we(S,B,Z){return fe(S,!1)}function je(S){var B=S.prototype;return!!(B&&B.isReactComponent)}function Me(S,B,Z){if(S==null)return"";if(typeof S=="function")return fe(S,je(S));if(typeof S=="string")return ie(S);switch(S){case d:return ie("Suspense");case u:return ie("SuspenseList")}if(typeof S=="object")switch(S.$$typeof){case c:return we(S.render);case p:return Me(S.type,B,Z);case m:{var ne=S,ge=ne._payload,ve=ne._init;try{return Me(ve(ge),B,Z)}catch{}}}return""}var Ae=Object.prototype.hasOwnProperty,$r={},Rr=b.ReactDebugCurrentFrame;function mt(S){if(S){var B=S._owner,Z=Me(S.type,S._source,B?B.type:null);Rr.setExtraStackFrame(Z)}else Rr.setExtraStackFrame(null)}function Au(S,B,Z,ne,ge){{var ve=Function.call.bind(Ae);for(var xe in S)if(ve(S,xe)){var he=void 0;try{if(typeof S[xe]!="function"){var Te=Error((ne||"React class")+": "+Z+" type `"+xe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof S[xe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Te.name="Invariant Violation",Te}he=S[xe](B,xe,ne,Z,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ce){he=Ce}he&&!(he instanceof Error)&&(mt(ge),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ne||"React class",Z,xe,typeof he),mt(null)),he instanceof Error&&!(he.message in $r)&&($r[he.message]=!0,mt(ge),j("Failed %s type: %s",Z,he.message),mt(null))}}}var Iu=Array.isArray;function Xa(S){return Iu(S)}function Lu(S){{var B=typeof Symbol=="function"&&Symbol.toStringTag,Z=B&&S[Symbol.toStringTag]||S.constructor.name||"Object";return Z}}function zu(S){try{return Hn(S),!1}catch{return!0}}function Hn(S){return""+S}function Wn(S){if(zu(S))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Lu(S)),Hn(S)}var qn=b.ReactCurrentOwner,Mu={key:!0,ref:!0,__self:!0,__source:!0},Zn,Xn;function Fu(S){if(Ae.call(S,"ref")){var B=Object.getOwnPropertyDescriptor(S,"ref").get;if(B&&B.isReactWarning)return!1}return S.ref!==void 0}function Vu(S){if(Ae.call(S,"key")){var B=Object.getOwnPropertyDescriptor(S,"key").get;if(B&&B.isReactWarning)return!1}return S.key!==void 0}function Bu(S,B){typeof S.ref=="string"&&qn.current}function Uu(S,B){{var Z=function(){Zn||(Zn=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",B))};Z.isReactWarning=!0,Object.defineProperty(S,"key",{get:Z,configurable:!0})}}function Hu(S,B){{var Z=function(){Xn||(Xn=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",B))};Z.isReactWarning=!0,Object.defineProperty(S,"ref",{get:Z,configurable:!0})}}var Wu=function(S,B,Z,ne,ge,ve,xe){var he={$$typeof:t,type:S,key:B,ref:Z,props:xe,_owner:ve};return he._store={},Object.defineProperty(he._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(he,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ne}),Object.defineProperty(he,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ge}),Object.freeze&&(Object.freeze(he.props),Object.freeze(he)),he};function qu(S,B,Z,ne,ge){{var ve,xe={},he=null,Te=null;Z!==void 0&&(Wn(Z),he=""+Z),Vu(B)&&(Wn(B.key),he=""+B.key),Fu(B)&&(Te=B.ref,Bu(B));for(ve in B)Ae.call(B,ve)&&!Mu.hasOwnProperty(ve)&&(xe[ve]=B[ve]);if(S&&S.defaultProps){var Ce=S.defaultProps;for(ve in Ce)xe[ve]===void 0&&(xe[ve]=Ce[ve])}if(he||Te){var ke=typeof S=="function"?S.displayName||S.name||"Unknown":S;he&&Uu(xe,ke),Te&&Hu(xe,ke)}return Wu(S,he,Te,ge,ne,qn.current,xe)}}var Ga=b.ReactCurrentOwner,Gn=b.ReactDebugCurrentFrame;function Zt(S){if(S){var B=S._owner,Z=Me(S.type,S._source,B?B.type:null);Gn.setExtraStackFrame(Z)}else Gn.setExtraStackFrame(null)}var Ya;Ya=!1;function Ka(S){return typeof S=="object"&&S!==null&&S.$$typeof===t}function Yn(){{if(Ga.current){var S=V(Ga.current.type);if(S)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+S+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+S+"`."}return""}}function Zu(S){return""}var Kn={};function Xu(S){{var B=Yn();if(!B){var Z=typeof S=="string"?S:S.displayName||S.name;Z&&(B=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+Z+">.")}return B}}function Jn(S,B){{if(!S._store||S._store.validated||S.key!=null)return;S._store.validated=!0;var Z=
|
|
25
|
+
Check the top-level render call using <`+Z+">.")}return B}}function Jn(S,B){{if(!S._store||S._store.validated||S.key!=null)return;S._store.validated=!0;var Z=Xu(B);if(Kn[Z])return;Kn[Z]=!0;var ne="";S&&S._owner&&S._owner!==Ga.current&&(ne=" It was passed a child from "+V(S._owner.type)+"."),Zt(S),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Z,ne),Zt(null)}}function Qn(S,B){{if(typeof S!="object")return;if(Xa(S))for(var Z=0;Z<S.length;Z++){var ne=S[Z];Ka(ne)&&Jn(ne,B)}else if(Ka(S))S._store&&(S._store.validated=!0);else if(S){var ge=v(S);if(typeof ge=="function"&&ge!==S.entries)for(var ve=ge.call(S),xe;!(xe=ve.next()).done;)Ka(xe.value)&&Jn(xe.value,B)}}}function Gu(S){{var B=S.type;if(B==null||typeof B=="string")return;var Z;if(typeof B=="function")Z=B.propTypes;else if(typeof B=="object"&&(B.$$typeof===c||B.$$typeof===p))Z=B.propTypes;else return;if(Z){var ne=V(B);Au(Z,S.props,"prop",ne,S)}else if(B.PropTypes!==void 0&&!Ya){Ya=!0;var ge=V(B);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ge||"Unknown")}typeof B.getDefaultProps=="function"&&!B.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Yu(S){{for(var B=Object.keys(S.props),Z=0;Z<B.length;Z++){var ne=B[Z];if(ne!=="children"&&ne!=="key"){Zt(S),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ne),Zt(null);break}}S.ref!==null&&(Zt(S),j("Invalid attribute `ref` supplied to `React.Fragment`."),Zt(null))}}var es={};function ts(S,B,Z,ne,ge,ve){{var xe=A(S);if(!xe){var he="";(S===void 0||typeof S=="object"&&S!==null&&Object.keys(S).length===0)&&(he+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Te=Zu();Te?he+=Te:he+=Yn();var Ce;S===null?Ce="null":Xa(S)?Ce="array":S!==void 0&&S.$$typeof===t?(Ce="<"+(V(S.type)||"Unknown")+" />",he=" Did you accidentally export a JSX literal instead of a component?"):Ce=typeof S,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ce,he)}var ke=qu(S,B,Z,ge,ve);if(ke==null)return ke;if(xe){var qe=B.children;if(qe!==void 0)if(ne)if(Xa(qe)){for(var Xt=0;Xt<qe.length;Xt++)Qn(qe[Xt],S);Object.freeze&&Object.freeze(qe)}else j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Qn(qe,S)}if(Ae.call(B,"key")){var At=V(S),Ie=Object.keys(B).filter(function(rp){return rp!=="key"}),Ja=Ie.length>0?"{key: someKey, "+Ie.join(": ..., ")+": ...}":"{key: someKey}";if(!es[At+Ja]){var tp=Ie.length>0?"{"+Ie.join(": ..., ")+": ...}":"{}";j(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,Ja,At,Ju,At),es[At+Ja]=!0}}return S===a?Zu(ke):qu(ke),ke}}function Xu(S,B,Z){return ts(S,B,Z,!0)}function Gu(S,B,Z){return ts(S,B,Z,!1)}var Yu=Gu,Ku=Xu;Or.Fragment=a,Or.jsx=Yu,Or.jsxs=Ku}()),Or}process.env.NODE_ENV==="production"?go.exports=bp():go.exports=yp();var Qa=go.exports;const vo=E.createContext(ua("moderno")),Ho=({config:e,children:t,renderWrapper:r=!0,className:a,style:n})=>{const s={"--t-primary":e.colors.primary,"--t-primary-hover":e.colors.primaryHover,"--t-accent":e.colors.accent,"--t-bg":e.colors.background,"--t-surface":e.colors.surface,"--t-text":e.colors.text,"--t-text-muted":e.colors.textMuted,"--t-border":e.colors.border,"--t-error":e.colors.error,...n};return r?Qa.jsx(vo.Provider,{value:e,children:Qa.jsx("div",{className:a,style:s,"data-template":"1",children:t})}):Qa.jsx(vo.Provider,{value:e,children:t})},Wo=()=>E.useContext(vo),pa=[{id:"preset_personal",name:"Dados Pessoais",description:"Nome, e-mail, CPF, telefone e data de nascimento",icon:"User",category:"personal",containerTemplate:{titulo:"Dados Pessoais",icone:"User",ordem:0,campos:[{id:"_personal_nome",nome:"nome",tipo:O.TEXTO,label:"Nome completo",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Seu nome completo"},{id:"_personal_email",nome:"email",tipo:O.EMAIL,label:"E-mail",ordem:1,tamanho:6,obrigatorio:!0,placeholder:"seuemail@exemplo.com"},{id:"_personal_telefone",nome:"telefone",tipo:O.TELEFONE,label:"Telefone / WhatsApp",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_personal_cpf",nome:"cpf",tipo:O.CPF,label:"CPF",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"},{id:"_personal_nascimento",nome:"data_nascimento",tipo:O.DATE,label:"Data de nascimento",ordem:4,tamanho:6,obrigatorio:!1}]}},{id:"preset_emergency_array",name:"Contatos de Emergência",description:"Lista de contatos (mín. 2, máx. 7) com Nome, Parentesco e Telefone",icon:"PhoneCall",category:"emergency",containerTemplate:{titulo:"Contatos de Emergência",icone:"PhoneCall",ordem:0,campos:[{id:"_emerg_array_contatos",nome:"contatos_emergencia",tipo:O.FIELD_ARRAY,label:"Contatos de Emergência",ordem:0,tamanho:12,obrigatorio:!0,itemLabel:"Contato",minItems:2,maxItems:7,addLabel:"Adicionar Contato",subFields:[{id:"_emerg_array_nome",nome:"nome",tipo:O.TEXTO,label:"Nome",ordem:0,tamanho:4,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_array_parentesco",nome:"parentesco",tipo:O.SELECT,label:"Parentesco",ordem:1,tamanho:4,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"conjuge",label:"Cônjuge"},{valor:"irmao",label:"Irmão/Irmã"},{valor:"avo",label:"Avô/Avó"},{valor:"tio",label:"Tio/Tia"},{valor:"amigo",label:"Amigo(a)"},{valor:"outro",label:"Outro"}]},{id:"_emerg_array_telefone",nome:"telefone",tipo:O.TELEFONE,label:"Celular",ordem:2,tamanho:4,obrigatorio:!0,placeholder:"(34) 99999-9999"}]}]}},{id:"preset_emergency",name:"Contatos de Emergência (Repetível)",description:"Lista repetível de contatos de emergência (mínimo 2)",icon:"PhoneCall",category:"emergency",containerTemplate:{titulo:"Contatos de Emergência",icone:"PhoneCall",ordem:0,nome:"contatos_emergencia",repeatable:!0,minItems:2,maxItems:5,itemLabel:"Contato",campos:[{id:"_emerg_nome",nome:"nome",tipo:O.TEXTO,label:"Nome",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_parentesco",nome:"parentesco",tipo:O.SELECT,label:"Parentesco",ordem:1,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"conjuge",label:"Cônjuge"},{valor:"irmao",label:"Irmão/Irmã"},{valor:"avo",label:"Avô/Avó"},{valor:"amigo",label:"Amigo(a)"},{valor:"outro",label:"Outro"}]},{id:"_emerg_telefone",nome:"telefone",tipo:O.TELEFONE,label:"Telefone",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"}]}},{id:"preset_address",name:"Endereço",description:"CEP com preenchimento automático via ViaCEP + campos de endereço",icon:"MapPin",category:"address",containerTemplate:{titulo:"Endereço",icone:"MapPin",ordem:0,campos:[{id:"_address_cep",nome:"_address_cep",tipo:O.CEP,label:"CEP",ordem:0,tamanho:4,obrigatorio:!1,placeholder:"00000-000",hint:"Preencha o CEP para auto-completar o endereço",locked:!0,cepFillMap:{logradouro:"_address_logradouro",bairro:"_address_bairro",cidade:"_address_cidade",estado:"_address_estado"}},{id:"_address_logradouro",nome:"_address_logradouro",tipo:O.TEXTO,label:"Logradouro",ordem:1,tamanho:8,obrigatorio:!1,placeholder:"Rua, Av., Travessa...",locked:!0},{id:"_address_numero",nome:"_address_numero",tipo:O.TEXTO,label:"Número",ordem:2,tamanho:3,obrigatorio:!1,placeholder:"Nº"},{id:"_address_complemento",nome:"_address_complemento",tipo:O.TEXTO,label:"Complemento",ordem:3,tamanho:9,obrigatorio:!1,placeholder:"Apto, bloco, casa..."},{id:"_address_bairro",nome:"_address_bairro",tipo:O.TEXTO,label:"Bairro",ordem:4,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_cidade",nome:"_address_cidade",tipo:O.TEXTO,label:"Cidade",ordem:5,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_estado",nome:"_address_estado",tipo:O.TEXTO,label:"Estado (UF)",ordem:6,tamanho:2,obrigatorio:!1,placeholder:"SP",locked:!0}]}},{id:"preset_responsible",name:"Responsável",description:"Dados do responsável legal (para menores ou dependentes)",icon:"Users",category:"personal",containerTemplate:{titulo:"Responsável",icone:"Users",ordem:0,campos:[{id:"_resp_nome",nome:"responsavel_nome",tipo:O.TEXTO,label:"Nome do responsável",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do responsável"},{id:"_resp_parentesco",nome:"responsavel_parentesco",tipo:O.SELECT,label:"Parentesco",ordem:1,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"avo",label:"Avô/Avó"},{valor:"outro",label:"Outro"}]},{id:"_resp_telefone",nome:"responsavel_telefone",tipo:O.TELEFONE,label:"Telefone do responsável",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_resp_cpf",nome:"responsavel_cpf",tipo:O.CPF,label:"CPF do responsável",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"}]}},{id:"preset_health",name:"Informações de Saúde",description:"Alergias, medicamentos, tipo sanguíneo e plano de saúde",icon:"HeartPulse",category:"health",containerTemplate:{titulo:"Informações de Saúde",icone:"HeartPulse",ordem:0,campos:[{id:"_health_tipo_sanguineo",nome:"tipo_sanguineo",tipo:O.SELECT,label:"Tipo sanguíneo",ordem:0,tamanho:4,obrigatorio:!1,opcoes:[{valor:"A+",label:"A+"},{valor:"A-",label:"A-"},{valor:"B+",label:"B+"},{valor:"B-",label:"B-"},{valor:"AB+",label:"AB+"},{valor:"AB-",label:"AB-"},{valor:"O+",label:"O+"},{valor:"O-",label:"O-"},{valor:"nao_sei",label:"Não sei"}]},{id:"_health_plano",nome:"plano_saude",tipo:O.TEXTO,label:"Plano de saúde",ordem:1,tamanho:8,obrigatorio:!1,placeholder:'Ex: Unimed... ou "Nenhum"'},{id:"_health_alergias",nome:"alergias",tipo:O.TEXTAREA,label:"Alergias",ordem:2,tamanho:12,obrigatorio:!1,placeholder:"Descreva alergias conhecidas"},{id:"_health_medicamentos",nome:"medicamentos",tipo:O.TEXTAREA,label:"Medicamentos em uso contínuo",ordem:3,tamanho:12,obrigatorio:!1,placeholder:"Nome, dosagem e frequência"},{id:"_health_obs",nome:"observacoes_medicas",tipo:O.TEXTAREA,label:"Outras observações médicas",ordem:4,tamanho:12,obrigatorio:!1}]}},{id:"preset_participation",name:"Participação",description:"Restrições alimentares, tamanho de camiseta e observações gerais",icon:"ClipboardList",category:"event",containerTemplate:{titulo:"Participação",icone:"ClipboardList",ordem:0,campos:[{id:"_part_restricao_alimentar",nome:"restricao_alimentar",tipo:O.SELECT,label:"Restrição alimentar",ordem:0,tamanho:6,obrigatorio:!1,opcoes:[{valor:"nenhuma",label:"Nenhuma"},{valor:"vegetariano",label:"Vegetariano"},{valor:"vegano",label:"Vegano"},{valor:"sem_gluten",label:"Sem glúten"},{valor:"sem_lactose",label:"Sem lactose"},{valor:"outro",label:"Outro"}]},{id:"_part_camiseta",nome:"tamanho_camiseta",tipo:O.SELECT,label:"Tamanho da camiseta",ordem:1,tamanho:6,obrigatorio:!1,opcoes:[{valor:"PP",label:"PP"},{valor:"P",label:"P"},{valor:"M",label:"M"},{valor:"G",label:"G"},{valor:"GG",label:"GG"},{valor:"XGG",label:"XGG"}]},{id:"_part_obs",nome:"observacoes_participacao",tipo:O.TEXTAREA,label:"Observações",ordem:2,tamanho:12,obrigatorio:!1}]}},{id:"preset_payment",name:"Informações de Pagamento",description:"Forma de pagamento e comprovante",icon:"CreditCard",category:"payment",containerTemplate:{titulo:"Pagamento",icone:"CreditCard",ordem:0,campos:[{id:"_pay_forma",nome:"forma_pagamento",tipo:O.SELECT,label:"Forma de pagamento",ordem:0,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pix",label:"PIX"},{valor:"cartao",label:"Cartão de crédito/débito"},{valor:"boleto",label:"Boleto bancário"},{valor:"dinheiro",label:"Dinheiro (presencial)"}]},{id:"_pay_comprovante",nome:"comprovante_pagamento",tipo:O.FILE,label:"Comprovante de pagamento",ordem:1,tamanho:6,obrigatorio:!1,hint:"Envie o comprovante caso já tenha efetuado o pagamento"}]}},{id:"preset_participation_type",name:"Tipo de Participação",description:"Seleção de todos os dias ou dia específico. Datas, preços e vagas carregados via externalData.",icon:"CalendarDays",category:"event",containerTemplate:{titulo:"Tipo de Participação",icone:"CalendarDays",descricao:"Escolha como você deseja participar do evento",ordem:0,campos:[{id:"_participation_type_field",nome:"tipo_participacao",tipo:O.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}}],wp=e=>pa.filter(t=>t.category===e),wi=e=>pa.find(t=>t.id===e),qo=[{id:"preset_steps_participation_payment",name:"Participação + Pagamento",description:"Dois steps: seleção do tipo de participação e escolha da forma de pagamento com cálculo automático de taxas.",icon:"Wallet",steps:[{titulo:"Tipo de Participação",descricao:"Escolha como deseja participar do evento",icone:"CalendarDays",containers:[{titulo:"Tipo de Participação",icone:"CalendarDays",descricao:"Escolha como você deseja participar do evento",ordem:0,campos:[{id:"_participation_type_field",nome:"tipo_participacao",tipo:O.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}]},{titulo:"Forma de Pagamento",descricao:"Escolha como deseja pagar sua inscrição",icone:"Wallet",containers:[{titulo:"Forma de Pagamento",icone:"Wallet",descricao:"Escolha como deseja pagar sua inscrição",ordem:0,campos:[{id:"_payment_method_field",nome:"forma_pagamento",tipo:O.PAYMENT_METHOD,label:"Forma de Pagamento",ordem:0,tamanho:12,obrigatorio:!0,locked:!0,relatedFieldName:"tipo_participacao"}]}]}]}],jp=e=>qo.find(t=>t.id===e);function de(e,t,r){function a(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const d=i.prototype,u=Object.keys(d);for(let p=0;p<u.length;p++){const m=u[p];m in l||(l[m]=d[m].bind(l))}}const n=(r==null?void 0:r.Parent)??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(l){var c;const d=r!=null&&r.Parent?new s:this;a(d,l),(c=d._zod).deferred??(c.deferred=[]);for(const u of d._zod.deferred)u();return d}return Object.defineProperty(i,"init",{value:a}),Object.defineProperty(i,Symbol.hasInstance,{value:l=>{var c,d;return r!=null&&r.Parent&&l instanceof r.Parent?!0:(d=(c=l==null?void 0:l._zod)==null?void 0:c.traits)==null?void 0:d.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class er extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class ji extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const Np={};function Mt(e){return Np}function bo(e,t){return typeof t=="bigint"?t.toString():t}function Zo(e){return e==null}function Xo(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const os=Symbol("evaluating");function be(e,t,r){let a;Object.defineProperty(e,t,{get(){if(a!==os)return a===void 0&&(a=os,a=r()),a},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Cp(...e){const t={};for(const r of e){const a=Object.getOwnPropertyDescriptors(r);Object.assign(t,a)}return Object.defineProperties({},t)}const Ni="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ns(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function yo(e){if(ns(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(ns(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Ci(e){return yo(e)?{...e}:Array.isArray(e)?[...e]:e}function Sp(e,t,r){const a=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(a._zod.parent=e),a}function Tt(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Qt(e,t=0){var r;if(e.aborted===!0)return!0;for(let a=t;a<e.issues.length;a++)if(((r=e.issues[a])==null?void 0:r.continue)!==!0)return!0;return!1}function kp(e,t){return t.map(r=>{var a;return(a=r).path??(a.path=[]),r.path.unshift(e),r})}function Dr(e){return typeof e=="string"?e:e==null?void 0:e.message}function Ft(e,t,r){var a,n,s,i,l,c;const d={...e,path:e.path??[]};if(!e.message){const u=Dr((s=(n=(a=e.inst)==null?void 0:a._zod.def)==null?void 0:n.error)==null?void 0:s.call(n,e))??Dr((i=t==null?void 0:t.error)==null?void 0:i.call(t,e))??Dr((l=r.customError)==null?void 0:l.call(r,e))??Dr((c=r.localeError)==null?void 0:c.call(r,e))??"Invalid input";d.message=u}return delete d.inst,delete d.continue,t!=null&&t.reportInput||delete d.input,d}function Go(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function yr(...e){const[t,r,a]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:a}:{...t}}const Si=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,bo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ki=de("$ZodError",Si),_i=de("$ZodError",Si,{Parent:Error});function _p(e,t=r=>r.message){const r={},a=[];for(const n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):a.push(t(n));return{formErrors:a,fieldErrors:r}}function Ep(e,t=r=>r.message){const r={_errors:[]},a=n=>{for(const s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>a({issues:i}));else if(s.code==="invalid_key")a({issues:s.issues});else if(s.code==="invalid_element")a({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let i=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],l++}}};return a(e),r}const Yo=e=>(t,r,a,n)=>{const s=a?Object.assign(a,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new er;if(i.issues.length){const l=new((n==null?void 0:n.Err)??e)(i.issues.map(c=>Ft(c,s,Mt())));throw Ni(l,n==null?void 0:n.callee),l}return i.value},Ko=e=>async(t,r,a,n)=>{const s=a?Object.assign(a,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const l=new((n==null?void 0:n.Err)??e)(i.issues.map(c=>Ft(c,s,Mt())));throw Ni(l,n==null?void 0:n.callee),l}return i.value},ma=e=>(t,r,a)=>{const n=a?{...a,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new er;return s.issues.length?{success:!1,error:new(e??ki)(s.issues.map(i=>Ft(i,n,Mt())))}:{success:!0,data:s.value}},Pp=ma(_i),fa=e=>async(t,r,a)=>{const n=a?Object.assign(a,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Ft(i,n,Mt())))}:{success:!0,data:s.value}},Tp=fa(_i),$p=e=>(t,r,a)=>{const n=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Yo(e)(t,r,n)},Rp=e=>(t,r,a)=>Yo(e)(t,r,a),Op=e=>async(t,r,a)=>{const n=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Ko(e)(t,r,n)},Dp=e=>async(t,r,a)=>Ko(e)(t,r,a),Ap=e=>(t,r,a)=>{const n=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return ma(e)(t,r,n)},Ip=e=>(t,r,a)=>ma(e)(t,r,a),Lp=e=>async(t,r,a)=>{const n=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return fa(e)(t,r,n)},zp=e=>async(t,r,a)=>fa(e)(t,r,a),dr=de("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Mp=de("$ZodCheckMaxLength",(e,t)=>{var r;dr.init(e,t),(r=e._zod.def).when??(r.when=a=>{const n=a.value;return!Zo(n)&&n.length!==void 0}),e._zod.onattach.push(a=>{const n=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const n=a.value;if(n.length<=t.maximum)return;const s=Go(n);a.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Fp=de("$ZodCheckMinLength",(e,t)=>{var r;dr.init(e,t),(r=e._zod.def).when??(r.when=a=>{const n=a.value;return!Zo(n)&&n.length!==void 0}),e._zod.onattach.push(a=>{const n=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const n=a.value;if(n.length>=t.minimum)return;const s=Go(n);a.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Vp=de("$ZodCheckLengthEquals",(e,t)=>{var r;dr.init(e,t),(r=e._zod.def).when??(r.when=a=>{const n=a.value;return!Zo(n)&&n.length!==void 0}),e._zod.onattach.push(a=>{const n=a._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=a=>{const n=a.value,s=n.length;if(s===t.length)return;const i=Go(n),l=s>t.length;a.issues.push({origin:i,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),Bp=de("$ZodCheckOverwrite",(e,t)=>{dr.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}}),Up={major:4,minor:3,patch:6},Oe=de("$ZodType",(e,t)=>{var r,a;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Up;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const s of n)for(const i of s._zod.onattach)i(e);if(n.length===0)(a=e._zod).deferred??(a.deferred=[]),(r=e._zod.deferred)==null||r.push(()=>{e._zod.run=e._zod.parse});else{const s=(l,c,d)=>{let u=Qt(l),p;for(const m of c){if(m._zod.def.when){if(!m._zod.def.when(l))continue}else if(u)continue;const h=l.issues.length,g=m._zod.check(l);if(g instanceof Promise&&(d==null?void 0:d.async)===!1)throw new er;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,l.issues.length!==h&&(u||(u=Qt(l,h)))});else{if(l.issues.length===h)continue;u||(u=Qt(l,h))}}return p?p.then(()=>l):l},i=(l,c,d)=>{if(Qt(l))return l.aborted=!0,l;const u=s(c,n,d);if(u instanceof Promise){if(d.async===!1)throw new er;return u.then(p=>e._zod.parse(p,d))}return e._zod.parse(u,d)};e._zod.run=(l,c)=>{if(c.skipChecks)return e._zod.parse(l,c);if(c.direction==="backward"){const u=e._zod.parse({value:l.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(p=>i(p,l,c)):i(u,l,c)}const d=e._zod.parse(l,c);if(d instanceof Promise){if(c.async===!1)throw new er;return d.then(u=>s(u,n,c))}return s(d,n,c)}}be(e,"~standard",()=>({validate:s=>{var i;try{const l=Pp(e,s);return l.success?{value:l.data}:{issues:(i=l.error)==null?void 0:i.issues}}catch{return Tp(e,s).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}))}),Hp=de("$ZodUnknown",(e,t)=>{Oe.init(e,t),e._zod.parse=r=>r});function ss(e,t,r){e.issues.length&&t.issues.push(...kp(r,e.issues)),t.value[r]=e.value}const Wp=de("$ZodArray",(e,t)=>{Oe.init(e,t),e._zod.parse=(r,a)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);const s=[];for(let i=0;i<n.length;i++){const l=n[i],c=t.element._zod.run({value:l,issues:[]},a);c instanceof Promise?s.push(c.then(d=>ss(d,r,i))):ss(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function is(e,t,r,a){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const n=e.filter(s=>!Qt(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Ft(i,a,Mt())))}),t)}const qp=de("$ZodUnion",(e,t)=>{Oe.init(e,t),be(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),be(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),be(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),be(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${n.map(s=>Xo(s.source)).join("|")})$`)}});const r=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(n,s)=>{if(r)return a(n,s);let i=!1;const l=[];for(const c of t.options){const d=c._zod.run({value:n.value,issues:[]},s);if(d instanceof Promise)l.push(d),i=!0;else{if(d.issues.length===0)return d;l.push(d)}}return i?Promise.all(l).then(c=>is(c,n,e,s)):is(l,n,e,s)}}),Zp=de("$ZodIntersection",(e,t)=>{Oe.init(e,t),e._zod.parse=(r,a)=>{const n=r.value,s=t.left._zod.run({value:n,issues:[]},a),i=t.right._zod.run({value:n,issues:[]},a);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([l,c])=>ls(r,l,c)):ls(r,s,i)}});function wo(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(yo(e)&&yo(t)){const r=Object.keys(t),a=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(const s of a){const i=wo(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let a=0;a<e.length;a++){const n=e[a],s=t[a],i=wo(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ls(e,t,r){const a=new Map;let n;for(const l of t.issues)if(l.code==="unrecognized_keys"){n??(n=l);for(const c of l.keys)a.has(c)||a.set(c,{}),a.get(c).l=!0}else e.issues.push(l);for(const l of r.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)a.has(c)||a.set(c,{}),a.get(c).r=!0;else e.issues.push(l);const s=[...a].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&n&&e.issues.push({...n,keys:s}),Qt(e))return e;const i=wo(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Xp=de("$ZodTransform",(e,t)=>{Oe.init(e,t),e._zod.parse=(r,a)=>{if(a.direction==="backward")throw new ji(e.constructor.name);const n=t.transform(r.value,r);if(a.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new er;return r.value=n,r}});function cs(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Ei=de("$ZodOptional",(e,t)=>{Oe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),be(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Xo(r.source)})?$`):void 0}),e._zod.parse=(r,a)=>{if(t.innerType._zod.optin==="optional"){const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(s=>cs(s,r.value)):cs(n,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,a)}}),Gp=de("$ZodExactOptional",(e,t)=>{Ei.init(e,t),be(e._zod,"values",()=>t.innerType._zod.values),be(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,a)=>t.innerType._zod.run(r,a)}),Yp=de("$ZodNullable",(e,t)=>{Oe.init(e,t),be(e._zod,"optin",()=>t.innerType._zod.optin),be(e._zod,"optout",()=>t.innerType._zod.optout),be(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Xo(r.source)}|null)$`):void 0}),be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,a)=>r.value===null?r:t.innerType._zod.run(r,a)}),Kp=de("$ZodDefault",(e,t)=>{Oe.init(e,t),e._zod.optin="optional",be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,a)=>{if(a.direction==="backward")return t.innerType._zod.run(r,a);if(r.value===void 0)return r.value=t.defaultValue,r;const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(s=>ds(s,t)):ds(n,t)}});function ds(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Jp=de("$ZodPrefault",(e,t)=>{Oe.init(e,t),e._zod.optin="optional",be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,a)=>(a.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,a))}),Qp=de("$ZodNonOptional",(e,t)=>{Oe.init(e,t),be(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(a=>a!==void 0)):void 0}),e._zod.parse=(r,a)=>{const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(s=>us(s,e)):us(n,e)}});function us(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const em=de("$ZodCatch",(e,t)=>{Oe.init(e,t),be(e._zod,"optin",()=>t.innerType._zod.optin),be(e._zod,"optout",()=>t.innerType._zod.optout),be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,a)=>{if(a.direction==="backward")return t.innerType._zod.run(r,a);const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Ft(i,a,Mt()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>Ft(s,a,Mt()))},input:r.value}),r.issues=[]),r)}}),tm=de("$ZodPipe",(e,t)=>{Oe.init(e,t),be(e._zod,"values",()=>t.in._zod.values),be(e._zod,"optin",()=>t.in._zod.optin),be(e._zod,"optout",()=>t.out._zod.optout),be(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,a)=>{if(a.direction==="backward"){const s=t.out._zod.run(r,a);return s instanceof Promise?s.then(i=>Ar(i,t.in,a)):Ar(s,t.in,a)}const n=t.in._zod.run(r,a);return n instanceof Promise?n.then(s=>Ar(s,t.out,a)):Ar(n,t.out,a)}});function Ar(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const rm=de("$ZodReadonly",(e,t)=>{Oe.init(e,t),be(e._zod,"propValues",()=>t.innerType._zod.propValues),be(e._zod,"values",()=>t.innerType._zod.values),be(e._zod,"optin",()=>{var r,a;return(a=(r=t.innerType)==null?void 0:r._zod)==null?void 0:a.optin}),be(e._zod,"optout",()=>{var r,a;return(a=(r=t.innerType)==null?void 0:r._zod)==null?void 0:a.optout}),e._zod.parse=(r,a)=>{if(a.direction==="backward")return t.innerType._zod.run(r,a);const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(ps):ps(n)}});function ps(e){return e.value=Object.freeze(e.value),e}const am=de("$ZodCustom",(e,t)=>{dr.init(e,t),Oe.init(e,t),e._zod.parse=(r,a)=>r,e._zod.check=r=>{const a=r.value,n=t.fn(a);if(n instanceof Promise)return n.then(s=>ms(s,r,a,e));ms(n,r,a,e)}});function ms(e,t,r,a){if(!e){const n={code:"custom",input:r,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(n.params=a._zod.def.params),t.issues.push(yr(n))}}var fs;let om=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const a=r[0];return this._map.set(t,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const a={...this.get(r)??{}};delete a.id;const n={...a,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function nm(){return new om}(fs=globalThis).__zod_globalRegistry??(fs.__zod_globalRegistry=nm());const vr=globalThis.__zod_globalRegistry;function sm(e){return new e({type:"unknown"})}function im(e,t){return new Mp({check:"max_length",...Tt(t),maximum:e})}function hs(e,t){return new Fp({check:"min_length",...Tt(t),minimum:e})}function lm(e,t){return new Vp({check:"length_equals",...Tt(t),length:e})}function cm(e){return new Bp({check:"overwrite",tx:e})}function dm(e,t,r){return new e({type:"array",element:t,...Tt(r)})}function um(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Tt(r)})}function pm(e){const t=mm(r=>(r.addIssue=a=>{if(typeof a=="string")r.issues.push(yr(a,r.value,t._zod.def));else{const n=a;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(yr(n))}},e(r.value,r)));return t}function mm(e,t){const r=new dr({check:"custom",...Tt(t)});return r._zod.check=e,r}function Pi(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??vr,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function Re(e,t,r={path:[],schemaPath:[]}){var a,n,s;const i=e._zod.def,l=t.seen.get(e);if(l)return l.count++,r.schemaPath.includes(e)&&(l.cycle=r.path),l.schema;const c={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,c);const d=(n=(a=e._zod).toJSONSchema)==null?void 0:n.call(a);if(d)c.schema=d;else{const p={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,p);else{const h=c.schema,g=t.processors[i.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);g(e,t,h,p)}const m=e._zod.parent;m&&(c.ref||(c.ref=m),Re(m,t,p),t.seen.get(m).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(c.schema,u),t.io==="input"&&$e(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((s=c.schema).default??(s.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function Ti(e,t){var r,a,n,s;const i=e.seen.get(t);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=new Map;for(const u of e.seen.entries()){const p=(r=e.metadataRegistry.get(u[0]))==null?void 0:r.id;if(p){const m=l.get(p);if(m&&m!==u[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);l.set(p,u[0])}}const c=u=>{var p;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const f=(p=e.external.registry.get(u[0]))==null?void 0:p.id,v=e.external.uri??(w=>w);if(f)return{ref:v(f)};const b=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=b,{defId:b,ref:`${v("__shared")}#/${m}/${b}`}}if(u[1]===i)return{ref:"#"};const h=`#/${m}/`,g=u[1].schema.id??`__schema${e.counter++}`;return{defId:g,ref:h+g}},d=u=>{if(u[1].schema.$ref)return;const p=u[1],{ref:m,defId:h}=c(u);p.def={...p.schema},h&&(p.defId=h);const g=p.schema;for(const f in g)delete g[f];g.$ref=m};if(e.cycles==="throw")for(const u of e.seen.entries()){const p=u[1];if(p.cycle)throw new Error(`Cycle detected: #/${(a=p.cycle)==null?void 0:a.join("/")}/<root>
|
|
30
|
+
<%s key={someKey} {...props} />`,Ja,At,tp,At),es[At+Ja]=!0}}return S===a?Yu(ke):Gu(ke),ke}}function Ku(S,B,Z){return ts(S,B,Z,!0)}function Ju(S,B,Z){return ts(S,B,Z,!1)}var Qu=Ju,ep=Ku;Or.Fragment=a,Or.jsx=Qu,Or.jsxs=ep}()),Or}process.env.NODE_ENV==="production"?go.exports=jp():go.exports=Np();var Qa=go.exports;const vo=E.createContext(ua("moderno")),Ho=({config:e,children:t,renderWrapper:r=!0,className:a,style:n})=>{const s={"--t-primary":e.colors.primary,"--t-primary-hover":e.colors.primaryHover,"--t-accent":e.colors.accent,"--t-bg":e.colors.background,"--t-surface":e.colors.surface,"--t-text":e.colors.text,"--t-text-muted":e.colors.textMuted,"--t-border":e.colors.border,"--t-error":e.colors.error,...n};return r?Qa.jsx(vo.Provider,{value:e,children:Qa.jsx("div",{className:a,style:s,"data-template":"1",children:t})}):Qa.jsx(vo.Provider,{value:e,children:t})},Wo=()=>E.useContext(vo),pa=[{id:"preset_personal",name:"Dados Pessoais",description:"Nome, e-mail, CPF, telefone e data de nascimento",icon:"User",category:"personal",containerTemplate:{titulo:"Dados Pessoais",icone:"User",ordem:0,campos:[{id:"_personal_nome",nome:"nome",tipo:O.TEXTO,label:"Nome completo",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Seu nome completo"},{id:"_personal_email",nome:"email",tipo:O.EMAIL,label:"E-mail",ordem:1,tamanho:6,obrigatorio:!0,placeholder:"seuemail@exemplo.com"},{id:"_personal_telefone",nome:"telefone",tipo:O.TELEFONE,label:"Telefone / WhatsApp",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_personal_cpf",nome:"cpf",tipo:O.CPF,label:"CPF",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"},{id:"_personal_nascimento",nome:"data_nascimento",tipo:O.DATE,label:"Data de nascimento",ordem:4,tamanho:6,obrigatorio:!1}]}},{id:"preset_emergency_array",name:"Contatos de Emergência",description:"Lista de contatos (mín. 2, máx. 7) com Nome, Parentesco e Telefone",icon:"PhoneCall",category:"emergency",containerTemplate:{titulo:"Contatos de Emergência",icone:"PhoneCall",ordem:0,campos:[{id:"_emerg_array_contatos",nome:"contatos_emergencia",tipo:O.FIELD_ARRAY,label:"Contatos de Emergência",ordem:0,tamanho:12,obrigatorio:!0,itemLabel:"Contato",minItems:2,maxItems:7,addLabel:"Adicionar Contato",subFields:[{id:"_emerg_array_nome",nome:"nome",tipo:O.TEXTO,label:"Nome",ordem:0,tamanho:4,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_array_parentesco",nome:"parentesco",tipo:O.SELECT,label:"Parentesco",ordem:1,tamanho:4,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"conjuge",label:"Cônjuge"},{valor:"irmao",label:"Irmão/Irmã"},{valor:"avo",label:"Avô/Avó"},{valor:"tio",label:"Tio/Tia"},{valor:"amigo",label:"Amigo(a)"},{valor:"outro",label:"Outro"}]},{id:"_emerg_array_telefone",nome:"telefone",tipo:O.TELEFONE,label:"Celular",ordem:2,tamanho:4,obrigatorio:!0,placeholder:"(34) 99999-9999"}]}]}},{id:"preset_emergency",name:"Contatos de Emergência (Repetível)",description:"Lista repetível de contatos de emergência (mínimo 2)",icon:"PhoneCall",category:"emergency",containerTemplate:{titulo:"Contatos de Emergência",icone:"PhoneCall",ordem:0,nome:"contatos_emergencia",repeatable:!0,minItems:2,maxItems:5,itemLabel:"Contato",campos:[{id:"_emerg_nome",nome:"nome",tipo:O.TEXTO,label:"Nome",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_parentesco",nome:"parentesco",tipo:O.SELECT,label:"Parentesco",ordem:1,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"conjuge",label:"Cônjuge"},{valor:"irmao",label:"Irmão/Irmã"},{valor:"avo",label:"Avô/Avó"},{valor:"amigo",label:"Amigo(a)"},{valor:"outro",label:"Outro"}]},{id:"_emerg_telefone",nome:"telefone",tipo:O.TELEFONE,label:"Telefone",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"}]}},{id:"preset_address",name:"Endereço",description:"CEP com preenchimento automático via ViaCEP + campos de endereço",icon:"MapPin",category:"address",containerTemplate:{titulo:"Endereço",icone:"MapPin",ordem:0,campos:[{id:"_address_cep",nome:"_address_cep",tipo:O.CEP,label:"CEP",ordem:0,tamanho:4,obrigatorio:!1,placeholder:"00000-000",hint:"Preencha o CEP para auto-completar o endereço",locked:!0,cepFillMap:{logradouro:"_address_logradouro",bairro:"_address_bairro",cidade:"_address_cidade",estado:"_address_estado"}},{id:"_address_logradouro",nome:"_address_logradouro",tipo:O.TEXTO,label:"Logradouro",ordem:1,tamanho:8,obrigatorio:!1,placeholder:"Rua, Av., Travessa...",locked:!0},{id:"_address_numero",nome:"_address_numero",tipo:O.TEXTO,label:"Número",ordem:2,tamanho:3,obrigatorio:!1,placeholder:"Nº"},{id:"_address_complemento",nome:"_address_complemento",tipo:O.TEXTO,label:"Complemento",ordem:3,tamanho:9,obrigatorio:!1,placeholder:"Apto, bloco, casa..."},{id:"_address_bairro",nome:"_address_bairro",tipo:O.TEXTO,label:"Bairro",ordem:4,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_cidade",nome:"_address_cidade",tipo:O.TEXTO,label:"Cidade",ordem:5,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_estado",nome:"_address_estado",tipo:O.TEXTO,label:"Estado (UF)",ordem:6,tamanho:2,obrigatorio:!1,placeholder:"SP",locked:!0}]}},{id:"preset_responsible",name:"Responsável",description:"Dados do responsável legal (para menores ou dependentes)",icon:"Users",category:"personal",containerTemplate:{titulo:"Responsável",icone:"Users",ordem:0,campos:[{id:"_resp_nome",nome:"responsavel_nome",tipo:O.TEXTO,label:"Nome do responsável",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do responsável"},{id:"_resp_parentesco",nome:"responsavel_parentesco",tipo:O.SELECT,label:"Parentesco",ordem:1,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"avo",label:"Avô/Avó"},{valor:"outro",label:"Outro"}]},{id:"_resp_telefone",nome:"responsavel_telefone",tipo:O.TELEFONE,label:"Telefone do responsável",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_resp_cpf",nome:"responsavel_cpf",tipo:O.CPF,label:"CPF do responsável",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"}]}},{id:"preset_health",name:"Informações de Saúde",description:"Alergias, medicamentos, tipo sanguíneo e plano de saúde",icon:"HeartPulse",category:"health",containerTemplate:{titulo:"Informações de Saúde",icone:"HeartPulse",ordem:0,campos:[{id:"_health_tipo_sanguineo",nome:"tipo_sanguineo",tipo:O.SELECT,label:"Tipo sanguíneo",ordem:0,tamanho:4,obrigatorio:!1,opcoes:[{valor:"A+",label:"A+"},{valor:"A-",label:"A-"},{valor:"B+",label:"B+"},{valor:"B-",label:"B-"},{valor:"AB+",label:"AB+"},{valor:"AB-",label:"AB-"},{valor:"O+",label:"O+"},{valor:"O-",label:"O-"},{valor:"nao_sei",label:"Não sei"}]},{id:"_health_plano",nome:"plano_saude",tipo:O.TEXTO,label:"Plano de saúde",ordem:1,tamanho:8,obrigatorio:!1,placeholder:'Ex: Unimed... ou "Nenhum"'},{id:"_health_alergias",nome:"alergias",tipo:O.TEXTAREA,label:"Alergias",ordem:2,tamanho:12,obrigatorio:!1,placeholder:"Descreva alergias conhecidas"},{id:"_health_medicamentos",nome:"medicamentos",tipo:O.TEXTAREA,label:"Medicamentos em uso contínuo",ordem:3,tamanho:12,obrigatorio:!1,placeholder:"Nome, dosagem e frequência"},{id:"_health_obs",nome:"observacoes_medicas",tipo:O.TEXTAREA,label:"Outras observações médicas",ordem:4,tamanho:12,obrigatorio:!1}]}},{id:"preset_participation",name:"Participação",description:"Restrições alimentares, tamanho de camiseta e observações gerais",icon:"ClipboardList",category:"event",containerTemplate:{titulo:"Participação",icone:"ClipboardList",ordem:0,campos:[{id:"_part_restricao_alimentar",nome:"restricao_alimentar",tipo:O.SELECT,label:"Restrição alimentar",ordem:0,tamanho:6,obrigatorio:!1,opcoes:[{valor:"nenhuma",label:"Nenhuma"},{valor:"vegetariano",label:"Vegetariano"},{valor:"vegano",label:"Vegano"},{valor:"sem_gluten",label:"Sem glúten"},{valor:"sem_lactose",label:"Sem lactose"},{valor:"outro",label:"Outro"}]},{id:"_part_camiseta",nome:"tamanho_camiseta",tipo:O.SELECT,label:"Tamanho da camiseta",ordem:1,tamanho:6,obrigatorio:!1,opcoes:[{valor:"PP",label:"PP"},{valor:"P",label:"P"},{valor:"M",label:"M"},{valor:"G",label:"G"},{valor:"GG",label:"GG"},{valor:"XGG",label:"XGG"}]},{id:"_part_obs",nome:"observacoes_participacao",tipo:O.TEXTAREA,label:"Observações",ordem:2,tamanho:12,obrigatorio:!1}]}},{id:"preset_payment",name:"Informações de Pagamento",description:"Forma de pagamento e comprovante",icon:"CreditCard",category:"payment",containerTemplate:{titulo:"Pagamento",icone:"CreditCard",ordem:0,campos:[{id:"_pay_forma",nome:"forma_pagamento",tipo:O.SELECT,label:"Forma de pagamento",ordem:0,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pix",label:"PIX"},{valor:"cartao",label:"Cartão de crédito/débito"},{valor:"boleto",label:"Boleto bancário"},{valor:"dinheiro",label:"Dinheiro (presencial)"}]},{id:"_pay_comprovante",nome:"comprovante_pagamento",tipo:O.FILE,label:"Comprovante de pagamento",ordem:1,tamanho:6,obrigatorio:!1,hint:"Envie o comprovante caso já tenha efetuado o pagamento"}]}},{id:"preset_participation_type",name:"Tipo de Participação",description:"Seleção de todos os dias ou dia específico. Datas, preços e vagas carregados via externalData.",icon:"CalendarDays",category:"event",containerTemplate:{titulo:"Tipo de Participação",icone:"CalendarDays",descricao:"Escolha como você deseja participar do evento",ordem:0,campos:[{id:"_participation_type_field",nome:"tipo_participacao",tipo:O.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}}],Cp=e=>pa.filter(t=>t.category===e),ji=e=>pa.find(t=>t.id===e),qo=[{id:"preset_steps_participation_payment",name:"Participação + Pagamento",description:"Dois steps: seleção do tipo de participação e escolha da forma de pagamento com cálculo automático de taxas.",icon:"Wallet",steps:[{titulo:"Tipo de Participação",descricao:"Escolha como deseja participar do evento",icone:"CalendarDays",containers:[{titulo:"Tipo de Participação",icone:"CalendarDays",descricao:"Escolha como você deseja participar do evento",ordem:0,campos:[{id:"_participation_type_field",nome:"tipo_participacao",tipo:O.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}]},{titulo:"Forma de Pagamento",descricao:"Escolha como deseja pagar sua inscrição",icone:"Wallet",containers:[{titulo:"Forma de Pagamento",icone:"Wallet",descricao:"Escolha como deseja pagar sua inscrição",ordem:0,campos:[{id:"_payment_method_field",nome:"forma_pagamento",tipo:O.PAYMENT_METHOD,label:"Forma de Pagamento",ordem:0,tamanho:12,obrigatorio:!0,locked:!0,relatedFieldName:"tipo_participacao"}]}]}]}],Sp=e=>qo.find(t=>t.id===e);function de(e,t,r){function a(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const d=i.prototype,u=Object.keys(d);for(let p=0;p<u.length;p++){const m=u[p];m in l||(l[m]=d[m].bind(l))}}const n=(r==null?void 0:r.Parent)??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(l){var c;const d=r!=null&&r.Parent?new s:this;a(d,l),(c=d._zod).deferred??(c.deferred=[]);for(const u of d._zod.deferred)u();return d}return Object.defineProperty(i,"init",{value:a}),Object.defineProperty(i,Symbol.hasInstance,{value:l=>{var c,d;return r!=null&&r.Parent&&l instanceof r.Parent?!0:(d=(c=l==null?void 0:l._zod)==null?void 0:c.traits)==null?void 0:d.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class er extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ni extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const kp={};function Mt(e){return kp}function bo(e,t){return typeof t=="bigint"?t.toString():t}function Zo(e){return e==null}function Xo(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const os=Symbol("evaluating");function be(e,t,r){let a;Object.defineProperty(e,t,{get(){if(a!==os)return a===void 0&&(a=os,a=r()),a},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function _p(...e){const t={};for(const r of e){const a=Object.getOwnPropertyDescriptors(r);Object.assign(t,a)}return Object.defineProperties({},t)}const Ci="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ns(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function yo(e){if(ns(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(ns(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Si(e){return yo(e)?{...e}:Array.isArray(e)?[...e]:e}function Ep(e,t,r){const a=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(a._zod.parent=e),a}function Tt(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Qt(e,t=0){var r;if(e.aborted===!0)return!0;for(let a=t;a<e.issues.length;a++)if(((r=e.issues[a])==null?void 0:r.continue)!==!0)return!0;return!1}function Pp(e,t){return t.map(r=>{var a;return(a=r).path??(a.path=[]),r.path.unshift(e),r})}function Dr(e){return typeof e=="string"?e:e==null?void 0:e.message}function Ft(e,t,r){var a,n,s,i,l,c;const d={...e,path:e.path??[]};if(!e.message){const u=Dr((s=(n=(a=e.inst)==null?void 0:a._zod.def)==null?void 0:n.error)==null?void 0:s.call(n,e))??Dr((i=t==null?void 0:t.error)==null?void 0:i.call(t,e))??Dr((l=r.customError)==null?void 0:l.call(r,e))??Dr((c=r.localeError)==null?void 0:c.call(r,e))??"Invalid input";d.message=u}return delete d.inst,delete d.continue,t!=null&&t.reportInput||delete d.input,d}function Go(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function yr(...e){const[t,r,a]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:a}:{...t}}const ki=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,bo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},_i=de("$ZodError",ki),Ei=de("$ZodError",ki,{Parent:Error});function Tp(e,t=r=>r.message){const r={},a=[];for(const n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):a.push(t(n));return{formErrors:a,fieldErrors:r}}function $p(e,t=r=>r.message){const r={_errors:[]},a=n=>{for(const s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>a({issues:i}));else if(s.code==="invalid_key")a({issues:s.issues});else if(s.code==="invalid_element")a({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let i=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],l++}}};return a(e),r}const Yo=e=>(t,r,a,n)=>{const s=a?Object.assign(a,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new er;if(i.issues.length){const l=new((n==null?void 0:n.Err)??e)(i.issues.map(c=>Ft(c,s,Mt())));throw Ci(l,n==null?void 0:n.callee),l}return i.value},Ko=e=>async(t,r,a,n)=>{const s=a?Object.assign(a,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const l=new((n==null?void 0:n.Err)??e)(i.issues.map(c=>Ft(c,s,Mt())));throw Ci(l,n==null?void 0:n.callee),l}return i.value},ma=e=>(t,r,a)=>{const n=a?{...a,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new er;return s.issues.length?{success:!1,error:new(e??_i)(s.issues.map(i=>Ft(i,n,Mt())))}:{success:!0,data:s.value}},Rp=ma(Ei),fa=e=>async(t,r,a)=>{const n=a?Object.assign(a,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Ft(i,n,Mt())))}:{success:!0,data:s.value}},Op=fa(Ei),Dp=e=>(t,r,a)=>{const n=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Yo(e)(t,r,n)},Ap=e=>(t,r,a)=>Yo(e)(t,r,a),Ip=e=>async(t,r,a)=>{const n=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Ko(e)(t,r,n)},Lp=e=>async(t,r,a)=>Ko(e)(t,r,a),zp=e=>(t,r,a)=>{const n=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return ma(e)(t,r,n)},Mp=e=>(t,r,a)=>ma(e)(t,r,a),Fp=e=>async(t,r,a)=>{const n=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return fa(e)(t,r,n)},Vp=e=>async(t,r,a)=>fa(e)(t,r,a),dr=de("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Bp=de("$ZodCheckMaxLength",(e,t)=>{var r;dr.init(e,t),(r=e._zod.def).when??(r.when=a=>{const n=a.value;return!Zo(n)&&n.length!==void 0}),e._zod.onattach.push(a=>{const n=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const n=a.value;if(n.length<=t.maximum)return;const s=Go(n);a.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Up=de("$ZodCheckMinLength",(e,t)=>{var r;dr.init(e,t),(r=e._zod.def).when??(r.when=a=>{const n=a.value;return!Zo(n)&&n.length!==void 0}),e._zod.onattach.push(a=>{const n=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const n=a.value;if(n.length>=t.minimum)return;const s=Go(n);a.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Hp=de("$ZodCheckLengthEquals",(e,t)=>{var r;dr.init(e,t),(r=e._zod.def).when??(r.when=a=>{const n=a.value;return!Zo(n)&&n.length!==void 0}),e._zod.onattach.push(a=>{const n=a._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=a=>{const n=a.value,s=n.length;if(s===t.length)return;const i=Go(n),l=s>t.length;a.issues.push({origin:i,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),Wp=de("$ZodCheckOverwrite",(e,t)=>{dr.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}}),qp={major:4,minor:3,patch:6},Oe=de("$ZodType",(e,t)=>{var r,a;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qp;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const s of n)for(const i of s._zod.onattach)i(e);if(n.length===0)(a=e._zod).deferred??(a.deferred=[]),(r=e._zod.deferred)==null||r.push(()=>{e._zod.run=e._zod.parse});else{const s=(l,c,d)=>{let u=Qt(l),p;for(const m of c){if(m._zod.def.when){if(!m._zod.def.when(l))continue}else if(u)continue;const x=l.issues.length,g=m._zod.check(l);if(g instanceof Promise&&(d==null?void 0:d.async)===!1)throw new er;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,l.issues.length!==x&&(u||(u=Qt(l,x)))});else{if(l.issues.length===x)continue;u||(u=Qt(l,x))}}return p?p.then(()=>l):l},i=(l,c,d)=>{if(Qt(l))return l.aborted=!0,l;const u=s(c,n,d);if(u instanceof Promise){if(d.async===!1)throw new er;return u.then(p=>e._zod.parse(p,d))}return e._zod.parse(u,d)};e._zod.run=(l,c)=>{if(c.skipChecks)return e._zod.parse(l,c);if(c.direction==="backward"){const u=e._zod.parse({value:l.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(p=>i(p,l,c)):i(u,l,c)}const d=e._zod.parse(l,c);if(d instanceof Promise){if(c.async===!1)throw new er;return d.then(u=>s(u,n,c))}return s(d,n,c)}}be(e,"~standard",()=>({validate:s=>{var i;try{const l=Rp(e,s);return l.success?{value:l.data}:{issues:(i=l.error)==null?void 0:i.issues}}catch{return Op(e,s).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}))}),Zp=de("$ZodUnknown",(e,t)=>{Oe.init(e,t),e._zod.parse=r=>r});function ss(e,t,r){e.issues.length&&t.issues.push(...Pp(r,e.issues)),t.value[r]=e.value}const Xp=de("$ZodArray",(e,t)=>{Oe.init(e,t),e._zod.parse=(r,a)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);const s=[];for(let i=0;i<n.length;i++){const l=n[i],c=t.element._zod.run({value:l,issues:[]},a);c instanceof Promise?s.push(c.then(d=>ss(d,r,i))):ss(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function is(e,t,r,a){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const n=e.filter(s=>!Qt(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Ft(i,a,Mt())))}),t)}const Gp=de("$ZodUnion",(e,t)=>{Oe.init(e,t),be(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),be(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),be(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),be(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${n.map(s=>Xo(s.source)).join("|")})$`)}});const r=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(n,s)=>{if(r)return a(n,s);let i=!1;const l=[];for(const c of t.options){const d=c._zod.run({value:n.value,issues:[]},s);if(d instanceof Promise)l.push(d),i=!0;else{if(d.issues.length===0)return d;l.push(d)}}return i?Promise.all(l).then(c=>is(c,n,e,s)):is(l,n,e,s)}}),Yp=de("$ZodIntersection",(e,t)=>{Oe.init(e,t),e._zod.parse=(r,a)=>{const n=r.value,s=t.left._zod.run({value:n,issues:[]},a),i=t.right._zod.run({value:n,issues:[]},a);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([l,c])=>ls(r,l,c)):ls(r,s,i)}});function wo(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(yo(e)&&yo(t)){const r=Object.keys(t),a=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(const s of a){const i=wo(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let a=0;a<e.length;a++){const n=e[a],s=t[a],i=wo(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ls(e,t,r){const a=new Map;let n;for(const l of t.issues)if(l.code==="unrecognized_keys"){n??(n=l);for(const c of l.keys)a.has(c)||a.set(c,{}),a.get(c).l=!0}else e.issues.push(l);for(const l of r.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)a.has(c)||a.set(c,{}),a.get(c).r=!0;else e.issues.push(l);const s=[...a].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&n&&e.issues.push({...n,keys:s}),Qt(e))return e;const i=wo(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Kp=de("$ZodTransform",(e,t)=>{Oe.init(e,t),e._zod.parse=(r,a)=>{if(a.direction==="backward")throw new Ni(e.constructor.name);const n=t.transform(r.value,r);if(a.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new er;return r.value=n,r}});function cs(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Pi=de("$ZodOptional",(e,t)=>{Oe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),be(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Xo(r.source)})?$`):void 0}),e._zod.parse=(r,a)=>{if(t.innerType._zod.optin==="optional"){const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(s=>cs(s,r.value)):cs(n,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,a)}}),Jp=de("$ZodExactOptional",(e,t)=>{Pi.init(e,t),be(e._zod,"values",()=>t.innerType._zod.values),be(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,a)=>t.innerType._zod.run(r,a)}),Qp=de("$ZodNullable",(e,t)=>{Oe.init(e,t),be(e._zod,"optin",()=>t.innerType._zod.optin),be(e._zod,"optout",()=>t.innerType._zod.optout),be(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Xo(r.source)}|null)$`):void 0}),be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,a)=>r.value===null?r:t.innerType._zod.run(r,a)}),em=de("$ZodDefault",(e,t)=>{Oe.init(e,t),e._zod.optin="optional",be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,a)=>{if(a.direction==="backward")return t.innerType._zod.run(r,a);if(r.value===void 0)return r.value=t.defaultValue,r;const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(s=>ds(s,t)):ds(n,t)}});function ds(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const tm=de("$ZodPrefault",(e,t)=>{Oe.init(e,t),e._zod.optin="optional",be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,a)=>(a.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,a))}),rm=de("$ZodNonOptional",(e,t)=>{Oe.init(e,t),be(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(a=>a!==void 0)):void 0}),e._zod.parse=(r,a)=>{const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(s=>us(s,e)):us(n,e)}});function us(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const am=de("$ZodCatch",(e,t)=>{Oe.init(e,t),be(e._zod,"optin",()=>t.innerType._zod.optin),be(e._zod,"optout",()=>t.innerType._zod.optout),be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,a)=>{if(a.direction==="backward")return t.innerType._zod.run(r,a);const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Ft(i,a,Mt()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>Ft(s,a,Mt()))},input:r.value}),r.issues=[]),r)}}),om=de("$ZodPipe",(e,t)=>{Oe.init(e,t),be(e._zod,"values",()=>t.in._zod.values),be(e._zod,"optin",()=>t.in._zod.optin),be(e._zod,"optout",()=>t.out._zod.optout),be(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,a)=>{if(a.direction==="backward"){const s=t.out._zod.run(r,a);return s instanceof Promise?s.then(i=>Ar(i,t.in,a)):Ar(s,t.in,a)}const n=t.in._zod.run(r,a);return n instanceof Promise?n.then(s=>Ar(s,t.out,a)):Ar(n,t.out,a)}});function Ar(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const nm=de("$ZodReadonly",(e,t)=>{Oe.init(e,t),be(e._zod,"propValues",()=>t.innerType._zod.propValues),be(e._zod,"values",()=>t.innerType._zod.values),be(e._zod,"optin",()=>{var r,a;return(a=(r=t.innerType)==null?void 0:r._zod)==null?void 0:a.optin}),be(e._zod,"optout",()=>{var r,a;return(a=(r=t.innerType)==null?void 0:r._zod)==null?void 0:a.optout}),e._zod.parse=(r,a)=>{if(a.direction==="backward")return t.innerType._zod.run(r,a);const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(ps):ps(n)}});function ps(e){return e.value=Object.freeze(e.value),e}const sm=de("$ZodCustom",(e,t)=>{dr.init(e,t),Oe.init(e,t),e._zod.parse=(r,a)=>r,e._zod.check=r=>{const a=r.value,n=t.fn(a);if(n instanceof Promise)return n.then(s=>ms(s,r,a,e));ms(n,r,a,e)}});function ms(e,t,r,a){if(!e){const n={code:"custom",input:r,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(n.params=a._zod.def.params),t.issues.push(yr(n))}}var fs;class im{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const a=r[0];return this._map.set(t,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const a={...this.get(r)??{}};delete a.id;const n={...a,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function lm(){return new im}(fs=globalThis).__zod_globalRegistry??(fs.__zod_globalRegistry=lm());const vr=globalThis.__zod_globalRegistry;function cm(e){return new e({type:"unknown"})}function dm(e,t){return new Bp({check:"max_length",...Tt(t),maximum:e})}function hs(e,t){return new Up({check:"min_length",...Tt(t),minimum:e})}function um(e,t){return new Hp({check:"length_equals",...Tt(t),length:e})}function pm(e){return new Wp({check:"overwrite",tx:e})}function mm(e,t,r){return new e({type:"array",element:t,...Tt(r)})}function fm(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Tt(r)})}function hm(e){const t=xm(r=>(r.addIssue=a=>{if(typeof a=="string")r.issues.push(yr(a,r.value,t._zod.def));else{const n=a;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(yr(n))}},e(r.value,r)));return t}function xm(e,t){const r=new dr({check:"custom",...Tt(t)});return r._zod.check=e,r}function Ti(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??vr,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function Re(e,t,r={path:[],schemaPath:[]}){var a,n,s;const i=e._zod.def,l=t.seen.get(e);if(l)return l.count++,r.schemaPath.includes(e)&&(l.cycle=r.path),l.schema;const c={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,c);const d=(n=(a=e._zod).toJSONSchema)==null?void 0:n.call(a);if(d)c.schema=d;else{const p={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,p);else{const x=c.schema,g=t.processors[i.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);g(e,t,x,p)}const m=e._zod.parent;m&&(c.ref||(c.ref=m),Re(m,t,p),t.seen.get(m).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(c.schema,u),t.io==="input"&&$e(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((s=c.schema).default??(s.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function $i(e,t){var r,a,n,s;const i=e.seen.get(t);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=new Map;for(const u of e.seen.entries()){const p=(r=e.metadataRegistry.get(u[0]))==null?void 0:r.id;if(p){const m=l.get(p);if(m&&m!==u[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);l.set(p,u[0])}}const c=u=>{var p;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const f=(p=e.external.registry.get(u[0]))==null?void 0:p.id,v=e.external.uri??(j=>j);if(f)return{ref:v(f)};const b=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=b,{defId:b,ref:`${v("__shared")}#/${m}/${b}`}}if(u[1]===i)return{ref:"#"};const x=`#/${m}/`,g=u[1].schema.id??`__schema${e.counter++}`;return{defId:g,ref:x+g}},d=u=>{if(u[1].schema.$ref)return;const p=u[1],{ref:m,defId:x}=c(u);p.def={...p.schema},x&&(p.defId=x);const g=p.schema;for(const f in g)delete g[f];g.$ref=m};if(e.cycles==="throw")for(const u of e.seen.entries()){const p=u[1];if(p.cycle)throw new Error(`Cycle detected: #/${(a=p.cycle)==null?void 0:a.join("/")}/<root>
|
|
31
31
|
|
|
32
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const p=u[1];if(t===u[0]){d(u);continue}if(e.external){const m=(n=e.external.registry.get(u[0]))==null?void 0:n.id;if(t!==u[0]&&m){d(u);continue}}if((s=e.metadataRegistry.get(u[0]))!=null&&s.id){d(u);continue}if(p.cycle){d(u);continue}if(p.count>1&&e.reused==="ref"){d(u);continue}}}function $i(e,t){var r,a,n;const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=d=>{const u=e.seen.get(d);if(u.ref===null)return;const p=u.def??u.schema,m={...p},h=u.ref;if(u.ref=null,h){i(h);const f=e.seen.get(h),v=f.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(v)):Object.assign(p,v),Object.assign(p,m),d._zod.parent===h)for(const b in p)b==="$ref"||b==="allOf"||b in m||delete p[b];if(v.$ref&&f.def)for(const b in p)b==="$ref"||b==="allOf"||b in f.def&&JSON.stringify(p[b])===JSON.stringify(f.def[b])&&delete p[b]}const g=d._zod.parent;if(g&&g!==h){i(g);const f=e.seen.get(g);if(f!=null&&f.schema.$ref&&(p.$ref=f.schema.$ref,f.def))for(const v in p)v==="$ref"||v==="allOf"||v in f.def&&JSON.stringify(p[v])===JSON.stringify(f.def[v])&&delete p[v]}e.override({zodSchema:d,jsonSchema:p,path:u.path??[]})};for(const d of[...e.seen.entries()].reverse())i(d[0]);const l={};if(e.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?l.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?l.$schema="http://json-schema.org/draft-04/schema#":e.target,(r=e.external)!=null&&r.uri){const d=(a=e.external.registry.get(t))==null?void 0:a.id;if(!d)throw new Error("Schema is missing an `id` property");l.$id=e.external.uri(d)}Object.assign(l,s.def??s.schema);const c=((n=e.external)==null?void 0:n.defs)??{};for(const d of e.seen.entries()){const u=d[1];u.def&&u.defId&&(c[u.defId]=u.def)}e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?l.$defs=c:l.definitions=c);try{const d=JSON.parse(JSON.stringify(l));return Object.defineProperty(d,"~standard",{value:{...t["~standard"],jsonSchema:{input:Yr(t,"input",e.processors),output:Yr(t,"output",e.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function $e(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return $e(a.element,r);if(a.type==="set")return $e(a.valueType,r);if(a.type==="lazy")return $e(a.getter(),r);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return $e(a.innerType,r);if(a.type==="intersection")return $e(a.left,r)||$e(a.right,r);if(a.type==="record"||a.type==="map")return $e(a.keyType,r)||$e(a.valueType,r);if(a.type==="pipe")return $e(a.in,r)||$e(a.out,r);if(a.type==="object"){for(const n in a.shape)if($e(a.shape[n],r))return!0;return!1}if(a.type==="union"){for(const n of a.options)if($e(n,r))return!0;return!1}if(a.type==="tuple"){for(const n of a.items)if($e(n,r))return!0;return!!(a.rest&&$e(a.rest,r))}return!1}const fm=(e,t={})=>r=>{const a=Pi({...r,processors:t});return Re(e,a),Ti(a,e),$i(a,e)},Yr=(e,t,r={})=>a=>{const{libraryOptions:n,target:s}=a??{},i=Pi({...n??{},target:s,io:t,processors:r});return Re(e,i),Ti(i,e),$i(i,e)},hm=(e,t,r,a)=>{},xm=(e,t,r,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},gm=(e,t,r,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},vm=(e,t,r,a)=>{const n=r,s=e._zod.def,{minimum:i,maximum:l}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof l=="number"&&(n.maxItems=l),n.type="array",n.items=Re(s.element,t,{...a,path:[...a.path,"items"]})},bm=(e,t,r,a)=>{const n=e._zod.def,s=n.inclusive===!1,i=n.options.map((l,c)=>Re(l,t,{...a,path:[...a.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},ym=(e,t,r,a)=>{const n=e._zod.def,s=Re(n.left,t,{...a,path:[...a.path,"allOf",0]}),i=Re(n.right,t,{...a,path:[...a.path,"allOf",1]}),l=d=>"allOf"in d&&Object.keys(d).length===1,c=[...l(s)?s.allOf:[s],...l(i)?i.allOf:[i]];r.allOf=c},wm=(e,t,r,a)=>{const n=e._zod.def,s=Re(n.innerType,t,a),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},jm=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType},Nm=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},Cm=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Sm=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},km=(e,t,r,a)=>{const n=e._zod.def,s=t.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;Re(s,t,a);const i=t.seen.get(e);i.ref=s},_m=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0},Ri=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType},Em=(e,t)=>{ki.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ep(e,r)},flatten:{value:r=>_p(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,bo,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,bo,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ke=de("ZodError",Em,{Parent:Error}),Pm=Yo(Ke),Tm=Ko(Ke),$m=ma(Ke),Rm=fa(Ke),Om=$p(Ke),Dm=Rp(Ke),Am=Op(Ke),Im=Dp(Ke),Lm=Ap(Ke),zm=Ip(Ke),Mm=Lp(Ke),Fm=zp(Ke),De=de("ZodType",(e,t)=>(Oe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Yr(e,"input"),output:Yr(e,"output")}}),e.toJSONSchema=fm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(Cp(t,{checks:[...t.checks??[],...r.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(r,a)=>Sp(e,r,a),e.brand=()=>e,e.register=(r,a)=>(r.add(e,a),e),e.parse=(r,a)=>Pm(e,r,a,{callee:e.parse}),e.safeParse=(r,a)=>$m(e,r,a),e.parseAsync=async(r,a)=>Tm(e,r,a,{callee:e.parseAsync}),e.safeParseAsync=async(r,a)=>Rm(e,r,a),e.spa=e.safeParseAsync,e.encode=(r,a)=>Om(e,r,a),e.decode=(r,a)=>Dm(e,r,a),e.encodeAsync=async(r,a)=>Am(e,r,a),e.decodeAsync=async(r,a)=>Im(e,r,a),e.safeEncode=(r,a)=>Lm(e,r,a),e.safeDecode=(r,a)=>zm(e,r,a),e.safeEncodeAsync=async(r,a)=>Mm(e,r,a),e.safeDecodeAsync=async(r,a)=>Fm(e,r,a),e.refine=(r,a)=>e.check(ff(r,a)),e.superRefine=r=>e.check(hf(r)),e.overwrite=r=>e.check(cm(r)),e.optional=()=>xs(e),e.exactOptional=()=>Qm(e),e.nullable=()=>gs(e),e.nullish=()=>xs(gs(e)),e.nonoptional=r=>sf(e,r),e.array=()=>Hm(e),e.or=r=>qm([e,r]),e.and=r=>Xm(e,r),e.transform=r=>vs(e,Ym(r)),e.default=r=>rf(e,r),e.prefault=r=>of(e,r),e.catch=r=>cf(e,r),e.pipe=r=>vs(e,r),e.readonly=()=>pf(e),e.describe=r=>{const a=e.clone();return vr.add(a,{description:r}),a},Object.defineProperty(e,"description",{get(){var r;return(r=vr.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return vr.get(e);const a=e.clone();return vr.add(a,r[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Vm=de("ZodUnknown",(e,t)=>{Hp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>hm()});function Bm(){return sm(Vm)}const Um=de("ZodArray",(e,t)=>{Wp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>vm(e,r,a,n),e.element=t.element,e.min=(r,a)=>e.check(hs(r,a)),e.nonempty=r=>e.check(hs(1,r)),e.max=(r,a)=>e.check(im(r,a)),e.length=(r,a)=>e.check(lm(r,a)),e.unwrap=()=>e.element});function Hm(e,t){return dm(Um,e,t)}const Wm=de("ZodUnion",(e,t)=>{qp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>bm(e,r,a,n),e.options=t.options});function qm(e,t){return new Wm({type:"union",options:e,...Tt(t)})}const Zm=de("ZodIntersection",(e,t)=>{Zp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>ym(e,r,a,n)});function Xm(e,t){return new Zm({type:"intersection",left:e,right:t})}const Gm=de("ZodTransform",(e,t)=>{Xp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>gm(e,r),e._zod.parse=(r,a)=>{if(a.direction==="backward")throw new ji(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(yr(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(yr(i))}};const n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function Ym(e){return new Gm({type:"transform",transform:e})}const Km=de("ZodOptional",(e,t)=>{Ei.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Ri(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function xs(e){return new Km({type:"optional",innerType:e})}const Jm=de("ZodExactOptional",(e,t)=>{Gp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Ri(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function Qm(e){return new Jm({type:"optional",innerType:e})}const ef=de("ZodNullable",(e,t)=>{Yp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>wm(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function gs(e){return new ef({type:"nullable",innerType:e})}const tf=de("ZodDefault",(e,t)=>{Kp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Nm(e,r,a,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function rf(e,t){return new tf({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Ci(t)}})}const af=de("ZodPrefault",(e,t)=>{Jp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Cm(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function of(e,t){return new af({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Ci(t)}})}const nf=de("ZodNonOptional",(e,t)=>{Qp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>jm(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function sf(e,t){return new nf({type:"nonoptional",innerType:e,...Tt(t)})}const lf=de("ZodCatch",(e,t)=>{em.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Sm(e,r,a,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function cf(e,t){return new lf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const df=de("ZodPipe",(e,t)=>{tm.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>km(e,r,a,n),e.in=t.in,e.out=t.out});function vs(e,t){return new df({type:"pipe",in:e,out:t})}const uf=de("ZodReadonly",(e,t)=>{rm.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>_m(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function pf(e){return new uf({type:"readonly",innerType:e})}const mf=de("ZodCustom",(e,t)=>{am.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>xm(e,r)});function ff(e,t={}){return um(mf,e,t)}function hf(e){return pm(e)}const xf={custom:"custom"},rt=(e,t,r={})=>{if(!e)return!0;if("and"in e||"or"in e)return"and"in e&&Array.isArray(e.and)?e.and.every(d=>rt(d,t,r)):"or"in e&&Array.isArray(e.or)?e.or.some(d=>rt(d,t,r)):!0;const a=e;if(!a.campoId)return!0;const n=a.source==="evento"?r[a.campoId]:t[a.campoId],s=n!=null?String(n):"",i=a.valor!==void 0?String(a.valor):"",l=parseFloat(s),c=parseFloat(i);switch(a.operador){case"igual":return s===i;case"diferente":return s!==i;case"vazio":return!s;case"naoVazio":return!!s;case"contem":return s.includes(i);case"naoContem":return!s.includes(i);case"maiorQue":return!isNaN(l)&&!isNaN(c)&&l>c;case"menorQue":return!isNaN(l)&&!isNaN(c)&&l<c;case"maiorOuIgual":return!isNaN(l)&&!isNaN(c)&&l>=c;case"menorOuIgual":return!isNaN(l)&&!isNaN(c)&&l<=c;default:return!0}},gf=/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/,vf=/^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/,bf=/^\d{5}-?\d{3}$/,yf=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,eo=(e,t,r={})=>{const a=e.validacao;if(e.tipo===O.CHECKBOX||e.tipo===O.SWITCH)return e.obrigatorio&&!t?"Campo obrigatório":void 0;if(e.tipo===O.SLIDER){const s=t!==void 0?Number(t):NaN;return e.obrigatorio&&isNaN(s)?"Campo obrigatório":isNaN(s)?void 0:(a==null?void 0:a.min)!==void 0&&s<a.min?`Valor mínimo: ${a.min}`:(a==null?void 0:a.max)!==void 0&&s>a.max?`Valor máximo: ${a.max}`:void 0}if(e.tipo===O.RATING){const s=t!==void 0?Number(t):0;return e.obrigatorio&&(!s||s<1)?"Avaliação obrigatória":void 0}if(e.tipo===O.DATE_RANGE){const s=t;if(e.obrigatorio){if(!(s!=null&&s.start))return"Data inicial obrigatória";if(!(s!=null&&s.end))return"Data final obrigatória"}return s!=null&&s.start&&s!=null&&s.end&&s.start>s.end?"A data inicial deve ser menor ou igual à data final":void 0}if(e.tipo===O.PARTICIPATION_TYPE){if(!e.obrigatorio)return;const s=t;return s!=null&&s.tipo?s.tipo==="por_dia"&&!s.data?"Selecione um dia para participar":"genero"in(s??{})&&!(s!=null&&s.genero)?"Selecione o sexo":void 0:"Selecione o tipo de participação"}if(e.tipo===O.CHECKBOX_GROUP){const s=Array.isArray(t)?t:[];return e.obrigatorio&&s.length===0?"Selecione pelo menos uma opção":void 0}if(e.tipo===O.FILE)return e.obrigatorio&&!t?"Arquivo obrigatório":void 0;if(e.tipo===O.NUMBER){const s=t!=null?String(t):"";if(e.obrigatorio&&!s)return"Campo obrigatório";if(!s)return;const i=Number(s);return isNaN(i)?"Deve ser um número":(a==null?void 0:a.min)!==void 0&&i<a.min?`Valor mínimo: ${a.min}`:(a==null?void 0:a.max)!==void 0&&i>a.max?`Valor máximo: ${a.max}`:void 0}const n=t!=null?String(t):"";if(e.obrigatorio&&!n.trim())return"Campo obrigatório";if(n){if(e.tipo===O.EMAIL&&!yf.test(n))return"E-mail inválido";if(e.tipo===O.CPF&&!gf.test(n))return"CPF inválido";if(e.tipo===O.TELEFONE&&!vf.test(n))return"Telefone inválido";if(e.tipo===O.CEP&&!bf.test(n))return"CEP inválido";if(a!=null&&a.minLength&&n.length<a.minLength)return`Mínimo ${a.minLength} caracteres`;if(a!=null&&a.maxLength&&n.length>a.maxLength)return`Máximo ${a.maxLength} caracteres`;if((e.tipo===O.DATE||e.tipo===O.DATETIME)&&n){if(a!=null&&a.minDate&&n<a.minDate)return`Data mínima: ${a.minDate}`;if(a!=null&&a.maxDate&&n>a.maxDate)return`Data máxima: ${a.maxDate}`}if((e.tipo===O.DATE||e.tipo===O.DATETIME)&&n&&((a==null?void 0:a.minAge)!=null||(a==null?void 0:a.maxAge)!=null)){const s=n.split("T")[0],i=new Date(s+"T00:00:00"),l=r["evento.dataInicioEvento"],c=l?new Date(l.split("T")[0]+"T00:00:00"):new Date;let d=c.getFullYear()-i.getFullYear();const u=c.getMonth()-i.getMonth();if((u<0||u===0&&c.getDate()<i.getDate())&&d--,a.minAge!=null&&d<a.minAge)return`Idade mínima: ${a.minAge} ano${a.minAge!==1?"s":""}`;if(a.maxAge!=null&&d>a.maxAge)return`Idade máxima: ${a.maxAge} ano${a.maxAge!==1?"s":""}`}if(a!=null&&a.regex)try{if(!new RegExp(a.regex).test(n))return a.regexMessage||"Formato inválido"}catch{}}},Ir=(e,t,r)=>{const a=t.split(".");let n=e;for(let s=0;s<a.length-1;s++){const i=a[s];(n[i]==null||typeof n[i]!="object")&&(n[i]={}),n=n[i]}n[a[a.length-1]]=r},wf=e=>[...e.containers].sort((t,r)=>t.ordem-r.ordem).filter(t=>!t.repeatable).flatMap(t=>[...t.campos].sort((r,a)=>r.ordem-a.ordem)),Oi=(e,t={},r={})=>async a=>{var n,s,i;const l=wf(e),c={};for(const p of l){if(!rt(p.condicional,a,t)||p.tipo===O.HIDDEN)continue;if(p.tipo===O.FIELD_ARRAY){const h=Array.isArray(a[p.nome])?a[p.nome]:[];p.obrigatorio&&h.length===0?c[p.nome]={type:"custom",message:"Adicione pelo menos um item"}:p.minItems&&h.length<p.minItems&&(c[p.nome]={type:"custom",message:`Mínimo de ${p.minItems} item${p.minItems!==1?"s":""}`});for(let g=0;g<h.length;g++){const f=h[g];for(const v of p.subFields??[]){const b=eo(v,f[v.nome],t);if(b){Ir(c,`${p.nome}.${g}.${v.nome}`,{type:"custom",message:b});continue}if((n=v.validate)!=null&&n.length){const w=await qr(v.validate,v.nome,f[v.nome],f,t,r);w&&Ir(c,`${p.nome}.${g}.${v.nome}`,{type:"custom",message:w})}}}continue}const m=eo(p,a[p.nome],t);if(m&&(c[p.nome]={type:"custom",message:m}),!c[p.nome]&&(s=p.validate)!=null&&s.length){const h=await qr(p.validate,p.nome,a[p.nome],a,t,r);h&&(c[p.nome]={type:"custom",message:h})}}const d=e.containers.filter(p=>p.repeatable&&p.nome);for(const p of d){const m=Array.isArray(a[p.nome])?a[p.nome]:[];for(let h=0;h<m.length;h++){const g=m[h];for(const f of p.campos){if(!rt(f.condicional,g,t)||f.tipo===O.HIDDEN)continue;const v=eo(f,g[f.nome],t);if(v){Ir(c,`${p.nome}.${h}.${f.nome}`,{type:"custom",message:v});continue}if((i=f.validate)!=null&&i.length){const b=await qr(f.validate,f.nome,g[f.nome],g,t,r);b&&Ir(c,`${p.nome}.${h}.${f.nome}`,{type:"custom",message:b})}}}}const u=Object.keys(c).length>0;return{values:u?{}:a,errors:u?c:{}}},qr=async(e,t,r,a,n,s)=>{var i;let l=Bm();for(const d of e){const u=s[d.type];if(!u)continue;const p=u,m=d;l=l.superRefine(async(h,g)=>{const f=await p(h,a,m,n);f&&g.addIssue({code:xf.custom,message:m.message??f})})}const c=await l.safeParseAsync(r);if(!c.success)return(i=c.error.issues[0])==null?void 0:i.message},Di=(e,t={},r={})=>async a=>{var n;const s={},i=[...e.containers].sort((l,c)=>l.ordem-c.ordem).flatMap(l=>[...l.campos].sort((c,d)=>c.ordem-d.ordem));for(const l of i){if(!((n=l.warn)!=null&&n.length)||!rt(l.condicional,a,t))continue;const c=await qr(l.warn,l.nome,a[l.nome],a,t,r);c&&(s[l.nome]=c)}return s},jf=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,Xe=(e,t)=>e?e.replace(jf,(r,a)=>t[`evento.${a}`]??t[a]??r):e??"",Nf=(e,t)=>({...e,label:Xe(e.label,t)}),Ai=(e,t)=>{var r;return{...e,label:Xe(e.label,t),placeholder:Xe(e.placeholder,t),hint:Xe(e.hint,t),defaultValue:typeof e.defaultValue=="string"?Xe(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(a=>Nf(a,t))}},ha=(e,t)=>({...e,titulo:Xe(e.titulo,t),descricao:Xe(e.descricao,t),campos:e.campos.map(r=>Ai(r,t))}),Ii=(e,t)=>({...e,titulo:Xe(e.titulo,t),descricao:Xe(e.descricao,t),containers:e.containers.map(r=>ha(r,t))}),Jo=E.createContext({}),dt=()=>E.useContext(Jo),Be=({name:e,control:t,placeholder:r,type:a="text",disabled:n,readOnly:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),d=!!c.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx("input",{...l,value:l.value??"",type:a,placeholder:r,disabled:n,readOnly:s,className:`sfr-input${d?" sfr-input--error":""}`,"data-sfr-field":"text"}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},xa=({name:e,control:t,placeholder:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsx("textarea",{...i,value:i.value??"",placeholder:r,disabled:a,readOnly:n,rows:3,className:`sfr-textarea${l.error?" sfr-input--error":""}`,"data-sfr-field":"textarea"}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},ga=({name:e,control:t,placeholder:r,options:a,disabled:n,readOnly:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("select",{...l,value:l.value??"",disabled:n||s,className:`sfr-select${c.error?" sfr-input--error":""}`,"data-sfr-field":"select",children:[r&&o.jsx("option",{value:"",children:r}),!r&&o.jsx("option",{value:"",children:"Selecione..."}),a.map(d=>o.jsx("option",{value:d.valor,disabled:d.disabled,children:d.label},d.valor))]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},va=({name:e,control:t,label:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"sfr-checkbox-label","data-sfr-field":"checkbox",children:[o.jsx("input",{type:"checkbox",name:i.name,checked:!!i.value,onChange:c=>!n&&i.onChange(c.target.checked),onBlur:i.onBlur,onKeyDown:c=>{n&&c.key===" "&&c.preventDefault()},disabled:a,readOnly:n,className:"sfr-checkbox"}),r&&o.jsx("span",{className:"sfr-checkbox-text",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Qo=({name:e,control:t,options:r,disabled:a})=>{var n;const{field:s,fieldState:i}=ce.useController({name:e,control:t}),l=Array.isArray(s.value)?s.value:[],c=d=>{const u=l.includes(d)?l.filter(p=>p!==d):[...l,d];s.onChange(u)};return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"sfr-checkbox-group","data-sfr-field":"checkbox-group",children:r.map(d=>o.jsxs("label",{className:"sfr-checkbox-label",children:[o.jsx("input",{type:"checkbox",checked:l.includes(d.valor),onChange:()=>c(d.valor),disabled:a||d.disabled,className:"sfr-checkbox"}),o.jsx("span",{className:"sfr-checkbox-text",children:d.label})]},d.valor))}),((n=i.error)==null?void 0:n.message)&&o.jsx("p",{className:"sfr-error",children:i.error.message})]})},en=({name:e,control:t,options:r,visualStyle:a="default",disabled:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),c=a==="card";return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:c?"sfr-radio-cards":"sfr-radio-group","data-sfr-field":"radio","data-style":a,children:r.map(d=>o.jsxs("label",{className:c?"sfr-radio-card":"sfr-radio-label","data-selected":i.value===d.valor?"true":void 0,children:[o.jsx("input",{type:"radio",name:i.name,value:d.valor,checked:i.value===d.valor,onChange:()=>i.onChange(d.valor),onBlur:i.onBlur,disabled:n||d.disabled,className:c?"sfr-radio-card-input":"sfr-radio"}),o.jsx("span",{className:c?"sfr-radio-card-label":"sfr-radio-text",children:d.label})]},d.valor))}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Cf=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),t.toISOString().split("T")[0]},Sf=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),t.toISOString().split("T")[0]},ar=({name:e,control:t,isDatetime:r,disabled:a,readOnly:n,validacao:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),d=r?"datetime-local":"date",u=h=>r?h+"T00:00":h,p=(s==null?void 0:s.minAge)!=null?u(Cf(s.minAge)):(s==null?void 0:s.maxDate)!=null?u(s.maxDate):void 0,m=(s==null?void 0:s.maxAge)!=null?u(Sf(s.maxAge)):(s==null?void 0:s.minDate)!=null?u(s.minDate):void 0;return o.jsxs("div",{className:"space-y-1",children:[o.jsx("input",{name:l.name,value:l.value??"",onChange:l.onChange,onBlur:l.onBlur,type:d,min:m,max:p,disabled:a,readOnly:n,className:`sfr-input${c.error?" sfr-input--error":""}`,"data-sfr-field":"date"}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},kf=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,tn=({name:e,control:t,disabled:r,campo:a,fileTypes:n,maxFileSize:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),{uploadFile:d}=dt(),[u,p]=E.useState({status:"idle"}),m=E.useRef(null),h=typeof l.value=="string"&&l.value?l.value:null,g=E.useCallback(async b=>{var w;if(n&&n.length>0){const y=((w=b.name.split(".").pop())==null?void 0:w.toLowerCase())??"",N=b.type.toLowerCase();if(!n.some(C=>C.toLowerCase()===y||C.toLowerCase()===N)){p({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${n.join(", ")}`});return}}if(s&&b.size>s){p({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${kf(s)}`});return}if(!d){p({status:"error",message:"Preview: upload não disponível sem configuração."});return}p({status:"uploading",fileName:b.name,progress:0});try{const y=await d(b,a??e,N=>{p(C=>C.status==="uploading"?{...C,progress:Math.min(100,N)}:C)});l.onChange(y),p({status:"done",uploadId:y,fileName:b.name})}catch{p({status:"error",message:"Falha no upload. Tente novamente."})}},[d,a,e,l,n,s]),f=E.useCallback(b=>{var w;const y=(w=b.target.files)==null?void 0:w[0];y&&g(y)},[g]),v=E.useCallback(()=>{l.onChange(""),p({status:"idle"}),m.current&&(m.current.value="")},[l]);return o.jsxs("div",{className:"sfr-file-upload","data-sfr-field":"file","data-status":u.status,children:[!h&&u.status!=="done"&&o.jsxs("label",{className:"sfr-file-drop",children:[o.jsx("input",{ref:m,type:"file",onChange:f,disabled:r||u.status==="uploading",className:"sfr-file-input"}),o.jsx("span",{className:"sfr-file-label",children:u.status==="uploading"?`Enviando ${u.fileName}…`:"Clique ou arraste o arquivo"})]}),(h||u.status==="done")&&o.jsxs("div",{className:"sfr-file-done",children:[o.jsx("span",{className:"sfr-file-name",children:u.status==="done"?u.fileName:"Arquivo enviado"}),!r&&o.jsx("button",{type:"button",onClick:v,className:"sfr-file-remove",children:"✕"})]}),u.status==="error"&&o.jsx("p",{className:"sfr-error",children:u.message}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},_f={cpf:e=>e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2"),telefone:e=>{const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")},cep:e=>e.replace(/\D/g,"").slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")},Ct=({name:e,control:t,placeholder:r,maskType:a,disabled:n,readOnly:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),d=_f[a||""],u=E.useCallback(p=>{l.onChange(d?d(p.target.value):p.target.value)},[l,d]);return o.jsxs("div",{className:"space-y-1",children:[o.jsx("input",{name:l.name,value:l.value||"",onChange:u,onBlur:l.onBlur,placeholder:r,disabled:n,readOnly:s,className:`sfr-input${c.error?" sfr-input--error":""}`,"data-sfr-field":"masked"}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},ba=({name:e,control:t})=>{const{field:r}=ce.useController({name:e,control:t});return o.jsx("input",{type:"hidden",...r,value:r.value??""})},Li=e=>e.replace(/\D/g,""),Ef=e=>{const t=Li(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},Pf=async(e,t)=>{const r=await fetch(`https://viacep.com.br/ws/${e}/json/`,{signal:t});if(!r.ok)throw new Error("Falha ao consultar CEP");return r.json()},rn=({name:e,control:t,placeholder:r="00000-000",disabled:a,readOnly:n,cepFillMap:s})=>{var i,l;const{field:c,fieldState:d}=ce.useController({name:e,control:t}),{setValue:u}=ce.useFormContext(),{cepLookup:p}=dt(),[m,h]=E.useState("idle"),[g,f]=E.useState(null),v=E.useRef(null);E.useEffect(()=>()=>{var y;(y=v.current)==null||y.abort()},[]);const b=E.useCallback(async()=>{var y;c.onBlur();const N=Li(c.value??"");if(N.length===8){(y=v.current)==null||y.abort(),v.current=new AbortController,h("loading"),f(null);try{let C;if(p){const j=v.current;if(C=await p(N),j.signal.aborted)return}else{const j=await Pf(N,v.current.signal);if(j.erro){h("error"),f("CEP não encontrado");return}C={logradouro:j.logradouro,bairro:j.bairro,cidade:j.localidade,estado:j.uf}}if(C.erro){h("error"),f("CEP não encontrado");return}const _=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",k=(j,R,A)=>{if(!A)return;const I=s!=null&&s[j]?`${_}${s[j]}`:`${_}${R}`;u(I,A)};k("logradouro","_address_logradouro",C.logradouro),k("bairro","_address_bairro",C.bairro),k("cidade","_address_cidade",C.cidade),k("estado","_address_estado",C.estado),h("success")}catch(C){if(C instanceof Error&&C.name==="AbortError")return;h("error"),f("Erro ao buscar CEP")}}},[c,p,u,e,s]),w=E.useCallback(y=>{c.onChange(Ef(y.target.value))},[c]);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"sfr-cep-wrapper","data-sfr-field":"cep","data-status":m,children:[o.jsx("input",{name:c.name,value:c.value||"",onChange:w,onBlur:b,placeholder:r,disabled:a,readOnly:n,className:`sfr-input${d.error?" sfr-input--error":""}`}),m==="loading"&&o.jsx("span",{className:"sfr-cep-indicator sfr-cep-loading"}),m==="success"&&o.jsx("span",{className:"sfr-cep-indicator sfr-cep-success"}),m==="error"&&o.jsx("span",{className:"sfr-cep-indicator sfr-cep-error"})]}),(((i=d.error)==null?void 0:i.message)||g)&&o.jsx("p",{className:"sfr-error",children:((l=d.error)==null?void 0:l.message)||g})]})},Tf=({field:e,control:t,nameOverride:r})=>{const a={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case O.TEXTO:return o.jsx(Be,{...a,type:"text"});case O.EMAIL:return o.jsx(Be,{...a,type:"email"});case O.NUMBER:return o.jsx(Be,{...a,type:"number"});case O.TEXTAREA:return o.jsx(xa,{...a});case O.SELECT:return o.jsx(ga,{...a,options:e.opcoes??[]});case O.RADIO:return o.jsx(en,{...a,options:e.opcoes??[]});case O.CHECKBOX:return o.jsx(va,{name:r,control:t,label:e.label});case O.CHECKBOX_GROUP:return o.jsx(Qo,{...a,options:e.opcoes??[]});case O.DATE:return o.jsx(ar,{...a,validacao:e.validacao});case O.DATETIME:return o.jsx(ar,{...a,isDatetime:!0,validacao:e.validacao});case O.FILE:return o.jsx(tn,{name:r,control:t});case O.TELEFONE:return o.jsx(Ct,{...a,maskType:"telefone"});case O.CPF:return o.jsx(Ct,{...a,maskType:"cpf"});case O.CEP:return o.jsx(rn,{name:r,control:t,placeholder:e.placeholder});case O.HIDDEN:return o.jsx(ba,{name:r,control:t});default:return o.jsx(Be,{...a,type:"text"})}},zi=({name:e,control:t,subFields:r=[],minItems:a=1,maxItems:n,itemLabel:s="Item",addLabel:i})=>{var l;const{fields:c,append:d,remove:u}=ce.useFieldArray({control:t,name:e}),{errors:p}=ce.useFormState({control:t}),m=(l=p[e])==null?void 0:l.message;E.useEffect(()=>{if(c.length<a)for(let v=c.length;v<a;v++)d({})},[]);const h=[...r].sort((v,b)=>v.ordem-b.ordem),g=!n||c.length<n,f=i??`Adicionar ${s.toLowerCase()}`;return o.jsxs("div",{className:"sfr-field-array space-y-3",children:[c.map((v,b)=>o.jsxs("div",{className:"sfr-field-array__item border rounded-lg p-4",children:[o.jsxs("div",{className:"sfr-field-array__item-header flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"sfr-field-array__counter w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0",children:b+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[s," ",b+1]})]}),c.length>a&&o.jsx("button",{type:"button",onClick:()=>u(b),className:"sfr-field-array__remove","aria-label":`Remover ${s.toLowerCase()} ${b+1}`,children:o.jsx(P.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:h.map(w=>{const y=`${e}.${b}.${w.nome}`,N=`span ${w.tamanho??12}`,C=o.jsx(Tf,{field:w,control:t,nameOverride:y});return w.tipo===O.CHECKBOX||w.tipo===O.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:N},children:C},w.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:N},children:[o.jsxs("label",{className:"sfr-label font-medium flex items-center gap-1 text-sm",children:[w.label,w.obrigatorio&&o.jsx("span",{className:"sfr-required",children:"*"})]}),C,w.hint&&o.jsx("p",{className:"sfr-hint text-xs",children:w.hint})]},w.id)})})]},v.id)),g&&o.jsxs("button",{type:"button",className:"sfr-btn sfr-btn--outline w-full flex items-center justify-center gap-2 py-2 px-4 border rounded-lg text-sm",onClick:()=>d({}),children:[o.jsx(P.Plus,{className:"w-4 h-4"}),f]}),n&&o.jsxs("p",{className:"sfr-hint text-xs text-center",children:["Máximo de ",n," ",s.toLowerCase(),n>1?"s":""]}),m&&o.jsxs("p",{className:"sfr-error text-sm flex items-center gap-1",children:[o.jsx(P.AlertCircle,{className:"w-4 h-4 shrink-0"}),m]})]})},bs=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,$f=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),a=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((a.getTime()-r.getTime())/864e5)+1},Rf=(e,t)=>{const r=[],a=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;a<=n&&s<60;)r.push(a.toISOString().slice(0,10)),a.setUTCDate(a.getUTCDate()+1),s++;return r},Of=e=>{const[t,r,a]=e.split("-").map(Number),n=new Date(Date.UTC(t,r-1,a)),s=String(a).padStart(2,"0"),i=String(r).padStart(2,"0"),l=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(n),c=l.charAt(0).toUpperCase()+l.slice(1);return`${s}/${i} - ${c}`},Df=(e,t)=>{const r=a=>{const[n,s,i]=a.slice(0,10).split("-");return`${i}/${s}/${n}`};return`${r(e)} a ${r(t)}`},Mi=({name:e,control:t})=>{var r;const{field:a,fieldState:n}=ce.useController({name:e,control:t}),{externalData:s={}}=dt(),i=a.value??null,l=(r=n.error)==null?void 0:r.message,c=D=>s[`evento.${D}`]??s[D],d=c("dataInicioEvento")??"",u=c("dataFimEvento")??"",p=Number(c("valor")??0),m=Number(c("valorPorDia")??0),h=c("vagasTotal"),g=c("vagasPorDia"),f=c("vagasMasculinas"),v=c("vagasFemininas"),b=h!=null?Number(h):null,w=g!=null?Number(g):null,y=f!=null?Number(f):null,N=v!=null?Number(v):null,C=d&&u?Rf(d,u):[],_=(d&&u?$f(d,u):0)>1,k=y!=null&&y>0&&N!=null&&N>0,j=y!=null&&N==null?"masculino":N!=null&&y==null?"feminino":null,R=(i==null?void 0:i.tipo)??null,A=(i==null?void 0:i.data)??null,I=(i==null?void 0:i.genero)??null,F=E.useRef(i);F.current=i;const V=E.useRef(a.onChange);V.current=a.onChange,E.useEffect(()=>{var D,z,L;j&&((D=F.current)==null?void 0:D.genero)!==j&&V.current({tipo:((z=F.current)==null?void 0:z.tipo)??null,data:((L=F.current)==null?void 0:L.data)??null,genero:j})},[j]);const M=D=>{const z={tipo:D,data:null};(k||j)&&(z.genero=I??j??void 0),a.onChange(z)},U=D=>{const z={tipo:"por_dia",data:D};(k||j)&&(z.genero=I??j??void 0),a.onChange(z)},$=D=>{a.onChange({tipo:R,data:A,genero:D})},T=D=>R===D;return o.jsxs("div",{className:"sfr-participation-type space-y-3",children:[k&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs sfr-text-muted shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(D=>o.jsx("button",{type:"button",onClick:()=>$(D),className:"sfr-participation-type__gender-btn px-3 py-1 rounded-full text-xs font-medium border transition-all","data-selected":I===D?"true":void 0,children:D==="masculino"?"Masculino":"Feminino"},D))})]}),o.jsxs("button",{type:"button",onClick:()=>M("todos_os_dias"),className:"sfr-participation-type__card w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all","data-selected":T("todos_os_dias")?"true":void 0,children:[o.jsx("div",{className:"sfr-participation-type__card-icon mt-0.5 p-2 rounded-lg shrink-0","data-selected":T("todos_os_dias")?"true":void 0,children:o.jsx(P.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&u?o.jsx("p",{className:"text-xs sfr-text-muted",children:Df(d,u)}):o.jsx("p",{className:"text-xs sfr-text-muted italic",children:"Datas do evento"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[p>0&&o.jsx("p",{className:"font-bold text-sm sfr-participation-type__price","data-selected":T("todos_os_dias")?"true":void 0,children:bs(p)}),b!=null&&b>0&&o.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 sfr-participation-type__vagas",children:[o.jsx(P.Users,{className:"w-3 h-3"}),b," vagas disponíveis"]})]})]}),_?o.jsxs("button",{type:"button",onClick:()=>M("por_dia"),className:"sfr-participation-type__card w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all","data-selected":T("por_dia")?"true":void 0,children:[o.jsx("div",{className:"sfr-participation-type__card-icon mt-0.5 p-2 rounded-lg shrink-0","data-selected":T("por_dia")?"true":void 0,children:o.jsx(P.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),o.jsx("p",{className:"text-xs sfr-text-muted",children:"Escolha o dia desejado abaixo"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[m>0&&o.jsx("p",{className:"font-bold text-sm sfr-participation-type__price","data-selected":T("por_dia")?"true":void 0,children:bs(m)}),o.jsx("p",{className:"text-xs sfr-text-muted",children:"por dia"})]})]}):d?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border sfr-participation-type__notice",children:[o.jsx(P.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 sfr-text-muted"}),o.jsx("p",{className:"text-xs sfr-text-muted",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,R==="por_dia"&&o.jsxs("div",{className:"pl-2 space-y-2 sfr-participation-type__days",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide sfr-primary-text",children:"Selecione o dia:"}),C.length===0?o.jsx("p",{className:"text-xs sfr-text-muted italic",children:"Nenhuma data configurada no evento"}):C.map(D=>o.jsxs("button",{type:"button",onClick:()=>U(D),className:"sfr-participation-type__day-btn w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all","data-selected":A===D?"true":void 0,children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center sfr-participation-type__day-radio","data-selected":A===D?"true":void 0,children:A===D&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),o.jsx("span",{className:"text-sm",children:Of(D)})]}),w!=null&&o.jsxs("span",{className:"text-xs sfr-participation-type__vagas",children:[w," vagas"]})]},D))]}),l&&o.jsx("p",{className:"text-sm sfr-error",children:l})]})},ys=.0315,ws=.124,js=7,Ns=12,Fi=[{id:"pix",label:"PIX",description:"Transferência instantânea (à vista)",Icon:P.Smartphone,taxa:0},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:P.Banknote,taxa:0},{id:"cartao",label:"Cartão de Crédito",description:"Débito ou crédito na maquininha",Icon:P.CreditCard,taxa:ys,taxaLabel:`Taxa: ${(ys*100).toFixed(2).replace(".",",")}%`}],Vi=[{id:"pix",label:"PIX à Vista",description:"Pagamento instantâneo sem parcelamento",Icon:P.Smartphone,taxa:0},{id:"pix_parcelado",label:"PIX Parcelado",description:`Parcelado em até ${js}x sem juros`,Icon:P.Smartphone,taxa:0,parcelas:js},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${Ns}x`,Icon:P.CreditCard,taxa:ws,parcelas:Ns,taxaLabel:`Taxa: ${(ws*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:P.Banknote,taxa:0}],Lr=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,Cs=(e,t)=>Math.round(e*(1+t)*100)/100,Af=(e,t)=>Math.round(e/t*100)/100,Bi=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var a;const{field:n,fieldState:s}=ce.useController({name:e,control:t}),{externalData:i={},paymentMethodOptions:l}=dt(),c=n.value??null,d=(a=s.error)==null?void 0:a.message,u=ce.useWatch({control:t,name:r}),p=(u==null?void 0:u.tipo)??null,m=y=>i[`evento.${y}`]??i[y],h=Number(m("valor")??0),g=Number(m("valorPorDia")??0),f=p==="por_dia"&&g>0?g:h,v=p==="por_dia"?(l==null?void 0:l.porDia)??Fi:(l==null?void 0:l.todosOsDias)??Vi,b=p==="por_dia"?(()=>{if(!(u!=null&&u.data))return"Um dia";const[y,N,C]=u.data.split("-");return`${C}/${N}/${y}`})():"Todos os dias",w=y=>{if(y.disabled)return;const N=Cs(f,y.taxa),C={metodo:y.id,valorTotal:N};y.parcelas&&(C.parcelas=y.parcelas),n.onChange(C)};return o.jsxs("div",{className:"sfr-payment-method space-y-4",children:[o.jsxs("div",{className:"sfr-payment-method__summary flex items-center justify-between rounded-xl border px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs sfr-text-muted",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:b})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs sfr-text-muted",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold sfr-primary-text",children:Lr(f)})]})]}),o.jsxs("div",{className:"sfr-payment-method__notice flex items-start gap-2 rounded-lg border px-3 py-2.5",children:[o.jsx(P.Info,{className:"h-4 w-4 mt-0.5 shrink-0"}),o.jsxs("p",{className:"text-xs",children:[o.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold sfr-primary-text",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:v.map(y=>{const{Icon:N}=y,C=(c==null?void 0:c.metodo)===y.id,_=Cs(f,y.taxa),k=!!y.parcelas&&y.parcelas>1,j=k?Af(_,y.parcelas):null;return o.jsxs("button",{type:"button",disabled:y.disabled,onClick:()=>w(y),className:"sfr-payment-method__card w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all","data-selected":C?"true":void 0,"data-disabled":y.disabled?"true":void 0,children:[o.jsx("div",{className:"sfr-payment-method__card-icon flex items-center justify-center w-10 h-10 rounded-lg shrink-0","data-selected":C?"true":void 0,children:o.jsx(N,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:y.label}),o.jsx("p",{className:"text-xs sfr-text-muted",children:y.description}),y.taxaLabel&&o.jsxs("p",{className:"text-xs sfr-payment-method__taxa mt-0.5",children:["* ",y.taxaLabel]}),y.taxa>0&&o.jsxs("p",{className:"text-xs sfr-text-muted",children:["Total com taxa: ",Lr(_)]})]}),o.jsx("div",{className:"text-right shrink-0",children:k?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs sfr-text-muted",children:[y.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold sfr-primary-text",children:Lr(j)})]}):o.jsx("p",{className:"text-base font-bold sfr-primary-text",children:Lr(_)})})]},y.id)})}),d&&o.jsx("p",{className:"text-xs sfr-error",children:d})]})},Ui=({name:e,control:t,label:r,termoTexto:a,termoPdfUrl:n,termoPdfUploadId:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),{resolveTermsUploadUrl:d}=dt(),u=!!c.error,p=(i=c.error)==null?void 0:i.message,[m,h]=E.useState(null),[g,f]=E.useState(!1),[v,b]=E.useState(!1);E.useEffect(()=>{if(!s||!d){h(null);return}f(!0),d(s).then(_=>h(_)).catch(()=>h(null)).finally(()=>f(!1))},[s,d]);const w=l.value==="accepted",y=m||n||null,N=!!(a||y||s),C=!!y;return o.jsxs("div",{className:"sfr-terms space-y-2",children:[o.jsxs("div",{className:"sfr-terms__box rounded-lg border p-4 space-y-4",style:{borderColor:u?"var(--sfr-error, #ef4444)":w?"var(--sfr-success, #22c55e)":"var(--sfr-border, #e2e8f0)",background:u?"color-mix(in srgb, var(--sfr-error, #ef4444) 5%, transparent)":w?"color-mix(in srgb, var(--sfr-success, #22c55e) 5%, transparent)":"transparent"},children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(P.ScrollText,{className:"h-4 w-4 sfr-terms__icon shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),N?o.jsxs("button",{type:"button",className:"sfr-btn sfr-btn--outline flex items-center gap-1.5 text-xs h-7 px-2 border rounded",disabled:g,onClick:()=>b(!0),children:[g?o.jsx(P.Loader2,{className:"h-3 w-3 animate-spin"}):o.jsx(P.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]}):o.jsx("span",{className:"text-xs sfr-text-muted italic",children:s&&g?"Carregando PDF...":"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx("input",{type:"checkbox",className:"sfr-checkbox mt-0.5",checked:w,onChange:_=>l.onChange(_.target.checked?"accepted":""),style:u?{outline:"1px solid var(--sfr-error, #ef4444)"}:{}}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),w&&o.jsx(P.CheckCircle2,{className:"h-4 w-4 sfr-terms__check shrink-0 mt-0.5"})]})]}),u&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs sfr-error",children:[o.jsx(P.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),p||"Você precisa aceitar os termos para continuar"]}),v&&o.jsx("div",{className:"sfr-modal-backdrop fixed inset-0 z-50 flex items-center justify-center p-4",style:{background:"rgba(0,0,0,0.6)"},onClick:()=>b(!1),children:o.jsxs("div",{className:"sfr-modal relative w-full max-w-2xl max-h-[90vh] rounded-xl overflow-hidden flex flex-col",style:{background:"var(--sfr-surface, #ffffff)"},onClick:_=>_.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b sfr-modal__header",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(P.ScrollText,{className:"h-4 w-4"}),o.jsx("span",{className:"font-semibold",children:"Termos e condições"})]}),o.jsx("button",{type:"button",className:"sfr-btn sfr-btn--ghost",onClick:()=>b(!1),children:o.jsx(P.X,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"flex-1 overflow-auto p-4",children:C?o.jsx("iframe",{src:y,className:"w-full rounded border",style:{height:"62vh"},title:"Termos e condições",sandbox:"allow-scripts allow-same-origin"}):o.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:a})})]})})]})},If=({name:e,control:t,placeholder:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),[c,d]=E.useState(!1),u=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx("input",{...i,value:i.value??"",type:c?"text":"password",placeholder:r,disabled:a,readOnly:n,className:`sfr-input pr-10${u?" sfr-input--error":""}`,"data-sfr-field":"password"}),o.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(p=>!p),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[var(--t-text-muted)] hover:text-[var(--t-text)] transition-colors","aria-label":c?"Ocultar senha":"Mostrar senha",children:c?o.jsx(P.EyeOff,{size:16}):o.jsx(P.Eye,{size:16})})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Hi=({name:e,control:t,label:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),c=!!i.value;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[o.jsx("button",{type:"button",role:"switch","aria-checked":c,disabled:a||n,onClick:()=>!n&&i.onChange(!c),className:["relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--t-primary)] focus-visible:ring-offset-2",c?"bg-[var(--t-primary)]":"bg-[var(--t-border)]",a?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),children:o.jsx("span",{className:["pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-lg transition-transform",c?"translate-x-5":"translate-x-0.5"].join(" ")})}),o.jsx("span",{className:"sfr-label !mb-0",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Lf=({name:e,control:t,minValue:r=0,maxValue:a=100,step:n=1,disabled:s,readOnly:i})=>{var l;const{field:c,fieldState:d}=ce.useController({name:e,control:t}),u=c.value??r,p=a-r,m=p>0?(u-r)/p*100:0;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"relative flex-1",children:o.jsx("input",{type:"range",min:r,max:a,step:n,value:u,disabled:s||i,onChange:h=>c.onChange(Number(h.target.value)),className:"sfr-slider w-full",style:{"--slider-pct":`${m}%`}})}),o.jsx("span",{className:"sfr-label !mb-0 min-w-[3rem] text-right tabular-nums",style:{color:"var(--t-primary)"},children:u})]}),o.jsxs("div",{className:"flex justify-between text-xs",style:{color:"var(--t-text-muted)"},children:[o.jsx("span",{children:r}),o.jsx("span",{children:a})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"sfr-error",children:d.error.message})]})},zf=({name:e,control:t,disabled:r,readOnly:a})=>{var n;const{field:s,fieldState:i}=ce.useController({name:e,control:t}),l=s.value??"#000000";return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("input",{type:"color",value:l,disabled:r||a,onChange:c=>s.onChange(c.target.value),className:"h-10 w-14 cursor-pointer rounded-lg border border-[var(--t-border)] bg-transparent p-1 disabled:cursor-not-allowed disabled:opacity-50","data-sfr-field":"color"}),o.jsx("input",{type:"text",value:l,readOnly:a,disabled:r,onChange:c=>{const d=c.target.value;/^#[0-9a-fA-F]{0,6}$/.test(d)&&s.onChange(d)},className:`sfr-input flex-1 font-mono uppercase${i.error?" sfr-input--error":""}`,maxLength:7,placeholder:"#000000"})]}),((n=i.error)==null?void 0:n.message)&&o.jsx("p",{className:"sfr-error",children:i.error.message})]})},Mf=({name:e,control:t,options:r,placeholder:a,disabled:n,readOnly:s})=>{var i,l;const{field:c,fieldState:d}=ce.useController({name:e,control:t}),[u,p]=E.useState(""),[m,h]=E.useState(!1),g=E.useRef(null),f=((i=r.find(y=>y.valor===c.value))==null?void 0:i.label)??"",v=u.length>0?r.filter(y=>y.label.toLowerCase().includes(u.toLowerCase())):r;E.useEffect(()=>{const y=N=>{g.current&&!g.current.contains(N.target)&&(h(!1),p(""))};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[]);const b=y=>{y.disabled||(c.onChange(y.valor),h(!1),p(""))},w=()=>{c.onChange(""),p("")};return o.jsxs("div",{className:"space-y-1",ref:g,children:[o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"text",value:m?u:f,placeholder:a??"Buscar...",disabled:n,readOnly:s,onChange:y=>{p(y.target.value),h(!0)},onFocus:()=>!s&&h(!0),className:`sfr-input pr-8${d.error?" sfr-input--error":""}`,"data-sfr-field":"autocomplete",autoComplete:"off"}),o.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?o.jsx("button",{type:"button",onClick:w,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,children:o.jsx(P.X,{size:14})}):o.jsx(P.ChevronDown,{size:16,className:"text-[var(--t-text-muted)] pointer-events-none"})}),m&&!n&&!s&&o.jsx("ul",{className:"absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-[var(--t-border)] bg-[var(--t-surface)] shadow-lg",children:v.length===0?o.jsx("li",{className:"px-3 py-2 text-sm text-[var(--t-text-muted)]",children:"Nenhuma opção encontrada"}):v.map(y=>o.jsx("li",{onMouseDown:()=>b(y),className:["flex cursor-pointer items-center px-3 py-2 text-sm",y.disabled?"cursor-not-allowed opacity-40":"hover:bg-[var(--t-accent)]",c.value===y.valor?"font-medium text-[var(--t-primary)]":"text-[var(--t-text)]"].join(" "),children:y.label},y.valor))})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"sfr-error",children:d.error.message})]})},Wi=({name:e,control:t,placeholder:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),c=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx("input",{...i,value:i.value??"",type:"time",placeholder:r,disabled:a,readOnly:n,className:`sfr-input${c?" sfr-input--error":""}`,"data-sfr-field":"time"}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Ff=({name:e,control:t,startLabel:r="Data inicial",endLabel:a="Data final",disabled:n,readOnly:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),d=l.value??{},u=(m,h)=>{l.onChange({...d,[m]:h})},p=!!c.error;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"sfr-label",children:r}),o.jsx("input",{type:"date",value:d.start??"",disabled:n,readOnly:s,onChange:m=>u("start",m.target.value),max:d.end??void 0,className:`sfr-input${p?" sfr-input--error":""}`,"data-sfr-field":"date-range-start"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"sfr-label",children:a}),o.jsx("input",{type:"date",value:d.end??"",disabled:n,readOnly:s,onChange:m=>u("end",m.target.value),min:d.start??void 0,className:`sfr-input${p?" sfr-input--error":""}`,"data-sfr-field":"date-range-end"})]})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},Vf=({name:e,control:t,maxRating:r=5,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),c=i.value??0,d=Array.from({length:r},(u,p)=>p+1);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[d.map(u=>o.jsx("button",{type:"button",disabled:a||n,onClick:()=>i.onChange(u===c?0:u),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--t-primary)] rounded","aria-label":`${u} estrela${u>1?"s":""}`,children:o.jsx(P.Star,{size:24,className:"transition-colors",fill:u<=c?"var(--t-primary)":"transparent",stroke:u<=c?"var(--t-primary)":"var(--t-border)"})},u)),c>0&&o.jsxs("span",{className:"ml-2 text-sm",style:{color:"var(--t-text-muted)"},children:[c,"/",r]})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Bf=({field:e,name:t,control:r,disabled:a,readOnly:n})=>{const s=a||e.isDisabled,i=n||e.isReadOnly;switch(e.tipo){case O.EMAIL:return o.jsx(Be,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:i});case O.NUMBER:return o.jsx(Be,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:i});case O.PASSWORD:return o.jsx(Be,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:i});case O.TELEFONE:return o.jsx(Ct,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:i});case O.CPF:return o.jsx(Ct,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:i});case O.CEP:return o.jsx(Ct,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:i});case O.TEXTAREA:return o.jsx(xa,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:i});case O.SELECT:return o.jsx(ga,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:i});case O.CHECKBOX:return o.jsx(va,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case O.SWITCH:return o.jsx(Hi,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case O.DATE:return o.jsx(ar,{name:t,control:r,disabled:s,readOnly:i});case O.TIME:return o.jsx(Wi,{name:t,control:r,disabled:s,readOnly:i});case O.HIDDEN:return o.jsx(ba,{name:t,control:r});default:return o.jsx(Be,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:i})}},Uf=({name:e,control:t,subSchema:r,disabled:a,readOnly:n})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((i,l)=>i.ordem-l.ordem);return o.jsxs("div",{className:"sfr-subform rounded-xl border p-4 space-y-4",style:{borderColor:"var(--t-border)",background:"color-mix(in srgb, var(--t-surface) 60%, transparent)"},children:[r.titulo&&o.jsx("h4",{className:"sfr-subform__title text-sm font-semibold",style:{color:"var(--t-text-muted)"},children:r.titulo}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(i=>{const l=`${e}.${i.nome}`,c=i.tipo===O.CHECKBOX||i.tipo===O.SWITCH||i.tipo===O.HIDDEN,d=i.tamanho??6;return o.jsxs("div",{className:`col-span-${d}`,children:[!c&&o.jsxs("label",{className:"sfr-label mb-1 block",children:[i.label,i.obrigatorio&&o.jsx("span",{style:{color:"var(--t-error)"},children:" *"})]}),o.jsx(Bf,{field:i,name:l,control:t,disabled:a,readOnly:n})]},i.id)})})]})},qi=({field:e,control:t,nameOverride:r})=>{var a,n;const s=r??e.nome,{componentMapper:i}=dt(),l=i==null?void 0:i[e.tipo];if(l)return o.jsx(l,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case O.TEXTO:return o.jsx(Be,{...c,type:"text"});case O.EMAIL:return o.jsx(Be,{...c,type:"email"});case O.NUMBER:return o.jsx(Be,{...c,type:"number"});case O.PASSWORD:return o.jsx(If,{...c});case O.TEXTAREA:return o.jsx(xa,{...c});case O.SELECT:return o.jsx(ga,{...c,options:e.opcoes??[]});case O.AUTOCOMPLETE:return o.jsx(Mf,{...c,options:e.opcoes??[]});case O.SWITCH:return o.jsx(Hi,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.SLIDER:return o.jsx(Lf,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.RATING:return o.jsx(Vf,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.COLOR:return o.jsx(zf,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.TIME:return o.jsx(Wi,{...c});case O.DATE_RANGE:return o.jsx(Ff,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.RADIO:return o.jsx(en,{...c,options:e.opcoes??[]});case O.CHECKBOX:return o.jsx(va,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.CHECKBOX_GROUP:return o.jsx(Qo,{...c,options:e.opcoes??[]});case O.DATE:return o.jsx(ar,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case O.DATETIME:return o.jsx(ar,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case O.FILE:return o.jsx(tn,{name:s,control:t,disabled:e.isDisabled,fileTypes:(a=e.validacao)==null?void 0:a.fileTypes,maxFileSize:(n=e.validacao)==null?void 0:n.maxFileSize});case O.TELEFONE:return o.jsx(Ct,{...c,maskType:"telefone"});case O.CPF:return o.jsx(Ct,{...c,maskType:"cpf"});case O.CEP:return o.jsx(rn,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case O.HIDDEN:return o.jsx(ba,{name:s,control:t});case O.PARTICIPATION_TYPE:return o.jsx(Mi,{name:s,control:t});case O.PAYMENT_METHOD:return o.jsx(Bi,{name:s,control:t,relatedFieldName:e.relatedFieldName});case O.TERMS:return o.jsx(Ui,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case O.FIELD_ARRAY:return o.jsx(zi,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case O.SUB_FORM:return o.jsx(Uf,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return o.jsx(Be,{...c,type:"text"})}},Zi=()=>{const e=Wo(),t=e.layout.containerStyle,r=["sfr-container overflow-hidden",e.layout.roundness??"rounded-xl",t==="card"?"sfr-container--card border":"",t==="bordered"?"sfr-container--bordered border":"",t==="glassmorphism"?"sfr-container--glass backdrop-blur-sm":""].filter(Boolean).join(" "),a=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},n=["sfr-container__header border-b px-6 py-4",t==="flat"?"border-transparent":""].filter(Boolean).join(" ");return{wrapperClass:r,wrapperStyle:a,headerClass:n,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},Hf=({container:e,control:t})=>{var r;const{externalData:a={}}=dt(),n=e.icone?ct[e.icone]:void 0,s=a,i=E.useMemo(()=>ha(e,s),[e,JSON.stringify(s)]),l=E.useMemo(()=>[...i.campos].sort((v,b)=>v.ordem-b.ordem),[i.campos]),c=ce.useWatch({control:t}),{fieldResolvers:d}=dt(),{wrapperClass:u,wrapperStyle:p,headerClass:m,headerStyle:h,tmpl:g}=Zi(),f=v=>{if(!rt(v.condicional,c,a))return null;let b=v;if(v.resolvePropsKey&&d!=null&&d[v.resolvePropsKey]){const _=d[v.resolvePropsKey](v,c,a);b={...v,..._}}if(b.opcoesFromVar){const _=a[b.opcoesFromVar];Array.isArray(_)&&(b={...b,opcoes:_.map(k=>typeof k=="string"?{valor:k,label:k}:k&&typeof k=="object"&&"valor"in k&&"label"in k?k:{valor:String(k),label:String(k)})})}const w=b.tamanho??12,y=b.inicioColuna,N=y?`${y} / span ${w}`:`span ${w}`,C=o.jsx(qi,{field:b,control:t});return b.tipo===O.CHECKBOX||b.tipo===O.HIDDEN||b.tipo===O.SWITCH?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:N},children:C},b.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:N},children:[o.jsxs("label",{className:"sfr-label font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[b.label,b.obrigatorio&&o.jsx("span",{className:"sfr-required",children:"*"})]}),C,b.hint&&o.jsx("p",{className:"sfr-hint text-xs",style:{color:"var(--t-text-muted)"},children:b.hint})]},b.id)};return o.jsxs("div",{className:u,style:p,children:[(i.titulo||n)&&o.jsx("div",{className:m,style:h,children:o.jsxs("div",{className:"flex items-center gap-3",children:[n&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(n,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=g.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:i.titulo}),i.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:i.descricao})]})]})}),o.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:l.map(f)})]})},Wf=({container:e,control:t})=>{var r;const{externalData:a={}}=dt(),n=e.nome,s=e.minItems??1,i=e.maxItems,l=e.itemLabel??"Item",{fields:c,append:d,remove:u}=ce.useFieldArray({control:t,name:n});E.useEffect(()=>{if(c.length<s)for(let _=c.length;_<s;_++)d({})},[]);const p=e.icone?ct[e.icone]:void 0,m=a,h=E.useMemo(()=>ha(e,m),[e,JSON.stringify(m)]),g=E.useMemo(()=>[...h.campos].sort((_,k)=>_.ordem-k.ordem),[h.campos]),f=ce.useWatch({control:t}),{wrapperClass:v,wrapperStyle:b,headerClass:w,headerStyle:y,tmpl:N}=Zi(),C=(_,k)=>{if(!rt(_.condicional,f,a))return null;const j=`${n}.${k}.${_.nome}`,R=_.tamanho??12,A=_.inicioColuna,I=A?`${A} / span ${R}`:`span ${R}`,F=o.jsx(qi,{field:_,control:t,nameOverride:j});return _.tipo===O.CHECKBOX||_.tipo===O.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:I},children:F},`${_.id}-${k}`):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:I},children:[o.jsxs("label",{className:"sfr-label font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[_.label,_.obrigatorio&&o.jsx("span",{className:"sfr-required",children:"*"})]}),F,_.hint&&o.jsx("p",{className:"sfr-hint text-xs",style:{color:"var(--t-text-muted)"},children:_.hint})]},`${_.id}-${k}`)};return o.jsxs("div",{className:v,style:b,children:[(h.titulo||p)&&o.jsx("div",{className:w,style:y,children:o.jsxs("div",{className:"flex items-center gap-3",children:[p&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(p,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=N.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:h.titulo}),h.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:h.descricao})]})]})}),o.jsxs("div",{className:"p-6 space-y-4",children:[c.map((_,k)=>o.jsxs("div",{className:"sfr-container__repeat-item border rounded-lg p-4",style:{borderColor:"var(--t-border)",background:"color-mix(in srgb, var(--t-surface) 60%, transparent)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:k+1}),o.jsxs("span",{className:"text-sm font-semibold",style:{color:"var(--t-text)"},children:[l," ",k+1]})]}),c.length>s&&o.jsx("button",{type:"button",onClick:()=>u(k),className:"sfr-btn sfr-btn--ghost sfr-error","aria-label":"Remover item",children:o.jsx(P.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:g.map(j=>C(j,k))})]},_.id)),(!i||c.length<i)&&o.jsxs("button",{type:"button",className:"sfr-btn sfr-btn--outline w-full flex items-center justify-center gap-2 py-2 px-4 border rounded-lg text-sm",onClick:()=>d({}),children:[o.jsx(P.Plus,{className:"w-4 h-4"}),"Adicionar ",l.toLowerCase()]}),i&&o.jsxs("p",{className:"text-xs text-center sfr-text-muted",children:["Máximo de ",i," ",l.toLowerCase(),i>1?"s":""]})]})]})},Xi=e=>e.container.repeatable&&e.container.nome?o.jsx(Wf,{...e}):o.jsx(Hf,{...e}),Gi=({step:e,control:t,externalData:r={}})=>{const a=E.useMemo(()=>[...e.containers].sort((s,i)=>s.ordem-i.ordem),[e.containers]),n=ce.useWatch({control:t});return o.jsx("div",{className:"sfr-step grid grid-cols-12 gap-4 sfr-step--animate",children:a.map(s=>{if(s.condicional&&!rt(s.condicional,n,r))return null;const i=s.tamanho??12,l=s.inicioColuna,c=l?`${l} / span ${i}`:`span ${i}`;return o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:o.jsx(Xi,{container:s,control:t})},s.id)})})},Sr=E.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),qf=Sr.Provider,Zf=()=>{const e=ce.useFormContext(),t=E.useContext(Sr);return{change:(r,a)=>e.setValue(r,a,{shouldValidate:!0,shouldDirty:!0}),reset:r=>e.reset(r),submit:t.requestSubmit,getState:()=>{const{errors:r,isDirty:a,isValid:n}=e.formState;return{values:e.getValues(),errors:Object.fromEntries(Object.entries(r).map(([s,i])=>[s,i==null?void 0:i.message])),warnings:t.warnings,dirty:a,valid:n,submitting:t.submitting}}}},Yi=()=>{const e=ce.useFormContext(),t=E.useContext(Sr),r=ce.useWatch({control:e.control}),{errors:a,isDirty:n,isValid:s}=e.formState;return{values:r,errors:Object.fromEntries(Object.entries(a).map(([i,l])=>[i,l==null?void 0:l.message])),warnings:t.warnings,dirty:n,valid:s,submitting:t.submitting}},Xf=e=>{var t;const r=ce.useFormContext(),{warnings:a}=E.useContext(Sr),n=ce.useWatch({control:r.control,name:e}),s=r.getFieldState(e,r.formState);return{value:n,error:(t=s.error)==null?void 0:t.message,warning:a[e],dirty:s.isDirty,touched:s.isTouched,valid:!s.error}},Gf=e=>{var t;const{control:r}=ce.useFormContext(),{warnings:a}=E.useContext(Sr),{field:n,fieldState:s}=ce.useController({name:e,control:r});return{input:{name:n.name,value:n.value,onChange:n.onChange,onBlur:n.onBlur,ref:n.ref},meta:{error:(t=s.error)==null?void 0:t.message,warning:a[e],touched:s.isTouched,dirty:s.isDirty,valid:!s.error}}},Yf=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"sfr-step-indicator flex items-center gap-2 justify-center flex-wrap",children:e.map((a,n)=>{const s=n<t,i=n===t,l=a.icone?ct[a.icone]:void 0;return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{type:"button",onClick:()=>s&&(r==null?void 0:r(n)),disabled:!s,className:"sfr-step-indicator__dot flex items-center justify-center w-8 h-8 rounded-full text-xs font-bold transition-all","data-active":i?"true":void 0,"data-done":s?"true":void 0,title:a.label,children:s?o.jsx(P.Check,{className:"w-4 h-4"}):l?o.jsx(l,{className:"w-4 h-4"}):n+1}),a.label&&o.jsx("span",{className:"text-xs hidden sm:block sfr-step-indicator__label","data-active":i?"true":void 0,children:a.label}),n<e.length-1&&o.jsx("div",{className:"sfr-step-indicator__line w-6 h-0.5","data-done":s?"true":void 0})]},a.id)})}),Kf=({stepIndex:e,totalSteps:t,step:r,defaultValues:a,externalData:n,fieldErrors:s,isSubmitting:i,submitError:l,validatorMapper:c={},onWarningsChange:d,onValuesChange:u,onSubmit:p,onBack:m})=>{const h=e===t-1,g=E.useMemo(()=>Oi(r,n,c),[r.id]),f=E.useMemo(()=>Di(r,n,c),[r.id]),[v,b]=E.useState({}),w=E.useRef(d);w.current=d;const y=n,N=E.useMemo(()=>Ii(r,y),[r,JSON.stringify(y)]),C=ce.useForm({resolver:g,defaultValues:a,mode:"onTouched"}),{control:_,watch:k,setValue:j,handleSubmit:R,setError:A,clearErrors:I}=C;E.useEffect(()=>{I();for(const[z,L]of Object.entries(s))A(z,{type:"server",message:L})},[s,A,I]);const F=E.useMemo(()=>r.containers.flatMap(z=>z.campos).filter(z=>z.condicional&&z.clearedValue!==void 0),[r.containers]),V=E.useMemo(()=>r.containers.flatMap(z=>z.campos).filter(z=>{var L;return z.condicional&&((L=z.setValues)==null?void 0:L.length)}),[r.containers]),M=E.useRef({}),U=ce.useWatch({control:_}),$=E.useRef(u);$.current=u,E.useEffect(()=>{var z;(z=$.current)==null||z.call($,U)},[U]),E.useEffect(()=>{let z=!1;return f(U).then(L=>{var ee;z||(b(L),(ee=w.current)==null||ee.call(w,L))}),()=>{z=!0}},[U,f]),E.useEffect(()=>{var z;if(!F.length&&!V.length)return;const L=U,ee=n;for(const Y of F)if(!rt(Y.condicional,L,n)){const J=Y.clearedValue??"";L[Y.nome]!==J&&j(Y.nome,J,{shouldValidate:!1})}for(const Y of V){const J=rt(Y.condicional,L,n),q=M.current[Y.nome]??!1;if(J&&!q&&(z=Y.setValues)!=null&&z.length)for(const se of Y.setValues){const me=typeof se.valor=="string"?Xe(se.valor,ee):se.valor;j(se.campo,me,{shouldValidate:!1})}M.current[Y.nome]=J}},[U,F,V,n,j]);const T=N.icone?ct[N.icone]:void 0,D=E.useMemo(()=>()=>{C.handleSubmit(p)()},[p]);return o.jsx(ce.FormProvider,{...C,children:o.jsx(qf,{value:{submitting:i,warnings:v,requestSubmit:D},children:o.jsx("form",{onSubmit:R(p),noValidate:!0,onKeyDown:z=>{z.key==="Enter"&&z.target.tagName==="INPUT"&&z.preventDefault()},children:o.jsxs("div",{className:"space-y-6",children:[N.showLabel!==!1&&o.jsxs("div",{className:"text-center space-y-2",children:[T&&o.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(T,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),o.jsx("h2",{className:"sfr-step__title text-2xl font-bold",style:{color:"var(--t-text)"},children:N.titulo}),N.descricao&&o.jsx("p",{className:"sfr-step__desc text-sm",style:{color:"var(--t-text-muted)"},children:N.descricao})]}),o.jsx(Gi,{step:N,control:_,externalData:n}),o.jsxs("div",{className:"sfr-form__nav flex items-center justify-between gap-4 pt-6 pb-2",children:[o.jsxs("button",{type:"button",className:"sfr-btn sfr-btn--outline flex items-center gap-1 px-4 py-2 border rounded-lg text-sm",onClick:m,disabled:e===0,style:e>0?{borderColor:"color-mix(in srgb, var(--t-primary) 40%, transparent)",color:"var(--t-primary)"}:{},children:[o.jsx(P.ChevronLeft,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),o.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden",style:{color:"var(--t-text-muted)"},children:[e+1,"/",t]}),o.jsxs("button",{type:"submit",className:"sfr-btn sfr-btn--primary flex items-center gap-1 px-4 py-2 rounded-lg text-sm font-semibold",disabled:i,style:{background:"var(--t-primary)",color:"#ffffff"},children:[i?o.jsx(P.Loader2,{className:"w-4 h-4 animate-spin"}):h?o.jsx(P.Check,{className:"w-4 h-4"}):o.jsx(P.ChevronRight,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:h?"Finalizar":"Próximo"})]})]}),l&&o.jsx("p",{className:"sfr-error text-sm mt-2 text-center",children:l})]})})})})},Jf=(e,t,r)=>{const a={...t},n=r;for(const s of e.containers)for(const i of s.campos)a[i.nome]===void 0&&(i.initialValue!==void 0?a[i.nome]=typeof i.initialValue=="string"?Xe(i.initialValue,n):i.initialValue:i.defaultValue!==void 0&&(a[i.nome]=i.defaultValue));return a},Qf=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:a,onComplete:n,template:s,formTitle:i,externalData:l={},fieldErrors:c={},uploadFile:d,cepLookup:u,resolveTermsUploadUrl:p,fieldResolvers:m,validatorMapper:h,componentMapper:g,paymentMethodOptions:f,onValuesChange:v,className:b,StepIndicator:w=Yf})=>{const[y,N]=E.useState(()=>r),[C,_]=E.useState({...t}),[k,j]=E.useState(!1),[R,A]=E.useState(null),[I,F]=E.useState({}),V=E.useMemo(()=>ua(s),[s]),M=E.useMemo(()=>[...e.steps].sort((Y,J)=>Y.ordem-J.ordem),[e.steps]),U=M.length,$=M[Math.min(y,U-1)],T=E.useMemo(()=>Jf($,C,l),[$,C,JSON.stringify(l)]),D=E.useMemo(()=>({uploadFile:d,cepLookup:u,resolveTermsUploadUrl:p,externalData:l,fieldResolvers:m,validatorMapper:h,fieldWarnings:I,componentMapper:g,paymentMethodOptions:f}),[d,u,p,m,h,I,g,f,JSON.stringify(l)]),z=E.useCallback(async Y=>{j(!0),A(null);try{const J={...C,...Y};_(J),a&&await a(y,Y),y===U-1?n&&await n(J):N(q=>q+1)}catch(J){console.error("[FormRenderer] Submit error:",J);const q=J instanceof Error?J.message:"Ocorreu um erro. Tente novamente.";A(q)}finally{j(!1)}},[y,C,U,a,n]),L=E.useCallback(()=>{y>0&&N(Y=>Y-1)},[y]),ee=V.layout.eventTitleStyle??"bar";return o.jsx(Jo.Provider,{value:D,children:o.jsx(Ho,{config:V,className:`sfr-root min-h-dvh ${V.wrapperClass??""} ${b??""}`,renderWrapper:!0,children:o.jsxs("div",{className:"sfr-form w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[i&&ee==="bar"&&o.jsx("div",{className:"sfr-form__title w-full text-center text-sm font-medium py-2.5 px-4 mb-6 rounded-lg border",style:{background:"color-mix(in srgb, var(--t-surface) 80%, transparent)",borderColor:"var(--t-border)",color:"var(--t-text-muted)"},children:i}),i&&ee==="inline"&&o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),o.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:i}),o.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),U>1&&o.jsx("div",{className:"mb-8",children:o.jsx(w,{steps:M.map(Y=>({id:Y.id,label:Y.titulo,icone:Y.icone})),currentStep:y,onStepClick:N})}),o.jsx(Kf,{stepIndex:y,totalSteps:U,step:$,defaultValues:T,externalData:l,fieldErrors:c,isSubmitting:k,submitError:R,validatorMapper:h,onWarningsChange:F,onValuesChange:v,onSubmit:z,onBack:L},y)]})})})},eh=({children:e,render:t,onChange:r})=>{const a=Yi(),n=E.useRef(r);return n.current=r,E.useEffect(()=>{var s;(s=n.current)==null||s.call(n,a)},[a.values,a.dirty,a.valid,a.submitting,a.errors,a.warnings]),t?o.jsx(o.Fragment,{children:t(a)}):typeof e=="function"?o.jsx(o.Fragment,{children:e(a)}):e!==void 0?o.jsx(o.Fragment,{children:e}):null},St=[{component:"texto",label:"Texto",icon:P.Type,group:"texto"},{component:"textarea",label:"Área de texto",icon:P.AlignLeft,group:"texto"},{component:"number",label:"Número",icon:P.Hash,group:"texto"},{component:"email",label:"E-mail",icon:P.Mail,group:"texto"},{component:"password",label:"Senha",icon:P.Lock,group:"texto"},{component:"select",label:"Seleção",icon:P.ChevronDown,group:"selecao"},{component:"autocomplete",label:"Autocomplete",icon:P.Search,group:"selecao"},{component:"radio",label:"Radio",icon:P.CircleDot,group:"selecao"},{component:"checkbox",label:"Checkbox",icon:P.CheckSquare,group:"selecao"},{component:"checkbox_group",label:"Grupo de checkboxes",icon:P.ListChecks,group:"selecao"},{component:"switch",label:"Switch (toggle)",icon:P.ToggleLeft,group:"selecao"},{component:"slider",label:"Slider",icon:P.SlidersHorizontal,group:"range"},{component:"rating",label:"Avaliação (estrelas)",icon:P.Star,group:"range"},{component:"color",label:"Cor",icon:P.Palette,group:"range"},{component:"date",label:"Data",icon:P.Calendar,group:"data"},{component:"datetime",label:"Data e hora",icon:P.Clock,group:"data"},{component:"time",label:"Horário",icon:P.Timer,group:"data"},{component:"date_range",label:"Período",icon:P.CalendarRange,group:"data"},{component:"telefone",label:"Telefone",icon:P.Phone,group:"contato"},{component:"cpf",label:"CPF",icon:P.CreditCard,group:"contato"},{component:"cep",label:"CEP",icon:P.MapPin,group:"contato"},{component:"file",label:"Arquivo",icon:P.Upload,group:"outros"},{component:"hidden",label:"Oculto",icon:P.EyeOff,group:"outros"},{component:"field_array",label:"Lista de itens",icon:P.List,group:"outros"},{component:"terms",label:"Termos e condições",icon:P.ScrollText,group:"outros"},{component:"sub_form",label:"Sub-formulário",icon:P.LayoutList,group:"outros"}],an=[{component:"step",label:"Step",icon:P.Layers,color:"border-primary/40 bg-primary/5"},{component:"container",label:"Container",icon:P.BoxSelect,color:"border-blue-500/40 bg-blue-500/5"}],on=[{key:"evento.nome",label:"Nome do evento",type:"string"},{key:"evento.descricao",label:"Descrição",type:"string"},{key:"evento.valor",label:"Valor (centavos)",type:"number"},{key:"evento.valorPorDia",label:"Valor por dia",type:"number"},{key:"evento.vagasTotal",label:"Vagas totais",type:"number"},{key:"evento.vagasPorDia",label:"Vagas por dia",type:"number"},{key:"evento.vagasMasculinas",label:"Vagas masculinas",type:"number"},{key:"evento.vagasFemininas",label:"Vagas femininas",type:"number"},{key:"evento.dataInicioEvento",label:"Data início",type:"date"},{key:"evento.dataFimEvento",label:"Data fim",type:"date"},{key:"evento.dataAberturaInscricoes",label:"Abertura inscrições",type:"date"},{key:"evento.localNome",label:"Local - Nome",type:"string"},{key:"evento.localEndereco",label:"Local - Endereço",type:"string"},{key:"evento.localTelefone",label:"Local - Telefone",type:"string"},{key:"evento.localMapUrl",label:"Local - URL do mapa",type:"string"},{key:"evento.localMapLink",label:"Local - Link do mapa",type:"string"},{key:"evento.status",label:"Status do evento",type:"string"},{key:"evento.publicId",label:"ID público (URL)",type:"string"},{key:"evento.fotoCapa",label:"URL da foto de capa",type:"string"},{key:"evento.template",label:"Template visual",type:"string"}],Ne=e=>e.startsWith("step-")||e==="step"?"step":e.startsWith("container-")||e==="container"?"container":"field",th=e=>St.find(t=>t.component===e),Ki=e=>{const t=St.map(a=>a.component).filter(a=>a.includes("_"));for(const a of t)if(e.startsWith(a))return St.find(n=>n.component===a);const r=e.split("-")[0];return St.find(a=>a.component===r)},Ji=E.createContext(null),rh=e=>{if(e.startsWith("step"))return"step";if(e.startsWith("container"))return"container";const t=e.match(/^([a-z_]+)-/);return t?t[1]:e.split("-")[0]},to=(e,t)=>{const r=t||rh(e),a=r==="step",n=r==="container",s=r==="field_array";return{label:a?"Novo Step":n?"Novo Container":s?"Lista de itens":r||e,name:e,fieldType:r||"texto",required:!1,columns:2,tamanho:n||s?12:a?void 0:6,showLabel:n?!0:void 0,itemLabel:s?"Item":void 0}},ro=e=>({containers:JSON.parse(JSON.stringify(e.containers)),configs:JSON.parse(JSON.stringify(e.configs))}),Qi=(e,t)=>{const r=[e],a=t[e];if(a!=null&&a.children)for(const n of a.children)r.push(...Qi(n,t));return r},el=(e,t)=>{for(const[r,a]of Object.entries(t))if(a.children.includes(e))return r;return null},tl=({children:e,initialConfigs:t,initialContainers:r,initialTemplateId:a,schemaId:n,uploadTermsPdf:s})=>{const[i,l]=E.useState({selectedId:null,configs:t||{},showPreview:!1,containers:r??{root:{children:[]}},previewTemplateId:a||"moderno"}),[c,d]=E.useState(null),[u,p]=E.useState(null),m=E.useRef([]),h=E.useRef([]),g=$=>{m.current=[...m.current.slice(-49),ro($)],h.current=[]},f=E.useCallback(()=>{l($=>(g($),{...$}))},[]),v=E.useCallback(()=>{m.current.length!==0&&l($=>{h.current=[...h.current,ro($)];const T=m.current.pop();return{...$,containers:T.containers,configs:T.configs}})},[]),b=E.useCallback(()=>{h.current.length!==0&&l($=>{m.current=[...m.current,ro($)];const T=h.current.pop();return{...$,containers:T.containers,configs:T.configs}})},[]);E.useEffect(()=>{const $=T=>{const D=T.metaKey||T.ctrlKey;D&&T.key==="z"&&!T.shiftKey&&(T.preventDefault(),v()),D&&T.key==="z"&&T.shiftKey&&(T.preventDefault(),b()),D&&T.key==="y"&&(T.preventDefault(),b())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[v,b]);const w=E.useCallback($=>i.configs[$]??to($),[i.configs]),y=E.useCallback(()=>{const $=[],T=D=>{var z;const L=((z=i.containers[D])==null?void 0:z.children)??[];for(const ee of L)Ne(ee)==="field"?$.push(ee):i.containers[ee]&&T(ee)};return T("root"),$},[i.containers]),N=E.useCallback($=>{l(T=>({...T,selectedId:$}))},[]),C=E.useCallback($=>{l(T=>({...T,showPreview:$}))},[]),_=E.useCallback($=>{l(T=>({...T,previewTemplateId:$}))},[]),k=E.useCallback(($,T)=>{l(D=>({...D,configs:{...D.configs,[$]:{...D.configs[$]??to($),...T}}}))},[]),j=E.useCallback(($,T,D)=>{const z=`${$}-${Fe()}`,L=Ne(z);return l(ee=>{var Y;g(ee);const J={...ee.containers};(L==="step"||L==="container"||$==="field_array")&&(J[z]={children:[]});const q=[...((Y=J[T])==null?void 0:Y.children)??[]];return D!==void 0&&D>=0?q.splice(D,0,z):q.push(z),J[T]={children:q},{...ee,containers:J,configs:{...ee.configs,[z]:to(z,$)},selectedId:z}}),z},[]),R=E.useCallback(($,T)=>{const D=`container-${Fe()}`;return l(z=>{var L,ee,Y;g(z);const J={...z.containers},q={...z.configs},se=[];for(const H of $.containerTemplate.campos){const ie=H.locked?H.id:`${String(H.tipo).toLowerCase()}-${Fe()}`;if(se.push(ie),q[ie]={label:H.label,name:H.locked?H.id:H.nome,fieldType:H.tipo,required:H.obrigatorio||!1,placeholder:H.placeholder,hint:H.hint,tamanho:H.tamanho||6,inicioColuna:H.inicioColuna,defaultValue:H.defaultValue!=null?String(H.defaultValue):void 0,locked:H.locked||!1,options:(L=H.opcoes)==null?void 0:L.map(te=>({value:te.valor,label:te.label})),...H.tipo==="field_array"&&{itemLabel:H.itemLabel,minItems:H.minItems,maxItems:H.maxItems,addLabel:H.addLabel}},H.tipo==="field_array"){const te=[];for(const re of H.subFields??[]){const Q=`${String(re.tipo).toLowerCase()}-${Fe()}`;te.push(Q),q[Q]={label:re.label,name:re.nome,fieldType:re.tipo,required:re.obrigatorio||!1,placeholder:re.placeholder,hint:re.hint,tamanho:re.tamanho||6,inicioColuna:re.inicioColuna,options:(ee=re.opcoes)==null?void 0:ee.map(fe=>({value:fe.valor,label:fe.label}))}}J[ie]={children:te}}}J[D]={children:se},q[D]={label:$.containerTemplate.titulo||$.name,description:$.containerTemplate.descricao,icone:$.containerTemplate.icone,tamanho:$.containerTemplate.tamanho||12,inicioColuna:$.containerTemplate.inicioColuna,showLabel:!0};const me=[...((Y=J[T])==null?void 0:Y.children)??[]];return me.push(D),J[T]={children:me},{...z,containers:J,configs:q,selectedId:D}}),D},[]),A=E.useCallback($=>{const T=[];return l(D=>{var z,L,ee;g(D);const Y={...D.containers},J={...D.configs};for(const q of $.steps){const se=`step-${Fe()}`;T.push(se);const me=[];for(const ie of q.containers){const te=`container-${Fe()}`;me.push(te);const re=[];for(const Q of ie.campos){const fe=Q.locked?Q.id:`${String(Q.tipo).toLowerCase()}-${Fe()}`;if(re.push(fe),J[fe]={label:Q.label,name:Q.locked?Q.id:Q.nome,fieldType:Q.tipo,required:Q.obrigatorio||!1,placeholder:Q.placeholder,hint:Q.hint,tamanho:Q.tamanho||12,inicioColuna:Q.inicioColuna,defaultValue:Q.defaultValue!=null?String(Q.defaultValue):void 0,locked:Q.locked||!1,options:(z=Q.opcoes)==null?void 0:z.map(we=>({value:we.valor,label:we.label})),...Q.tipo==="field_array"&&{itemLabel:Q.itemLabel,minItems:Q.minItems,maxItems:Q.maxItems,addLabel:Q.addLabel}},Q.tipo==="field_array"){const we=[];for(const je of Q.subFields??[]){const Me=`${String(je.tipo).toLowerCase()}-${Fe()}`;we.push(Me),J[Me]={label:je.label,name:je.nome,fieldType:je.tipo,required:je.obrigatorio||!1,placeholder:je.placeholder,hint:je.hint,tamanho:je.tamanho||6,inicioColuna:je.inicioColuna,options:(L=je.opcoes)==null?void 0:L.map(Ae=>({value:Ae.valor,label:Ae.label}))}}Y[fe]={children:we}}}Y[te]={children:re},J[te]={label:ie.titulo,description:ie.descricao,icone:ie.icone,tamanho:ie.tamanho||12,showLabel:!0}}Y[se]={children:me},J[se]={label:q.titulo,description:q.descricao,icone:q.icone};const H=[...((ee=Y.root)==null?void 0:ee.children)??[],se];Y.root={children:H}}return{...D,containers:Y,configs:J,selectedId:T[0]??D.selectedId}}),T},[]),I=E.useCallback(($,T,D,z)=>{l(L=>{var ee,Y;g(L);const J={...L.containers},q=(((ee=J[T])==null?void 0:ee.children)??[]).filter(H=>H!==$);J[T]={children:q};const se=[...(((Y=J[D])==null?void 0:Y.children)??[]).filter(H=>H!==$)],me=Math.max(0,Math.min(z,se.length));return se.splice(me,0,$),J[D]={children:se},{...L,containers:J}})},[]),F=E.useCallback(($,T)=>{l(D=>(g(D),{...D,containers:{...D.containers,[$]:{children:T}}}))},[]),V=E.useCallback($=>{l(T=>{g(T);const D=Qi($,T.containers),z={};for(const[ee,Y]of Object.entries(T.containers))D.includes(ee)||(z[ee]={children:Y.children.filter(J=>J!==$)});const L={...T.configs};for(const ee of D)delete L[ee];return{...T,containers:z,configs:L,selectedId:D.includes(T.selectedId??"")?null:T.selectedId}})},[]),M=E.useCallback(($,T)=>{l(D=>{const z=el($,D.containers);if(!z)return D;const L=[...D.containers[z].children],ee=L.indexOf($),Y=T==="up"?ee-1:ee+1;return Y<0||Y>=L.length?D:([L[ee],L[Y]]=[L[Y],L[ee]],{...D,containers:{...D.containers,[z]:{children:L}}})})},[]),U=E.useCallback(($,T)=>{f(),M($,T)},[M,f]);return o.jsx(Ji.Provider,{value:{selectedId:i.selectedId,configs:i.configs,showPreview:i.showPreview,containers:i.containers,positionDrag:c,reorderDrag:u,canUndo:m.current.length>0,canRedo:h.current.length>0,schemaId:n,uploadTermsPdf:s,previewTemplateId:i.previewTemplateId,setPreviewTemplateId:_,getConfig:w,getAllFieldIds:y,setSelected:N,updateConfig:k,setShowPreview:C,addItem:j,addPresetBlock:R,addPresetStepBlock:A,moveCanvasItem:I,reorderInContainer:F,removeItem:V,moveItem:U,moveItemNoSnapshot:M,setPositionDrag:d,setReorderDrag:p,undo:v,redo:b,pushSnapshot:f},children:e})},Je=()=>{const e=E.useContext(Ji);if(!e)throw new Error("useBuilder must be inside BuilderProvider");return e};function Ss(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function nn(...e){return t=>{let r=!1;const a=e.map(n=>{const s=Ss(n,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let n=0;n<a.length;n++){const s=a[n];typeof s=="function"?s():Ss(e[n],null)}}}}function pe(...e){return x.useCallback(nn(...e),e)}var ah=Symbol.for("react.lazy"),Kr=x[" use ".trim().toString()];function oh(e){return typeof e=="object"&&e!==null&&"then"in e}function rl(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===ah&&"_payload"in e&&oh(e._payload)}function al(e){const t=sh(e),r=x.forwardRef((a,n)=>{let{children:s,...i}=a;rl(s)&&typeof Kr=="function"&&(s=Kr(s._payload));const l=x.Children.toArray(s),c=l.find(lh);if(c){const d=c.props.children,u=l.map(p=>p===c?x.Children.count(d)>1?x.Children.only(null):x.isValidElement(d)?d.props.children:null:p);return o.jsx(t,{...i,ref:n,children:x.isValidElement(d)?x.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:n,children:s})});return r.displayName=`${e}.Slot`,r}var nh=al("Slot");function sh(e){const t=x.forwardRef((r,a)=>{let{children:n,...s}=r;if(rl(n)&&typeof Kr=="function"&&(n=Kr(n._payload)),x.isValidElement(n)){const i=dh(n),l=ch(s,n.props);return n.type!==x.Fragment&&(l.ref=a?nn(a,i):i),x.cloneElement(n,l)}return x.Children.count(n)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ih=Symbol("radix.slottable");function lh(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ih}function ch(e,t){const r={...t};for(const a in t){const n=e[a],s=t[a];/^on[A-Z]/.test(a)?n&&s?r[a]=(...i)=>{const l=s(...i);return n(...i),l}:n&&(r[a]=n):a==="style"?r[a]={...n,...s}:a==="className"&&(r[a]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}function dh(e){var t,r;let a=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;return n?e.ref:(a=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var uh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ya=uh.reduce((e,t)=>{const r=al(`Primitive.${t}`),a=x.forwardRef((n,s)=>{const{asChild:i,...l}=n,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),ph="Separator",ks="horizontal",mh=["horizontal","vertical"],ol=x.forwardRef((e,t)=>{const{decorative:r,orientation:a=ks,...n}=e,s=fh(a)?a:ks,i=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return o.jsx(ya.div,{"data-orientation":s,...i,...n,ref:t})});ol.displayName=ph;function fh(e){return mh.includes(e)}var nl=ol;function sl(e){var t,r,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=sl(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function il(){for(var e,t,r=0,a="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=sl(e))&&(a&&(a+=" "),a+=t);return a}const hh=(e,t)=>{const r=new Array(e.length+t.length);for(let a=0;a<e.length;a++)r[a]=e[a];for(let a=0;a<t.length;a++)r[e.length+a]=t[a];return r},xh=(e,t)=>({classGroupId:e,validator:t}),ll=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Jr="-",_s=[],gh="arbitrary..",vh=e=>{const t=yh(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:n=>{if(n.startsWith("[")&&n.endsWith("]"))return bh(n);const s=n.split(Jr),i=s[0]===""&&s.length>1?1:0;return cl(s,i,t)},getConflictingClassGroupIds:(n,s)=>{if(s){const i=a[n],l=r[n];return i?l?hh(l,i):i:l||_s}return r[n]||_s}}},cl=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const a=e[t],n=r.nextPart.get(a);if(n){const c=cl(e,t+1,n);if(c)return c}const s=r.validators;if(s===null)return;const i=t===0?e.join(Jr):e.slice(t).join(Jr),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(i))return d.classGroupId}},bh=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),a=t.slice(0,r);return a?gh+a:void 0})(),yh=e=>{const{theme:t,classGroups:r}=e;return wh(r,t)},wh=(e,t)=>{const r=ll();for(const a in e){const n=e[a];sn(n,r,a,t)}return r},sn=(e,t,r,a)=>{const n=e.length;for(let s=0;s<n;s++){const i=e[s];jh(i,t,r,a)}},jh=(e,t,r,a)=>{if(typeof e=="string"){Nh(e,t,r);return}if(typeof e=="function"){Ch(e,t,r,a);return}Sh(e,t,r,a)},Nh=(e,t,r)=>{const a=e===""?t:dl(t,e);a.classGroupId=r},Ch=(e,t,r,a)=>{if(kh(e)){sn(e(a),t,r,a);return}t.validators===null&&(t.validators=[]),t.validators.push(xh(r,e))},Sh=(e,t,r,a)=>{const n=Object.entries(e),s=n.length;for(let i=0;i<s;i++){const[l,c]=n[i];sn(c,dl(t,l),r,a)}},dl=(e,t)=>{let r=e;const a=t.split(Jr),n=a.length;for(let s=0;s<n;s++){const i=a[s];let l=r.nextPart.get(i);l||(l=ll(),r.nextPart.set(i,l)),r=l}return r},kh=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,_h=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),a=Object.create(null);const n=(s,i)=>{r[s]=i,t++,t>e&&(t=0,a=r,r=Object.create(null))};return{get(s){let i=r[s];if(i!==void 0)return i;if((i=a[s])!==void 0)return n(s,i),i},set(s,i){s in r?r[s]=i:n(s,i)}}},jo="!",Es=":",Eh=[],Ps=(e,t,r,a,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:a,isExternal:n}),Ph=e=>{const{prefix:t,experimentalParseClassName:r}=e;let a=n=>{const s=[];let i=0,l=0,c=0,d;const u=n.length;for(let f=0;f<u;f++){const v=n[f];if(i===0&&l===0){if(v===Es){s.push(n.slice(c,f)),c=f+1;continue}if(v==="/"){d=f;continue}}v==="["?i++:v==="]"?i--:v==="("?l++:v===")"&&l--}const p=s.length===0?n:n.slice(c);let m=p,h=!1;p.endsWith(jo)?(m=p.slice(0,-1),h=!0):p.startsWith(jo)&&(m=p.slice(1),h=!0);const g=d&&d>c?d-c:void 0;return Ps(s,h,m,g)};if(t){const n=t+Es,s=a;a=i=>i.startsWith(n)?s(i.slice(n.length)):Ps(Eh,!1,i,void 0,!0)}if(r){const n=a;a=s=>r({className:s,parseClassName:n})}return a},Th=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,a)=>{t.set(r,1e6+a)}),r=>{const a=[];let n=[];for(let s=0;s<r.length;s++){const i=r[s],l=i[0]==="[",c=t.has(i);l||c?(n.length>0&&(n.sort(),a.push(...n),n=[]),a.push(i)):n.push(i)}return n.length>0&&(n.sort(),a.push(...n)),a}},$h=e=>({cache:_h(e.cacheSize),parseClassName:Ph(e),sortModifiers:Th(e),...vh(e)}),Rh=/\s+/,Oh=(e,t)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:n,sortModifiers:s}=t,i=[],l=e.trim().split(Rh);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:m,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:f}=r(u);if(p){c=u+(c.length>0?" "+c:c);continue}let v=!!f,b=a(v?g.substring(0,f):g);if(!b){if(!v){c=u+(c.length>0?" "+c:c);continue}if(b=a(g),!b){c=u+(c.length>0?" "+c:c);continue}v=!1}const w=m.length===0?"":m.length===1?m[0]:s(m).join(":"),y=h?w+jo:w,N=y+b;if(i.indexOf(N)>-1)continue;i.push(N);const C=n(b,v);for(let _=0;_<C.length;++_){const k=C[_];i.push(y+k)}c=u+(c.length>0?" "+c:c)}return c},Dh=(...e)=>{let t=0,r,a,n="";for(;t<e.length;)(r=e[t++])&&(a=ul(r))&&(n&&(n+=" "),n+=a);return n},ul=e=>{if(typeof e=="string")return e;let t,r="";for(let a=0;a<e.length;a++)e[a]&&(t=ul(e[a]))&&(r&&(r+=" "),r+=t);return r},Ah=(e,...t)=>{let r,a,n,s;const i=c=>{const d=t.reduce((u,p)=>p(u),e());return r=$h(d),a=r.cache.get,n=r.cache.set,s=l,l(c)},l=c=>{const d=a(c);if(d)return d;const u=Oh(c,r);return n(c,u),u};return s=i,(...c)=>s(Dh(...c))},Ih=[],_e=e=>{const t=r=>r[e]||Ih;return t.isThemeGetter=!0,t},pl=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ml=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Lh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,zh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Mh=/\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$/,Fh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Vh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Bh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wt=e=>Lh.test(e),ue=e=>!!e&&!Number.isNaN(Number(e)),jt=e=>!!e&&Number.isInteger(Number(e)),ao=e=>e.endsWith("%")&&ue(e.slice(0,-1)),ft=e=>zh.test(e),fl=()=>!0,Uh=e=>Mh.test(e)&&!Fh.test(e),ln=()=>!1,Hh=e=>Vh.test(e),Wh=e=>Bh.test(e),qh=e=>!X(e)&&!K(e),Zh=e=>$t(e,gl,ln),X=e=>pl.test(e),It=e=>$t(e,vl,Uh),Ts=e=>$t(e,tx,ue),Xh=e=>$t(e,yl,fl),Gh=e=>$t(e,bl,ln),$s=e=>$t(e,hl,ln),Yh=e=>$t(e,xl,Wh),zr=e=>$t(e,wl,Hh),K=e=>ml.test(e),gr=e=>qt(e,vl),Kh=e=>qt(e,bl),Rs=e=>qt(e,hl),Jh=e=>qt(e,gl),Qh=e=>qt(e,xl),Mr=e=>qt(e,wl,!0),ex=e=>qt(e,yl,!0),$t=(e,t,r)=>{const a=pl.exec(e);return a?a[1]?t(a[1]):r(a[2]):!1},qt=(e,t,r=!1)=>{const a=ml.exec(e);return a?a[1]?t(a[1]):r:!1},hl=e=>e==="position"||e==="percentage",xl=e=>e==="image"||e==="url",gl=e=>e==="length"||e==="size"||e==="bg-size",vl=e=>e==="length",tx=e=>e==="number",bl=e=>e==="family-name",yl=e=>e==="number"||e==="weight",wl=e=>e==="shadow",rx=()=>{const e=_e("color"),t=_e("font"),r=_e("text"),a=_e("font-weight"),n=_e("tracking"),s=_e("leading"),i=_e("breakpoint"),l=_e("container"),c=_e("spacing"),d=_e("radius"),u=_e("shadow"),p=_e("inset-shadow"),m=_e("text-shadow"),h=_e("drop-shadow"),g=_e("blur"),f=_e("perspective"),v=_e("aspect"),b=_e("ease"),w=_e("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...N(),K,X],_=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],j=()=>[K,X,c],R=()=>[wt,"full","auto",...j()],A=()=>[jt,"none","subgrid",K,X],I=()=>["auto",{span:["full",jt,K,X]},jt,K,X],F=()=>[jt,"auto",K,X],V=()=>["auto","min","max","fr",K,X],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...j()],T=()=>[wt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],D=()=>[wt,"screen","full","dvw","lvw","svw","min","max","fit",...j()],z=()=>[wt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],L=()=>[e,K,X],ee=()=>[...N(),Rs,$s,{position:[K,X]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",Jh,Zh,{size:[K,X]}],q=()=>[ao,gr,It],se=()=>["","none","full",d,K,X],me=()=>["",ue,gr,It],H=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[ue,ao,Rs,$s],re=()=>["","none",g,K,X],Q=()=>["none",ue,K,X],fe=()=>["none",ue,K,X],we=()=>[ue,K,X],je=()=>[wt,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ft],breakpoint:[ft],color:[fl],container:[ft],"drop-shadow":[ft],ease:["in","out","in-out"],font:[qh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ft],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ft],shadow:[ft],spacing:["px",ue],text:[ft],"text-shadow":[ft],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wt,X,K,v]}],container:["container"],columns:[{columns:[ue,X,K,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:C()}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{"inset-s":R(),start:R()}],end:[{"inset-e":R(),end:R()}],"inset-bs":[{"inset-bs":R()}],"inset-be":[{"inset-be":R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[jt,"auto",K,X]}],basis:[{basis:[wt,"full","auto",l,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ue,wt,"auto","initial","none",X]}],grow:[{grow:["",ue,K,X]}],shrink:[{shrink:["",ue,K,X]}],order:[{order:[jt,"first","last","none",K,X]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:T()}],"inline-size":[{inline:["auto",...D()]}],"min-inline-size":[{"min-inline":["auto",...D()]}],"max-inline-size":[{"max-inline":["none",...D()]}],"block-size":[{block:["auto",...z()]}],"min-block-size":[{"min-block":["auto",...z()]}],"max-block-size":[{"max-block":["none",...z()]}],w:[{w:[l,"screen",...T()]}],"min-w":[{"min-w":[l,"screen","none",...T()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...T()]}],h:[{h:["screen","lh",...T()]}],"min-h":[{"min-h":["screen","lh","none",...T()]}],"max-h":[{"max-h":["screen","lh",...T()]}],"font-size":[{text:["base",r,gr,It]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,ex,Xh]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ao,X]}],"font-family":[{font:[Kh,Gh,t]}],"font-features":[{"font-features":[X]}],"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,K,X]}],"line-clamp":[{"line-clamp":[ue,"none",K,Ts]}],leading:[{leading:[s,...j()]}],"list-image":[{"list-image":["none",K,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",K,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:[ue,"from-font","auto",K,It]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[ue,"auto",K,X]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",K,X]}],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",K,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},jt,K,X],radial:["",K,X],conic:[jt,K,X]},Qh,Yh]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:me()}],"border-w-x":[{"border-x":me()}],"border-w-y":[{"border-y":me()}],"border-w-s":[{"border-s":me()}],"border-w-e":[{"border-e":me()}],"border-w-bs":[{"border-bs":me()}],"border-w-be":[{"border-be":me()}],"border-w-t":[{"border-t":me()}],"border-w-r":[{"border-r":me()}],"border-w-b":[{"border-b":me()}],"border-w-l":[{"border-l":me()}],"divide-x":[{"divide-x":me()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":me()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...H(),"hidden","none"]}],"divide-style":[{divide:[...H(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...H(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ue,K,X]}],"outline-w":[{outline:["",ue,gr,It]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",u,Mr,zr]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",p,Mr,zr]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[ue,It]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":me()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",m,Mr,zr]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[ue,K,X]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"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":[ue]}],"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":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"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":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"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":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"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":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"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":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"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":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"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":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[K,X]}],"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":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"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":N()}],"mask-image-conic-pos":[{"mask-conic":[ue]}],"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":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",K,X]}],filter:[{filter:["","none",K,X]}],blur:[{blur:re()}],brightness:[{brightness:[ue,K,X]}],contrast:[{contrast:[ue,K,X]}],"drop-shadow":[{"drop-shadow":["","none",h,Mr,zr]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",ue,K,X]}],"hue-rotate":[{"hue-rotate":[ue,K,X]}],invert:[{invert:["",ue,K,X]}],saturate:[{saturate:[ue,K,X]}],sepia:[{sepia:["",ue,K,X]}],"backdrop-filter":[{"backdrop-filter":["","none",K,X]}],"backdrop-blur":[{"backdrop-blur":re()}],"backdrop-brightness":[{"backdrop-brightness":[ue,K,X]}],"backdrop-contrast":[{"backdrop-contrast":[ue,K,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ue,K,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ue,K,X]}],"backdrop-invert":[{"backdrop-invert":["",ue,K,X]}],"backdrop-opacity":[{"backdrop-opacity":[ue,K,X]}],"backdrop-saturate":[{"backdrop-saturate":[ue,K,X]}],"backdrop-sepia":[{"backdrop-sepia":["",ue,K,X]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",K,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ue,"initial",K,X]}],ease:[{ease:["linear","initial",b,K,X]}],delay:[{delay:[ue,K,X]}],animate:[{animate:["none",w,K,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,K,X]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:Q()}],"rotate-x":[{"rotate-x":Q()}],"rotate-y":[{"rotate-y":Q()}],"rotate-z":[{"rotate-z":Q()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[K,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:je()}],"translate-x":[{"translate-x":je()}],"translate-y":[{"translate-y":je()}],"translate-z":[{"translate-z":je()}],"translate-none":["translate-none"],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"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",K,X]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"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",K,X]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[ue,gr,It,Ts]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},ax=Ah(rx);function G(...e){return ax(il(e))}const Ze=x.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...a},n)=>o.jsx(nl,{ref:n,decorative:r,orientation:t,className:G("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...a}));Ze.displayName=nl.displayName;const ae=x.forwardRef(({className:e,type:t,...r},a)=>o.jsx("input",{type:t,className:G("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background 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-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:a,...r}));ae.displayName="Input";var ox="Label",jl=x.forwardRef((e,t)=>o.jsx(ya.label,{...e,ref:t,onMouseDown:r=>{var a;r.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));jl.displayName=ox;var Nl=jl;const Os=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ds=il,cn=(e,t)=>r=>{var a;if((t==null?void 0:t.variants)==null)return Ds(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:s}=t,i=Object.keys(n).map(d=>{const u=r==null?void 0:r[d],p=s==null?void 0:s[d];if(u===null)return null;const m=Os(u)||Os(p);return n[d][m]}),l=r&&Object.entries(r).reduce((d,u)=>{let[p,m]=u;return m===void 0||(d[p]=m),d},{}),c=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((d,u)=>{let{class:p,className:m,...h}=u;return Object.entries(h).every(g=>{let[f,v]=g;return Array.isArray(v)?v.includes({...s,...l}[f]):{...s,...l}[f]===v})?[...d,p,m]:d},[]);return Ds(e,i,c,r==null?void 0:r.class,r==null?void 0:r.className)},nx=cn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),W=x.forwardRef(({className:e,...t},r)=>o.jsx(Nl,{ref:r,className:G(nx(),e),...t}));W.displayName=Nl.displayName;function sx(e,t){const r=x.createContext(t),a=s=>{const{children:i,...l}=s,c=x.useMemo(()=>l,Object.values(l));return o.jsx(r.Provider,{value:c,children:i})};a.displayName=e+"Provider";function n(s){const i=x.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[a,n]}function bt(e,t=[]){let r=[];function a(s,i){const l=x.createContext(i),c=r.length;r=[...r,i];const d=p=>{var m;const{scope:h,children:g,...f}=p,v=((m=h==null?void 0:h[e])==null?void 0:m[c])||l,b=x.useMemo(()=>f,Object.values(f));return o.jsx(v.Provider,{value:b,children:g})};d.displayName=s+"Provider";function u(p,m){var h;const g=((h=m==null?void 0:m[e])==null?void 0:h[c])||l,f=x.useContext(g);if(f)return f;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[d,u]}const n=()=>{const s=r.map(i=>x.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return x.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return n.scopeName=e,[a,ix(n,...t)]}function ix(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const a=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(n){const s=a.reduce((i,{useScope:l,scopeName:c})=>{const d=l(n)[`__scope${c}`];return{...i,...d}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function oe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e==null||e(a),r===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}var Ee=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},lx=x[" useInsertionEffect ".trim().toString()]||Ee;function Vt({prop:e,defaultProp:t,onChange:r=()=>{},caller:a}){const[n,s,i]=cx({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:n;{const u=x.useRef(e!==void 0);x.useEffect(()=>{const p=u.current;p!==l&&console.warn(`${a} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,a])}const d=x.useCallback(u=>{var p;if(l){const m=dx(u)?u(e):u;m!==e&&((p=i.current)==null||p.call(i,m))}else s(u)},[l,e,s,i]);return[c,d]}function cx({defaultProp:e,onChange:t}){const[r,a]=x.useState(e),n=x.useRef(r),s=x.useRef(t);return lx(()=>{s.current=t},[t]),x.useEffect(()=>{var i;n.current!==r&&((i=s.current)==null||i.call(s,r),n.current=r)},[r,n]),[r,a,s]}function dx(e){return typeof e=="function"}function dn(e){const t=x.useRef({value:e,previous:e});return x.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function un(e){const[t,r]=x.useState(void 0);return Ee(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const s=n[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;r({width:i,height:l})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else r(void 0)},[e]),t}function ux(e,t){return x.useReducer((r,a)=>t[r][a]??r,e)}var Qe=e=>{const{present:t,children:r}=e,a=px(t),n=typeof r=="function"?r({present:a.isPresent}):x.Children.only(r),s=pe(a.ref,mx(n));return typeof r=="function"||a.isPresent?x.cloneElement(n,{ref:s}):null};Qe.displayName="Presence";function px(e){const[t,r]=x.useState(),a=x.useRef(null),n=x.useRef(e),s=x.useRef("none"),i=e?"mounted":"unmounted",[l,c]=ux(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const d=Fr(a.current);s.current=l==="mounted"?d:"none"},[l]),Ee(()=>{const d=a.current,u=n.current;if(u!==e){const p=s.current,m=Fr(d);e?c("MOUNT"):m==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&p!==m?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,c]),Ee(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,p=h=>{const g=Fr(a.current).includes(CSS.escape(h.animationName));if(h.target===t&&g&&(c("ANIMATION_END"),!n.current)){const f=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=f)})}},m=h=>{h.target===t&&(s.current=Fr(a.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:x.useCallback(d=>{a.current=d?getComputedStyle(d):null,r(d)},[])}}function Fr(e){return(e==null?void 0:e.animationName)||"none"}function mx(e){var t,r;let a=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;return n?e.ref:(a=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function or(e){const t=fx(e),r=x.forwardRef((a,n)=>{const{children:s,...i}=a,l=x.Children.toArray(s),c=l.find(xx);if(c){const d=c.props.children,u=l.map(p=>p===c?x.Children.count(d)>1?x.Children.only(null):x.isValidElement(d)?d.props.children:null:p);return o.jsx(t,{...i,ref:n,children:x.isValidElement(d)?x.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:n,children:s})});return r.displayName=`${e}.Slot`,r}function fx(e){const t=x.forwardRef((r,a)=>{const{children:n,...s}=r;if(x.isValidElement(n)){const i=vx(n),l=gx(s,n.props);return n.type!==x.Fragment&&(l.ref=a?nn(a,i):i),x.cloneElement(n,l)}return x.Children.count(n)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Cl=Symbol("radix.slottable");function hx(e){const t=({children:r})=>o.jsx(o.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Cl,t}function xx(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Cl}function gx(e,t){const r={...t};for(const a in t){const n=e[a],s=t[a];/^on[A-Z]/.test(a)?n&&s?r[a]=(...i)=>{const l=s(...i);return n(...i),l}:n&&(r[a]=n):a==="style"?r[a]={...n,...s}:a==="className"&&(r[a]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}function vx(e){var t,r;let a=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;return n?e.ref:(a=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var bx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],le=bx.reduce((e,t)=>{const r=or(`Primitive.${t}`),a=x.forwardRef((n,s)=>{const{asChild:i,...l}=n,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function yx(e,t){e&&da.flushSync(()=>e.dispatchEvent(t))}var wa="Checkbox",[wx]=bt(wa),[jx,pn]=wx(wa);function Nx(e){const{__scopeCheckbox:t,checked:r,children:a,defaultChecked:n,disabled:s,form:i,name:l,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:p}=e,[m,h]=Vt({prop:r,defaultProp:n??!1,onChange:c,caller:wa}),[g,f]=x.useState(null),[v,b]=x.useState(null),w=x.useRef(!1),y=g?!!i||!!g.closest("form"):!0,N={checked:m,disabled:s,setChecked:h,control:g,setControl:f,name:l,form:i,value:u,hasConsumerStoppedPropagationRef:w,required:d,defaultChecked:kt(n)?!1:n,isFormControl:y,bubbleInput:v,setBubbleInput:b};return o.jsx(jx,{scope:t,...N,children:Cx(p)?p(N):a})}var Sl="CheckboxTrigger",kl=x.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...a},n)=>{const{control:s,value:i,disabled:l,checked:c,required:d,setControl:u,setChecked:p,hasConsumerStoppedPropagationRef:m,isFormControl:h,bubbleInput:g}=pn(Sl,e),f=pe(n,u),v=x.useRef(c);return x.useEffect(()=>{const b=s==null?void 0:s.form;if(b){const w=()=>p(v.current);return b.addEventListener("reset",w),()=>b.removeEventListener("reset",w)}},[s,p]),o.jsx(le.button,{type:"button",role:"checkbox","aria-checked":kt(c)?"mixed":c,"aria-required":d,"data-state":$l(c),"data-disabled":l?"":void 0,disabled:l,value:i,...a,ref:f,onKeyDown:oe(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:oe(r,b=>{p(w=>kt(w)?!0:!w),g&&h&&(m.current=b.isPropagationStopped(),m.current||b.stopPropagation())})})});kl.displayName=Sl;var mn=x.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:a,checked:n,defaultChecked:s,required:i,disabled:l,value:c,onCheckedChange:d,form:u,...p}=e;return o.jsx(Nx,{__scopeCheckbox:r,checked:n,defaultChecked:s,disabled:l,required:i,onCheckedChange:d,name:a,form:u,value:c,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(kl,{...p,ref:t,__scopeCheckbox:r}),m&&o.jsx(Tl,{__scopeCheckbox:r})]})})});mn.displayName=wa;var _l="CheckboxIndicator",El=x.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:a,...n}=e,s=pn(_l,r);return o.jsx(Qe,{present:a||kt(s.checked)||s.checked===!0,children:o.jsx(le.span,{"data-state":$l(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t,style:{pointerEvents:"none",...e.style}})})});El.displayName=_l;var Pl="CheckboxBubbleInput",Tl=x.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:a,hasConsumerStoppedPropagationRef:n,checked:s,defaultChecked:i,required:l,disabled:c,name:d,value:u,form:p,bubbleInput:m,setBubbleInput:h}=pn(Pl,e),g=pe(r,h),f=dn(s),v=un(a);x.useEffect(()=>{const w=m;if(!w)return;const y=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(y,"checked").set,C=!n.current;if(f!==s&&N){const _=new Event("click",{bubbles:C});w.indeterminate=kt(s),N.call(w,kt(s)?!1:s),w.dispatchEvent(_)}},[m,f,s,n]);const b=x.useRef(kt(s)?!1:s);return o.jsx(le.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??b.current,required:l,disabled:c,name:d,value:u,form:p,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Tl.displayName=Pl;function Cx(e){return typeof e=="function"}function kt(e){return e==="indeterminate"}function $l(e){return kt(e)?"indeterminate":e?"checked":"unchecked"}const Pe=x.forwardRef(({className:e,...t},r)=>o.jsx(mn,{ref:r,className:G("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:o.jsx(El,{className:G("flex items-center justify-center text-current"),children:o.jsx(P.Check,{className:"h-4 w-4"})})}));Pe.displayName=mn.displayName;const Sx=cn("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 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 hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ye=x.forwardRef(({className:e,variant:t,size:r,asChild:a=!1,...n},s)=>o.jsx(a?nh:"button",{className:G(Sx({variant:t,size:r,className:e})),ref:s,...n}));ye.displayName="Button";function Le(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...r)=>{var a;return(a=t.current)==null?void 0:a.call(t,...r)},[])}var kx=x.createContext(void 0);function fn(e){const t=x.useContext(kx);return e||t||"ltr"}function wr(e,[t,r]){return Math.min(r,Math.max(t,e))}function _x(e,t){return x.useReducer((r,a)=>t[r][a]??r,e)}var hn="ScrollArea",[Rl]=bt(hn),[Ex,et]=Rl(hn),Ol=x.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:a="hover",dir:n,scrollHideDelay:s=600,...i}=e,[l,c]=x.useState(null),[d,u]=x.useState(null),[p,m]=x.useState(null),[h,g]=x.useState(null),[f,v]=x.useState(null),[b,w]=x.useState(0),[y,N]=x.useState(0),[C,_]=x.useState(!1),[k,j]=x.useState(!1),R=pe(t,I=>c(I)),A=fn(n);return o.jsx(Ex,{scope:r,type:a,dir:A,scrollHideDelay:s,scrollArea:l,viewport:d,onViewportChange:u,content:p,onContentChange:m,scrollbarX:h,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:_,scrollbarY:f,onScrollbarYChange:v,scrollbarYEnabled:k,onScrollbarYEnabledChange:j,onCornerWidthChange:w,onCornerHeightChange:N,children:o.jsx(le.div,{dir:A,...i,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":y+"px",...e.style}})})});Ol.displayName=hn;var Dl="ScrollAreaViewport",Al=x.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:a,nonce:n,...s}=e,i=et(Dl,r),l=x.useRef(null),c=pe(t,l,i.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),o.jsx(le.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})});Al.displayName=Dl;var ut="ScrollAreaScrollbar",xn=x.forwardRef((e,t)=>{const{forceMount:r,...a}=e,n=et(ut,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=n,l=e.orientation==="horizontal";return x.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),n.type==="hover"?o.jsx(Px,{...a,ref:t,forceMount:r}):n.type==="scroll"?o.jsx(Tx,{...a,ref:t,forceMount:r}):n.type==="auto"?o.jsx(Il,{...a,ref:t,forceMount:r}):n.type==="always"?o.jsx(gn,{...a,ref:t}):null});xn.displayName=ut;var Px=x.forwardRef((e,t)=>{const{forceMount:r,...a}=e,n=et(ut,e.__scopeScrollArea),[s,i]=x.useState(!1);return x.useEffect(()=>{const l=n.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),i(!0)},u=()=>{c=window.setTimeout(()=>i(!1),n.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",u)}}},[n.scrollArea,n.scrollHideDelay]),o.jsx(Qe,{present:r||s,children:o.jsx(Il,{"data-state":s?"visible":"hidden",...a,ref:t})})}),Tx=x.forwardRef((e,t)=>{const{forceMount:r,...a}=e,n=et(ut,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Na(()=>c("SCROLL_END"),100),[l,c]=_x("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return x.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,n.scrollHideDelay,c]),x.useEffect(()=>{const d=n.viewport,u=s?"scrollLeft":"scrollTop";if(d){let p=d[u];const m=()=>{const h=d[u];p!==h&&(c("SCROLL"),i()),p=h};return d.addEventListener("scroll",m),()=>d.removeEventListener("scroll",m)}},[n.viewport,s,c,i]),o.jsx(Qe,{present:r||l!=="hidden",children:o.jsx(gn,{"data-state":l==="hidden"?"hidden":"visible",...a,ref:t,onPointerEnter:oe(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:oe(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Il=x.forwardRef((e,t)=>{const r=et(ut,e.__scopeScrollArea),{forceMount:a,...n}=e,[s,i]=x.useState(!1),l=e.orientation==="horizontal",c=Na(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;i(l?d:u)}},10);return nr(r.viewport,c),nr(r.content,c),o.jsx(Qe,{present:a||s,children:o.jsx(gn,{"data-state":s?"visible":"hidden",...n,ref:t})})}),gn=x.forwardRef((e,t)=>{const{orientation:r="vertical",...a}=e,n=et(ut,e.__scopeScrollArea),s=x.useRef(null),i=x.useRef(0),[l,c]=x.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Vl(l.viewport,l.content),u={...a,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:m=>s.current=m,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:m=>i.current=m};function p(m,h){return Ix(m,i.current,l,h)}return r==="horizontal"?o.jsx($x,{...u,ref:t,onThumbPositionChange:()=>{if(n.viewport&&s.current){const m=n.viewport.scrollLeft,h=As(m,l,n.dir);s.current.style.transform=`translate3d(${h}px, 0, 0)`}},onWheelScroll:m=>{n.viewport&&(n.viewport.scrollLeft=m)},onDragScroll:m=>{n.viewport&&(n.viewport.scrollLeft=p(m,n.dir))}}):r==="vertical"?o.jsx(Rx,{...u,ref:t,onThumbPositionChange:()=>{if(n.viewport&&s.current){const m=n.viewport.scrollTop,h=As(m,l);s.current.style.transform=`translate3d(0, ${h}px, 0)`}},onWheelScroll:m=>{n.viewport&&(n.viewport.scrollTop=m)},onDragScroll:m=>{n.viewport&&(n.viewport.scrollTop=p(m))}}):null}),$x=x.forwardRef((e,t)=>{const{sizes:r,onSizesChange:a,...n}=e,s=et(ut,e.__scopeScrollArea),[i,l]=x.useState(),c=x.useRef(null),d=pe(t,c,s.onScrollbarXChange);return x.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(zl,{"data-orientation":"horizontal",...n,ref:d,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ja(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,p)=>{if(s.viewport){const m=s.viewport.scrollLeft+u.deltaX;e.onWheelScroll(m),Ul(m,p)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&a({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:ea(i.paddingLeft),paddingEnd:ea(i.paddingRight)}})}})}),Rx=x.forwardRef((e,t)=>{const{sizes:r,onSizesChange:a,...n}=e,s=et(ut,e.__scopeScrollArea),[i,l]=x.useState(),c=x.useRef(null),d=pe(t,c,s.onScrollbarYChange);return x.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(zl,{"data-orientation":"vertical",...n,ref:d,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ja(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,p)=>{if(s.viewport){const m=s.viewport.scrollTop+u.deltaY;e.onWheelScroll(m),Ul(m,p)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&a({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:ea(i.paddingTop),paddingEnd:ea(i.paddingBottom)}})}})}),[Ox,Ll]=Rl(ut),zl=x.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:a,hasThumb:n,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:u,onResize:p,...m}=e,h=et(ut,r),[g,f]=x.useState(null),v=pe(t,R=>f(R)),b=x.useRef(null),w=x.useRef(""),y=h.viewport,N=a.content-a.viewport,C=Le(u),_=Le(c),k=Na(p,10);function j(R){if(b.current){const A=R.clientX-b.current.left,I=R.clientY-b.current.top;d({x:A,y:I})}}return x.useEffect(()=>{const R=A=>{const I=A.target;g!=null&&g.contains(I)&&C(A,N)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[y,g,N,C]),x.useEffect(_,[a,_]),nr(g,k),nr(h.content,k),o.jsx(Ox,{scope:r,scrollbar:g,hasThumb:n,onThumbChange:Le(s),onThumbPointerUp:Le(i),onThumbPositionChange:_,onThumbPointerDown:Le(l),children:o.jsx(le.div,{...m,ref:v,style:{position:"absolute",...m.style},onPointerDown:oe(e.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),b.current=g.getBoundingClientRect(),w.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",h.viewport&&(h.viewport.style.scrollBehavior="auto"),j(R))}),onPointerMove:oe(e.onPointerMove,j),onPointerUp:oe(e.onPointerUp,R=>{const A=R.target;A.hasPointerCapture(R.pointerId)&&A.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=w.current,h.viewport&&(h.viewport.style.scrollBehavior=""),b.current=null})})})}),Qr="ScrollAreaThumb",Ml=x.forwardRef((e,t)=>{const{forceMount:r,...a}=e,n=Ll(Qr,e.__scopeScrollArea);return o.jsx(Qe,{present:r||n.hasThumb,children:o.jsx(Dx,{ref:t,...a})})}),Dx=x.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:a,...n}=e,s=et(Qr,r),i=Ll(Qr,r),{onThumbPositionChange:l}=i,c=pe(t,p=>i.onThumbChange(p)),d=x.useRef(void 0),u=Na(()=>{d.current&&(d.current(),d.current=void 0)},100);return x.useEffect(()=>{const p=s.viewport;if(p){const m=()=>{if(u(),!d.current){const h=Lx(p,l);d.current=h,l()}};return l(),p.addEventListener("scroll",m),()=>p.removeEventListener("scroll",m)}},[s.viewport,u,l]),o.jsx(le.div,{"data-state":i.hasThumb?"visible":"hidden",...n,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:oe(e.onPointerDownCapture,p=>{const m=p.target.getBoundingClientRect(),h=p.clientX-m.left,g=p.clientY-m.top;i.onThumbPointerDown({x:h,y:g})}),onPointerUp:oe(e.onPointerUp,i.onThumbPointerUp)})});Ml.displayName=Qr;var vn="ScrollAreaCorner",Fl=x.forwardRef((e,t)=>{const r=et(vn,e.__scopeScrollArea),a=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&a?o.jsx(Ax,{...e,ref:t}):null});Fl.displayName=vn;var Ax=x.forwardRef((e,t)=>{const{__scopeScrollArea:r,...a}=e,n=et(vn,r),[s,i]=x.useState(0),[l,c]=x.useState(0),d=!!(s&&l);return nr(n.scrollbarX,()=>{var u;const p=((u=n.scrollbarX)==null?void 0:u.offsetHeight)||0;n.onCornerHeightChange(p),c(p)}),nr(n.scrollbarY,()=>{var u;const p=((u=n.scrollbarY)==null?void 0:u.offsetWidth)||0;n.onCornerWidthChange(p),i(p)}),d?o.jsx(le.div,{...a,ref:t,style:{width:s,height:l,position:"absolute",right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function ea(e){return e?parseInt(e,10):0}function Vl(e,t){const r=e/t;return isNaN(r)?0:r}function ja(e){const t=Vl(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=(e.scrollbar.size-r)*t;return Math.max(a,18)}function Ix(e,t,r,a="ltr"){const n=ja(r),s=n/2,i=t||s,l=n-i,c=r.scrollbar.paddingStart+i,d=r.scrollbar.size-r.scrollbar.paddingEnd-l,u=r.content-r.viewport,p=a==="ltr"?[0,u]:[u*-1,0];return Bl([c,d],p)(e)}function As(e,t,r="ltr"){const a=ja(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-n,i=t.content-t.viewport,l=s-a,c=r==="ltr"?[0,i]:[i*-1,0],d=wr(e,c);return Bl([0,i],[0,l])(d)}function Bl(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(r-e[0])}}function Ul(e,t){return e>0&&e<t}var Lx=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},a=0;return function n(){const s={left:e.scrollLeft,top:e.scrollTop},i=r.left!==s.left,l=r.top!==s.top;(i||l)&&t(),r=s,a=window.requestAnimationFrame(n)}(),()=>window.cancelAnimationFrame(a)};function Na(e,t){const r=Le(e),a=x.useRef(0);return x.useEffect(()=>()=>window.clearTimeout(a.current),[]),x.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(r,t)},[r,t])}function nr(e,t){const r=Le(t);Ee(()=>{let a=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(a),n.unobserve(e)}}},[e,r])}var Hl=Ol,zx=Al,Mx=Fl;const Ca=x.forwardRef(({className:e,children:t,...r},a)=>o.jsxs(Hl,{ref:a,className:G("relative overflow-hidden",e),...r,children:[o.jsx(zx,{className:"h-full w-full rounded-[inherit]",children:t}),o.jsx(Wl,{}),o.jsx(Mx,{})]}));Ca.displayName=Hl.displayName;const Wl=x.forwardRef(({className:e,orientation:t="vertical",...r},a)=>o.jsx(xn,{ref:a,orientation:t,className:G("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:o.jsx(Ml,{className:"relative flex-1 rounded-full bg-border"})}));Wl.displayName=xn.displayName;var Fx=x[" useId ".trim().toString()]||(()=>{}),Vx=0;function _t(e){const[t,r]=x.useState(Fx());return Ee(()=>{r(a=>a??String(Vx++))},[e]),t?`radix-${t}`:""}function Bx(e,t=globalThis==null?void 0:globalThis.document){const r=Le(e);x.useEffect(()=>{const a=n=>{n.key==="Escape"&&r(n)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[r,t])}var Ux="DismissableLayer",No="dismissableLayer.update",Hx="dismissableLayer.pointerDownOutside",Wx="dismissableLayer.focusOutside",Is,ql=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kr=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:a,onPointerDownOutside:n,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,d=x.useContext(ql),[u,p]=x.useState(null),m=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=x.useState({}),g=pe(t,k=>p(k)),f=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=f.indexOf(v),w=u?f.indexOf(u):-1,y=d.layersWithOutsidePointerEventsDisabled.size>0,N=w>=b,C=Xx(k=>{const j=k.target,R=[...d.branches].some(A=>A.contains(j));!N||R||(n==null||n(k),i==null||i(k),k.defaultPrevented||l==null||l())},m),_=Gx(k=>{const j=k.target;[...d.branches].some(R=>R.contains(j))||(s==null||s(k),i==null||i(k),k.defaultPrevented||l==null||l())},m);return Bx(k=>{w===d.layers.size-1&&(a==null||a(k),!k.defaultPrevented&&l&&(k.preventDefault(),l()))},m),x.useEffect(()=>{if(u)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Is=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),Ls(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Is)}},[u,m,r,d]),x.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),Ls())},[u,d]),x.useEffect(()=>{const k=()=>h({});return document.addEventListener(No,k),()=>document.removeEventListener(No,k)},[]),o.jsx(le.div,{...c,ref:g,style:{pointerEvents:y?N?"auto":"none":void 0,...e.style},onFocusCapture:oe(e.onFocusCapture,_.onFocusCapture),onBlurCapture:oe(e.onBlurCapture,_.onBlurCapture),onPointerDownCapture:oe(e.onPointerDownCapture,C.onPointerDownCapture)})});kr.displayName=Ux;var qx="DismissableLayerBranch",Zx=x.forwardRef((e,t)=>{const r=x.useContext(ql),a=x.useRef(null),n=pe(t,a);return x.useEffect(()=>{const s=a.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),o.jsx(le.div,{...e,ref:n})});Zx.displayName=qx;function Xx(e,t=globalThis==null?void 0:globalThis.document){const r=Le(e),a=x.useRef(!1),n=x.useRef(()=>{});return x.useEffect(()=>{const s=l=>{if(l.target&&!a.current){let c=function(){Zl(Hx,r,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",n.current),n.current=c,t.addEventListener("click",n.current,{once:!0})):c()}else t.removeEventListener("click",n.current);a.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",n.current)}},[t,r]),{onPointerDownCapture:()=>a.current=!0}}function Gx(e,t=globalThis==null?void 0:globalThis.document){const r=Le(e),a=x.useRef(!1);return x.useEffect(()=>{const n=s=>{s.target&&!a.current&&Zl(Wx,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function Ls(){const e=new CustomEvent(No);document.dispatchEvent(e)}function Zl(e,t,r,{discrete:a}){const n=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),a?yx(n,s):n.dispatchEvent(s)}var oo="focusScope.autoFocusOnMount",no="focusScope.autoFocusOnUnmount",zs={bubbles:!1,cancelable:!0},Yx="FocusScope",Sa=x.forwardRef((e,t)=>{const{loop:r=!1,trapped:a=!1,onMountAutoFocus:n,onUnmountAutoFocus:s,...i}=e,[l,c]=x.useState(null),d=Le(n),u=Le(s),p=x.useRef(null),m=pe(t,f=>c(f)),h=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(a){let f=function(y){if(h.paused||!l)return;const N=y.target;l.contains(N)?p.current=N:Nt(p.current,{select:!0})},v=function(y){if(h.paused||!l)return;const N=y.relatedTarget;N!==null&&(l.contains(N)||Nt(p.current,{select:!0}))},b=function(y){if(document.activeElement===document.body)for(const N of y)N.removedNodes.length>0&&Nt(l)};document.addEventListener("focusin",f),document.addEventListener("focusout",v);const w=new MutationObserver(b);return l&&w.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",v),w.disconnect()}}},[a,l,h.paused]),x.useEffect(()=>{if(l){Fs.add(h);const f=document.activeElement;if(!l.contains(f)){const v=new CustomEvent(oo,zs);l.addEventListener(oo,d),l.dispatchEvent(v),v.defaultPrevented||(Kx(rg(Xl(l)),{select:!0}),document.activeElement===f&&Nt(l))}return()=>{l.removeEventListener(oo,d),setTimeout(()=>{const v=new CustomEvent(no,zs);l.addEventListener(no,u),l.dispatchEvent(v),v.defaultPrevented||Nt(f??document.body,{select:!0}),l.removeEventListener(no,u),Fs.remove(h)},0)}}},[l,d,u,h]);const g=x.useCallback(f=>{if(!r&&!a||h.paused)return;const v=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,b=document.activeElement;if(v&&b){const w=f.currentTarget,[y,N]=Jx(w);y&&N?!f.shiftKey&&b===N?(f.preventDefault(),r&&Nt(y,{select:!0})):f.shiftKey&&b===y&&(f.preventDefault(),r&&Nt(N,{select:!0})):b===w&&f.preventDefault()}},[r,a,h.paused]);return o.jsx(le.div,{tabIndex:-1,...i,ref:m,onKeyDown:g})});Sa.displayName=Yx;function Kx(e,{select:t=!1}={}){const r=document.activeElement;for(const a of e)if(Nt(a,{select:t}),document.activeElement!==r)return}function Jx(e){const t=Xl(e),r=Ms(t,e),a=Ms(t.reverse(),e);return[r,a]}function Xl(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const n=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||n?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Ms(e,t){for(const r of e)if(!Qx(r,{upTo:t}))return r}function Qx(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function eg(e){return e instanceof HTMLInputElement&&"select"in e}function Nt(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&eg(e)&&t&&e.select()}}var Fs=tg();function tg(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Vs(e,t),e.unshift(t)},remove(t){var r;e=Vs(e,t),(r=e[0])==null||r.resume()}}}function Vs(e,t){const r=[...e],a=r.indexOf(t);return a!==-1&&r.splice(a,1),r}function rg(e){return e.filter(t=>t.tagName!=="A")}var ag="Portal",ka=x.forwardRef((e,t)=>{var r;const{container:a,...n}=e,[s,i]=x.useState(!1);Ee(()=>i(!0),[]);const l=a||s&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return l?Bo.createPortal(o.jsx(le.div,{...n,ref:t}),l):null});ka.displayName=ag;var so=0;function bn(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Bs()),document.body.insertAdjacentElement("beforeend",e[1]??Bs()),so++,()=>{so===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),so--}},[])}function Bs(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var st=function(){return st=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},st.apply(this,arguments)};function Gl(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]]);return r}function og(e,t,r){for(var a=0,n=t.length,s;a<n;a++)(s||!(a in t))&&(s||(s=Array.prototype.slice.call(t,0,a)),s[a]=t[a]);return e.concat(s||Array.prototype.slice.call(t))}var Zr="right-scroll-bar-position",Xr="width-before-scroll-bar",ng="with-scroll-bars-hidden",sg="--removed-body-scroll-bar-size";function io(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function ig(e,t){var r=E.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(a){var n=r.value;n!==a&&(r.value=a,r.callback(a,n))}}}})[0];return r.callback=t,r.facade}var lg=typeof window<"u"?x.useLayoutEffect:x.useEffect,Us=new WeakMap;function cg(e,t){var r=ig(null,function(a){return e.forEach(function(n){return io(n,a)})});return lg(function(){var a=Us.get(r);if(a){var n=new Set(a),s=new Set(e),i=r.current;n.forEach(function(l){s.has(l)||io(l,null)}),s.forEach(function(l){n.has(l)||io(l,i)})}Us.set(r,e)},[e]),r}function dg(e){return e}function ug(e,t){t===void 0&&(t=dg);var r=[],a=!1,n={read:function(){if(a)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(s){var i=t(s,a);return r.push(i),function(){r=r.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(a=!0;r.length;){var i=r;r=[],i.forEach(s)}r={push:function(l){return s(l)},filter:function(){return r}}},assignMedium:function(s){a=!0;var i=[];if(r.length){var l=r;r=[],l.forEach(s),i=r}var c=function(){var u=i;i=[],u.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(u){i.push(u),d()},filter:function(u){return i=i.filter(u),r}}}};return n}function pg(e){e===void 0&&(e={});var t=ug(null);return t.options=st({async:!0,ssr:!1},e),t}var Yl=function(e){var t=e.sideCar,r=Gl(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return x.createElement(a,st({},r))};Yl.isSideCarExport=!0;function mg(e,t){return e.useMedium(t),Yl}var Kl=pg(),lo=function(){},_a=x.forwardRef(function(e,t){var r=x.useRef(null),a=x.useState({onScrollCapture:lo,onWheelCapture:lo,onTouchMoveCapture:lo}),n=a[0],s=a[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,p=e.shards,m=e.sideCar,h=e.noRelative,g=e.noIsolation,f=e.inert,v=e.allowPinchZoom,b=e.as,w=b===void 0?"div":b,y=e.gapMode,N=Gl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=m,_=cg([r,t]),k=st(st({},N),n);return x.createElement(x.Fragment,null,u&&x.createElement(C,{sideCar:Kl,removeScrollBar:d,shards:p,noRelative:h,noIsolation:g,inert:f,setCallbacks:s,allowPinchZoom:!!v,lockRef:r,gapMode:y}),i?x.cloneElement(x.Children.only(l),st(st({},k),{ref:_})):x.createElement(w,st({},k,{className:c,ref:_}),l))});_a.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_a.classNames={fullWidth:Xr,zeroRight:Zr};var fg=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function hg(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=fg();return t&&e.setAttribute("nonce",t),e}function xg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function gg(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var vg=function(){var e=0,t=null;return{add:function(r){e==0&&(t=hg())&&(xg(t,r),gg(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},bg=function(){var e=vg();return function(t,r){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Jl=function(){var e=bg(),t=function(r){var a=r.styles,n=r.dynamic;return e(a,n),null};return t},yg={left:0,top:0,right:0,gap:0},co=function(e){return parseInt(e||"",10)||0},wg=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],n=t[e==="padding"?"paddingRight":"marginRight"];return[co(r),co(a),co(n)]},jg=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return yg;var t=wg(e),r=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-r+t[2]-t[0])}},Ng=Jl(),tr="data-scroll-locked",Cg=function(e,t,r,a){var n=e.left,s=e.top,i=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
33
|
-
.`.concat(
|
|
32
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const p=u[1];if(t===u[0]){d(u);continue}if(e.external){const m=(n=e.external.registry.get(u[0]))==null?void 0:n.id;if(t!==u[0]&&m){d(u);continue}}if((s=e.metadataRegistry.get(u[0]))!=null&&s.id){d(u);continue}if(p.cycle){d(u);continue}if(p.count>1&&e.reused==="ref"){d(u);continue}}}function Ri(e,t){var r,a,n;const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=d=>{const u=e.seen.get(d);if(u.ref===null)return;const p=u.def??u.schema,m={...p},x=u.ref;if(u.ref=null,x){i(x);const f=e.seen.get(x),v=f.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(v)):Object.assign(p,v),Object.assign(p,m),d._zod.parent===x)for(const b in p)b==="$ref"||b==="allOf"||b in m||delete p[b];if(v.$ref&&f.def)for(const b in p)b==="$ref"||b==="allOf"||b in f.def&&JSON.stringify(p[b])===JSON.stringify(f.def[b])&&delete p[b]}const g=d._zod.parent;if(g&&g!==x){i(g);const f=e.seen.get(g);if(f!=null&&f.schema.$ref&&(p.$ref=f.schema.$ref,f.def))for(const v in p)v==="$ref"||v==="allOf"||v in f.def&&JSON.stringify(p[v])===JSON.stringify(f.def[v])&&delete p[v]}e.override({zodSchema:d,jsonSchema:p,path:u.path??[]})};for(const d of[...e.seen.entries()].reverse())i(d[0]);const l={};if(e.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?l.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?l.$schema="http://json-schema.org/draft-04/schema#":e.target,(r=e.external)!=null&&r.uri){const d=(a=e.external.registry.get(t))==null?void 0:a.id;if(!d)throw new Error("Schema is missing an `id` property");l.$id=e.external.uri(d)}Object.assign(l,s.def??s.schema);const c=((n=e.external)==null?void 0:n.defs)??{};for(const d of e.seen.entries()){const u=d[1];u.def&&u.defId&&(c[u.defId]=u.def)}e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?l.$defs=c:l.definitions=c);try{const d=JSON.parse(JSON.stringify(l));return Object.defineProperty(d,"~standard",{value:{...t["~standard"],jsonSchema:{input:Yr(t,"input",e.processors),output:Yr(t,"output",e.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function $e(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return $e(a.element,r);if(a.type==="set")return $e(a.valueType,r);if(a.type==="lazy")return $e(a.getter(),r);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return $e(a.innerType,r);if(a.type==="intersection")return $e(a.left,r)||$e(a.right,r);if(a.type==="record"||a.type==="map")return $e(a.keyType,r)||$e(a.valueType,r);if(a.type==="pipe")return $e(a.in,r)||$e(a.out,r);if(a.type==="object"){for(const n in a.shape)if($e(a.shape[n],r))return!0;return!1}if(a.type==="union"){for(const n of a.options)if($e(n,r))return!0;return!1}if(a.type==="tuple"){for(const n of a.items)if($e(n,r))return!0;return!!(a.rest&&$e(a.rest,r))}return!1}const gm=(e,t={})=>r=>{const a=Ti({...r,processors:t});return Re(e,a),$i(a,e),Ri(a,e)},Yr=(e,t,r={})=>a=>{const{libraryOptions:n,target:s}=a??{},i=Ti({...n??{},target:s,io:t,processors:r});return Re(e,i),$i(i,e),Ri(i,e)},vm=(e,t,r,a)=>{},bm=(e,t,r,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},ym=(e,t,r,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},wm=(e,t,r,a)=>{const n=r,s=e._zod.def,{minimum:i,maximum:l}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof l=="number"&&(n.maxItems=l),n.type="array",n.items=Re(s.element,t,{...a,path:[...a.path,"items"]})},jm=(e,t,r,a)=>{const n=e._zod.def,s=n.inclusive===!1,i=n.options.map((l,c)=>Re(l,t,{...a,path:[...a.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Nm=(e,t,r,a)=>{const n=e._zod.def,s=Re(n.left,t,{...a,path:[...a.path,"allOf",0]}),i=Re(n.right,t,{...a,path:[...a.path,"allOf",1]}),l=d=>"allOf"in d&&Object.keys(d).length===1,c=[...l(s)?s.allOf:[s],...l(i)?i.allOf:[i]];r.allOf=c},Cm=(e,t,r,a)=>{const n=e._zod.def,s=Re(n.innerType,t,a),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Sm=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType},km=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},_m=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Em=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Pm=(e,t,r,a)=>{const n=e._zod.def,s=t.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;Re(s,t,a);const i=t.seen.get(e);i.ref=s},Tm=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0},Oi=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType},$m=(e,t)=>{_i.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>$p(e,r)},flatten:{value:r=>Tp(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,bo,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,bo,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ke=de("ZodError",$m,{Parent:Error}),Rm=Yo(Ke),Om=Ko(Ke),Dm=ma(Ke),Am=fa(Ke),Im=Dp(Ke),Lm=Ap(Ke),zm=Ip(Ke),Mm=Lp(Ke),Fm=zp(Ke),Vm=Mp(Ke),Bm=Fp(Ke),Um=Vp(Ke),De=de("ZodType",(e,t)=>(Oe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Yr(e,"input"),output:Yr(e,"output")}}),e.toJSONSchema=gm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(_p(t,{checks:[...t.checks??[],...r.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(r,a)=>Ep(e,r,a),e.brand=()=>e,e.register=(r,a)=>(r.add(e,a),e),e.parse=(r,a)=>Rm(e,r,a,{callee:e.parse}),e.safeParse=(r,a)=>Dm(e,r,a),e.parseAsync=async(r,a)=>Om(e,r,a,{callee:e.parseAsync}),e.safeParseAsync=async(r,a)=>Am(e,r,a),e.spa=e.safeParseAsync,e.encode=(r,a)=>Im(e,r,a),e.decode=(r,a)=>Lm(e,r,a),e.encodeAsync=async(r,a)=>zm(e,r,a),e.decodeAsync=async(r,a)=>Mm(e,r,a),e.safeEncode=(r,a)=>Fm(e,r,a),e.safeDecode=(r,a)=>Vm(e,r,a),e.safeEncodeAsync=async(r,a)=>Bm(e,r,a),e.safeDecodeAsync=async(r,a)=>Um(e,r,a),e.refine=(r,a)=>e.check(gf(r,a)),e.superRefine=r=>e.check(vf(r)),e.overwrite=r=>e.check(pm(r)),e.optional=()=>xs(e),e.exactOptional=()=>rf(e),e.nullable=()=>gs(e),e.nullish=()=>xs(gs(e)),e.nonoptional=r=>df(e,r),e.array=()=>Zm(e),e.or=r=>Gm([e,r]),e.and=r=>Km(e,r),e.transform=r=>vs(e,Qm(r)),e.default=r=>nf(e,r),e.prefault=r=>lf(e,r),e.catch=r=>pf(e,r),e.pipe=r=>vs(e,r),e.readonly=()=>hf(e),e.describe=r=>{const a=e.clone();return vr.add(a,{description:r}),a},Object.defineProperty(e,"description",{get(){var r;return(r=vr.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return vr.get(e);const a=e.clone();return vr.add(a,r[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Hm=de("ZodUnknown",(e,t)=>{Zp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>vm()});function Wm(){return cm(Hm)}const qm=de("ZodArray",(e,t)=>{Xp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>wm(e,r,a,n),e.element=t.element,e.min=(r,a)=>e.check(hs(r,a)),e.nonempty=r=>e.check(hs(1,r)),e.max=(r,a)=>e.check(dm(r,a)),e.length=(r,a)=>e.check(um(r,a)),e.unwrap=()=>e.element});function Zm(e,t){return mm(qm,e,t)}const Xm=de("ZodUnion",(e,t)=>{Gp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>jm(e,r,a,n),e.options=t.options});function Gm(e,t){return new Xm({type:"union",options:e,...Tt(t)})}const Ym=de("ZodIntersection",(e,t)=>{Yp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Nm(e,r,a,n)});function Km(e,t){return new Ym({type:"intersection",left:e,right:t})}const Jm=de("ZodTransform",(e,t)=>{Kp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>ym(e,r),e._zod.parse=(r,a)=>{if(a.direction==="backward")throw new Ni(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(yr(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(yr(i))}};const n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function Qm(e){return new Jm({type:"transform",transform:e})}const ef=de("ZodOptional",(e,t)=>{Pi.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Oi(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function xs(e){return new ef({type:"optional",innerType:e})}const tf=de("ZodExactOptional",(e,t)=>{Jp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Oi(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function rf(e){return new tf({type:"optional",innerType:e})}const af=de("ZodNullable",(e,t)=>{Qp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Cm(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function gs(e){return new af({type:"nullable",innerType:e})}const of=de("ZodDefault",(e,t)=>{em.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>km(e,r,a,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function nf(e,t){return new of({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Si(t)}})}const sf=de("ZodPrefault",(e,t)=>{tm.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>_m(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function lf(e,t){return new sf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Si(t)}})}const cf=de("ZodNonOptional",(e,t)=>{rm.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Sm(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function df(e,t){return new cf({type:"nonoptional",innerType:e,...Tt(t)})}const uf=de("ZodCatch",(e,t)=>{am.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Em(e,r,a,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pf(e,t){return new uf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const mf=de("ZodPipe",(e,t)=>{om.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Pm(e,r,a,n),e.in=t.in,e.out=t.out});function vs(e,t){return new mf({type:"pipe",in:e,out:t})}const ff=de("ZodReadonly",(e,t)=>{nm.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Tm(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function hf(e){return new ff({type:"readonly",innerType:e})}const xf=de("ZodCustom",(e,t)=>{sm.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>bm(e,r)});function gf(e,t={}){return fm(xf,e,t)}function vf(e){return hm(e)}const bf={custom:"custom"},rt=(e,t,r={})=>{if(!e)return!0;if("and"in e||"or"in e)return"and"in e&&Array.isArray(e.and)?e.and.every(d=>rt(d,t,r)):"or"in e&&Array.isArray(e.or)?e.or.some(d=>rt(d,t,r)):!0;const a=e;if(!a.campoId)return!0;const n=a.source==="evento"?r[a.campoId]:t[a.campoId],s=n!=null?String(n):"",i=a.valor!==void 0?String(a.valor):"",l=parseFloat(s),c=parseFloat(i);switch(a.operador){case"igual":return s===i;case"diferente":return s!==i;case"vazio":return!s;case"naoVazio":return!!s;case"contem":return s.includes(i);case"naoContem":return!s.includes(i);case"maiorQue":return!isNaN(l)&&!isNaN(c)&&l>c;case"menorQue":return!isNaN(l)&&!isNaN(c)&&l<c;case"maiorOuIgual":return!isNaN(l)&&!isNaN(c)&&l>=c;case"menorOuIgual":return!isNaN(l)&&!isNaN(c)&&l<=c;default:return!0}},yf=/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/,wf=/^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/,jf=/^\d{5}-?\d{3}$/,Nf=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,eo=(e,t,r={})=>{const a=e.validacao;if(e.tipo===O.CHECKBOX||e.tipo===O.SWITCH)return e.obrigatorio&&!t?"Campo obrigatório":void 0;if(e.tipo===O.SLIDER){const s=t!==void 0?Number(t):NaN;return e.obrigatorio&&isNaN(s)?"Campo obrigatório":isNaN(s)?void 0:(a==null?void 0:a.min)!==void 0&&s<a.min?`Valor mínimo: ${a.min}`:(a==null?void 0:a.max)!==void 0&&s>a.max?`Valor máximo: ${a.max}`:void 0}if(e.tipo===O.RATING){const s=t!==void 0?Number(t):0;return e.obrigatorio&&(!s||s<1)?"Avaliação obrigatória":void 0}if(e.tipo===O.DATE_RANGE){const s=t;if(e.obrigatorio){if(!(s!=null&&s.start))return"Data inicial obrigatória";if(!(s!=null&&s.end))return"Data final obrigatória"}return s!=null&&s.start&&s!=null&&s.end&&s.start>s.end?"A data inicial deve ser menor ou igual à data final":void 0}if(e.tipo===O.PARTICIPATION_TYPE){if(!e.obrigatorio)return;const s=t;return s!=null&&s.tipo?s.tipo==="por_dia"&&!s.data?"Selecione um dia para participar":"genero"in(s??{})&&!(s!=null&&s.genero)?"Selecione o sexo":void 0:"Selecione o tipo de participação"}if(e.tipo===O.CHECKBOX_GROUP){const s=Array.isArray(t)?t:[];return e.obrigatorio&&s.length===0?"Selecione pelo menos uma opção":void 0}if(e.tipo===O.FILE)return e.obrigatorio&&!t?"Arquivo obrigatório":void 0;if(e.tipo===O.NUMBER){const s=t!=null?String(t):"";if(e.obrigatorio&&!s)return"Campo obrigatório";if(!s)return;const i=Number(s);return isNaN(i)?"Deve ser um número":(a==null?void 0:a.min)!==void 0&&i<a.min?`Valor mínimo: ${a.min}`:(a==null?void 0:a.max)!==void 0&&i>a.max?`Valor máximo: ${a.max}`:void 0}const n=t!=null?String(t):"";if(e.obrigatorio&&!n.trim())return"Campo obrigatório";if(n){if(e.tipo===O.EMAIL&&!Nf.test(n))return"E-mail inválido";if(e.tipo===O.CPF&&!yf.test(n))return"CPF inválido";if(e.tipo===O.TELEFONE&&!wf.test(n))return"Telefone inválido";if(e.tipo===O.CEP&&!jf.test(n))return"CEP inválido";if(a!=null&&a.minLength&&n.length<a.minLength)return`Mínimo ${a.minLength} caracteres`;if(a!=null&&a.maxLength&&n.length>a.maxLength)return`Máximo ${a.maxLength} caracteres`;if((e.tipo===O.DATE||e.tipo===O.DATETIME)&&n){if(a!=null&&a.minDate&&n<a.minDate)return`Data mínima: ${a.minDate}`;if(a!=null&&a.maxDate&&n>a.maxDate)return`Data máxima: ${a.maxDate}`}if((e.tipo===O.DATE||e.tipo===O.DATETIME)&&n&&((a==null?void 0:a.minAge)!=null||(a==null?void 0:a.maxAge)!=null)){const s=n.split("T")[0],i=new Date(s+"T00:00:00"),l=r["evento.dataInicioEvento"],c=l?new Date(l.split("T")[0]+"T00:00:00"):new Date;let d=c.getFullYear()-i.getFullYear();const u=c.getMonth()-i.getMonth();if((u<0||u===0&&c.getDate()<i.getDate())&&d--,a.minAge!=null&&d<a.minAge)return`Idade mínima: ${a.minAge} ano${a.minAge!==1?"s":""}`;if(a.maxAge!=null&&d>a.maxAge)return`Idade máxima: ${a.maxAge} ano${a.maxAge!==1?"s":""}`}if(a!=null&&a.regex)try{if(!new RegExp(a.regex).test(n))return a.regexMessage||"Formato inválido"}catch{}}},Ir=(e,t,r)=>{const a=t.split(".");let n=e;for(let s=0;s<a.length-1;s++){const i=a[s];(n[i]==null||typeof n[i]!="object")&&(n[i]={}),n=n[i]}n[a[a.length-1]]=r},Cf=e=>[...e.containers].sort((t,r)=>t.ordem-r.ordem).filter(t=>!t.repeatable).flatMap(t=>[...t.campos].sort((r,a)=>r.ordem-a.ordem)),Di=(e,t={},r={})=>async a=>{var n,s,i;const l=Cf(e),c={};for(const p of l){if(!rt(p.condicional,a,t)||p.tipo===O.HIDDEN)continue;if(p.tipo===O.FIELD_ARRAY){const x=Array.isArray(a[p.nome])?a[p.nome]:[];p.obrigatorio&&x.length===0?c[p.nome]={type:"custom",message:"Adicione pelo menos um item"}:p.minItems&&x.length<p.minItems&&(c[p.nome]={type:"custom",message:`Mínimo de ${p.minItems} item${p.minItems!==1?"s":""}`});for(let g=0;g<x.length;g++){const f=x[g];for(const v of p.subFields??[]){const b=eo(v,f[v.nome],t);if(b){Ir(c,`${p.nome}.${g}.${v.nome}`,{type:"custom",message:b});continue}if((n=v.validate)!=null&&n.length){const j=await qr(v.validate,v.nome,f[v.nome],f,t,r);j&&Ir(c,`${p.nome}.${g}.${v.nome}`,{type:"custom",message:j})}}}continue}const m=eo(p,a[p.nome],t);if(m&&(c[p.nome]={type:"custom",message:m}),!c[p.nome]&&(s=p.validate)!=null&&s.length){const x=await qr(p.validate,p.nome,a[p.nome],a,t,r);x&&(c[p.nome]={type:"custom",message:x})}}const d=e.containers.filter(p=>p.repeatable&&p.nome);for(const p of d){const m=Array.isArray(a[p.nome])?a[p.nome]:[];for(let x=0;x<m.length;x++){const g=m[x];for(const f of p.campos){if(!rt(f.condicional,g,t)||f.tipo===O.HIDDEN)continue;const v=eo(f,g[f.nome],t);if(v){Ir(c,`${p.nome}.${x}.${f.nome}`,{type:"custom",message:v});continue}if((i=f.validate)!=null&&i.length){const b=await qr(f.validate,f.nome,g[f.nome],g,t,r);b&&Ir(c,`${p.nome}.${x}.${f.nome}`,{type:"custom",message:b})}}}}const u=Object.keys(c).length>0;return{values:u?{}:a,errors:u?c:{}}},qr=async(e,t,r,a,n,s)=>{var i;let l=Wm();for(const d of e){const u=s[d.type];if(!u)continue;const p=u,m=d;l=l.superRefine(async(x,g)=>{const f=await p(x,a,m,n);f&&g.addIssue({code:bf.custom,message:m.message??f})})}const c=await l.safeParseAsync(r);if(!c.success)return(i=c.error.issues[0])==null?void 0:i.message},Ai=(e,t={},r={})=>async a=>{var n;const s={},i=[...e.containers].sort((l,c)=>l.ordem-c.ordem).flatMap(l=>[...l.campos].sort((c,d)=>c.ordem-d.ordem));for(const l of i){if(!((n=l.warn)!=null&&n.length)||!rt(l.condicional,a,t))continue;const c=await qr(l.warn,l.nome,a[l.nome],a,t,r);c&&(s[l.nome]=c)}return s},Sf=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,Xe=(e,t)=>e?e.replace(Sf,(r,a)=>t[`evento.${a}`]??t[a]??r):e??"",kf=(e,t)=>({...e,label:Xe(e.label,t)}),Ii=(e,t)=>{var r;return{...e,label:Xe(e.label,t),placeholder:Xe(e.placeholder,t),hint:Xe(e.hint,t),defaultValue:typeof e.defaultValue=="string"?Xe(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(a=>kf(a,t))}},ha=(e,t)=>({...e,titulo:Xe(e.titulo,t),descricao:Xe(e.descricao,t),campos:e.campos.map(r=>Ii(r,t))}),Li=(e,t)=>({...e,titulo:Xe(e.titulo,t),descricao:Xe(e.descricao,t),containers:e.containers.map(r=>ha(r,t))}),Jo=E.createContext({}),dt=()=>E.useContext(Jo),Be=({name:e,control:t,placeholder:r,type:a="text",disabled:n,readOnly:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),d=!!c.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx("input",{...l,value:l.value??"",type:a,placeholder:r,disabled:n,readOnly:s,className:`sfr-input${d?" sfr-input--error":""}`,"data-sfr-field":"text"}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},xa=({name:e,control:t,placeholder:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsx("textarea",{...i,value:i.value??"",placeholder:r,disabled:a,readOnly:n,rows:3,className:`sfr-textarea${l.error?" sfr-input--error":""}`,"data-sfr-field":"textarea"}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},ga=({name:e,control:t,placeholder:r,options:a,disabled:n,readOnly:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("select",{...l,value:l.value??"",disabled:n||s,className:`sfr-select${c.error?" sfr-input--error":""}`,"data-sfr-field":"select",children:[r&&o.jsx("option",{value:"",children:r}),!r&&o.jsx("option",{value:"",children:"Selecione..."}),a.map(d=>o.jsx("option",{value:d.valor,disabled:d.disabled,children:d.label},d.valor))]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},va=({name:e,control:t,label:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"sfr-checkbox-label","data-sfr-field":"checkbox",children:[o.jsx("input",{type:"checkbox",name:i.name,checked:!!i.value,onChange:c=>!n&&i.onChange(c.target.checked),onBlur:i.onBlur,onKeyDown:c=>{n&&c.key===" "&&c.preventDefault()},disabled:a,readOnly:n,className:"sfr-checkbox"}),r&&o.jsx("span",{className:"sfr-checkbox-text",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Qo=({name:e,control:t,options:r,disabled:a})=>{var n;const{field:s,fieldState:i}=ce.useController({name:e,control:t}),l=Array.isArray(s.value)?s.value:[],c=d=>{const u=l.includes(d)?l.filter(p=>p!==d):[...l,d];s.onChange(u)};return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"sfr-checkbox-group","data-sfr-field":"checkbox-group",children:r.map(d=>o.jsxs("label",{className:"sfr-checkbox-label",children:[o.jsx("input",{type:"checkbox",checked:l.includes(d.valor),onChange:()=>c(d.valor),disabled:a||d.disabled,className:"sfr-checkbox"}),o.jsx("span",{className:"sfr-checkbox-text",children:d.label})]},d.valor))}),((n=i.error)==null?void 0:n.message)&&o.jsx("p",{className:"sfr-error",children:i.error.message})]})},en=({name:e,control:t,options:r,visualStyle:a="default",disabled:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),c=a==="card";return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:c?"sfr-radio-cards":"sfr-radio-group","data-sfr-field":"radio","data-style":a,children:r.map(d=>o.jsxs("label",{className:c?"sfr-radio-card":"sfr-radio-label","data-selected":i.value===d.valor?"true":void 0,children:[o.jsx("input",{type:"radio",name:i.name,value:d.valor,checked:i.value===d.valor,onChange:()=>i.onChange(d.valor),onBlur:i.onBlur,disabled:n||d.disabled,className:c?"sfr-radio-card-input":"sfr-radio"}),o.jsx("span",{className:c?"sfr-radio-card-label":"sfr-radio-text",children:d.label})]},d.valor))}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},_f=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),t.toISOString().split("T")[0]},Ef=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),t.toISOString().split("T")[0]},ar=({name:e,control:t,isDatetime:r,disabled:a,readOnly:n,validacao:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),d=r?"datetime-local":"date",u=x=>r?x+"T00:00":x,p=(s==null?void 0:s.minAge)!=null?u(_f(s.minAge)):(s==null?void 0:s.maxDate)!=null?u(s.maxDate):void 0,m=(s==null?void 0:s.maxAge)!=null?u(Ef(s.maxAge)):(s==null?void 0:s.minDate)!=null?u(s.minDate):void 0;return o.jsxs("div",{className:"space-y-1",children:[o.jsx("input",{name:l.name,value:l.value??"",onChange:l.onChange,onBlur:l.onBlur,type:d,min:m,max:p,disabled:a,readOnly:n,className:`sfr-input${c.error?" sfr-input--error":""}`,"data-sfr-field":"date"}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},bs=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,tn=({name:e,control:t,disabled:r,campo:a,fileTypes:n,maxFileSize:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),{uploadFile:d}=dt(),[u,p]=E.useState({status:"idle"}),m=E.useRef(null),[x,g]=E.useState(!1),f=typeof l.value=="string"&&l.value?l.value:null,v=E.useCallback(async N=>{var C;if(n&&n.length>0){const k=((C=N.name.split(".").pop())==null?void 0:C.toLowerCase())??"",_=N.type.toLowerCase();if(!n.some(w=>w.toLowerCase()===k||w.toLowerCase()===_)){p({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${n.join(", ")}`});return}}if(s&&N.size>s){p({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${bs(s)}`});return}if(!d){p({status:"error",message:"Preview: upload não disponível sem configuração."});return}p({status:"uploading",fileName:N.name,progress:0});try{const k=await d(N,a??e,_=>{p(w=>w.status==="uploading"?{...w,progress:Math.min(100,_)}:w)});l.onChange(k),p({status:"done",uploadId:k,fileName:N.name,size:N.size})}catch{p({status:"error",message:"Falha no upload. Tente novamente."})}},[d,a,e,l,n,s]),b=E.useCallback(N=>{var C;const k=(C=N.target.files)==null?void 0:C[0];k&&v(k),N.target.value=""},[v]),j=E.useCallback(()=>{l.onChange(""),p({status:"idle"}),m.current&&(m.current.value="")},[l]);if(u.status==="done"||u.status==="idle"&&f){const N=u.status==="done"?u.fileName:"Arquivo enviado",C=u.status==="done"?u.size:null;return o.jsxs("div",{className:"sfr-file-upload sfr-file-done","data-sfr-field":"file","data-status":"done",children:[o.jsx("span",{className:"sfr-file-name",children:N}),C!==null&&o.jsx("span",{className:"sfr-file-size",children:bs(C)}),!r&&o.jsx("button",{type:"button",onClick:j,className:"sfr-file-remove","aria-label":"Remover arquivo",children:"✕"})]})}if(u.status==="uploading"){const{fileName:N,progress:C}=u;return o.jsxs("div",{className:"sfr-file-upload sfr-file-uploading","data-sfr-field":"file","data-status":"uploading",children:[o.jsxs("div",{className:"sfr-file-uploading__info",children:[o.jsx("span",{className:"sfr-file-name",children:N}),o.jsxs("span",{className:"sfr-file-progress-pct",children:[C,"%"]})]}),o.jsx("div",{className:"sfr-file-progress-track",children:o.jsx("div",{className:"sfr-file-progress-bar",style:{width:`${C}%`}})})]})}const y=u.status==="error";return o.jsxs("div",{className:"sfr-file-upload","data-sfr-field":"file","data-status":u.status,children:[o.jsxs("div",{role:"button",tabIndex:r?-1:0,"aria-label":"Selecionar arquivo","data-dragging":x||void 0,"data-error":y||void 0,"data-field-error":!!c.error||void 0,"data-disabled":r||void 0,className:"sfr-file-drop",onClick:()=>{var N;return!r&&((N=m.current)==null?void 0:N.click())},onKeyDown:N=>{var C;(N.key==="Enter"||N.key===" ")&&((C=m.current)==null||C.click())},onDragOver:N=>{N.preventDefault(),r||g(!0)},onDragLeave:()=>g(!1),onDrop:r?void 0:N=>{var C;N.preventDefault(),g(!1);const k=(C=N.dataTransfer.files)==null?void 0:C[0];k&&v(k)},onBlur:l.onBlur,children:[o.jsx("input",{ref:m,type:"file",onChange:b,disabled:r,className:"sfr-file-input"}),o.jsx("span",{className:"sfr-file-label",children:x?"Solte o arquivo aqui":"Clique ou arraste um arquivo"})]}),y&&o.jsxs("p",{className:"sfr-error",children:[u.message," · ",o.jsx("button",{type:"button",className:"sfr-error-retry",onClick:()=>p({status:"idle"}),children:"Tentar novamente"})]}),!y&&((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},Pf={cpf:e=>e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2"),telefone:e=>{const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")},cep:e=>e.replace(/\D/g,"").slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")},Ct=({name:e,control:t,placeholder:r,maskType:a,disabled:n,readOnly:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),d=Pf[a||""],u=E.useCallback(p=>{l.onChange(d?d(p.target.value):p.target.value)},[l,d]);return o.jsxs("div",{className:"space-y-1",children:[o.jsx("input",{name:l.name,value:l.value||"",onChange:u,onBlur:l.onBlur,placeholder:r,disabled:n,readOnly:s,className:`sfr-input${c.error?" sfr-input--error":""}`,"data-sfr-field":"masked"}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},ba=({name:e,control:t})=>{const{field:r}=ce.useController({name:e,control:t});return o.jsx("input",{type:"hidden",...r,value:r.value??""})},zi=e=>e.replace(/\D/g,""),Tf=e=>{const t=zi(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},$f=async(e,t)=>{const r=await fetch(`https://viacep.com.br/ws/${e}/json/`,{signal:t});if(!r.ok)throw new Error("Falha ao consultar CEP");return r.json()},rn=({name:e,control:t,placeholder:r="00000-000",disabled:a,readOnly:n,cepFillMap:s})=>{var i,l;const{field:c,fieldState:d}=ce.useController({name:e,control:t}),{setValue:u}=ce.useFormContext(),{cepLookup:p}=dt(),[m,x]=E.useState("idle"),[g,f]=E.useState(null),v=E.useRef(null);E.useEffect(()=>()=>{var y;(y=v.current)==null||y.abort()},[]);const b=E.useCallback(async()=>{var y;c.onBlur();const N=zi(c.value??"");if(N.length===8){(y=v.current)==null||y.abort(),v.current=new AbortController,x("loading"),f(null);try{let C;if(p){const w=v.current;if(C=await p(N),w.signal.aborted)return}else{const w=await $f(N,v.current.signal);if(w.erro){x("error"),f("CEP não encontrado");return}C={logradouro:w.logradouro,bairro:w.bairro,cidade:w.localidade,estado:w.uf}}if(C.erro){x("error"),f("CEP não encontrado");return}const k=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",_=(w,R,A)=>{if(!A)return;const I=s!=null&&s[w]?`${k}${s[w]}`:`${k}${R}`;u(I,A)};_("logradouro","_address_logradouro",C.logradouro),_("bairro","_address_bairro",C.bairro),_("cidade","_address_cidade",C.cidade),_("estado","_address_estado",C.estado),x("success")}catch(C){if(C instanceof Error&&C.name==="AbortError")return;x("error"),f("Erro ao buscar CEP")}}},[c,p,u,e,s]),j=E.useCallback(y=>{c.onChange(Tf(y.target.value))},[c]);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"sfr-cep-wrapper","data-sfr-field":"cep","data-status":m,children:[o.jsx("input",{name:c.name,value:c.value||"",onChange:j,onBlur:b,placeholder:r,disabled:a,readOnly:n,className:`sfr-input${d.error?" sfr-input--error":""}`}),m==="loading"&&o.jsx("span",{className:"sfr-cep-indicator sfr-cep-loading"}),m==="success"&&o.jsx("span",{className:"sfr-cep-indicator sfr-cep-success"}),m==="error"&&o.jsx("span",{className:"sfr-cep-indicator sfr-cep-error"})]}),(((i=d.error)==null?void 0:i.message)||g)&&o.jsx("p",{className:"sfr-error",children:((l=d.error)==null?void 0:l.message)||g})]})},Rf=({field:e,control:t,nameOverride:r})=>{const a={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case O.TEXTO:return o.jsx(Be,{...a,type:"text"});case O.EMAIL:return o.jsx(Be,{...a,type:"email"});case O.NUMBER:return o.jsx(Be,{...a,type:"number"});case O.TEXTAREA:return o.jsx(xa,{...a});case O.SELECT:return o.jsx(ga,{...a,options:e.opcoes??[]});case O.RADIO:return o.jsx(en,{...a,options:e.opcoes??[]});case O.CHECKBOX:return o.jsx(va,{name:r,control:t,label:e.label});case O.CHECKBOX_GROUP:return o.jsx(Qo,{...a,options:e.opcoes??[]});case O.DATE:return o.jsx(ar,{...a,validacao:e.validacao});case O.DATETIME:return o.jsx(ar,{...a,isDatetime:!0,validacao:e.validacao});case O.FILE:return o.jsx(tn,{name:r,control:t});case O.TELEFONE:return o.jsx(Ct,{...a,maskType:"telefone"});case O.CPF:return o.jsx(Ct,{...a,maskType:"cpf"});case O.CEP:return o.jsx(rn,{name:r,control:t,placeholder:e.placeholder});case O.HIDDEN:return o.jsx(ba,{name:r,control:t});default:return o.jsx(Be,{...a,type:"text"})}},Mi=({name:e,control:t,subFields:r=[],minItems:a=1,maxItems:n,itemLabel:s="Item",addLabel:i})=>{var l;const{fields:c,append:d,remove:u}=ce.useFieldArray({control:t,name:e}),{errors:p}=ce.useFormState({control:t}),m=(l=p[e])==null?void 0:l.message;E.useEffect(()=>{if(c.length<a)for(let v=c.length;v<a;v++)d({})},[]);const x=[...r].sort((v,b)=>v.ordem-b.ordem),g=!n||c.length<n,f=i??`Adicionar ${s.toLowerCase()}`;return o.jsxs("div",{className:"sfr-field-array space-y-3",children:[c.map((v,b)=>o.jsxs("div",{className:"sfr-field-array__item border rounded-lg p-4",children:[o.jsxs("div",{className:"sfr-field-array__item-header flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"sfr-field-array__counter w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0",children:b+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[s," ",b+1]})]}),c.length>a&&o.jsx("button",{type:"button",onClick:()=>u(b),className:"sfr-field-array__remove","aria-label":`Remover ${s.toLowerCase()} ${b+1}`,children:o.jsx(P.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:x.map(j=>{const y=`${e}.${b}.${j.nome}`,N=`span ${j.tamanho??12}`,C=o.jsx(Rf,{field:j,control:t,nameOverride:y});return j.tipo===O.CHECKBOX||j.tipo===O.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:N},children:C},j.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:N},children:[o.jsxs("label",{className:"sfr-label font-medium flex items-center gap-1 text-sm",children:[j.label,j.obrigatorio&&o.jsx("span",{className:"sfr-required",children:"*"})]}),C,j.hint&&o.jsx("p",{className:"sfr-hint text-xs",children:j.hint})]},j.id)})})]},v.id)),g&&o.jsxs("button",{type:"button",className:"sfr-btn sfr-btn--outline w-full flex items-center justify-center gap-2 py-2 px-4 border rounded-lg text-sm",onClick:()=>d({}),children:[o.jsx(P.Plus,{className:"w-4 h-4"}),f]}),n&&o.jsxs("p",{className:"sfr-hint text-xs text-center",children:["Máximo de ",n," ",s.toLowerCase(),n>1?"s":""]}),m&&o.jsxs("p",{className:"sfr-error text-sm flex items-center gap-1",children:[o.jsx(P.AlertCircle,{className:"w-4 h-4 shrink-0"}),m]})]})},ys=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,Of=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),a=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((a.getTime()-r.getTime())/864e5)+1},Df=(e,t)=>{const r=[],a=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;a<=n&&s<60;)r.push(a.toISOString().slice(0,10)),a.setUTCDate(a.getUTCDate()+1),s++;return r},Af=e=>{const[t,r,a]=e.split("-").map(Number),n=new Date(Date.UTC(t,r-1,a)),s=String(a).padStart(2,"0"),i=String(r).padStart(2,"0"),l=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(n),c=l.charAt(0).toUpperCase()+l.slice(1);return`${s}/${i} - ${c}`},If=(e,t)=>{const r=a=>{const[n,s,i]=a.slice(0,10).split("-");return`${i}/${s}/${n}`};return`${r(e)} a ${r(t)}`},Fi=({name:e,control:t})=>{var r;const{field:a,fieldState:n}=ce.useController({name:e,control:t}),{externalData:s={}}=dt(),i=a.value??null,l=(r=n.error)==null?void 0:r.message,c=D=>s[`evento.${D}`]??s[D],d=c("dataInicioEvento")??"",u=c("dataFimEvento")??"",p=Number(c("valor")??0),m=Number(c("valorPorDia")??0),x=c("vagasTotal"),g=c("vagasPorDia"),f=c("vagasMasculinas"),v=c("vagasFemininas"),b=x!=null?Number(x):null,j=g!=null?Number(g):null,y=f!=null?Number(f):null,N=v!=null?Number(v):null,C=d&&u?Df(d,u):[],k=(d&&u?Of(d,u):0)>1,_=y!=null&&y>0&&N!=null&&N>0,w=y!=null&&N==null?"masculino":N!=null&&y==null?"feminino":null,R=(i==null?void 0:i.tipo)??null,A=(i==null?void 0:i.data)??null,I=(i==null?void 0:i.genero)??null,F=E.useRef(i);F.current=i;const V=E.useRef(a.onChange);V.current=a.onChange,E.useEffect(()=>{var D,z,L;w&&((D=F.current)==null?void 0:D.genero)!==w&&V.current({tipo:((z=F.current)==null?void 0:z.tipo)??null,data:((L=F.current)==null?void 0:L.data)??null,genero:w})},[w]);const M=D=>{const z={tipo:D,data:null};(_||w)&&(z.genero=I??w??void 0),a.onChange(z)},U=D=>{const z={tipo:"por_dia",data:D};(_||w)&&(z.genero=I??w??void 0),a.onChange(z)},$=D=>{a.onChange({tipo:R,data:A,genero:D})},T=D=>R===D;return o.jsxs("div",{className:"sfr-participation-type space-y-3",children:[_&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs sfr-text-muted shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(D=>o.jsx("button",{type:"button",onClick:()=>$(D),className:"sfr-participation-type__gender-btn px-3 py-1 rounded-full text-xs font-medium border transition-all","data-selected":I===D?"true":void 0,children:D==="masculino"?"Masculino":"Feminino"},D))})]}),o.jsxs("button",{type:"button",onClick:()=>M("todos_os_dias"),className:"sfr-participation-type__card w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all","data-selected":T("todos_os_dias")?"true":void 0,children:[o.jsx("div",{className:"sfr-participation-type__card-icon mt-0.5 p-2 rounded-lg shrink-0","data-selected":T("todos_os_dias")?"true":void 0,children:o.jsx(P.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&u?o.jsx("p",{className:"text-xs sfr-text-muted",children:If(d,u)}):o.jsx("p",{className:"text-xs sfr-text-muted italic",children:"Datas do evento"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[p>0&&o.jsx("p",{className:"font-bold text-sm sfr-participation-type__price","data-selected":T("todos_os_dias")?"true":void 0,children:ys(p)}),b!=null&&b>0&&o.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 sfr-participation-type__vagas",children:[o.jsx(P.Users,{className:"w-3 h-3"}),b," vagas disponíveis"]})]})]}),k?o.jsxs("button",{type:"button",onClick:()=>M("por_dia"),className:"sfr-participation-type__card w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all","data-selected":T("por_dia")?"true":void 0,children:[o.jsx("div",{className:"sfr-participation-type__card-icon mt-0.5 p-2 rounded-lg shrink-0","data-selected":T("por_dia")?"true":void 0,children:o.jsx(P.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),o.jsx("p",{className:"text-xs sfr-text-muted",children:"Escolha o dia desejado abaixo"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[m>0&&o.jsx("p",{className:"font-bold text-sm sfr-participation-type__price","data-selected":T("por_dia")?"true":void 0,children:ys(m)}),o.jsx("p",{className:"text-xs sfr-text-muted",children:"por dia"})]})]}):d?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border sfr-participation-type__notice",children:[o.jsx(P.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 sfr-text-muted"}),o.jsx("p",{className:"text-xs sfr-text-muted",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,R==="por_dia"&&o.jsxs("div",{className:"pl-2 space-y-2 sfr-participation-type__days",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide sfr-primary-text",children:"Selecione o dia:"}),C.length===0?o.jsx("p",{className:"text-xs sfr-text-muted italic",children:"Nenhuma data configurada no evento"}):C.map(D=>o.jsxs("button",{type:"button",onClick:()=>U(D),className:"sfr-participation-type__day-btn w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all","data-selected":A===D?"true":void 0,children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center sfr-participation-type__day-radio","data-selected":A===D?"true":void 0,children:A===D&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),o.jsx("span",{className:"text-sm",children:Af(D)})]}),j!=null&&o.jsxs("span",{className:"text-xs sfr-participation-type__vagas",children:[j," vagas"]})]},D))]}),l&&o.jsx("p",{className:"text-sm sfr-error",children:l})]})},ws=.0315,js=.124,Ns=7,Cs=12,Vi=[{id:"pix",label:"PIX",description:"Transferência instantânea (à vista)",Icon:P.Smartphone,taxa:0},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:P.Banknote,taxa:0},{id:"cartao",label:"Cartão de Crédito",description:"Débito ou crédito na maquininha",Icon:P.CreditCard,taxa:ws,taxaLabel:`Taxa: ${(ws*100).toFixed(2).replace(".",",")}%`}],Bi=[{id:"pix",label:"PIX à Vista",description:"Pagamento instantâneo sem parcelamento",Icon:P.Smartphone,taxa:0},{id:"pix_parcelado",label:"PIX Parcelado",description:`Parcelado em até ${Ns}x sem juros`,Icon:P.Smartphone,taxa:0,parcelas:Ns},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${Cs}x`,Icon:P.CreditCard,taxa:js,parcelas:Cs,taxaLabel:`Taxa: ${(js*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:P.Banknote,taxa:0}],Lr=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,Ss=(e,t)=>Math.round(e*(1+t)*100)/100,Lf=(e,t)=>Math.round(e/t*100)/100,Ui=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var a;const{field:n,fieldState:s}=ce.useController({name:e,control:t}),{externalData:i={},paymentMethodOptions:l}=dt(),c=n.value??null,d=(a=s.error)==null?void 0:a.message,u=ce.useWatch({control:t,name:r}),p=(u==null?void 0:u.tipo)??null,m=y=>i[`evento.${y}`]??i[y],x=Number(m("valor")??0),g=Number(m("valorPorDia")??0),f=p==="por_dia"&&g>0?g:x,v=p==="por_dia"?(l==null?void 0:l.porDia)??Vi:(l==null?void 0:l.todosOsDias)??Bi,b=p==="por_dia"?(()=>{if(!(u!=null&&u.data))return"Um dia";const[y,N,C]=u.data.split("-");return`${C}/${N}/${y}`})():"Todos os dias",j=y=>{if(y.disabled)return;const N=Ss(f,y.taxa),C={metodo:y.id,valorTotal:N};y.parcelas&&(C.parcelas=y.parcelas),n.onChange(C)};return o.jsxs("div",{className:"sfr-payment-method space-y-4",children:[o.jsxs("div",{className:"sfr-payment-method__summary flex items-center justify-between rounded-xl border px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs sfr-text-muted",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:b})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs sfr-text-muted",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold sfr-primary-text",children:Lr(f)})]})]}),o.jsxs("div",{className:"sfr-payment-method__notice flex items-start gap-2 rounded-lg border px-3 py-2.5",children:[o.jsx(P.Info,{className:"h-4 w-4 mt-0.5 shrink-0"}),o.jsxs("p",{className:"text-xs",children:[o.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold sfr-primary-text",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:v.map(y=>{const{Icon:N}=y,C=(c==null?void 0:c.metodo)===y.id,k=Ss(f,y.taxa),_=!!y.parcelas&&y.parcelas>1,w=_?Lf(k,y.parcelas):null;return o.jsxs("button",{type:"button",disabled:y.disabled,onClick:()=>j(y),className:"sfr-payment-method__card w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all","data-selected":C?"true":void 0,"data-disabled":y.disabled?"true":void 0,children:[o.jsx("div",{className:"sfr-payment-method__card-icon flex items-center justify-center w-10 h-10 rounded-lg shrink-0","data-selected":C?"true":void 0,children:o.jsx(N,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:y.label}),o.jsx("p",{className:"text-xs sfr-text-muted",children:y.description}),y.taxaLabel&&o.jsxs("p",{className:"text-xs sfr-payment-method__taxa mt-0.5",children:["* ",y.taxaLabel]}),y.taxa>0&&o.jsxs("p",{className:"text-xs sfr-text-muted",children:["Total com taxa: ",Lr(k)]})]}),o.jsx("div",{className:"text-right shrink-0",children:_?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs sfr-text-muted",children:[y.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold sfr-primary-text",children:Lr(w)})]}):o.jsx("p",{className:"text-base font-bold sfr-primary-text",children:Lr(k)})})]},y.id)})}),d&&o.jsx("p",{className:"text-xs sfr-error",children:d})]})},Hi=({name:e,control:t,label:r,termoTexto:a,termoPdfUrl:n,termoPdfUploadId:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),{resolveTermsUploadUrl:d}=dt(),u=!!c.error,p=(i=c.error)==null?void 0:i.message,[m,x]=E.useState(null),[g,f]=E.useState(!1),[v,b]=E.useState(!1);E.useEffect(()=>{if(!s||!d){x(null);return}f(!0),d(s).then(k=>x(k)).catch(()=>x(null)).finally(()=>f(!1))},[s,d]);const j=l.value==="accepted",y=m||n||null,N=!!(a||y||s),C=!!y;return o.jsxs("div",{className:"sfr-terms space-y-2",children:[o.jsxs("div",{className:"sfr-terms__box rounded-lg border p-4 space-y-4",style:{borderColor:u?"var(--sfr-error, #ef4444)":j?"var(--sfr-success, #22c55e)":"var(--sfr-border, #e2e8f0)",background:u?"color-mix(in srgb, var(--sfr-error, #ef4444) 5%, transparent)":j?"color-mix(in srgb, var(--sfr-success, #22c55e) 5%, transparent)":"transparent"},children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(P.ScrollText,{className:"h-4 w-4 sfr-terms__icon shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),N?o.jsxs("button",{type:"button",className:"sfr-btn sfr-btn--outline flex items-center gap-1.5 text-xs h-7 px-2 border rounded",disabled:g,onClick:()=>b(!0),children:[g?o.jsx(P.Loader2,{className:"h-3 w-3 animate-spin"}):o.jsx(P.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]}):o.jsx("span",{className:"text-xs sfr-text-muted italic",children:s&&g?"Carregando PDF...":"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx("input",{type:"checkbox",className:"sfr-checkbox mt-0.5",checked:j,onChange:k=>l.onChange(k.target.checked?"accepted":""),style:u?{outline:"1px solid var(--sfr-error, #ef4444)"}:{}}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),j&&o.jsx(P.CheckCircle2,{className:"h-4 w-4 sfr-terms__check shrink-0 mt-0.5"})]})]}),u&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs sfr-error",children:[o.jsx(P.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),p||"Você precisa aceitar os termos para continuar"]}),v&&o.jsx("div",{className:"sfr-modal-backdrop fixed inset-0 z-50 flex items-center justify-center p-4",style:{background:"rgba(0,0,0,0.6)"},onClick:()=>b(!1),children:o.jsxs("div",{className:"sfr-modal relative w-full max-w-2xl max-h-[90vh] rounded-xl overflow-hidden flex flex-col",style:{background:"var(--sfr-surface, #ffffff)"},onClick:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b sfr-modal__header",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(P.ScrollText,{className:"h-4 w-4"}),o.jsx("span",{className:"font-semibold",children:"Termos e condições"})]}),o.jsx("button",{type:"button",className:"sfr-btn sfr-btn--ghost",onClick:()=>b(!1),children:o.jsx(P.X,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"flex-1 overflow-auto p-4",children:C?o.jsx("iframe",{src:y,className:"w-full rounded border",style:{height:"62vh"},title:"Termos e condições",sandbox:"allow-scripts allow-same-origin"}):o.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:a})})]})})]})},zf=({name:e,control:t,placeholder:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),[c,d]=E.useState(!1),u=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx("input",{...i,value:i.value??"",type:c?"text":"password",placeholder:r,disabled:a,readOnly:n,className:`sfr-input pr-10${u?" sfr-input--error":""}`,"data-sfr-field":"password"}),o.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(p=>!p),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[var(--t-text-muted)] hover:text-[var(--t-text)] transition-colors","aria-label":c?"Ocultar senha":"Mostrar senha",children:c?o.jsx(P.EyeOff,{size:16}):o.jsx(P.Eye,{size:16})})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Wi=({name:e,control:t,label:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),c=!!i.value;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[o.jsx("button",{type:"button",role:"switch","aria-checked":c,disabled:a||n,onClick:()=>!n&&i.onChange(!c),className:["relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--t-primary)] focus-visible:ring-offset-2",c?"bg-[var(--t-primary)]":"bg-[var(--t-border)]",a?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),children:o.jsx("span",{className:["pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-lg transition-transform",c?"translate-x-5":"translate-x-0.5"].join(" ")})}),o.jsx("span",{className:"sfr-label !mb-0",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Mf=({name:e,control:t,minValue:r=0,maxValue:a=100,step:n=1,disabled:s,readOnly:i})=>{var l;const{field:c,fieldState:d}=ce.useController({name:e,control:t}),u=c.value??r,p=a-r,m=p>0?(u-r)/p*100:0;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"relative flex-1",children:o.jsx("input",{type:"range",min:r,max:a,step:n,value:u,disabled:s||i,onChange:x=>c.onChange(Number(x.target.value)),className:"sfr-slider w-full",style:{"--slider-pct":`${m}%`}})}),o.jsx("span",{className:"sfr-label !mb-0 min-w-[3rem] text-right tabular-nums",style:{color:"var(--t-primary)"},children:u})]}),o.jsxs("div",{className:"flex justify-between text-xs",style:{color:"var(--t-text-muted)"},children:[o.jsx("span",{children:r}),o.jsx("span",{children:a})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"sfr-error",children:d.error.message})]})},Ff=({name:e,control:t,disabled:r,readOnly:a})=>{var n;const{field:s,fieldState:i}=ce.useController({name:e,control:t}),l=s.value??"#000000";return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("input",{type:"color",value:l,disabled:r||a,onChange:c=>s.onChange(c.target.value),className:"h-10 w-14 cursor-pointer rounded-lg border border-[var(--t-border)] bg-transparent p-1 disabled:cursor-not-allowed disabled:opacity-50","data-sfr-field":"color"}),o.jsx("input",{type:"text",value:l,readOnly:a,disabled:r,onChange:c=>{const d=c.target.value;/^#[0-9a-fA-F]{0,6}$/.test(d)&&s.onChange(d)},className:`sfr-input flex-1 font-mono uppercase${i.error?" sfr-input--error":""}`,maxLength:7,placeholder:"#000000"})]}),((n=i.error)==null?void 0:n.message)&&o.jsx("p",{className:"sfr-error",children:i.error.message})]})},Vf=({name:e,control:t,options:r,placeholder:a,disabled:n,readOnly:s})=>{var i,l;const{field:c,fieldState:d}=ce.useController({name:e,control:t}),[u,p]=E.useState(""),[m,x]=E.useState(!1),g=E.useRef(null),f=((i=r.find(y=>y.valor===c.value))==null?void 0:i.label)??"",v=u.length>0?r.filter(y=>y.label.toLowerCase().includes(u.toLowerCase())):r;E.useEffect(()=>{const y=N=>{g.current&&!g.current.contains(N.target)&&(x(!1),p(""))};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[]);const b=y=>{y.disabled||(c.onChange(y.valor),x(!1),p(""))},j=()=>{c.onChange(""),p("")};return o.jsxs("div",{className:"space-y-1",ref:g,children:[o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"text",value:m?u:f,placeholder:a??"Buscar...",disabled:n,readOnly:s,onChange:y=>{p(y.target.value),x(!0)},onFocus:()=>!s&&x(!0),className:`sfr-input pr-8${d.error?" sfr-input--error":""}`,"data-sfr-field":"autocomplete",autoComplete:"off"}),o.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?o.jsx("button",{type:"button",onClick:j,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,children:o.jsx(P.X,{size:14})}):o.jsx(P.ChevronDown,{size:16,className:"text-[var(--t-text-muted)] pointer-events-none"})}),m&&!n&&!s&&o.jsx("ul",{className:"absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-[var(--t-border)] bg-[var(--t-surface)] shadow-lg",children:v.length===0?o.jsx("li",{className:"px-3 py-2 text-sm text-[var(--t-text-muted)]",children:"Nenhuma opção encontrada"}):v.map(y=>o.jsx("li",{onMouseDown:()=>b(y),className:["flex cursor-pointer items-center px-3 py-2 text-sm",y.disabled?"cursor-not-allowed opacity-40":"hover:bg-[var(--t-accent)]",c.value===y.valor?"font-medium text-[var(--t-primary)]":"text-[var(--t-text)]"].join(" "),children:y.label},y.valor))})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"sfr-error",children:d.error.message})]})},qi=({name:e,control:t,placeholder:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),c=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx("input",{...i,value:i.value??"",type:"time",placeholder:r,disabled:a,readOnly:n,className:`sfr-input${c?" sfr-input--error":""}`,"data-sfr-field":"time"}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Bf=({name:e,control:t,startLabel:r="Data inicial",endLabel:a="Data final",disabled:n,readOnly:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),d=l.value??{},u=(m,x)=>{l.onChange({...d,[m]:x})},p=!!c.error;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"sfr-label",children:r}),o.jsx("input",{type:"date",value:d.start??"",disabled:n,readOnly:s,onChange:m=>u("start",m.target.value),max:d.end??void 0,className:`sfr-input${p?" sfr-input--error":""}`,"data-sfr-field":"date-range-start"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"sfr-label",children:a}),o.jsx("input",{type:"date",value:d.end??"",disabled:n,readOnly:s,onChange:m=>u("end",m.target.value),min:d.start??void 0,className:`sfr-input${p?" sfr-input--error":""}`,"data-sfr-field":"date-range-end"})]})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},Uf=({name:e,control:t,maxRating:r=5,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),c=i.value??0,d=Array.from({length:r},(u,p)=>p+1);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[d.map(u=>o.jsx("button",{type:"button",disabled:a||n,onClick:()=>i.onChange(u===c?0:u),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--t-primary)] rounded","aria-label":`${u} estrela${u>1?"s":""}`,children:o.jsx(P.Star,{size:24,className:"transition-colors",fill:u<=c?"var(--t-primary)":"transparent",stroke:u<=c?"var(--t-primary)":"var(--t-border)"})},u)),c>0&&o.jsxs("span",{className:"ml-2 text-sm",style:{color:"var(--t-text-muted)"},children:[c,"/",r]})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Hf=({field:e,name:t,control:r,disabled:a,readOnly:n})=>{const s=a||e.isDisabled,i=n||e.isReadOnly;switch(e.tipo){case O.EMAIL:return o.jsx(Be,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:i});case O.NUMBER:return o.jsx(Be,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:i});case O.PASSWORD:return o.jsx(Be,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:i});case O.TELEFONE:return o.jsx(Ct,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:i});case O.CPF:return o.jsx(Ct,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:i});case O.CEP:return o.jsx(Ct,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:i});case O.TEXTAREA:return o.jsx(xa,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:i});case O.SELECT:return o.jsx(ga,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:i});case O.CHECKBOX:return o.jsx(va,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case O.SWITCH:return o.jsx(Wi,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case O.DATE:return o.jsx(ar,{name:t,control:r,disabled:s,readOnly:i});case O.TIME:return o.jsx(qi,{name:t,control:r,disabled:s,readOnly:i});case O.HIDDEN:return o.jsx(ba,{name:t,control:r});default:return o.jsx(Be,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:i})}},Wf=({name:e,control:t,subSchema:r,disabled:a,readOnly:n})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((i,l)=>i.ordem-l.ordem);return o.jsxs("div",{className:"sfr-subform rounded-xl border p-4 space-y-4",style:{borderColor:"var(--t-border)",background:"color-mix(in srgb, var(--t-surface) 60%, transparent)"},children:[r.titulo&&o.jsx("h4",{className:"sfr-subform__title text-sm font-semibold",style:{color:"var(--t-text-muted)"},children:r.titulo}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(i=>{const l=`${e}.${i.nome}`,c=i.tipo===O.CHECKBOX||i.tipo===O.SWITCH||i.tipo===O.HIDDEN,d=i.tamanho??6;return o.jsxs("div",{className:`col-span-${d}`,children:[!c&&o.jsxs("label",{className:"sfr-label mb-1 block",children:[i.label,i.obrigatorio&&o.jsx("span",{style:{color:"var(--t-error)"},children:" *"})]}),o.jsx(Hf,{field:i,name:l,control:t,disabled:a,readOnly:n})]},i.id)})})]})},Zi=({field:e,control:t,nameOverride:r})=>{var a,n;const s=r??e.nome,{componentMapper:i}=dt(),l=i==null?void 0:i[e.tipo];if(l)return o.jsx(l,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case O.TEXTO:return o.jsx(Be,{...c,type:"text"});case O.EMAIL:return o.jsx(Be,{...c,type:"email"});case O.NUMBER:return o.jsx(Be,{...c,type:"number"});case O.PASSWORD:return o.jsx(zf,{...c});case O.TEXTAREA:return o.jsx(xa,{...c});case O.SELECT:return o.jsx(ga,{...c,options:e.opcoes??[]});case O.AUTOCOMPLETE:return o.jsx(Vf,{...c,options:e.opcoes??[]});case O.SWITCH:return o.jsx(Wi,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.SLIDER:return o.jsx(Mf,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.RATING:return o.jsx(Uf,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.COLOR:return o.jsx(Ff,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.TIME:return o.jsx(qi,{...c});case O.DATE_RANGE:return o.jsx(Bf,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.RADIO:return o.jsx(en,{...c,options:e.opcoes??[]});case O.CHECKBOX:return o.jsx(va,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.CHECKBOX_GROUP:return o.jsx(Qo,{...c,options:e.opcoes??[]});case O.DATE:return o.jsx(ar,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case O.DATETIME:return o.jsx(ar,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case O.FILE:return o.jsx(tn,{name:s,control:t,disabled:e.isDisabled,fileTypes:(a=e.validacao)==null?void 0:a.fileTypes,maxFileSize:(n=e.validacao)==null?void 0:n.maxFileSize});case O.TELEFONE:return o.jsx(Ct,{...c,maskType:"telefone"});case O.CPF:return o.jsx(Ct,{...c,maskType:"cpf"});case O.CEP:return o.jsx(rn,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case O.HIDDEN:return o.jsx(ba,{name:s,control:t});case O.PARTICIPATION_TYPE:return o.jsx(Fi,{name:s,control:t});case O.PAYMENT_METHOD:return o.jsx(Ui,{name:s,control:t,relatedFieldName:e.relatedFieldName});case O.TERMS:return o.jsx(Hi,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case O.FIELD_ARRAY:return o.jsx(Mi,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case O.SUB_FORM:return o.jsx(Wf,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return o.jsx(Be,{...c,type:"text"})}},Xi=()=>{const e=Wo(),t=e.layout.containerStyle,r=["sfr-container overflow-hidden",e.layout.roundness??"rounded-xl",t==="card"?"sfr-container--card border":"",t==="bordered"?"sfr-container--bordered border":"",t==="glassmorphism"?"sfr-container--glass backdrop-blur-sm":""].filter(Boolean).join(" "),a=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},n=["sfr-container__header border-b px-6 py-4",t==="flat"?"border-transparent":""].filter(Boolean).join(" ");return{wrapperClass:r,wrapperStyle:a,headerClass:n,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},qf=({container:e,control:t})=>{var r;const{externalData:a={}}=dt(),n=e.icone?ct[e.icone]:void 0,s=a,i=E.useMemo(()=>ha(e,s),[e,JSON.stringify(s)]),l=E.useMemo(()=>[...i.campos].sort((v,b)=>v.ordem-b.ordem),[i.campos]),c=ce.useWatch({control:t}),{fieldResolvers:d}=dt(),{wrapperClass:u,wrapperStyle:p,headerClass:m,headerStyle:x,tmpl:g}=Xi(),f=v=>{if(!rt(v.condicional,c,a))return null;let b=v;if(v.resolvePropsKey&&d!=null&&d[v.resolvePropsKey]){const k=d[v.resolvePropsKey](v,c,a);b={...v,...k}}if(b.opcoesFromVar){const k=a[b.opcoesFromVar];Array.isArray(k)&&(b={...b,opcoes:k.map(_=>typeof _=="string"?{valor:_,label:_}:_&&typeof _=="object"&&"valor"in _&&"label"in _?_:{valor:String(_),label:String(_)})})}const j=b.tamanho??12,y=b.inicioColuna,N=y?`${y} / span ${j}`:`span ${j}`,C=o.jsx(Zi,{field:b,control:t});return b.tipo===O.CHECKBOX||b.tipo===O.HIDDEN||b.tipo===O.SWITCH?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:N},children:C},b.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:N},children:[o.jsxs("label",{className:"sfr-label font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[b.label,b.obrigatorio&&o.jsx("span",{className:"sfr-required",children:"*"})]}),C,b.hint&&o.jsx("p",{className:"sfr-hint text-xs",style:{color:"var(--t-text-muted)"},children:b.hint})]},b.id)};return o.jsxs("div",{className:u,style:p,children:[(i.titulo||n)&&o.jsx("div",{className:m,style:x,children:o.jsxs("div",{className:"flex items-center gap-3",children:[n&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(n,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=g.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:i.titulo}),i.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:i.descricao})]})]})}),o.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:l.map(f)})]})},Zf=({container:e,control:t})=>{var r;const{externalData:a={}}=dt(),n=e.nome,s=e.minItems??1,i=e.maxItems,l=e.itemLabel??"Item",{fields:c,append:d,remove:u}=ce.useFieldArray({control:t,name:n});E.useEffect(()=>{if(c.length<s)for(let k=c.length;k<s;k++)d({})},[]);const p=e.icone?ct[e.icone]:void 0,m=a,x=E.useMemo(()=>ha(e,m),[e,JSON.stringify(m)]),g=E.useMemo(()=>[...x.campos].sort((k,_)=>k.ordem-_.ordem),[x.campos]),f=ce.useWatch({control:t}),{wrapperClass:v,wrapperStyle:b,headerClass:j,headerStyle:y,tmpl:N}=Xi(),C=(k,_)=>{if(!rt(k.condicional,f,a))return null;const w=`${n}.${_}.${k.nome}`,R=k.tamanho??12,A=k.inicioColuna,I=A?`${A} / span ${R}`:`span ${R}`,F=o.jsx(Zi,{field:k,control:t,nameOverride:w});return k.tipo===O.CHECKBOX||k.tipo===O.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:I},children:F},`${k.id}-${_}`):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:I},children:[o.jsxs("label",{className:"sfr-label font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[k.label,k.obrigatorio&&o.jsx("span",{className:"sfr-required",children:"*"})]}),F,k.hint&&o.jsx("p",{className:"sfr-hint text-xs",style:{color:"var(--t-text-muted)"},children:k.hint})]},`${k.id}-${_}`)};return o.jsxs("div",{className:v,style:b,children:[(x.titulo||p)&&o.jsx("div",{className:j,style:y,children:o.jsxs("div",{className:"flex items-center gap-3",children:[p&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(p,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=N.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:x.titulo}),x.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:x.descricao})]})]})}),o.jsxs("div",{className:"p-6 space-y-4",children:[c.map((k,_)=>o.jsxs("div",{className:"sfr-container__repeat-item border rounded-lg p-4",style:{borderColor:"var(--t-border)",background:"color-mix(in srgb, var(--t-surface) 60%, transparent)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:_+1}),o.jsxs("span",{className:"text-sm font-semibold",style:{color:"var(--t-text)"},children:[l," ",_+1]})]}),c.length>s&&o.jsx("button",{type:"button",onClick:()=>u(_),className:"sfr-btn sfr-btn--ghost sfr-error","aria-label":"Remover item",children:o.jsx(P.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:g.map(w=>C(w,_))})]},k.id)),(!i||c.length<i)&&o.jsxs("button",{type:"button",className:"sfr-btn sfr-btn--outline w-full flex items-center justify-center gap-2 py-2 px-4 border rounded-lg text-sm",onClick:()=>d({}),children:[o.jsx(P.Plus,{className:"w-4 h-4"}),"Adicionar ",l.toLowerCase()]}),i&&o.jsxs("p",{className:"text-xs text-center sfr-text-muted",children:["Máximo de ",i," ",l.toLowerCase(),i>1?"s":""]})]})]})},Gi=e=>e.container.repeatable&&e.container.nome?o.jsx(Zf,{...e}):o.jsx(qf,{...e}),Yi=({step:e,control:t,externalData:r={}})=>{const a=E.useMemo(()=>[...e.containers].sort((s,i)=>s.ordem-i.ordem),[e.containers]),n=ce.useWatch({control:t});return o.jsx("div",{className:"sfr-step grid grid-cols-12 gap-4 sfr-step--animate",children:a.map(s=>{if(s.condicional&&!rt(s.condicional,n,r))return null;const i=s.tamanho??12,l=s.inicioColuna,c=l?`${l} / span ${i}`:`span ${i}`;return o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:o.jsx(Gi,{container:s,control:t})},s.id)})})},Sr=E.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),Xf=Sr.Provider,Gf=()=>{const e=ce.useFormContext(),t=E.useContext(Sr);return{change:(r,a)=>e.setValue(r,a,{shouldValidate:!0,shouldDirty:!0}),reset:r=>e.reset(r),submit:t.requestSubmit,getState:()=>{const{errors:r,isDirty:a,isValid:n}=e.formState;return{values:e.getValues(),errors:Object.fromEntries(Object.entries(r).map(([s,i])=>[s,i==null?void 0:i.message])),warnings:t.warnings,dirty:a,valid:n,submitting:t.submitting}}}},Ki=()=>{const e=ce.useFormContext(),t=E.useContext(Sr),r=ce.useWatch({control:e.control}),{errors:a,isDirty:n,isValid:s}=e.formState;return{values:r,errors:Object.fromEntries(Object.entries(a).map(([i,l])=>[i,l==null?void 0:l.message])),warnings:t.warnings,dirty:n,valid:s,submitting:t.submitting}},Yf=e=>{var t;const r=ce.useFormContext(),{warnings:a}=E.useContext(Sr),n=ce.useWatch({control:r.control,name:e}),s=r.getFieldState(e,r.formState);return{value:n,error:(t=s.error)==null?void 0:t.message,warning:a[e],dirty:s.isDirty,touched:s.isTouched,valid:!s.error}},Kf=e=>{var t;const{control:r}=ce.useFormContext(),{warnings:a}=E.useContext(Sr),{field:n,fieldState:s}=ce.useController({name:e,control:r});return{input:{name:n.name,value:n.value,onChange:n.onChange,onBlur:n.onBlur,ref:n.ref},meta:{error:(t=s.error)==null?void 0:t.message,warning:a[e],touched:s.isTouched,dirty:s.isDirty,valid:!s.error}}},Jf=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"sfr-step-indicator flex items-center gap-2 justify-center flex-wrap",children:e.map((a,n)=>{const s=n<t,i=n===t,l=a.icone?ct[a.icone]:void 0;return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{type:"button",onClick:()=>s&&(r==null?void 0:r(n)),disabled:!s,className:"sfr-step-indicator__dot flex items-center justify-center w-8 h-8 rounded-full text-xs font-bold transition-all","data-active":i?"true":void 0,"data-done":s?"true":void 0,title:a.label,children:s?o.jsx(P.Check,{className:"w-4 h-4"}):l?o.jsx(l,{className:"w-4 h-4"}):n+1}),a.label&&o.jsx("span",{className:"text-xs hidden sm:block sfr-step-indicator__label","data-active":i?"true":void 0,children:a.label}),n<e.length-1&&o.jsx("div",{className:"sfr-step-indicator__line w-6 h-0.5","data-done":s?"true":void 0})]},a.id)})}),Qf=({stepIndex:e,totalSteps:t,step:r,defaultValues:a,externalData:n,fieldErrors:s,isSubmitting:i,submitError:l,validatorMapper:c={},onWarningsChange:d,onValuesChange:u,onSubmit:p,onBack:m})=>{const x=e===t-1,g=E.useMemo(()=>Di(r,n,c),[r.id]),f=E.useMemo(()=>Ai(r,n,c),[r.id]),[v,b]=E.useState({}),j=E.useRef(d);j.current=d;const y=n,N=E.useMemo(()=>Li(r,y),[r,JSON.stringify(y)]),C=ce.useForm({resolver:g,defaultValues:a,mode:"onTouched"}),{control:k,watch:_,setValue:w,handleSubmit:R,setError:A,clearErrors:I}=C;E.useEffect(()=>{I();for(const[z,L]of Object.entries(s))A(z,{type:"server",message:L})},[s,A,I]);const F=E.useMemo(()=>r.containers.flatMap(z=>z.campos).filter(z=>z.condicional&&z.clearedValue!==void 0),[r.containers]),V=E.useMemo(()=>r.containers.flatMap(z=>z.campos).filter(z=>{var L;return z.condicional&&((L=z.setValues)==null?void 0:L.length)}),[r.containers]),M=E.useRef({}),U=ce.useWatch({control:k}),$=E.useRef(u);$.current=u,E.useEffect(()=>{var z;(z=$.current)==null||z.call($,U)},[U]),E.useEffect(()=>{let z=!1;return f(U).then(L=>{var ee;z||(b(L),(ee=j.current)==null||ee.call(j,L))}),()=>{z=!0}},[U,f]),E.useEffect(()=>{var z;if(!F.length&&!V.length)return;const L=U,ee=n;for(const Y of F)if(!rt(Y.condicional,L,n)){const J=Y.clearedValue??"";L[Y.nome]!==J&&w(Y.nome,J,{shouldValidate:!1})}for(const Y of V){const J=rt(Y.condicional,L,n),q=M.current[Y.nome]??!1;if(J&&!q&&(z=Y.setValues)!=null&&z.length)for(const se of Y.setValues){const me=typeof se.valor=="string"?Xe(se.valor,ee):se.valor;w(se.campo,me,{shouldValidate:!1})}M.current[Y.nome]=J}},[U,F,V,n,w]);const T=N.icone?ct[N.icone]:void 0,D=E.useMemo(()=>()=>{C.handleSubmit(p)()},[p]);return o.jsx(ce.FormProvider,{...C,children:o.jsx(Xf,{value:{submitting:i,warnings:v,requestSubmit:D},children:o.jsx("form",{onSubmit:R(p),noValidate:!0,onKeyDown:z=>{z.key==="Enter"&&z.target.tagName==="INPUT"&&z.preventDefault()},children:o.jsxs("div",{className:"space-y-6",children:[N.showLabel!==!1&&o.jsxs("div",{className:"text-center space-y-2",children:[T&&o.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(T,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),o.jsx("h2",{className:"sfr-step__title text-2xl font-bold",style:{color:"var(--t-text)"},children:N.titulo}),N.descricao&&o.jsx("p",{className:"sfr-step__desc text-sm",style:{color:"var(--t-text-muted)"},children:N.descricao})]}),o.jsx(Yi,{step:N,control:k,externalData:n}),o.jsxs("div",{className:"sfr-form__nav flex items-center justify-between gap-4 pt-6 pb-2",children:[o.jsxs("button",{type:"button",className:"sfr-btn sfr-btn--outline flex items-center gap-1 px-4 py-2 border rounded-lg text-sm",onClick:m,disabled:e===0,style:e>0?{borderColor:"color-mix(in srgb, var(--t-primary) 40%, transparent)",color:"var(--t-primary)"}:{},children:[o.jsx(P.ChevronLeft,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),o.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden",style:{color:"var(--t-text-muted)"},children:[e+1,"/",t]}),o.jsxs("button",{type:"submit",className:"sfr-btn sfr-btn--primary flex items-center gap-1 px-4 py-2 rounded-lg text-sm font-semibold",disabled:i,style:{background:"var(--t-primary)",color:"#ffffff"},children:[i?o.jsx(P.Loader2,{className:"w-4 h-4 animate-spin"}):x?o.jsx(P.Check,{className:"w-4 h-4"}):o.jsx(P.ChevronRight,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:x?"Finalizar":"Próximo"})]})]}),l&&o.jsx("p",{className:"sfr-error text-sm mt-2 text-center",children:l})]})})})})},eh=(e,t,r)=>{const a={...t},n=r;for(const s of e.containers)for(const i of s.campos)a[i.nome]===void 0&&(i.initialValue!==void 0?a[i.nome]=typeof i.initialValue=="string"?Xe(i.initialValue,n):i.initialValue:i.defaultValue!==void 0&&(a[i.nome]=i.defaultValue));return a},th=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:a,onComplete:n,template:s,formTitle:i,externalData:l={},fieldErrors:c={},uploadFile:d,cepLookup:u,resolveTermsUploadUrl:p,fieldResolvers:m,validatorMapper:x,componentMapper:g,paymentMethodOptions:f,onValuesChange:v,className:b,StepIndicator:j=Jf})=>{const[y,N]=E.useState(()=>r),[C,k]=E.useState({...t}),[_,w]=E.useState(!1),[R,A]=E.useState(null),[I,F]=E.useState({}),V=E.useMemo(()=>ua(s),[s]),M=E.useMemo(()=>[...e.steps].sort((Y,J)=>Y.ordem-J.ordem),[e.steps]),U=M.length,$=M[Math.min(y,U-1)],T=E.useMemo(()=>eh($,C,l),[$,C,JSON.stringify(l)]),D=E.useMemo(()=>({uploadFile:d,cepLookup:u,resolveTermsUploadUrl:p,externalData:l,fieldResolvers:m,validatorMapper:x,fieldWarnings:I,componentMapper:g,paymentMethodOptions:f}),[d,u,p,m,x,I,g,f,JSON.stringify(l)]),z=E.useCallback(async Y=>{w(!0),A(null);try{const J={...C,...Y};k(J),a&&await a(y,Y),y===U-1?n&&await n(J):N(q=>q+1)}catch(J){console.error("[FormRenderer] Submit error:",J);const q=J instanceof Error?J.message:"Ocorreu um erro. Tente novamente.";A(q)}finally{w(!1)}},[y,C,U,a,n]),L=E.useCallback(()=>{y>0&&N(Y=>Y-1)},[y]),ee=V.layout.eventTitleStyle??"bar";return o.jsx(Jo.Provider,{value:D,children:o.jsx(Ho,{config:V,className:`sfr-root min-h-dvh ${V.wrapperClass??""} ${b??""}`,renderWrapper:!0,children:o.jsxs("div",{className:"sfr-form w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[i&&ee==="bar"&&o.jsx("div",{className:"sfr-form__title w-full text-center text-sm font-medium py-2.5 px-4 mb-6 rounded-lg border",style:{background:"color-mix(in srgb, var(--t-surface) 80%, transparent)",borderColor:"var(--t-border)",color:"var(--t-text-muted)"},children:i}),i&&ee==="inline"&&o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),o.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:i}),o.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),U>1&&o.jsx("div",{className:"mb-8",children:o.jsx(j,{steps:M.map(Y=>({id:Y.id,label:Y.titulo,icone:Y.icone})),currentStep:y,onStepClick:N})}),o.jsx(Qf,{stepIndex:y,totalSteps:U,step:$,defaultValues:T,externalData:l,fieldErrors:c,isSubmitting:_,submitError:R,validatorMapper:x,onWarningsChange:F,onValuesChange:v,onSubmit:z,onBack:L},y)]})})})},rh=({children:e,render:t,onChange:r})=>{const a=Ki(),n=E.useRef(r);return n.current=r,E.useEffect(()=>{var s;(s=n.current)==null||s.call(n,a)},[a.values,a.dirty,a.valid,a.submitting,a.errors,a.warnings]),t?o.jsx(o.Fragment,{children:t(a)}):typeof e=="function"?o.jsx(o.Fragment,{children:e(a)}):e!==void 0?o.jsx(o.Fragment,{children:e}):null},St=[{component:"texto",label:"Texto",icon:P.Type,group:"texto"},{component:"textarea",label:"Área de texto",icon:P.AlignLeft,group:"texto"},{component:"number",label:"Número",icon:P.Hash,group:"texto"},{component:"email",label:"E-mail",icon:P.Mail,group:"texto"},{component:"password",label:"Senha",icon:P.Lock,group:"texto"},{component:"select",label:"Seleção",icon:P.ChevronDown,group:"selecao"},{component:"autocomplete",label:"Autocomplete",icon:P.Search,group:"selecao"},{component:"radio",label:"Radio",icon:P.CircleDot,group:"selecao"},{component:"checkbox",label:"Checkbox",icon:P.CheckSquare,group:"selecao"},{component:"checkbox_group",label:"Grupo de checkboxes",icon:P.ListChecks,group:"selecao"},{component:"switch",label:"Switch (toggle)",icon:P.ToggleLeft,group:"selecao"},{component:"slider",label:"Slider",icon:P.SlidersHorizontal,group:"range"},{component:"rating",label:"Avaliação (estrelas)",icon:P.Star,group:"range"},{component:"color",label:"Cor",icon:P.Palette,group:"range"},{component:"date",label:"Data",icon:P.Calendar,group:"data"},{component:"datetime",label:"Data e hora",icon:P.Clock,group:"data"},{component:"time",label:"Horário",icon:P.Timer,group:"data"},{component:"date_range",label:"Período",icon:P.CalendarRange,group:"data"},{component:"telefone",label:"Telefone",icon:P.Phone,group:"contato"},{component:"cpf",label:"CPF",icon:P.CreditCard,group:"contato"},{component:"cep",label:"CEP",icon:P.MapPin,group:"contato"},{component:"file",label:"Arquivo",icon:P.Upload,group:"outros"},{component:"hidden",label:"Oculto",icon:P.EyeOff,group:"outros"},{component:"field_array",label:"Lista de itens",icon:P.List,group:"outros"},{component:"terms",label:"Termos e condições",icon:P.ScrollText,group:"outros"},{component:"sub_form",label:"Sub-formulário",icon:P.LayoutList,group:"outros"}],an=[{component:"step",label:"Step",icon:P.Layers,color:"border-primary/40 bg-primary/5"},{component:"container",label:"Container",icon:P.BoxSelect,color:"border-blue-500/40 bg-blue-500/5"}],on=[{key:"evento.nome",label:"Nome do evento",type:"string"},{key:"evento.descricao",label:"Descrição",type:"string"},{key:"evento.valor",label:"Valor (centavos)",type:"number"},{key:"evento.valorPorDia",label:"Valor por dia",type:"number"},{key:"evento.vagasTotal",label:"Vagas totais",type:"number"},{key:"evento.vagasPorDia",label:"Vagas por dia",type:"number"},{key:"evento.vagasMasculinas",label:"Vagas masculinas",type:"number"},{key:"evento.vagasFemininas",label:"Vagas femininas",type:"number"},{key:"evento.dataInicioEvento",label:"Data início",type:"date"},{key:"evento.dataFimEvento",label:"Data fim",type:"date"},{key:"evento.dataAberturaInscricoes",label:"Abertura inscrições",type:"date"},{key:"evento.localNome",label:"Local - Nome",type:"string"},{key:"evento.localEndereco",label:"Local - Endereço",type:"string"},{key:"evento.localTelefone",label:"Local - Telefone",type:"string"},{key:"evento.localMapUrl",label:"Local - URL do mapa",type:"string"},{key:"evento.localMapLink",label:"Local - Link do mapa",type:"string"},{key:"evento.status",label:"Status do evento",type:"string"},{key:"evento.publicId",label:"ID público (URL)",type:"string"},{key:"evento.fotoCapa",label:"URL da foto de capa",type:"string"},{key:"evento.template",label:"Template visual",type:"string"}],Ne=e=>e.startsWith("step-")||e==="step"?"step":e.startsWith("container-")||e==="container"?"container":"field",ah=e=>St.find(t=>t.component===e),Ji=e=>{const t=St.map(a=>a.component).filter(a=>a.includes("_"));for(const a of t)if(e.startsWith(a))return St.find(n=>n.component===a);const r=e.split("-")[0];return St.find(a=>a.component===r)},Qi=E.createContext(null),oh=e=>{if(e.startsWith("step"))return"step";if(e.startsWith("container"))return"container";const t=e.match(/^([a-z_]+)-/);return t?t[1]:e.split("-")[0]},to=(e,t)=>{const r=t||oh(e),a=r==="step",n=r==="container",s=r==="field_array";return{label:a?"Novo Step":n?"Novo Container":s?"Lista de itens":r||e,name:e,fieldType:r||"texto",required:!1,columns:2,tamanho:n||s?12:a?void 0:6,showLabel:n?!0:void 0,itemLabel:s?"Item":void 0}},ro=e=>({containers:JSON.parse(JSON.stringify(e.containers)),configs:JSON.parse(JSON.stringify(e.configs))}),el=(e,t)=>{const r=[e],a=t[e];if(a!=null&&a.children)for(const n of a.children)r.push(...el(n,t));return r},tl=(e,t)=>{for(const[r,a]of Object.entries(t))if(a.children.includes(e))return r;return null},rl=({children:e,initialConfigs:t,initialContainers:r,initialTemplateId:a,schemaId:n,uploadTermsPdf:s})=>{const[i,l]=E.useState({selectedId:null,configs:t||{},showPreview:!1,containers:r??{root:{children:[]}},previewTemplateId:a||"moderno"}),[c,d]=E.useState(null),[u,p]=E.useState(null),m=E.useRef([]),x=E.useRef([]),g=$=>{m.current=[...m.current.slice(-49),ro($)],x.current=[]},f=E.useCallback(()=>{l($=>(g($),{...$}))},[]),v=E.useCallback(()=>{m.current.length!==0&&l($=>{x.current=[...x.current,ro($)];const T=m.current.pop();return{...$,containers:T.containers,configs:T.configs}})},[]),b=E.useCallback(()=>{x.current.length!==0&&l($=>{m.current=[...m.current,ro($)];const T=x.current.pop();return{...$,containers:T.containers,configs:T.configs}})},[]);E.useEffect(()=>{const $=T=>{const D=T.metaKey||T.ctrlKey;D&&T.key==="z"&&!T.shiftKey&&(T.preventDefault(),v()),D&&T.key==="z"&&T.shiftKey&&(T.preventDefault(),b()),D&&T.key==="y"&&(T.preventDefault(),b())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[v,b]);const j=E.useCallback($=>i.configs[$]??to($),[i.configs]),y=E.useCallback(()=>{const $=[],T=D=>{var z;const L=((z=i.containers[D])==null?void 0:z.children)??[];for(const ee of L)Ne(ee)==="field"?$.push(ee):i.containers[ee]&&T(ee)};return T("root"),$},[i.containers]),N=E.useCallback($=>{l(T=>({...T,selectedId:$}))},[]),C=E.useCallback($=>{l(T=>({...T,showPreview:$}))},[]),k=E.useCallback($=>{l(T=>({...T,previewTemplateId:$}))},[]),_=E.useCallback(($,T)=>{l(D=>({...D,configs:{...D.configs,[$]:{...D.configs[$]??to($),...T}}}))},[]),w=E.useCallback(($,T,D)=>{const z=`${$}-${Fe()}`,L=Ne(z);return l(ee=>{var Y;g(ee);const J={...ee.containers};(L==="step"||L==="container"||$==="field_array")&&(J[z]={children:[]});const q=[...((Y=J[T])==null?void 0:Y.children)??[]];return D!==void 0&&D>=0?q.splice(D,0,z):q.push(z),J[T]={children:q},{...ee,containers:J,configs:{...ee.configs,[z]:to(z,$)},selectedId:z}}),z},[]),R=E.useCallback(($,T)=>{const D=`container-${Fe()}`;return l(z=>{var L,ee,Y;g(z);const J={...z.containers},q={...z.configs},se=[];for(const H of $.containerTemplate.campos){const ie=H.locked?H.id:`${String(H.tipo).toLowerCase()}-${Fe()}`;if(se.push(ie),q[ie]={label:H.label,name:H.locked?H.id:H.nome,fieldType:H.tipo,required:H.obrigatorio||!1,placeholder:H.placeholder,hint:H.hint,tamanho:H.tamanho||6,inicioColuna:H.inicioColuna,defaultValue:H.defaultValue!=null?String(H.defaultValue):void 0,locked:H.locked||!1,options:(L=H.opcoes)==null?void 0:L.map(te=>({value:te.valor,label:te.label})),...H.tipo==="field_array"&&{itemLabel:H.itemLabel,minItems:H.minItems,maxItems:H.maxItems,addLabel:H.addLabel}},H.tipo==="field_array"){const te=[];for(const re of H.subFields??[]){const Q=`${String(re.tipo).toLowerCase()}-${Fe()}`;te.push(Q),q[Q]={label:re.label,name:re.nome,fieldType:re.tipo,required:re.obrigatorio||!1,placeholder:re.placeholder,hint:re.hint,tamanho:re.tamanho||6,inicioColuna:re.inicioColuna,options:(ee=re.opcoes)==null?void 0:ee.map(fe=>({value:fe.valor,label:fe.label}))}}J[ie]={children:te}}}J[D]={children:se},q[D]={label:$.containerTemplate.titulo||$.name,description:$.containerTemplate.descricao,icone:$.containerTemplate.icone,tamanho:$.containerTemplate.tamanho||12,inicioColuna:$.containerTemplate.inicioColuna,showLabel:!0};const me=[...((Y=J[T])==null?void 0:Y.children)??[]];return me.push(D),J[T]={children:me},{...z,containers:J,configs:q,selectedId:D}}),D},[]),A=E.useCallback($=>{const T=[];return l(D=>{var z,L,ee;g(D);const Y={...D.containers},J={...D.configs};for(const q of $.steps){const se=`step-${Fe()}`;T.push(se);const me=[];for(const ie of q.containers){const te=`container-${Fe()}`;me.push(te);const re=[];for(const Q of ie.campos){const fe=Q.locked?Q.id:`${String(Q.tipo).toLowerCase()}-${Fe()}`;if(re.push(fe),J[fe]={label:Q.label,name:Q.locked?Q.id:Q.nome,fieldType:Q.tipo,required:Q.obrigatorio||!1,placeholder:Q.placeholder,hint:Q.hint,tamanho:Q.tamanho||12,inicioColuna:Q.inicioColuna,defaultValue:Q.defaultValue!=null?String(Q.defaultValue):void 0,locked:Q.locked||!1,options:(z=Q.opcoes)==null?void 0:z.map(we=>({value:we.valor,label:we.label})),...Q.tipo==="field_array"&&{itemLabel:Q.itemLabel,minItems:Q.minItems,maxItems:Q.maxItems,addLabel:Q.addLabel}},Q.tipo==="field_array"){const we=[];for(const je of Q.subFields??[]){const Me=`${String(je.tipo).toLowerCase()}-${Fe()}`;we.push(Me),J[Me]={label:je.label,name:je.nome,fieldType:je.tipo,required:je.obrigatorio||!1,placeholder:je.placeholder,hint:je.hint,tamanho:je.tamanho||6,inicioColuna:je.inicioColuna,options:(L=je.opcoes)==null?void 0:L.map(Ae=>({value:Ae.valor,label:Ae.label}))}}Y[fe]={children:we}}}Y[te]={children:re},J[te]={label:ie.titulo,description:ie.descricao,icone:ie.icone,tamanho:ie.tamanho||12,showLabel:!0}}Y[se]={children:me},J[se]={label:q.titulo,description:q.descricao,icone:q.icone};const H=[...((ee=Y.root)==null?void 0:ee.children)??[],se];Y.root={children:H}}return{...D,containers:Y,configs:J,selectedId:T[0]??D.selectedId}}),T},[]),I=E.useCallback(($,T,D,z)=>{l(L=>{var ee,Y;g(L);const J={...L.containers},q=(((ee=J[T])==null?void 0:ee.children)??[]).filter(H=>H!==$);J[T]={children:q};const se=[...(((Y=J[D])==null?void 0:Y.children)??[]).filter(H=>H!==$)],me=Math.max(0,Math.min(z,se.length));return se.splice(me,0,$),J[D]={children:se},{...L,containers:J}})},[]),F=E.useCallback(($,T)=>{l(D=>(g(D),{...D,containers:{...D.containers,[$]:{children:T}}}))},[]),V=E.useCallback($=>{l(T=>{g(T);const D=el($,T.containers),z={};for(const[ee,Y]of Object.entries(T.containers))D.includes(ee)||(z[ee]={children:Y.children.filter(J=>J!==$)});const L={...T.configs};for(const ee of D)delete L[ee];return{...T,containers:z,configs:L,selectedId:D.includes(T.selectedId??"")?null:T.selectedId}})},[]),M=E.useCallback(($,T)=>{l(D=>{const z=tl($,D.containers);if(!z)return D;const L=[...D.containers[z].children],ee=L.indexOf($),Y=T==="up"?ee-1:ee+1;return Y<0||Y>=L.length?D:([L[ee],L[Y]]=[L[Y],L[ee]],{...D,containers:{...D.containers,[z]:{children:L}}})})},[]),U=E.useCallback(($,T)=>{f(),M($,T)},[M,f]);return o.jsx(Qi.Provider,{value:{selectedId:i.selectedId,configs:i.configs,showPreview:i.showPreview,containers:i.containers,positionDrag:c,reorderDrag:u,canUndo:m.current.length>0,canRedo:x.current.length>0,schemaId:n,uploadTermsPdf:s,previewTemplateId:i.previewTemplateId,setPreviewTemplateId:k,getConfig:j,getAllFieldIds:y,setSelected:N,updateConfig:_,setShowPreview:C,addItem:w,addPresetBlock:R,addPresetStepBlock:A,moveCanvasItem:I,reorderInContainer:F,removeItem:V,moveItem:U,moveItemNoSnapshot:M,setPositionDrag:d,setReorderDrag:p,undo:v,redo:b,pushSnapshot:f},children:e})},Je=()=>{const e=E.useContext(Qi);if(!e)throw new Error("useBuilder must be inside BuilderProvider");return e};function ks(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function nn(...e){return t=>{let r=!1;const a=e.map(n=>{const s=ks(n,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let n=0;n<a.length;n++){const s=a[n];typeof s=="function"?s():ks(e[n],null)}}}}function pe(...e){return h.useCallback(nn(...e),e)}var nh=Symbol.for("react.lazy"),Kr=h[" use ".trim().toString()];function sh(e){return typeof e=="object"&&e!==null&&"then"in e}function al(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===nh&&"_payload"in e&&sh(e._payload)}function ol(e){const t=lh(e),r=h.forwardRef((a,n)=>{let{children:s,...i}=a;al(s)&&typeof Kr=="function"&&(s=Kr(s._payload));const l=h.Children.toArray(s),c=l.find(dh);if(c){const d=c.props.children,u=l.map(p=>p===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:p);return o.jsx(t,{...i,ref:n,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:n,children:s})});return r.displayName=`${e}.Slot`,r}var ih=ol("Slot");function lh(e){const t=h.forwardRef((r,a)=>{let{children:n,...s}=r;if(al(n)&&typeof Kr=="function"&&(n=Kr(n._payload)),h.isValidElement(n)){const i=ph(n),l=uh(s,n.props);return n.type!==h.Fragment&&(l.ref=a?nn(a,i):i),h.cloneElement(n,l)}return h.Children.count(n)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ch=Symbol("radix.slottable");function dh(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ch}function uh(e,t){const r={...t};for(const a in t){const n=e[a],s=t[a];/^on[A-Z]/.test(a)?n&&s?r[a]=(...i)=>{const l=s(...i);return n(...i),l}:n&&(r[a]=n):a==="style"?r[a]={...n,...s}:a==="className"&&(r[a]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}function ph(e){var t,r;let a=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;return n?e.ref:(a=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ya=mh.reduce((e,t)=>{const r=ol(`Primitive.${t}`),a=h.forwardRef((n,s)=>{const{asChild:i,...l}=n,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),fh="Separator",_s="horizontal",hh=["horizontal","vertical"],nl=h.forwardRef((e,t)=>{const{decorative:r,orientation:a=_s,...n}=e,s=xh(a)?a:_s,i=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return o.jsx(ya.div,{"data-orientation":s,...i,...n,ref:t})});nl.displayName=fh;function xh(e){return hh.includes(e)}var sl=nl;function il(e){var t,r,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=il(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function ll(){for(var e,t,r=0,a="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=il(e))&&(a&&(a+=" "),a+=t);return a}const gh=(e,t)=>{const r=new Array(e.length+t.length);for(let a=0;a<e.length;a++)r[a]=e[a];for(let a=0;a<t.length;a++)r[e.length+a]=t[a];return r},vh=(e,t)=>({classGroupId:e,validator:t}),cl=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Jr="-",Es=[],bh="arbitrary..",yh=e=>{const t=jh(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:n=>{if(n.startsWith("[")&&n.endsWith("]"))return wh(n);const s=n.split(Jr),i=s[0]===""&&s.length>1?1:0;return dl(s,i,t)},getConflictingClassGroupIds:(n,s)=>{if(s){const i=a[n],l=r[n];return i?l?gh(l,i):i:l||Es}return r[n]||Es}}},dl=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const a=e[t],n=r.nextPart.get(a);if(n){const c=dl(e,t+1,n);if(c)return c}const s=r.validators;if(s===null)return;const i=t===0?e.join(Jr):e.slice(t).join(Jr),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(i))return d.classGroupId}},wh=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),a=t.slice(0,r);return a?bh+a:void 0})(),jh=e=>{const{theme:t,classGroups:r}=e;return Nh(r,t)},Nh=(e,t)=>{const r=cl();for(const a in e){const n=e[a];sn(n,r,a,t)}return r},sn=(e,t,r,a)=>{const n=e.length;for(let s=0;s<n;s++){const i=e[s];Ch(i,t,r,a)}},Ch=(e,t,r,a)=>{if(typeof e=="string"){Sh(e,t,r);return}if(typeof e=="function"){kh(e,t,r,a);return}_h(e,t,r,a)},Sh=(e,t,r)=>{const a=e===""?t:ul(t,e);a.classGroupId=r},kh=(e,t,r,a)=>{if(Eh(e)){sn(e(a),t,r,a);return}t.validators===null&&(t.validators=[]),t.validators.push(vh(r,e))},_h=(e,t,r,a)=>{const n=Object.entries(e),s=n.length;for(let i=0;i<s;i++){const[l,c]=n[i];sn(c,ul(t,l),r,a)}},ul=(e,t)=>{let r=e;const a=t.split(Jr),n=a.length;for(let s=0;s<n;s++){const i=a[s];let l=r.nextPart.get(i);l||(l=cl(),r.nextPart.set(i,l)),r=l}return r},Eh=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Ph=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),a=Object.create(null);const n=(s,i)=>{r[s]=i,t++,t>e&&(t=0,a=r,r=Object.create(null))};return{get(s){let i=r[s];if(i!==void 0)return i;if((i=a[s])!==void 0)return n(s,i),i},set(s,i){s in r?r[s]=i:n(s,i)}}},jo="!",Ps=":",Th=[],Ts=(e,t,r,a,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:a,isExternal:n}),$h=e=>{const{prefix:t,experimentalParseClassName:r}=e;let a=n=>{const s=[];let i=0,l=0,c=0,d;const u=n.length;for(let f=0;f<u;f++){const v=n[f];if(i===0&&l===0){if(v===Ps){s.push(n.slice(c,f)),c=f+1;continue}if(v==="/"){d=f;continue}}v==="["?i++:v==="]"?i--:v==="("?l++:v===")"&&l--}const p=s.length===0?n:n.slice(c);let m=p,x=!1;p.endsWith(jo)?(m=p.slice(0,-1),x=!0):p.startsWith(jo)&&(m=p.slice(1),x=!0);const g=d&&d>c?d-c:void 0;return Ts(s,x,m,g)};if(t){const n=t+Ps,s=a;a=i=>i.startsWith(n)?s(i.slice(n.length)):Ts(Th,!1,i,void 0,!0)}if(r){const n=a;a=s=>r({className:s,parseClassName:n})}return a},Rh=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,a)=>{t.set(r,1e6+a)}),r=>{const a=[];let n=[];for(let s=0;s<r.length;s++){const i=r[s],l=i[0]==="[",c=t.has(i);l||c?(n.length>0&&(n.sort(),a.push(...n),n=[]),a.push(i)):n.push(i)}return n.length>0&&(n.sort(),a.push(...n)),a}},Oh=e=>({cache:Ph(e.cacheSize),parseClassName:$h(e),sortModifiers:Rh(e),...yh(e)}),Dh=/\s+/,Ah=(e,t)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:n,sortModifiers:s}=t,i=[],l=e.trim().split(Dh);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:m,hasImportantModifier:x,baseClassName:g,maybePostfixModifierPosition:f}=r(u);if(p){c=u+(c.length>0?" "+c:c);continue}let v=!!f,b=a(v?g.substring(0,f):g);if(!b){if(!v){c=u+(c.length>0?" "+c:c);continue}if(b=a(g),!b){c=u+(c.length>0?" "+c:c);continue}v=!1}const j=m.length===0?"":m.length===1?m[0]:s(m).join(":"),y=x?j+jo:j,N=y+b;if(i.indexOf(N)>-1)continue;i.push(N);const C=n(b,v);for(let k=0;k<C.length;++k){const _=C[k];i.push(y+_)}c=u+(c.length>0?" "+c:c)}return c},Ih=(...e)=>{let t=0,r,a,n="";for(;t<e.length;)(r=e[t++])&&(a=pl(r))&&(n&&(n+=" "),n+=a);return n},pl=e=>{if(typeof e=="string")return e;let t,r="";for(let a=0;a<e.length;a++)e[a]&&(t=pl(e[a]))&&(r&&(r+=" "),r+=t);return r},Lh=(e,...t)=>{let r,a,n,s;const i=c=>{const d=t.reduce((u,p)=>p(u),e());return r=Oh(d),a=r.cache.get,n=r.cache.set,s=l,l(c)},l=c=>{const d=a(c);if(d)return d;const u=Ah(c,r);return n(c,u),u};return s=i,(...c)=>s(Ih(...c))},zh=[],_e=e=>{const t=r=>r[e]||zh;return t.isThemeGetter=!0,t},ml=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Mh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Fh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vh=/\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$/,Bh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Uh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Hh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wt=e=>Mh.test(e),ue=e=>!!e&&!Number.isNaN(Number(e)),jt=e=>!!e&&Number.isInteger(Number(e)),ao=e=>e.endsWith("%")&&ue(e.slice(0,-1)),ft=e=>Fh.test(e),hl=()=>!0,Wh=e=>Vh.test(e)&&!Bh.test(e),ln=()=>!1,qh=e=>Uh.test(e),Zh=e=>Hh.test(e),Xh=e=>!X(e)&&!K(e),Gh=e=>$t(e,vl,ln),X=e=>ml.test(e),It=e=>$t(e,bl,Wh),$s=e=>$t(e,ax,ue),Yh=e=>$t(e,wl,hl),Kh=e=>$t(e,yl,ln),Rs=e=>$t(e,xl,ln),Jh=e=>$t(e,gl,Zh),zr=e=>$t(e,jl,qh),K=e=>fl.test(e),gr=e=>qt(e,bl),Qh=e=>qt(e,yl),Os=e=>qt(e,xl),ex=e=>qt(e,vl),tx=e=>qt(e,gl),Mr=e=>qt(e,jl,!0),rx=e=>qt(e,wl,!0),$t=(e,t,r)=>{const a=ml.exec(e);return a?a[1]?t(a[1]):r(a[2]):!1},qt=(e,t,r=!1)=>{const a=fl.exec(e);return a?a[1]?t(a[1]):r:!1},xl=e=>e==="position"||e==="percentage",gl=e=>e==="image"||e==="url",vl=e=>e==="length"||e==="size"||e==="bg-size",bl=e=>e==="length",ax=e=>e==="number",yl=e=>e==="family-name",wl=e=>e==="number"||e==="weight",jl=e=>e==="shadow",ox=()=>{const e=_e("color"),t=_e("font"),r=_e("text"),a=_e("font-weight"),n=_e("tracking"),s=_e("leading"),i=_e("breakpoint"),l=_e("container"),c=_e("spacing"),d=_e("radius"),u=_e("shadow"),p=_e("inset-shadow"),m=_e("text-shadow"),x=_e("drop-shadow"),g=_e("blur"),f=_e("perspective"),v=_e("aspect"),b=_e("ease"),j=_e("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...N(),K,X],k=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],w=()=>[K,X,c],R=()=>[wt,"full","auto",...w()],A=()=>[jt,"none","subgrid",K,X],I=()=>["auto",{span:["full",jt,K,X]},jt,K,X],F=()=>[jt,"auto",K,X],V=()=>["auto","min","max","fr",K,X],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...w()],T=()=>[wt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],D=()=>[wt,"screen","full","dvw","lvw","svw","min","max","fit",...w()],z=()=>[wt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...w()],L=()=>[e,K,X],ee=()=>[...N(),Os,Rs,{position:[K,X]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",ex,Gh,{size:[K,X]}],q=()=>[ao,gr,It],se=()=>["","none","full",d,K,X],me=()=>["",ue,gr,It],H=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[ue,ao,Os,Rs],re=()=>["","none",g,K,X],Q=()=>["none",ue,K,X],fe=()=>["none",ue,K,X],we=()=>[ue,K,X],je=()=>[wt,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ft],breakpoint:[ft],color:[hl],container:[ft],"drop-shadow":[ft],ease:["in","out","in-out"],font:[Xh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ft],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ft],shadow:[ft],spacing:["px",ue],text:[ft],"text-shadow":[ft],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wt,X,K,v]}],container:["container"],columns:[{columns:[ue,X,K,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"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:C()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{"inset-s":R(),start:R()}],end:[{"inset-e":R(),end:R()}],"inset-bs":[{"inset-bs":R()}],"inset-be":[{"inset-be":R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[jt,"auto",K,X]}],basis:[{basis:[wt,"full","auto",l,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ue,wt,"auto","initial","none",X]}],grow:[{grow:["",ue,K,X]}],shrink:[{shrink:["",ue,K,X]}],order:[{order:[jt,"first","last","none",K,X]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:T()}],"inline-size":[{inline:["auto",...D()]}],"min-inline-size":[{"min-inline":["auto",...D()]}],"max-inline-size":[{"max-inline":["none",...D()]}],"block-size":[{block:["auto",...z()]}],"min-block-size":[{"min-block":["auto",...z()]}],"max-block-size":[{"max-block":["none",...z()]}],w:[{w:[l,"screen",...T()]}],"min-w":[{"min-w":[l,"screen","none",...T()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...T()]}],h:[{h:["screen","lh",...T()]}],"min-h":[{"min-h":["screen","lh","none",...T()]}],"max-h":[{"max-h":["screen","lh",...T()]}],"font-size":[{text:["base",r,gr,It]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,rx,Yh]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ao,X]}],"font-family":[{font:[Qh,Kh,t]}],"font-features":[{"font-features":[X]}],"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,K,X]}],"line-clamp":[{"line-clamp":[ue,"none",K,$s]}],leading:[{leading:[s,...w()]}],"list-image":[{"list-image":["none",K,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",K,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:[ue,"from-font","auto",K,It]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[ue,"auto",K,X]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",K,X]}],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",K,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},jt,K,X],radial:["",K,X],conic:[jt,K,X]},tx,Jh]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:me()}],"border-w-x":[{"border-x":me()}],"border-w-y":[{"border-y":me()}],"border-w-s":[{"border-s":me()}],"border-w-e":[{"border-e":me()}],"border-w-bs":[{"border-bs":me()}],"border-w-be":[{"border-be":me()}],"border-w-t":[{"border-t":me()}],"border-w-r":[{"border-r":me()}],"border-w-b":[{"border-b":me()}],"border-w-l":[{"border-l":me()}],"divide-x":[{"divide-x":me()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":me()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...H(),"hidden","none"]}],"divide-style":[{divide:[...H(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...H(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ue,K,X]}],"outline-w":[{outline:["",ue,gr,It]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",u,Mr,zr]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",p,Mr,zr]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[ue,It]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":me()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",m,Mr,zr]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[ue,K,X]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"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":[ue]}],"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":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"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":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"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":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"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":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"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":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"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":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"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":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[K,X]}],"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":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"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":N()}],"mask-image-conic-pos":[{"mask-conic":[ue]}],"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":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",K,X]}],filter:[{filter:["","none",K,X]}],blur:[{blur:re()}],brightness:[{brightness:[ue,K,X]}],contrast:[{contrast:[ue,K,X]}],"drop-shadow":[{"drop-shadow":["","none",x,Mr,zr]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",ue,K,X]}],"hue-rotate":[{"hue-rotate":[ue,K,X]}],invert:[{invert:["",ue,K,X]}],saturate:[{saturate:[ue,K,X]}],sepia:[{sepia:["",ue,K,X]}],"backdrop-filter":[{"backdrop-filter":["","none",K,X]}],"backdrop-blur":[{"backdrop-blur":re()}],"backdrop-brightness":[{"backdrop-brightness":[ue,K,X]}],"backdrop-contrast":[{"backdrop-contrast":[ue,K,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ue,K,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ue,K,X]}],"backdrop-invert":[{"backdrop-invert":["",ue,K,X]}],"backdrop-opacity":[{"backdrop-opacity":[ue,K,X]}],"backdrop-saturate":[{"backdrop-saturate":[ue,K,X]}],"backdrop-sepia":[{"backdrop-sepia":["",ue,K,X]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",K,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ue,"initial",K,X]}],ease:[{ease:["linear","initial",b,K,X]}],delay:[{delay:[ue,K,X]}],animate:[{animate:["none",j,K,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,K,X]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:Q()}],"rotate-x":[{"rotate-x":Q()}],"rotate-y":[{"rotate-y":Q()}],"rotate-z":[{"rotate-z":Q()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[K,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:je()}],"translate-x":[{"translate-x":je()}],"translate-y":[{"translate-y":je()}],"translate-z":[{"translate-z":je()}],"translate-none":["translate-none"],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"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",K,X]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"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",K,X]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[ue,gr,It,$s]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},nx=Lh(ox);function G(...e){return nx(ll(e))}const Ze=h.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...a},n)=>o.jsx(sl,{ref:n,decorative:r,orientation:t,className:G("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...a}));Ze.displayName=sl.displayName;const ae=h.forwardRef(({className:e,type:t,...r},a)=>o.jsx("input",{type:t,className:G("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background 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-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:a,...r}));ae.displayName="Input";var sx="Label",Nl=h.forwardRef((e,t)=>o.jsx(ya.label,{...e,ref:t,onMouseDown:r=>{var a;r.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Nl.displayName=sx;var Cl=Nl;const Ds=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,As=ll,cn=(e,t)=>r=>{var a;if((t==null?void 0:t.variants)==null)return As(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:s}=t,i=Object.keys(n).map(d=>{const u=r==null?void 0:r[d],p=s==null?void 0:s[d];if(u===null)return null;const m=Ds(u)||Ds(p);return n[d][m]}),l=r&&Object.entries(r).reduce((d,u)=>{let[p,m]=u;return m===void 0||(d[p]=m),d},{}),c=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((d,u)=>{let{class:p,className:m,...x}=u;return Object.entries(x).every(g=>{let[f,v]=g;return Array.isArray(v)?v.includes({...s,...l}[f]):{...s,...l}[f]===v})?[...d,p,m]:d},[]);return As(e,i,c,r==null?void 0:r.class,r==null?void 0:r.className)},ix=cn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),W=h.forwardRef(({className:e,...t},r)=>o.jsx(Cl,{ref:r,className:G(ix(),e),...t}));W.displayName=Cl.displayName;function lx(e,t){const r=h.createContext(t),a=s=>{const{children:i,...l}=s,c=h.useMemo(()=>l,Object.values(l));return o.jsx(r.Provider,{value:c,children:i})};a.displayName=e+"Provider";function n(s){const i=h.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[a,n]}function bt(e,t=[]){let r=[];function a(s,i){const l=h.createContext(i),c=r.length;r=[...r,i];const d=p=>{var m;const{scope:x,children:g,...f}=p,v=((m=x==null?void 0:x[e])==null?void 0:m[c])||l,b=h.useMemo(()=>f,Object.values(f));return o.jsx(v.Provider,{value:b,children:g})};d.displayName=s+"Provider";function u(p,m){var x;const g=((x=m==null?void 0:m[e])==null?void 0:x[c])||l,f=h.useContext(g);if(f)return f;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[d,u]}const n=()=>{const s=r.map(i=>h.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return h.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return n.scopeName=e,[a,cx(n,...t)]}function cx(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const a=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(n){const s=a.reduce((i,{useScope:l,scopeName:c})=>{const d=l(n)[`__scope${c}`];return{...i,...d}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function oe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e==null||e(a),r===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}var Ee=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},dx=h[" useInsertionEffect ".trim().toString()]||Ee;function Vt({prop:e,defaultProp:t,onChange:r=()=>{},caller:a}){const[n,s,i]=ux({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:n;{const u=h.useRef(e!==void 0);h.useEffect(()=>{const p=u.current;p!==l&&console.warn(`${a} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,a])}const d=h.useCallback(u=>{var p;if(l){const m=px(u)?u(e):u;m!==e&&((p=i.current)==null||p.call(i,m))}else s(u)},[l,e,s,i]);return[c,d]}function ux({defaultProp:e,onChange:t}){const[r,a]=h.useState(e),n=h.useRef(r),s=h.useRef(t);return dx(()=>{s.current=t},[t]),h.useEffect(()=>{var i;n.current!==r&&((i=s.current)==null||i.call(s,r),n.current=r)},[r,n]),[r,a,s]}function px(e){return typeof e=="function"}function dn(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function un(e){const[t,r]=h.useState(void 0);return Ee(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const s=n[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;r({width:i,height:l})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else r(void 0)},[e]),t}function mx(e,t){return h.useReducer((r,a)=>t[r][a]??r,e)}var Qe=e=>{const{present:t,children:r}=e,a=fx(t),n=typeof r=="function"?r({present:a.isPresent}):h.Children.only(r),s=pe(a.ref,hx(n));return typeof r=="function"||a.isPresent?h.cloneElement(n,{ref:s}):null};Qe.displayName="Presence";function fx(e){const[t,r]=h.useState(),a=h.useRef(null),n=h.useRef(e),s=h.useRef("none"),i=e?"mounted":"unmounted",[l,c]=mx(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const d=Fr(a.current);s.current=l==="mounted"?d:"none"},[l]),Ee(()=>{const d=a.current,u=n.current;if(u!==e){const p=s.current,m=Fr(d);e?c("MOUNT"):m==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&p!==m?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,c]),Ee(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,p=x=>{const g=Fr(a.current).includes(CSS.escape(x.animationName));if(x.target===t&&g&&(c("ANIMATION_END"),!n.current)){const f=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=f)})}},m=x=>{x.target===t&&(s.current=Fr(a.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(d=>{a.current=d?getComputedStyle(d):null,r(d)},[])}}function Fr(e){return(e==null?void 0:e.animationName)||"none"}function hx(e){var t,r;let a=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;return n?e.ref:(a=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function or(e){const t=xx(e),r=h.forwardRef((a,n)=>{const{children:s,...i}=a,l=h.Children.toArray(s),c=l.find(vx);if(c){const d=c.props.children,u=l.map(p=>p===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:p);return o.jsx(t,{...i,ref:n,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:n,children:s})});return r.displayName=`${e}.Slot`,r}function xx(e){const t=h.forwardRef((r,a)=>{const{children:n,...s}=r;if(h.isValidElement(n)){const i=yx(n),l=bx(s,n.props);return n.type!==h.Fragment&&(l.ref=a?nn(a,i):i),h.cloneElement(n,l)}return h.Children.count(n)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sl=Symbol("radix.slottable");function gx(e){const t=({children:r})=>o.jsx(o.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Sl,t}function vx(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Sl}function bx(e,t){const r={...t};for(const a in t){const n=e[a],s=t[a];/^on[A-Z]/.test(a)?n&&s?r[a]=(...i)=>{const l=s(...i);return n(...i),l}:n&&(r[a]=n):a==="style"?r[a]={...n,...s}:a==="className"&&(r[a]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}function yx(e){var t,r;let a=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;return n?e.ref:(a=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var wx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],le=wx.reduce((e,t)=>{const r=or(`Primitive.${t}`),a=h.forwardRef((n,s)=>{const{asChild:i,...l}=n,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function jx(e,t){e&&da.flushSync(()=>e.dispatchEvent(t))}var wa="Checkbox",[Nx]=bt(wa),[Cx,pn]=Nx(wa);function Sx(e){const{__scopeCheckbox:t,checked:r,children:a,defaultChecked:n,disabled:s,form:i,name:l,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:p}=e,[m,x]=Vt({prop:r,defaultProp:n??!1,onChange:c,caller:wa}),[g,f]=h.useState(null),[v,b]=h.useState(null),j=h.useRef(!1),y=g?!!i||!!g.closest("form"):!0,N={checked:m,disabled:s,setChecked:x,control:g,setControl:f,name:l,form:i,value:u,hasConsumerStoppedPropagationRef:j,required:d,defaultChecked:kt(n)?!1:n,isFormControl:y,bubbleInput:v,setBubbleInput:b};return o.jsx(Cx,{scope:t,...N,children:kx(p)?p(N):a})}var kl="CheckboxTrigger",_l=h.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...a},n)=>{const{control:s,value:i,disabled:l,checked:c,required:d,setControl:u,setChecked:p,hasConsumerStoppedPropagationRef:m,isFormControl:x,bubbleInput:g}=pn(kl,e),f=pe(n,u),v=h.useRef(c);return h.useEffect(()=>{const b=s==null?void 0:s.form;if(b){const j=()=>p(v.current);return b.addEventListener("reset",j),()=>b.removeEventListener("reset",j)}},[s,p]),o.jsx(le.button,{type:"button",role:"checkbox","aria-checked":kt(c)?"mixed":c,"aria-required":d,"data-state":Rl(c),"data-disabled":l?"":void 0,disabled:l,value:i,...a,ref:f,onKeyDown:oe(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:oe(r,b=>{p(j=>kt(j)?!0:!j),g&&x&&(m.current=b.isPropagationStopped(),m.current||b.stopPropagation())})})});_l.displayName=kl;var mn=h.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:a,checked:n,defaultChecked:s,required:i,disabled:l,value:c,onCheckedChange:d,form:u,...p}=e;return o.jsx(Sx,{__scopeCheckbox:r,checked:n,defaultChecked:s,disabled:l,required:i,onCheckedChange:d,name:a,form:u,value:c,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(_l,{...p,ref:t,__scopeCheckbox:r}),m&&o.jsx($l,{__scopeCheckbox:r})]})})});mn.displayName=wa;var El="CheckboxIndicator",Pl=h.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:a,...n}=e,s=pn(El,r);return o.jsx(Qe,{present:a||kt(s.checked)||s.checked===!0,children:o.jsx(le.span,{"data-state":Rl(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t,style:{pointerEvents:"none",...e.style}})})});Pl.displayName=El;var Tl="CheckboxBubbleInput",$l=h.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:a,hasConsumerStoppedPropagationRef:n,checked:s,defaultChecked:i,required:l,disabled:c,name:d,value:u,form:p,bubbleInput:m,setBubbleInput:x}=pn(Tl,e),g=pe(r,x),f=dn(s),v=un(a);h.useEffect(()=>{const j=m;if(!j)return;const y=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(y,"checked").set,C=!n.current;if(f!==s&&N){const k=new Event("click",{bubbles:C});j.indeterminate=kt(s),N.call(j,kt(s)?!1:s),j.dispatchEvent(k)}},[m,f,s,n]);const b=h.useRef(kt(s)?!1:s);return o.jsx(le.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??b.current,required:l,disabled:c,name:d,value:u,form:p,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});$l.displayName=Tl;function kx(e){return typeof e=="function"}function kt(e){return e==="indeterminate"}function Rl(e){return kt(e)?"indeterminate":e?"checked":"unchecked"}const Pe=h.forwardRef(({className:e,...t},r)=>o.jsx(mn,{ref:r,className:G("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:o.jsx(Pl,{className:G("flex items-center justify-center text-current"),children:o.jsx(P.Check,{className:"h-4 w-4"})})}));Pe.displayName=mn.displayName;const _x=cn("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 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 hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ye=h.forwardRef(({className:e,variant:t,size:r,asChild:a=!1,...n},s)=>o.jsx(a?ih:"button",{className:G(_x({variant:t,size:r,className:e})),ref:s,...n}));ye.displayName="Button";function Le(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...r)=>{var a;return(a=t.current)==null?void 0:a.call(t,...r)},[])}var Ex=h.createContext(void 0);function fn(e){const t=h.useContext(Ex);return e||t||"ltr"}function wr(e,[t,r]){return Math.min(r,Math.max(t,e))}function Px(e,t){return h.useReducer((r,a)=>t[r][a]??r,e)}var hn="ScrollArea",[Ol]=bt(hn),[Tx,et]=Ol(hn),Dl=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:a="hover",dir:n,scrollHideDelay:s=600,...i}=e,[l,c]=h.useState(null),[d,u]=h.useState(null),[p,m]=h.useState(null),[x,g]=h.useState(null),[f,v]=h.useState(null),[b,j]=h.useState(0),[y,N]=h.useState(0),[C,k]=h.useState(!1),[_,w]=h.useState(!1),R=pe(t,I=>c(I)),A=fn(n);return o.jsx(Tx,{scope:r,type:a,dir:A,scrollHideDelay:s,scrollArea:l,viewport:d,onViewportChange:u,content:p,onContentChange:m,scrollbarX:x,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:k,scrollbarY:f,onScrollbarYChange:v,scrollbarYEnabled:_,onScrollbarYEnabledChange:w,onCornerWidthChange:j,onCornerHeightChange:N,children:o.jsx(le.div,{dir:A,...i,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":y+"px",...e.style}})})});Dl.displayName=hn;var Al="ScrollAreaViewport",Il=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:a,nonce:n,...s}=e,i=et(Al,r),l=h.useRef(null),c=pe(t,l,i.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),o.jsx(le.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})});Il.displayName=Al;var ut="ScrollAreaScrollbar",xn=h.forwardRef((e,t)=>{const{forceMount:r,...a}=e,n=et(ut,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=n,l=e.orientation==="horizontal";return h.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),n.type==="hover"?o.jsx($x,{...a,ref:t,forceMount:r}):n.type==="scroll"?o.jsx(Rx,{...a,ref:t,forceMount:r}):n.type==="auto"?o.jsx(Ll,{...a,ref:t,forceMount:r}):n.type==="always"?o.jsx(gn,{...a,ref:t}):null});xn.displayName=ut;var $x=h.forwardRef((e,t)=>{const{forceMount:r,...a}=e,n=et(ut,e.__scopeScrollArea),[s,i]=h.useState(!1);return h.useEffect(()=>{const l=n.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),i(!0)},u=()=>{c=window.setTimeout(()=>i(!1),n.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",u)}}},[n.scrollArea,n.scrollHideDelay]),o.jsx(Qe,{present:r||s,children:o.jsx(Ll,{"data-state":s?"visible":"hidden",...a,ref:t})})}),Rx=h.forwardRef((e,t)=>{const{forceMount:r,...a}=e,n=et(ut,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Na(()=>c("SCROLL_END"),100),[l,c]=Px("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return h.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,n.scrollHideDelay,c]),h.useEffect(()=>{const d=n.viewport,u=s?"scrollLeft":"scrollTop";if(d){let p=d[u];const m=()=>{const x=d[u];p!==x&&(c("SCROLL"),i()),p=x};return d.addEventListener("scroll",m),()=>d.removeEventListener("scroll",m)}},[n.viewport,s,c,i]),o.jsx(Qe,{present:r||l!=="hidden",children:o.jsx(gn,{"data-state":l==="hidden"?"hidden":"visible",...a,ref:t,onPointerEnter:oe(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:oe(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Ll=h.forwardRef((e,t)=>{const r=et(ut,e.__scopeScrollArea),{forceMount:a,...n}=e,[s,i]=h.useState(!1),l=e.orientation==="horizontal",c=Na(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;i(l?d:u)}},10);return nr(r.viewport,c),nr(r.content,c),o.jsx(Qe,{present:a||s,children:o.jsx(gn,{"data-state":s?"visible":"hidden",...n,ref:t})})}),gn=h.forwardRef((e,t)=>{const{orientation:r="vertical",...a}=e,n=et(ut,e.__scopeScrollArea),s=h.useRef(null),i=h.useRef(0),[l,c]=h.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Bl(l.viewport,l.content),u={...a,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:m=>s.current=m,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:m=>i.current=m};function p(m,x){return zx(m,i.current,l,x)}return r==="horizontal"?o.jsx(Ox,{...u,ref:t,onThumbPositionChange:()=>{if(n.viewport&&s.current){const m=n.viewport.scrollLeft,x=Is(m,l,n.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:m=>{n.viewport&&(n.viewport.scrollLeft=m)},onDragScroll:m=>{n.viewport&&(n.viewport.scrollLeft=p(m,n.dir))}}):r==="vertical"?o.jsx(Dx,{...u,ref:t,onThumbPositionChange:()=>{if(n.viewport&&s.current){const m=n.viewport.scrollTop,x=Is(m,l);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:m=>{n.viewport&&(n.viewport.scrollTop=m)},onDragScroll:m=>{n.viewport&&(n.viewport.scrollTop=p(m))}}):null}),Ox=h.forwardRef((e,t)=>{const{sizes:r,onSizesChange:a,...n}=e,s=et(ut,e.__scopeScrollArea),[i,l]=h.useState(),c=h.useRef(null),d=pe(t,c,s.onScrollbarXChange);return h.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Ml,{"data-orientation":"horizontal",...n,ref:d,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ja(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,p)=>{if(s.viewport){const m=s.viewport.scrollLeft+u.deltaX;e.onWheelScroll(m),Hl(m,p)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&a({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:ea(i.paddingLeft),paddingEnd:ea(i.paddingRight)}})}})}),Dx=h.forwardRef((e,t)=>{const{sizes:r,onSizesChange:a,...n}=e,s=et(ut,e.__scopeScrollArea),[i,l]=h.useState(),c=h.useRef(null),d=pe(t,c,s.onScrollbarYChange);return h.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Ml,{"data-orientation":"vertical",...n,ref:d,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ja(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,p)=>{if(s.viewport){const m=s.viewport.scrollTop+u.deltaY;e.onWheelScroll(m),Hl(m,p)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&a({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:ea(i.paddingTop),paddingEnd:ea(i.paddingBottom)}})}})}),[Ax,zl]=Ol(ut),Ml=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:a,hasThumb:n,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:u,onResize:p,...m}=e,x=et(ut,r),[g,f]=h.useState(null),v=pe(t,R=>f(R)),b=h.useRef(null),j=h.useRef(""),y=x.viewport,N=a.content-a.viewport,C=Le(u),k=Le(c),_=Na(p,10);function w(R){if(b.current){const A=R.clientX-b.current.left,I=R.clientY-b.current.top;d({x:A,y:I})}}return h.useEffect(()=>{const R=A=>{const I=A.target;g!=null&&g.contains(I)&&C(A,N)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[y,g,N,C]),h.useEffect(k,[a,k]),nr(g,_),nr(x.content,_),o.jsx(Ax,{scope:r,scrollbar:g,hasThumb:n,onThumbChange:Le(s),onThumbPointerUp:Le(i),onThumbPositionChange:k,onThumbPointerDown:Le(l),children:o.jsx(le.div,{...m,ref:v,style:{position:"absolute",...m.style},onPointerDown:oe(e.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),b.current=g.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),w(R))}),onPointerMove:oe(e.onPointerMove,w),onPointerUp:oe(e.onPointerUp,R=>{const A=R.target;A.hasPointerCapture(R.pointerId)&&A.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=j.current,x.viewport&&(x.viewport.style.scrollBehavior=""),b.current=null})})})}),Qr="ScrollAreaThumb",Fl=h.forwardRef((e,t)=>{const{forceMount:r,...a}=e,n=zl(Qr,e.__scopeScrollArea);return o.jsx(Qe,{present:r||n.hasThumb,children:o.jsx(Ix,{ref:t,...a})})}),Ix=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:a,...n}=e,s=et(Qr,r),i=zl(Qr,r),{onThumbPositionChange:l}=i,c=pe(t,p=>i.onThumbChange(p)),d=h.useRef(void 0),u=Na(()=>{d.current&&(d.current(),d.current=void 0)},100);return h.useEffect(()=>{const p=s.viewport;if(p){const m=()=>{if(u(),!d.current){const x=Mx(p,l);d.current=x,l()}};return l(),p.addEventListener("scroll",m),()=>p.removeEventListener("scroll",m)}},[s.viewport,u,l]),o.jsx(le.div,{"data-state":i.hasThumb?"visible":"hidden",...n,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:oe(e.onPointerDownCapture,p=>{const m=p.target.getBoundingClientRect(),x=p.clientX-m.left,g=p.clientY-m.top;i.onThumbPointerDown({x,y:g})}),onPointerUp:oe(e.onPointerUp,i.onThumbPointerUp)})});Fl.displayName=Qr;var vn="ScrollAreaCorner",Vl=h.forwardRef((e,t)=>{const r=et(vn,e.__scopeScrollArea),a=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&a?o.jsx(Lx,{...e,ref:t}):null});Vl.displayName=vn;var Lx=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,...a}=e,n=et(vn,r),[s,i]=h.useState(0),[l,c]=h.useState(0),d=!!(s&&l);return nr(n.scrollbarX,()=>{var u;const p=((u=n.scrollbarX)==null?void 0:u.offsetHeight)||0;n.onCornerHeightChange(p),c(p)}),nr(n.scrollbarY,()=>{var u;const p=((u=n.scrollbarY)==null?void 0:u.offsetWidth)||0;n.onCornerWidthChange(p),i(p)}),d?o.jsx(le.div,{...a,ref:t,style:{width:s,height:l,position:"absolute",right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function ea(e){return e?parseInt(e,10):0}function Bl(e,t){const r=e/t;return isNaN(r)?0:r}function ja(e){const t=Bl(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=(e.scrollbar.size-r)*t;return Math.max(a,18)}function zx(e,t,r,a="ltr"){const n=ja(r),s=n/2,i=t||s,l=n-i,c=r.scrollbar.paddingStart+i,d=r.scrollbar.size-r.scrollbar.paddingEnd-l,u=r.content-r.viewport,p=a==="ltr"?[0,u]:[u*-1,0];return Ul([c,d],p)(e)}function Is(e,t,r="ltr"){const a=ja(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-n,i=t.content-t.viewport,l=s-a,c=r==="ltr"?[0,i]:[i*-1,0],d=wr(e,c);return Ul([0,i],[0,l])(d)}function Ul(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(r-e[0])}}function Hl(e,t){return e>0&&e<t}var Mx=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},a=0;return function n(){const s={left:e.scrollLeft,top:e.scrollTop},i=r.left!==s.left,l=r.top!==s.top;(i||l)&&t(),r=s,a=window.requestAnimationFrame(n)}(),()=>window.cancelAnimationFrame(a)};function Na(e,t){const r=Le(e),a=h.useRef(0);return h.useEffect(()=>()=>window.clearTimeout(a.current),[]),h.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(r,t)},[r,t])}function nr(e,t){const r=Le(t);Ee(()=>{let a=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(a),n.unobserve(e)}}},[e,r])}var Wl=Dl,Fx=Il,Vx=Vl;const Ca=h.forwardRef(({className:e,children:t,...r},a)=>o.jsxs(Wl,{ref:a,className:G("relative overflow-hidden",e),...r,children:[o.jsx(Fx,{className:"h-full w-full rounded-[inherit]",children:t}),o.jsx(ql,{}),o.jsx(Vx,{})]}));Ca.displayName=Wl.displayName;const ql=h.forwardRef(({className:e,orientation:t="vertical",...r},a)=>o.jsx(xn,{ref:a,orientation:t,className:G("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:o.jsx(Fl,{className:"relative flex-1 rounded-full bg-border"})}));ql.displayName=xn.displayName;var Bx=h[" useId ".trim().toString()]||(()=>{}),Ux=0;function _t(e){const[t,r]=h.useState(Bx());return Ee(()=>{r(a=>a??String(Ux++))},[e]),t?`radix-${t}`:""}function Hx(e,t=globalThis==null?void 0:globalThis.document){const r=Le(e);h.useEffect(()=>{const a=n=>{n.key==="Escape"&&r(n)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[r,t])}var Wx="DismissableLayer",No="dismissableLayer.update",qx="dismissableLayer.pointerDownOutside",Zx="dismissableLayer.focusOutside",Ls,Zl=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kr=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:a,onPointerDownOutside:n,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,d=h.useContext(Zl),[u,p]=h.useState(null),m=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=h.useState({}),g=pe(t,_=>p(_)),f=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=f.indexOf(v),j=u?f.indexOf(u):-1,y=d.layersWithOutsidePointerEventsDisabled.size>0,N=j>=b,C=Yx(_=>{const w=_.target,R=[...d.branches].some(A=>A.contains(w));!N||R||(n==null||n(_),i==null||i(_),_.defaultPrevented||l==null||l())},m),k=Kx(_=>{const w=_.target;[...d.branches].some(R=>R.contains(w))||(s==null||s(_),i==null||i(_),_.defaultPrevented||l==null||l())},m);return Hx(_=>{j===d.layers.size-1&&(a==null||a(_),!_.defaultPrevented&&l&&(_.preventDefault(),l()))},m),h.useEffect(()=>{if(u)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Ls=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),zs(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Ls)}},[u,m,r,d]),h.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),zs())},[u,d]),h.useEffect(()=>{const _=()=>x({});return document.addEventListener(No,_),()=>document.removeEventListener(No,_)},[]),o.jsx(le.div,{...c,ref:g,style:{pointerEvents:y?N?"auto":"none":void 0,...e.style},onFocusCapture:oe(e.onFocusCapture,k.onFocusCapture),onBlurCapture:oe(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:oe(e.onPointerDownCapture,C.onPointerDownCapture)})});kr.displayName=Wx;var Xx="DismissableLayerBranch",Gx=h.forwardRef((e,t)=>{const r=h.useContext(Zl),a=h.useRef(null),n=pe(t,a);return h.useEffect(()=>{const s=a.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),o.jsx(le.div,{...e,ref:n})});Gx.displayName=Xx;function Yx(e,t=globalThis==null?void 0:globalThis.document){const r=Le(e),a=h.useRef(!1),n=h.useRef(()=>{});return h.useEffect(()=>{const s=l=>{if(l.target&&!a.current){let c=function(){Xl(qx,r,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",n.current),n.current=c,t.addEventListener("click",n.current,{once:!0})):c()}else t.removeEventListener("click",n.current);a.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",n.current)}},[t,r]),{onPointerDownCapture:()=>a.current=!0}}function Kx(e,t=globalThis==null?void 0:globalThis.document){const r=Le(e),a=h.useRef(!1);return h.useEffect(()=>{const n=s=>{s.target&&!a.current&&Xl(Zx,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function zs(){const e=new CustomEvent(No);document.dispatchEvent(e)}function Xl(e,t,r,{discrete:a}){const n=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),a?jx(n,s):n.dispatchEvent(s)}var oo="focusScope.autoFocusOnMount",no="focusScope.autoFocusOnUnmount",Ms={bubbles:!1,cancelable:!0},Jx="FocusScope",Sa=h.forwardRef((e,t)=>{const{loop:r=!1,trapped:a=!1,onMountAutoFocus:n,onUnmountAutoFocus:s,...i}=e,[l,c]=h.useState(null),d=Le(n),u=Le(s),p=h.useRef(null),m=pe(t,f=>c(f)),x=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(a){let f=function(y){if(x.paused||!l)return;const N=y.target;l.contains(N)?p.current=N:Nt(p.current,{select:!0})},v=function(y){if(x.paused||!l)return;const N=y.relatedTarget;N!==null&&(l.contains(N)||Nt(p.current,{select:!0}))},b=function(y){if(document.activeElement===document.body)for(const N of y)N.removedNodes.length>0&&Nt(l)};document.addEventListener("focusin",f),document.addEventListener("focusout",v);const j=new MutationObserver(b);return l&&j.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",v),j.disconnect()}}},[a,l,x.paused]),h.useEffect(()=>{if(l){Vs.add(x);const f=document.activeElement;if(!l.contains(f)){const v=new CustomEvent(oo,Ms);l.addEventListener(oo,d),l.dispatchEvent(v),v.defaultPrevented||(Qx(og(Gl(l)),{select:!0}),document.activeElement===f&&Nt(l))}return()=>{l.removeEventListener(oo,d),setTimeout(()=>{const v=new CustomEvent(no,Ms);l.addEventListener(no,u),l.dispatchEvent(v),v.defaultPrevented||Nt(f??document.body,{select:!0}),l.removeEventListener(no,u),Vs.remove(x)},0)}}},[l,d,u,x]);const g=h.useCallback(f=>{if(!r&&!a||x.paused)return;const v=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,b=document.activeElement;if(v&&b){const j=f.currentTarget,[y,N]=eg(j);y&&N?!f.shiftKey&&b===N?(f.preventDefault(),r&&Nt(y,{select:!0})):f.shiftKey&&b===y&&(f.preventDefault(),r&&Nt(N,{select:!0})):b===j&&f.preventDefault()}},[r,a,x.paused]);return o.jsx(le.div,{tabIndex:-1,...i,ref:m,onKeyDown:g})});Sa.displayName=Jx;function Qx(e,{select:t=!1}={}){const r=document.activeElement;for(const a of e)if(Nt(a,{select:t}),document.activeElement!==r)return}function eg(e){const t=Gl(e),r=Fs(t,e),a=Fs(t.reverse(),e);return[r,a]}function Gl(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const n=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||n?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Fs(e,t){for(const r of e)if(!tg(r,{upTo:t}))return r}function tg(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function rg(e){return e instanceof HTMLInputElement&&"select"in e}function Nt(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&rg(e)&&t&&e.select()}}var Vs=ag();function ag(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Bs(e,t),e.unshift(t)},remove(t){var r;e=Bs(e,t),(r=e[0])==null||r.resume()}}}function Bs(e,t){const r=[...e],a=r.indexOf(t);return a!==-1&&r.splice(a,1),r}function og(e){return e.filter(t=>t.tagName!=="A")}var ng="Portal",ka=h.forwardRef((e,t)=>{var r;const{container:a,...n}=e,[s,i]=h.useState(!1);Ee(()=>i(!0),[]);const l=a||s&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return l?Bo.createPortal(o.jsx(le.div,{...n,ref:t}),l):null});ka.displayName=ng;var so=0;function bn(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Us()),document.body.insertAdjacentElement("beforeend",e[1]??Us()),so++,()=>{so===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),so--}},[])}function Us(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var st=function(){return st=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},st.apply(this,arguments)};function Yl(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]]);return r}function sg(e,t,r){for(var a=0,n=t.length,s;a<n;a++)(s||!(a in t))&&(s||(s=Array.prototype.slice.call(t,0,a)),s[a]=t[a]);return e.concat(s||Array.prototype.slice.call(t))}var Zr="right-scroll-bar-position",Xr="width-before-scroll-bar",ig="with-scroll-bars-hidden",lg="--removed-body-scroll-bar-size";function io(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function cg(e,t){var r=E.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(a){var n=r.value;n!==a&&(r.value=a,r.callback(a,n))}}}})[0];return r.callback=t,r.facade}var dg=typeof window<"u"?h.useLayoutEffect:h.useEffect,Hs=new WeakMap;function ug(e,t){var r=cg(null,function(a){return e.forEach(function(n){return io(n,a)})});return dg(function(){var a=Hs.get(r);if(a){var n=new Set(a),s=new Set(e),i=r.current;n.forEach(function(l){s.has(l)||io(l,null)}),s.forEach(function(l){n.has(l)||io(l,i)})}Hs.set(r,e)},[e]),r}function pg(e){return e}function mg(e,t){t===void 0&&(t=pg);var r=[],a=!1,n={read:function(){if(a)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(s){var i=t(s,a);return r.push(i),function(){r=r.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(a=!0;r.length;){var i=r;r=[],i.forEach(s)}r={push:function(l){return s(l)},filter:function(){return r}}},assignMedium:function(s){a=!0;var i=[];if(r.length){var l=r;r=[],l.forEach(s),i=r}var c=function(){var u=i;i=[],u.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(u){i.push(u),d()},filter:function(u){return i=i.filter(u),r}}}};return n}function fg(e){e===void 0&&(e={});var t=mg(null);return t.options=st({async:!0,ssr:!1},e),t}var Kl=function(e){var t=e.sideCar,r=Yl(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return h.createElement(a,st({},r))};Kl.isSideCarExport=!0;function hg(e,t){return e.useMedium(t),Kl}var Jl=fg(),lo=function(){},_a=h.forwardRef(function(e,t){var r=h.useRef(null),a=h.useState({onScrollCapture:lo,onWheelCapture:lo,onTouchMoveCapture:lo}),n=a[0],s=a[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,p=e.shards,m=e.sideCar,x=e.noRelative,g=e.noIsolation,f=e.inert,v=e.allowPinchZoom,b=e.as,j=b===void 0?"div":b,y=e.gapMode,N=Yl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=m,k=ug([r,t]),_=st(st({},N),n);return h.createElement(h.Fragment,null,u&&h.createElement(C,{sideCar:Jl,removeScrollBar:d,shards:p,noRelative:x,noIsolation:g,inert:f,setCallbacks:s,allowPinchZoom:!!v,lockRef:r,gapMode:y}),i?h.cloneElement(h.Children.only(l),st(st({},_),{ref:k})):h.createElement(j,st({},_,{className:c,ref:k}),l))});_a.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_a.classNames={fullWidth:Xr,zeroRight:Zr};var xg=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function gg(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=xg();return t&&e.setAttribute("nonce",t),e}function vg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function bg(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var yg=function(){var e=0,t=null;return{add:function(r){e==0&&(t=gg())&&(vg(t,r),bg(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},wg=function(){var e=yg();return function(t,r){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Ql=function(){var e=wg(),t=function(r){var a=r.styles,n=r.dynamic;return e(a,n),null};return t},jg={left:0,top:0,right:0,gap:0},co=function(e){return parseInt(e||"",10)||0},Ng=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],n=t[e==="padding"?"paddingRight":"marginRight"];return[co(r),co(a),co(n)]},Cg=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return jg;var t=Ng(e),r=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-r+t[2]-t[0])}},Sg=Ql(),tr="data-scroll-locked",kg=function(e,t,r,a){var n=e.left,s=e.top,i=e.right,l=e.gap;return r===void 0&&(r="margin"),`
|
|
33
|
+
.`.concat(ig,` {
|
|
34
34
|
overflow: hidden `).concat(a,`;
|
|
35
35
|
padding-right: `).concat(l,"px ").concat(a,`;
|
|
36
36
|
}
|
|
@@ -64,18 +64,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
body[`).concat(tr,`] {
|
|
67
|
-
`).concat(
|
|
67
|
+
`).concat(lg,": ").concat(l,`px;
|
|
68
68
|
}
|
|
69
|
-
`)},
|
|
69
|
+
`)},Ws=function(){var e=parseInt(document.body.getAttribute(tr)||"0",10);return isFinite(e)?e:0},_g=function(){h.useEffect(function(){return document.body.setAttribute(tr,(Ws()+1).toString()),function(){var e=Ws()-1;e<=0?document.body.removeAttribute(tr):document.body.setAttribute(tr,e.toString())}},[])},Eg=function(e){var t=e.noRelative,r=e.noImportant,a=e.gapMode,n=a===void 0?"margin":a;_g();var s=h.useMemo(function(){return Cg(n)},[n]);return h.createElement(Sg,{styles:kg(s,!t,n,r?"":"!important")})},Co=!1;if(typeof window<"u")try{var Vr=Object.defineProperty({},"passive",{get:function(){return Co=!0,!0}});window.addEventListener("test",Vr,Vr),window.removeEventListener("test",Vr,Vr)}catch{Co=!1}var Gt=Co?{passive:!1}:!1,Pg=function(e){return e.tagName==="TEXTAREA"},ec=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!Pg(e)&&r[t]==="visible")},Tg=function(e){return ec(e,"overflowY")},$g=function(e){return ec(e,"overflowX")},qs=function(e,t){var r=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var n=tc(e,a);if(n){var s=rc(e,a),i=s[1],l=s[2];if(i>l)return!0}a=a.parentNode}while(a&&a!==r.body);return!1},Rg=function(e){var t=e.scrollTop,r=e.scrollHeight,a=e.clientHeight;return[t,r,a]},Og=function(e){var t=e.scrollLeft,r=e.scrollWidth,a=e.clientWidth;return[t,r,a]},tc=function(e,t){return e==="v"?Tg(t):$g(t)},rc=function(e,t){return e==="v"?Rg(t):Og(t)},Dg=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ag=function(e,t,r,a,n){var s=Dg(e,window.getComputedStyle(t).direction),i=s*a,l=r.target,c=t.contains(l),d=!1,u=i>0,p=0,m=0;do{if(!l)break;var x=rc(e,l),g=x[0],f=x[1],v=x[2],b=f-v-s*g;(g||b)&&tc(e,l)&&(p+=b,m+=g);var j=l.parentNode;l=j&&j.nodeType===Node.DOCUMENT_FRAGMENT_NODE?j.host:j}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(u&&Math.abs(p)<1||!u&&Math.abs(m)<1)&&(d=!0),d},Br=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Zs=function(e){return[e.deltaX,e.deltaY]},Xs=function(e){return e&&"current"in e?e.current:e},Ig=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Lg=function(e){return`
|
|
70
70
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
71
71
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
72
|
-
`)},
|
|
72
|
+
`)},zg=0,Yt=[];function Mg(e){var t=h.useRef([]),r=h.useRef([0,0]),a=h.useRef(),n=h.useState(zg++)[0],s=h.useState(Ql)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var f=sg([e.lockRef.current],(e.shards||[]).map(Xs)).filter(Boolean);return f.forEach(function(v){return v.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),f.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(f,v){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!i.current.allowPinchZoom;var b=Br(f),j=r.current,y="deltaX"in f?f.deltaX:j[0]-b[0],N="deltaY"in f?f.deltaY:j[1]-b[1],C,k=f.target,_=Math.abs(y)>Math.abs(N)?"h":"v";if("touches"in f&&_==="h"&&k.type==="range")return!1;var w=window.getSelection(),R=w&&w.anchorNode,A=R?R===k||R.contains(k):!1;if(A)return!1;var I=qs(_,k);if(!I)return!0;if(I?C=_:(C=_==="v"?"h":"v",I=qs(_,k)),!I)return!1;if(!a.current&&"changedTouches"in f&&(y||N)&&(a.current=C),!C)return!0;var F=a.current||C;return Ag(F,v,f,F==="h"?y:N)},[]),c=h.useCallback(function(f){var v=f;if(!(!Yt.length||Yt[Yt.length-1]!==s)){var b="deltaY"in v?Zs(v):Br(v),j=t.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&Ig(C.delta,b)})[0];if(j&&j.should){v.cancelable&&v.preventDefault();return}if(!j){var y=(i.current.shards||[]).map(Xs).filter(Boolean).filter(function(C){return C.contains(v.target)}),N=y.length>0?l(v,y[0]):!i.current.noIsolation;N&&v.cancelable&&v.preventDefault()}}},[]),d=h.useCallback(function(f,v,b,j){var y={name:f,delta:v,target:b,should:j,shadowParent:Fg(b)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(N){return N!==y})},1)},[]),u=h.useCallback(function(f){r.current=Br(f),a.current=void 0},[]),p=h.useCallback(function(f){d(f.type,Zs(f),f.target,l(f,e.lockRef.current))},[]),m=h.useCallback(function(f){d(f.type,Br(f),f.target,l(f,e.lockRef.current))},[]);h.useEffect(function(){return Yt.push(s),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Gt),document.addEventListener("touchmove",c,Gt),document.addEventListener("touchstart",u,Gt),function(){Yt=Yt.filter(function(f){return f!==s}),document.removeEventListener("wheel",c,Gt),document.removeEventListener("touchmove",c,Gt),document.removeEventListener("touchstart",u,Gt)}},[]);var x=e.removeScrollBar,g=e.inert;return h.createElement(h.Fragment,null,g?h.createElement(s,{styles:Lg(n)}):null,x?h.createElement(Eg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Fg(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Vg=hg(Jl,Mg);var Ea=h.forwardRef(function(e,t){return h.createElement(_a,st({},e,{ref:t,sideCar:Vg}))});Ea.classNames=_a.classNames;var Bg=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Kt=new WeakMap,Ur=new WeakMap,Hr={},uo=0,ac=function(e){return e&&(e.host||ac(e.parentNode))},Ug=function(e,t){return t.map(function(r){if(e.contains(r))return r;var a=ac(r);return a&&e.contains(a)?a:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Hg=function(e,t,r,a){var n=Ug(t,Array.isArray(e)?e:[e]);Hr[r]||(Hr[r]=new WeakMap);var s=Hr[r],i=[],l=new Set,c=new Set(n),d=function(p){!p||l.has(p)||(l.add(p),d(p.parentNode))};n.forEach(d);var u=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(m){if(l.has(m))u(m);else try{var x=m.getAttribute(a),g=x!==null&&x!=="false",f=(Kt.get(m)||0)+1,v=(s.get(m)||0)+1;Kt.set(m,f),s.set(m,v),i.push(m),f===1&&g&&Ur.set(m,!0),v===1&&m.setAttribute(r,"true"),g||m.setAttribute(a,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return u(t),l.clear(),uo++,function(){i.forEach(function(p){var m=Kt.get(p)-1,x=s.get(p)-1;Kt.set(p,m),s.set(p,x),m||(Ur.has(p)||p.removeAttribute(a),Ur.delete(p)),x||p.removeAttribute(r)}),uo--,uo||(Kt=new WeakMap,Kt=new WeakMap,Ur=new WeakMap,Hr={})}},yn=function(e,t,r){r===void 0&&(r="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),n=Bg(e);return n?(a.push.apply(a,Array.from(n.querySelectorAll("[aria-live], script"))),Hg(a,n,r,"aria-hidden")):function(){return null}},Pa="Dialog",[oc]=bt(Pa),[Wg,nt]=oc(Pa),nc=e=>{const{__scopeDialog:t,children:r,open:a,defaultOpen:n,onOpenChange:s,modal:i=!0}=e,l=h.useRef(null),c=h.useRef(null),[d,u]=Vt({prop:a,defaultProp:n??!1,onChange:s,caller:Pa});return o.jsx(Wg,{scope:t,triggerRef:l,contentRef:c,contentId:_t(),titleId:_t(),descriptionId:_t(),open:d,onOpenChange:u,onOpenToggle:h.useCallback(()=>u(p=>!p),[u]),modal:i,children:r})};nc.displayName=Pa;var sc="DialogTrigger",qg=h.forwardRef((e,t)=>{const{__scopeDialog:r,...a}=e,n=nt(sc,r),s=pe(t,n.triggerRef);return o.jsx(le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":Nn(n.open),...a,ref:s,onClick:oe(e.onClick,n.onOpenToggle)})});qg.displayName=sc;var wn="DialogPortal",[Zg,ic]=oc(wn,{forceMount:void 0}),lc=e=>{const{__scopeDialog:t,forceMount:r,children:a,container:n}=e,s=nt(wn,t);return o.jsx(Zg,{scope:t,forceMount:r,children:h.Children.map(a,i=>o.jsx(Qe,{present:r||s.open,children:o.jsx(ka,{asChild:!0,container:n,children:i})}))})};lc.displayName=wn;var ta="DialogOverlay",cc=h.forwardRef((e,t)=>{const r=ic(ta,e.__scopeDialog),{forceMount:a=r.forceMount,...n}=e,s=nt(ta,e.__scopeDialog);return s.modal?o.jsx(Qe,{present:a||s.open,children:o.jsx(Gg,{...n,ref:t})}):null});cc.displayName=ta;var Xg=or("DialogOverlay.RemoveScroll"),Gg=h.forwardRef((e,t)=>{const{__scopeDialog:r,...a}=e,n=nt(ta,r);return o.jsx(Ea,{as:Xg,allowPinchZoom:!0,shards:[n.contentRef],children:o.jsx(le.div,{"data-state":Nn(n.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Bt="DialogContent",dc=h.forwardRef((e,t)=>{const r=ic(Bt,e.__scopeDialog),{forceMount:a=r.forceMount,...n}=e,s=nt(Bt,e.__scopeDialog);return o.jsx(Qe,{present:a||s.open,children:s.modal?o.jsx(Yg,{...n,ref:t}):o.jsx(Kg,{...n,ref:t})})});dc.displayName=Bt;var Yg=h.forwardRef((e,t)=>{const r=nt(Bt,e.__scopeDialog),a=h.useRef(null),n=pe(t,r.contentRef,a);return h.useEffect(()=>{const s=a.current;if(s)return yn(s)},[]),o.jsx(uc,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:oe(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:oe(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:oe(e.onFocusOutside,s=>s.preventDefault())})}),Kg=h.forwardRef((e,t)=>{const r=nt(Bt,e.__scopeDialog),a=h.useRef(!1),n=h.useRef(!1);return o.jsx(uc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(a.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),a.current=!1,n.current=!1},onInteractOutside:s=>{var i,l;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(a.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const c=s.target;(l=r.triggerRef.current)!=null&&l.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),uc=h.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:a,onOpenAutoFocus:n,onCloseAutoFocus:s,...i}=e,l=nt(Bt,r),c=h.useRef(null),d=pe(t,c);return bn(),o.jsxs(o.Fragment,{children:[o.jsx(Sa,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:n,onUnmountAutoFocus:s,children:o.jsx(kr,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Nn(l.open),...i,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Jg,{titleId:l.titleId}),o.jsx(ev,{contentRef:c,descriptionId:l.descriptionId})]})]})}),jn="DialogTitle",pc=h.forwardRef((e,t)=>{const{__scopeDialog:r,...a}=e,n=nt(jn,r);return o.jsx(le.h2,{id:n.titleId,...a,ref:t})});pc.displayName=jn;var mc="DialogDescription",fc=h.forwardRef((e,t)=>{const{__scopeDialog:r,...a}=e,n=nt(mc,r);return o.jsx(le.p,{id:n.descriptionId,...a,ref:t})});fc.displayName=mc;var hc="DialogClose",xc=h.forwardRef((e,t)=>{const{__scopeDialog:r,...a}=e,n=nt(hc,r);return o.jsx(le.button,{type:"button",...a,ref:t,onClick:oe(e.onClick,()=>n.onOpenChange(!1))})});xc.displayName=hc;function Nn(e){return e?"open":"closed"}var gc="DialogTitleWarning",[Y0,vc]=lx(gc,{contentName:Bt,titleName:jn,docsSlug:"dialog"}),Jg=({titleId:e})=>{const t=vc(gc),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
73
73
|
|
|
74
74
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
75
75
|
|
|
76
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Kg="DialogDescriptionWarning",Jg=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${gc(Kg).contentName}}.`;return x.useEffect(()=>{var a;const n=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Qg=oc,ev=ic,vc=lc,bc=cc,yc=uc,wc=mc,tv=hc;const rv=Qg,av=ev,jc=x.forwardRef(({className:e,...t},r)=>o.jsx(vc,{ref:r,className:G("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));jc.displayName=vc.displayName;const Nc=x.forwardRef(({className:e,children:t,...r},a)=>o.jsxs(av,{children:[o.jsx(jc,{}),o.jsxs(bc,{ref:a,className:G("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,o.jsxs(tv,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(P.X,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nc.displayName=bc.displayName;const Cc=({className:e,...t})=>o.jsx("div",{className:G("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Cc.displayName="DialogHeader";const Sc=x.forwardRef(({className:e,...t},r)=>o.jsx(yc,{ref:r,className:G("text-lg font-semibold leading-none tracking-tight",e),...t}));Sc.displayName=yc.displayName;const kc=x.forwardRef(({className:e,...t},r)=>o.jsx(wc,{ref:r,className:G("text-sm text-muted-foreground",e),...t}));kc.displayName=wc.displayName;function ov(e){if(!e)return null;if(e.includes("-")){const t=e.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");return P.icons[t]??null}return P.icons[e]??null}const Xs=Object.entries(P.icons).map(([e,t])=>({name:e,kebab:e.replace(/([A-Z])/g,(r,a,n)=>n===0?a.toLowerCase():`-${a.toLowerCase()}`),component:t})),_c=({value:e,onChange:t,label:r="Ícone (Lucide)",hideLabel:a=!1,className:n})=>{const[s,i]=E.useState(!1),[l,c]=E.useState(""),d=E.useMemo(()=>ov(e),[e]),u=E.useMemo(()=>{const h=l.toLowerCase();return h?Xs.filter(g=>g.name.toLowerCase().includes(h)||g.kebab.includes(h)):Xs},[l]),p=h=>{t(h),i(!1)},m=h=>{i(h),h||c("")};return o.jsxs("div",{className:`space-y-1 ${n??""}`,children:[!a&&o.jsx(W,{className:"text-xs",children:r}),o.jsx(ye,{type:"button",variant:"outline",className:"w-full h-8 justify-start text-xs font-normal gap-2",onClick:()=>i(!0),children:d?o.jsxs(o.Fragment,{children:[E.createElement(d,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{className:"truncate",children:e})]}):o.jsx("span",{className:"text-muted-foreground",children:"Selecionar ícone…"})}),o.jsx(rv,{open:s,onOpenChange:m,children:o.jsxs(Nc,{className:"max-w-3xl max-h-[85vh] flex flex-col gap-0 p-0",children:[o.jsxs(Cc,{className:"px-4 pt-4 pb-2 border-b",children:[o.jsx(Sc,{children:"Selecionar ícone"}),o.jsx(kc,{children:"Pesquise e clique em um ícone da biblioteca Lucide."})]}),o.jsx("div",{className:"px-4 py-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(P.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ae,{autoFocus:!0,placeholder:"Buscar ícones…",value:l,onChange:h=>c(h.target.value),className:"pl-8 h-9 text-sm"})]})}),o.jsx(Ca,{className:"flex-1 px-4 py-2",children:o.jsxs("div",{className:"grid grid-cols-5 gap-2 sm:grid-cols-7 md:grid-cols-8 pb-2",children:[o.jsxs(ye,{type:"button",variant:e?"outline":"secondary",className:"flex flex-col items-center justify-center h-20 gap-1 p-1",onClick:()=>p(void 0),children:[o.jsx("div",{className:"h-6 w-6 rounded border-2 border-dashed border-muted-foreground/30"}),o.jsx("span",{className:"text-[10px] leading-tight text-center",children:"Nenhum"})]}),u.map(({name:h,component:g})=>o.jsxs(ye,{type:"button",variant:e===h?"secondary":"outline",className:"flex flex-col items-center justify-center h-20 gap-1 p-1 overflow-hidden",onClick:()=>p(h),children:[E.createElement(g,{size:24}),o.jsx("span",{className:"text-[9px] leading-tight text-center break-all line-clamp-2",children:h})]},h))]})})]})})]})},nv=["top","right","bottom","left"],Et=Math.min,Ve=Math.max,ra=Math.round,Wr=Math.floor,lt=e=>({x:e,y:e}),sv={left:"right",right:"left",bottom:"top",top:"bottom"};function So(e,t,r){return Ve(e,Et(t,r))}function gt(e,t){return typeof e=="function"?e(t):e}function vt(e){return e.split("-")[0]}function ur(e){return e.split("-")[1]}function Cn(e){return e==="x"?"y":"x"}function Sn(e){return e==="y"?"height":"width"}function it(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function kn(e){return Cn(it(e))}function iv(e,t,r){r===void 0&&(r=!1);const a=ur(e),n=kn(e),s=Sn(n);let i=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=aa(i)),[i,aa(i)]}function lv(e){const t=aa(e);return[ko(e),t,ko(t)]}function ko(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Gs=["left","right"],Ys=["right","left"],cv=["top","bottom"],dv=["bottom","top"];function uv(e,t,r){switch(e){case"top":case"bottom":return r?t?Ys:Gs:t?Gs:Ys;case"left":case"right":return t?cv:dv;default:return[]}}function pv(e,t,r,a){const n=ur(e);let s=uv(vt(e),r==="start",a);return n&&(s=s.map(i=>i+"-"+n),t&&(s=s.concat(s.map(ko)))),s}function aa(e){const t=vt(e);return sv[t]+e.slice(t.length)}function mv(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ec(e){return typeof e!="number"?mv(e):{top:e,right:e,bottom:e,left:e}}function oa(e){const{x:t,y:r,width:a,height:n}=e;return{width:a,height:n,top:r,left:t,right:t+a,bottom:r+n,x:t,y:r}}function Ks(e,t,r){let{reference:a,floating:n}=e;const s=it(t),i=kn(t),l=Sn(i),c=vt(t),d=s==="y",u=a.x+a.width/2-n.width/2,p=a.y+a.height/2-n.height/2,m=a[l]/2-n[l]/2;let h;switch(c){case"top":h={x:u,y:a.y-n.height};break;case"bottom":h={x:u,y:a.y+a.height};break;case"right":h={x:a.x+a.width,y:p};break;case"left":h={x:a.x-n.width,y:p};break;default:h={x:a.x,y:a.y}}switch(ur(t)){case"start":h[i]-=m*(r&&d?-1:1);break;case"end":h[i]+=m*(r&&d?-1:1);break}return h}async function fv(e,t){var r;t===void 0&&(t={});const{x:a,y:n,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:m=!1,padding:h=0}=gt(t,e),g=Ec(h),f=l[m?p==="floating"?"reference":"floating":p],v=oa(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(f)))==null||r?f:f.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),b=p==="floating"?{x:a,y:n,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),y=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},N=oa(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:w,strategy:c}):b);return{top:(v.top-N.top+g.top)/y.y,bottom:(N.bottom-v.bottom+g.bottom)/y.y,left:(v.left-N.left+g.left)/y.x,right:(N.right-v.right+g.right)/y.x}}const hv=50,xv=async(e,t,r)=>{const{placement:a="bottom",strategy:n="absolute",middleware:s=[],platform:i}=r,l=i.detectOverflow?i:{...i,detectOverflow:fv},c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:p}=Ks(d,a,c),m=a,h=0;const g={};for(let f=0;f<s.length;f++){const v=s[f];if(!v)continue;const{name:b,fn:w}=v,{x:y,y:N,data:C,reset:_}=await w({x:u,y:p,initialPlacement:a,placement:m,strategy:n,middlewareData:g,rects:d,platform:l,elements:{reference:e,floating:t}});u=y??u,p=N??p,g[b]={...g[b],...C},_&&h<hv&&(h++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(d=_.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:n}):_.rects),{x:u,y:p}=Ks(d,m,c)),f=-1)}return{x:u,y:p,placement:m,strategy:n,middlewareData:g}},gv=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:a,placement:n,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=gt(e,t)||{};if(d==null)return{};const p=Ec(u),m={x:r,y:a},h=kn(n),g=Sn(h),f=await i.getDimensions(d),v=h==="y",b=v?"top":"left",w=v?"bottom":"right",y=v?"clientHeight":"clientWidth",N=s.reference[g]+s.reference[h]-m[h]-s.floating[g],C=m[h]-s.reference[h],_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let k=_?_[y]:0;(!k||!await(i.isElement==null?void 0:i.isElement(_)))&&(k=l.floating[y]||s.floating[g]);const j=N/2-C/2,R=k/2-f[g]/2-1,A=Et(p[b],R),I=Et(p[w],R),F=A,V=k-f[g]-I,M=k/2-f[g]/2+j,U=So(F,M,V),$=!c.arrow&&ur(n)!=null&&M!==U&&s.reference[g]/2-(M<F?A:I)-f[g]/2<0,T=$?M<F?M-F:M-V:0;return{[h]:m[h]+T,data:{[h]:U,centerOffset:M-U-T,...$&&{alignmentOffset:T}},reset:$}}}),vv=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,a;const{placement:n,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:f=!0,...v}=gt(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const b=vt(n),w=it(l),y=vt(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=m||(y||!f?[aa(l)]:lv(l)),_=g!=="none";!m&&_&&C.push(...pv(l,f,g,N));const k=[l,...C],j=await c.detectOverflow(t,v),R=[];let A=((a=s.flip)==null?void 0:a.overflows)||[];if(u&&R.push(j[b]),p){const M=iv(n,i,N);R.push(j[M[0]],j[M[1]])}if(A=[...A,{placement:n,overflows:R}],!R.every(M=>M<=0)){var I,F;const M=(((I=s.flip)==null?void 0:I.index)||0)+1,U=k[M];if(U&&(!(p==="alignment"&&w!==it(U))||A.every(T=>it(T.placement)===w?T.overflows[0]>0:!0)))return{data:{index:M,overflows:A},reset:{placement:U}};let $=(F=A.filter(T=>T.overflows[0]<=0).sort((T,D)=>T.overflows[1]-D.overflows[1])[0])==null?void 0:F.placement;if(!$)switch(h){case"bestFit":{var V;const T=(V=A.filter(D=>{if(_){const z=it(D.placement);return z===w||z==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(z=>z>0).reduce((z,L)=>z+L,0)]).sort((D,z)=>D[1]-z[1])[0])==null?void 0:V[0];T&&($=T);break}case"initialPlacement":$=l;break}if(n!==$)return{reset:{placement:$}}}return{}}}};function Js(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Qs(e){return nv.some(t=>e[t]>=0)}const bv=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:a}=t,{strategy:n="referenceHidden",...s}=gt(e,t);switch(n){case"referenceHidden":{const i=await a.detectOverflow(t,{...s,elementContext:"reference"}),l=Js(i,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Qs(l)}}}case"escaped":{const i=await a.detectOverflow(t,{...s,altBoundary:!0}),l=Js(i,r.floating);return{data:{escapedOffsets:l,escaped:Qs(l)}}}default:return{}}}}},Pc=new Set(["left","top"]);async function yv(e,t){const{placement:r,platform:a,elements:n}=e,s=await(a.isRTL==null?void 0:a.isRTL(n.floating)),i=vt(r),l=ur(r),c=it(r)==="y",d=Pc.has(i)?-1:1,u=s&&c?-1:1,p=gt(t,e);let{mainAxis:m,crossAxis:h,alignmentAxis:g}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof g=="number"&&(h=l==="end"?g*-1:g),c?{x:h*u,y:m*d}:{x:m*d,y:h*u}}const wv=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,a;const{x:n,y:s,placement:i,middlewareData:l}=t,c=await yv(t,e);return i===((r=l.offset)==null?void 0:r.placement)&&(a=l.arrow)!=null&&a.alignmentOffset?{}:{x:n+c.x,y:s+c.y,data:{...c,placement:i}}}}},jv=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:a,placement:n,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:w,y}=b;return{x:w,y}}},...d}=gt(e,t),u={x:r,y:a},p=await s.detectOverflow(t,d),m=it(vt(n)),h=Cn(m);let g=u[h],f=u[m];if(i){const b=h==="y"?"top":"left",w=h==="y"?"bottom":"right",y=g+p[b],N=g-p[w];g=So(y,g,N)}if(l){const b=m==="y"?"top":"left",w=m==="y"?"bottom":"right",y=f+p[b],N=f-p[w];f=So(y,f,N)}const v=c.fn({...t,[h]:g,[m]:f});return{...v,data:{x:v.x-r,y:v.y-a,enabled:{[h]:i,[m]:l}}}}}},Nv=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:a,placement:n,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=gt(e,t),u={x:r,y:a},p=it(n),m=Cn(p);let h=u[m],g=u[p];const f=gt(l,t),v=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(c){const y=m==="y"?"height":"width",N=s.reference[m]-s.floating[y]+v.mainAxis,C=s.reference[m]+s.reference[y]-v.mainAxis;h<N?h=N:h>C&&(h=C)}if(d){var b,w;const y=m==="y"?"width":"height",N=Pc.has(vt(n)),C=s.reference[p]-s.floating[y]+(N&&((b=i.offset)==null?void 0:b[p])||0)+(N?0:v.crossAxis),_=s.reference[p]+s.reference[y]+(N?0:((w=i.offset)==null?void 0:w[p])||0)-(N?v.crossAxis:0);g<C?g=C:g>_&&(g=_)}return{[m]:h,[p]:g}}}},Cv=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,a;const{placement:n,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...d}=gt(e,t),u=await i.detectOverflow(t,d),p=vt(n),m=ur(n),h=it(n)==="y",{width:g,height:f}=s.floating;let v,b;p==="top"||p==="bottom"?(v=p,b=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=p,v=m==="end"?"top":"bottom");const w=f-u.top-u.bottom,y=g-u.left-u.right,N=Et(f-u[v],w),C=Et(g-u[b],y),_=!t.middlewareData.shift;let k=N,j=C;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(j=y),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(k=w),_&&!m){const A=Ve(u.left,0),I=Ve(u.right,0),F=Ve(u.top,0),V=Ve(u.bottom,0);h?j=g-2*(A!==0||I!==0?A+I:Ve(u.left,u.right)):k=f-2*(F!==0||V!==0?F+V:Ve(u.top,u.bottom))}await c({...t,availableWidth:j,availableHeight:k});const R=await i.getDimensions(l.floating);return g!==R.width||f!==R.height?{reset:{rects:!0}}:{}}}};function Ta(){return typeof window<"u"}function pr(e){return Tc(e)?(e.nodeName||"").toLowerCase():"#document"}function Ue(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pt(e){var t;return(t=(Tc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Tc(e){return Ta()?e instanceof Node||e instanceof Ue(e).Node:!1}function at(e){return Ta()?e instanceof Element||e instanceof Ue(e).Element:!1}function yt(e){return Ta()?e instanceof HTMLElement||e instanceof Ue(e).HTMLElement:!1}function ei(e){return!Ta()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ue(e).ShadowRoot}function _r(e){const{overflow:t,overflowX:r,overflowY:a,display:n}=ot(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+r)&&n!=="inline"&&n!=="contents"}function Sv(e){return/^(table|td|th)$/.test(pr(e))}function $a(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const kv=/transform|translate|scale|rotate|perspective|filter/,_v=/paint|layout|strict|content/,Lt=e=>!!e&&e!=="none";let po;function _n(e){const t=at(e)?ot(e):e;return Lt(t.transform)||Lt(t.translate)||Lt(t.scale)||Lt(t.rotate)||Lt(t.perspective)||!En()&&(Lt(t.backdropFilter)||Lt(t.filter))||kv.test(t.willChange||"")||_v.test(t.contain||"")}function Ev(e){let t=Pt(e);for(;yt(t)&&!sr(t);){if(_n(t))return t;if($a(t))return null;t=Pt(t)}return null}function En(){return po==null&&(po=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),po}function sr(e){return/^(html|body|#document)$/.test(pr(e))}function ot(e){return Ue(e).getComputedStyle(e)}function Ra(e){return at(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Pt(e){if(pr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ei(e)&&e.host||pt(e);return ei(t)?t.host:t}function $c(e){const t=Pt(e);return sr(t)?e.ownerDocument?e.ownerDocument.body:e.body:yt(t)&&_r(t)?t:$c(t)}function jr(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=$c(e),s=n===((a=e.ownerDocument)==null?void 0:a.body),i=Ue(n);if(s){const l=_o(i);return t.concat(i,i.visualViewport||[],_r(n)?n:[],l&&r?jr(l):[])}else return t.concat(n,jr(n,[],r))}function _o(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Rc(e){const t=ot(e);let r=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const n=yt(e),s=n?e.offsetWidth:r,i=n?e.offsetHeight:a,l=ra(r)!==s||ra(a)!==i;return l&&(r=s,a=i),{width:r,height:a,$:l}}function Pn(e){return at(e)?e:e.contextElement}function rr(e){const t=Pn(e);if(!yt(t))return lt(1);const r=t.getBoundingClientRect(),{width:a,height:n,$:s}=Rc(t);let i=(s?ra(r.width):r.width)/a,l=(s?ra(r.height):r.height)/n;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const Pv=lt(0);function Oc(e){const t=Ue(e);return!En()||!t.visualViewport?Pv:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Tv(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Ue(e)?!1:t}function Ut(e,t,r,a){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),s=Pn(e);let i=lt(1);t&&(a?at(a)&&(i=rr(a)):i=rr(e));const l=Tv(s,r,a)?Oc(s):lt(0);let c=(n.left+l.x)/i.x,d=(n.top+l.y)/i.y,u=n.width/i.x,p=n.height/i.y;if(s){const m=Ue(s),h=a&&at(a)?Ue(a):a;let g=m,f=_o(g);for(;f&&a&&h!==g;){const v=rr(f),b=f.getBoundingClientRect(),w=ot(f),y=b.left+(f.clientLeft+parseFloat(w.paddingLeft))*v.x,N=b.top+(f.clientTop+parseFloat(w.paddingTop))*v.y;c*=v.x,d*=v.y,u*=v.x,p*=v.y,c+=y,d+=N,g=Ue(f),f=_o(g)}}return oa({width:u,height:p,x:c,y:d})}function Oa(e,t){const r=Ra(e).scrollLeft;return t?t.left+r:Ut(pt(e)).left+r}function Dc(e,t){const r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-Oa(e,r),n=r.top+t.scrollTop;return{x:a,y:n}}function $v(e){let{elements:t,rect:r,offsetParent:a,strategy:n}=e;const s=n==="fixed",i=pt(a),l=t?$a(t.floating):!1;if(a===i||l&&s)return r;let c={scrollLeft:0,scrollTop:0},d=lt(1);const u=lt(0),p=yt(a);if((p||!p&&!s)&&((pr(a)!=="body"||_r(i))&&(c=Ra(a)),p)){const h=Ut(a);d=rr(a),u.x=h.x+a.clientLeft,u.y=h.y+a.clientTop}const m=i&&!p&&!s?Dc(i,c):lt(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+u.x+m.x,y:r.y*d.y-c.scrollTop*d.y+u.y+m.y}}function Rv(e){return Array.from(e.getClientRects())}function Ov(e){const t=pt(e),r=Ra(e),a=e.ownerDocument.body,n=Ve(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),s=Ve(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let i=-r.scrollLeft+Oa(e);const l=-r.scrollTop;return ot(a).direction==="rtl"&&(i+=Ve(t.clientWidth,a.clientWidth)-n),{width:n,height:s,x:i,y:l}}const ti=25;function Dv(e,t){const r=Ue(e),a=pt(e),n=r.visualViewport;let s=a.clientWidth,i=a.clientHeight,l=0,c=0;if(n){s=n.width,i=n.height;const u=En();(!u||u&&t==="fixed")&&(l=n.offsetLeft,c=n.offsetTop)}const d=Oa(a);if(d<=0){const u=a.ownerDocument,p=u.body,m=getComputedStyle(p),h=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(a.clientWidth-p.clientWidth-h);g<=ti&&(s-=g)}else d<=ti&&(s+=d);return{width:s,height:i,x:l,y:c}}function Av(e,t){const r=Ut(e,!0,t==="fixed"),a=r.top+e.clientTop,n=r.left+e.clientLeft,s=yt(e)?rr(e):lt(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=n*s.x,d=a*s.y;return{width:i,height:l,x:c,y:d}}function ri(e,t,r){let a;if(t==="viewport")a=Dv(e,r);else if(t==="document")a=Ov(pt(e));else if(at(t))a=Av(t,r);else{const n=Oc(e);a={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return oa(a)}function Ac(e,t){const r=Pt(e);return r===t||!at(r)||sr(r)?!1:ot(r).position==="fixed"||Ac(r,t)}function Iv(e,t){const r=t.get(e);if(r)return r;let a=jr(e,[],!1).filter(l=>at(l)&&pr(l)!=="body"),n=null;const s=ot(e).position==="fixed";let i=s?Pt(e):e;for(;at(i)&&!sr(i);){const l=ot(i),c=_n(i);!c&&l.position==="fixed"&&(n=null),(s?!c&&!n:!c&&l.position==="static"&&n&&(n.position==="absolute"||n.position==="fixed")||_r(i)&&!c&&Ac(e,i))?a=a.filter(d=>d!==i):n=l,i=Pt(i)}return t.set(e,a),a}function Lv(e){let{element:t,boundary:r,rootBoundary:a,strategy:n}=e;const s=[...r==="clippingAncestors"?$a(t)?[]:Iv(t,this._c):[].concat(r),a],i=ri(t,s[0],n);let l=i.top,c=i.right,d=i.bottom,u=i.left;for(let p=1;p<s.length;p++){const m=ri(t,s[p],n);l=Ve(m.top,l),c=Et(m.right,c),d=Et(m.bottom,d),u=Ve(m.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function zv(e){const{width:t,height:r}=Rc(e);return{width:t,height:r}}function Mv(e,t,r){const a=yt(t),n=pt(t),s=r==="fixed",i=Ut(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=lt(0);function d(){c.x=Oa(n)}if(a||!a&&!s)if((pr(t)!=="body"||_r(n))&&(l=Ra(t)),a){const h=Ut(t,!0,s,t);c.x=h.x+t.clientLeft,c.y=h.y+t.clientTop}else n&&d();s&&!a&&n&&d();const u=n&&!a&&!s?Dc(n,l):lt(0),p=i.left+l.scrollLeft-c.x-u.x,m=i.top+l.scrollTop-c.y-u.y;return{x:p,y:m,width:i.width,height:i.height}}function mo(e){return ot(e).position==="static"}function ai(e,t){if(!yt(e)||ot(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return pt(e)===r&&(r=r.ownerDocument.body),r}function Ic(e,t){const r=Ue(e);if($a(e))return r;if(!yt(e)){let n=Pt(e);for(;n&&!sr(n);){if(at(n)&&!mo(n))return n;n=Pt(n)}return r}let a=ai(e,t);for(;a&&Sv(a)&&mo(a);)a=ai(a,t);return a&&sr(a)&&mo(a)&&!_n(a)?r:a||Ev(e)||r}const Fv=async function(e){const t=this.getOffsetParent||Ic,r=this.getDimensions,a=await r(e.floating);return{reference:Mv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function Vv(e){return ot(e).direction==="rtl"}const Bv={convertOffsetParentRelativeRectToViewportRelativeRect:$v,getDocumentElement:pt,getClippingRect:Lv,getOffsetParent:Ic,getElementRects:Fv,getClientRects:Rv,getDimensions:zv,getScale:rr,isElement:at,isRTL:Vv};function Lc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Uv(e,t){let r=null,a;const n=pt(e);function s(){var l;clearTimeout(a),(l=r)==null||l.disconnect(),r=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:u,top:p,width:m,height:h}=d;if(l||t(),!m||!h)return;const g=Wr(p),f=Wr(n.clientWidth-(u+m)),v=Wr(n.clientHeight-(p+h)),b=Wr(u),w={rootMargin:-g+"px "+-f+"px "+-v+"px "+-b+"px",threshold:Ve(0,Et(1,c))||1};let y=!0;function N(C){const _=C[0].intersectionRatio;if(_!==c){if(!y)return i();_?i(!1,_):a=setTimeout(()=>{i(!1,1e-7)},1e3)}_===1&&!Lc(d,e.getBoundingClientRect())&&i(),y=!1}try{r=new IntersectionObserver(N,{...w,root:n.ownerDocument})}catch{r=new IntersectionObserver(N,w)}r.observe(e)}return i(!0),s}function Hv(e,t,r,a){a===void 0&&(a={});const{ancestorScroll:n=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=a,d=Pn(e),u=n||s?[...d?jr(d):[],...t?jr(t):[]]:[];u.forEach(b=>{n&&b.addEventListener("scroll",r,{passive:!0}),s&&b.addEventListener("resize",r)});const p=d&&l?Uv(d,r):null;let m=-1,h=null;i&&(h=new ResizeObserver(b=>{let[w]=b;w&&w.target===d&&h&&t&&(h.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=h)==null||y.observe(t)})),r()}),d&&!c&&h.observe(d),t&&h.observe(t));let g,f=c?Ut(e):null;c&&v();function v(){const b=Ut(e);f&&!Lc(f,b)&&r(),f=b,g=requestAnimationFrame(v)}return r(),()=>{var b;u.forEach(w=>{n&&w.removeEventListener("scroll",r),s&&w.removeEventListener("resize",r)}),p==null||p(),(b=h)==null||b.disconnect(),h=null,c&&cancelAnimationFrame(g)}}const Wv=wv,qv=jv,Zv=vv,Xv=Cv,Gv=bv,oi=gv,Yv=Nv,Kv=(e,t,r)=>{const a=new Map,n={platform:Bv,...r},s={...n.platform,_c:a};return xv(e,t,{...n,platform:s})};var Jv=typeof document<"u",Qv=function(){},Gr=Jv?E.useLayoutEffect:Qv;function na(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,a,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(a=r;a--!==0;)if(!na(e[a],t[a]))return!1;return!0}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(t,n[a]))return!1;for(a=r;a--!==0;){const s=n[a];if(!(s==="_owner"&&e.$$typeof)&&!na(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function zc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ni(e,t){const r=zc(e);return Math.round(t*r)/r}function fo(e){const t=x.useRef(e);return Gr(()=>{t.current=e}),t}function eb(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:n,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,p]=x.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=x.useState(a);na(m,a)||h(a);const[g,f]=x.useState(null),[v,b]=x.useState(null),w=x.useCallback(D=>{D!==_.current&&(_.current=D,f(D))},[]),y=x.useCallback(D=>{D!==k.current&&(k.current=D,b(D))},[]),N=s||g,C=i||v,_=x.useRef(null),k=x.useRef(null),j=x.useRef(u),R=c!=null,A=fo(c),I=fo(n),F=fo(d),V=x.useCallback(()=>{if(!_.current||!k.current)return;const D={placement:t,strategy:r,middleware:m};I.current&&(D.platform=I.current),Kv(_.current,k.current,D).then(z=>{const L={...z,isPositioned:F.current!==!1};M.current&&!na(j.current,L)&&(j.current=L,da.flushSync(()=>{p(L)}))})},[m,t,r,I,F]);Gr(()=>{d===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,p(D=>({...D,isPositioned:!1})))},[d]);const M=x.useRef(!1);Gr(()=>(M.current=!0,()=>{M.current=!1}),[]),Gr(()=>{if(N&&(_.current=N),C&&(k.current=C),N&&C){if(A.current)return A.current(N,C,V);V()}},[N,C,V,A,R]);const U=x.useMemo(()=>({reference:_,floating:k,setReference:w,setFloating:y}),[w,y]),$=x.useMemo(()=>({reference:N,floating:C}),[N,C]),T=x.useMemo(()=>{const D={position:r,left:0,top:0};if(!$.floating)return D;const z=ni($.floating,u.x),L=ni($.floating,u.y);return l?{...D,transform:"translate("+z+"px, "+L+"px)",...zc($.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:z,top:L}},[r,l,$.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:V,refs:U,elements:$,floatingStyles:T}),[u,V,U,$,T])}const tb=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:a,padding:n}=typeof e=="function"?e(r):e;return a&&t(a)?a.current!=null?oi({element:a.current,padding:n}).fn(r):{}:a?oi({element:a,padding:n}).fn(r):{}}}},rb=(e,t)=>{const r=Wv(e);return{name:r.name,fn:r.fn,options:[e,t]}},ab=(e,t)=>{const r=qv(e);return{name:r.name,fn:r.fn,options:[e,t]}},ob=(e,t)=>({fn:Yv(e).fn,options:[e,t]}),nb=(e,t)=>{const r=Zv(e);return{name:r.name,fn:r.fn,options:[e,t]}},sb=(e,t)=>{const r=Xv(e);return{name:r.name,fn:r.fn,options:[e,t]}},ib=(e,t)=>{const r=Gv(e);return{name:r.name,fn:r.fn,options:[e,t]}},lb=(e,t)=>{const r=tb(e);return{name:r.name,fn:r.fn,options:[e,t]}};var cb="Arrow",Mc=x.forwardRef((e,t)=>{const{children:r,width:a=10,height:n=5,...s}=e;return o.jsx(le.svg,{...s,ref:t,width:a,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});Mc.displayName=cb;var db=Mc,Tn="Popper",[Fc,mr]=bt(Tn),[ub,Vc]=Fc(Tn),Bc=e=>{const{__scopePopper:t,children:r}=e,[a,n]=x.useState(null);return o.jsx(ub,{scope:t,anchor:a,onAnchorChange:n,children:r})};Bc.displayName=Tn;var Uc="PopperAnchor",Hc=x.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:a,...n}=e,s=Vc(Uc,r),i=x.useRef(null),l=pe(t,i),c=x.useRef(null);return x.useEffect(()=>{const d=c.current;c.current=(a==null?void 0:a.current)||i.current,d!==c.current&&s.onAnchorChange(c.current)}),a?null:o.jsx(le.div,{...n,ref:l})});Hc.displayName=Uc;var $n="PopperContent",[pb,mb]=Fc($n),Wc=x.forwardRef((e,t)=>{var r,a,n,s,i,l;const{__scopePopper:c,side:d="bottom",sideOffset:u=0,align:p="center",alignOffset:m=0,arrowPadding:h=0,avoidCollisions:g=!0,collisionBoundary:f=[],collisionPadding:v=0,sticky:b="partial",hideWhenDetached:w=!1,updatePositionStrategy:y="optimized",onPlaced:N,...C}=e,_=Vc($n,c),[k,j]=x.useState(null),R=pe(t,we=>j(we)),[A,I]=x.useState(null),F=un(A),V=(F==null?void 0:F.width)??0,M=(F==null?void 0:F.height)??0,U=d+(p!=="center"?"-"+p:""),$=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},T=Array.isArray(f)?f:[f],D=T.length>0,z={padding:$,boundary:T.filter(hb),altBoundary:D},{refs:L,floatingStyles:ee,placement:Y,isPositioned:J,middlewareData:q}=eb({strategy:"fixed",placement:U,whileElementsMounted:(...we)=>Hv(...we,{animationFrame:y==="always"}),elements:{reference:_.anchor},middleware:[rb({mainAxis:u+M,alignmentAxis:m}),g&&ab({mainAxis:!0,crossAxis:!1,limiter:b==="partial"?ob():void 0,...z}),g&&nb({...z}),sb({...z,apply:({elements:we,rects:je,availableWidth:Me,availableHeight:Ae})=>{const{width:$r,height:Rr}=je.reference,mt=we.floating.style;mt.setProperty("--radix-popper-available-width",`${Me}px`),mt.setProperty("--radix-popper-available-height",`${Ae}px`),mt.setProperty("--radix-popper-anchor-width",`${$r}px`),mt.setProperty("--radix-popper-anchor-height",`${Rr}px`)}}),A&&lb({element:A,padding:h}),xb({arrowWidth:V,arrowHeight:M}),w&&ib({strategy:"referenceHidden",...z})]}),[se,me]=Xc(Y),H=Le(N);Ee(()=>{J&&(H==null||H())},[J,H]);const ie=(r=q.arrow)==null?void 0:r.x,te=(a=q.arrow)==null?void 0:a.y,re=((n=q.arrow)==null?void 0:n.centerOffset)!==0,[Q,fe]=x.useState();return Ee(()=>{k&&fe(window.getComputedStyle(k).zIndex)},[k]),o.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:J?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(s=q.transformOrigin)==null?void 0:s.x,(i=q.transformOrigin)==null?void 0:i.y].join(" "),...((l=q.hide)==null?void 0:l.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(pb,{scope:c,placedSide:se,onArrowChange:I,arrowX:ie,arrowY:te,shouldHideArrow:re,children:o.jsx(le.div,{"data-side":se,"data-align":me,...C,ref:R,style:{...C.style,animation:J?void 0:"none"}})})})});Wc.displayName=$n;var qc="PopperArrow",fb={top:"bottom",right:"left",bottom:"top",left:"right"},Zc=x.forwardRef(function(e,t){const{__scopePopper:r,...a}=e,n=mb(qc,r),s=fb[n.placedSide];return o.jsx("span",{ref:n.onArrowChange,style:{position:"absolute",left:n.arrowX,top:n.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[n.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[n.placedSide],visibility:n.shouldHideArrow?"hidden":void 0},children:o.jsx(db,{...a,ref:t,style:{...a.style,display:"block"}})})});Zc.displayName=qc;function hb(e){return e!==null}var xb=e=>({name:"transformOrigin",options:e,fn(t){var r,a,n;const{placement:s,rects:i,middlewareData:l}=t,c=((r=l.arrow)==null?void 0:r.centerOffset)!==0,d=c?0:e.arrowWidth,u=c?0:e.arrowHeight,[p,m]=Xc(s),h={start:"0%",center:"50%",end:"100%"}[m],g=(((a=l.arrow)==null?void 0:a.x)??0)+d/2,f=(((n=l.arrow)==null?void 0:n.y)??0)+u/2;let v="",b="";return p==="bottom"?(v=c?h:`${g}px`,b=`${-u}px`):p==="top"?(v=c?h:`${g}px`,b=`${i.floating.height+u}px`):p==="right"?(v=`${-u}px`,b=c?h:`${f}px`):p==="left"&&(v=`${i.floating.width+u}px`,b=c?h:`${f}px`),{data:{x:v,y:b}}}});function Xc(e){const[t,r="center"]=e.split("-");return[t,r]}var Rn=Bc,Da=Hc,On=Wc,Dn=Zc,Aa="Popover",[Gc]=bt(Aa,[mr]),Er=mr(),[gb,Rt]=Gc(Aa),Yc=e=>{const{__scopePopover:t,children:r,open:a,defaultOpen:n,onOpenChange:s,modal:i=!1}=e,l=Er(t),c=x.useRef(null),[d,u]=x.useState(!1),[p,m]=Vt({prop:a,defaultProp:n??!1,onChange:s,caller:Aa});return o.jsx(Rn,{...l,children:o.jsx(gb,{scope:t,contentId:_t(),triggerRef:c,open:p,onOpenChange:m,onOpenToggle:x.useCallback(()=>m(h=>!h),[m]),hasCustomAnchor:d,onCustomAnchorAdd:x.useCallback(()=>u(!0),[]),onCustomAnchorRemove:x.useCallback(()=>u(!1),[]),modal:i,children:r})})};Yc.displayName=Aa;var Kc="PopoverAnchor",vb=x.forwardRef((e,t)=>{const{__scopePopover:r,...a}=e,n=Rt(Kc,r),s=Er(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=n;return x.useEffect(()=>(i(),()=>l()),[i,l]),o.jsx(Da,{...s,...a,ref:t})});vb.displayName=Kc;var Jc="PopoverTrigger",Qc=x.forwardRef((e,t)=>{const{__scopePopover:r,...a}=e,n=Rt(Jc,r),s=Er(r),i=pe(t,n.triggerRef),l=o.jsx(le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":od(n.open),...a,ref:i,onClick:oe(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?l:o.jsx(Da,{asChild:!0,...s,children:l})});Qc.displayName=Jc;var An="PopoverPortal",[bb,yb]=Gc(An,{forceMount:void 0}),ed=e=>{const{__scopePopover:t,forceMount:r,children:a,container:n}=e,s=Rt(An,t);return o.jsx(bb,{scope:t,forceMount:r,children:o.jsx(Qe,{present:r||s.open,children:o.jsx(ka,{asChild:!0,container:n,children:a})})})};ed.displayName=An;var ir="PopoverContent",td=x.forwardRef((e,t)=>{const r=yb(ir,e.__scopePopover),{forceMount:a=r.forceMount,...n}=e,s=Rt(ir,e.__scopePopover);return o.jsx(Qe,{present:a||s.open,children:s.modal?o.jsx(jb,{...n,ref:t}):o.jsx(Nb,{...n,ref:t})})});td.displayName=ir;var wb=or("PopoverContent.RemoveScroll"),jb=x.forwardRef((e,t)=>{const r=Rt(ir,e.__scopePopover),a=x.useRef(null),n=pe(t,a),s=x.useRef(!1);return x.useEffect(()=>{const i=a.current;if(i)return yn(i)},[]),o.jsx(Ea,{as:wb,allowPinchZoom:!0,children:o.jsx(rd,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:oe(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),s.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:oe(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:oe(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Nb=x.forwardRef((e,t)=>{const r=Rt(ir,e.__scopePopover),a=x.useRef(!1),n=x.useRef(!1);return o.jsx(rd,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(a.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),a.current=!1,n.current=!1},onInteractOutside:s=>{var i,l;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(a.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const c=s.target;(l=r.triggerRef.current)!=null&&l.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),rd=x.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:a,onOpenAutoFocus:n,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...p}=e,m=Rt(ir,r),h=Er(r);return bn(),o.jsx(Sa,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:n,onUnmountAutoFocus:s,children:o.jsx(kr,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:o.jsx(On,{"data-state":od(m.open),role:"dialog",id:m.contentId,...h,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ad="PopoverClose",Cb=x.forwardRef((e,t)=>{const{__scopePopover:r,...a}=e,n=Rt(ad,r);return o.jsx(le.button,{type:"button",...a,ref:t,onClick:oe(e.onClick,()=>n.onOpenChange(!1))})});Cb.displayName=ad;var Sb="PopoverArrow",kb=x.forwardRef((e,t)=>{const{__scopePopover:r,...a}=e,n=Er(r);return o.jsx(Dn,{...n,...a,ref:t})});kb.displayName=Sb;function od(e){return e?"open":"closed"}var _b=Yc,Eb=Qc,Pb=ed,nd=td;const Ia=_b,La=Eb,Pr=x.forwardRef(({className:e,align:t="center",sideOffset:r=4,...a},n)=>o.jsx(Pb,{children:o.jsx(nd,{ref:n,align:t,sideOffset:r,className:G("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...a})}));Pr.displayName=nd.displayName;const ht=({onInsert:e})=>{const[t,r]=E.useState(null),a=async n=>{const s=`{{${n}}}`;try{await navigator.clipboard.writeText(s)}catch{const i=document.createElement("textarea");i.value=s,i.style.position="fixed",i.style.opacity="0",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}e&&e(s),r(n),setTimeout(()=>r(null),1500)};return o.jsxs(Ia,{children:[o.jsx(La,{asChild:!0,children:o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-primary",title:"Inserir variável do evento",children:o.jsx(P.Braces,{className:"h-3.5 w-3.5"})})}),o.jsxs(Pr,{className:"w-80 p-0",align:"end",side:"left",sideOffset:6,children:[o.jsxs("div",{className:"px-3 py-2 border-b border-border",children:[o.jsx("p",{className:"text-xs font-semibold text-foreground",children:"Variáveis do evento"}),o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Clique para copiar. Use"," ",o.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"{{evento.xxx}}"})," ","em labels, placeholders e hints."]})]}),o.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:on.map(n=>{const s=t===n.key;return o.jsxs("button",{type:"button",onClick:()=>a(n.key),className:G("w-full flex items-center justify-between px-3 py-1.5 text-left hover:bg-accent transition-colors",s&&"bg-primary/10"),children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs font-medium truncate",children:n.label}),o.jsx("code",{className:"text-[10px] text-muted-foreground font-mono",children:`{{${n.key}}}`})]}),o.jsx("div",{className:"ml-2 shrink-0",children:s?o.jsx(P.Check,{className:"h-3.5 w-3.5 text-primary"}):o.jsx(P.Braces,{className:"h-3 w-3 text-muted-foreground/50"})})]},n.key)})})]})]})},Tb=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Label"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Descrição"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do step"})]}),o.jsx(_c,{value:e.icone,onChange:r=>t({icone:r})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"step-show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(W,{htmlFor:"step-show-label",className:"text-xs cursor-pointer",children:"Exibir título no formulário"})]})]});function sd(e){const t=e+"CollectionProvider",[r,a]=bt(t),[n,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=f=>{const{scope:v,children:b}=f,w=E.useRef(null),y=E.useRef(new Map).current;return o.jsx(n,{scope:v,itemMap:y,collectionRef:w,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=or(l),d=E.forwardRef((f,v)=>{const{scope:b,children:w}=f,y=s(l,b),N=pe(v,y.collectionRef);return o.jsx(c,{ref:N,children:w})});d.displayName=l;const u=e+"CollectionItemSlot",p="data-radix-collection-item",m=or(u),h=E.forwardRef((f,v)=>{const{scope:b,children:w,...y}=f,N=E.useRef(null),C=pe(v,N),_=s(u,b);return E.useEffect(()=>(_.itemMap.set(N,{ref:N,...y}),()=>void _.itemMap.delete(N))),o.jsx(m,{[p]:"",ref:C,children:w})});h.displayName=u;function g(f){const v=s(e+"CollectionConsumer",f);return E.useCallback(()=>{const b=v.collectionRef.current;if(!b)return[];const w=Array.from(b.querySelectorAll(`[${p}]`));return Array.from(v.itemMap.values()).sort((y,N)=>w.indexOf(y.ref.current)-w.indexOf(N.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:d,ItemSlot:h},g,a]}var id=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"}),$b="VisuallyHidden",ld=x.forwardRef((e,t)=>o.jsx(le.span,{...e,ref:t,style:{...id,...e.style}}));ld.displayName=$b;var Rb=ld,Ob=[" ","Enter","ArrowUp","ArrowDown"],Db=[" ","Enter"],Ht="Select",[za,Ma,Ab]=sd(Ht),[fr]=bt(Ht,[Ab,mr]),Fa=mr(),[Ib,Ot]=fr(Ht),[Lb,zb]=fr(Ht),cd=e=>{const{__scopeSelect:t,children:r,open:a,defaultOpen:n,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:d,name:u,autoComplete:p,disabled:m,required:h,form:g}=e,f=Fa(t),[v,b]=x.useState(null),[w,y]=x.useState(null),[N,C]=x.useState(!1),_=fn(d),[k,j]=Vt({prop:a,defaultProp:n??!1,onChange:s,caller:Ht}),[R,A]=Vt({prop:i,defaultProp:l,onChange:c,caller:Ht}),I=x.useRef(null),F=v?g||!!v.closest("form"):!0,[V,M]=x.useState(new Set),U=Array.from(V).map($=>$.props.value).join(";");return o.jsx(Rn,{...f,children:o.jsxs(Ib,{required:h,scope:t,trigger:v,onTriggerChange:b,valueNode:w,onValueNodeChange:y,valueNodeHasChildren:N,onValueNodeHasChildrenChange:C,contentId:_t(),value:R,onValueChange:A,open:k,onOpenChange:j,dir:_,triggerPointerDownPosRef:I,disabled:m,children:[o.jsx(za.Provider,{scope:t,children:o.jsx(Lb,{scope:e.__scopeSelect,onNativeOptionAdd:x.useCallback($=>{M(T=>new Set(T).add($))},[]),onNativeOptionRemove:x.useCallback($=>{M(T=>{const D=new Set(T);return D.delete($),D})},[]),children:r})}),F?o.jsxs(Od,{"aria-hidden":!0,required:h,tabIndex:-1,name:u,autoComplete:p,value:R,onChange:$=>A($.target.value),disabled:m,form:g,children:[R===void 0?o.jsx("option",{value:""}):null,Array.from(V)]},U):null]})})};cd.displayName=Ht;var dd="SelectTrigger",ud=x.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:a=!1,...n}=e,s=Fa(r),i=Ot(dd,r),l=i.disabled||a,c=pe(t,i.onTriggerChange),d=Ma(r),u=x.useRef("touch"),[p,m,h]=Ad(f=>{const v=d().filter(y=>!y.disabled),b=v.find(y=>y.value===i.value),w=Id(v,f,b);w!==void 0&&i.onValueChange(w.value)}),g=f=>{l||(i.onOpenChange(!0),h()),f&&(i.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return o.jsx(Da,{asChild:!0,...s,children:o.jsx(le.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Dd(i.value)?"":void 0,...n,ref:c,onClick:oe(n.onClick,f=>{f.currentTarget.focus(),u.current!=="mouse"&&g(f)}),onPointerDown:oe(n.onPointerDown,f=>{u.current=f.pointerType;const v=f.target;v.hasPointerCapture(f.pointerId)&&v.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(g(f),f.preventDefault())}),onKeyDown:oe(n.onKeyDown,f=>{const v=p.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&m(f.key),!(v&&f.key===" ")&&Ob.includes(f.key)&&(g(),f.preventDefault())})})})});ud.displayName=dd;var pd="SelectValue",md=x.forwardRef((e,t)=>{const{__scopeSelect:r,className:a,style:n,children:s,placeholder:i="",...l}=e,c=Ot(pd,r),{onValueNodeHasChildrenChange:d}=c,u=s!==void 0,p=pe(t,c.onValueNodeChange);return Ee(()=>{d(u)},[d,u]),o.jsx(le.span,{...l,ref:p,style:{pointerEvents:"none"},children:Dd(c.value)?o.jsx(o.Fragment,{children:i}):s})});md.displayName=pd;var Mb="SelectIcon",fd=x.forwardRef((e,t)=>{const{__scopeSelect:r,children:a,...n}=e;return o.jsx(le.span,{"aria-hidden":!0,...n,ref:t,children:a||"▼"})});fd.displayName=Mb;var Fb="SelectPortal",hd=e=>o.jsx(ka,{asChild:!0,...e});hd.displayName=Fb;var Wt="SelectContent",xd=x.forwardRef((e,t)=>{const r=Ot(Wt,e.__scopeSelect),[a,n]=x.useState();if(Ee(()=>{n(new DocumentFragment)},[]),!r.open){const s=a;return s?da.createPortal(o.jsx(gd,{scope:e.__scopeSelect,children:o.jsx(za.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),s):null}return o.jsx(vd,{...e,ref:t})});xd.displayName=Wt;var tt=10,[gd,Dt]=fr(Wt),Vb="SelectContentImpl",Bb=or("SelectContent.RemoveScroll"),vd=x.forwardRef((e,t)=>{const{__scopeSelect:r,position:a="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:f,avoidCollisions:v,...b}=e,w=Ot(Wt,r),[y,N]=x.useState(null),[C,_]=x.useState(null),k=pe(t,H=>N(H)),[j,R]=x.useState(null),[A,I]=x.useState(null),F=Ma(r),[V,M]=x.useState(!1),U=x.useRef(!1);x.useEffect(()=>{if(y)return yn(y)},[y]),bn();const $=x.useCallback(H=>{const[ie,...te]=F().map(fe=>fe.ref.current),[re]=te.slice(-1),Q=document.activeElement;for(const fe of H)if(fe===Q||(fe==null||fe.scrollIntoView({block:"nearest"}),fe===ie&&C&&(C.scrollTop=0),fe===re&&C&&(C.scrollTop=C.scrollHeight),fe==null||fe.focus(),document.activeElement!==Q))return},[F,C]),T=x.useCallback(()=>$([j,y]),[$,j,y]);x.useEffect(()=>{V&&T()},[V,T]);const{onOpenChange:D,triggerPointerDownPosRef:z}=w;x.useEffect(()=>{if(y){let H={x:0,y:0};const ie=re=>{var Q,fe;H={x:Math.abs(Math.round(re.pageX)-(((Q=z.current)==null?void 0:Q.x)??0)),y:Math.abs(Math.round(re.pageY)-(((fe=z.current)==null?void 0:fe.y)??0))}},te=re=>{H.x<=10&&H.y<=10?re.preventDefault():y.contains(re.target)||D(!1),document.removeEventListener("pointermove",ie),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",te,{capture:!0})}}},[y,D,z]),x.useEffect(()=>{const H=()=>D(!1);return window.addEventListener("blur",H),window.addEventListener("resize",H),()=>{window.removeEventListener("blur",H),window.removeEventListener("resize",H)}},[D]);const[L,ee]=Ad(H=>{const ie=F().filter(Q=>!Q.disabled),te=ie.find(Q=>Q.ref.current===document.activeElement),re=Id(ie,H,te);re&&setTimeout(()=>re.ref.current.focus())}),Y=x.useCallback((H,ie,te)=>{const re=!U.current&&!te;(w.value!==void 0&&w.value===ie||re)&&(R(H),re&&(U.current=!0))},[w.value]),J=x.useCallback(()=>y==null?void 0:y.focus(),[y]),q=x.useCallback((H,ie,te)=>{const re=!U.current&&!te;(w.value!==void 0&&w.value===ie||re)&&I(H)},[w.value]),se=a==="popper"?Eo:bd,me=se===Eo?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:p,collisionBoundary:m,collisionPadding:h,sticky:g,hideWhenDetached:f,avoidCollisions:v}:{};return o.jsx(gd,{scope:r,content:y,viewport:C,onViewportChange:_,itemRefCallback:Y,selectedItem:j,onItemLeave:J,itemTextRefCallback:q,focusSelectedItem:T,selectedItemText:A,position:a,isPositioned:V,searchRef:L,children:o.jsx(Ea,{as:Bb,allowPinchZoom:!0,children:o.jsx(Sa,{asChild:!0,trapped:w.open,onMountAutoFocus:H=>{H.preventDefault()},onUnmountAutoFocus:oe(n,H=>{var ie;(ie=w.trigger)==null||ie.focus({preventScroll:!0}),H.preventDefault()}),children:o.jsx(kr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:H=>H.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:o.jsx(se,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:H=>H.preventDefault(),...b,...me,onPlaced:()=>M(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:oe(b.onKeyDown,H=>{const ie=H.ctrlKey||H.altKey||H.metaKey;if(H.key==="Tab"&&H.preventDefault(),!ie&&H.key.length===1&&ee(H.key),["ArrowUp","ArrowDown","Home","End"].includes(H.key)){let te=F().filter(re=>!re.disabled).map(re=>re.ref.current);if(["ArrowUp","End"].includes(H.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(H.key)){const re=H.target,Q=te.indexOf(re);te=te.slice(Q+1)}setTimeout(()=>$(te)),H.preventDefault()}})})})})})})});vd.displayName=Vb;var Ub="SelectItemAlignedPosition",bd=x.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:a,...n}=e,s=Ot(Wt,r),i=Dt(Wt,r),[l,c]=x.useState(null),[d,u]=x.useState(null),p=pe(t,k=>u(k)),m=Ma(r),h=x.useRef(!1),g=x.useRef(!0),{viewport:f,selectedItem:v,selectedItemText:b,focusSelectedItem:w}=i,y=x.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&f&&v&&b){const k=s.trigger.getBoundingClientRect(),j=d.getBoundingClientRect(),R=s.valueNode.getBoundingClientRect(),A=b.getBoundingClientRect();if(s.dir!=="rtl"){const re=A.left-j.left,Q=R.left-re,fe=k.left-Q,we=k.width+fe,je=Math.max(we,j.width),Me=window.innerWidth-tt,Ae=wr(Q,[tt,Math.max(tt,Me-je)]);l.style.minWidth=we+"px",l.style.left=Ae+"px"}else{const re=j.right-A.right,Q=window.innerWidth-R.right-re,fe=window.innerWidth-k.right-Q,we=k.width+fe,je=Math.max(we,j.width),Me=window.innerWidth-tt,Ae=wr(Q,[tt,Math.max(tt,Me-je)]);l.style.minWidth=we+"px",l.style.right=Ae+"px"}const I=m(),F=window.innerHeight-tt*2,V=f.scrollHeight,M=window.getComputedStyle(d),U=parseInt(M.borderTopWidth,10),$=parseInt(M.paddingTop,10),T=parseInt(M.borderBottomWidth,10),D=parseInt(M.paddingBottom,10),z=U+$+V+D+T,L=Math.min(v.offsetHeight*5,z),ee=window.getComputedStyle(f),Y=parseInt(ee.paddingTop,10),J=parseInt(ee.paddingBottom,10),q=k.top+k.height/2-tt,se=F-q,me=v.offsetHeight/2,H=v.offsetTop+me,ie=U+$+H,te=z-ie;if(ie<=q){const re=I.length>0&&v===I[I.length-1].ref.current;l.style.bottom="0px";const Q=d.clientHeight-f.offsetTop-f.offsetHeight,fe=Math.max(se,me+(re?J:0)+Q+T),we=ie+fe;l.style.height=we+"px"}else{const re=I.length>0&&v===I[0].ref.current;l.style.top="0px";const Q=Math.max(q,U+f.offsetTop+(re?Y:0)+me)+te;l.style.height=Q+"px",f.scrollTop=ie-q+f.offsetTop}l.style.margin=`${tt}px 0`,l.style.minHeight=L+"px",l.style.maxHeight=F+"px",a==null||a(),requestAnimationFrame(()=>h.current=!0)}},[m,s.trigger,s.valueNode,l,d,f,v,b,s.dir,a]);Ee(()=>y(),[y]);const[N,C]=x.useState();Ee(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const _=x.useCallback(k=>{k&&g.current===!0&&(y(),w==null||w(),g.current=!1)},[y,w]);return o.jsx(Wb,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:_,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:o.jsx(le.div,{...n,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});bd.displayName=Ub;var Hb="SelectPopperPosition",Eo=x.forwardRef((e,t)=>{const{__scopeSelect:r,align:a="start",collisionPadding:n=tt,...s}=e,i=Fa(r);return o.jsx(On,{...i,...s,ref:t,align:a,collisionPadding:n,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)"}})});Eo.displayName=Hb;var[Wb,In]=fr(Wt,{}),Po="SelectViewport",yd=x.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:a,...n}=e,s=Dt(Po,r),i=In(Po,r),l=pe(t,s.onViewportChange),c=x.useRef(0);return o.jsxs(o.Fragment,{children:[o.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:a}),o.jsx(za.Slot,{scope:r,children:o.jsx(le.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:oe(n.onScroll,d=>{const u=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&p){const h=Math.abs(c.current-u.scrollTop);if(h>0){const g=window.innerHeight-tt*2,f=parseFloat(p.style.minHeight),v=parseFloat(p.style.height),b=Math.max(f,v);if(b<g){const w=b+h,y=Math.min(g,w),N=w-y;p.style.height=y+"px",p.style.bottom==="0px"&&(u.scrollTop=N>0?N:0,p.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});yd.displayName=Po;var wd="SelectGroup",[qb,Zb]=fr(wd),Xb=x.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e,n=_t();return o.jsx(qb,{scope:r,id:n,children:o.jsx(le.div,{role:"group","aria-labelledby":n,...a,ref:t})})});Xb.displayName=wd;var jd="SelectLabel",Nd=x.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e,n=Zb(jd,r);return o.jsx(le.div,{id:n.id,...a,ref:t})});Nd.displayName=jd;var sa="SelectItem",[Gb,Cd]=fr(sa),Sd=x.forwardRef((e,t)=>{const{__scopeSelect:r,value:a,disabled:n=!1,textValue:s,...i}=e,l=Ot(sa,r),c=Dt(sa,r),d=l.value===a,[u,p]=x.useState(s??""),[m,h]=x.useState(!1),g=pe(t,w=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,w,a,n)}),f=_t(),v=x.useRef("touch"),b=()=>{n||(l.onValueChange(a),l.onOpenChange(!1))};if(a==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(Gb,{scope:r,value:a,disabled:n,textId:f,isSelected:d,onItemTextChange:x.useCallback(w=>{p(y=>y||((w==null?void 0:w.textContent)??"").trim())},[]),children:o.jsx(za.ItemSlot,{scope:r,value:a,disabled:n,textValue:u,children:o.jsx(le.div,{role:"option","aria-labelledby":f,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...i,ref:g,onFocus:oe(i.onFocus,()=>h(!0)),onBlur:oe(i.onBlur,()=>h(!1)),onClick:oe(i.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:oe(i.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:oe(i.onPointerDown,w=>{v.current=w.pointerType}),onPointerMove:oe(i.onPointerMove,w=>{var y;v.current=w.pointerType,n?(y=c.onItemLeave)==null||y.call(c):v.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:oe(i.onPointerLeave,w=>{var y;w.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:oe(i.onKeyDown,w=>{var y;((y=c.searchRef)==null?void 0:y.current)!==""&&w.key===" "||(Db.includes(w.key)&&b(),w.key===" "&&w.preventDefault())})})})})});Sd.displayName=sa;var br="SelectItemText",kd=x.forwardRef((e,t)=>{const{__scopeSelect:r,className:a,style:n,...s}=e,i=Ot(br,r),l=Dt(br,r),c=Cd(br,r),d=zb(br,r),[u,p]=x.useState(null),m=pe(t,b=>p(b),c.onItemTextChange,b=>{var w;return(w=l.itemTextRefCallback)==null?void 0:w.call(l,b,c.value,c.disabled)}),h=u==null?void 0:u.textContent,g=x.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:h},c.value),[c.disabled,c.value,h]),{onNativeOptionAdd:f,onNativeOptionRemove:v}=d;return Ee(()=>(f(g),()=>v(g)),[f,v,g]),o.jsxs(o.Fragment,{children:[o.jsx(le.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?da.createPortal(s.children,i.valueNode):null]})});kd.displayName=br;var _d="SelectItemIndicator",Ed=x.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e;return Cd(_d,r).isSelected?o.jsx(le.span,{"aria-hidden":!0,...a,ref:t}):null});Ed.displayName=_d;var To="SelectScrollUpButton",Pd=x.forwardRef((e,t)=>{const r=Dt(To,e.__scopeSelect),a=In(To,e.__scopeSelect),[n,s]=x.useState(!1),i=pe(t,a.onScrollButtonChange);return Ee(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),n?o.jsx($d,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Pd.displayName=To;var $o="SelectScrollDownButton",Td=x.forwardRef((e,t)=>{const r=Dt($o,e.__scopeSelect),a=In($o,e.__scopeSelect),[n,s]=x.useState(!1),i=pe(t,a.onScrollButtonChange);return Ee(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;s(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),n?o.jsx($d,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});Td.displayName=$o;var $d=x.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:a,...n}=e,s=Dt("SelectScrollButton",r),i=x.useRef(null),l=Ma(r),c=x.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return x.useEffect(()=>()=>c(),[c]),Ee(()=>{var d;const u=l().find(p=>p.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),o.jsx(le.div,{"aria-hidden":!0,...n,ref:t,style:{flexShrink:0,...n.style},onPointerDown:oe(n.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(a,50))}),onPointerMove:oe(n.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),i.current===null&&(i.current=window.setInterval(a,50))}),onPointerLeave:oe(n.onPointerLeave,()=>{c()})})}),Yb="SelectSeparator",Rd=x.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e;return o.jsx(le.div,{"aria-hidden":!0,...a,ref:t})});Rd.displayName=Yb;var Ro="SelectArrow",Kb=x.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e,n=Fa(r),s=Ot(Ro,r),i=Dt(Ro,r);return s.open&&i.position==="popper"?o.jsx(Dn,{...n,...a,ref:t}):null});Kb.displayName=Ro;var Jb="SelectBubbleInput",Od=x.forwardRef(({__scopeSelect:e,value:t,...r},a)=>{const n=x.useRef(null),s=pe(a,n),i=dn(t);return x.useEffect(()=>{const l=n.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(le.select,{...r,style:{...id,...r.style},ref:s,defaultValue:t})});Od.displayName=Jb;function Dd(e){return e===""||e===void 0}function Ad(e){const t=Le(e),r=x.useRef(""),a=x.useRef(0),n=x.useCallback(i=>{const l=r.current+i;t(l),function c(d){r.current=d,window.clearTimeout(a.current),d!==""&&(a.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),s=x.useCallback(()=>{r.current="",window.clearTimeout(a.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(a.current),[]),[r,n,s]}function Id(e,t,r){const a=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,n=r?e.indexOf(r):-1;let s=Qb(e,Math.max(n,0));a.length===1&&(s=s.filter(l=>l!==r));const i=s.find(l=>l.textValue.toLowerCase().startsWith(a.toLowerCase()));return i!==r?i:void 0}function Qb(e,t){return e.map((r,a)=>e[(t+a)%e.length])}var ey=cd,Ld=ud,ty=md,ry=fd,ay=hd,zd=xd,oy=yd,Md=Nd,Fd=Sd,ny=kd,sy=Ed,Vd=Pd,Bd=Td,Ud=Rd;const Ge=ey,Ye=ty,He=x.forwardRef(({className:e,children:t,...r},a)=>o.jsxs(Ld,{ref:a,className:G("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,o.jsx(ry,{asChild:!0,children:o.jsx(P.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));He.displayName=Ld.displayName;const Hd=x.forwardRef(({className:e,...t},r)=>o.jsx(Vd,{ref:r,className:G("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(P.ChevronUp,{className:"h-4 w-4"})}));Hd.displayName=Vd.displayName;const Wd=x.forwardRef(({className:e,...t},r)=>o.jsx(Bd,{ref:r,className:G("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(P.ChevronDown,{className:"h-4 w-4"})}));Wd.displayName=Bd.displayName;const We=x.forwardRef(({className:e,children:t,position:r="popper",...a},n)=>o.jsx(ay,{children:o.jsxs(zd,{ref:n,className:G("relative z-50 max-h-96 min-w-[8rem] overflow-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",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,...a,children:[o.jsx(Hd,{}),o.jsx(oy,{className:G("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(Wd,{})]})}));We.displayName=zd.displayName;const iy=x.forwardRef(({className:e,...t},r)=>o.jsx(Md,{ref:r,className:G("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));iy.displayName=Md.displayName;const Se=x.forwardRef(({className:e,children:t,...r},a)=>o.jsxs(Fd,{ref:a,className:G("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(sy,{children:o.jsx(P.Check,{className:"h-4 w-4"})})}),o.jsx(ny,{children:t})]}));Se.displayName=Fd.displayName;const ly=x.forwardRef(({className:e,...t},r)=>o.jsx(Ud,{ref:r,className:G("-mx-1 my-1 h-px bg-muted",e),...t}));ly.displayName=Ud.displayName;var qd=["PageUp","PageDown"],Zd=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Xd={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},hr="Slider",[Oo,cy,dy]=sd(hr),[Gd]=bt(hr,[dy]),[uy,Va]=Gd(hr),Yd=x.forwardRef((e,t)=>{const{name:r,min:a=0,max:n=100,step:s=1,orientation:i="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[a],value:u,onValueChange:p=()=>{},onValueCommit:m=()=>{},inverted:h=!1,form:g,...f}=e,v=x.useRef(new Set),b=x.useRef(0),w=i==="horizontal"?py:my,[y=[],N]=Vt({prop:u,defaultProp:d,onChange:A=>{var I;(I=[...v.current][b.current])==null||I.focus(),p(A)}}),C=x.useRef(y);function _(A){const I=vy(y,A);R(A,I)}function k(A){R(A,b.current)}function j(){const A=C.current[b.current];y[b.current]!==A&&m(y)}function R(A,I,{commit:F}={commit:!1}){const V=jy(s),M=Ny(Math.round((A-a)/s)*s+a,V),U=wr(M,[a,n]);N(($=[])=>{const T=xy($,U,I);if(wy(T,c*s)){b.current=T.indexOf(U);const D=String(T)!==String($);return D&&F&&m(T),D?T:$}else return $})}return o.jsx(uy,{scope:e.__scopeSlider,name:r,disabled:l,min:a,max:n,valueIndexToChangeRef:b,thumbs:v.current,values:y,orientation:i,form:g,children:o.jsx(Oo.Provider,{scope:e.__scopeSlider,children:o.jsx(Oo.Slot,{scope:e.__scopeSlider,children:o.jsx(w,{"aria-disabled":l,"data-disabled":l?"":void 0,...f,ref:t,onPointerDown:oe(f.onPointerDown,()=>{l||(C.current=y)}),min:a,max:n,inverted:h,onSlideStart:l?void 0:_,onSlideMove:l?void 0:k,onSlideEnd:l?void 0:j,onHomeKeyDown:()=>!l&&R(a,0,{commit:!0}),onEndKeyDown:()=>!l&&R(n,y.length-1,{commit:!0}),onStepKeyDown:({event:A,direction:I})=>{if(!l){const F=qd.includes(A.key)||A.shiftKey&&Zd.includes(A.key)?10:1,V=b.current,M=y[V],U=s*F*I;R(M+U,V,{commit:!0})}}})})})})});Yd.displayName=hr;var[Kd,Jd]=Gd(hr,{startEdge:"left",endEdge:"right",size:"width",direction:1}),py=x.forwardRef((e,t)=>{const{min:r,max:a,dir:n,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...u}=e,[p,m]=x.useState(null),h=pe(t,y=>m(y)),g=x.useRef(void 0),f=fn(n),v=f==="ltr",b=v&&!s||!v&&s;function w(y){const N=g.current||p.getBoundingClientRect(),C=[0,N.width],_=Ln(C,b?[r,a]:[a,r]);return g.current=N,_(y-N.left)}return o.jsx(Kd,{scope:e.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:o.jsx(Qd,{dir:f,"data-orientation":"horizontal",...u,ref:h,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:y=>{const N=w(y.clientX);i==null||i(N)},onSlideMove:y=>{const N=w(y.clientX);l==null||l(N)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:y=>{const N=Xd[b?"from-left":"from-right"].includes(y.key);d==null||d({event:y,direction:N?-1:1})}})})}),my=x.forwardRef((e,t)=>{const{min:r,max:a,inverted:n,onSlideStart:s,onSlideMove:i,onSlideEnd:l,onStepKeyDown:c,...d}=e,u=x.useRef(null),p=pe(t,u),m=x.useRef(void 0),h=!n;function g(f){const v=m.current||u.current.getBoundingClientRect(),b=[0,v.height],w=Ln(b,h?[a,r]:[r,a]);return m.current=v,w(f-v.top)}return o.jsx(Kd,{scope:e.__scopeSlider,startEdge:h?"bottom":"top",endEdge:h?"top":"bottom",size:"height",direction:h?1:-1,children:o.jsx(Qd,{"data-orientation":"vertical",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:f=>{const v=g(f.clientY);s==null||s(v)},onSlideMove:f=>{const v=g(f.clientY);i==null||i(v)},onSlideEnd:()=>{m.current=void 0,l==null||l()},onStepKeyDown:f=>{const v=Xd[h?"from-bottom":"from-top"].includes(f.key);c==null||c({event:f,direction:v?-1:1})}})})}),Qd=x.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:a,onSlideMove:n,onSlideEnd:s,onHomeKeyDown:i,onEndKeyDown:l,onStepKeyDown:c,...d}=e,u=Va(hr,r);return o.jsx(le.span,{...d,ref:t,onKeyDown:oe(e.onKeyDown,p=>{p.key==="Home"?(i(p),p.preventDefault()):p.key==="End"?(l(p),p.preventDefault()):qd.concat(Zd).includes(p.key)&&(c(p),p.preventDefault())}),onPointerDown:oe(e.onPointerDown,p=>{const m=p.target;m.setPointerCapture(p.pointerId),p.preventDefault(),u.thumbs.has(m)?m.focus():a(p)}),onPointerMove:oe(e.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&n(p)}),onPointerUp:oe(e.onPointerUp,p=>{const m=p.target;m.hasPointerCapture(p.pointerId)&&(m.releasePointerCapture(p.pointerId),s(p))})})}),eu="SliderTrack",tu=x.forwardRef((e,t)=>{const{__scopeSlider:r,...a}=e,n=Va(eu,r);return o.jsx(le.span,{"data-disabled":n.disabled?"":void 0,"data-orientation":n.orientation,...a,ref:t})});tu.displayName=eu;var Do="SliderRange",ru=x.forwardRef((e,t)=>{const{__scopeSlider:r,...a}=e,n=Va(Do,r),s=Jd(Do,r),i=x.useRef(null),l=pe(t,i),c=n.values.length,d=n.values.map(m=>nu(m,n.min,n.max)),u=c>1?Math.min(...d):0,p=100-Math.max(...d);return o.jsx(le.span,{"data-orientation":n.orientation,"data-disabled":n.disabled?"":void 0,...a,ref:l,style:{...e.style,[s.startEdge]:u+"%",[s.endEdge]:p+"%"}})});ru.displayName=Do;var Ao="SliderThumb",au=x.forwardRef((e,t)=>{const r=cy(e.__scopeSlider),[a,n]=x.useState(null),s=pe(t,l=>n(l)),i=x.useMemo(()=>a?r().findIndex(l=>l.ref.current===a):-1,[r,a]);return o.jsx(fy,{...e,ref:s,index:i})}),fy=x.forwardRef((e,t)=>{const{__scopeSlider:r,index:a,name:n,...s}=e,i=Va(Ao,r),l=Jd(Ao,r),[c,d]=x.useState(null),u=pe(t,w=>d(w)),p=c?i.form||!!c.closest("form"):!0,m=un(c),h=i.values[a],g=h===void 0?0:nu(h,i.min,i.max),f=gy(a,i.values.length),v=m==null?void 0:m[l.size],b=v?by(v,g,l.direction):0;return x.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${g}% + ${b}px)`},children:[o.jsx(Oo.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(le.span,{role:"slider","aria-label":e["aria-label"]||f,"aria-valuemin":i.min,"aria-valuenow":h,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...s,ref:u,style:h===void 0?{display:"none"}:e.style,onFocus:oe(e.onFocus,()=>{i.valueIndexToChangeRef.current=a})})}),p&&o.jsx(ou,{name:n??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:h},a)]})});au.displayName=Ao;var hy="RadioBubbleInput",ou=x.forwardRef(({__scopeSlider:e,value:t,...r},a)=>{const n=x.useRef(null),s=pe(n,a),i=dn(t);return x.useEffect(()=>{const l=n.current;if(!l)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("input",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(le.input,{style:{display:"none"},...r,ref:s,defaultValue:t})});ou.displayName=hy;function xy(e=[],t,r){const a=[...e];return a[r]=t,a.sort((n,s)=>n-s)}function nu(e,t,r){const a=100/(r-t)*(e-t);return wr(a,[0,100])}function gy(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function vy(e,t){if(e.length===1)return 0;const r=e.map(n=>Math.abs(n-t)),a=Math.min(...r);return r.indexOf(a)}function by(e,t,r){const a=e/2,n=Ln([0,50],[0,a]);return(a-n(t)*r)*r}function yy(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function wy(e,t){if(t>0){const r=yy(e);return Math.min(...r)>=t}return!0}function Ln(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(r-e[0])}}function jy(e){return(String(e).split(".")[1]||"").length}function Ny(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var su=Yd,Cy=tu,Sy=ru,ky=au;const iu=x.forwardRef(({className:e,...t},r)=>o.jsxs(su,{ref:r,className:G("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(Cy,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(Sy,{className:"absolute h-full bg-primary"})}),o.jsx(ky,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));iu.displayName=su.displayName;const _y=({inicioColuna:e,tamanho:t,onSelect:r})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(W,{className:"text-xs",children:"Posição no grid"}),o.jsx("div",{className:"flex gap-0.5",children:Array.from({length:12},(a,n)=>{const s=n+1,i=s>=e&&s<e+t;return o.jsx("button",{onClick:()=>r(s),className:G("flex-1 h-6 rounded-sm text-[8px] font-mono transition-all border",i?"bg-primary text-primary-foreground border-primary":"bg-muted/50 text-muted-foreground/50 border-border/50 hover:bg-muted hover:border-border"),children:s},s)})}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Início: col ",e," · Span: ",t]})]}),lu=({tamanho:e,inicioColuna:t,defaultTamanho:r=6,onTamanhoChange:a,onPositionChange:n})=>{const s=13-t;return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(W,{className:"text-xs",children:["Tamanho (",e,"/12 colunas)"]}),o.jsx(iu,{value:[e],onValueChange:([i])=>{const l=Math.min(i,s);a(l)},min:1,max:s,step:1,className:"py-1"}),o.jsxs("div",{className:"flex justify-between text-[9px] text-muted-foreground",children:[o.jsx("span",{children:"1"}),o.jsx("span",{children:"3"}),o.jsx("span",{children:"6"}),o.jsx("span",{children:"9"}),o.jsx("span",{children:"12"})]})]}),o.jsx(_y,{inicioColuna:t,tamanho:e,onSelect:i=>{const l=13-i,c=Math.min(e,l);n(i),c!==e&&a(c)}})]})},Ey=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Label"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Descrição"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do container"})]}),o.jsx(_c,{value:e.icone,onChange:r=>t({icone:r})}),o.jsx(lu,{tamanho:e.tamanho||12,inicioColuna:e.inicioColuna||1,defaultTamanho:12,onTamanhoChange:r=>t({tamanho:r}),onPositionChange:r=>t({inicioColuna:r})}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Colunas internas"}),o.jsxs(Ge,{value:String(e.columns||2),onValueChange:r=>t({columns:Number(r)}),children:[o.jsx(He,{className:"h-8 text-sm",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"1",children:"1 coluna"}),o.jsx(Se,{value:"2",children:"2 colunas"}),o.jsx(Se,{value:"3",children:"3 colunas"}),o.jsx(Se,{value:"4",children:"4 colunas"})]})]}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Grid interno simplificado para campos"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(W,{htmlFor:"show-label",className:"text-xs cursor-pointer",children:"Exibir label no formulário"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"show-as-card",checked:e.showAsCard||!1,onCheckedChange:r=>t({showAsCard:r===!0})}),o.jsx(W,{htmlFor:"show-as-card",className:"text-xs cursor-pointer",children:"Exibir como card"})]})]}),Ba=x.forwardRef(({className:e,...t},r)=>o.jsx("textarea",{className:G("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));Ba.displayName="Textarea";function Py(e,t=[]){let r=[];function a(s,i){const l=x.createContext(i);l.displayName=s+"Context";const c=r.length;r=[...r,i];const d=p=>{var m;const{scope:h,children:g,...f}=p,v=((m=h==null?void 0:h[e])==null?void 0:m[c])||l,b=x.useMemo(()=>f,Object.values(f));return o.jsx(v.Provider,{value:b,children:g})};d.displayName=s+"Provider";function u(p,m){var h;const g=((h=m==null?void 0:m[e])==null?void 0:h[c])||l,f=x.useContext(g);if(f)return f;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[d,u]}const n=()=>{const s=r.map(i=>x.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return x.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return n.scopeName=e,[a,Ty(n,...t)]}function Ty(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const a=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(n){const s=a.reduce((i,{useScope:l,scopeName:c})=>{const d=l(n)[`__scope${c}`];return{...i,...d}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var zn="Progress",Mn=100,[$y]=Py(zn),[Ry,Oy]=$y(zn),cu=x.forwardRef((e,t)=>{const{__scopeProgress:r,value:a=null,max:n,getValueLabel:s=Dy,...i}=e;(n||n===0)&&!si(n)&&console.error(Ay(`${n}`,"Progress"));const l=si(n)?n:Mn;a!==null&&!ii(a,l)&&console.error(Iy(`${a}`,"Progress"));const c=ii(a,l)?a:null,d=ia(c)?s(c,l):void 0;return o.jsx(Ry,{scope:r,value:c,max:l,children:o.jsx(ya.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":ia(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":pu(c,l),"data-value":c??void 0,"data-max":l,...i,ref:t})})});cu.displayName=zn;var du="ProgressIndicator",uu=x.forwardRef((e,t)=>{const{__scopeProgress:r,...a}=e,n=Oy(du,r);return o.jsx(ya.div,{"data-state":pu(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...a,ref:t})});uu.displayName=du;function Dy(e,t){return`${Math.round(e/t*100)}%`}function pu(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function ia(e){return typeof e=="number"}function si(e){return ia(e)&&!isNaN(e)&&e>0}function ii(e,t){return ia(e)&&!isNaN(e)&&e<=t&&e>=0}function Ay(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Mn}\`.`}function Iy(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
76
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Qg="DialogDescriptionWarning",ev=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${vc(Qg).contentName}}.`;return h.useEffect(()=>{var a;const n=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},tv=nc,rv=lc,bc=cc,yc=dc,wc=pc,jc=fc,av=xc;const ov=tv,nv=rv,Nc=h.forwardRef(({className:e,...t},r)=>o.jsx(bc,{ref:r,className:G("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Nc.displayName=bc.displayName;const Cc=h.forwardRef(({className:e,children:t,...r},a)=>o.jsxs(nv,{children:[o.jsx(Nc,{}),o.jsxs(yc,{ref:a,className:G("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,o.jsxs(av,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(P.X,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Cc.displayName=yc.displayName;const Sc=({className:e,...t})=>o.jsx("div",{className:G("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Sc.displayName="DialogHeader";const kc=h.forwardRef(({className:e,...t},r)=>o.jsx(wc,{ref:r,className:G("text-lg font-semibold leading-none tracking-tight",e),...t}));kc.displayName=wc.displayName;const _c=h.forwardRef(({className:e,...t},r)=>o.jsx(jc,{ref:r,className:G("text-sm text-muted-foreground",e),...t}));_c.displayName=jc.displayName;function sv(e){if(!e)return null;if(e.includes("-")){const t=e.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");return P.icons[t]??null}return P.icons[e]??null}const Gs=Object.entries(P.icons).map(([e,t])=>({name:e,kebab:e.replace(/([A-Z])/g,(r,a,n)=>n===0?a.toLowerCase():`-${a.toLowerCase()}`),component:t})),Ec=({value:e,onChange:t,label:r="Ícone (Lucide)",hideLabel:a=!1,className:n})=>{const[s,i]=E.useState(!1),[l,c]=E.useState(""),d=E.useMemo(()=>sv(e),[e]),u=E.useMemo(()=>{const x=l.toLowerCase();return x?Gs.filter(g=>g.name.toLowerCase().includes(x)||g.kebab.includes(x)):Gs},[l]),p=x=>{t(x),i(!1)},m=x=>{i(x),x||c("")};return o.jsxs("div",{className:`space-y-1 ${n??""}`,children:[!a&&o.jsx(W,{className:"text-xs",children:r}),o.jsx(ye,{type:"button",variant:"outline",className:"w-full h-8 justify-start text-xs font-normal gap-2",onClick:()=>i(!0),children:d?o.jsxs(o.Fragment,{children:[E.createElement(d,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{className:"truncate",children:e})]}):o.jsx("span",{className:"text-muted-foreground",children:"Selecionar ícone…"})}),o.jsx(ov,{open:s,onOpenChange:m,children:o.jsxs(Cc,{className:"max-w-3xl max-h-[85vh] flex flex-col gap-0 p-0",children:[o.jsxs(Sc,{className:"px-4 pt-4 pb-2 border-b",children:[o.jsx(kc,{children:"Selecionar ícone"}),o.jsx(_c,{children:"Pesquise e clique em um ícone da biblioteca Lucide."})]}),o.jsx("div",{className:"px-4 py-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(P.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ae,{autoFocus:!0,placeholder:"Buscar ícones…",value:l,onChange:x=>c(x.target.value),className:"pl-8 h-9 text-sm"})]})}),o.jsx(Ca,{className:"flex-1 px-4 py-2",children:o.jsxs("div",{className:"grid grid-cols-5 gap-2 sm:grid-cols-7 md:grid-cols-8 pb-2",children:[o.jsxs(ye,{type:"button",variant:e?"outline":"secondary",className:"flex flex-col items-center justify-center h-20 gap-1 p-1",onClick:()=>p(void 0),children:[o.jsx("div",{className:"h-6 w-6 rounded border-2 border-dashed border-muted-foreground/30"}),o.jsx("span",{className:"text-[10px] leading-tight text-center",children:"Nenhum"})]}),u.map(({name:x,component:g})=>o.jsxs(ye,{type:"button",variant:e===x?"secondary":"outline",className:"flex flex-col items-center justify-center h-20 gap-1 p-1 overflow-hidden",onClick:()=>p(x),children:[E.createElement(g,{size:24}),o.jsx("span",{className:"text-[9px] leading-tight text-center break-all line-clamp-2",children:x})]},x))]})})]})})]})},iv=["top","right","bottom","left"],Et=Math.min,Ve=Math.max,ra=Math.round,Wr=Math.floor,lt=e=>({x:e,y:e}),lv={left:"right",right:"left",bottom:"top",top:"bottom"};function So(e,t,r){return Ve(e,Et(t,r))}function gt(e,t){return typeof e=="function"?e(t):e}function vt(e){return e.split("-")[0]}function ur(e){return e.split("-")[1]}function Cn(e){return e==="x"?"y":"x"}function Sn(e){return e==="y"?"height":"width"}function it(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function kn(e){return Cn(it(e))}function cv(e,t,r){r===void 0&&(r=!1);const a=ur(e),n=kn(e),s=Sn(n);let i=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=aa(i)),[i,aa(i)]}function dv(e){const t=aa(e);return[ko(e),t,ko(t)]}function ko(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ys=["left","right"],Ks=["right","left"],uv=["top","bottom"],pv=["bottom","top"];function mv(e,t,r){switch(e){case"top":case"bottom":return r?t?Ks:Ys:t?Ys:Ks;case"left":case"right":return t?uv:pv;default:return[]}}function fv(e,t,r,a){const n=ur(e);let s=mv(vt(e),r==="start",a);return n&&(s=s.map(i=>i+"-"+n),t&&(s=s.concat(s.map(ko)))),s}function aa(e){const t=vt(e);return lv[t]+e.slice(t.length)}function hv(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pc(e){return typeof e!="number"?hv(e):{top:e,right:e,bottom:e,left:e}}function oa(e){const{x:t,y:r,width:a,height:n}=e;return{width:a,height:n,top:r,left:t,right:t+a,bottom:r+n,x:t,y:r}}function Js(e,t,r){let{reference:a,floating:n}=e;const s=it(t),i=kn(t),l=Sn(i),c=vt(t),d=s==="y",u=a.x+a.width/2-n.width/2,p=a.y+a.height/2-n.height/2,m=a[l]/2-n[l]/2;let x;switch(c){case"top":x={x:u,y:a.y-n.height};break;case"bottom":x={x:u,y:a.y+a.height};break;case"right":x={x:a.x+a.width,y:p};break;case"left":x={x:a.x-n.width,y:p};break;default:x={x:a.x,y:a.y}}switch(ur(t)){case"start":x[i]-=m*(r&&d?-1:1);break;case"end":x[i]+=m*(r&&d?-1:1);break}return x}async function xv(e,t){var r;t===void 0&&(t={});const{x:a,y:n,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:m=!1,padding:x=0}=gt(t,e),g=Pc(x),f=l[m?p==="floating"?"reference":"floating":p],v=oa(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(f)))==null||r?f:f.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),b=p==="floating"?{x:a,y:n,width:i.floating.width,height:i.floating.height}:i.reference,j=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),y=await(s.isElement==null?void 0:s.isElement(j))?await(s.getScale==null?void 0:s.getScale(j))||{x:1,y:1}:{x:1,y:1},N=oa(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:j,strategy:c}):b);return{top:(v.top-N.top+g.top)/y.y,bottom:(N.bottom-v.bottom+g.bottom)/y.y,left:(v.left-N.left+g.left)/y.x,right:(N.right-v.right+g.right)/y.x}}const gv=50,vv=async(e,t,r)=>{const{placement:a="bottom",strategy:n="absolute",middleware:s=[],platform:i}=r,l=i.detectOverflow?i:{...i,detectOverflow:xv},c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:p}=Js(d,a,c),m=a,x=0;const g={};for(let f=0;f<s.length;f++){const v=s[f];if(!v)continue;const{name:b,fn:j}=v,{x:y,y:N,data:C,reset:k}=await j({x:u,y:p,initialPlacement:a,placement:m,strategy:n,middlewareData:g,rects:d,platform:l,elements:{reference:e,floating:t}});u=y??u,p=N??p,g[b]={...g[b],...C},k&&x<gv&&(x++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(d=k.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:n}):k.rects),{x:u,y:p}=Js(d,m,c)),f=-1)}return{x:u,y:p,placement:m,strategy:n,middlewareData:g}},bv=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:a,placement:n,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=gt(e,t)||{};if(d==null)return{};const p=Pc(u),m={x:r,y:a},x=kn(n),g=Sn(x),f=await i.getDimensions(d),v=x==="y",b=v?"top":"left",j=v?"bottom":"right",y=v?"clientHeight":"clientWidth",N=s.reference[g]+s.reference[x]-m[x]-s.floating[g],C=m[x]-s.reference[x],k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let _=k?k[y]:0;(!_||!await(i.isElement==null?void 0:i.isElement(k)))&&(_=l.floating[y]||s.floating[g]);const w=N/2-C/2,R=_/2-f[g]/2-1,A=Et(p[b],R),I=Et(p[j],R),F=A,V=_-f[g]-I,M=_/2-f[g]/2+w,U=So(F,M,V),$=!c.arrow&&ur(n)!=null&&M!==U&&s.reference[g]/2-(M<F?A:I)-f[g]/2<0,T=$?M<F?M-F:M-V:0;return{[x]:m[x]+T,data:{[x]:U,centerOffset:M-U-T,...$&&{alignmentOffset:T}},reset:$}}}),yv=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,a;const{placement:n,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:f=!0,...v}=gt(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const b=vt(n),j=it(l),y=vt(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=m||(y||!f?[aa(l)]:dv(l)),k=g!=="none";!m&&k&&C.push(...fv(l,f,g,N));const _=[l,...C],w=await c.detectOverflow(t,v),R=[];let A=((a=s.flip)==null?void 0:a.overflows)||[];if(u&&R.push(w[b]),p){const M=cv(n,i,N);R.push(w[M[0]],w[M[1]])}if(A=[...A,{placement:n,overflows:R}],!R.every(M=>M<=0)){var I,F;const M=(((I=s.flip)==null?void 0:I.index)||0)+1,U=_[M];if(U&&(!(p==="alignment"&&j!==it(U))||A.every(T=>it(T.placement)===j?T.overflows[0]>0:!0)))return{data:{index:M,overflows:A},reset:{placement:U}};let $=(F=A.filter(T=>T.overflows[0]<=0).sort((T,D)=>T.overflows[1]-D.overflows[1])[0])==null?void 0:F.placement;if(!$)switch(x){case"bestFit":{var V;const T=(V=A.filter(D=>{if(k){const z=it(D.placement);return z===j||z==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(z=>z>0).reduce((z,L)=>z+L,0)]).sort((D,z)=>D[1]-z[1])[0])==null?void 0:V[0];T&&($=T);break}case"initialPlacement":$=l;break}if(n!==$)return{reset:{placement:$}}}return{}}}};function Qs(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ei(e){return iv.some(t=>e[t]>=0)}const wv=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:a}=t,{strategy:n="referenceHidden",...s}=gt(e,t);switch(n){case"referenceHidden":{const i=await a.detectOverflow(t,{...s,elementContext:"reference"}),l=Qs(i,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:ei(l)}}}case"escaped":{const i=await a.detectOverflow(t,{...s,altBoundary:!0}),l=Qs(i,r.floating);return{data:{escapedOffsets:l,escaped:ei(l)}}}default:return{}}}}},Tc=new Set(["left","top"]);async function jv(e,t){const{placement:r,platform:a,elements:n}=e,s=await(a.isRTL==null?void 0:a.isRTL(n.floating)),i=vt(r),l=ur(r),c=it(r)==="y",d=Tc.has(i)?-1:1,u=s&&c?-1:1,p=gt(t,e);let{mainAxis:m,crossAxis:x,alignmentAxis:g}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof g=="number"&&(x=l==="end"?g*-1:g),c?{x:x*u,y:m*d}:{x:m*d,y:x*u}}const Nv=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,a;const{x:n,y:s,placement:i,middlewareData:l}=t,c=await jv(t,e);return i===((r=l.offset)==null?void 0:r.placement)&&(a=l.arrow)!=null&&a.alignmentOffset?{}:{x:n+c.x,y:s+c.y,data:{...c,placement:i}}}}},Cv=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:a,placement:n,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:j,y}=b;return{x:j,y}}},...d}=gt(e,t),u={x:r,y:a},p=await s.detectOverflow(t,d),m=it(vt(n)),x=Cn(m);let g=u[x],f=u[m];if(i){const b=x==="y"?"top":"left",j=x==="y"?"bottom":"right",y=g+p[b],N=g-p[j];g=So(y,g,N)}if(l){const b=m==="y"?"top":"left",j=m==="y"?"bottom":"right",y=f+p[b],N=f-p[j];f=So(y,f,N)}const v=c.fn({...t,[x]:g,[m]:f});return{...v,data:{x:v.x-r,y:v.y-a,enabled:{[x]:i,[m]:l}}}}}},Sv=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:a,placement:n,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=gt(e,t),u={x:r,y:a},p=it(n),m=Cn(p);let x=u[m],g=u[p];const f=gt(l,t),v=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(c){const y=m==="y"?"height":"width",N=s.reference[m]-s.floating[y]+v.mainAxis,C=s.reference[m]+s.reference[y]-v.mainAxis;x<N?x=N:x>C&&(x=C)}if(d){var b,j;const y=m==="y"?"width":"height",N=Tc.has(vt(n)),C=s.reference[p]-s.floating[y]+(N&&((b=i.offset)==null?void 0:b[p])||0)+(N?0:v.crossAxis),k=s.reference[p]+s.reference[y]+(N?0:((j=i.offset)==null?void 0:j[p])||0)-(N?v.crossAxis:0);g<C?g=C:g>k&&(g=k)}return{[m]:x,[p]:g}}}},kv=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,a;const{placement:n,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...d}=gt(e,t),u=await i.detectOverflow(t,d),p=vt(n),m=ur(n),x=it(n)==="y",{width:g,height:f}=s.floating;let v,b;p==="top"||p==="bottom"?(v=p,b=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=p,v=m==="end"?"top":"bottom");const j=f-u.top-u.bottom,y=g-u.left-u.right,N=Et(f-u[v],j),C=Et(g-u[b],y),k=!t.middlewareData.shift;let _=N,w=C;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(w=y),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(_=j),k&&!m){const A=Ve(u.left,0),I=Ve(u.right,0),F=Ve(u.top,0),V=Ve(u.bottom,0);x?w=g-2*(A!==0||I!==0?A+I:Ve(u.left,u.right)):_=f-2*(F!==0||V!==0?F+V:Ve(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:_});const R=await i.getDimensions(l.floating);return g!==R.width||f!==R.height?{reset:{rects:!0}}:{}}}};function Ta(){return typeof window<"u"}function pr(e){return $c(e)?(e.nodeName||"").toLowerCase():"#document"}function Ue(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pt(e){var t;return(t=($c(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $c(e){return Ta()?e instanceof Node||e instanceof Ue(e).Node:!1}function at(e){return Ta()?e instanceof Element||e instanceof Ue(e).Element:!1}function yt(e){return Ta()?e instanceof HTMLElement||e instanceof Ue(e).HTMLElement:!1}function ti(e){return!Ta()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ue(e).ShadowRoot}function _r(e){const{overflow:t,overflowX:r,overflowY:a,display:n}=ot(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+r)&&n!=="inline"&&n!=="contents"}function _v(e){return/^(table|td|th)$/.test(pr(e))}function $a(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Ev=/transform|translate|scale|rotate|perspective|filter/,Pv=/paint|layout|strict|content/,Lt=e=>!!e&&e!=="none";let po;function _n(e){const t=at(e)?ot(e):e;return Lt(t.transform)||Lt(t.translate)||Lt(t.scale)||Lt(t.rotate)||Lt(t.perspective)||!En()&&(Lt(t.backdropFilter)||Lt(t.filter))||Ev.test(t.willChange||"")||Pv.test(t.contain||"")}function Tv(e){let t=Pt(e);for(;yt(t)&&!sr(t);){if(_n(t))return t;if($a(t))return null;t=Pt(t)}return null}function En(){return po==null&&(po=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),po}function sr(e){return/^(html|body|#document)$/.test(pr(e))}function ot(e){return Ue(e).getComputedStyle(e)}function Ra(e){return at(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Pt(e){if(pr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ti(e)&&e.host||pt(e);return ti(t)?t.host:t}function Rc(e){const t=Pt(e);return sr(t)?e.ownerDocument?e.ownerDocument.body:e.body:yt(t)&&_r(t)?t:Rc(t)}function jr(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=Rc(e),s=n===((a=e.ownerDocument)==null?void 0:a.body),i=Ue(n);if(s){const l=_o(i);return t.concat(i,i.visualViewport||[],_r(n)?n:[],l&&r?jr(l):[])}else return t.concat(n,jr(n,[],r))}function _o(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Oc(e){const t=ot(e);let r=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const n=yt(e),s=n?e.offsetWidth:r,i=n?e.offsetHeight:a,l=ra(r)!==s||ra(a)!==i;return l&&(r=s,a=i),{width:r,height:a,$:l}}function Pn(e){return at(e)?e:e.contextElement}function rr(e){const t=Pn(e);if(!yt(t))return lt(1);const r=t.getBoundingClientRect(),{width:a,height:n,$:s}=Oc(t);let i=(s?ra(r.width):r.width)/a,l=(s?ra(r.height):r.height)/n;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const $v=lt(0);function Dc(e){const t=Ue(e);return!En()||!t.visualViewport?$v:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rv(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Ue(e)?!1:t}function Ut(e,t,r,a){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),s=Pn(e);let i=lt(1);t&&(a?at(a)&&(i=rr(a)):i=rr(e));const l=Rv(s,r,a)?Dc(s):lt(0);let c=(n.left+l.x)/i.x,d=(n.top+l.y)/i.y,u=n.width/i.x,p=n.height/i.y;if(s){const m=Ue(s),x=a&&at(a)?Ue(a):a;let g=m,f=_o(g);for(;f&&a&&x!==g;){const v=rr(f),b=f.getBoundingClientRect(),j=ot(f),y=b.left+(f.clientLeft+parseFloat(j.paddingLeft))*v.x,N=b.top+(f.clientTop+parseFloat(j.paddingTop))*v.y;c*=v.x,d*=v.y,u*=v.x,p*=v.y,c+=y,d+=N,g=Ue(f),f=_o(g)}}return oa({width:u,height:p,x:c,y:d})}function Oa(e,t){const r=Ra(e).scrollLeft;return t?t.left+r:Ut(pt(e)).left+r}function Ac(e,t){const r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-Oa(e,r),n=r.top+t.scrollTop;return{x:a,y:n}}function Ov(e){let{elements:t,rect:r,offsetParent:a,strategy:n}=e;const s=n==="fixed",i=pt(a),l=t?$a(t.floating):!1;if(a===i||l&&s)return r;let c={scrollLeft:0,scrollTop:0},d=lt(1);const u=lt(0),p=yt(a);if((p||!p&&!s)&&((pr(a)!=="body"||_r(i))&&(c=Ra(a)),p)){const x=Ut(a);d=rr(a),u.x=x.x+a.clientLeft,u.y=x.y+a.clientTop}const m=i&&!p&&!s?Ac(i,c):lt(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+u.x+m.x,y:r.y*d.y-c.scrollTop*d.y+u.y+m.y}}function Dv(e){return Array.from(e.getClientRects())}function Av(e){const t=pt(e),r=Ra(e),a=e.ownerDocument.body,n=Ve(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),s=Ve(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let i=-r.scrollLeft+Oa(e);const l=-r.scrollTop;return ot(a).direction==="rtl"&&(i+=Ve(t.clientWidth,a.clientWidth)-n),{width:n,height:s,x:i,y:l}}const ri=25;function Iv(e,t){const r=Ue(e),a=pt(e),n=r.visualViewport;let s=a.clientWidth,i=a.clientHeight,l=0,c=0;if(n){s=n.width,i=n.height;const u=En();(!u||u&&t==="fixed")&&(l=n.offsetLeft,c=n.offsetTop)}const d=Oa(a);if(d<=0){const u=a.ownerDocument,p=u.body,m=getComputedStyle(p),x=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(a.clientWidth-p.clientWidth-x);g<=ri&&(s-=g)}else d<=ri&&(s+=d);return{width:s,height:i,x:l,y:c}}function Lv(e,t){const r=Ut(e,!0,t==="fixed"),a=r.top+e.clientTop,n=r.left+e.clientLeft,s=yt(e)?rr(e):lt(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=n*s.x,d=a*s.y;return{width:i,height:l,x:c,y:d}}function ai(e,t,r){let a;if(t==="viewport")a=Iv(e,r);else if(t==="document")a=Av(pt(e));else if(at(t))a=Lv(t,r);else{const n=Dc(e);a={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return oa(a)}function Ic(e,t){const r=Pt(e);return r===t||!at(r)||sr(r)?!1:ot(r).position==="fixed"||Ic(r,t)}function zv(e,t){const r=t.get(e);if(r)return r;let a=jr(e,[],!1).filter(l=>at(l)&&pr(l)!=="body"),n=null;const s=ot(e).position==="fixed";let i=s?Pt(e):e;for(;at(i)&&!sr(i);){const l=ot(i),c=_n(i);!c&&l.position==="fixed"&&(n=null),(s?!c&&!n:!c&&l.position==="static"&&n&&(n.position==="absolute"||n.position==="fixed")||_r(i)&&!c&&Ic(e,i))?a=a.filter(d=>d!==i):n=l,i=Pt(i)}return t.set(e,a),a}function Mv(e){let{element:t,boundary:r,rootBoundary:a,strategy:n}=e;const s=[...r==="clippingAncestors"?$a(t)?[]:zv(t,this._c):[].concat(r),a],i=ai(t,s[0],n);let l=i.top,c=i.right,d=i.bottom,u=i.left;for(let p=1;p<s.length;p++){const m=ai(t,s[p],n);l=Ve(m.top,l),c=Et(m.right,c),d=Et(m.bottom,d),u=Ve(m.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function Fv(e){const{width:t,height:r}=Oc(e);return{width:t,height:r}}function Vv(e,t,r){const a=yt(t),n=pt(t),s=r==="fixed",i=Ut(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=lt(0);function d(){c.x=Oa(n)}if(a||!a&&!s)if((pr(t)!=="body"||_r(n))&&(l=Ra(t)),a){const x=Ut(t,!0,s,t);c.x=x.x+t.clientLeft,c.y=x.y+t.clientTop}else n&&d();s&&!a&&n&&d();const u=n&&!a&&!s?Ac(n,l):lt(0),p=i.left+l.scrollLeft-c.x-u.x,m=i.top+l.scrollTop-c.y-u.y;return{x:p,y:m,width:i.width,height:i.height}}function mo(e){return ot(e).position==="static"}function oi(e,t){if(!yt(e)||ot(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return pt(e)===r&&(r=r.ownerDocument.body),r}function Lc(e,t){const r=Ue(e);if($a(e))return r;if(!yt(e)){let n=Pt(e);for(;n&&!sr(n);){if(at(n)&&!mo(n))return n;n=Pt(n)}return r}let a=oi(e,t);for(;a&&_v(a)&&mo(a);)a=oi(a,t);return a&&sr(a)&&mo(a)&&!_n(a)?r:a||Tv(e)||r}const Bv=async function(e){const t=this.getOffsetParent||Lc,r=this.getDimensions,a=await r(e.floating);return{reference:Vv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function Uv(e){return ot(e).direction==="rtl"}const Hv={convertOffsetParentRelativeRectToViewportRelativeRect:Ov,getDocumentElement:pt,getClippingRect:Mv,getOffsetParent:Lc,getElementRects:Bv,getClientRects:Dv,getDimensions:Fv,getScale:rr,isElement:at,isRTL:Uv};function zc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Wv(e,t){let r=null,a;const n=pt(e);function s(){var l;clearTimeout(a),(l=r)==null||l.disconnect(),r=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:u,top:p,width:m,height:x}=d;if(l||t(),!m||!x)return;const g=Wr(p),f=Wr(n.clientWidth-(u+m)),v=Wr(n.clientHeight-(p+x)),b=Wr(u),j={rootMargin:-g+"px "+-f+"px "+-v+"px "+-b+"px",threshold:Ve(0,Et(1,c))||1};let y=!0;function N(C){const k=C[0].intersectionRatio;if(k!==c){if(!y)return i();k?i(!1,k):a=setTimeout(()=>{i(!1,1e-7)},1e3)}k===1&&!zc(d,e.getBoundingClientRect())&&i(),y=!1}try{r=new IntersectionObserver(N,{...j,root:n.ownerDocument})}catch{r=new IntersectionObserver(N,j)}r.observe(e)}return i(!0),s}function qv(e,t,r,a){a===void 0&&(a={});const{ancestorScroll:n=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=a,d=Pn(e),u=n||s?[...d?jr(d):[],...t?jr(t):[]]:[];u.forEach(b=>{n&&b.addEventListener("scroll",r,{passive:!0}),s&&b.addEventListener("resize",r)});const p=d&&l?Wv(d,r):null;let m=-1,x=null;i&&(x=new ResizeObserver(b=>{let[j]=b;j&&j.target===d&&x&&t&&(x.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=x)==null||y.observe(t)})),r()}),d&&!c&&x.observe(d),t&&x.observe(t));let g,f=c?Ut(e):null;c&&v();function v(){const b=Ut(e);f&&!zc(f,b)&&r(),f=b,g=requestAnimationFrame(v)}return r(),()=>{var b;u.forEach(j=>{n&&j.removeEventListener("scroll",r),s&&j.removeEventListener("resize",r)}),p==null||p(),(b=x)==null||b.disconnect(),x=null,c&&cancelAnimationFrame(g)}}const Zv=Nv,Xv=Cv,Gv=yv,Yv=kv,Kv=wv,ni=bv,Jv=Sv,Qv=(e,t,r)=>{const a=new Map,n={platform:Hv,...r},s={...n.platform,_c:a};return vv(e,t,{...n,platform:s})};var eb=typeof document<"u",tb=function(){},Gr=eb?E.useLayoutEffect:tb;function na(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,a,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(a=r;a--!==0;)if(!na(e[a],t[a]))return!1;return!0}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(t,n[a]))return!1;for(a=r;a--!==0;){const s=n[a];if(!(s==="_owner"&&e.$$typeof)&&!na(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Mc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function si(e,t){const r=Mc(e);return Math.round(t*r)/r}function fo(e){const t=h.useRef(e);return Gr(()=>{t.current=e}),t}function rb(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:n,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,p]=h.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,x]=h.useState(a);na(m,a)||x(a);const[g,f]=h.useState(null),[v,b]=h.useState(null),j=h.useCallback(D=>{D!==k.current&&(k.current=D,f(D))},[]),y=h.useCallback(D=>{D!==_.current&&(_.current=D,b(D))},[]),N=s||g,C=i||v,k=h.useRef(null),_=h.useRef(null),w=h.useRef(u),R=c!=null,A=fo(c),I=fo(n),F=fo(d),V=h.useCallback(()=>{if(!k.current||!_.current)return;const D={placement:t,strategy:r,middleware:m};I.current&&(D.platform=I.current),Qv(k.current,_.current,D).then(z=>{const L={...z,isPositioned:F.current!==!1};M.current&&!na(w.current,L)&&(w.current=L,da.flushSync(()=>{p(L)}))})},[m,t,r,I,F]);Gr(()=>{d===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,p(D=>({...D,isPositioned:!1})))},[d]);const M=h.useRef(!1);Gr(()=>(M.current=!0,()=>{M.current=!1}),[]),Gr(()=>{if(N&&(k.current=N),C&&(_.current=C),N&&C){if(A.current)return A.current(N,C,V);V()}},[N,C,V,A,R]);const U=h.useMemo(()=>({reference:k,floating:_,setReference:j,setFloating:y}),[j,y]),$=h.useMemo(()=>({reference:N,floating:C}),[N,C]),T=h.useMemo(()=>{const D={position:r,left:0,top:0};if(!$.floating)return D;const z=si($.floating,u.x),L=si($.floating,u.y);return l?{...D,transform:"translate("+z+"px, "+L+"px)",...Mc($.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:z,top:L}},[r,l,$.floating,u.x,u.y]);return h.useMemo(()=>({...u,update:V,refs:U,elements:$,floatingStyles:T}),[u,V,U,$,T])}const ab=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:a,padding:n}=typeof e=="function"?e(r):e;return a&&t(a)?a.current!=null?ni({element:a.current,padding:n}).fn(r):{}:a?ni({element:a,padding:n}).fn(r):{}}}},ob=(e,t)=>{const r=Zv(e);return{name:r.name,fn:r.fn,options:[e,t]}},nb=(e,t)=>{const r=Xv(e);return{name:r.name,fn:r.fn,options:[e,t]}},sb=(e,t)=>({fn:Jv(e).fn,options:[e,t]}),ib=(e,t)=>{const r=Gv(e);return{name:r.name,fn:r.fn,options:[e,t]}},lb=(e,t)=>{const r=Yv(e);return{name:r.name,fn:r.fn,options:[e,t]}},cb=(e,t)=>{const r=Kv(e);return{name:r.name,fn:r.fn,options:[e,t]}},db=(e,t)=>{const r=ab(e);return{name:r.name,fn:r.fn,options:[e,t]}};var ub="Arrow",Fc=h.forwardRef((e,t)=>{const{children:r,width:a=10,height:n=5,...s}=e;return o.jsx(le.svg,{...s,ref:t,width:a,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});Fc.displayName=ub;var pb=Fc,Tn="Popper",[Vc,mr]=bt(Tn),[mb,Bc]=Vc(Tn),Uc=e=>{const{__scopePopper:t,children:r}=e,[a,n]=h.useState(null);return o.jsx(mb,{scope:t,anchor:a,onAnchorChange:n,children:r})};Uc.displayName=Tn;var Hc="PopperAnchor",Wc=h.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:a,...n}=e,s=Bc(Hc,r),i=h.useRef(null),l=pe(t,i),c=h.useRef(null);return h.useEffect(()=>{const d=c.current;c.current=(a==null?void 0:a.current)||i.current,d!==c.current&&s.onAnchorChange(c.current)}),a?null:o.jsx(le.div,{...n,ref:l})});Wc.displayName=Hc;var $n="PopperContent",[fb,hb]=Vc($n),qc=h.forwardRef((e,t)=>{var r,a,n,s,i,l;const{__scopePopper:c,side:d="bottom",sideOffset:u=0,align:p="center",alignOffset:m=0,arrowPadding:x=0,avoidCollisions:g=!0,collisionBoundary:f=[],collisionPadding:v=0,sticky:b="partial",hideWhenDetached:j=!1,updatePositionStrategy:y="optimized",onPlaced:N,...C}=e,k=Bc($n,c),[_,w]=h.useState(null),R=pe(t,we=>w(we)),[A,I]=h.useState(null),F=un(A),V=(F==null?void 0:F.width)??0,M=(F==null?void 0:F.height)??0,U=d+(p!=="center"?"-"+p:""),$=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},T=Array.isArray(f)?f:[f],D=T.length>0,z={padding:$,boundary:T.filter(gb),altBoundary:D},{refs:L,floatingStyles:ee,placement:Y,isPositioned:J,middlewareData:q}=rb({strategy:"fixed",placement:U,whileElementsMounted:(...we)=>qv(...we,{animationFrame:y==="always"}),elements:{reference:k.anchor},middleware:[ob({mainAxis:u+M,alignmentAxis:m}),g&&nb({mainAxis:!0,crossAxis:!1,limiter:b==="partial"?sb():void 0,...z}),g&&ib({...z}),lb({...z,apply:({elements:we,rects:je,availableWidth:Me,availableHeight:Ae})=>{const{width:$r,height:Rr}=je.reference,mt=we.floating.style;mt.setProperty("--radix-popper-available-width",`${Me}px`),mt.setProperty("--radix-popper-available-height",`${Ae}px`),mt.setProperty("--radix-popper-anchor-width",`${$r}px`),mt.setProperty("--radix-popper-anchor-height",`${Rr}px`)}}),A&&db({element:A,padding:x}),vb({arrowWidth:V,arrowHeight:M}),j&&cb({strategy:"referenceHidden",...z})]}),[se,me]=Gc(Y),H=Le(N);Ee(()=>{J&&(H==null||H())},[J,H]);const ie=(r=q.arrow)==null?void 0:r.x,te=(a=q.arrow)==null?void 0:a.y,re=((n=q.arrow)==null?void 0:n.centerOffset)!==0,[Q,fe]=h.useState();return Ee(()=>{_&&fe(window.getComputedStyle(_).zIndex)},[_]),o.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:J?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(s=q.transformOrigin)==null?void 0:s.x,(i=q.transformOrigin)==null?void 0:i.y].join(" "),...((l=q.hide)==null?void 0:l.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(fb,{scope:c,placedSide:se,onArrowChange:I,arrowX:ie,arrowY:te,shouldHideArrow:re,children:o.jsx(le.div,{"data-side":se,"data-align":me,...C,ref:R,style:{...C.style,animation:J?void 0:"none"}})})})});qc.displayName=$n;var Zc="PopperArrow",xb={top:"bottom",right:"left",bottom:"top",left:"right"},Xc=h.forwardRef(function(e,t){const{__scopePopper:r,...a}=e,n=hb(Zc,r),s=xb[n.placedSide];return o.jsx("span",{ref:n.onArrowChange,style:{position:"absolute",left:n.arrowX,top:n.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[n.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[n.placedSide],visibility:n.shouldHideArrow?"hidden":void 0},children:o.jsx(pb,{...a,ref:t,style:{...a.style,display:"block"}})})});Xc.displayName=Zc;function gb(e){return e!==null}var vb=e=>({name:"transformOrigin",options:e,fn(t){var r,a,n;const{placement:s,rects:i,middlewareData:l}=t,c=((r=l.arrow)==null?void 0:r.centerOffset)!==0,d=c?0:e.arrowWidth,u=c?0:e.arrowHeight,[p,m]=Gc(s),x={start:"0%",center:"50%",end:"100%"}[m],g=(((a=l.arrow)==null?void 0:a.x)??0)+d/2,f=(((n=l.arrow)==null?void 0:n.y)??0)+u/2;let v="",b="";return p==="bottom"?(v=c?x:`${g}px`,b=`${-u}px`):p==="top"?(v=c?x:`${g}px`,b=`${i.floating.height+u}px`):p==="right"?(v=`${-u}px`,b=c?x:`${f}px`):p==="left"&&(v=`${i.floating.width+u}px`,b=c?x:`${f}px`),{data:{x:v,y:b}}}});function Gc(e){const[t,r="center"]=e.split("-");return[t,r]}var Rn=Uc,Da=Wc,On=qc,Dn=Xc,Aa="Popover",[Yc]=bt(Aa,[mr]),Er=mr(),[bb,Rt]=Yc(Aa),Kc=e=>{const{__scopePopover:t,children:r,open:a,defaultOpen:n,onOpenChange:s,modal:i=!1}=e,l=Er(t),c=h.useRef(null),[d,u]=h.useState(!1),[p,m]=Vt({prop:a,defaultProp:n??!1,onChange:s,caller:Aa});return o.jsx(Rn,{...l,children:o.jsx(bb,{scope:t,contentId:_t(),triggerRef:c,open:p,onOpenChange:m,onOpenToggle:h.useCallback(()=>m(x=>!x),[m]),hasCustomAnchor:d,onCustomAnchorAdd:h.useCallback(()=>u(!0),[]),onCustomAnchorRemove:h.useCallback(()=>u(!1),[]),modal:i,children:r})})};Kc.displayName=Aa;var Jc="PopoverAnchor",yb=h.forwardRef((e,t)=>{const{__scopePopover:r,...a}=e,n=Rt(Jc,r),s=Er(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=n;return h.useEffect(()=>(i(),()=>l()),[i,l]),o.jsx(Da,{...s,...a,ref:t})});yb.displayName=Jc;var Qc="PopoverTrigger",ed=h.forwardRef((e,t)=>{const{__scopePopover:r,...a}=e,n=Rt(Qc,r),s=Er(r),i=pe(t,n.triggerRef),l=o.jsx(le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":nd(n.open),...a,ref:i,onClick:oe(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?l:o.jsx(Da,{asChild:!0,...s,children:l})});ed.displayName=Qc;var An="PopoverPortal",[wb,jb]=Yc(An,{forceMount:void 0}),td=e=>{const{__scopePopover:t,forceMount:r,children:a,container:n}=e,s=Rt(An,t);return o.jsx(wb,{scope:t,forceMount:r,children:o.jsx(Qe,{present:r||s.open,children:o.jsx(ka,{asChild:!0,container:n,children:a})})})};td.displayName=An;var ir="PopoverContent",rd=h.forwardRef((e,t)=>{const r=jb(ir,e.__scopePopover),{forceMount:a=r.forceMount,...n}=e,s=Rt(ir,e.__scopePopover);return o.jsx(Qe,{present:a||s.open,children:s.modal?o.jsx(Cb,{...n,ref:t}):o.jsx(Sb,{...n,ref:t})})});rd.displayName=ir;var Nb=or("PopoverContent.RemoveScroll"),Cb=h.forwardRef((e,t)=>{const r=Rt(ir,e.__scopePopover),a=h.useRef(null),n=pe(t,a),s=h.useRef(!1);return h.useEffect(()=>{const i=a.current;if(i)return yn(i)},[]),o.jsx(Ea,{as:Nb,allowPinchZoom:!0,children:o.jsx(ad,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:oe(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),s.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:oe(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:oe(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Sb=h.forwardRef((e,t)=>{const r=Rt(ir,e.__scopePopover),a=h.useRef(!1),n=h.useRef(!1);return o.jsx(ad,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(a.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),a.current=!1,n.current=!1},onInteractOutside:s=>{var i,l;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(a.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const c=s.target;(l=r.triggerRef.current)!=null&&l.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),ad=h.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:a,onOpenAutoFocus:n,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...p}=e,m=Rt(ir,r),x=Er(r);return bn(),o.jsx(Sa,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:n,onUnmountAutoFocus:s,children:o.jsx(kr,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:o.jsx(On,{"data-state":nd(m.open),role:"dialog",id:m.contentId,...x,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),od="PopoverClose",kb=h.forwardRef((e,t)=>{const{__scopePopover:r,...a}=e,n=Rt(od,r);return o.jsx(le.button,{type:"button",...a,ref:t,onClick:oe(e.onClick,()=>n.onOpenChange(!1))})});kb.displayName=od;var _b="PopoverArrow",Eb=h.forwardRef((e,t)=>{const{__scopePopover:r,...a}=e,n=Er(r);return o.jsx(Dn,{...n,...a,ref:t})});Eb.displayName=_b;function nd(e){return e?"open":"closed"}var Pb=Kc,Tb=ed,$b=td,sd=rd;const Ia=Pb,La=Tb,Pr=h.forwardRef(({className:e,align:t="center",sideOffset:r=4,...a},n)=>o.jsx($b,{children:o.jsx(sd,{ref:n,align:t,sideOffset:r,className:G("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...a})}));Pr.displayName=sd.displayName;const ht=({onInsert:e})=>{const[t,r]=E.useState(null),a=async n=>{const s=`{{${n}}}`;try{await navigator.clipboard.writeText(s)}catch{const i=document.createElement("textarea");i.value=s,i.style.position="fixed",i.style.opacity="0",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}e&&e(s),r(n),setTimeout(()=>r(null),1500)};return o.jsxs(Ia,{children:[o.jsx(La,{asChild:!0,children:o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-primary",title:"Inserir variável do evento",children:o.jsx(P.Braces,{className:"h-3.5 w-3.5"})})}),o.jsxs(Pr,{className:"w-80 p-0",align:"end",side:"left",sideOffset:6,children:[o.jsxs("div",{className:"px-3 py-2 border-b border-border",children:[o.jsx("p",{className:"text-xs font-semibold text-foreground",children:"Variáveis do evento"}),o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Clique para copiar. Use"," ",o.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"{{evento.xxx}}"})," ","em labels, placeholders e hints."]})]}),o.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:on.map(n=>{const s=t===n.key;return o.jsxs("button",{type:"button",onClick:()=>a(n.key),className:G("w-full flex items-center justify-between px-3 py-1.5 text-left hover:bg-accent transition-colors",s&&"bg-primary/10"),children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs font-medium truncate",children:n.label}),o.jsx("code",{className:"text-[10px] text-muted-foreground font-mono",children:`{{${n.key}}}`})]}),o.jsx("div",{className:"ml-2 shrink-0",children:s?o.jsx(P.Check,{className:"h-3.5 w-3.5 text-primary"}):o.jsx(P.Braces,{className:"h-3 w-3 text-muted-foreground/50"})})]},n.key)})})]})]})},Rb=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Label"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Descrição"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do step"})]}),o.jsx(Ec,{value:e.icone,onChange:r=>t({icone:r})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"step-show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(W,{htmlFor:"step-show-label",className:"text-xs cursor-pointer",children:"Exibir título no formulário"})]})]});function id(e){const t=e+"CollectionProvider",[r,a]=bt(t),[n,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=f=>{const{scope:v,children:b}=f,j=E.useRef(null),y=E.useRef(new Map).current;return o.jsx(n,{scope:v,itemMap:y,collectionRef:j,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=or(l),d=E.forwardRef((f,v)=>{const{scope:b,children:j}=f,y=s(l,b),N=pe(v,y.collectionRef);return o.jsx(c,{ref:N,children:j})});d.displayName=l;const u=e+"CollectionItemSlot",p="data-radix-collection-item",m=or(u),x=E.forwardRef((f,v)=>{const{scope:b,children:j,...y}=f,N=E.useRef(null),C=pe(v,N),k=s(u,b);return E.useEffect(()=>(k.itemMap.set(N,{ref:N,...y}),()=>void k.itemMap.delete(N))),o.jsx(m,{[p]:"",ref:C,children:j})});x.displayName=u;function g(f){const v=s(e+"CollectionConsumer",f);return E.useCallback(()=>{const b=v.collectionRef.current;if(!b)return[];const j=Array.from(b.querySelectorAll(`[${p}]`));return Array.from(v.itemMap.values()).sort((y,N)=>j.indexOf(y.ref.current)-j.indexOf(N.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:d,ItemSlot:x},g,a]}var ld=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"}),Ob="VisuallyHidden",cd=h.forwardRef((e,t)=>o.jsx(le.span,{...e,ref:t,style:{...ld,...e.style}}));cd.displayName=Ob;var Db=cd,Ab=[" ","Enter","ArrowUp","ArrowDown"],Ib=[" ","Enter"],Ht="Select",[za,Ma,Lb]=id(Ht),[fr]=bt(Ht,[Lb,mr]),Fa=mr(),[zb,Ot]=fr(Ht),[Mb,Fb]=fr(Ht),dd=e=>{const{__scopeSelect:t,children:r,open:a,defaultOpen:n,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:d,name:u,autoComplete:p,disabled:m,required:x,form:g}=e,f=Fa(t),[v,b]=h.useState(null),[j,y]=h.useState(null),[N,C]=h.useState(!1),k=fn(d),[_,w]=Vt({prop:a,defaultProp:n??!1,onChange:s,caller:Ht}),[R,A]=Vt({prop:i,defaultProp:l,onChange:c,caller:Ht}),I=h.useRef(null),F=v?g||!!v.closest("form"):!0,[V,M]=h.useState(new Set),U=Array.from(V).map($=>$.props.value).join(";");return o.jsx(Rn,{...f,children:o.jsxs(zb,{required:x,scope:t,trigger:v,onTriggerChange:b,valueNode:j,onValueNodeChange:y,valueNodeHasChildren:N,onValueNodeHasChildrenChange:C,contentId:_t(),value:R,onValueChange:A,open:_,onOpenChange:w,dir:k,triggerPointerDownPosRef:I,disabled:m,children:[o.jsx(za.Provider,{scope:t,children:o.jsx(Mb,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback($=>{M(T=>new Set(T).add($))},[]),onNativeOptionRemove:h.useCallback($=>{M(T=>{const D=new Set(T);return D.delete($),D})},[]),children:r})}),F?o.jsxs(Dd,{"aria-hidden":!0,required:x,tabIndex:-1,name:u,autoComplete:p,value:R,onChange:$=>A($.target.value),disabled:m,form:g,children:[R===void 0?o.jsx("option",{value:""}):null,Array.from(V)]},U):null]})})};dd.displayName=Ht;var ud="SelectTrigger",pd=h.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:a=!1,...n}=e,s=Fa(r),i=Ot(ud,r),l=i.disabled||a,c=pe(t,i.onTriggerChange),d=Ma(r),u=h.useRef("touch"),[p,m,x]=Id(f=>{const v=d().filter(y=>!y.disabled),b=v.find(y=>y.value===i.value),j=Ld(v,f,b);j!==void 0&&i.onValueChange(j.value)}),g=f=>{l||(i.onOpenChange(!0),x()),f&&(i.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return o.jsx(Da,{asChild:!0,...s,children:o.jsx(le.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Ad(i.value)?"":void 0,...n,ref:c,onClick:oe(n.onClick,f=>{f.currentTarget.focus(),u.current!=="mouse"&&g(f)}),onPointerDown:oe(n.onPointerDown,f=>{u.current=f.pointerType;const v=f.target;v.hasPointerCapture(f.pointerId)&&v.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(g(f),f.preventDefault())}),onKeyDown:oe(n.onKeyDown,f=>{const v=p.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&m(f.key),!(v&&f.key===" ")&&Ab.includes(f.key)&&(g(),f.preventDefault())})})})});pd.displayName=ud;var md="SelectValue",fd=h.forwardRef((e,t)=>{const{__scopeSelect:r,className:a,style:n,children:s,placeholder:i="",...l}=e,c=Ot(md,r),{onValueNodeHasChildrenChange:d}=c,u=s!==void 0,p=pe(t,c.onValueNodeChange);return Ee(()=>{d(u)},[d,u]),o.jsx(le.span,{...l,ref:p,style:{pointerEvents:"none"},children:Ad(c.value)?o.jsx(o.Fragment,{children:i}):s})});fd.displayName=md;var Vb="SelectIcon",hd=h.forwardRef((e,t)=>{const{__scopeSelect:r,children:a,...n}=e;return o.jsx(le.span,{"aria-hidden":!0,...n,ref:t,children:a||"▼"})});hd.displayName=Vb;var Bb="SelectPortal",xd=e=>o.jsx(ka,{asChild:!0,...e});xd.displayName=Bb;var Wt="SelectContent",gd=h.forwardRef((e,t)=>{const r=Ot(Wt,e.__scopeSelect),[a,n]=h.useState();if(Ee(()=>{n(new DocumentFragment)},[]),!r.open){const s=a;return s?da.createPortal(o.jsx(vd,{scope:e.__scopeSelect,children:o.jsx(za.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),s):null}return o.jsx(bd,{...e,ref:t})});gd.displayName=Wt;var tt=10,[vd,Dt]=fr(Wt),Ub="SelectContentImpl",Hb=or("SelectContent.RemoveScroll"),bd=h.forwardRef((e,t)=>{const{__scopeSelect:r,position:a="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:p,collisionBoundary:m,collisionPadding:x,sticky:g,hideWhenDetached:f,avoidCollisions:v,...b}=e,j=Ot(Wt,r),[y,N]=h.useState(null),[C,k]=h.useState(null),_=pe(t,H=>N(H)),[w,R]=h.useState(null),[A,I]=h.useState(null),F=Ma(r),[V,M]=h.useState(!1),U=h.useRef(!1);h.useEffect(()=>{if(y)return yn(y)},[y]),bn();const $=h.useCallback(H=>{const[ie,...te]=F().map(fe=>fe.ref.current),[re]=te.slice(-1),Q=document.activeElement;for(const fe of H)if(fe===Q||(fe==null||fe.scrollIntoView({block:"nearest"}),fe===ie&&C&&(C.scrollTop=0),fe===re&&C&&(C.scrollTop=C.scrollHeight),fe==null||fe.focus(),document.activeElement!==Q))return},[F,C]),T=h.useCallback(()=>$([w,y]),[$,w,y]);h.useEffect(()=>{V&&T()},[V,T]);const{onOpenChange:D,triggerPointerDownPosRef:z}=j;h.useEffect(()=>{if(y){let H={x:0,y:0};const ie=re=>{var Q,fe;H={x:Math.abs(Math.round(re.pageX)-(((Q=z.current)==null?void 0:Q.x)??0)),y:Math.abs(Math.round(re.pageY)-(((fe=z.current)==null?void 0:fe.y)??0))}},te=re=>{H.x<=10&&H.y<=10?re.preventDefault():y.contains(re.target)||D(!1),document.removeEventListener("pointermove",ie),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",te,{capture:!0})}}},[y,D,z]),h.useEffect(()=>{const H=()=>D(!1);return window.addEventListener("blur",H),window.addEventListener("resize",H),()=>{window.removeEventListener("blur",H),window.removeEventListener("resize",H)}},[D]);const[L,ee]=Id(H=>{const ie=F().filter(Q=>!Q.disabled),te=ie.find(Q=>Q.ref.current===document.activeElement),re=Ld(ie,H,te);re&&setTimeout(()=>re.ref.current.focus())}),Y=h.useCallback((H,ie,te)=>{const re=!U.current&&!te;(j.value!==void 0&&j.value===ie||re)&&(R(H),re&&(U.current=!0))},[j.value]),J=h.useCallback(()=>y==null?void 0:y.focus(),[y]),q=h.useCallback((H,ie,te)=>{const re=!U.current&&!te;(j.value!==void 0&&j.value===ie||re)&&I(H)},[j.value]),se=a==="popper"?Eo:yd,me=se===Eo?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:p,collisionBoundary:m,collisionPadding:x,sticky:g,hideWhenDetached:f,avoidCollisions:v}:{};return o.jsx(vd,{scope:r,content:y,viewport:C,onViewportChange:k,itemRefCallback:Y,selectedItem:w,onItemLeave:J,itemTextRefCallback:q,focusSelectedItem:T,selectedItemText:A,position:a,isPositioned:V,searchRef:L,children:o.jsx(Ea,{as:Hb,allowPinchZoom:!0,children:o.jsx(Sa,{asChild:!0,trapped:j.open,onMountAutoFocus:H=>{H.preventDefault()},onUnmountAutoFocus:oe(n,H=>{var ie;(ie=j.trigger)==null||ie.focus({preventScroll:!0}),H.preventDefault()}),children:o.jsx(kr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:H=>H.preventDefault(),onDismiss:()=>j.onOpenChange(!1),children:o.jsx(se,{role:"listbox",id:j.contentId,"data-state":j.open?"open":"closed",dir:j.dir,onContextMenu:H=>H.preventDefault(),...b,...me,onPlaced:()=>M(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:oe(b.onKeyDown,H=>{const ie=H.ctrlKey||H.altKey||H.metaKey;if(H.key==="Tab"&&H.preventDefault(),!ie&&H.key.length===1&&ee(H.key),["ArrowUp","ArrowDown","Home","End"].includes(H.key)){let te=F().filter(re=>!re.disabled).map(re=>re.ref.current);if(["ArrowUp","End"].includes(H.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(H.key)){const re=H.target,Q=te.indexOf(re);te=te.slice(Q+1)}setTimeout(()=>$(te)),H.preventDefault()}})})})})})})});bd.displayName=Ub;var Wb="SelectItemAlignedPosition",yd=h.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:a,...n}=e,s=Ot(Wt,r),i=Dt(Wt,r),[l,c]=h.useState(null),[d,u]=h.useState(null),p=pe(t,_=>u(_)),m=Ma(r),x=h.useRef(!1),g=h.useRef(!0),{viewport:f,selectedItem:v,selectedItemText:b,focusSelectedItem:j}=i,y=h.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&f&&v&&b){const _=s.trigger.getBoundingClientRect(),w=d.getBoundingClientRect(),R=s.valueNode.getBoundingClientRect(),A=b.getBoundingClientRect();if(s.dir!=="rtl"){const re=A.left-w.left,Q=R.left-re,fe=_.left-Q,we=_.width+fe,je=Math.max(we,w.width),Me=window.innerWidth-tt,Ae=wr(Q,[tt,Math.max(tt,Me-je)]);l.style.minWidth=we+"px",l.style.left=Ae+"px"}else{const re=w.right-A.right,Q=window.innerWidth-R.right-re,fe=window.innerWidth-_.right-Q,we=_.width+fe,je=Math.max(we,w.width),Me=window.innerWidth-tt,Ae=wr(Q,[tt,Math.max(tt,Me-je)]);l.style.minWidth=we+"px",l.style.right=Ae+"px"}const I=m(),F=window.innerHeight-tt*2,V=f.scrollHeight,M=window.getComputedStyle(d),U=parseInt(M.borderTopWidth,10),$=parseInt(M.paddingTop,10),T=parseInt(M.borderBottomWidth,10),D=parseInt(M.paddingBottom,10),z=U+$+V+D+T,L=Math.min(v.offsetHeight*5,z),ee=window.getComputedStyle(f),Y=parseInt(ee.paddingTop,10),J=parseInt(ee.paddingBottom,10),q=_.top+_.height/2-tt,se=F-q,me=v.offsetHeight/2,H=v.offsetTop+me,ie=U+$+H,te=z-ie;if(ie<=q){const re=I.length>0&&v===I[I.length-1].ref.current;l.style.bottom="0px";const Q=d.clientHeight-f.offsetTop-f.offsetHeight,fe=Math.max(se,me+(re?J:0)+Q+T),we=ie+fe;l.style.height=we+"px"}else{const re=I.length>0&&v===I[0].ref.current;l.style.top="0px";const Q=Math.max(q,U+f.offsetTop+(re?Y:0)+me)+te;l.style.height=Q+"px",f.scrollTop=ie-q+f.offsetTop}l.style.margin=`${tt}px 0`,l.style.minHeight=L+"px",l.style.maxHeight=F+"px",a==null||a(),requestAnimationFrame(()=>x.current=!0)}},[m,s.trigger,s.valueNode,l,d,f,v,b,s.dir,a]);Ee(()=>y(),[y]);const[N,C]=h.useState();Ee(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const k=h.useCallback(_=>{_&&g.current===!0&&(y(),j==null||j(),g.current=!1)},[y,j]);return o.jsx(Zb,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:x,onScrollButtonChange:k,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:o.jsx(le.div,{...n,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});yd.displayName=Wb;var qb="SelectPopperPosition",Eo=h.forwardRef((e,t)=>{const{__scopeSelect:r,align:a="start",collisionPadding:n=tt,...s}=e,i=Fa(r);return o.jsx(On,{...i,...s,ref:t,align:a,collisionPadding:n,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)"}})});Eo.displayName=qb;var[Zb,In]=fr(Wt,{}),Po="SelectViewport",wd=h.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:a,...n}=e,s=Dt(Po,r),i=In(Po,r),l=pe(t,s.onViewportChange),c=h.useRef(0);return o.jsxs(o.Fragment,{children:[o.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:a}),o.jsx(za.Slot,{scope:r,children:o.jsx(le.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:oe(n.onScroll,d=>{const u=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&p){const x=Math.abs(c.current-u.scrollTop);if(x>0){const g=window.innerHeight-tt*2,f=parseFloat(p.style.minHeight),v=parseFloat(p.style.height),b=Math.max(f,v);if(b<g){const j=b+x,y=Math.min(g,j),N=j-y;p.style.height=y+"px",p.style.bottom==="0px"&&(u.scrollTop=N>0?N:0,p.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});wd.displayName=Po;var jd="SelectGroup",[Xb,Gb]=fr(jd),Yb=h.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e,n=_t();return o.jsx(Xb,{scope:r,id:n,children:o.jsx(le.div,{role:"group","aria-labelledby":n,...a,ref:t})})});Yb.displayName=jd;var Nd="SelectLabel",Cd=h.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e,n=Gb(Nd,r);return o.jsx(le.div,{id:n.id,...a,ref:t})});Cd.displayName=Nd;var sa="SelectItem",[Kb,Sd]=fr(sa),kd=h.forwardRef((e,t)=>{const{__scopeSelect:r,value:a,disabled:n=!1,textValue:s,...i}=e,l=Ot(sa,r),c=Dt(sa,r),d=l.value===a,[u,p]=h.useState(s??""),[m,x]=h.useState(!1),g=pe(t,j=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,j,a,n)}),f=_t(),v=h.useRef("touch"),b=()=>{n||(l.onValueChange(a),l.onOpenChange(!1))};if(a==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(Kb,{scope:r,value:a,disabled:n,textId:f,isSelected:d,onItemTextChange:h.useCallback(j=>{p(y=>y||((j==null?void 0:j.textContent)??"").trim())},[]),children:o.jsx(za.ItemSlot,{scope:r,value:a,disabled:n,textValue:u,children:o.jsx(le.div,{role:"option","aria-labelledby":f,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...i,ref:g,onFocus:oe(i.onFocus,()=>x(!0)),onBlur:oe(i.onBlur,()=>x(!1)),onClick:oe(i.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:oe(i.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:oe(i.onPointerDown,j=>{v.current=j.pointerType}),onPointerMove:oe(i.onPointerMove,j=>{var y;v.current=j.pointerType,n?(y=c.onItemLeave)==null||y.call(c):v.current==="mouse"&&j.currentTarget.focus({preventScroll:!0})}),onPointerLeave:oe(i.onPointerLeave,j=>{var y;j.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:oe(i.onKeyDown,j=>{var y;((y=c.searchRef)==null?void 0:y.current)!==""&&j.key===" "||(Ib.includes(j.key)&&b(),j.key===" "&&j.preventDefault())})})})})});kd.displayName=sa;var br="SelectItemText",_d=h.forwardRef((e,t)=>{const{__scopeSelect:r,className:a,style:n,...s}=e,i=Ot(br,r),l=Dt(br,r),c=Sd(br,r),d=Fb(br,r),[u,p]=h.useState(null),m=pe(t,b=>p(b),c.onItemTextChange,b=>{var j;return(j=l.itemTextRefCallback)==null?void 0:j.call(l,b,c.value,c.disabled)}),x=u==null?void 0:u.textContent,g=h.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:x},c.value),[c.disabled,c.value,x]),{onNativeOptionAdd:f,onNativeOptionRemove:v}=d;return Ee(()=>(f(g),()=>v(g)),[f,v,g]),o.jsxs(o.Fragment,{children:[o.jsx(le.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?da.createPortal(s.children,i.valueNode):null]})});_d.displayName=br;var Ed="SelectItemIndicator",Pd=h.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e;return Sd(Ed,r).isSelected?o.jsx(le.span,{"aria-hidden":!0,...a,ref:t}):null});Pd.displayName=Ed;var To="SelectScrollUpButton",Td=h.forwardRef((e,t)=>{const r=Dt(To,e.__scopeSelect),a=In(To,e.__scopeSelect),[n,s]=h.useState(!1),i=pe(t,a.onScrollButtonChange);return Ee(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),n?o.jsx(Rd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Td.displayName=To;var $o="SelectScrollDownButton",$d=h.forwardRef((e,t)=>{const r=Dt($o,e.__scopeSelect),a=In($o,e.__scopeSelect),[n,s]=h.useState(!1),i=pe(t,a.onScrollButtonChange);return Ee(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;s(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),n?o.jsx(Rd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});$d.displayName=$o;var Rd=h.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:a,...n}=e,s=Dt("SelectScrollButton",r),i=h.useRef(null),l=Ma(r),c=h.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return h.useEffect(()=>()=>c(),[c]),Ee(()=>{var d;const u=l().find(p=>p.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),o.jsx(le.div,{"aria-hidden":!0,...n,ref:t,style:{flexShrink:0,...n.style},onPointerDown:oe(n.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(a,50))}),onPointerMove:oe(n.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),i.current===null&&(i.current=window.setInterval(a,50))}),onPointerLeave:oe(n.onPointerLeave,()=>{c()})})}),Jb="SelectSeparator",Od=h.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e;return o.jsx(le.div,{"aria-hidden":!0,...a,ref:t})});Od.displayName=Jb;var Ro="SelectArrow",Qb=h.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e,n=Fa(r),s=Ot(Ro,r),i=Dt(Ro,r);return s.open&&i.position==="popper"?o.jsx(Dn,{...n,...a,ref:t}):null});Qb.displayName=Ro;var ey="SelectBubbleInput",Dd=h.forwardRef(({__scopeSelect:e,value:t,...r},a)=>{const n=h.useRef(null),s=pe(a,n),i=dn(t);return h.useEffect(()=>{const l=n.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(le.select,{...r,style:{...ld,...r.style},ref:s,defaultValue:t})});Dd.displayName=ey;function Ad(e){return e===""||e===void 0}function Id(e){const t=Le(e),r=h.useRef(""),a=h.useRef(0),n=h.useCallback(i=>{const l=r.current+i;t(l),function c(d){r.current=d,window.clearTimeout(a.current),d!==""&&(a.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),s=h.useCallback(()=>{r.current="",window.clearTimeout(a.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(a.current),[]),[r,n,s]}function Ld(e,t,r){const a=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,n=r?e.indexOf(r):-1;let s=ty(e,Math.max(n,0));a.length===1&&(s=s.filter(l=>l!==r));const i=s.find(l=>l.textValue.toLowerCase().startsWith(a.toLowerCase()));return i!==r?i:void 0}function ty(e,t){return e.map((r,a)=>e[(t+a)%e.length])}var ry=dd,zd=pd,ay=fd,oy=hd,ny=xd,Md=gd,sy=wd,Fd=Cd,Vd=kd,iy=_d,ly=Pd,Bd=Td,Ud=$d,Hd=Od;const Ge=ry,Ye=ay,He=h.forwardRef(({className:e,children:t,...r},a)=>o.jsxs(zd,{ref:a,className:G("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,o.jsx(oy,{asChild:!0,children:o.jsx(P.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));He.displayName=zd.displayName;const Wd=h.forwardRef(({className:e,...t},r)=>o.jsx(Bd,{ref:r,className:G("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(P.ChevronUp,{className:"h-4 w-4"})}));Wd.displayName=Bd.displayName;const qd=h.forwardRef(({className:e,...t},r)=>o.jsx(Ud,{ref:r,className:G("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(P.ChevronDown,{className:"h-4 w-4"})}));qd.displayName=Ud.displayName;const We=h.forwardRef(({className:e,children:t,position:r="popper",...a},n)=>o.jsx(ny,{children:o.jsxs(Md,{ref:n,className:G("relative z-50 max-h-96 min-w-[8rem] overflow-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",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,...a,children:[o.jsx(Wd,{}),o.jsx(sy,{className:G("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(qd,{})]})}));We.displayName=Md.displayName;const cy=h.forwardRef(({className:e,...t},r)=>o.jsx(Fd,{ref:r,className:G("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));cy.displayName=Fd.displayName;const Se=h.forwardRef(({className:e,children:t,...r},a)=>o.jsxs(Vd,{ref:a,className:G("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(ly,{children:o.jsx(P.Check,{className:"h-4 w-4"})})}),o.jsx(iy,{children:t})]}));Se.displayName=Vd.displayName;const dy=h.forwardRef(({className:e,...t},r)=>o.jsx(Hd,{ref:r,className:G("-mx-1 my-1 h-px bg-muted",e),...t}));dy.displayName=Hd.displayName;var Zd=["PageUp","PageDown"],Xd=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Gd={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},hr="Slider",[Oo,uy,py]=id(hr),[Yd]=bt(hr,[py]),[my,Va]=Yd(hr),Kd=h.forwardRef((e,t)=>{const{name:r,min:a=0,max:n=100,step:s=1,orientation:i="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[a],value:u,onValueChange:p=()=>{},onValueCommit:m=()=>{},inverted:x=!1,form:g,...f}=e,v=h.useRef(new Set),b=h.useRef(0),j=i==="horizontal"?fy:hy,[y=[],N]=Vt({prop:u,defaultProp:d,onChange:A=>{var I;(I=[...v.current][b.current])==null||I.focus(),p(A)}}),C=h.useRef(y);function k(A){const I=yy(y,A);R(A,I)}function _(A){R(A,b.current)}function w(){const A=C.current[b.current];y[b.current]!==A&&m(y)}function R(A,I,{commit:F}={commit:!1}){const V=Cy(s),M=Sy(Math.round((A-a)/s)*s+a,V),U=wr(M,[a,n]);N(($=[])=>{const T=vy($,U,I);if(Ny(T,c*s)){b.current=T.indexOf(U);const D=String(T)!==String($);return D&&F&&m(T),D?T:$}else return $})}return o.jsx(my,{scope:e.__scopeSlider,name:r,disabled:l,min:a,max:n,valueIndexToChangeRef:b,thumbs:v.current,values:y,orientation:i,form:g,children:o.jsx(Oo.Provider,{scope:e.__scopeSlider,children:o.jsx(Oo.Slot,{scope:e.__scopeSlider,children:o.jsx(j,{"aria-disabled":l,"data-disabled":l?"":void 0,...f,ref:t,onPointerDown:oe(f.onPointerDown,()=>{l||(C.current=y)}),min:a,max:n,inverted:x,onSlideStart:l?void 0:k,onSlideMove:l?void 0:_,onSlideEnd:l?void 0:w,onHomeKeyDown:()=>!l&&R(a,0,{commit:!0}),onEndKeyDown:()=>!l&&R(n,y.length-1,{commit:!0}),onStepKeyDown:({event:A,direction:I})=>{if(!l){const F=Zd.includes(A.key)||A.shiftKey&&Xd.includes(A.key)?10:1,V=b.current,M=y[V],U=s*F*I;R(M+U,V,{commit:!0})}}})})})})});Kd.displayName=hr;var[Jd,Qd]=Yd(hr,{startEdge:"left",endEdge:"right",size:"width",direction:1}),fy=h.forwardRef((e,t)=>{const{min:r,max:a,dir:n,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...u}=e,[p,m]=h.useState(null),x=pe(t,y=>m(y)),g=h.useRef(void 0),f=fn(n),v=f==="ltr",b=v&&!s||!v&&s;function j(y){const N=g.current||p.getBoundingClientRect(),C=[0,N.width],k=Ln(C,b?[r,a]:[a,r]);return g.current=N,k(y-N.left)}return o.jsx(Jd,{scope:e.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:o.jsx(eu,{dir:f,"data-orientation":"horizontal",...u,ref:x,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:y=>{const N=j(y.clientX);i==null||i(N)},onSlideMove:y=>{const N=j(y.clientX);l==null||l(N)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:y=>{const N=Gd[b?"from-left":"from-right"].includes(y.key);d==null||d({event:y,direction:N?-1:1})}})})}),hy=h.forwardRef((e,t)=>{const{min:r,max:a,inverted:n,onSlideStart:s,onSlideMove:i,onSlideEnd:l,onStepKeyDown:c,...d}=e,u=h.useRef(null),p=pe(t,u),m=h.useRef(void 0),x=!n;function g(f){const v=m.current||u.current.getBoundingClientRect(),b=[0,v.height],j=Ln(b,x?[a,r]:[r,a]);return m.current=v,j(f-v.top)}return o.jsx(Jd,{scope:e.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:o.jsx(eu,{"data-orientation":"vertical",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:f=>{const v=g(f.clientY);s==null||s(v)},onSlideMove:f=>{const v=g(f.clientY);i==null||i(v)},onSlideEnd:()=>{m.current=void 0,l==null||l()},onStepKeyDown:f=>{const v=Gd[x?"from-bottom":"from-top"].includes(f.key);c==null||c({event:f,direction:v?-1:1})}})})}),eu=h.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:a,onSlideMove:n,onSlideEnd:s,onHomeKeyDown:i,onEndKeyDown:l,onStepKeyDown:c,...d}=e,u=Va(hr,r);return o.jsx(le.span,{...d,ref:t,onKeyDown:oe(e.onKeyDown,p=>{p.key==="Home"?(i(p),p.preventDefault()):p.key==="End"?(l(p),p.preventDefault()):Zd.concat(Xd).includes(p.key)&&(c(p),p.preventDefault())}),onPointerDown:oe(e.onPointerDown,p=>{const m=p.target;m.setPointerCapture(p.pointerId),p.preventDefault(),u.thumbs.has(m)?m.focus():a(p)}),onPointerMove:oe(e.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&n(p)}),onPointerUp:oe(e.onPointerUp,p=>{const m=p.target;m.hasPointerCapture(p.pointerId)&&(m.releasePointerCapture(p.pointerId),s(p))})})}),tu="SliderTrack",ru=h.forwardRef((e,t)=>{const{__scopeSlider:r,...a}=e,n=Va(tu,r);return o.jsx(le.span,{"data-disabled":n.disabled?"":void 0,"data-orientation":n.orientation,...a,ref:t})});ru.displayName=tu;var Do="SliderRange",au=h.forwardRef((e,t)=>{const{__scopeSlider:r,...a}=e,n=Va(Do,r),s=Qd(Do,r),i=h.useRef(null),l=pe(t,i),c=n.values.length,d=n.values.map(m=>su(m,n.min,n.max)),u=c>1?Math.min(...d):0,p=100-Math.max(...d);return o.jsx(le.span,{"data-orientation":n.orientation,"data-disabled":n.disabled?"":void 0,...a,ref:l,style:{...e.style,[s.startEdge]:u+"%",[s.endEdge]:p+"%"}})});au.displayName=Do;var Ao="SliderThumb",ou=h.forwardRef((e,t)=>{const r=uy(e.__scopeSlider),[a,n]=h.useState(null),s=pe(t,l=>n(l)),i=h.useMemo(()=>a?r().findIndex(l=>l.ref.current===a):-1,[r,a]);return o.jsx(xy,{...e,ref:s,index:i})}),xy=h.forwardRef((e,t)=>{const{__scopeSlider:r,index:a,name:n,...s}=e,i=Va(Ao,r),l=Qd(Ao,r),[c,d]=h.useState(null),u=pe(t,j=>d(j)),p=c?i.form||!!c.closest("form"):!0,m=un(c),x=i.values[a],g=x===void 0?0:su(x,i.min,i.max),f=by(a,i.values.length),v=m==null?void 0:m[l.size],b=v?wy(v,g,l.direction):0;return h.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${g}% + ${b}px)`},children:[o.jsx(Oo.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(le.span,{role:"slider","aria-label":e["aria-label"]||f,"aria-valuemin":i.min,"aria-valuenow":x,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...s,ref:u,style:x===void 0?{display:"none"}:e.style,onFocus:oe(e.onFocus,()=>{i.valueIndexToChangeRef.current=a})})}),p&&o.jsx(nu,{name:n??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:x},a)]})});ou.displayName=Ao;var gy="RadioBubbleInput",nu=h.forwardRef(({__scopeSlider:e,value:t,...r},a)=>{const n=h.useRef(null),s=pe(n,a),i=dn(t);return h.useEffect(()=>{const l=n.current;if(!l)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("input",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(le.input,{style:{display:"none"},...r,ref:s,defaultValue:t})});nu.displayName=gy;function vy(e=[],t,r){const a=[...e];return a[r]=t,a.sort((n,s)=>n-s)}function su(e,t,r){const a=100/(r-t)*(e-t);return wr(a,[0,100])}function by(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function yy(e,t){if(e.length===1)return 0;const r=e.map(n=>Math.abs(n-t)),a=Math.min(...r);return r.indexOf(a)}function wy(e,t,r){const a=e/2,n=Ln([0,50],[0,a]);return(a-n(t)*r)*r}function jy(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function Ny(e,t){if(t>0){const r=jy(e);return Math.min(...r)>=t}return!0}function Ln(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(r-e[0])}}function Cy(e){return(String(e).split(".")[1]||"").length}function Sy(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var iu=Kd,ky=ru,_y=au,Ey=ou;const lu=h.forwardRef(({className:e,...t},r)=>o.jsxs(iu,{ref:r,className:G("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(ky,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(_y,{className:"absolute h-full bg-primary"})}),o.jsx(Ey,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));lu.displayName=iu.displayName;const Py=({inicioColuna:e,tamanho:t,onSelect:r})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(W,{className:"text-xs",children:"Posição no grid"}),o.jsx("div",{className:"flex gap-0.5",children:Array.from({length:12},(a,n)=>{const s=n+1,i=s>=e&&s<e+t;return o.jsx("button",{onClick:()=>r(s),className:G("flex-1 h-6 rounded-sm text-[8px] font-mono transition-all border",i?"bg-primary text-primary-foreground border-primary":"bg-muted/50 text-muted-foreground/50 border-border/50 hover:bg-muted hover:border-border"),children:s},s)})}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Início: col ",e," · Span: ",t]})]}),cu=({tamanho:e,inicioColuna:t,defaultTamanho:r=6,onTamanhoChange:a,onPositionChange:n})=>{const s=13-t;return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(W,{className:"text-xs",children:["Tamanho (",e,"/12 colunas)"]}),o.jsx(lu,{value:[e],onValueChange:([i])=>{const l=Math.min(i,s);a(l)},min:1,max:s,step:1,className:"py-1"}),o.jsxs("div",{className:"flex justify-between text-[9px] text-muted-foreground",children:[o.jsx("span",{children:"1"}),o.jsx("span",{children:"3"}),o.jsx("span",{children:"6"}),o.jsx("span",{children:"9"}),o.jsx("span",{children:"12"})]})]}),o.jsx(Py,{inicioColuna:t,tamanho:e,onSelect:i=>{const l=13-i,c=Math.min(e,l);n(i),c!==e&&a(c)}})]})},Ty=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Label"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Descrição"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do container"})]}),o.jsx(Ec,{value:e.icone,onChange:r=>t({icone:r})}),o.jsx(cu,{tamanho:e.tamanho||12,inicioColuna:e.inicioColuna||1,defaultTamanho:12,onTamanhoChange:r=>t({tamanho:r}),onPositionChange:r=>t({inicioColuna:r})}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Colunas internas"}),o.jsxs(Ge,{value:String(e.columns||2),onValueChange:r=>t({columns:Number(r)}),children:[o.jsx(He,{className:"h-8 text-sm",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"1",children:"1 coluna"}),o.jsx(Se,{value:"2",children:"2 colunas"}),o.jsx(Se,{value:"3",children:"3 colunas"}),o.jsx(Se,{value:"4",children:"4 colunas"})]})]}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Grid interno simplificado para campos"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(W,{htmlFor:"show-label",className:"text-xs cursor-pointer",children:"Exibir label no formulário"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"show-as-card",checked:e.showAsCard||!1,onCheckedChange:r=>t({showAsCard:r===!0})}),o.jsx(W,{htmlFor:"show-as-card",className:"text-xs cursor-pointer",children:"Exibir como card"})]})]}),Ba=h.forwardRef(({className:e,...t},r)=>o.jsx("textarea",{className:G("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...t}));Ba.displayName="Textarea";function $y(e,t=[]){let r=[];function a(s,i){const l=h.createContext(i);l.displayName=s+"Context";const c=r.length;r=[...r,i];const d=p=>{var m;const{scope:x,children:g,...f}=p,v=((m=x==null?void 0:x[e])==null?void 0:m[c])||l,b=h.useMemo(()=>f,Object.values(f));return o.jsx(v.Provider,{value:b,children:g})};d.displayName=s+"Provider";function u(p,m){var x;const g=((x=m==null?void 0:m[e])==null?void 0:x[c])||l,f=h.useContext(g);if(f)return f;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[d,u]}const n=()=>{const s=r.map(i=>h.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return h.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return n.scopeName=e,[a,Ry(n,...t)]}function Ry(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const a=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(n){const s=a.reduce((i,{useScope:l,scopeName:c})=>{const d=l(n)[`__scope${c}`];return{...i,...d}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var zn="Progress",Mn=100,[Oy]=$y(zn),[Dy,Ay]=Oy(zn),du=h.forwardRef((e,t)=>{const{__scopeProgress:r,value:a=null,max:n,getValueLabel:s=Iy,...i}=e;(n||n===0)&&!ii(n)&&console.error(Ly(`${n}`,"Progress"));const l=ii(n)?n:Mn;a!==null&&!li(a,l)&&console.error(zy(`${a}`,"Progress"));const c=li(a,l)?a:null,d=ia(c)?s(c,l):void 0;return o.jsx(Dy,{scope:r,value:c,max:l,children:o.jsx(ya.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":ia(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":mu(c,l),"data-value":c??void 0,"data-max":l,...i,ref:t})})});du.displayName=zn;var uu="ProgressIndicator",pu=h.forwardRef((e,t)=>{const{__scopeProgress:r,...a}=e,n=Ay(uu,r);return o.jsx(ya.div,{"data-state":mu(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...a,ref:t})});pu.displayName=uu;function Iy(e,t){return`${Math.round(e/t*100)}%`}function mu(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function ia(e){return typeof e=="number"}function ii(e){return ia(e)&&!isNaN(e)&&e>0}function li(e,t){return ia(e)&&!isNaN(e)&&e<=t&&e>=0}function Ly(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Mn}\`.`}function zy(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
|
|
77
77
|
- a positive number
|
|
78
78
|
- less than the value passed to \`max\` (or ${Mn} if no \`max\` prop is set)
|
|
79
79
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
80
80
|
|
|
81
|
-
Defaulting to \`null\`.`}var mu=cu,Ly=uu;const fu=x.forwardRef(({className:e,value:t,...r},a)=>o.jsx(mu,{ref:a,className:G("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:o.jsx(Ly,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));fu.displayName=mu.displayName;var[Ua]=bt("Tooltip",[mr]),Ha=mr(),zy="TooltipProvider",Io="tooltip.open",[Z0,Fn]=Ua(zy),Nr="Tooltip",[My,Wa]=Ua(Nr),hu=e=>{const{__scopeTooltip:t,children:r,open:a,defaultOpen:n,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=Fn(Nr,e.__scopeTooltip),d=Ha(t),[u,p]=x.useState(null),m=_t(),h=x.useRef(0),g=i??c.disableHoverableContent,f=l??c.delayDuration,v=x.useRef(!1),[b,w]=Vt({prop:a,defaultProp:n??!1,onChange:k=>{k?(c.onOpen(),document.dispatchEvent(new CustomEvent(Io))):c.onClose(),s==null||s(k)},caller:Nr}),y=x.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),N=x.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,w(!0)},[w]),C=x.useCallback(()=>{window.clearTimeout(h.current),h.current=0,w(!1)},[w]),_=x.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,w(!0),h.current=0},f)},[f,w]);return x.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),o.jsx(Rn,{...d,children:o.jsx(My,{scope:t,contentId:m,open:b,stateAttribute:y,trigger:u,onTriggerChange:p,onTriggerEnter:x.useCallback(()=>{c.isOpenDelayedRef.current?_():N()},[c.isOpenDelayedRef,_,N]),onTriggerLeave:x.useCallback(()=>{g?C():(window.clearTimeout(h.current),h.current=0)},[C,g]),onOpen:N,onClose:C,disableHoverableContent:g,children:r})})};hu.displayName=Nr;var Lo="TooltipTrigger",xu=x.forwardRef((e,t)=>{const{__scopeTooltip:r,...a}=e,n=Wa(Lo,r),s=Fn(Lo,r),i=Ha(r),l=x.useRef(null),c=pe(t,l,n.onTriggerChange),d=x.useRef(!1),u=x.useRef(!1),p=x.useCallback(()=>d.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),o.jsx(Da,{asChild:!0,...i,children:o.jsx(le.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...a,ref:c,onPointerMove:oe(e.onPointerMove,m=>{m.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:oe(e.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:oe(e.onPointerDown,()=>{n.open&&n.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:oe(e.onFocus,()=>{d.current||n.onOpen()}),onBlur:oe(e.onBlur,n.onClose),onClick:oe(e.onClick,n.onClose)})})});xu.displayName=Lo;var Fy="TooltipPortal",[X0,Vy]=Ua(Fy,{forceMount:void 0}),lr="TooltipContent",gu=x.forwardRef((e,t)=>{const r=Vy(lr,e.__scopeTooltip),{forceMount:a=r.forceMount,side:n="top",...s}=e,i=Wa(lr,e.__scopeTooltip);return o.jsx(Qe,{present:a||i.open,children:i.disableHoverableContent?o.jsx(vu,{side:n,...s,ref:t}):o.jsx(By,{side:n,...s,ref:t})})}),By=x.forwardRef((e,t)=>{const r=Wa(lr,e.__scopeTooltip),a=Fn(lr,e.__scopeTooltip),n=x.useRef(null),s=pe(t,n),[i,l]=x.useState(null),{trigger:c,onClose:d}=r,u=n.current,{onPointerInTransitChange:p}=a,m=x.useCallback(()=>{l(null),p(!1)},[p]),h=x.useCallback((g,f)=>{const v=g.currentTarget,b={x:g.clientX,y:g.clientY},w=Zy(b,v.getBoundingClientRect()),y=Xy(b,w),N=Gy(f.getBoundingClientRect()),C=Ky([...y,...N]);l(C),p(!0)},[p]);return x.useEffect(()=>()=>m(),[m]),x.useEffect(()=>{if(c&&u){const g=v=>h(v,u),f=v=>h(v,c);return c.addEventListener("pointerleave",g),u.addEventListener("pointerleave",f),()=>{c.removeEventListener("pointerleave",g),u.removeEventListener("pointerleave",f)}}},[c,u,h,m]),x.useEffect(()=>{if(i){const g=f=>{const v=f.target,b={x:f.clientX,y:f.clientY},w=(c==null?void 0:c.contains(v))||(u==null?void 0:u.contains(v)),y=!Yy(b,i);w?m():y&&(m(),d())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,u,i,d,m]),o.jsx(vu,{...e,ref:s})}),[Uy,Hy]=Ua(Nr,{isInside:!1}),Wy=hx("TooltipContent"),vu=x.forwardRef((e,t)=>{const{__scopeTooltip:r,children:a,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Wa(lr,r),d=Ha(r),{onClose:u}=c;return x.useEffect(()=>(document.addEventListener(Io,u),()=>document.removeEventListener(Io,u)),[u]),x.useEffect(()=>{if(c.trigger){const p=m=>{const h=m.target;h!=null&&h.contains(c.trigger)&&u()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,u]),o.jsx(kr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:u,children:o.jsxs(On,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.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:[o.jsx(Wy,{children:a}),o.jsx(Uy,{scope:r,isInside:!0,children:o.jsx(Rb,{id:c.contentId,role:"tooltip",children:n||a})})]})})});gu.displayName=lr;var bu="TooltipArrow",qy=x.forwardRef((e,t)=>{const{__scopeTooltip:r,...a}=e,n=Ha(r);return Hy(bu,r).isInside?null:o.jsx(Dn,{...n,...a,ref:t})});qy.displayName=bu;function Zy(e,t){const r=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),n=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,a,n,s)){case s:return"left";case n:return"right";case r:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function Xy(e,t,r=5){const a=[];switch(t){case"top":a.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":a.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":a.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":a.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return a}function Gy(e){const{top:t,right:r,bottom:a,left:n}=e;return[{x:n,y:t},{x:r,y:t},{x:r,y:a},{x:n,y:a}]}function Yy(e,t){const{x:r,y:a}=e;let n=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,u=l.y,p=c.x,m=c.y;u>a!=m>a&&r<(p-d)*(a-u)/(m-u)+d&&(n=!n)}return n}function Ky(e){const t=e.slice();return t.sort((r,a)=>r.x<a.x?-1:r.x>a.x?1:r.y<a.y?-1:r.y>a.y?1:0),Jy(t)}function Jy(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const n=e[a];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(n.y-i.y)>=(s.y-i.y)*(n.x-i.x))t.pop();else break}t.push(n)}t.pop();const r=[];for(let a=e.length-1;a>=0;a--){const n=e[a];for(;r.length>=2;){const s=r[r.length-1],i=r[r.length-2];if((s.x-i.x)*(n.y-i.y)>=(s.y-i.y)*(n.x-i.x))r.pop();else break}r.push(n)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var Qy=hu,e0=xu,yu=gu;const wu=Qy,ju=e0,Vn=x.forwardRef(({className:e,sideOffset:t=4,...r},a)=>o.jsx(yu,{ref:a,sideOffset:t,className:G("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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",e),...r}));Vn.displayName=yu.displayName;const t0=cn("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",success:"border-transparent bg-green-500 text-white shadow"}},defaultVariants:{variant:"default"}});function qa({className:e,variant:t,...r}){return o.jsx("div",{className:G(t0({variant:t}),e),...r})}const zo=[{category:"Texto básico",presets:[{pattern:"^[A-Za-z]+$",label:"Apenas letras",description:"Aceita somente letras de A-Z (maiúsculas e minúsculas), sem espaços, números ou especiais."},{pattern:"^[a-z]+$",label:"Apenas minúsculas",description:"Aceita somente letras minúsculas de a-z."},{pattern:"^[A-Z]+$",label:"Apenas maiúsculas",description:"Aceita somente letras maiúsculas de A-Z."},{pattern:"^[A-Za-zÀ-ÿ]+$",label:"Letras com acentos",description:"Aceita letras incluindo acentuadas (é, ã, ü, etc.)."},{pattern:"^[A-Za-zÀ-ÿ\\s]+$",label:"Letras, acentos e espaços",description:"Aceita letras com acentos e espaços — ideal para nomes completos."},{pattern:"^[A-Za-z0-9]+$",label:"Alfanumérico",description:"Apenas letras e números, sem espaços ou caracteres especiais."},{pattern:"^[A-Za-z0-9\\s]+$",label:"Alfanumérico com espaços",description:"Letras, números e espaços."},{pattern:"^[A-Za-z0-9_]+$",label:"Alfanumérico + underscore",description:"Letras, números e underscore (_). Padrão para usernames."},{pattern:"^[A-Za-z0-9_-]+$",label:"Slug-friendly",description:"Letras, números, underscore e hífen. Ideal para slugs de URL."},{pattern:"^\\S+$",label:"Sem espaços",description:"Aceita qualquer caractere exceto espaços em branco."},{pattern:"^.{1,}$",label:"Não vazio",description:"Exige pelo menos 1 caractere (qualquer um)."}]},{category:"Números",presets:[{pattern:"^[0-9]+$",label:"Apenas dígitos",description:"Aceita somente dígitos numéricos (0-9)."},{pattern:"^-?[0-9]+$",label:"Inteiro (com negativo)",description:"Número inteiro, opcionalmente negativo."},{pattern:"^[0-9]+\\.?[0-9]*$",label:"Decimal positivo",description:"Número decimal positivo (ex: 3.14, 42)."},{pattern:"^-?[0-9]+\\.?[0-9]*$",label:"Decimal (com negativo)",description:"Número decimal, opcionalmente negativo."},{pattern:"^\\d{1,3}(\\.\\d{3})*(,\\d{2})?$",label:"Formato BR (1.234,56)",description:"Número no formato brasileiro com pontos de milhar e vírgula decimal."},{pattern:"^\\d{1,3}(,\\d{3})*(\\.\\d{2})?$",label:"Formato US (1,234.56)",description:"Número no formato americano com vírgulas de milhar e ponto decimal."},{pattern:"^[01]+$",label:"Binário",description:"Aceita apenas 0 e 1 — representação binária."},{pattern:"^[0-9A-Fa-f]+$",label:"Hexadecimal",description:"Aceita dígitos hexadecimais (0-9, A-F)."},{pattern:"^0[xX][0-9A-Fa-f]+$",label:"Hex com prefixo 0x",description:"Hexadecimal com prefixo 0x (ex: 0xFF)."},{pattern:"^[0-7]+$",label:"Octal",description:"Aceita apenas dígitos octais (0-7)."},{pattern:"^\\d+(\\.\\d{1,2})?$",label:"Monetário (2 casas)",description:"Número com até 2 casas decimais — ideal para valores monetários."},{pattern:"^\\d+(\\.\\d{1,4})?$",label:"Até 4 casas decimais",description:"Número com até 4 casas decimais."}]},{category:"Documentos BR",presets:[{pattern:"^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$",label:"CPF (com máscara)",description:"CPF formatado: 123.456.789-00."},{pattern:"^\\d{11}$",label:"CPF (sem máscara)",description:"CPF apenas dígitos: 12345678900."},{pattern:"^\\d{2}\\.\\d{3}\\.\\d{3}/\\d{4}-\\d{2}$",label:"CNPJ (com máscara)",description:"CNPJ formatado: 12.345.678/0001-00."},{pattern:"^\\d{14}$",label:"CNPJ (sem máscara)",description:"CNPJ apenas dígitos: 12345678000100."},{pattern:"^\\d{5}-?\\d{3}$",label:"CEP",description:"CEP brasileiro: 12345-678 ou 12345678."},{pattern:"^\\d{1,2}\\.\\d{3}\\.\\d{3}[-]?\\d{1}$",label:"RG (formato comum)",description:"RG no formato mais comum: 1.234.567-8."},{pattern:"^\\d{11}$",label:"PIS/PASEP",description:"PIS/PASEP com 11 dígitos."},{pattern:"^\\d{3}\\.?\\d{7}-?\\d{1}$",label:"Título de eleitor",description:"Título de eleitor com 12 dígitos."},{pattern:"^[A-Z]{2}\\d{7}$",label:"Passaporte BR",description:"Passaporte brasileiro: 2 letras + 7 dígitos (ex: AB1234567)."},{pattern:"^\\d{11}$",label:"CNH (registro)",description:"Número de registro da CNH: 11 dígitos."},{pattern:"^\\d{10}$",label:"Certidão (matrícula)",description:"Matrícula de certidão de nascimento/casamento."},{pattern:"^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$|^\\d{2}\\.\\d{3}\\.\\d{3}/\\d{4}-\\d{2}$",label:"CPF ou CNPJ",description:"Aceita CPF (123.456.789-00) ou CNPJ (12.345.678/0001-00)."}]},{category:"Contato",presets:[{pattern:"^[\\w.-]+@[\\w.-]+\\.[A-Za-z]{2,}$",label:"E-mail simples",description:"Validação básica de e-mail: usuario@dominio.com."},{pattern:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",label:"E-mail completo",description:"E-mail com mais caracteres aceitos no usuário."},{pattern:"^\\(\\d{2}\\)\\s?\\d{4,5}-\\d{4}$",label:"Telefone BR (com máscara)",description:"Telefone formatado: (11) 91234-5678 ou (11) 1234-5678."},{pattern:"^\\d{10,11}$",label:"Telefone BR (sem máscara)",description:"Telefone apenas dígitos: 11912345678."},{pattern:"^\\+\\d{1,3}\\s?\\d{2,3}\\s?\\d{4,5}[-]?\\d{4}$",label:"Telefone internacional",description:"Formato +55 11 91234-5678."},{pattern:"^\\+55\\d{10,11}$",label:"Celular BR (+55)",description:"Celular brasileiro com DDI: +5511912345678."},{pattern:"^\\d{4,5}-\\d{4}$",label:"Telefone (sem DDD)",description:"Número local: 1234-5678 ou 91234-5678."},{pattern:"^0800\\d{6,7}$",label:"0800",description:"Número 0800 (SAC): 0800XXXXXXX."}]},{category:"Internet / URLs",presets:[{pattern:"^https?://[\\w.-]+(:\\d+)?(/[\\w./-]*)*$",label:"URL HTTP/HTTPS",description:"URL completa com protocolo http ou https."},{pattern:"^(https?://)?[\\w.-]+\\.[A-Za-z]{2,}(/.*)?$",label:"URL (protocolo opcional)",description:"URL com ou sem http:// na frente."},{pattern:"^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*\\.[a-z]{2,}$",label:"Domínio",description:"Nome de domínio válido: exemplo.com.br."},{pattern:"^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$",label:"IPv4",description:"Endereço IPv4: 192.168.0.1."},{pattern:"^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$",label:"IPv6 (completo)",description:"Endereço IPv6 completo."},{pattern:"^[a-z][a-z0-9-]*$",label:"Subdomínio",description:"Nome de subdomínio válido (letra inicial, alfanumérico + hífen)."},{pattern:"^[A-Za-z][A-Za-z0-9+.-]*://.*$",label:"URI genérica",description:"Qualquer URI com esquema (ftp://, mailto:, tel:, etc.)."},{pattern:"^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",label:"Cor hex (#FFF)",description:"Código de cor hexadecimal: #FFF ou #FFFFFF."},{pattern:"^#[0-9A-Fa-f]{8}$",label:"Cor hex com alpha",description:"Cor hexadecimal com canal alpha: #FFFFFFFF."},{pattern:"^rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)$",label:"Cor RGB",description:"Cor no formato rgb(255, 0, 0)."}]},{category:"Data e hora",presets:[{pattern:"^\\d{2}/\\d{2}/\\d{4}$",label:"Data DD/MM/AAAA",description:"Data no formato brasileiro: 25/12/2024."},{pattern:"^\\d{4}-\\d{2}-\\d{2}$",label:"Data ISO (AAAA-MM-DD)",description:"Data no formato ISO 8601: 2024-12-25."},{pattern:"^\\d{2}/\\d{2}/\\d{2}$",label:"Data DD/MM/AA",description:"Data com ano de 2 dígitos: 25/12/24."},{pattern:"^\\d{2}-\\d{2}-\\d{4}$",label:"Data DD-MM-AAAA",description:"Data com hífens: 25-12-2024."},{pattern:"^\\d{2}:\\d{2}$",label:"Hora HH:MM",description:"Horário 24h: 14:30."},{pattern:"^\\d{2}:\\d{2}:\\d{2}$",label:"Hora HH:MM:SS",description:"Horário com segundos: 14:30:59."},{pattern:"^(0[1-9]|1[0-2])/\\d{4}$",label:"Mês/Ano (MM/AAAA)",description:"Mês e ano: 12/2024."},{pattern:"^\\d{4}$",label:"Ano (4 dígitos)",description:"Ano com 4 dígitos: 2024."},{pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$",label:"DateTime ISO (sem seg)",description:"Data e hora ISO: 2024-12-25T14:30."},{pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",label:"DateTime ISO (com seg)",description:"Data e hora ISO com segundos."},{pattern:"^\\d{2}/\\d{2}/\\d{4}\\s\\d{2}:\\d{2}$",label:"DateTime BR",description:"Data e hora BR: 25/12/2024 14:30."}]},{category:"Senhas",presets:[{pattern:"^.{6,}$",label:"Mín. 6 caracteres",description:"Exige no mínimo 6 caracteres (qualquer tipo)."},{pattern:"^.{8,}$",label:"Mín. 8 caracteres",description:"Exige no mínimo 8 caracteres."},{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).{8,}$",label:"Forte (letra+número)",description:"Mín. 8 chars com pelo menos 1 maiúscula, 1 minúscula e 1 número."},{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!@#$%^&*]).{8,}$",label:"Muito forte",description:"Mín. 8 chars com maiúscula, minúscula, número e caractere especial."},{pattern:"^(?=.*[A-Z])(?=.*\\d).{6,}$",label:"Média (maiúsc+número)",description:"Mín. 6 chars com pelo menos 1 maiúscula e 1 número."},{pattern:"^(?!.*\\s).{8,}$",label:"Sem espaços (mín. 8)",description:"Mín. 8 caracteres, sem espaços."}]},{category:"Nomes e texto formatado",presets:[{pattern:"^[A-Za-zÀ-ÿ]{2,}(\\s[A-Za-zÀ-ÿ]{2,})+$",label:"Nome completo",description:"Nome e sobrenome (mínimo 2 palavras, cada com 2+ letras)."},{pattern:"^[A-Za-zÀ-ÿ]{2,}$",label:"Primeiro nome",description:"Apenas o primeiro nome (mínimo 2 letras, com acentos)."},{pattern:"^[A-Za-zÀ-ÿ'\\-\\s]+$",label:"Nome com apóstrofo/hífen",description:"Nome que aceita D'Silva, Maria-José, etc."},{pattern:"^[A-Z][a-zà-ÿ]+(\\s[A-Z][a-zà-ÿ]+)*$",label:"Nome capitalizado",description:"Cada palavra inicia com maiúscula: João Silva."},{pattern:"^@[A-Za-z0-9_]{1,30}$",label:"Username (@handle)",description:"Username no estilo @usuario (letras, números, underscore, até 30 chars)."},{pattern:"^[a-z0-9_]{3,20}$",label:"Username simples",description:"Username minúsculo: 3-20 chars, letras, números e underscore."},{pattern:"^[A-Za-z0-9._%+-]+$",label:"Parte local do e-mail",description:"Parte antes do @ em endereços de e-mail."}]},{category:"Endereço",presets:[{pattern:"^[A-Za-zÀ-ÿ0-9\\s,./-]+$",label:"Endereço genérico",description:"Aceita letras, números, espaços, vírgulas, pontos, barras e hífens."},{pattern:"^\\d{1,6}$",label:"Número residencial",description:"Número do endereço: 1 a 6 dígitos."},{pattern:"^\\d{5}-?\\d{3}$",label:"CEP",description:"CEP: 12345-678 ou 12345678."},{pattern:"^[A-Z]{2}$",label:"UF (estado)",description:"Sigla do estado brasileiro: SP, RJ, MG, etc."},{pattern:"^(Rua|Av|Avenida|Travessa|Alameda|Praça|Rod|Rodovia)\\s.+$",label:"Logradouro BR",description:"Começa com tipo de via: Rua, Avenida, Travessa, etc."},{pattern:"^(Apt|Apto|Sala|Bloco|Lote|Casa)\\s?\\d+.*$",label:"Complemento",description:"Complemento: Apto 123, Bloco B, Sala 3, etc."}]},{category:"Financeiro",presets:[{pattern:"^R\\$\\s?\\d{1,3}(\\.\\d{3})*(,\\d{2})?$",label:"Moeda BRL (R$)",description:"Valor em reais: R$ 1.234,56."},{pattern:"^\\$\\d{1,3}(,\\d{3})*(\\.\\d{2})?$",label:"Moeda USD ($)",description:"Valor em dólares: $1,234.56."},{pattern:"^\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}$",label:"Cartão de crédito",description:"Número de cartão: 1234 5678 9012 3456."},{pattern:"^(0[1-9]|1[0-2])/\\d{2}$",label:"Validade cartão (MM/AA)",description:"Data de validade: 12/25."},{pattern:"^\\d{3,4}$",label:"CVV",description:"Código de segurança: 3 ou 4 dígitos."},{pattern:"^\\d{1,6}(-[0-9Xx])?$",label:"Agência bancária",description:"Número da agência: 1234-5 ou 1234."},{pattern:"^\\d{1,12}(-[0-9Xx])?$",label:"Conta bancária",description:"Número da conta: até 12 dígitos com dígito verificador."},{pattern:"^\\d{1,3}(\\.\\d{3})*(,\\d{2})$",label:"Valor BR sem símbolo",description:"Valor monetário sem R$: 1.234,56."}]},{category:"Veículos",presets:[{pattern:"^[A-Z]{3}-?\\d{4}$",label:"Placa antiga (ABC-1234)",description:"Placa veicular formato antigo: ABC-1234."},{pattern:"^[A-Z]{3}\\d[A-Z]\\d{2}$",label:"Placa Mercosul (ABC1D23)",description:"Placa veicular Mercosul: ABC1D23."},{pattern:"^[A-Z]{3}-?\\d{4}$|^[A-Z]{3}\\d[A-Z]\\d{2}$",label:"Placa (ambos formatos)",description:"Aceita placa antiga (ABC-1234) ou Mercosul (ABC1D23)."},{pattern:"^\\d{11}$",label:"RENAVAM",description:"RENAVAM: 11 dígitos numéricos."},{pattern:"^[A-Z0-9]{17}$",label:"Chassi (VIN)",description:"Número de chassi/VIN: 17 caracteres alfanuméricos maiúsculos."}]},{category:"Códigos e identificadores",presets:[{pattern:"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",label:"UUID v4",description:"UUID formato padrão: 550e8400-e29b-41d4-a716-446655440000."},{pattern:"^[A-Za-z0-9+/]+={0,2}$",label:"Base64",description:"String codificada em Base64."},{pattern:"^[A-Za-z0-9-_]+$",label:"Base64 URL-safe",description:"Base64 com caracteres seguros para URL."},{pattern:"^[0-9a-f]{32}$",label:"MD5 hash",description:"Hash MD5: 32 caracteres hexadecimais."},{pattern:"^[0-9a-f]{40}$",label:"SHA-1 hash",description:"Hash SHA-1: 40 caracteres hexadecimais."},{pattern:"^[0-9a-f]{64}$",label:"SHA-256 hash",description:"Hash SHA-256: 64 caracteres hexadecimais."},{pattern:"^\\d{8,14}$",label:"Código de barras",description:"Código de barras numérico: 8-14 dígitos."},{pattern:"^\\d{44}$",label:"Linha digitável boleto",description:"Linha digitável de boleto: 44 dígitos."},{pattern:"^[A-Z]{2}\\d{2}[A-Z0-9]{4}\\d{7}([A-Z0-9]?){0,16}\\d{2}$",label:"IBAN",description:"Código bancário internacional IBAN."},{pattern:"^[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$",label:"SWIFT/BIC",description:"Código SWIFT bancário: 8 ou 11 caracteres."}]},{category:"Saúde e governo",presets:[{pattern:"^\\d{15}$",label:"Cartão SUS",description:"Número do Cartão Nacional de Saúde: 15 dígitos."},{pattern:"^\\d{6,7}$",label:"CRM/CRO/CRP",description:"Número de registro profissional de saúde."},{pattern:"^\\d{3}\\.\\d{5}\\.\\d{2}-\\d$",label:"NIT/PIS",description:"Número de Identificação do Trabalhador."},{pattern:"^\\d{7}-?\\d{2}\\.\\d{4}\\.\\d\\.\\d{2}\\.\\d{4}$",label:"Processo judicial",description:"Número de processo judicial (formato CNJ)."},{pattern:"^\\d{12}$",label:"Inscrição estadual (genérica)",description:"Inscrição estadual genérica: 12 dígitos."},{pattern:"^\\d{11}$",label:"NIS/NIT",description:"Número de Identificação Social: 11 dígitos."}]},{category:"Redes sociais",presets:[{pattern:"^https?://(www\\.)?instagram\\.com/[A-Za-z0-9_.]+/?$",label:"Perfil Instagram",description:"URL de perfil do Instagram."},{pattern:"^https?://(www\\.)?facebook\\.com/.+$",label:"Perfil Facebook",description:"URL de perfil ou página do Facebook."},{pattern:"^https?://(www\\.)?linkedin\\.com/in/[A-Za-z0-9-]+/?$",label:"Perfil LinkedIn",description:"URL de perfil do LinkedIn."},{pattern:"^https?://(www\\.)?(twitter|x)\\.com/[A-Za-z0-9_]+/?$",label:"Perfil Twitter/X",description:"URL de perfil no Twitter/X."},{pattern:"^https?://(www\\.)?youtube\\.com/(c/|channel/|@)[A-Za-z0-9_-]+/?$",label:"Canal YouTube",description:"URL de canal do YouTube."},{pattern:"^https?://(www\\.)?github\\.com/[A-Za-z0-9_-]+/?$",label:"Perfil GitHub",description:"URL de perfil do GitHub."},{pattern:"^https?://(www\\.)?tiktok\\.com/@[A-Za-z0-9_.]+/?$",label:"Perfil TikTok",description:"URL de perfil do TikTok."}]},{category:"Programação",presets:[{pattern:"^[a-z][a-zA-Z0-9]*$",label:"camelCase",description:"Formato camelCase: minúscula inicial, sem espaços."},{pattern:"^[A-Z][a-zA-Z0-9]*$",label:"PascalCase",description:"Formato PascalCase: maiúscula inicial."},{pattern:"^[a-z]+(_[a-z]+)*$",label:"snake_case",description:"Formato snake_case: minúsculas separadas por underscore."},{pattern:"^[a-z]+(-[a-z]+)*$",label:"kebab-case",description:"Formato kebab-case: minúsculas separadas por hífen."},{pattern:"^[A-Z]+(_[A-Z]+)*$",label:"SCREAMING_SNAKE",description:"Constantes: MAIÚSCULAS_COM_UNDERSCORES."},{pattern:"^[a-zA-Z_$][a-zA-Z0-9_$]*$",label:"Variável JS válida",description:"Nome de variável JavaScript válido."},{pattern:"^v?\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$",label:"Semver",description:"Versionamento semântico: v1.2.3 ou 1.2.3-beta.1."},{pattern:"^[a-z][a-z0-9]*(-[a-z][a-z0-9]*)*$",label:"Nome de pacote npm",description:"Nome válido de pacote npm."}]}],r0=zo.flatMap(e=>e.presets),a0=({value:e,message:t,onChange:r})=>{const[a,n]=E.useState(!1),[s,i]=E.useState(""),l=E.useMemo(()=>{if(!s.trim())return zo;const u=s.toLowerCase();return zo.map(p=>({...p,presets:p.presets.filter(m=>m.label.toLowerCase().includes(u)||m.description.toLowerCase().includes(u)||m.pattern.toLowerCase().includes(u))})).filter(p=>p.presets.length>0)},[s]),c=E.useMemo(()=>e?r0.find(u=>u.pattern===e):void 0,[e]),d=u=>{r(u.pattern,`${u.label}: formato inválido`),n(!1),i("")};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(W,{className:"text-[10px]",children:"Regex"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(ae,{value:e??"",onChange:u=>r(u.target.value||void 0,t),className:"h-7 text-xs font-mono flex-1",placeholder:"Clique no botão ou digite..."}),e&&o.jsx(ye,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>{r(void 0,void 0)},children:o.jsx(P.X,{className:"h-3 w-3"})}),o.jsxs(Ia,{open:a,onOpenChange:n,children:[o.jsx(La,{asChild:!0,children:o.jsx(ye,{variant:"outline",size:"icon",className:"h-7 w-7 shrink-0",children:o.jsx(P.Regex,{className:"h-3.5 w-3.5"})})}),o.jsxs(Pr,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(P.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ae,{value:s,onChange:u=>i(u.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar regex (ex: CPF, e-mail, senha)...",autoFocus:!0})]})}),o.jsx(Ca,{className:"h-[360px]",children:o.jsxs("div",{className:"p-1",children:[l.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum regex encontrado"}),l.map(u=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:u.category}),u.presets.map(p=>o.jsxs(wu,{children:[o.jsx(ju,{asChild:!0,children:o.jsxs("button",{onClick:()=>d(p),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors group",children:[o.jsx(P.ChevronRight,{className:"h-3 w-3 text-muted-foreground/50 group-hover:text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium block truncate",children:p.label}),o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono block truncate",children:p.pattern})]})]})}),o.jsxs(Vn,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:p.label}),o.jsx("p",{children:p.description})]})]},p.pattern+p.label))]},u.category))]})})]})]})]}),c&&o.jsxs(qa,{variant:"secondary",className:"text-[10px] font-normal gap-1",children:[o.jsx(P.Regex,{className:"h-2.5 w-2.5"}),c.label]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Mensagem do regex"}),o.jsx(ae,{value:t??"",onChange:u=>r(e,u.target.value||void 0),className:"h-7 text-xs",placeholder:"Formato inválido"})]})]})},Mo=[{category:"Imagens",presets:[{value:"image/jpeg",label:"JPEG",description:"Imagem JPEG — formato mais comum para fotos. Boa compressão, perde qualidade."},{value:"image/png",label:"PNG",description:"Imagem PNG — suporta transparência, sem perda de qualidade. Arquivos maiores."},{value:"image/gif",label:"GIF",description:"Imagem GIF — suporta animações simples e transparência. Limitado a 256 cores."},{value:"image/webp",label:"WebP",description:"Formato moderno do Google — compressão superior ao JPEG e PNG."},{value:"image/svg+xml",label:"SVG",description:"Imagem vetorial XML — escalável sem perda. Ideal para logos e ícones."},{value:"image/bmp",label:"BMP",description:"Bitmap — sem compressão, arquivos muito grandes."},{value:"image/tiff",label:"TIFF",description:"Imagem TIFF — alta qualidade, usado em impressão profissional."},{value:"image/avif",label:"AVIF",description:"Formato moderno — melhor compressão que WebP, suporte crescente."},{value:"image/heic",label:"HEIC",description:"Formato padrão do iPhone — alta qualidade, tamanho reduzido."},{value:"image/*",label:"Qualquer imagem",description:"Aceita todos os formatos de imagem (JPEG, PNG, GIF, WebP, etc.)."}]},{category:"Documentos",presets:[{value:"application/pdf",label:"PDF",description:"Documento PDF — formato universal para documentos. Preserva formatação."},{value:"application/msword",label:"DOC (Word antigo)",description:"Microsoft Word 97-2003 (.doc)."},{value:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",label:"DOCX (Word)",description:"Microsoft Word moderno (.docx) — formato atual do Word."},{value:"application/vnd.ms-excel",label:"XLS (Excel antigo)",description:"Microsoft Excel 97-2003 (.xls)."},{value:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",label:"XLSX (Excel)",description:"Microsoft Excel moderno (.xlsx) — formato atual do Excel."},{value:"application/vnd.ms-powerpoint",label:"PPT (PowerPoint antigo)",description:"Microsoft PowerPoint 97-2003 (.ppt)."},{value:"application/vnd.openxmlformats-officedocument.presentationml.presentation",label:"PPTX (PowerPoint)",description:"Microsoft PowerPoint moderno (.pptx)."},{value:"application/vnd.oasis.opendocument.text",label:"ODT (LibreOffice)",description:"Documento de texto LibreOffice/OpenOffice (.odt)."},{value:"application/vnd.oasis.opendocument.spreadsheet",label:"ODS (LibreOffice)",description:"Planilha LibreOffice/OpenOffice (.ods)."},{value:"application/rtf",label:"RTF",description:"Rich Text Format — compatível com quase todos os editores de texto."},{value:"text/plain",label:"TXT",description:"Texto puro sem formatação (.txt)."},{value:"text/csv",label:"CSV",description:"Valores separados por vírgula — planilhas simples e dados tabulares."}]},{category:"Vídeos",presets:[{value:"video/mp4",label:"MP4",description:"Vídeo MP4 — formato mais compatível, boa compressão (H.264/H.265)."},{value:"video/webm",label:"WebM",description:"Vídeo WebM — formato aberto do Google, boa compressão."},{value:"video/quicktime",label:"MOV",description:"Vídeo QuickTime — formato padrão do macOS/iPhone."},{value:"video/x-msvideo",label:"AVI",description:"Vídeo AVI — formato antigo da Microsoft, arquivos grandes."},{value:"video/x-matroska",label:"MKV",description:"Matroska — contêiner flexível, suporta múltiplas faixas de áudio/legenda."},{value:"video/*",label:"Qualquer vídeo",description:"Aceita todos os formatos de vídeo."}]},{category:"Áudios",presets:[{value:"audio/mpeg",label:"MP3",description:"Áudio MP3 — formato mais popular, boa compressão com perda."},{value:"audio/wav",label:"WAV",description:"Áudio WAV — sem compressão, alta qualidade, arquivos grandes."},{value:"audio/ogg",label:"OGG",description:"Áudio OGG Vorbis — formato aberto, boa qualidade."},{value:"audio/aac",label:"AAC",description:"Áudio AAC — qualidade superior ao MP3 no mesmo bitrate."},{value:"audio/flac",label:"FLAC",description:"Áudio FLAC — compressão sem perda, alta fidelidade."},{value:"audio/webm",label:"WebM Áudio",description:"Áudio no contêiner WebM."},{value:"audio/*",label:"Qualquer áudio",description:"Aceita todos os formatos de áudio."}]},{category:"Compactados",presets:[{value:"application/zip",label:"ZIP",description:"Arquivo compactado ZIP — o mais universal."},{value:"application/x-rar-compressed",label:"RAR",description:"Arquivo compactado RAR — boa compressão, formato proprietário."},{value:"application/gzip",label:"GZ / GZIP",description:"Compactação GZIP — muito usado em ambientes Unix/Linux."},{value:"application/x-7z-compressed",label:"7Z",description:"Arquivo 7-Zip — excelente taxa de compressão."},{value:"application/x-tar",label:"TAR",description:"TAR — agrupa arquivos sem compressão (usado com gzip)."}]},{category:"Dados / Código",presets:[{value:"application/json",label:"JSON",description:"Dados JSON — formato leve para troca de dados."},{value:"application/xml",label:"XML",description:"Dados XML — formato de marcação extensível."},{value:"text/html",label:"HTML",description:"Página web HTML."},{value:"text/css",label:"CSS",description:"Folha de estilo CSS."},{value:"application/javascript",label:"JavaScript",description:"Código JavaScript (.js)."},{value:"application/x-yaml",label:"YAML",description:"Dados YAML — formato legível para configurações."},{value:"text/markdown",label:"Markdown",description:"Texto Markdown (.md) — formatação leve."}]},{category:"Fontes",presets:[{value:"font/ttf",label:"TTF",description:"Fonte TrueType — amplamente suportada."},{value:"font/otf",label:"OTF",description:"Fonte OpenType — recursos tipográficos avançados."},{value:"font/woff",label:"WOFF",description:"Web Open Font Format — otimizado para web."},{value:"font/woff2",label:"WOFF2",description:"WOFF2 — compressão superior ao WOFF."}]},{category:"Atalhos comuns",presets:[{value:"image/*",label:"Todas as imagens",description:"Aceita qualquer formato de imagem."},{value:"video/*",label:"Todos os vídeos",description:"Aceita qualquer formato de vídeo."},{value:"audio/*",label:"Todos os áudios",description:"Aceita qualquer formato de áudio."},{value:"_group_documentos",label:"Documentos comuns",description:"PDF + Word .doc e .docx.",group:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"]},{value:"_group_imagens_web",label:"Imagens web",description:"JPEG, PNG e WebP — formatos mais usados na web.",group:["image/jpeg","image/png","image/webp"]},{value:"_group_planilhas",label:"Planilhas",description:"Excel .xls, .xlsx e CSV.",group:["application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/csv"]}]}],o0=Mo.flatMap(e=>e.presets),n0=({value:e,onChange:t})=>{const[r,a]=E.useState(!1),[n,s]=E.useState(""),[i,l]=E.useState(""),c=E.useMemo(()=>new Set(e??[]),[e]),d=E.useMemo(()=>{if(!n.trim())return Mo;const g=n.toLowerCase();return Mo.map(f=>({...f,presets:f.presets.filter(v=>v.label.toLowerCase().includes(g)||v.description.toLowerCase().includes(g)||v.value.toLowerCase().includes(g))})).filter(f=>f.presets.length>0)},[n]),u=g=>{const f=new Set(e??[]);g.group?g.group.every(v=>f.has(v))?g.group.forEach(v=>f.delete(v)):g.group.forEach(v=>f.add(v)):f.has(g.value)?f.delete(g.value):f.add(g.value),t(f.size>0?Array.from(f):void 0)},p=()=>{const g=i.trim();if(!g)return;const f=new Set(e??[]);f.add(g),t(Array.from(f)),l("")},m=g=>{const f=new Set(e??[]);f.delete(g),t(f.size>0?Array.from(f):void 0)},h=g=>{const f=o0.find(v=>v.value===g);return(f==null?void 0:f.label)??g};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(W,{className:"text-[10px]",children:"Tipos de arquivo aceitos"}),((e==null?void 0:e.length)??0)>0&&o.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(g=>o.jsxs(qa,{variant:"secondary",className:"text-[10px] gap-1 pr-1",children:[h(g),o.jsx("button",{onClick:()=>m(g),className:"hover:text-destructive",children:o.jsx(P.X,{className:"h-2.5 w-2.5"})})]},g))}),o.jsxs(Ia,{open:r,onOpenChange:a,children:[o.jsx(La,{asChild:!0,children:o.jsxs(ye,{variant:"outline",className:"w-full h-8 text-xs justify-start gap-2",children:[o.jsx(P.FileType2,{className:"h-3.5 w-3.5"}),((e==null?void 0:e.length)??0)>0?`${e.length} tipo(s) selecionado(s)`:"Selecionar tipos de arquivo..."]})}),o.jsxs(Pr,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(P.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ae,{value:n,onChange:g=>s(g.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar tipos (ex: PDF, imagem, vídeo)...",autoFocus:!0})]})}),o.jsxs("div",{className:"px-2 py-1.5 border-b flex gap-1",children:[o.jsx(ae,{value:i,onChange:g=>l(g.target.value),className:"h-7 text-xs font-mono flex-1",placeholder:"Tipo customizado (ex: .dwg)",onKeyDown:g=>g.key==="Enter"&&p()}),o.jsx(ye,{variant:"secondary",size:"sm",className:"h-7 text-xs shrink-0",onClick:p,disabled:!i.trim(),children:"Adicionar"})]}),o.jsx(Ca,{className:"h-[320px]",children:o.jsxs("div",{className:"p-1",children:[d.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum tipo encontrado"}),d.map(g=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:g.category}),g.presets.map(f=>{const v=f.group?f.group.every(w=>c.has(w)):c.has(f.value),b=f.group?f.group.some(w=>c.has(w))&&!v:!1;return o.jsxs(wu,{children:[o.jsx(ju,{asChild:!0,children:o.jsxs("button",{onClick:()=>u(f),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors",children:[o.jsx(Pe,{checked:b?"indeterminate":v,className:"h-3.5 w-3.5",tabIndex:-1}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium",children:f.label}),!f.group&&o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono ml-2",children:f.value}),f.group&&o.jsxs("span",{className:"text-[10px] text-muted-foreground ml-2",children:[f.group.length," tipos"]})]}),o.jsx(P.Info,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"})]})}),o.jsxs(Vn,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:f.label}),o.jsx("p",{children:f.description}),f.group&&o.jsx("ul",{className:"mt-1 space-y-0.5",children:f.group.map(w=>o.jsx("li",{className:"font-mono text-[10px] opacity-80",children:w},w))})]})]},f.value)})]},g.category))]})})]})]})]})},Nu=1048576,la=1073741824;function li(e){return e>=la&&e%la===0?"GB":"MB"}function ci(e,t){return t==="GB"?e/la:e/Nu}function di(e,t){return Math.round(e*(t==="GB"?la:Nu))}const s0=({value:e,onChange:t})=>{const r=E.useMemo(()=>e?li(e):"MB",[]),[a,n]=E.useState(r),[s,i]=E.useState(e?String(ci(e,r)):"");E.useEffect(()=>{if(e===void 0){i("");return}const d=li(e);n(d),i(String(ci(e,d)))},[e]);const l=d=>{i(d);const u=parseFloat(d);d.trim()===""||isNaN(u)||u<=0?t(void 0):t(di(u,a))},c=d=>{n(d);const u=parseFloat(s);!isNaN(u)&&u>0&&t(di(u,d))};return o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(W,{className:"text-[10px]",children:"Tamanho máximo do arquivo"}),o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(ae,{type:"number",min:0,step:"any",value:s,onChange:d=>l(d.target.value),placeholder:"Ex: 10",className:"h-8 text-xs flex-1"}),o.jsxs(Ge,{value:a,onValueChange:d=>c(d),children:[o.jsx(He,{className:"w-[72px] h-8 text-xs",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"MB",children:"MB"}),o.jsx(Se,{value:"GB",children:"GB"})]})]})]}),e!==void 0&&o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["= ",e.toLocaleString("pt-BR")," bytes"]})]})},i0=new Set(["texto","textarea","email","password","url","phone","tel","cpf","cnpj","cep","rg"]),l0=({fieldType:e,validation:t,onChange:r})=>{const a=(i,l)=>{const c=["minLength","maxLength","min","max","maxFileSize","minAge","maxAge"].includes(i)?l?Number(l):void 0:l||void 0;r({...t,[i]:c})},n=e==="file",s=i0.has(e);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Validação"}),s&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Min caracteres"}),o.jsx(ae,{type:"number",min:0,value:(t==null?void 0:t.minLength)??"",onChange:i=>a("minLength",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Max caracteres"}),o.jsx(ae,{type:"number",min:0,value:(t==null?void 0:t.maxLength)??"",onChange:i=>a("maxLength",i.target.value),className:"h-7 text-xs"})]})]}),e==="number"&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Valor mínimo"}),o.jsx(ae,{type:"number",value:(t==null?void 0:t.min)??"",onChange:i=>a("min",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Valor máximo"}),o.jsx(ae,{type:"number",value:(t==null?void 0:t.max)??"",onChange:i=>a("max",i.target.value),className:"h-7 text-xs"})]})]}),(e==="date"||e==="datetime")&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Data mínima"}),o.jsx(ae,{type:"date",value:(t==null?void 0:t.minDate)??"",onChange:i=>a("minDate",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Data máxima"}),o.jsx(ae,{type:"date",value:(t==null?void 0:t.maxDate)??"",onChange:i=>a("maxDate",i.target.value),className:"h-7 text-xs"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Idade mínima (anos)"}),o.jsx(ae,{type:"number",min:0,value:(t==null?void 0:t.minAge)??"",onChange:i=>a("minAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 18"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Idade máxima (anos)"}),o.jsx(ae,{type:"number",min:0,value:(t==null?void 0:t.maxAge)??"",onChange:i=>a("maxAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 60"})]})]})]}),n&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(n0,{value:t==null?void 0:t.fileTypes,onChange:i=>r({...t,fileTypes:i})}),o.jsx(s0,{value:t==null?void 0:t.maxFileSize,onChange:i=>r({...t,maxFileSize:i})})]}),!n&&o.jsx(a0,{value:(t==null?void 0:t.regex)??"",message:(t==null?void 0:t.regexMessage)??"",onChange:(i,l)=>r({...t,regex:i,regexMessage:l})})]})},Cu=({options:e,onChange:t})=>{const r=E.useRef([]);if(r.current.length<e.length)for(let i=r.current.length;i<e.length;i++)r.current.push(`opt-${Math.random().toString(36).slice(2)}`);const a=E.useCallback((i,l,c)=>{const d=[...e];d[i]={...d[i],[l]:c},t(d)},[e,t]),n=E.useCallback(i=>{r.current.splice(i,1),t(e.filter((l,c)=>c!==i))},[e,t]),s=E.useCallback(()=>{t([...e,{value:"",label:""}])},[e,t]);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Opções"}),e.map((i,l)=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(P.GripVertical,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}),o.jsx(ae,{value:i.value,onChange:c=>a(l,"value",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Valor"}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-1",children:[o.jsx(ae,{value:i.label,onChange:c=>a(l,"label",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Label"}),o.jsx(ht,{})]}),o.jsx(ye,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>n(l),children:o.jsx(P.Trash2,{className:"h-3 w-3"})})]},r.current[l])),o.jsxs(ye,{variant:"outline",size:"sm",className:"w-full h-7 text-xs",onClick:s,children:[o.jsx(P.Plus,{className:"h-3 w-3 mr-1"})," Adicionar opção"]})]})},c0=[{value:"igual",label:"Igual a"},{value:"diferente",label:"Diferente de"},{value:"vazio",label:"Vazio"},{value:"naoVazio",label:"Não vazio"},{value:"contem",label:"Contém"},{value:"naoContem",label:"Não contém"},{value:"maiorQue",label:"Maior que"},{value:"menorQue",label:"Menor que"},{value:"maiorOuIgual",label:"Maior ou igual a"},{value:"menorOuIgual",label:"Menor ou igual a"}],d0=["vazio","naoVazio"],ui=({cond:e,selectedId:t,allFieldIds:r,getFieldLabel:a,onUpdate:n})=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Fonte"}),o.jsxs(Ge,{value:e.source||"campo",onValueChange:s=>n({source:s,when:""}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"campo",children:"Campo do formulário"}),o.jsx(Se,{value:"evento",children:"Variável do evento"})]})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:e.source==="evento"?"Variável do evento":"Quando o campo"}),o.jsxs(Ge,{value:e.when||"",onValueChange:s=>n({when:s}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{placeholder:e.source==="evento"?"Selecione uma variável...":"Selecione um campo..."})}),o.jsx(We,{children:e.source==="evento"?on.map(s=>o.jsx(Se,{value:s.key,children:s.label},s.key)):r.filter(s=>s!==t).map(s=>o.jsxs(Se,{value:s,children:[a(s),o.jsxs("span",{className:"text-muted-foreground/50 ml-1 text-[9px] font-mono",children:["(",s,")"]})]},s))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Operador"}),o.jsxs(Ge,{value:e.operator,onValueChange:s=>n({operator:s}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{})}),o.jsx(We,{children:c0.map(s=>o.jsx(Se,{value:s.value,children:s.label},s.value))})]})]}),!d0.includes(e.operator)&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Valor"}),o.jsx(ae,{value:e.value||"",onChange:s=>n({value:s.target.value}),className:"h-7 text-xs",placeholder:"Valor esperado"})]})]}),u0=({condition:e,selectedId:t,allFieldIds:r,getFieldLabel:a,onChange:n})=>{var s;const i=p=>{e&&n({...e,...p})},l=()=>{if(!e)return;const p=e.extraConditions??[];n({...e,logicOperator:e.logicOperator??"and",extraConditions:[...p,{when:"",operator:"igual",value:"",source:"campo"}]})},c=p=>{if(!e)return;const m=(e.extraConditions??[]).filter((h,g)=>g!==p);n({...e,extraConditions:m,logicOperator:m.length?e.logicOperator:void 0})},d=(p,m)=>{if(!e)return;const h=(e.extraConditions??[]).map((g,f)=>f===p?{...g,...m}:g);n({...e,extraConditions:h})},u=(((s=e==null?void 0:e.extraConditions)==null?void 0:s.length)??0)>0;return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Condicional"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"has-condition",checked:!!e,onCheckedChange:p=>{n(p?{when:"",operator:"igual",value:"",source:"campo"}:void 0)}}),o.jsx(W,{htmlFor:"has-condition",className:"text-xs cursor-pointer",children:"Exibir condicionalmente"})]}),e&&o.jsxs("div",{className:"space-y-2 pl-2 border-l-2 border-amber-500/30",children:[o.jsx(ui,{cond:e,selectedId:t,allFieldIds:r,getFieldLabel:a,onUpdate:i}),u&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Lógica"}),o.jsxs(Ge,{value:e.logicOperator??"and",onValueChange:p=>i({logicOperator:p}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"and",children:"E (AND) — todas devem ser verdadeiras"}),o.jsx(Se,{value:"or",children:"OU (OR) — pelo menos uma deve ser verdadeira"})]})]})]}),(e.extraConditions??[]).map((p,m)=>o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/40",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-[10px] text-muted-foreground font-medium uppercase",children:[e.logicOperator==="or"?"OU":"E"," — condição"," ",m+2]}),o.jsx(ye,{variant:"ghost",size:"sm",className:"h-5 px-1 text-[10px] text-destructive hover:text-destructive",onClick:()=>c(m),children:"Remover"})]}),o.jsx(ui,{cond:p,selectedId:t,allFieldIds:r,getFieldLabel:a,onUpdate:h=>d(m,h)})]},m)),o.jsx(ye,{variant:"outline",size:"sm",className:"h-6 text-[10px] w-full mt-1",onClick:l,children:"+ Adicionar condição"})]})]})},pi=[{value:"texto",label:"Texto"},{value:"textarea",label:"Área de texto"},{value:"number",label:"Número"},{value:"email",label:"E-mail"},{value:"telefone",label:"Telefone"},{value:"cpf",label:"CPF"},{value:"cep",label:"CEP"},{value:"date",label:"Data"},{value:"datetime",label:"Data e hora"},{value:"select",label:"Seleção"},{value:"radio",label:"Radio"},{value:"checkbox",label:"Checkbox"}],p0=({subFields:e,onChange:t})=>{const[r,a]=E.useState(null),n=(i,l)=>{const c=e.map((d,u)=>u===i?{...d,...l}:d);t(c)},s=i=>{t(e.filter((l,c)=>c!==i)),a(null)};return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs font-semibold",children:"Sub-campos"}),o.jsxs(ye,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs gap-1",onClick:()=>{const i={label:"Novo campo",name:`campo_${e.length+1}`,fieldType:"texto",required:!1};t([...e,i]),a(e.length)},children:[o.jsx(P.Plus,{className:"w-3 h-3"}),"Adicionar"]})]}),e.length===0&&o.jsx("p",{className:"text-[11px] text-muted-foreground italic py-1",children:"Nenhum sub-campo adicionado."}),e.map((i,l)=>{var c;return o.jsxs("div",{className:"border rounded-md text-xs overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-muted/40 select-none",onClick:()=>a(r===l?null:l),children:[o.jsx(qa,{variant:"secondary",className:"h-4 text-[9px] px-1 shrink-0",children:l+1}),o.jsx("span",{className:"flex-1 truncate font-medium",children:i.label||i.name||"Campo sem nome"}),o.jsx("span",{className:"text-muted-foreground text-[10px] shrink-0",children:((c=pi.find(d=>d.value===i.fieldType))==null?void 0:c.label)??i.fieldType}),o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 text-destructive hover:text-destructive shrink-0",onClick:d=>{d.stopPropagation(),s(l)},children:o.jsx(P.Trash2,{className:"w-3 h-3"})}),r===l?o.jsx(P.ChevronUp,{className:"w-3 h-3 text-muted-foreground shrink-0"}):o.jsx(P.ChevronDown,{className:"w-3 h-3 text-muted-foreground shrink-0"})]}),r===l&&o.jsxs("div",{className:"px-2 pb-2 space-y-2 border-t bg-muted/20",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Label"}),o.jsx(ae,{value:i.label,onChange:d=>n(l,{label:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: Nome"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Nome (campo)"}),o.jsx(ae,{value:i.name||"",onChange:d=>n(l,{name:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: nome"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Tipo de campo"}),o.jsxs(Ge,{value:i.fieldType,onValueChange:d=>n(l,{fieldType:d}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{})}),o.jsx(We,{children:pi.map(d=>o.jsx(Se,{value:d.value,className:"text-xs",children:d.label},d.value))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Colunas (1-12)"}),o.jsx(ae,{type:"number",min:1,max:12,value:i.tamanho??"",onChange:d=>n(l,{tamanho:d.target.value?Number(d.target.value):void 0}),className:"h-7 text-xs",placeholder:"12"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Placeholder"}),o.jsx(ae,{value:i.placeholder||"",onChange:d=>n(l,{placeholder:d.target.value}),className:"h-7 text-xs",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:`sf-req-${l}`,checked:i.required||!1,onCheckedChange:d=>n(l,{required:d===!0})}),o.jsx(W,{htmlFor:`sf-req-${l}`,className:"text-[10px] cursor-pointer",children:"Obrigatório"})]}),["select","radio","checkbox_group"].includes(i.fieldType)&&o.jsx("div",{className:"pt-1",children:o.jsx(Cu,{options:i.options||[],onChange:d=>n(l,{options:d})})})]})]},l)}),e.length>0&&o.jsx(Ze,{className:"mt-1"})]})},m0=({config:e,selectedId:t,allFieldIds:r,getFieldLabel:a,onUpdate:n})=>{const s=e.fieldType||"texto",i=["select","radio","checkbox_group","autocomplete"].includes(s),l=s==="field_array",c=e.locked===!0,d=s==="participation_type",u=s==="payment_method",p=s==="terms",m=s==="slider",h=s==="rating",g=s==="date_range",f=s==="sub_form",{schemaId:v,uploadTermsPdf:b}=Je(),[w,y]=E.useState(e.termoPdfUploadId?"upload":"link"),[N,C]=E.useState({status:"idle"}),_=E.useRef(null),k=E.useCallback(async j=>{if(!v){C({status:"error",message:"Salve o schema primeiro para habilitar o upload de PDF."});return}if(!b){C({status:"error",message:"Upload de PDF não configurado. Forneça a prop uploadTermsPdf ao BuilderProvider."});return}C({status:"uploading",fileName:j.name,progress:0});try{const R=await b(j,v);n({termoPdfUploadId:R,termoPdfUrl:void 0}),C({status:"idle"})}catch(R){C({status:"error",message:R instanceof Error?R.message:"Falha no upload do PDF."})}},[v,b,n]);return o.jsxs("div",{className:"space-y-4",children:[c&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/10 border border-amber-500/30 px-3 py-2",children:[o.jsx(P.Lock,{className:"h-4 w-4 text-amber-500 shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-amber-600 dark:text-amber-400",children:"Campo bloqueado"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tipo, nome e ID são fixos (integração automática)"})]})]}),d&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(P.Lock,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Tipo de Participação"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Datas, preços e vagas são carregados automaticamente do evento"})]})]}),p&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(P.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Termos e Condições"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Configure o texto ou URL do PDF abaixo"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Label"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.label,onChange:j=>n({label:j.target.value}),className:"h-8 text-sm"})]}),d||u?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ae,{value:e.hint||"",onChange:j=>n({hint:j.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"req",checked:e.required||!1,onCheckedChange:j=>n({required:j===!0})}),o.jsx(W,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]})]}):p?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ae,{value:e.hint||"",onChange:j=>n({hint:j.target.value}),className:"h-8 text-sm",placeholder:"Ex: Leia os termos antes de continuar"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"req",checked:e.required||!1,onCheckedChange:j=>n({required:j===!0})}),o.jsx(W,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Conteúdo dos termos"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Texto dos termos"}),o.jsx(Ba,{value:e.termoTexto||"",onChange:j=>n({termoTexto:j.target.value||void 0}),className:"text-sm min-h-[120px] resize-y",placeholder:"Escreva aqui os termos e condições que o usuário deverá ler e aceitar..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(W,{className:"text-xs",children:"PDF dos termos (opcional)"}),o.jsxs("div",{className:"flex gap-1 p-0.5 bg-muted rounded-md",children:[o.jsx("button",{type:"button",onClick:()=>y("link"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${w==="link"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Link externo"}),o.jsx("button",{type:"button",onClick:()=>y("upload"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${w==="upload"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Upload de PDF"})]}),w==="link"?o.jsxs("div",{className:"space-y-1",children:[o.jsx(ae,{value:e.termoPdfUrl||"",onChange:j=>n({termoPdfUrl:j.target.value||void 0}),className:"h-8 text-sm",placeholder:"https://exemplo.com/termos.pdf"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"URL pública de um PDF. Tem prioridade sobre o texto acima."})]}):o.jsxs("div",{className:"space-y-2",children:[e.termoPdfUploadId&&N.status==="idle"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-green-500/40 bg-green-500/10 px-2 py-1.5",children:[o.jsx(P.CheckCircle2,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),o.jsx("span",{className:"text-[11px] text-green-700 dark:text-green-400 flex-1",children:"PDF enviado ✓"}),o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>{n({termoPdfUploadId:void 0})},children:o.jsx(P.X,{className:"h-3 w-3"})})]}):null,N.status==="uploading"?o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[o.jsx(P.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),o.jsx("span",{className:"truncate",children:N.fileName}),o.jsxs("span",{className:"ml-auto",children:[N.progress,"%"]})]}),o.jsx(fu,{value:N.progress,className:"h-1"})]}):null,N.status==="error"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-destructive/40 bg-destructive/10 px-2 py-1.5",children:[o.jsx(P.AlertCircle,{className:"h-3.5 w-3.5 text-destructive shrink-0"}),o.jsx("span",{className:"text-[11px] text-destructive",children:N.message}),o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 ml-auto",onClick:()=>C({status:"idle"}),children:o.jsx(P.X,{className:"h-3 w-3"})})]}):null,N.status!=="uploading"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:_,type:"file",accept:"application/pdf",className:"hidden",onChange:j=>{var R;const A=(R=j.target.files)==null?void 0:R[0];A&&k(A),j.target.value=""}}),o.jsxs(ye,{type:"button",variant:"outline",size:"sm",className:"w-full h-8 text-xs gap-1.5",disabled:!v,onClick:()=>{var j;return(j=_.current)==null?void 0:j.click()},children:[o.jsx(P.Upload,{className:"h-3.5 w-3.5"}),e.termoPdfUploadId?"Substituir PDF":"Selecionar PDF"]}),!v&&o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Salve o schema uma vez para habilitar o upload."})]}):null]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Nome (chave)"}),o.jsx(ae,{value:e.name||t.replace(/^field_/,""),onChange:j=>!c&&n({name:j.target.value}),className:"h-8 text-xs font-mono",placeholder:"nome_do_campo",disabled:c}),c?o.jsx("p",{className:"text-[9px] text-amber-500",children:"ID fixo — necessário para auto-preenchimento"}):o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Usado como chave no JSON do formulário"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Tipo do campo"}),o.jsxs(Ge,{value:s,onValueChange:j=>!c&&n({fieldType:j}),disabled:c,children:[o.jsx(He,{className:"h-8 text-sm",children:o.jsx(Ye,{})}),o.jsx(We,{children:St.map(j=>o.jsx(Se,{value:j.component,children:j.label},j.component))})]})]}),o.jsx(lu,{tamanho:e.tamanho||6,inicioColuna:e.inicioColuna||1,defaultTamanho:6,onTamanhoChange:j=>n({tamanho:j}),onPositionChange:j=>n({inicioColuna:j})}),s!=="file"&&!l&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Placeholder"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.placeholder||"",onChange:j=>n({placeholder:j.target.value}),className:"h-8 text-sm",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.hint||"",onChange:j=>n({hint:j.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),s!=="file"&&!l&&!f&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Valor padrão"}),o.jsx(ae,{value:e.defaultValue||"",onChange:j=>n({defaultValue:j.target.value}),className:"h-8 text-sm",placeholder:"Valor inicial do campo"})]}),s!=="file"&&!l&&!f&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Valor inicial (runtime)"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.initialValue||"",onChange:j=>n({initialValue:j.target.value||void 0}),className:"h-8 text-sm",placeholder:"{{evento.nome}} ou valor fixo"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:['Sobrepõe "Valor padrão" — suporta variáveis'," ",o.jsx("code",{children:"{{evento.x}}"})]})]}),!l&&!f&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"req",checked:e.required||!1,onCheckedChange:j=>n({required:j===!0})}),o.jsx(W,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),!l&&!f&&!c&&o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"readonly",checked:e.isReadOnly||!1,onCheckedChange:j=>n({isReadOnly:j===!0||void 0})}),o.jsx(W,{htmlFor:"readonly",className:"text-xs cursor-pointer",children:"Somente leitura"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"disabled",checked:e.isDisabled||!1,onCheckedChange:j=>n({isDisabled:j===!0||void 0})}),o.jsx(W,{htmlFor:"disabled",className:"text-xs cursor-pointer",children:"Desabilitado"})]})]}),m&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Slider"}),o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Mínimo"}),o.jsx(ae,{type:"number",value:e.minValue??0,onChange:j=>n({minValue:Number(j.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Máximo"}),o.jsx(ae,{type:"number",value:e.maxValue??100,onChange:j=>n({maxValue:Number(j.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Passo"}),o.jsx(ae,{type:"number",min:1,value:e.step??1,onChange:j=>n({step:Number(j.target.value)}),className:"h-8 text-sm"})]})]})]})]}),h&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Avaliação"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Número de estrelas"}),o.jsxs(Ge,{value:String(e.maxRating??5),onValueChange:j=>n({maxRating:Number(j)}),children:[o.jsx(He,{className:"h-8 text-sm",children:o.jsx(Ye,{})}),o.jsx(We,{children:[3,4,5,6,7,10].map(j=>o.jsxs(Se,{value:String(j),children:[j," estrelas"]},j))})]})]})]})]}),g&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Período"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Label da data inicial"}),o.jsx(ae,{value:e.dateRangeStartLabel??"Data inicial",onChange:j=>n({dateRangeStartLabel:j.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Label da data final"}),o.jsx(ae,{value:e.dateRangeEndLabel??"Data final",onChange:j=>n({dateRangeEndLabel:j.target.value}),className:"h-8 text-sm"})]})]})]}),!l&&o.jsx(Ze,{}),!l&&o.jsx(l0,{fieldType:s,validation:e.validation,onChange:j=>n({validation:j})}),i&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),s==="radio"&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Estilo visual"}),o.jsxs(Ge,{value:e.visualStyle||"card",onValueChange:j=>n({visualStyle:j}),children:[o.jsx(He,{className:"h-8 text-sm",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"card",children:"Card (padrão)"}),o.jsx(Se,{value:"default",children:"Radio simples"})]})]})]}),o.jsx(Cu,{options:e.options||[],onChange:j=>n({options:j})})]}),l&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Lista de itens"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Mín. itens"}),o.jsx(ae,{type:"number",min:0,value:e.minItems??"",onChange:j=>n({minItems:j.target.value?Number(j.target.value):void 0}),className:"h-8 text-sm",placeholder:"0"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Máx. itens"}),o.jsx(ae,{type:"number",min:0,value:e.maxItems??"",onChange:j=>n({maxItems:j.target.value?Number(j.target.value):void 0}),className:"h-8 text-sm",placeholder:"Sem limite"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Label do item"}),o.jsx(ae,{value:e.itemLabel||"",onChange:j=>n({itemLabel:j.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Contato"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:'Prefixo exibido em cada item (ex: "Contato 1", "Contato 2")'})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Label do botão adicionar"}),o.jsx(ae,{value:e.addLabel||"",onChange:j=>n({addLabel:j.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Adicionar contato"})]}),o.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2",children:o.jsx("p",{className:"text-[11px] text-amber-700 dark:text-amber-400",children:"Os sub-campos são configurados visualmente no canvas: arraste campos da paleta para dentro da caixa laranja."})})]})]}),f&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Sub-formulário"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Título do grupo (opcional)"}),o.jsx(ae,{value:e.subSchemaTitle||"",onChange:j=>n({subSchemaTitle:j.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Endereço, Responsável..."})]}),o.jsx(p0,{subFields:e.subSchemaFields||[],onChange:j=>n({subSchemaFields:j})})]})]}),o.jsx(Ze,{}),o.jsx(u0,{condition:e.condition,selectedId:t,allFieldIds:r,getFieldLabel:a,onChange:j=>n({condition:j})}),e.condition&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Valor ao ocultar (clearedValue)"}),o.jsx(ae,{value:e.clearedValue??"",onChange:j=>n({clearedValue:j.target.value||void 0}),className:"h-8 text-sm",placeholder:"Deixar vazio = não limpar"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Valor aplicado automaticamente quando o campo fica oculto."})]}),!l&&!f&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs text-muted-foreground",children:"Resolver de props (avançado)"}),o.jsx(ae,{value:e.resolvePropsKey||"",onChange:j=>n({resolvePropsKey:j.target.value||void 0}),className:"h-8 text-xs font-mono",placeholder:"chaveDoResolver"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Registre este key em"," ",o.jsx("code",{children:"RendererContext.fieldResolvers"})," para opções dinâmicas."]})]})]})]})},f0=()=>{const{selectedId:e,getConfig:t,updateConfig:r,getAllFieldIds:a}=Je();if(!e)return o.jsx("div",{className:"rounded-xl border bg-card p-4 text-center text-sm text-muted-foreground",children:"Clique em um item para configurá-lo"});const n=t(e),s=Ne(e),i=c=>r(e,c),l=a().filter(c=>c!==e);return o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"text-sm font-bold text-foreground",children:s==="step"?"Step":s==="container"?"Container":"Campo"}),o.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:e})]}),o.jsx(Ze,{}),s==="step"&&o.jsx(Tb,{config:n,onUpdate:i}),s==="container"&&o.jsx(Ey,{config:n,onUpdate:i}),s==="field"&&o.jsx(m0,{config:n,selectedId:e,allFieldIds:l,getFieldLabel:c=>t(c).label||c,onUpdate:i})]})},h0=(e,t)=>{var r,a,n,s,i,l;const c=((a=(r=e==null?void 0:e.containers)==null?void 0:r.root)==null?void 0:a.children)||[],d=[];for(const u of c){if(Ne(u)!=="step")continue;const p=((s=(n=e==null?void 0:e.containers)==null?void 0:n[u])==null?void 0:s.children)||[],m=[];for(const h of p){if(Ne(h)!=="container")continue;const g=(((l=(i=e==null?void 0:e.containers)==null?void 0:i[h])==null?void 0:l.children)||[]).filter(f=>Ne(f)==="field").map(f=>{var v,b;const w=t(f),y={id:f,config:w};if(w.fieldType==="field_array"){const N=((b=(v=e==null?void 0:e.containers)==null?void 0:v[f])==null?void 0:b.children)??[];y.subFields=N.filter(C=>Ne(C)==="field").map(C=>({id:C,config:t(C)}))}return y});m.push({id:h,config:t(h),fields:g})}d.push({id:u,config:t(u),containers:m})}return d},Za=(e,t,r)=>{var a;if(!e||!e.when)return!0;const n=e.source==="evento"?(r==null?void 0:r[e.when])||"":t[e.when]||"",s=parseFloat(n),i=parseFloat(e.value||"");let l;switch(e.operator){case"igual":l=n===(e.value||"");break;case"diferente":l=n!==(e.value||"");break;case"vazio":l=!n;break;case"naoVazio":l=!!n;break;case"contem":l=n.includes(e.value||"");break;case"naoContem":l=!n.includes(e.value||"");break;case"maiorQue":l=!isNaN(s)&&!isNaN(i)&&s>i;break;case"menorQue":l=!isNaN(s)&&!isNaN(i)&&s<i;break;case"maiorOuIgual":l=!isNaN(s)&&!isNaN(i)&&s>=i;break;case"menorOuIgual":l=!isNaN(s)&&!isNaN(i)&&s<=i;break;default:l=!0}if(e.logicOperator&&(a=e.extraConditions)!=null&&a.length){const c=e.extraConditions.map(d=>Za(d,t,r));return e.logicOperator==="and"?l&&c.every(Boolean):l||c.some(Boolean)}return l},mi=(e,t,r,a)=>{if(!Za(t.condition,r,a))return;const n=t.validation,s=t.fieldType||"texto";if(t.required&&!e)return"Campo obrigatório";if(e){if(n!=null&&n.minLength&&e.length<n.minLength)return`Mínimo ${n.minLength} caracteres`;if(n!=null&&n.maxLength&&e.length>n.maxLength)return`Máximo ${n.maxLength} caracteres`;if(s==="number"){const i=Number(e);if(!isNaN(i)){if((n==null?void 0:n.min)!==void 0&&i<n.min)return`Valor mínimo: ${n.min}`;if((n==null?void 0:n.max)!==void 0&&i>n.max)return`Valor máximo: ${n.max}`}}if((s==="date"||s==="datetime")&&e){if(n!=null&&n.minDate&&e<n.minDate)return`Data mínima: ${n.minDate}`;if(n!=null&&n.maxDate&&e>n.maxDate)return`Data máxima: ${n.maxDate}`}if(n!=null&&n.regex)try{if(!new RegExp(n.regex).test(e))return n.regexMessage||"Formato inválido"}catch{}}},fi={email:"teste@email.com",number:"123",telefone:"(11) 99999-9999",cpf:"123.456.789-00",cep:"01001-000",date:new Date().toISOString().slice(0,10),datetime:new Date().toISOString().slice(0,10),textarea:"Texto de teste para preview",checkbox:"true",hidden:"",participation_type:JSON.stringify({tipo:"todos_os_dias",data:null,genero:null}),payment_method:JSON.stringify({metodo:"pix",valorTotal:0}),terms:""},Su=(e,t)=>{var r;const a=e.fieldType||"texto";if(a==="field_array"){const n=Math.max(e.minItems??1,1),s=Array.from({length:n},()=>{const i={};return t==null||t.forEach(l=>{i[l.id]=Su(l.config)}),i});return JSON.stringify(s)}return fi[a]!==void 0?fi[a]:(a==="select"||a==="radio")&&(r=e.options)!=null&&r.length?e.options[0].value||"":"Teste"},x0={glassmorphism:"Glass",card:"Card",flat:"Flat",bordered:"Bordered"},g0=()=>{const{previewTemplateId:e,setPreviewTemplateId:t}=Je(),[r,a]=E.useState(!1),n=Object.values(zt),s=zt[e];return o.jsxs(Ia,{open:r,onOpenChange:a,children:[o.jsx(La,{asChild:!0,children:o.jsxs(ye,{variant:"outline",size:"sm",className:"gap-1.5",title:"Selecionar template visual",children:[o.jsx("span",{className:"w-3.5 h-3.5 rounded-full shrink-0 border border-white/20",style:{background:(s==null?void 0:s.colors.primary)??"#3b82f6"}}),o.jsx(P.Palette,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"hidden sm:inline",children:(s==null?void 0:s.displayName)??"Template"})]})}),o.jsxs(Pr,{side:"bottom",align:"end",className:"w-80 p-3",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase tracking-wider",children:"Template de Preview"}),o.jsx("div",{className:"grid grid-cols-3 gap-1.5 max-h-72 overflow-y-auto pr-0.5",children:n.map(i=>{const l=i.id===e,c=yi(i),d=x0[i.layout.containerStyle]??"";return o.jsxs("button",{onClick:()=>{t(i.id),a(!1)},className:G("relative flex flex-col items-center gap-1.5 rounded-lg p-2 border text-center transition-all hover:scale-[1.02]",l?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsxs("div",{className:"w-full h-8 rounded-md flex items-center justify-center gap-0.5",style:{background:i.colors.background.startsWith("#")||i.colors.background.startsWith("rgba")?i.colors.background:void 0},"data-muted":!i.colors.background.startsWith("#")&&!i.colors.background.startsWith("rgba")?"true":void 0,children:[o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.primary}}),o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.accent}})]}),o.jsx("span",{className:"text-[10px] font-medium leading-tight line-clamp-2",children:i.displayName}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-wrap justify-center",children:[c&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-zinc-800 text-zinc-300",children:"dark"}),d&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-muted text-muted-foreground",children:d})]}),l&&o.jsx("div",{className:"absolute top-1 right-1",children:o.jsx(P.Check,{className:"w-3 h-3 text-primary"})})]},i.id)})})]})]})},v0=({onFillMock:e,onClear:t})=>o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(g0,{}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(ye,{variant:"outline",size:"sm",onClick:e,children:[o.jsx(P.FlaskConical,{className:"w-3.5 h-3.5 mr-1"}),"Preencher mock"]}),o.jsxs(ye,{variant:"ghost",size:"sm",onClick:t,children:[o.jsx(P.Eraser,{className:"w-3.5 h-3.5 mr-1"}),"Limpar"]})]})]}),b0={texto:"text",number:"number",email:"email",telefone:"tel",cpf:"text",cep:"text",date:"date",datetime:"datetime-local"},ku=e=>b0[e]||"text",Jt=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,y0=({config:e,fieldId:t,subFields:r,tamanho:a,error:n,onChange:s,value:i})=>{const l=e.minItems??1,c=e.maxItems??10,d=e.itemLabel||"Item",u=e.addLabel||`Adicionar ${d}`,p=E.useRef(i||""),m=E.useCallback(()=>Object.fromEntries(r.map(C=>[C.id,""])),[r]),[h,g]=E.useState(()=>{if(i)try{const C=JSON.parse(i);if(Array.isArray(C)&&C.length>0)return C}catch{}return[m()]}),[f,v]=E.useState({});E.useEffect(()=>{if(i!==p.current){if(p.current=i||"",!i){g([m()]);return}try{const C=JSON.parse(i);Array.isArray(C)&&g(C)}catch{}}},[i,m]),E.useEffect(()=>{if(!n){v({});return}const C={};h.forEach((_,k)=>{r.forEach(j=>{const R=_[j.id]??"";j.config.required&&!R.trim()&&(C[`${k}.${j.id}`]="Campo obrigatório")})}),v(C)},[n,h,r]);const b=C=>{if(!s)return;const _=C.map(j=>{const R={};return r.forEach(A=>{R[A.id]=j[A.id]??""}),R}),k=JSON.stringify(_);p.current=k,s(k)},w=()=>{if(h.length>=c)return;const C=[...h,m()];g(C),b(C)},y=C=>{if(h.length<=l)return;const _=h.filter((k,j)=>j!==C);g(_),b(_)},N=(C,_,k)=>{const j=h.map((R,A)=>A===C?{...R,[_]:k}:R);g(j),b(j),v(R=>{const A={...R};return delete A[`${C}.${_}`],A})};return o.jsxs("div",{className:"space-y-2",style:{gridColumn:`span ${a}`},children:[e.label&&o.jsx(W,{className:"text-sm font-medium",children:e.label}),o.jsx("div",{className:"space-y-3",children:h.map((C,_)=>o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-3 shadow-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-orange-500 text-white text-xs font-bold shrink-0",children:_+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[d," ",_+1]})]}),h.length>l&&o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive/60 hover:text-destructive",onClick:()=>y(_),children:o.jsx(P.Trash2,{className:"h-4 w-4"})})]}),r.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Sem sub-campos configurados"}):o.jsx("div",{className:"grid grid-cols-12 gap-3",children:r.map(k=>{const j=k.config.fieldType||"texto",R=k.config.tamanho||6,A=C[k.id]??"",I=V=>N(_,k.id,V),F=f[`${_}.${k.id}`];return o.jsxs("div",{className:"space-y-1",style:{gridColumn:`span ${R}`},children:[o.jsxs(W,{className:"text-xs font-medium",children:[k.config.label,k.config.required&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),j==="textarea"?o.jsx(Ba,{placeholder:k.config.placeholder,className:F?"text-sm border-destructive":"text-sm",value:A,onChange:V=>I(V.target.value)}):j==="select"?o.jsxs(Ge,{value:A,onValueChange:I,children:[o.jsx(He,{className:F?"text-sm border-destructive":"text-sm",children:o.jsx(Ye,{placeholder:k.config.placeholder||"Selecione..."})}),o.jsx(We,{children:(k.config.options||[]).map((V,M)=>o.jsx(Se,{value:V.value||`__opt_${M}`,children:V.label},`${M}-${V.value}`))})]}):j==="checkbox"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{checked:A==="true",onCheckedChange:V=>I(V?"true":"")}),o.jsx("span",{className:"text-sm text-muted-foreground",children:k.config.placeholder||k.config.label})]}):o.jsx(ae,{type:ku(j),placeholder:k.config.placeholder,className:F?"text-sm border-destructive":"text-sm",value:A,onChange:V=>I(V.target.value)}),F&&o.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[o.jsx(P.AlertCircle,{className:"h-3 w-3 shrink-0"}),F]})]},k.id)})})]},_))}),o.jsxs(ye,{type:"button",variant:"outline",className:"w-full border-dashed border-orange-500 text-orange-500 hover:bg-orange-500/10 hover:text-orange-500 font-semibold",onClick:w,disabled:h.length>=c,children:[o.jsx(P.Plus,{className:"h-4 w-4 mr-2"}),u]}),e.maxItems&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",e.maxItems," ",d.toLowerCase(),e.maxItems!==1?"s":""]}),!e.maxItems&&e.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:e.hint}),n&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(P.AlertCircle,{className:"h-4 w-4 shrink-0"}),n]})]})},w0=({config:e,fieldId:t,value:r,onChange:a,visible:n,error:s,subFields:i,eventoData:l,allValues:c})=>{const d=e.fieldType||"texto",u=e.tamanho||6;if(!n)return null;if(d==="field_array")return o.jsx(y0,{config:e,fieldId:t,subFields:i??[],tamanho:u,error:s,onChange:a,value:r});const p=s?"border-destructive":"";return o.jsxs("div",{className:"space-y-1",style:{gridColumn:e.inicioColuna?`${e.inicioColuna} / span ${u}`:`span ${u}`},children:[d!=="terms"&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs(W,{className:"text-sm font-medium",children:[e.label,e.required&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.condition&&o.jsxs(qa,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 border-amber-500/50 text-amber-600",children:[o.jsx(P.Zap,{className:"h-2.5 w-2.5 mr-0.5"}),"cond"]})]}),d==="textarea"?o.jsx(Ba,{placeholder:e.placeholder,className:G("text-sm",p),value:r,onChange:m=>a(m.target.value)}):d==="select"?o.jsxs(Ge,{value:r,onValueChange:a,children:[o.jsx(He,{className:G("text-sm",p),children:o.jsx(Ye,{placeholder:e.placeholder||"Selecione..."})}),o.jsx(We,{children:(e.options||[]).map((m,h)=>o.jsx(Se,{value:m.value||`__opt_${h}`,children:m.label},`${h}-${m.value}`))})]}):d==="checkbox"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{checked:r==="true",onCheckedChange:m=>a(m?"true":"")}),o.jsx("span",{className:"text-sm text-muted-foreground",children:e.placeholder||e.label})]}):d==="checkbox_group"?o.jsx(j0,{config:e,value:r,onChange:a}):d==="radio"?o.jsx("div",{className:"space-y-2",children:(e.options||[{value:"1",label:"Opção 1"}]).map((m,h)=>e.visualStyle==="default"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"radio",readOnly:!0,checked:r===m.value,className:"accent-orange-500"}),o.jsx("span",{className:"text-sm",children:m.label})]},`${h}-${m.value}`):o.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border-2 transition-all cursor-pointer bg-card border-border",children:[o.jsx("input",{type:"radio",readOnly:!0,checked:r===m.value,className:"accent-orange-500"}),o.jsx("span",{className:"text-sm flex-1",children:m.label})]},`${h}-${m.value}`))}):d==="participation_type"?(()=>{const m=parseInt((l==null?void 0:l["evento.valor"])??"0")||0,h=parseInt((l==null?void 0:l["evento.valorPorDia"])??"0")||0,g=l==null?void 0:l["evento.vagasTotal"],f=l==null?void 0:l["evento.vagasPorDia"],v=l==null?void 0:l["evento.vagasMasculinas"],b=l==null?void 0:l["evento.vagasFemininas"],w=!!(v&&Number(v)>0)&&!!(b&&Number(b)>0),y=l==null?void 0:l["evento.dataInicioEvento"],N=l==null?void 0:l["evento.dataFimEvento"],C=T=>T?T.slice(8,10)+"/"+T.slice(5,7)+"/"+T.slice(0,4):"—",_=y&&N?`${C(y)} a ${C(N)}`:"Período do evento",k=(y&&N?Math.round((new Date(N.slice(0,10)+"T00:00:00Z").getTime()-new Date(y.slice(0,10)+"T00:00:00Z").getTime())/864e5)+1:0)>1;let j={};try{j=r?JSON.parse(r):{}}catch{}const R=j.tipo??null,A=j.data??null,I=j.genero??null,F=T=>a(JSON.stringify({tipo:T,data:null,...w?{genero:I}:{}})),V=T=>a(JSON.stringify({tipo:"por_dia",data:T,...w?{genero:I}:{}})),M=T=>a(JSON.stringify({tipo:R,data:A,genero:T})),U=[];if(k&&y&&N){const T=new Date(y.slice(0,10)+"T00:00:00Z"),D=new Date(N.slice(0,10)+"T00:00:00Z");let z=0;for(;T<=D&&z++<60;)U.push(T.toISOString().slice(0,10)),T.setUTCDate(T.getUTCDate()+1)}const $=T=>{const[D,z,L]=T.split("-").map(Number),ee=new Date(Date.UTC(D,z-1,L)),Y=String(L).padStart(2,"0"),J=String(z).padStart(2,"0"),q=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(ee);return`${Y}/${J} — ${q.charAt(0).toUpperCase()}${q.slice(1)}`};return o.jsxs("div",{className:"space-y-2",children:[w&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(T=>{const D=T==="masculino"?"Masculino":"Feminino";return o.jsx("button",{type:"button",onClick:()=>M(T),className:G("px-3 py-1 rounded-full text-xs font-medium border transition-all",I===T?"border-primary bg-primary text-primary-foreground":"border-border bg-card text-muted-foreground hover:border-primary/60"),children:D},T)})})]}),o.jsxs("button",{type:"button",onClick:()=>F("todos_os_dias"),className:G("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all bg-card",R==="todos_os_dias"?"border-primary bg-primary/10":"border-border hover:border-primary/40"),children:[o.jsx("div",{className:G("mt-0.5 p-2 rounded-lg shrink-0",R==="todos_os_dias"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:o.jsx(P.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar todos os dias"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:_})]}),o.jsxs("div",{className:"text-right shrink-0",children:[o.jsx("p",{className:G("text-sm font-bold",R==="todos_os_dias"?"text-primary":"text-foreground"),children:m>0?Jt(m):"R$ —,—"}),g&&o.jsxs("p",{className:"text-xs text-emerald-500 flex items-center justify-end gap-1",children:[o.jsx(P.Users,{className:"w-3 h-3"}),g," vagas"]})]})]}),k?o.jsxs("button",{type:"button",onClick:()=>F("por_dia"),className:G("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all bg-card",R==="por_dia"?"border-primary bg-primary/10":"border-border hover:border-primary/40"),children:[o.jsx("div",{className:G("mt-0.5 p-2 rounded-lg shrink-0",R==="por_dia"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:o.jsx(P.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[o.jsx("p",{className:G("text-sm font-bold",R==="por_dia"?"text-primary":"text-foreground"),children:h>0?Jt(h):"R$ —,—"}),f&&o.jsxs("p",{className:"text-xs text-emerald-500 flex items-center justify-end gap-1",children:[o.jsx(P.Users,{className:"w-3 h-3"}),f," vagas/dia"]})]})]}):y?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg bg-muted/50 border border-border",children:[o.jsx(P.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Evento de 1 dia — a opção "Participar um dia" não é exibida.'})]}):o.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl border-2 border-border bg-card opacity-40",children:[o.jsx("div",{className:"mt-0.5 p-2 rounded-lg shrink-0 bg-muted text-muted-foreground",children:o.jsx(P.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Visível se evento tiver 2+ dias"})]}),o.jsx("div",{className:"text-right shrink-0",children:o.jsx("p",{className:"text-sm font-bold text-primary",children:"R$ —,—"})})]}),R==="por_dia"&&U.length>0&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold text-primary uppercase tracking-wide",children:"Selecione o dia:"}),U.map(T=>o.jsxs("button",{type:"button",onClick:()=>V(T),className:G("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",A===T?"border-primary bg-primary/10 text-primary":"border-border bg-card hover:border-primary/40"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:G("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center",A===T?"border-primary bg-primary":"border-muted-foreground"),children:A===T&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-primary-foreground"})}),o.jsx("span",{className:"text-sm",children:$(T)})]}),f&&o.jsxs("span",{className:"text-xs text-emerald-500",children:[f," vagas"]})]},T))]})]})})():d==="payment_method"?(()=>{const m=(c==null?void 0:c._participation_type_field)??"";let h={};try{h=m?JSON.parse(m):{}}catch{}const g=h.tipo??null,f=Number((l==null?void 0:l["evento.valor"])??0)||0,v=Number((l==null?void 0:l["evento.valorPorDia"])??0)||0,b=g==="por_dia"&&v>0?v:f,w=g==="por_dia"?(()=>{if(!h.data)return"Um dia";const[k,j,R]=h.data.split("-");return`${R}/${j}/${k}`})():"Todos os dias",y=g==="por_dia"?[{id:"pix",label:"PIX",desc:"Transferência instantânea (à vista)",taxa:0,parcelas:0},{id:"dinheiro",label:"Dinheiro",desc:"Pagamento em espécie",taxa:0,parcelas:0},{id:"cartao",label:"Cartão de Crédito",desc:"Débito ou crédito na maquininha",taxa:.0315,parcelas:0,taxaLabel:`Taxa InfinityPay: ${(.0315*100).toFixed(2).replace(".",",")}%`}]:[{id:"pix",label:"PIX à Vista",desc:"Pagamento instantâneo sem parcelamento",taxa:0,parcelas:0},{id:"pix_parcelado",label:"PIX Parcelado",desc:"Parcelado em até 7x sem juros",taxa:0,parcelas:7},{id:"cartao",label:"Cartão de Crédito",desc:"Parcelado em até 12x",taxa:.124,parcelas:12,taxaLabel:`Taxa InfinityPay: ${(.124*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",desc:"Pagamento em espécie",taxa:0,parcelas:0}];let N={};try{N=r?JSON.parse(r):{}}catch{}const C=N.metodo??null,_=k=>{const j=Math.round(b*(1+k.taxa)*100)/100,R={metodo:k.id,valorTotal:j};k.parcelas>1&&(R.parcelas=k.parcelas),a(JSON.stringify(R))};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:w})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold text-primary",children:Jt(b)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2.5",children:[o.jsx(P.Info,{className:"h-4 w-4 text-amber-500 mt-0.5 shrink-0"}),o.jsxs("p",{className:"text-xs text-amber-200",children:[o.jsx("span",{className:"font-bold text-amber-400",children:"Importante:"})," ","Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:y.map(k=>{const j=C===k.id,R=Math.round(b*(1+k.taxa)*100)/100,A=k.parcelas>1,I=A?Math.round(R/k.parcelas*100)/100:null;return o.jsxs("button",{type:"button",onClick:()=>_(k),className:G("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all bg-card",j?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:[o.jsx("div",{className:G("flex items-center justify-center w-10 h-10 rounded-lg shrink-0",j?"bg-primary/20":"bg-muted"),children:o.jsx(P.Wallet,{className:G("h-5 w-5",j?"text-primary":"text-muted-foreground")})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:k.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:k.desc}),k.taxaLabel&&o.jsxs("p",{className:"text-xs text-amber-400 mt-0.5",children:["* ",k.taxaLabel]}),k.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",Jt(R)]})]}),o.jsx("div",{className:"text-right shrink-0",children:A?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[k.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:Jt(I)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:Jt(R)})})]},k.id)})})]})})():d==="terms"?(()=>{const m=r==="accepted",h=e.termoTexto,g=e.termoPdfUrl,f=!!e.termoPdfUploadId,v=!!(h||g||f);return o.jsxs("div",{className:G("rounded-lg border p-4 space-y-4 transition-colors",m?"border-green-500/40 bg-green-500/5":"border-border bg-muted/30"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(P.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:e.label||"Termos e condições"})]}),v?o.jsxs("div",{className:"flex items-center gap-1.5",children:[f&&o.jsx("span",{className:"flex items-center gap-1 text-[10px] text-green-600 dark:text-green-400 font-medium border border-green-500/40 bg-green-500/10 rounded px-1.5 py-0.5",children:"PDF enviado ✓"}),o.jsxs(ye,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{},children:[o.jsx(P.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]})]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(Pe,{checked:m,onCheckedChange:b=>a(b?"accepted":""),className:"mt-0.5"}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito"," ",e.label?`"${e.label}"`:"os termos e condições"]}),m&&o.jsx(P.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]})})():d==="file"?o.jsx(ae,{type:"file",className:G("text-sm",p)}):d==="hidden"?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Campo oculto"}):o.jsx(ae,{type:ku(d),placeholder:e.placeholder,className:G("text-sm",p),value:r,onChange:m=>a(m.target.value)}),s?o.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[o.jsx(P.AlertCircle,{className:"h-3 w-3 shrink-0"}),s]}):e.hint?o.jsx("p",{className:"text-xs text-muted-foreground",children:e.hint}):null]})},j0=({config:e,value:t,onChange:r})=>{var a;const n=new Set(t?t.split(","):[]),s=(a=e.options)!=null&&a.length?e.options:[{value:"1",label:"Opção 1"}],i=l=>{const c=new Set(n);c.has(l)?c.delete(l):c.add(l),r(Array.from(c).join(","))};return o.jsx("div",{className:"space-y-1",children:s.map((l,c)=>o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{checked:n.has(l.value),onCheckedChange:()=>i(l.value),disabled:l.disabled}),o.jsx("span",{className:"text-sm",children:l.label})]},`${c}-${l.value}`))})},N0=({step:e,stepIndex:t,formValues:r,errors:a,eventoData:n,onChange:s})=>o.jsxs("div",{className:"rounded-xl border bg-card p-5 space-y-5",children:[o.jsxs("div",{children:[e.config.showLabel!==!1&&o.jsxs("h2",{className:"text-base font-bold text-foreground",children:["Step ",t+1," — ",e.config.label]}),e.config.description&&o.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:e.config.description})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4",children:e.containers.map(i=>o.jsxs("div",{className:G("space-y-3",i.config.showAsCard&&"rounded-lg border bg-card p-4 shadow-sm"),style:{gridColumn:i.config.inicioColuna?`${i.config.inicioColuna} / span ${i.config.tamanho||12}`:`span ${i.config.tamanho||12}`},children:[i.config.showLabel!==!1&&i.config.label!=="Novo Container"&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold text-foreground",children:i.config.label}),i.config.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:i.config.description})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-3",children:i.fields.map(l=>o.jsx(w0,{config:l.config,fieldId:l.id,subFields:l.subFields,value:r[l.id]||"",onChange:c=>s(l.id,c),visible:Za(l.config.condition,r,n),error:a[l.id],eventoData:n,allValues:r},l.id))})]},i.id))})]}),C0=({currentStep:e,isLastStep:t,onBack:r,onNext:a})=>o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs(ye,{variant:"outline",onClick:r,disabled:e===0,children:[o.jsx(P.ChevronLeft,{className:"w-4 h-4 mr-1"}),"Voltar"]}),o.jsx(ye,{onClick:a,children:t?o.jsxs(o.Fragment,{children:[o.jsx(P.Check,{className:"w-4 h-4 mr-1"}),"Finalizar"]}):o.jsxs(o.Fragment,{children:[o.jsx(P.ChevronRight,{className:"w-4 h-4 mr-1"}),"Próximo"]})})]}),S0=({onRestart:e})=>o.jsxs("div",{className:"max-w-4xl mx-auto flex flex-col items-center justify-center py-16 space-y-4",children:[o.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:o.jsx(P.PartyPopper,{className:"w-8 h-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Formulário enviado!"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Este é um preview simulado. Nenhum dado foi enviado."}),o.jsxs(ye,{variant:"outline",onClick:e,children:[o.jsx(P.RotateCcw,{className:"w-4 h-4 mr-1"}),"Recomeçar"]})]}),ca=e=>{if(e)return ct[e]},k0=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((a,n)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(n),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(n)),className:G("w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:n===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:n<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:n<t?o.jsx(P.Check,{className:"w-4 h-4"}):n+1},a.id))}),_0=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((a,n)=>{const s=ca(a.icone)??P.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(n),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(n)),className:G("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:n===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:n<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:n<t?o.jsx(P.Check,{className:"w-4 h-4"}):o.jsx(s,{className:"w-4 h-4"})},a.id)})}),E0=({steps:e,currentStep:t,position:r,orientation:a="horizontal",onStepClick:n})=>a==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,i)=>{const l=ca(s.icone)??P.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("button",{type:"button",onClick:()=>n==null?void 0:n(i),className:G("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",n&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(P.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!u&&o.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),o.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label})]},s.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((s,i)=>{const l=ca(s.icone)??P.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:G("flex items-start",!u&&"flex-1"),children:[o.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[o.jsx("button",{type:"button",onClick:()=>n==null?void 0:n(i),className:G("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",n&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(P.Check,{className:"w-4 h-4"}):o.jsx(l,{className:"w-4 h-4"})}),o.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label})]}),!u&&o.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),P0=({steps:e,currentStep:t,onStepClick:r,className:a})=>{const n=Wo(),{layout:s}=n;if(!s.showStepIndicators||e.length<=1)return null;const i=s.stepIndicatorVariant??"numbers",l=s.stepIndicatorPosition??"top-center",c=s.stepIndicatorOrientation??"horizontal",d=(t+1)/e.length*100,u=e[t],p=ca(u==null?void 0:u.icone)??P.CircleDot,m=o.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${d}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),h=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:u==null?void 0:u.label}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),m]}),g=o.jsxs("div",{className:"hidden sm:block",children:[i==="numbers"&&o.jsx(k0,{steps:e,currentStep:t,onStepClick:r}),i==="icons"&&o.jsx(_0,{steps:e,currentStep:t,onStepClick:r}),i==="icons-labeled"&&o.jsx(E0,{steps:e,currentStep:t,position:l,orientation:c,onStepClick:r})]}),f=s.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:m}):null;return c==="vertical"?o.jsxs("div",{className:G("flex gap-6 items-start",a),children:[h,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[g,f&&o.jsx("div",{className:"flex-1 pt-4",children:f})]})]}):o.jsxs("div",{className:G("space-y-3",a),children:[h,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[g,f]})]})},T0=({eventoData:e})=>{const{getConfig:t,containers:r,previewTemplateId:a}=Je(),n=h0({containers:r},t),[s,i]=E.useState({}),[l,c]=E.useState(0),[d,u]=E.useState(!1),[p,m]=E.useState({}),[h,g]=E.useState(!1),f=Math.min(l,Math.max(n.length-1,0));E.useEffect(()=>{f!==l&&c(f)},[f,l,c]);const v=E.useCallback((I,F)=>{var V;if(i(M=>({...M,[I]:F})),h){const M=(V=n[f])==null?void 0:V.containers.flatMap(U=>U.fields).find(U=>U.id===I);if(M){const U=mi(F,M.config,{...s,[I]:F},e);m($=>{const T={...$};return U?T[I]=U:delete T[I],T})}}},[h,n,f,s,e,i,m]),b=E.useCallback(()=>{const I=n[f];if(!I)return!0;const F={};for(const M of I.containers)for(const U of M.fields){if(U.config.fieldType==="field_array"){let T=!1;try{const D=s[U.id],z=D?JSON.parse(D):[],L=U.config.minItems??1;if(z.length<L)F[U.id]=`Mínimo de ${L} item${L!==1?"s":""} obrigatório${L!==1?"s":""}`,T=!0;else{for(const ee of z){for(const Y of U.subFields??[]){const J=ee[Y.id]??"";if(Y.config.required&&!J.trim()){T=!0;break}}if(T)break}T&&(F[U.id]="Preencha todos os campos obrigatórios")}}catch{U.config.required&&(F[U.id]="Campo obrigatório")}continue}const $=mi(s[U.id]||"",U.config,s,e);$&&(F[U.id]=$)}m(F),g(!0);const V=Object.keys(F).length;return V>0?(console.warn(`Corrija ${V} campo(s) destacado(s) antes de continuar`),!1):!0},[n,f,s,e,m,g]),w=E.useCallback(()=>{b()&&(g(!1),m({}),f>=n.length-1?u(!0):c(I=>I+1))},[b,f,n.length,g,m,u,c]),y=E.useCallback(()=>{c(I=>I-1),g(!1),m({})},[c,g,m]),N=E.useCallback(()=>{const I={};for(const F of n)for(const V of F.containers)for(const M of V.fields)Za(M.config.condition,s,e)&&(I[M.id]=Su(M.config,M.subFields));i(F=>({...F,...I}))},[n,s,e,i]),C=E.useCallback(()=>{i({}),m({}),g(!1)},[i,m,g]),_=E.useCallback(()=>{u(!1),c(0),C()},[u,c,C]);if(n.length===0)return o.jsx("div",{className:"rounded-lg border border-dashed border-border/40 p-6 text-center text-xs text-muted-foreground/50",children:"Adicione steps, containers e campos para ver o preview ao vivo"});if(d)return o.jsx(S0,{onRestart:_});const k=n[f],j=n.length,R=f===j-1,A=ua(a);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"px-1",children:o.jsx(v0,{onFillMock:N,onClear:C})}),o.jsx(Ho,{config:A,className:A.wrapperClass,style:{minHeight:"100%",padding:"12px",borderRadius:"12px"},children:o.jsxs("div",{className:"max-w-4xl mx-auto space-y-4",children:[o.jsx(P0,{steps:n.map(I=>({id:I.id,label:I.config.label,icone:I.config.icone})),currentStep:f}),o.jsx(N0,{step:k,stepIndex:f,formValues:s,errors:p,eventoData:e,onChange:v}),o.jsx(C0,{currentStep:f,isLastStep:R,onBack:y,onNext:w})]})})]})},_u=({id:e,currentTamanho:t,inicioColuna:r,onResize:a,pushSnapshot:n})=>{const s=E.useRef(null),[i,l]=E.useState(!1),[c,d]=E.useState(null),u=E.useRef(null);E.useEffect(()=>()=>{var m;(m=u.current)==null||m.call(u)},[]);const p=E.useCallback(m=>{m.preventDefault(),m.stopPropagation(),n==null||n();const h=s.current;if(!h)return;const g=h.parentElement;if(!g)return;const f=g.getBoundingClientRect().width,v=h.getBoundingClientRect().width,b=m.clientX,w=r?13-r:12;l(!0);const y=C=>{const _=C.clientX-b,k=(v+_)/f,j=Math.max(1,Math.min(w,Math.round(k*12)));d(j),a(j)},N=()=>{l(!1),d(null),u.current=null,window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",N)};u.current=()=>{l(!1),d(null),window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",N)},window.addEventListener("mousemove",y),window.addEventListener("mouseup",N)},[r,a,n]);return{resizeRef:s,resizing:i,resizePreview:c,handleResizeStart:p}},$0=({id:e,elementRef:t,onPositionApply:r,setPositionDrag:a,setSelected:n,pushSnapshot:s})=>{const i=E.useRef(null);return E.useEffect(()=>()=>{var l;(l=i.current)==null||l.call(i)},[]),{handlePositionMouseDown:E.useCallback(l=>{l.preventDefault(),l.stopPropagation(),s==null||s(),n(e);const c=t.current;if(!c)return;const d=c.parentElement;if(!d)return;const u=d.getBoundingClientRect(),p=u.width/12,m=c.getBoundingClientRect(),h=Math.max(1,Math.round(m.width/p)),g=m.left-u.left,f=l.clientX-m.left,v=N=>{const C=N-u.left-f,_=Math.round(C/p)+1;return Math.max(1,Math.min(13-h,_))},b=Math.max(1,Math.min(12,Math.round(g/p)+1));a({itemId:e,ghostStart:b,ghostSpan:h,cursorX:l.clientX,cursorY:l.clientY});const w=N=>{a({itemId:e,ghostStart:v(N.clientX),ghostSpan:h,cursorX:N.clientX,cursorY:N.clientY})},y=N=>{r(v(N.clientX)),a(null),i.current=null,window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",y)};i.current=()=>{a(null),window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",y)},window.addEventListener("mousemove",w),window.addEventListener("mouseup",y)},[e,t,r,a,n,s])}},Tr=({id:e,container:t})=>{const{attributes:r,listeners:a,setNodeRef:n,transform:s,transition:i,isDragging:l}=xt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{selectedId:c,setSelected:d,getConfig:u,updateConfig:p,removeItem:m,setPositionDrag:h,positionDrag:g,pushSnapshot:f}=Je(),v=u(e),b=Ki(e),w=(b==null?void 0:b.icon)||P.Type,y=c===e,N=v.tamanho||6,C=(g==null?void 0:g.itemId)===e,[_,k]=E.useState(!1),j="var(--t-primary, hsl(var(--primary)))",R=y?j:_?`color-mix(in srgb, ${j} 60%, transparent)`:`color-mix(in srgb, ${j} 25%, transparent)`,A=y?`0 0 0 2px color-mix(in srgb, ${j} 30%, transparent)`:void 0,{resizeRef:I,resizing:F,resizePreview:V,handleResizeStart:M}=_u({id:e,currentTamanho:N,inicioColuna:v.inicioColuna,onResize:$=>p(e,{tamanho:$}),pushSnapshot:f}),{handlePositionMouseDown:U}=$0({id:e,elementRef:I,onPositionApply:$=>p(e,{inicioColuna:$}),setPositionDrag:h,setSelected:d,pushSnapshot:f});return o.jsxs("div",{ref:$=>{n($),I.current=$},onClick:$=>{$.stopPropagation(),d(e)},"data-field-id":e,onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),className:G("relative flex items-center gap-2 rounded border bg-card/80 backdrop-blur-sm px-2.5 pt-1.5 pb-3.5 cursor-pointer transition-all text-xs",F&&"ring-2 ring-blue-400/50",C&&"opacity-0 pointer-events-none"),style:{gridColumn:v.inicioColuna?`${v.inicioColuna} / span ${N}`:`span ${N}`,transform:Cr.CSS.Transform.toString(s),transition:i,opacity:l?0:1,borderColor:R,boxShadow:A},children:[o.jsx("div",{onMouseDown:U,onClick:$=>$.stopPropagation(),className:"cursor-ew-resize shrink-0 p-0.5 rounded hover:bg-primary/20 transition-colors",title:"Arrastar para mudar coluna",children:o.jsx(P.ArrowLeftRight,{className:"h-3 w-3 text-primary/60"})}),o.jsx("div",{...a,...r,className:"cursor-grab shrink-0",onClick:$=>$.stopPropagation(),children:o.jsx(P.GripVertical,{className:"h-3 w-3 text-primary"})}),o.jsx(w,{className:"h-3.5 w-3.5 text-primary shrink-0"}),o.jsx("span",{className:"font-medium truncate flex-1",children:v.label}),v.condition&&o.jsx(P.Zap,{className:"h-3 w-3 text-amber-500 shrink-0"}),v.required&&o.jsx("span",{className:"text-destructive font-bold",children:"*"}),o.jsxs("span",{className:"text-[9px] text-muted-foreground shrink-0",children:[V??N,"/12"]}),o.jsx("button",{onClick:$=>{$.stopPropagation(),m(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:_?1:0},children:o.jsx(P.Trash2,{className:"h-3 w-3 text-destructive"})}),o.jsx("div",{className:"absolute left-2 -bottom-0.5 font-mono truncate max-w-[90%] pointer-events-none text-[8px] text-muted-foreground/30",children:e}),o.jsx("div",{"data-resize":!0,onMouseDown:M,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-primary/20 transition-colors flex items-center justify-center",children:o.jsx(P.GripHorizontal,{className:"h-3 w-3 text-primary/40 rotate-90"})})]})},R0=({id:e,container:t})=>{var r;const{attributes:a,listeners:n,setNodeRef:s,transform:i,transition:l,isDragging:c}=xt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{setNodeRef:d,isOver:u}=cr.useDroppable({id:`zone-${e}`}),{selectedId:p,setSelected:m,getConfig:h,removeItem:g,moveItem:f,containers:v}=Je(),b=h(e),w=(((r=v[e])==null?void 0:r.children)??[]).filter(C=>Ne(C)==="field"),y=p===e,N=b.tamanho||12;return o.jsxs("div",{ref:s,onClick:C=>{C.stopPropagation(),m(e)},className:G("group/fa relative rounded-lg border overflow-hidden transition-all",c&&"opacity-0 pointer-events-none",y?"border-amber-500 ring-2 ring-amber-500/20 shadow-lg":"border-amber-500/30 hover:border-amber-500/55"),style:{gridColumn:b.inicioColuna?`${b.inicioColuna} / span ${N}`:`span ${N}`,transform:Cr.CSS.Transform.toString(i),transition:l},children:[o.jsxs("div",{className:G("flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",y?"bg-amber-500/15 border-amber-500/30":"bg-amber-500/10 border-amber-500/20"),children:[o.jsx("div",{...n,...a,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-amber-500/20 transition-colors",onClick:C=>C.stopPropagation(),children:o.jsx(P.GripVertical,{className:"h-3.5 w-3.5 text-amber-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:C=>{C.stopPropagation(),f(e,"up")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(P.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})}),o.jsx("button",{onClick:C=>{C.stopPropagation(),f(e,"down")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(P.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})})]}),o.jsx(P.List,{className:"h-3.5 w-3.5 text-amber-500 shrink-0"}),o.jsx("span",{className:"text-xs font-semibold truncate flex-1 text-amber-700 dark:text-amber-300",children:b.label}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-amber-500/10 px-1.5 rounded",children:[b.itemLabel||"Item"," · ",w.length," campo",w.length!==1?"s":""]}),o.jsx("button",{onClick:C=>{C.stopPropagation(),g(e)},className:"opacity-0 group-hover/fa:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",children:o.jsx(P.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:d,className:G("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",u?"bg-amber-500/10 ring-2 ring-inset ring-amber-500/40":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[w.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(xt.SortableContext,{items:w,strategy:xt.rectSortingStrategy,children:w.map(C=>o.jsx(Tr,{id:C,container:e},C))})]})]})},hi=5,O0=({id:e,elementRef:t,tamanho:r,inicioColuna:a,onPositionApply:n,setPositionDrag:s,setSelected:i,reorderStrategy:l})=>{const c=E.useRef({inicioColuna:a,tamanho:r});c.current={inicioColuna:a,tamanho:r};const d=E.useRef(null);return E.useEffect(()=>()=>{var u;(u=d.current)==null||u.call(d)},[]),{handleGripMouseDown:E.useCallback(u=>{u.preventDefault(),u.stopPropagation(),i(e);const p=u.clientX,m=u.clientY;let h=!1;const g=()=>{d.current=null,window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",v)},f=y=>{const N=Math.abs(y.clientX-p),C=Math.abs(y.clientY-m);N<hi&&C<hi||(h=!0,g(),N>=C?b(y):w(y))},v=()=>{h||g()};window.addEventListener("mousemove",f),window.addEventListener("mouseup",v),d.current=g;const b=y=>{const N=t.current;if(!N)return;const C=N.parentElement;if(!C)return;const _=C.getBoundingClientRect(),k=_.width/12,{tamanho:j}=c.current,R=N.getBoundingClientRect(),A=R.left-_.left,I=Math.max(1,Math.min(12,Math.round(A/k)+1)),F=R.left;s({itemId:e,ghostStart:I,ghostSpan:j,cursorX:y.clientX,cursorY:y.clientY});const V=$=>{const T=$-F,D=Math.round(T/k)+1;return Math.max(1,Math.min(13-j,D))};s({itemId:e,ghostStart:V(y.clientX),ghostSpan:j,cursorX:y.clientX,cursorY:y.clientY});const M=$=>{s({itemId:e,ghostStart:V($.clientX),ghostSpan:j,cursorX:$.clientX,cursorY:$.clientY})},U=$=>{n(V($.clientX)),s(null),d.current=null,window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",U)};window.addEventListener("mousemove",M),window.addEventListener("mouseup",U),d.current=()=>{s(null),window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",U)}},w=y=>{const N=l,C=t.current;if(!C)return;const _=C.parentElement;if(!_)return;const k=N.dataAttribute||"data-container-id";N.pushSnapshot(),N.setReorderDrag({draggingId:e});let j=y.clientY;const R=I=>{const F=Array.from(_.children).filter(V=>V!==C&&V.getAttribute(k));for(const V of F){const M=V.getBoundingClientRect(),U=M.top+M.height/2;if(I.clientY<U&&I.clientY>M.top&&I.clientY<j){N.moveItemNoSnapshot(e,"up"),j=I.clientY;break}else if(I.clientY>U&&I.clientY<M.bottom&&I.clientY>j){N.moveItemNoSnapshot(e,"down"),j=I.clientY;break}}},A=()=>{N.setReorderDrag(null),d.current=null,window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",A)};window.addEventListener("mousemove",R),window.addEventListener("mouseup",A),d.current=()=>{N.setReorderDrag(null),window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",A)}}},[e,t,n,s,i,l])}},Bn=({showGuides:e,positionDrag:t})=>!e&&!t?null:o.jsxs(o.Fragment,{children:[e&&o.jsx("div",{className:"absolute inset-0 pointer-events-none z-10",style:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",padding:"inherit",gap:"inherit"},children:Array.from({length:12},(r,a)=>o.jsx("div",{className:"border border-dashed border-muted-foreground/20 rounded-sm flex items-end justify-center pb-1",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/40 font-mono",children:a+1})},a))}),t&&o.jsx("div",{className:"absolute pointer-events-none z-20 rounded-lg border-2 border-dashed border-destructive/60 bg-destructive/10",style:{top:"12px",bottom:"12px",left:`calc(${(t.ghostStart-1)/12*100}% + 12px)`,width:`calc(${t.ghostSpan/12*100}% - 8px)`,transition:"left 0.1s ease-out, width 0.1s ease-out"},children:o.jsxs("div",{className:"absolute -top-5 left-1/2 -translate-x-1/2 bg-destructive text-destructive-foreground text-[10px] font-bold px-2 py-0.5 rounded whitespace-nowrap",children:[t.ghostStart," →"," ",t.ghostStart+t.ghostSpan-1]})})]}),Un=({id:e,container:t})=>{var r;const{setNodeRef:a,isOver:n}=cr.useDroppable({id:`zone-${e}`}),{selectedId:s,setSelected:i,getConfig:l,updateConfig:c,removeItem:d,moveItem:u,moveItemNoSnapshot:p,setPositionDrag:m,positionDrag:h,reorderDrag:g,setReorderDrag:f,pushSnapshot:v,containers:b}=Je(),w=l(e),y=((r=b[e])==null?void 0:r.children)??[],N=y.filter(q=>Ne(q)==="field"),C=s===e,_=w.tamanho||12,k=(h==null?void 0:h.itemId)===e,j=(g==null?void 0:g.draggingId)===e,R=h&&y.includes(h.itemId),A=s&&y.includes(s)&&Ne(s)==="field",[I,F]=E.useState(!1),V="var(--t-primary, hsl(var(--primary)))",M=C?V:I?"rgba(59,130,246,0.55)":"rgba(59,130,246,0.3)",U=C?`color-mix(in srgb, ${V} 15%, transparent)`:I?"rgba(59,130,246,0.12)":"rgba(59,130,246,0.07)",$=C?`color-mix(in srgb, ${V} 30%, transparent)`:I?"rgba(59,130,246,0.28)":"rgba(59,130,246,0.18)",T=C?`0 0 0 3px color-mix(in srgb, ${V} 20%, transparent)`:I?"0 0 0 2px rgba(59,130,246,0.25)":void 0,{resizeRef:D,resizing:z,resizePreview:L,handleResizeStart:ee}=_u({id:e,currentTamanho:_,inicioColuna:w.inicioColuna,onResize:q=>c(e,{tamanho:q}),pushSnapshot:v}),Y=E.useMemo(()=>({kind:"custom",moveItemNoSnapshot:p,pushSnapshot:v,setReorderDrag:f,dataAttribute:"data-container-id"}),[p,v,f]),{handleGripMouseDown:J}=O0({id:e,elementRef:D,tamanho:_,inicioColuna:w.inicioColuna||1,onPositionApply:q=>c(e,{inicioColuna:q}),setPositionDrag:m,setSelected:i,reorderStrategy:Y});return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:q=>{D.current=q},onClick:q=>{q.stopPropagation(),i(e)},onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),className:G("relative rounded-lg border overflow-hidden transition-all",z&&"ring-2 ring-blue-400/50",k&&"opacity-0 pointer-events-none",j&&"opacity-50"),"data-container-id":e,style:{gridColumn:w.inicioColuna?`${w.inicioColuna} / span ${_}`:`span ${_}`,minWidth:"80px",borderColor:M,boxShadow:T},children:[o.jsxs("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",style:{backgroundColor:U,borderColor:$},children:[o.jsx("div",{"data-grip":!0,onMouseDown:J,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-primary/20 transition-colors",children:o.jsx(P.GripVertical,{className:"h-3.5 w-3.5 text-blue-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:q=>{q.stopPropagation(),u(e,"up")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(P.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})}),o.jsx("button",{onClick:q=>{q.stopPropagation(),u(e,"down")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(P.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})})]}),o.jsx(P.BoxSelect,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),o.jsx("span",{className:G("text-xs font-semibold truncate flex-1",w.showLabel===!1?"text-blue-500/50 italic":"text-blue-700 dark:text-blue-300"),children:w.label}),w.showAsCard&&o.jsx(P.SquareStack,{className:"h-3 w-3 text-blue-400 shrink-0"}),w.showLabel===!1&&o.jsx(P.EyeOff,{className:"h-3 w-3 text-muted-foreground/50 shrink-0"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-blue-500/10 px-1.5 rounded",children:[L??_,"/12"]}),o.jsx("button",{onClick:q=>{q.stopPropagation(),d(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:I?1:0},children:o.jsx(P.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:a,className:G("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",n?"bg-primary/15 ring-2 ring-inset ring-primary/50":(R||A)&&"bg-muted/30"),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[o.jsx(Bn,{showGuides:!!R||!!A,positionDrag:R?h:null}),y.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(xt.SortableContext,{items:N,strategy:xt.rectSortingStrategy,children:y.filter(q=>Ne(q)==="field").map(q=>l(q).fieldType==="field_array"?o.jsx(R0,{id:q,container:e},q):o.jsx(Tr,{id:q,container:e},q))})]}),o.jsx("div",{onMouseDown:ee,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-blue-500/20 transition-colors flex items-center justify-center",children:o.jsx(P.GripHorizontal,{className:"h-3 w-3 text-blue-500/40 rotate-90"})})]}),k&&h&&Bo.createPortal(o.jsxs("div",{style:{position:"fixed",left:h.cursorX+14,top:h.cursorY-18,zIndex:9999,pointerEvents:"none"},className:"flex items-center gap-1 bg-foreground text-background text-[10px] font-mono px-2 py-0.5 rounded shadow-xl border border-border/20",children:[o.jsx(P.BoxSelect,{className:"h-2.5 w-2.5"}),"col ",h.ghostStart,"–",h.ghostStart+h.ghostSpan-1]}),document.body)," "]})},Eu=({id:e,container:t,index:r})=>{var a;const{attributes:n,listeners:s,setNodeRef:i,transform:l,transition:c,isDragging:d}=xt.useSortable({id:e,data:{isCanvasItem:!0,type:"step",id:e}}),{setNodeRef:u,isOver:p}=cr.useDroppable({id:`zone-${e}`}),{selectedId:m,setSelected:h,getConfig:g,removeItem:f,containers:v,positionDrag:b}=Je(),w=g(e),y=((a=v[e])==null?void 0:a.children)??[],N=m===e,C=b&&y.includes(b.itemId),[_,k]=E.useState(!1),j="var(--t-primary, hsl(var(--primary)))",R=N?j:_?`color-mix(in srgb, ${j} 60%, transparent)`:`color-mix(in srgb, ${j} 25%, transparent)`,A=N?`color-mix(in srgb, ${j} 14%, transparent)`:_?`color-mix(in srgb, ${j} 10%, transparent)`:`color-mix(in srgb, ${j} 6%, transparent)`,I=N?`color-mix(in srgb, ${j} 28%, transparent)`:`color-mix(in srgb, ${j} 15%, transparent)`,F=N?`0 0 0 3px color-mix(in srgb, ${j} 20%, transparent)`:void 0,V={transform:Cr.CSS.Transform.toString(l),transition:c,opacity:d?0:1};return o.jsxs("div",{ref:i,style:{...V,borderWidth:"2px",borderStyle:"solid",borderColor:R,boxShadow:F},onMouseEnter:()=>k(!0),onMouseLeave:()=>k(!1),onClick:M=>{M.stopPropagation(),h(e)},className:"group/step rounded-xl overflow-hidden transition-all",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2",style:{backgroundColor:A,borderColor:I},children:[o.jsx("div",{...s,...n,className:"cursor-grab shrink-0",onClick:M=>M.stopPropagation(),children:o.jsx(P.GripVertical,{className:"h-3.5 w-3.5 text-primary"})}),o.jsx(P.Layers,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{className:"text-sm font-bold truncate flex-1 text-primary",children:["Step ",r+1," — ",w.label]}),w.description&&o.jsx("span",{className:"text-[10px] text-muted-foreground truncate hidden md:block",children:w.description}),o.jsx("button",{onClick:M=>{M.stopPropagation(),f(e)},className:"transition-opacity shrink-0 p-1 rounded hover:bg-destructive/10",style:{opacity:_?1:0},children:o.jsx(P.Trash2,{className:"h-3.5 w-3.5 text-destructive"})})]}),o.jsxs("div",{ref:u,className:G("relative p-3 min-h-[80px] gap-2 items-start transition-all duration-150",p?"bg-blue-500/20 ring-2 ring-inset ring-blue-400/70 shadow-[inset_0_0_0_2px_theme(colors.blue.400/50%)]":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content",backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px)",backgroundSize:"16px 16px"},children:[o.jsx(Bn,{showGuides:!!C,positionDrag:C?b:null}),y.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground/50 text-center py-6 italic w-full",style:{gridColumn:"span 12"},children:"Arraste containers aqui"}),y.map(M=>Ne(M)==="container"?o.jsx(Un,{id:M,container:e},M):o.jsx(Tr,{id:M,container:e},M))]})]})},D0=()=>{var e;const{containers:t,setSelected:r}=Je(),a=((e=t.root)==null?void 0:e.children)??[],n=a.filter(l=>Ne(l)==="step"),{setNodeRef:s,isOver:i}=cr.useDroppable({id:"root"});return o.jsxs("div",{ref:s,onClick:()=>r(null),className:`min-h-[500px] rounded-xl border p-4 space-y-4 transition-all duration-150 ${i?"bg-primary/10 border-primary/60 ring-2 ring-primary/30 shadow-[0_0_0_4px_theme(colors.primary/10%)]":"border-border/40"}`,style:{backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.12) 1px, transparent 1px)",backgroundSize:"20px 20px",backgroundColor:i?void 0:"hsl(var(--muted) / 0.3)"},children:[a.length===0&&o.jsx("div",{className:"flex items-center justify-center h-[400px]",children:o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx(P.Layers,{className:"h-10 w-10 text-muted-foreground/30 mx-auto"}),o.jsxs("p",{className:"text-sm text-muted-foreground/50",children:["Arraste ",o.jsx("strong",{children:"Steps"})," da paleta para cá"]})]})}),o.jsx(xt.SortableContext,{items:n,strategy:xt.verticalListSortingStrategy,children:a.map((l,c)=>{const d=Ne(l);return d==="step"?o.jsx(Eu,{id:l,container:"root",index:c},l):d==="container"?o.jsx(Un,{id:l,container:"root"},l):o.jsx(Tr,{id:l,container:"root"},l)})})]})},A0={personal:"Pessoal",address:"Endereço",health:"Saúde",event:"Evento",payment:"Pagamento",emergency:"Emergência"},I0={texto:"Texto",selecao:"Seleção",range:"Numérico / Visual",data:"Data e Hora",contato:"Contato / Endereço",outros:"Arquivo / Outros"},L0=()=>{const e=St.reduce((t,r)=>{const a=r.group??"outros";return t[a]||(t[a]=[]),t[a].push(r),t},{});return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Estrutura"}),an.map(t=>o.jsx(xi,{component:t.component,label:t.label,icon:t.icon,color:t.color},t.component))]}),Object.entries(e).map(([t,r])=>o.jsx(ho,{label:I0[t]??t,children:r.map(a=>o.jsx(xi,{component:a.component,label:a.label,icon:a.icon,color:"border-border"},a.component))},t)),o.jsx(ho,{label:"Blocos pré-configurados",defaultOpen:!1,children:pa.map(t=>o.jsx(z0,{block:t},t.id))}),o.jsx(ho,{label:"Blocos de steps",defaultOpen:!1,children:qo.map(t=>o.jsx(M0,{block:t},t.id))})]})},ho=({label:e,children:t,defaultOpen:r=!0})=>{const[a,n]=E.useState(r);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{type:"button",onClick:()=>n(s=>!s),className:"flex w-full items-center justify-between text-xs font-semibold text-muted-foreground uppercase tracking-wide hover:text-foreground transition-colors",children:[e,o.jsx(P.ChevronDown,{className:`h-3.5 w-3.5 transition-transform ${a?"":"-rotate-90"}`})]}),a&&o.jsx("div",{className:"space-y-1.5",children:t})]})},xi=({component:e,label:t,icon:r,color:a})=>{const{attributes:n,listeners:s,setNodeRef:i,transform:l,isDragging:c}=cr.useDraggable({id:`palette-${e}`,data:{isPaletteItem:!0,componentType:e}});return o.jsxs("div",{ref:i,...s,...n,className:`cursor-grab flex items-center gap-2 rounded-lg border px-3 py-2 select-none hover:bg-accent transition-colors ${a} ${c?"opacity-50":""}`,style:{transform:c?void 0:Cr.CSS.Translate.toString(l)},children:[o.jsx(P.GripVertical,{className:"h-4 w-4 text-muted-foreground"}),o.jsx(r,{className:"h-4 w-4"}),o.jsx("span",{className:"text-sm font-medium",children:t})]})},z0=({block:e})=>{const{attributes:t,listeners:r,setNodeRef:a,transform:n,isDragging:s}=cr.useDraggable({id:`preset-${e.id}`,data:{isPalettePreset:!0,presetId:e.id}}),i=e.icon?ct[e.icon]:void 0,l=A0[e.category]??e.category;return o.jsxs("div",{ref:a,...r,...t,className:`cursor-grab flex items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2 select-none hover:bg-primary/10 transition-colors ${s?"opacity-50":""}`,style:{transform:s?void 0:Cr.CSS.Translate.toString(n)},title:e.description,children:[o.jsx(P.GripVertical,{className:"h-4 w-4 text-muted-foreground shrink-0"}),i?o.jsx(i,{className:"h-4 w-4 text-primary shrink-0"}):o.jsx(ct.Blocks,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:l})]})]})},M0=({block:e})=>{const{addPresetStepBlock:t}=Je(),r=e.icon?ct[e.icon]:void 0;return o.jsxs("button",{type:"button",onClick:()=>t(e),className:"w-full flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 cursor-pointer select-none hover:bg-amber-500/15 transition-colors text-left",title:e.description,children:[r?o.jsx(r,{className:"h-4 w-4 text-amber-400 shrink-0"}):o.jsx(ct.Layers,{className:"h-4 w-4 text-amber-400 shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.steps.length," steps"]})]}),o.jsxs("span",{className:"text-[10px] text-amber-400 border border-amber-500/30 rounded px-1.5 py-0.5 shrink-0",children:["+",e.steps.length," steps"]})]})},xo=e=>({when:e.campoId,operator:e.operador,value:e.valor,source:e.source}),Pu=e=>{var t;const r={campoId:e.when,operador:e.operator,valor:e.value,source:e.source};if(e.logicOperator&&(t=e.extraConditions)!=null&&t.length){const a=e.extraConditions.map(s=>({campoId:s.when,operador:s.operator,valor:s.value,source:s.source})),n=[r,...a];return e.logicOperator==="or"?{or:n}:{and:n}}return r},Tu=e=>{if("campoId"in e)return xo(e);const t=("and"in e?e.and:e.or)??[];if(t.length===0)return;const r="and"in e?"and":"or",[a,...n]=t;if(!("campoId"in a))return;const s=xo(a);return n.length===0?s:{...s,logicOperator:r,extraConditions:n.filter(i=>"campoId"in i).map(xo)}},F0=(e,t,r)=>{var a,n;const s=l=>t[l]||{label:l,name:l},i=(((n=(a=e==null?void 0:e.containers)==null?void 0:a.root)==null?void 0:n.children)||[]).filter(l=>Ne(l)==="step").map((l,c)=>{var d,u;const p=s(l),m=(((u=(d=e==null?void 0:e.containers)==null?void 0:d[l])==null?void 0:u.children)||[]).filter(h=>Ne(h)==="container").map((h,g)=>{var f,v;const b=s(h),w=(((v=(f=e==null?void 0:e.containers)==null?void 0:f[h])==null?void 0:v.children)||[]).filter(N=>Ne(N)==="field").map((N,C)=>{var _,k;const j=s(N),R=Fo(j,N,C);if(R.tipo===O.FIELD_ARRAY){const A=((k=(_=e==null?void 0:e.containers)==null?void 0:_[N])==null?void 0:k.children)??[];R.subFields=A.filter(I=>Ne(I)==="field").map((I,F)=>Fo(s(I),I,F))}return R}),y={id:h,titulo:b.label||"Container",descricao:b.description,icone:b.icone,ordem:g,colunas:b.columns||2,tamanho:b.tamanho||12,inicioColuna:b.inicioColuna,showLabel:b.showLabel,showAsCard:b.showAsCard,campos:w};return b.condition&&(y.condicional=Pu(b.condition)),y});return{id:l,titulo:p.label||"Step",descricao:p.description,icone:p.icone,ordem:c,showLabel:p.showLabel,containers:m}});return{id:r.id||"",nome:r.nome,descricao:r.descricao,status:r.status,template:r.template??null,steps:i}},Fo=(e,t,r)=>{var a,n,s,i;const l={id:t,nome:e.name||t,label:e.label||"",tipo:e.fieldType||"texto",obrigatorio:e.required||!1,tamanho:e.tamanho||6,inicioColuna:e.inicioColuna,ordem:r,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==void 0?e.clearedValue:void 0,initialValue:e.initialValue!==void 0?e.initialValue:void 0,resolvePropsKey:e.resolvePropsKey||void 0};if((a=e.validate)!=null&&a.length&&(l.validate=e.validate),(n=e.warn)!=null&&n.length&&(l.warn=e.warn),(s=e.options)!=null&&s.length&&(l.opcoes=e.options.map(c=>({valor:c.value,label:c.label,disabled:c.disabled}))),e.validation){const c=e.validation;l.validacao={},c.minLength!==void 0&&(l.validacao.minLength=c.minLength),c.maxLength!==void 0&&(l.validacao.maxLength=c.maxLength),c.min!==void 0&&(l.validacao.min=c.min),c.max!==void 0&&(l.validacao.max=c.max),c.regex&&(l.validacao.regex=c.regex),c.regexMessage&&(l.validacao.regexMessage=c.regexMessage),c.minDate&&(l.validacao.minDate=c.minDate),c.maxDate&&(l.validacao.maxDate=c.maxDate),c.minAge!==void 0&&(l.validacao.minAge=c.minAge),c.maxAge!==void 0&&(l.validacao.maxAge=c.maxAge),(i=c.fileTypes)!=null&&i.length&&(l.validacao.fileTypes=c.fileTypes),c.maxFileSize!==void 0&&(l.validacao.maxFileSize=c.maxFileSize)}if(l.tipo===O.FIELD_ARRAY&&(e.itemLabel&&(l.itemLabel=e.itemLabel),e.minItems!==void 0&&(l.minItems=e.minItems),e.maxItems!==void 0&&(l.maxItems=e.maxItems),e.addLabel&&(l.addLabel=e.addLabel)),l.tipo===O.TERMS&&(e.termoTexto&&(l.termoTexto=e.termoTexto),e.termoPdfUrl&&(l.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(l.termoPdfUploadId=e.termoPdfUploadId)),l.tipo===O.SLIDER&&(e.step!==void 0&&(l.step=e.step),e.minValue!==void 0&&(l.minValue=e.minValue),e.maxValue!==void 0&&(l.maxValue=e.maxValue)),l.tipo===O.RATING&&e.maxRating!==void 0&&(l.maxRating=e.maxRating),l.tipo===O.DATE_RANGE&&(e.dateRangeStartLabel&&(l.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(l.dateRangeEndLabel=e.dateRangeEndLabel)),l.tipo===O.SUB_FORM){const c=e.subSchemaFields??[];(c.length>0||e.subSchemaTitle)&&(l.subSchema={titulo:e.subSchemaTitle,fields:c.map((d,u)=>Fo(d,d.name??`subfield-${u}`,u))})}return e.condition&&(l.condicional=Pu(e.condition)),l},$u=e=>{const t={},r={root:{children:[]}},a=[...e.steps].sort((n,s)=>n.ordem-s.ordem);for(const n of a){const s=n.id||`step-${Fe()}`;r.root.children.push(s),t[s]={label:n.titulo,name:s,fieldType:"step",description:n.descricao,icone:n.icone,showLabel:n.showLabel};const i=[],l=[...n.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l){const d=c.id||`container-${Fe()}`;i.push(d);const u=c.condicional?Tu(c.condicional):void 0;t[d]={label:c.titulo,name:d,fieldType:"container",description:c.descricao,icone:c.icone,columns:c.colunas,tamanho:c.tamanho||12,inicioColuna:c.inicioColuna,showLabel:c.showLabel,showAsCard:c.showAsCard,...u?{condition:u}:{}};const p=[],m=[...c.campos].sort((h,g)=>h.ordem-g.ordem);for(const h of m){const g=h.id||`${h.tipo}-${Fe()}`;if(p.push(g),t[g]=Vo(h),h.tipo===O.FIELD_ARRAY){const f=[];for(const v of h.subFields??[]){const b=v.id||`${v.tipo}-${Fe()}`;f.push(b),t[b]=Vo(v)}r[g]={children:f}}}r[d]={children:p}}r[s]={children:i}}return{dndState:{containers:r},configs:t,templateId:e.template??null}},Vo=(e,t)=>{var r,a,n,s;const i={label:e.label,name:e.nome,fieldType:e.tipo,required:e.obrigatorio,tamanho:e.tamanho,inicioColuna:e.inicioColuna,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!=null?String(e.clearedValue):void 0,initialValue:e.initialValue!==void 0?String(e.initialValue):void 0,resolvePropsKey:e.resolvePropsKey||void 0,validate:(r=e.validate)!=null&&r.length?e.validate:void 0,warn:(a=e.warn)!=null&&a.length?e.warn:void 0};if((n=e.opcoes)!=null&&n.length&&(i.options=e.opcoes.map(l=>({value:l.valor,label:l.label,disabled:l.disabled}))),e.validacao){const l=e.validacao;i.validation={},l.minLength!==void 0&&(i.validation.minLength=l.minLength),l.maxLength!==void 0&&(i.validation.maxLength=l.maxLength),l.min!==void 0&&(i.validation.min=l.min),l.max!==void 0&&(i.validation.max=l.max),l.regex&&(i.validation.regex=l.regex),l.regexMessage&&(i.validation.regexMessage=l.regexMessage),l.minDate&&(i.validation.minDate=l.minDate),l.maxDate&&(i.validation.maxDate=l.maxDate),l.minAge!==void 0&&(i.validation.minAge=l.minAge),l.maxAge!==void 0&&(i.validation.maxAge=l.maxAge),(s=l.fileTypes)!=null&&s.length&&(i.validation.fileTypes=l.fileTypes),l.maxFileSize!==void 0&&(i.validation.maxFileSize=l.maxFileSize)}if(e.tipo===O.FIELD_ARRAY&&(e.itemLabel&&(i.itemLabel=e.itemLabel),e.minItems!==void 0&&(i.minItems=e.minItems),e.maxItems!==void 0&&(i.maxItems=e.maxItems),e.addLabel&&(i.addLabel=e.addLabel)),e.tipo===O.TERMS&&(e.termoTexto&&(i.termoTexto=e.termoTexto),e.termoPdfUrl&&(i.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(i.termoPdfUploadId=e.termoPdfUploadId)),e.tipo===O.SLIDER&&(e.step!==void 0&&(i.step=e.step),e.minValue!==void 0&&(i.minValue=e.minValue),e.maxValue!==void 0&&(i.maxValue=e.maxValue)),e.tipo===O.RATING&&e.maxRating!==void 0&&(i.maxRating=e.maxRating),e.tipo===O.DATE_RANGE&&(e.dateRangeStartLabel&&(i.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(i.dateRangeEndLabel=e.dateRangeEndLabel)),e.tipo===O.SUB_FORM&&e.subSchema&&(i.subSchemaTitle=e.subSchema.titulo,i.subSchemaFields=e.subSchema.fields.map(l=>Vo(l,l.id))),e.condicional){const l=Tu(e.condicional);l&&(i.condition=l)}return i},V0=(e,t)=>{var r,a,n,s,i,l,c;const d=[],u=[],p=g=>t[g]||{label:g,name:g},m=((a=(r=e==null?void 0:e.containers)==null?void 0:r.root)==null?void 0:a.children)||[],h=new Set;for(const g of m){if(Ne(g)!=="step")continue;const f=p(g).label||g,v=((s=(n=e==null?void 0:e.containers)==null?void 0:n[g])==null?void 0:s.children)||[];if(v.length===0){u.push(`Step "${f}" está vazio (sem containers).`);continue}for(const b of v){if(Ne(b)!=="container")continue;const w=p(b).label||b,y=((l=(i=e==null?void 0:e.containers)==null?void 0:i[b])==null?void 0:l.children)||[],N=new Map;for(const C of y){if(Ne(C)!=="field")continue;h.add(C);const _=p(C).name||C;N.has(_)||N.set(_,[]),N.get(_).push(C)}for(const[C,_]of N.entries())_.length>1&&d.push(`Nome duplicado "${C}" no container "${w}" (IDs: ${_.join(", ")}).`)}}for(const[g,f]of Object.entries(t)){if(!((c=f.condition)!=null&&c.when))continue;const v=f.condition.when;if(!h.has(v)){const b=f.label||g;u.push(`Campo "${b}" referencia campo inexistente na condição (when: "${v}").`)}}return{errors:d,warnings:u}},B0=[...an,...St],U0=({data:e})=>{const{getConfig:t}=Je();if(!e)return null;const r=e;if(r.isPalettePreset){const a=wi(r.presetId);return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[o.jsx(ct.Blocks,{className:"h-3.5 w-3.5 shrink-0"}),(a==null?void 0:a.name)??"Bloco"]})}if(r.isPaletteItem){const a=B0.find(s=>s.component===r.componentType),n=a==null?void 0:a.icon;return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[n&&o.jsx(n,{className:"h-3.5 w-3.5 shrink-0"}),(a==null?void 0:a.label)??r.componentType]})}if(r.isCanvasItem){const{type:a,id:n}=r,s=t(n),i={step:"border-primary/80 bg-primary text-primary-foreground",container:"border-blue-600 bg-blue-600 text-white",field:"border-primary/80 bg-primary text-primary-foreground"},l={step:"Step",container:"Container",field:"Campo"};return o.jsxs("div",{className:G("flex items-center gap-2 rounded-full px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none min-w-[100px] max-w-[200px]",i[a]??"border-border bg-card"),children:[o.jsx(P.GripVertical,{className:"h-3 w-3 opacity-60 shrink-0"}),o.jsxs("span",{className:"opacity-70 shrink-0",children:[l[a]??a,":"]}),o.jsx("span",{className:"truncate",children:s.label||n})]})}return null},H0=({schema:e,children:t})=>{var r;const a=E.useMemo(()=>{var n;return(n=e==null?void 0:e.steps)!=null&&n.length?$u(e):null},[e]);return o.jsx(tl,{initialConfigs:a==null?void 0:a.configs,initialContainers:(r=a==null?void 0:a.dndState)==null?void 0:r.containers,initialTemplateId:(a==null?void 0:a.templateId)??void 0,schemaId:(e==null?void 0:e.id)??void 0,children:t})};exports.BuilderProvider=tl;exports.BuilderWrapper=H0;exports.Canvas=D0;exports.ConfigPanel=f0;exports.ContainerRenderer=Xi;exports.DFCepField=rn;exports.DFCheckbox=va;exports.DFCheckboxGroup=Qo;exports.DFDateField=ar;exports.DFFieldArray=zi;exports.DFFileUpload=tn;exports.DFHidden=ba;exports.DFMaskedInput=Ct;exports.DFParticipationType=Mi;exports.DFPaymentMethod=Bi;exports.DFRadioGroup=en;exports.DFSelect=ga;exports.DFTerms=Ui;exports.DFTextField=Be;exports.DFTextarea=xa;exports.DragGhost=U0;exports.DroppedContainer=Un;exports.DroppedField=Tr;exports.DroppedStep=Eu;exports.EVENT_VARIABLES=on;exports.FIELD_TYPES=St;exports.FIELD_TYPE_ICONS=tp;exports.FIELD_TYPE_LABELS=ep;exports.FieldType=O;exports.FormRenderer=Qf;exports.FormSchemaStatus=gi;exports.FormSpy=eh;exports.GridOverlay=Bn;exports.LivePreview=T0;exports.MaskType=vi;exports.OPCOES_POR_DIA=Fi;exports.OPCOES_TODOS_OS_DIAS=Vi;exports.PRESET_BLOCKS=pa;exports.PRESET_STEP_BLOCKS=qo;exports.Palette=L0;exports.RendererContext=Jo;exports.STRUCTURE_TYPES=an;exports.StepRenderer=Gi;exports.TEMPLATE_REGISTRY=zt;exports.TemplateProvider=Ho;exports.builderToFormSchema=F0;exports.evaluateFieldCondition=rt;exports.findParentContainer=el;exports.formSchemaToBuilder=$u;exports.generateId=bi;exports.getAllTemplates=gp;exports.getFieldMeta=th;exports.getFieldMetaById=Ki;exports.getItemType=Ne;exports.getPresetById=wi;exports.getPresetStepBlockById=jp;exports.getPresetsByCategory=wp;exports.getTemplateConfig=ua;exports.interpolate=Xe;exports.interpolateContainer=ha;exports.interpolateField=Ai;exports.interpolateStep=Ii;exports.isDarkTemplate=yi;exports.isGlassmorphism=vp;exports.makeStepResolver=Oi;exports.makeStepWarnComputer=Di;exports.useBuilder=Je;exports.useField=Xf;exports.useFieldApi=Gf;exports.useFormApi=Zf;exports.useFormState=Yi;exports.useRendererContext=dt;exports.useTemplate=Wo;exports.v4Fallback=Fe;exports.validateBuilderIntegrity=V0;
|
|
81
|
+
Defaulting to \`null\`.`}var fu=du,My=pu;const hu=h.forwardRef(({className:e,value:t,...r},a)=>o.jsx(fu,{ref:a,className:G("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:o.jsx(My,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));hu.displayName=fu.displayName;var[Ua]=bt("Tooltip",[mr]),Ha=mr(),xu="TooltipProvider",Fy=700,Io="tooltip.open",[Vy,Fn]=Ua(xu),gu=e=>{const{__scopeTooltip:t,delayDuration:r=Fy,skipDelayDuration:a=300,disableHoverableContent:n=!1,children:s}=e,i=h.useRef(!0),l=h.useRef(!1),c=h.useRef(0);return h.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),o.jsx(Vy,{scope:t,isOpenDelayedRef:i,delayDuration:r,onOpen:h.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:h.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,a)},[a]),isPointerInTransitRef:l,onPointerInTransitChange:h.useCallback(d=>{l.current=d},[]),disableHoverableContent:n,children:s})};gu.displayName=xu;var Nr="Tooltip",[By,Wa]=Ua(Nr),vu=e=>{const{__scopeTooltip:t,children:r,open:a,defaultOpen:n,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=Fn(Nr,e.__scopeTooltip),d=Ha(t),[u,p]=h.useState(null),m=_t(),x=h.useRef(0),g=i??c.disableHoverableContent,f=l??c.delayDuration,v=h.useRef(!1),[b,j]=Vt({prop:a,defaultProp:n??!1,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(Io))):c.onClose(),s==null||s(_)},caller:Nr}),y=h.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),N=h.useCallback(()=>{window.clearTimeout(x.current),x.current=0,v.current=!1,j(!0)},[j]),C=h.useCallback(()=>{window.clearTimeout(x.current),x.current=0,j(!1)},[j]),k=h.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{v.current=!0,j(!0),x.current=0},f)},[f,j]);return h.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),o.jsx(Rn,{...d,children:o.jsx(By,{scope:t,contentId:m,open:b,stateAttribute:y,trigger:u,onTriggerChange:p,onTriggerEnter:h.useCallback(()=>{c.isOpenDelayedRef.current?k():N()},[c.isOpenDelayedRef,k,N]),onTriggerLeave:h.useCallback(()=>{g?C():(window.clearTimeout(x.current),x.current=0)},[C,g]),onOpen:N,onClose:C,disableHoverableContent:g,children:r})})};vu.displayName=Nr;var Lo="TooltipTrigger",bu=h.forwardRef((e,t)=>{const{__scopeTooltip:r,...a}=e,n=Wa(Lo,r),s=Fn(Lo,r),i=Ha(r),l=h.useRef(null),c=pe(t,l,n.onTriggerChange),d=h.useRef(!1),u=h.useRef(!1),p=h.useCallback(()=>d.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),o.jsx(Da,{asChild:!0,...i,children:o.jsx(le.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...a,ref:c,onPointerMove:oe(e.onPointerMove,m=>{m.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:oe(e.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:oe(e.onPointerDown,()=>{n.open&&n.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:oe(e.onFocus,()=>{d.current||n.onOpen()}),onBlur:oe(e.onBlur,n.onClose),onClick:oe(e.onClick,n.onClose)})})});bu.displayName=Lo;var Uy="TooltipPortal",[K0,Hy]=Ua(Uy,{forceMount:void 0}),lr="TooltipContent",yu=h.forwardRef((e,t)=>{const r=Hy(lr,e.__scopeTooltip),{forceMount:a=r.forceMount,side:n="top",...s}=e,i=Wa(lr,e.__scopeTooltip);return o.jsx(Qe,{present:a||i.open,children:i.disableHoverableContent?o.jsx(wu,{side:n,...s,ref:t}):o.jsx(Wy,{side:n,...s,ref:t})})}),Wy=h.forwardRef((e,t)=>{const r=Wa(lr,e.__scopeTooltip),a=Fn(lr,e.__scopeTooltip),n=h.useRef(null),s=pe(t,n),[i,l]=h.useState(null),{trigger:c,onClose:d}=r,u=n.current,{onPointerInTransitChange:p}=a,m=h.useCallback(()=>{l(null),p(!1)},[p]),x=h.useCallback((g,f)=>{const v=g.currentTarget,b={x:g.clientX,y:g.clientY},j=Yy(b,v.getBoundingClientRect()),y=Ky(b,j),N=Jy(f.getBoundingClientRect()),C=e0([...y,...N]);l(C),p(!0)},[p]);return h.useEffect(()=>()=>m(),[m]),h.useEffect(()=>{if(c&&u){const g=v=>x(v,u),f=v=>x(v,c);return c.addEventListener("pointerleave",g),u.addEventListener("pointerleave",f),()=>{c.removeEventListener("pointerleave",g),u.removeEventListener("pointerleave",f)}}},[c,u,x,m]),h.useEffect(()=>{if(i){const g=f=>{const v=f.target,b={x:f.clientX,y:f.clientY},j=(c==null?void 0:c.contains(v))||(u==null?void 0:u.contains(v)),y=!Qy(b,i);j?m():y&&(m(),d())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,u,i,d,m]),o.jsx(wu,{...e,ref:s})}),[qy,Zy]=Ua(Nr,{isInside:!1}),Xy=gx("TooltipContent"),wu=h.forwardRef((e,t)=>{const{__scopeTooltip:r,children:a,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Wa(lr,r),d=Ha(r),{onClose:u}=c;return h.useEffect(()=>(document.addEventListener(Io,u),()=>document.removeEventListener(Io,u)),[u]),h.useEffect(()=>{if(c.trigger){const p=m=>{const x=m.target;x!=null&&x.contains(c.trigger)&&u()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,u]),o.jsx(kr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:u,children:o.jsxs(On,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.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:[o.jsx(Xy,{children:a}),o.jsx(qy,{scope:r,isInside:!0,children:o.jsx(Db,{id:c.contentId,role:"tooltip",children:n||a})})]})})});yu.displayName=lr;var ju="TooltipArrow",Gy=h.forwardRef((e,t)=>{const{__scopeTooltip:r,...a}=e,n=Ha(r);return Zy(ju,r).isInside?null:o.jsx(Dn,{...n,...a,ref:t})});Gy.displayName=ju;function Yy(e,t){const r=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),n=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,a,n,s)){case s:return"left";case n:return"right";case r:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function Ky(e,t,r=5){const a=[];switch(t){case"top":a.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":a.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":a.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":a.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return a}function Jy(e){const{top:t,right:r,bottom:a,left:n}=e;return[{x:n,y:t},{x:r,y:t},{x:r,y:a},{x:n,y:a}]}function Qy(e,t){const{x:r,y:a}=e;let n=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,u=l.y,p=c.x,m=c.y;u>a!=m>a&&r<(p-d)*(a-u)/(m-u)+d&&(n=!n)}return n}function e0(e){const t=e.slice();return t.sort((r,a)=>r.x<a.x?-1:r.x>a.x?1:r.y<a.y?-1:r.y>a.y?1:0),t0(t)}function t0(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const n=e[a];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(n.y-i.y)>=(s.y-i.y)*(n.x-i.x))t.pop();else break}t.push(n)}t.pop();const r=[];for(let a=e.length-1;a>=0;a--){const n=e[a];for(;r.length>=2;){const s=r[r.length-1],i=r[r.length-2];if((s.x-i.x)*(n.y-i.y)>=(s.y-i.y)*(n.x-i.x))r.pop();else break}r.push(n)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var r0=gu,a0=vu,o0=bu,Nu=yu;const n0=r0,Cu=a0,Su=o0,Vn=h.forwardRef(({className:e,sideOffset:t=4,...r},a)=>o.jsx(Nu,{ref:a,sideOffset:t,className:G("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md 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",e),...r}));Vn.displayName=Nu.displayName;const s0=cn("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",success:"border-transparent bg-green-500 text-white shadow"}},defaultVariants:{variant:"default"}});function qa({className:e,variant:t,...r}){return o.jsx("div",{className:G(s0({variant:t}),e),...r})}const zo=[{category:"Texto básico",presets:[{pattern:"^[A-Za-z]+$",label:"Apenas letras",description:"Aceita somente letras de A-Z (maiúsculas e minúsculas), sem espaços, números ou especiais."},{pattern:"^[a-z]+$",label:"Apenas minúsculas",description:"Aceita somente letras minúsculas de a-z."},{pattern:"^[A-Z]+$",label:"Apenas maiúsculas",description:"Aceita somente letras maiúsculas de A-Z."},{pattern:"^[A-Za-zÀ-ÿ]+$",label:"Letras com acentos",description:"Aceita letras incluindo acentuadas (é, ã, ü, etc.)."},{pattern:"^[A-Za-zÀ-ÿ\\s]+$",label:"Letras, acentos e espaços",description:"Aceita letras com acentos e espaços — ideal para nomes completos."},{pattern:"^[A-Za-z0-9]+$",label:"Alfanumérico",description:"Apenas letras e números, sem espaços ou caracteres especiais."},{pattern:"^[A-Za-z0-9\\s]+$",label:"Alfanumérico com espaços",description:"Letras, números e espaços."},{pattern:"^[A-Za-z0-9_]+$",label:"Alfanumérico + underscore",description:"Letras, números e underscore (_). Padrão para usernames."},{pattern:"^[A-Za-z0-9_-]+$",label:"Slug-friendly",description:"Letras, números, underscore e hífen. Ideal para slugs de URL."},{pattern:"^\\S+$",label:"Sem espaços",description:"Aceita qualquer caractere exceto espaços em branco."},{pattern:"^.{1,}$",label:"Não vazio",description:"Exige pelo menos 1 caractere (qualquer um)."}]},{category:"Números",presets:[{pattern:"^[0-9]+$",label:"Apenas dígitos",description:"Aceita somente dígitos numéricos (0-9)."},{pattern:"^-?[0-9]+$",label:"Inteiro (com negativo)",description:"Número inteiro, opcionalmente negativo."},{pattern:"^[0-9]+\\.?[0-9]*$",label:"Decimal positivo",description:"Número decimal positivo (ex: 3.14, 42)."},{pattern:"^-?[0-9]+\\.?[0-9]*$",label:"Decimal (com negativo)",description:"Número decimal, opcionalmente negativo."},{pattern:"^\\d{1,3}(\\.\\d{3})*(,\\d{2})?$",label:"Formato BR (1.234,56)",description:"Número no formato brasileiro com pontos de milhar e vírgula decimal."},{pattern:"^\\d{1,3}(,\\d{3})*(\\.\\d{2})?$",label:"Formato US (1,234.56)",description:"Número no formato americano com vírgulas de milhar e ponto decimal."},{pattern:"^[01]+$",label:"Binário",description:"Aceita apenas 0 e 1 — representação binária."},{pattern:"^[0-9A-Fa-f]+$",label:"Hexadecimal",description:"Aceita dígitos hexadecimais (0-9, A-F)."},{pattern:"^0[xX][0-9A-Fa-f]+$",label:"Hex com prefixo 0x",description:"Hexadecimal com prefixo 0x (ex: 0xFF)."},{pattern:"^[0-7]+$",label:"Octal",description:"Aceita apenas dígitos octais (0-7)."},{pattern:"^\\d+(\\.\\d{1,2})?$",label:"Monetário (2 casas)",description:"Número com até 2 casas decimais — ideal para valores monetários."},{pattern:"^\\d+(\\.\\d{1,4})?$",label:"Até 4 casas decimais",description:"Número com até 4 casas decimais."}]},{category:"Documentos BR",presets:[{pattern:"^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$",label:"CPF (com máscara)",description:"CPF formatado: 123.456.789-00."},{pattern:"^\\d{11}$",label:"CPF (sem máscara)",description:"CPF apenas dígitos: 12345678900."},{pattern:"^\\d{2}\\.\\d{3}\\.\\d{3}/\\d{4}-\\d{2}$",label:"CNPJ (com máscara)",description:"CNPJ formatado: 12.345.678/0001-00."},{pattern:"^\\d{14}$",label:"CNPJ (sem máscara)",description:"CNPJ apenas dígitos: 12345678000100."},{pattern:"^\\d{5}-?\\d{3}$",label:"CEP",description:"CEP brasileiro: 12345-678 ou 12345678."},{pattern:"^\\d{1,2}\\.\\d{3}\\.\\d{3}[-]?\\d{1}$",label:"RG (formato comum)",description:"RG no formato mais comum: 1.234.567-8."},{pattern:"^\\d{11}$",label:"PIS/PASEP",description:"PIS/PASEP com 11 dígitos."},{pattern:"^\\d{3}\\.?\\d{7}-?\\d{1}$",label:"Título de eleitor",description:"Título de eleitor com 12 dígitos."},{pattern:"^[A-Z]{2}\\d{7}$",label:"Passaporte BR",description:"Passaporte brasileiro: 2 letras + 7 dígitos (ex: AB1234567)."},{pattern:"^\\d{11}$",label:"CNH (registro)",description:"Número de registro da CNH: 11 dígitos."},{pattern:"^\\d{10}$",label:"Certidão (matrícula)",description:"Matrícula de certidão de nascimento/casamento."},{pattern:"^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$|^\\d{2}\\.\\d{3}\\.\\d{3}/\\d{4}-\\d{2}$",label:"CPF ou CNPJ",description:"Aceita CPF (123.456.789-00) ou CNPJ (12.345.678/0001-00)."}]},{category:"Contato",presets:[{pattern:"^[\\w.-]+@[\\w.-]+\\.[A-Za-z]{2,}$",label:"E-mail simples",description:"Validação básica de e-mail: usuario@dominio.com."},{pattern:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",label:"E-mail completo",description:"E-mail com mais caracteres aceitos no usuário."},{pattern:"^\\(\\d{2}\\)\\s?\\d{4,5}-\\d{4}$",label:"Telefone BR (com máscara)",description:"Telefone formatado: (11) 91234-5678 ou (11) 1234-5678."},{pattern:"^\\d{10,11}$",label:"Telefone BR (sem máscara)",description:"Telefone apenas dígitos: 11912345678."},{pattern:"^\\+\\d{1,3}\\s?\\d{2,3}\\s?\\d{4,5}[-]?\\d{4}$",label:"Telefone internacional",description:"Formato +55 11 91234-5678."},{pattern:"^\\+55\\d{10,11}$",label:"Celular BR (+55)",description:"Celular brasileiro com DDI: +5511912345678."},{pattern:"^\\d{4,5}-\\d{4}$",label:"Telefone (sem DDD)",description:"Número local: 1234-5678 ou 91234-5678."},{pattern:"^0800\\d{6,7}$",label:"0800",description:"Número 0800 (SAC): 0800XXXXXXX."}]},{category:"Internet / URLs",presets:[{pattern:"^https?://[\\w.-]+(:\\d+)?(/[\\w./-]*)*$",label:"URL HTTP/HTTPS",description:"URL completa com protocolo http ou https."},{pattern:"^(https?://)?[\\w.-]+\\.[A-Za-z]{2,}(/.*)?$",label:"URL (protocolo opcional)",description:"URL com ou sem http:// na frente."},{pattern:"^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*\\.[a-z]{2,}$",label:"Domínio",description:"Nome de domínio válido: exemplo.com.br."},{pattern:"^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$",label:"IPv4",description:"Endereço IPv4: 192.168.0.1."},{pattern:"^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$",label:"IPv6 (completo)",description:"Endereço IPv6 completo."},{pattern:"^[a-z][a-z0-9-]*$",label:"Subdomínio",description:"Nome de subdomínio válido (letra inicial, alfanumérico + hífen)."},{pattern:"^[A-Za-z][A-Za-z0-9+.-]*://.*$",label:"URI genérica",description:"Qualquer URI com esquema (ftp://, mailto:, tel:, etc.)."},{pattern:"^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",label:"Cor hex (#FFF)",description:"Código de cor hexadecimal: #FFF ou #FFFFFF."},{pattern:"^#[0-9A-Fa-f]{8}$",label:"Cor hex com alpha",description:"Cor hexadecimal com canal alpha: #FFFFFFFF."},{pattern:"^rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)$",label:"Cor RGB",description:"Cor no formato rgb(255, 0, 0)."}]},{category:"Data e hora",presets:[{pattern:"^\\d{2}/\\d{2}/\\d{4}$",label:"Data DD/MM/AAAA",description:"Data no formato brasileiro: 25/12/2024."},{pattern:"^\\d{4}-\\d{2}-\\d{2}$",label:"Data ISO (AAAA-MM-DD)",description:"Data no formato ISO 8601: 2024-12-25."},{pattern:"^\\d{2}/\\d{2}/\\d{2}$",label:"Data DD/MM/AA",description:"Data com ano de 2 dígitos: 25/12/24."},{pattern:"^\\d{2}-\\d{2}-\\d{4}$",label:"Data DD-MM-AAAA",description:"Data com hífens: 25-12-2024."},{pattern:"^\\d{2}:\\d{2}$",label:"Hora HH:MM",description:"Horário 24h: 14:30."},{pattern:"^\\d{2}:\\d{2}:\\d{2}$",label:"Hora HH:MM:SS",description:"Horário com segundos: 14:30:59."},{pattern:"^(0[1-9]|1[0-2])/\\d{4}$",label:"Mês/Ano (MM/AAAA)",description:"Mês e ano: 12/2024."},{pattern:"^\\d{4}$",label:"Ano (4 dígitos)",description:"Ano com 4 dígitos: 2024."},{pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$",label:"DateTime ISO (sem seg)",description:"Data e hora ISO: 2024-12-25T14:30."},{pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",label:"DateTime ISO (com seg)",description:"Data e hora ISO com segundos."},{pattern:"^\\d{2}/\\d{2}/\\d{4}\\s\\d{2}:\\d{2}$",label:"DateTime BR",description:"Data e hora BR: 25/12/2024 14:30."}]},{category:"Senhas",presets:[{pattern:"^.{6,}$",label:"Mín. 6 caracteres",description:"Exige no mínimo 6 caracteres (qualquer tipo)."},{pattern:"^.{8,}$",label:"Mín. 8 caracteres",description:"Exige no mínimo 8 caracteres."},{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).{8,}$",label:"Forte (letra+número)",description:"Mín. 8 chars com pelo menos 1 maiúscula, 1 minúscula e 1 número."},{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!@#$%^&*]).{8,}$",label:"Muito forte",description:"Mín. 8 chars com maiúscula, minúscula, número e caractere especial."},{pattern:"^(?=.*[A-Z])(?=.*\\d).{6,}$",label:"Média (maiúsc+número)",description:"Mín. 6 chars com pelo menos 1 maiúscula e 1 número."},{pattern:"^(?!.*\\s).{8,}$",label:"Sem espaços (mín. 8)",description:"Mín. 8 caracteres, sem espaços."}]},{category:"Nomes e texto formatado",presets:[{pattern:"^[A-Za-zÀ-ÿ]{2,}(\\s[A-Za-zÀ-ÿ]{2,})+$",label:"Nome completo",description:"Nome e sobrenome (mínimo 2 palavras, cada com 2+ letras)."},{pattern:"^[A-Za-zÀ-ÿ]{2,}$",label:"Primeiro nome",description:"Apenas o primeiro nome (mínimo 2 letras, com acentos)."},{pattern:"^[A-Za-zÀ-ÿ'\\-\\s]+$",label:"Nome com apóstrofo/hífen",description:"Nome que aceita D'Silva, Maria-José, etc."},{pattern:"^[A-Z][a-zà-ÿ]+(\\s[A-Z][a-zà-ÿ]+)*$",label:"Nome capitalizado",description:"Cada palavra inicia com maiúscula: João Silva."},{pattern:"^@[A-Za-z0-9_]{1,30}$",label:"Username (@handle)",description:"Username no estilo @usuario (letras, números, underscore, até 30 chars)."},{pattern:"^[a-z0-9_]{3,20}$",label:"Username simples",description:"Username minúsculo: 3-20 chars, letras, números e underscore."},{pattern:"^[A-Za-z0-9._%+-]+$",label:"Parte local do e-mail",description:"Parte antes do @ em endereços de e-mail."}]},{category:"Endereço",presets:[{pattern:"^[A-Za-zÀ-ÿ0-9\\s,./-]+$",label:"Endereço genérico",description:"Aceita letras, números, espaços, vírgulas, pontos, barras e hífens."},{pattern:"^\\d{1,6}$",label:"Número residencial",description:"Número do endereço: 1 a 6 dígitos."},{pattern:"^\\d{5}-?\\d{3}$",label:"CEP",description:"CEP: 12345-678 ou 12345678."},{pattern:"^[A-Z]{2}$",label:"UF (estado)",description:"Sigla do estado brasileiro: SP, RJ, MG, etc."},{pattern:"^(Rua|Av|Avenida|Travessa|Alameda|Praça|Rod|Rodovia)\\s.+$",label:"Logradouro BR",description:"Começa com tipo de via: Rua, Avenida, Travessa, etc."},{pattern:"^(Apt|Apto|Sala|Bloco|Lote|Casa)\\s?\\d+.*$",label:"Complemento",description:"Complemento: Apto 123, Bloco B, Sala 3, etc."}]},{category:"Financeiro",presets:[{pattern:"^R\\$\\s?\\d{1,3}(\\.\\d{3})*(,\\d{2})?$",label:"Moeda BRL (R$)",description:"Valor em reais: R$ 1.234,56."},{pattern:"^\\$\\d{1,3}(,\\d{3})*(\\.\\d{2})?$",label:"Moeda USD ($)",description:"Valor em dólares: $1,234.56."},{pattern:"^\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}$",label:"Cartão de crédito",description:"Número de cartão: 1234 5678 9012 3456."},{pattern:"^(0[1-9]|1[0-2])/\\d{2}$",label:"Validade cartão (MM/AA)",description:"Data de validade: 12/25."},{pattern:"^\\d{3,4}$",label:"CVV",description:"Código de segurança: 3 ou 4 dígitos."},{pattern:"^\\d{1,6}(-[0-9Xx])?$",label:"Agência bancária",description:"Número da agência: 1234-5 ou 1234."},{pattern:"^\\d{1,12}(-[0-9Xx])?$",label:"Conta bancária",description:"Número da conta: até 12 dígitos com dígito verificador."},{pattern:"^\\d{1,3}(\\.\\d{3})*(,\\d{2})$",label:"Valor BR sem símbolo",description:"Valor monetário sem R$: 1.234,56."}]},{category:"Veículos",presets:[{pattern:"^[A-Z]{3}-?\\d{4}$",label:"Placa antiga (ABC-1234)",description:"Placa veicular formato antigo: ABC-1234."},{pattern:"^[A-Z]{3}\\d[A-Z]\\d{2}$",label:"Placa Mercosul (ABC1D23)",description:"Placa veicular Mercosul: ABC1D23."},{pattern:"^[A-Z]{3}-?\\d{4}$|^[A-Z]{3}\\d[A-Z]\\d{2}$",label:"Placa (ambos formatos)",description:"Aceita placa antiga (ABC-1234) ou Mercosul (ABC1D23)."},{pattern:"^\\d{11}$",label:"RENAVAM",description:"RENAVAM: 11 dígitos numéricos."},{pattern:"^[A-Z0-9]{17}$",label:"Chassi (VIN)",description:"Número de chassi/VIN: 17 caracteres alfanuméricos maiúsculos."}]},{category:"Códigos e identificadores",presets:[{pattern:"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",label:"UUID v4",description:"UUID formato padrão: 550e8400-e29b-41d4-a716-446655440000."},{pattern:"^[A-Za-z0-9+/]+={0,2}$",label:"Base64",description:"String codificada em Base64."},{pattern:"^[A-Za-z0-9-_]+$",label:"Base64 URL-safe",description:"Base64 com caracteres seguros para URL."},{pattern:"^[0-9a-f]{32}$",label:"MD5 hash",description:"Hash MD5: 32 caracteres hexadecimais."},{pattern:"^[0-9a-f]{40}$",label:"SHA-1 hash",description:"Hash SHA-1: 40 caracteres hexadecimais."},{pattern:"^[0-9a-f]{64}$",label:"SHA-256 hash",description:"Hash SHA-256: 64 caracteres hexadecimais."},{pattern:"^\\d{8,14}$",label:"Código de barras",description:"Código de barras numérico: 8-14 dígitos."},{pattern:"^\\d{44}$",label:"Linha digitável boleto",description:"Linha digitável de boleto: 44 dígitos."},{pattern:"^[A-Z]{2}\\d{2}[A-Z0-9]{4}\\d{7}([A-Z0-9]?){0,16}\\d{2}$",label:"IBAN",description:"Código bancário internacional IBAN."},{pattern:"^[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$",label:"SWIFT/BIC",description:"Código SWIFT bancário: 8 ou 11 caracteres."}]},{category:"Saúde e governo",presets:[{pattern:"^\\d{15}$",label:"Cartão SUS",description:"Número do Cartão Nacional de Saúde: 15 dígitos."},{pattern:"^\\d{6,7}$",label:"CRM/CRO/CRP",description:"Número de registro profissional de saúde."},{pattern:"^\\d{3}\\.\\d{5}\\.\\d{2}-\\d$",label:"NIT/PIS",description:"Número de Identificação do Trabalhador."},{pattern:"^\\d{7}-?\\d{2}\\.\\d{4}\\.\\d\\.\\d{2}\\.\\d{4}$",label:"Processo judicial",description:"Número de processo judicial (formato CNJ)."},{pattern:"^\\d{12}$",label:"Inscrição estadual (genérica)",description:"Inscrição estadual genérica: 12 dígitos."},{pattern:"^\\d{11}$",label:"NIS/NIT",description:"Número de Identificação Social: 11 dígitos."}]},{category:"Redes sociais",presets:[{pattern:"^https?://(www\\.)?instagram\\.com/[A-Za-z0-9_.]+/?$",label:"Perfil Instagram",description:"URL de perfil do Instagram."},{pattern:"^https?://(www\\.)?facebook\\.com/.+$",label:"Perfil Facebook",description:"URL de perfil ou página do Facebook."},{pattern:"^https?://(www\\.)?linkedin\\.com/in/[A-Za-z0-9-]+/?$",label:"Perfil LinkedIn",description:"URL de perfil do LinkedIn."},{pattern:"^https?://(www\\.)?(twitter|x)\\.com/[A-Za-z0-9_]+/?$",label:"Perfil Twitter/X",description:"URL de perfil no Twitter/X."},{pattern:"^https?://(www\\.)?youtube\\.com/(c/|channel/|@)[A-Za-z0-9_-]+/?$",label:"Canal YouTube",description:"URL de canal do YouTube."},{pattern:"^https?://(www\\.)?github\\.com/[A-Za-z0-9_-]+/?$",label:"Perfil GitHub",description:"URL de perfil do GitHub."},{pattern:"^https?://(www\\.)?tiktok\\.com/@[A-Za-z0-9_.]+/?$",label:"Perfil TikTok",description:"URL de perfil do TikTok."}]},{category:"Programação",presets:[{pattern:"^[a-z][a-zA-Z0-9]*$",label:"camelCase",description:"Formato camelCase: minúscula inicial, sem espaços."},{pattern:"^[A-Z][a-zA-Z0-9]*$",label:"PascalCase",description:"Formato PascalCase: maiúscula inicial."},{pattern:"^[a-z]+(_[a-z]+)*$",label:"snake_case",description:"Formato snake_case: minúsculas separadas por underscore."},{pattern:"^[a-z]+(-[a-z]+)*$",label:"kebab-case",description:"Formato kebab-case: minúsculas separadas por hífen."},{pattern:"^[A-Z]+(_[A-Z]+)*$",label:"SCREAMING_SNAKE",description:"Constantes: MAIÚSCULAS_COM_UNDERSCORES."},{pattern:"^[a-zA-Z_$][a-zA-Z0-9_$]*$",label:"Variável JS válida",description:"Nome de variável JavaScript válido."},{pattern:"^v?\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$",label:"Semver",description:"Versionamento semântico: v1.2.3 ou 1.2.3-beta.1."},{pattern:"^[a-z][a-z0-9]*(-[a-z][a-z0-9]*)*$",label:"Nome de pacote npm",description:"Nome válido de pacote npm."}]}],i0=zo.flatMap(e=>e.presets),l0=({value:e,message:t,onChange:r})=>{const[a,n]=E.useState(!1),[s,i]=E.useState(""),l=E.useMemo(()=>{if(!s.trim())return zo;const u=s.toLowerCase();return zo.map(p=>({...p,presets:p.presets.filter(m=>m.label.toLowerCase().includes(u)||m.description.toLowerCase().includes(u)||m.pattern.toLowerCase().includes(u))})).filter(p=>p.presets.length>0)},[s]),c=E.useMemo(()=>e?i0.find(u=>u.pattern===e):void 0,[e]),d=u=>{r(u.pattern,`${u.label}: formato inválido`),n(!1),i("")};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(W,{className:"text-[10px]",children:"Regex"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(ae,{value:e??"",onChange:u=>r(u.target.value||void 0,t),className:"h-7 text-xs font-mono flex-1",placeholder:"Clique no botão ou digite..."}),e&&o.jsx(ye,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>{r(void 0,void 0)},children:o.jsx(P.X,{className:"h-3 w-3"})}),o.jsxs(Ia,{open:a,onOpenChange:n,children:[o.jsx(La,{asChild:!0,children:o.jsx(ye,{variant:"outline",size:"icon",className:"h-7 w-7 shrink-0",children:o.jsx(P.Regex,{className:"h-3.5 w-3.5"})})}),o.jsxs(Pr,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(P.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ae,{value:s,onChange:u=>i(u.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar regex (ex: CPF, e-mail, senha)...",autoFocus:!0})]})}),o.jsx(Ca,{className:"h-[360px]",children:o.jsxs("div",{className:"p-1",children:[l.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum regex encontrado"}),l.map(u=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:u.category}),u.presets.map(p=>o.jsxs(Cu,{children:[o.jsx(Su,{asChild:!0,children:o.jsxs("button",{onClick:()=>d(p),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors group",children:[o.jsx(P.ChevronRight,{className:"h-3 w-3 text-muted-foreground/50 group-hover:text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium block truncate",children:p.label}),o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono block truncate",children:p.pattern})]})]})}),o.jsxs(Vn,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:p.label}),o.jsx("p",{children:p.description})]})]},p.pattern+p.label))]},u.category))]})})]})]})]}),c&&o.jsxs(qa,{variant:"secondary",className:"text-[10px] font-normal gap-1",children:[o.jsx(P.Regex,{className:"h-2.5 w-2.5"}),c.label]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Mensagem do regex"}),o.jsx(ae,{value:t??"",onChange:u=>r(e,u.target.value||void 0),className:"h-7 text-xs",placeholder:"Formato inválido"})]})]})},Mo=[{category:"Imagens",presets:[{value:"image/jpeg",label:"JPEG",description:"Imagem JPEG — formato mais comum para fotos. Boa compressão, perde qualidade."},{value:"image/png",label:"PNG",description:"Imagem PNG — suporta transparência, sem perda de qualidade. Arquivos maiores."},{value:"image/gif",label:"GIF",description:"Imagem GIF — suporta animações simples e transparência. Limitado a 256 cores."},{value:"image/webp",label:"WebP",description:"Formato moderno do Google — compressão superior ao JPEG e PNG."},{value:"image/svg+xml",label:"SVG",description:"Imagem vetorial XML — escalável sem perda. Ideal para logos e ícones."},{value:"image/bmp",label:"BMP",description:"Bitmap — sem compressão, arquivos muito grandes."},{value:"image/tiff",label:"TIFF",description:"Imagem TIFF — alta qualidade, usado em impressão profissional."},{value:"image/avif",label:"AVIF",description:"Formato moderno — melhor compressão que WebP, suporte crescente."},{value:"image/heic",label:"HEIC",description:"Formato padrão do iPhone — alta qualidade, tamanho reduzido."},{value:"image/*",label:"Qualquer imagem",description:"Aceita todos os formatos de imagem (JPEG, PNG, GIF, WebP, etc.)."}]},{category:"Documentos",presets:[{value:"application/pdf",label:"PDF",description:"Documento PDF — formato universal para documentos. Preserva formatação."},{value:"application/msword",label:"DOC (Word antigo)",description:"Microsoft Word 97-2003 (.doc)."},{value:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",label:"DOCX (Word)",description:"Microsoft Word moderno (.docx) — formato atual do Word."},{value:"application/vnd.ms-excel",label:"XLS (Excel antigo)",description:"Microsoft Excel 97-2003 (.xls)."},{value:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",label:"XLSX (Excel)",description:"Microsoft Excel moderno (.xlsx) — formato atual do Excel."},{value:"application/vnd.ms-powerpoint",label:"PPT (PowerPoint antigo)",description:"Microsoft PowerPoint 97-2003 (.ppt)."},{value:"application/vnd.openxmlformats-officedocument.presentationml.presentation",label:"PPTX (PowerPoint)",description:"Microsoft PowerPoint moderno (.pptx)."},{value:"application/vnd.oasis.opendocument.text",label:"ODT (LibreOffice)",description:"Documento de texto LibreOffice/OpenOffice (.odt)."},{value:"application/vnd.oasis.opendocument.spreadsheet",label:"ODS (LibreOffice)",description:"Planilha LibreOffice/OpenOffice (.ods)."},{value:"application/rtf",label:"RTF",description:"Rich Text Format — compatível com quase todos os editores de texto."},{value:"text/plain",label:"TXT",description:"Texto puro sem formatação (.txt)."},{value:"text/csv",label:"CSV",description:"Valores separados por vírgula — planilhas simples e dados tabulares."}]},{category:"Vídeos",presets:[{value:"video/mp4",label:"MP4",description:"Vídeo MP4 — formato mais compatível, boa compressão (H.264/H.265)."},{value:"video/webm",label:"WebM",description:"Vídeo WebM — formato aberto do Google, boa compressão."},{value:"video/quicktime",label:"MOV",description:"Vídeo QuickTime — formato padrão do macOS/iPhone."},{value:"video/x-msvideo",label:"AVI",description:"Vídeo AVI — formato antigo da Microsoft, arquivos grandes."},{value:"video/x-matroska",label:"MKV",description:"Matroska — contêiner flexível, suporta múltiplas faixas de áudio/legenda."},{value:"video/*",label:"Qualquer vídeo",description:"Aceita todos os formatos de vídeo."}]},{category:"Áudios",presets:[{value:"audio/mpeg",label:"MP3",description:"Áudio MP3 — formato mais popular, boa compressão com perda."},{value:"audio/wav",label:"WAV",description:"Áudio WAV — sem compressão, alta qualidade, arquivos grandes."},{value:"audio/ogg",label:"OGG",description:"Áudio OGG Vorbis — formato aberto, boa qualidade."},{value:"audio/aac",label:"AAC",description:"Áudio AAC — qualidade superior ao MP3 no mesmo bitrate."},{value:"audio/flac",label:"FLAC",description:"Áudio FLAC — compressão sem perda, alta fidelidade."},{value:"audio/webm",label:"WebM Áudio",description:"Áudio no contêiner WebM."},{value:"audio/*",label:"Qualquer áudio",description:"Aceita todos os formatos de áudio."}]},{category:"Compactados",presets:[{value:"application/zip",label:"ZIP",description:"Arquivo compactado ZIP — o mais universal."},{value:"application/x-rar-compressed",label:"RAR",description:"Arquivo compactado RAR — boa compressão, formato proprietário."},{value:"application/gzip",label:"GZ / GZIP",description:"Compactação GZIP — muito usado em ambientes Unix/Linux."},{value:"application/x-7z-compressed",label:"7Z",description:"Arquivo 7-Zip — excelente taxa de compressão."},{value:"application/x-tar",label:"TAR",description:"TAR — agrupa arquivos sem compressão (usado com gzip)."}]},{category:"Dados / Código",presets:[{value:"application/json",label:"JSON",description:"Dados JSON — formato leve para troca de dados."},{value:"application/xml",label:"XML",description:"Dados XML — formato de marcação extensível."},{value:"text/html",label:"HTML",description:"Página web HTML."},{value:"text/css",label:"CSS",description:"Folha de estilo CSS."},{value:"application/javascript",label:"JavaScript",description:"Código JavaScript (.js)."},{value:"application/x-yaml",label:"YAML",description:"Dados YAML — formato legível para configurações."},{value:"text/markdown",label:"Markdown",description:"Texto Markdown (.md) — formatação leve."}]},{category:"Fontes",presets:[{value:"font/ttf",label:"TTF",description:"Fonte TrueType — amplamente suportada."},{value:"font/otf",label:"OTF",description:"Fonte OpenType — recursos tipográficos avançados."},{value:"font/woff",label:"WOFF",description:"Web Open Font Format — otimizado para web."},{value:"font/woff2",label:"WOFF2",description:"WOFF2 — compressão superior ao WOFF."}]},{category:"Atalhos comuns",presets:[{value:"image/*",label:"Todas as imagens",description:"Aceita qualquer formato de imagem."},{value:"video/*",label:"Todos os vídeos",description:"Aceita qualquer formato de vídeo."},{value:"audio/*",label:"Todos os áudios",description:"Aceita qualquer formato de áudio."},{value:"_group_documentos",label:"Documentos comuns",description:"PDF + Word .doc e .docx.",group:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"]},{value:"_group_imagens_web",label:"Imagens web",description:"JPEG, PNG e WebP — formatos mais usados na web.",group:["image/jpeg","image/png","image/webp"]},{value:"_group_planilhas",label:"Planilhas",description:"Excel .xls, .xlsx e CSV.",group:["application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/csv"]}]}],c0=Mo.flatMap(e=>e.presets),d0=({value:e,onChange:t})=>{const[r,a]=E.useState(!1),[n,s]=E.useState(""),[i,l]=E.useState(""),c=E.useMemo(()=>new Set(e??[]),[e]),d=E.useMemo(()=>{if(!n.trim())return Mo;const g=n.toLowerCase();return Mo.map(f=>({...f,presets:f.presets.filter(v=>v.label.toLowerCase().includes(g)||v.description.toLowerCase().includes(g)||v.value.toLowerCase().includes(g))})).filter(f=>f.presets.length>0)},[n]),u=g=>{const f=new Set(e??[]);g.group?g.group.every(v=>f.has(v))?g.group.forEach(v=>f.delete(v)):g.group.forEach(v=>f.add(v)):f.has(g.value)?f.delete(g.value):f.add(g.value),t(f.size>0?Array.from(f):void 0)},p=()=>{const g=i.trim();if(!g)return;const f=new Set(e??[]);f.add(g),t(Array.from(f)),l("")},m=g=>{const f=new Set(e??[]);f.delete(g),t(f.size>0?Array.from(f):void 0)},x=g=>{const f=c0.find(v=>v.value===g);return(f==null?void 0:f.label)??g};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(W,{className:"text-[10px]",children:"Tipos de arquivo aceitos"}),((e==null?void 0:e.length)??0)>0&&o.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(g=>o.jsxs(qa,{variant:"secondary",className:"text-[10px] gap-1 pr-1",children:[x(g),o.jsx("button",{onClick:()=>m(g),className:"hover:text-destructive",children:o.jsx(P.X,{className:"h-2.5 w-2.5"})})]},g))}),o.jsxs(Ia,{open:r,onOpenChange:a,children:[o.jsx(La,{asChild:!0,children:o.jsxs(ye,{variant:"outline",className:"w-full h-8 text-xs justify-start gap-2",children:[o.jsx(P.FileType2,{className:"h-3.5 w-3.5"}),((e==null?void 0:e.length)??0)>0?`${e.length} tipo(s) selecionado(s)`:"Selecionar tipos de arquivo..."]})}),o.jsxs(Pr,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(P.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ae,{value:n,onChange:g=>s(g.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar tipos (ex: PDF, imagem, vídeo)...",autoFocus:!0})]})}),o.jsxs("div",{className:"px-2 py-1.5 border-b flex gap-1",children:[o.jsx(ae,{value:i,onChange:g=>l(g.target.value),className:"h-7 text-xs font-mono flex-1",placeholder:"Tipo customizado (ex: .dwg)",onKeyDown:g=>g.key==="Enter"&&p()}),o.jsx(ye,{variant:"secondary",size:"sm",className:"h-7 text-xs shrink-0",onClick:p,disabled:!i.trim(),children:"Adicionar"})]}),o.jsx(Ca,{className:"h-[320px]",children:o.jsxs("div",{className:"p-1",children:[d.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum tipo encontrado"}),d.map(g=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:g.category}),g.presets.map(f=>{const v=f.group?f.group.every(j=>c.has(j)):c.has(f.value),b=f.group?f.group.some(j=>c.has(j))&&!v:!1;return o.jsxs(Cu,{children:[o.jsx(Su,{asChild:!0,children:o.jsxs("button",{onClick:()=>u(f),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors",children:[o.jsx(Pe,{checked:b?"indeterminate":v,className:"h-3.5 w-3.5",tabIndex:-1}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium",children:f.label}),!f.group&&o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono ml-2",children:f.value}),f.group&&o.jsxs("span",{className:"text-[10px] text-muted-foreground ml-2",children:[f.group.length," tipos"]})]}),o.jsx(P.Info,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"})]})}),o.jsxs(Vn,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:f.label}),o.jsx("p",{children:f.description}),f.group&&o.jsx("ul",{className:"mt-1 space-y-0.5",children:f.group.map(j=>o.jsx("li",{className:"font-mono text-[10px] opacity-80",children:j},j))})]})]},f.value)})]},g.category))]})})]})]})]})},ku=1048576,la=1073741824;function ci(e){return e>=la&&e%la===0?"GB":"MB"}function di(e,t){return t==="GB"?e/la:e/ku}function ui(e,t){return Math.round(e*(t==="GB"?la:ku))}const u0=({value:e,onChange:t})=>{const r=E.useMemo(()=>e?ci(e):"MB",[]),[a,n]=E.useState(r),[s,i]=E.useState(e?String(di(e,r)):"");E.useEffect(()=>{if(e===void 0){i("");return}const d=ci(e);n(d),i(String(di(e,d)))},[e]);const l=d=>{i(d);const u=parseFloat(d);d.trim()===""||isNaN(u)||u<=0?t(void 0):t(ui(u,a))},c=d=>{n(d);const u=parseFloat(s);!isNaN(u)&&u>0&&t(ui(u,d))};return o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(W,{className:"text-[10px]",children:"Tamanho máximo do arquivo"}),o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(ae,{type:"number",min:0,step:"any",value:s,onChange:d=>l(d.target.value),placeholder:"Ex: 10",className:"h-8 text-xs flex-1"}),o.jsxs(Ge,{value:a,onValueChange:d=>c(d),children:[o.jsx(He,{className:"w-[72px] h-8 text-xs",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"MB",children:"MB"}),o.jsx(Se,{value:"GB",children:"GB"})]})]})]}),e!==void 0&&o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["= ",e.toLocaleString("pt-BR")," bytes"]})]})},p0=new Set(["texto","textarea","email","password","url","phone","tel","cpf","cnpj","cep","rg"]),m0=({fieldType:e,validation:t,onChange:r})=>{const a=(i,l)=>{const c=["minLength","maxLength","min","max","maxFileSize","minAge","maxAge"].includes(i)?l?Number(l):void 0:l||void 0;r({...t,[i]:c})},n=e==="file",s=p0.has(e);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Validação"}),s&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Min caracteres"}),o.jsx(ae,{type:"number",min:0,value:(t==null?void 0:t.minLength)??"",onChange:i=>a("minLength",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Max caracteres"}),o.jsx(ae,{type:"number",min:0,value:(t==null?void 0:t.maxLength)??"",onChange:i=>a("maxLength",i.target.value),className:"h-7 text-xs"})]})]}),e==="number"&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Valor mínimo"}),o.jsx(ae,{type:"number",value:(t==null?void 0:t.min)??"",onChange:i=>a("min",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Valor máximo"}),o.jsx(ae,{type:"number",value:(t==null?void 0:t.max)??"",onChange:i=>a("max",i.target.value),className:"h-7 text-xs"})]})]}),(e==="date"||e==="datetime")&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Data mínima"}),o.jsx(ae,{type:"date",value:(t==null?void 0:t.minDate)??"",onChange:i=>a("minDate",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Data máxima"}),o.jsx(ae,{type:"date",value:(t==null?void 0:t.maxDate)??"",onChange:i=>a("maxDate",i.target.value),className:"h-7 text-xs"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Idade mínima (anos)"}),o.jsx(ae,{type:"number",min:0,value:(t==null?void 0:t.minAge)??"",onChange:i=>a("minAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 18"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Idade máxima (anos)"}),o.jsx(ae,{type:"number",min:0,value:(t==null?void 0:t.maxAge)??"",onChange:i=>a("maxAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 60"})]})]})]}),n&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(d0,{value:t==null?void 0:t.fileTypes,onChange:i=>r({...t,fileTypes:i})}),o.jsx(u0,{value:t==null?void 0:t.maxFileSize,onChange:i=>r({...t,maxFileSize:i})})]}),!n&&o.jsx(l0,{value:(t==null?void 0:t.regex)??"",message:(t==null?void 0:t.regexMessage)??"",onChange:(i,l)=>r({...t,regex:i,regexMessage:l})})]})},_u=({options:e,onChange:t})=>{const r=E.useRef([]);if(r.current.length<e.length)for(let i=r.current.length;i<e.length;i++)r.current.push(`opt-${Math.random().toString(36).slice(2)}`);const a=E.useCallback((i,l,c)=>{const d=[...e];d[i]={...d[i],[l]:c},t(d)},[e,t]),n=E.useCallback(i=>{r.current.splice(i,1),t(e.filter((l,c)=>c!==i))},[e,t]),s=E.useCallback(()=>{t([...e,{value:"",label:""}])},[e,t]);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Opções"}),e.map((i,l)=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(P.GripVertical,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}),o.jsx(ae,{value:i.value,onChange:c=>a(l,"value",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Valor"}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-1",children:[o.jsx(ae,{value:i.label,onChange:c=>a(l,"label",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Label"}),o.jsx(ht,{})]}),o.jsx(ye,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>n(l),children:o.jsx(P.Trash2,{className:"h-3 w-3"})})]},r.current[l])),o.jsxs(ye,{variant:"outline",size:"sm",className:"w-full h-7 text-xs",onClick:s,children:[o.jsx(P.Plus,{className:"h-3 w-3 mr-1"})," Adicionar opção"]})]})},f0=[{value:"igual",label:"Igual a"},{value:"diferente",label:"Diferente de"},{value:"vazio",label:"Vazio"},{value:"naoVazio",label:"Não vazio"},{value:"contem",label:"Contém"},{value:"naoContem",label:"Não contém"},{value:"maiorQue",label:"Maior que"},{value:"menorQue",label:"Menor que"},{value:"maiorOuIgual",label:"Maior ou igual a"},{value:"menorOuIgual",label:"Menor ou igual a"}],h0=["vazio","naoVazio"],pi=({cond:e,selectedId:t,allFieldIds:r,getFieldLabel:a,onUpdate:n})=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Fonte"}),o.jsxs(Ge,{value:e.source||"campo",onValueChange:s=>n({source:s,when:""}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"campo",children:"Campo do formulário"}),o.jsx(Se,{value:"evento",children:"Variável do evento"})]})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:e.source==="evento"?"Variável do evento":"Quando o campo"}),o.jsxs(Ge,{value:e.when||"",onValueChange:s=>n({when:s}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{placeholder:e.source==="evento"?"Selecione uma variável...":"Selecione um campo..."})}),o.jsx(We,{children:e.source==="evento"?on.map(s=>o.jsx(Se,{value:s.key,children:s.label},s.key)):r.filter(s=>s!==t).map(s=>o.jsxs(Se,{value:s,children:[a(s),o.jsxs("span",{className:"text-muted-foreground/50 ml-1 text-[9px] font-mono",children:["(",s,")"]})]},s))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Operador"}),o.jsxs(Ge,{value:e.operator,onValueChange:s=>n({operator:s}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{})}),o.jsx(We,{children:f0.map(s=>o.jsx(Se,{value:s.value,children:s.label},s.value))})]})]}),!h0.includes(e.operator)&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Valor"}),o.jsx(ae,{value:e.value||"",onChange:s=>n({value:s.target.value}),className:"h-7 text-xs",placeholder:"Valor esperado"})]})]}),x0=({condition:e,selectedId:t,allFieldIds:r,getFieldLabel:a,onChange:n})=>{var s;const i=p=>{e&&n({...e,...p})},l=()=>{if(!e)return;const p=e.extraConditions??[];n({...e,logicOperator:e.logicOperator??"and",extraConditions:[...p,{when:"",operator:"igual",value:"",source:"campo"}]})},c=p=>{if(!e)return;const m=(e.extraConditions??[]).filter((x,g)=>g!==p);n({...e,extraConditions:m,logicOperator:m.length?e.logicOperator:void 0})},d=(p,m)=>{if(!e)return;const x=(e.extraConditions??[]).map((g,f)=>f===p?{...g,...m}:g);n({...e,extraConditions:x})},u=(((s=e==null?void 0:e.extraConditions)==null?void 0:s.length)??0)>0;return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Condicional"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"has-condition",checked:!!e,onCheckedChange:p=>{n(p?{when:"",operator:"igual",value:"",source:"campo"}:void 0)}}),o.jsx(W,{htmlFor:"has-condition",className:"text-xs cursor-pointer",children:"Exibir condicionalmente"})]}),e&&o.jsxs("div",{className:"space-y-2 pl-2 border-l-2 border-amber-500/30",children:[o.jsx(pi,{cond:e,selectedId:t,allFieldIds:r,getFieldLabel:a,onUpdate:i}),u&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Lógica"}),o.jsxs(Ge,{value:e.logicOperator??"and",onValueChange:p=>i({logicOperator:p}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"and",children:"E (AND) — todas devem ser verdadeiras"}),o.jsx(Se,{value:"or",children:"OU (OR) — pelo menos uma deve ser verdadeira"})]})]})]}),(e.extraConditions??[]).map((p,m)=>o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/40",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-[10px] text-muted-foreground font-medium uppercase",children:[e.logicOperator==="or"?"OU":"E"," — condição"," ",m+2]}),o.jsx(ye,{variant:"ghost",size:"sm",className:"h-5 px-1 text-[10px] text-destructive hover:text-destructive",onClick:()=>c(m),children:"Remover"})]}),o.jsx(pi,{cond:p,selectedId:t,allFieldIds:r,getFieldLabel:a,onUpdate:x=>d(m,x)})]},m)),o.jsx(ye,{variant:"outline",size:"sm",className:"h-6 text-[10px] w-full mt-1",onClick:l,children:"+ Adicionar condição"})]})]})},mi=[{value:"texto",label:"Texto"},{value:"textarea",label:"Área de texto"},{value:"number",label:"Número"},{value:"email",label:"E-mail"},{value:"telefone",label:"Telefone"},{value:"cpf",label:"CPF"},{value:"cep",label:"CEP"},{value:"date",label:"Data"},{value:"datetime",label:"Data e hora"},{value:"select",label:"Seleção"},{value:"radio",label:"Radio"},{value:"checkbox",label:"Checkbox"}],g0=({subFields:e,onChange:t})=>{const[r,a]=E.useState(null),n=(i,l)=>{const c=e.map((d,u)=>u===i?{...d,...l}:d);t(c)},s=i=>{t(e.filter((l,c)=>c!==i)),a(null)};return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs font-semibold",children:"Sub-campos"}),o.jsxs(ye,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs gap-1",onClick:()=>{const i={label:"Novo campo",name:`campo_${e.length+1}`,fieldType:"texto",required:!1};t([...e,i]),a(e.length)},children:[o.jsx(P.Plus,{className:"w-3 h-3"}),"Adicionar"]})]}),e.length===0&&o.jsx("p",{className:"text-[11px] text-muted-foreground italic py-1",children:"Nenhum sub-campo adicionado."}),e.map((i,l)=>{var c;return o.jsxs("div",{className:"border rounded-md text-xs overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-muted/40 select-none",onClick:()=>a(r===l?null:l),children:[o.jsx(qa,{variant:"secondary",className:"h-4 text-[9px] px-1 shrink-0",children:l+1}),o.jsx("span",{className:"flex-1 truncate font-medium",children:i.label||i.name||"Campo sem nome"}),o.jsx("span",{className:"text-muted-foreground text-[10px] shrink-0",children:((c=mi.find(d=>d.value===i.fieldType))==null?void 0:c.label)??i.fieldType}),o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 text-destructive hover:text-destructive shrink-0",onClick:d=>{d.stopPropagation(),s(l)},children:o.jsx(P.Trash2,{className:"w-3 h-3"})}),r===l?o.jsx(P.ChevronUp,{className:"w-3 h-3 text-muted-foreground shrink-0"}):o.jsx(P.ChevronDown,{className:"w-3 h-3 text-muted-foreground shrink-0"})]}),r===l&&o.jsxs("div",{className:"px-2 pb-2 space-y-2 border-t bg-muted/20",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Label"}),o.jsx(ae,{value:i.label,onChange:d=>n(l,{label:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: Nome"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Nome (campo)"}),o.jsx(ae,{value:i.name||"",onChange:d=>n(l,{name:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: nome"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Tipo de campo"}),o.jsxs(Ge,{value:i.fieldType,onValueChange:d=>n(l,{fieldType:d}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{})}),o.jsx(We,{children:mi.map(d=>o.jsx(Se,{value:d.value,className:"text-xs",children:d.label},d.value))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Colunas (1-12)"}),o.jsx(ae,{type:"number",min:1,max:12,value:i.tamanho??"",onChange:d=>n(l,{tamanho:d.target.value?Number(d.target.value):void 0}),className:"h-7 text-xs",placeholder:"12"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Placeholder"}),o.jsx(ae,{value:i.placeholder||"",onChange:d=>n(l,{placeholder:d.target.value}),className:"h-7 text-xs",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:`sf-req-${l}`,checked:i.required||!1,onCheckedChange:d=>n(l,{required:d===!0})}),o.jsx(W,{htmlFor:`sf-req-${l}`,className:"text-[10px] cursor-pointer",children:"Obrigatório"})]}),["select","radio","checkbox_group"].includes(i.fieldType)&&o.jsx("div",{className:"pt-1",children:o.jsx(_u,{options:i.options||[],onChange:d=>n(l,{options:d})})})]})]},l)}),e.length>0&&o.jsx(Ze,{className:"mt-1"})]})},v0=({config:e,selectedId:t,allFieldIds:r,getFieldLabel:a,onUpdate:n})=>{const s=e.fieldType||"texto",i=["select","radio","checkbox_group","autocomplete"].includes(s),l=s==="field_array",c=e.locked===!0,d=s==="participation_type",u=s==="payment_method",p=s==="terms",m=s==="slider",x=s==="rating",g=s==="date_range",f=s==="sub_form",{schemaId:v,uploadTermsPdf:b}=Je(),[j,y]=E.useState(e.termoPdfUploadId?"upload":"link"),[N,C]=E.useState({status:"idle"}),k=E.useRef(null),_=E.useCallback(async w=>{if(!v){C({status:"error",message:"Salve o schema primeiro para habilitar o upload de PDF."});return}if(!b){C({status:"error",message:"Upload de PDF não configurado. Forneça a prop uploadTermsPdf ao BuilderProvider."});return}C({status:"uploading",fileName:w.name,progress:0});try{const R=await b(w,v);n({termoPdfUploadId:R,termoPdfUrl:void 0}),C({status:"idle"})}catch(R){C({status:"error",message:R instanceof Error?R.message:"Falha no upload do PDF."})}},[v,b,n]);return o.jsxs("div",{className:"space-y-4",children:[c&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/10 border border-amber-500/30 px-3 py-2",children:[o.jsx(P.Lock,{className:"h-4 w-4 text-amber-500 shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-amber-600 dark:text-amber-400",children:"Campo bloqueado"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tipo, nome e ID são fixos (integração automática)"})]})]}),d&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(P.Lock,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Tipo de Participação"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Datas, preços e vagas são carregados automaticamente do evento"})]})]}),p&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(P.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Termos e Condições"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Configure o texto ou URL do PDF abaixo"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Label"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.label,onChange:w=>n({label:w.target.value}),className:"h-8 text-sm"})]}),d||u?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ae,{value:e.hint||"",onChange:w=>n({hint:w.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"req",checked:e.required||!1,onCheckedChange:w=>n({required:w===!0})}),o.jsx(W,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]})]}):p?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ae,{value:e.hint||"",onChange:w=>n({hint:w.target.value}),className:"h-8 text-sm",placeholder:"Ex: Leia os termos antes de continuar"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"req",checked:e.required||!1,onCheckedChange:w=>n({required:w===!0})}),o.jsx(W,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Conteúdo dos termos"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Texto dos termos"}),o.jsx(Ba,{value:e.termoTexto||"",onChange:w=>n({termoTexto:w.target.value||void 0}),className:"text-sm min-h-[120px] resize-y",placeholder:"Escreva aqui os termos e condições que o usuário deverá ler e aceitar..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(W,{className:"text-xs",children:"PDF dos termos (opcional)"}),o.jsxs("div",{className:"flex gap-1 p-0.5 bg-muted rounded-md",children:[o.jsx("button",{type:"button",onClick:()=>y("link"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${j==="link"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Link externo"}),o.jsx("button",{type:"button",onClick:()=>y("upload"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${j==="upload"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Upload de PDF"})]}),j==="link"?o.jsxs("div",{className:"space-y-1",children:[o.jsx(ae,{value:e.termoPdfUrl||"",onChange:w=>n({termoPdfUrl:w.target.value||void 0}),className:"h-8 text-sm",placeholder:"https://exemplo.com/termos.pdf"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"URL pública de um PDF. Tem prioridade sobre o texto acima."})]}):o.jsxs("div",{className:"space-y-2",children:[e.termoPdfUploadId&&N.status==="idle"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-green-500/40 bg-green-500/10 px-2 py-1.5",children:[o.jsx(P.CheckCircle2,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),o.jsx("span",{className:"text-[11px] text-green-700 dark:text-green-400 flex-1",children:"PDF enviado ✓"}),o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>{n({termoPdfUploadId:void 0})},children:o.jsx(P.X,{className:"h-3 w-3"})})]}):null,N.status==="uploading"?o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[o.jsx(P.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),o.jsx("span",{className:"truncate",children:N.fileName}),o.jsxs("span",{className:"ml-auto",children:[N.progress,"%"]})]}),o.jsx(hu,{value:N.progress,className:"h-1"})]}):null,N.status==="error"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-destructive/40 bg-destructive/10 px-2 py-1.5",children:[o.jsx(P.AlertCircle,{className:"h-3.5 w-3.5 text-destructive shrink-0"}),o.jsx("span",{className:"text-[11px] text-destructive",children:N.message}),o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 ml-auto",onClick:()=>C({status:"idle"}),children:o.jsx(P.X,{className:"h-3 w-3"})})]}):null,N.status!=="uploading"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:k,type:"file",accept:"application/pdf",className:"hidden",onChange:w=>{var R;const A=(R=w.target.files)==null?void 0:R[0];A&&_(A),w.target.value=""}}),o.jsxs(ye,{type:"button",variant:"outline",size:"sm",className:"w-full h-8 text-xs gap-1.5",disabled:!v,onClick:()=>{var w;return(w=k.current)==null?void 0:w.click()},children:[o.jsx(P.Upload,{className:"h-3.5 w-3.5"}),e.termoPdfUploadId?"Substituir PDF":"Selecionar PDF"]}),!v&&o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Salve o schema uma vez para habilitar o upload."})]}):null]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Nome (chave)"}),o.jsx(ae,{value:e.name||t.replace(/^field_/,""),onChange:w=>!c&&n({name:w.target.value}),className:"h-8 text-xs font-mono",placeholder:"nome_do_campo",disabled:c}),c?o.jsx("p",{className:"text-[9px] text-amber-500",children:"ID fixo — necessário para auto-preenchimento"}):o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Usado como chave no JSON do formulário"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Tipo do campo"}),o.jsxs(Ge,{value:s,onValueChange:w=>!c&&n({fieldType:w}),disabled:c,children:[o.jsx(He,{className:"h-8 text-sm",children:o.jsx(Ye,{})}),o.jsx(We,{children:St.map(w=>o.jsx(Se,{value:w.component,children:w.label},w.component))})]})]}),o.jsx(cu,{tamanho:e.tamanho||6,inicioColuna:e.inicioColuna||1,defaultTamanho:6,onTamanhoChange:w=>n({tamanho:w}),onPositionChange:w=>n({inicioColuna:w})}),s!=="file"&&!l&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Placeholder"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.placeholder||"",onChange:w=>n({placeholder:w.target.value}),className:"h-8 text-sm",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.hint||"",onChange:w=>n({hint:w.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),s!=="file"&&!l&&!f&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Valor padrão"}),o.jsx(ae,{value:e.defaultValue||"",onChange:w=>n({defaultValue:w.target.value}),className:"h-8 text-sm",placeholder:"Valor inicial do campo"})]}),s!=="file"&&!l&&!f&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Valor inicial (runtime)"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.initialValue||"",onChange:w=>n({initialValue:w.target.value||void 0}),className:"h-8 text-sm",placeholder:"{{evento.nome}} ou valor fixo"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:['Sobrepõe "Valor padrão" — suporta variáveis'," ",o.jsx("code",{children:"{{evento.x}}"})]})]}),!l&&!f&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"req",checked:e.required||!1,onCheckedChange:w=>n({required:w===!0})}),o.jsx(W,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),!l&&!f&&!c&&o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"readonly",checked:e.isReadOnly||!1,onCheckedChange:w=>n({isReadOnly:w===!0||void 0})}),o.jsx(W,{htmlFor:"readonly",className:"text-xs cursor-pointer",children:"Somente leitura"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"disabled",checked:e.isDisabled||!1,onCheckedChange:w=>n({isDisabled:w===!0||void 0})}),o.jsx(W,{htmlFor:"disabled",className:"text-xs cursor-pointer",children:"Desabilitado"})]})]}),m&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Slider"}),o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Mínimo"}),o.jsx(ae,{type:"number",value:e.minValue??0,onChange:w=>n({minValue:Number(w.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Máximo"}),o.jsx(ae,{type:"number",value:e.maxValue??100,onChange:w=>n({maxValue:Number(w.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Passo"}),o.jsx(ae,{type:"number",min:1,value:e.step??1,onChange:w=>n({step:Number(w.target.value)}),className:"h-8 text-sm"})]})]})]})]}),x&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Avaliação"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Número de estrelas"}),o.jsxs(Ge,{value:String(e.maxRating??5),onValueChange:w=>n({maxRating:Number(w)}),children:[o.jsx(He,{className:"h-8 text-sm",children:o.jsx(Ye,{})}),o.jsx(We,{children:[3,4,5,6,7,10].map(w=>o.jsxs(Se,{value:String(w),children:[w," estrelas"]},w))})]})]})]})]}),g&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Período"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Label da data inicial"}),o.jsx(ae,{value:e.dateRangeStartLabel??"Data inicial",onChange:w=>n({dateRangeStartLabel:w.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Label da data final"}),o.jsx(ae,{value:e.dateRangeEndLabel??"Data final",onChange:w=>n({dateRangeEndLabel:w.target.value}),className:"h-8 text-sm"})]})]})]}),!l&&o.jsx(Ze,{}),!l&&o.jsx(m0,{fieldType:s,validation:e.validation,onChange:w=>n({validation:w})}),i&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),s==="radio"&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Estilo visual"}),o.jsxs(Ge,{value:e.visualStyle||"card",onValueChange:w=>n({visualStyle:w}),children:[o.jsx(He,{className:"h-8 text-sm",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"card",children:"Card (padrão)"}),o.jsx(Se,{value:"default",children:"Radio simples"})]})]})]}),o.jsx(_u,{options:e.options||[],onChange:w=>n({options:w})})]}),l&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Lista de itens"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Mín. itens"}),o.jsx(ae,{type:"number",min:0,value:e.minItems??"",onChange:w=>n({minItems:w.target.value?Number(w.target.value):void 0}),className:"h-8 text-sm",placeholder:"0"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Máx. itens"}),o.jsx(ae,{type:"number",min:0,value:e.maxItems??"",onChange:w=>n({maxItems:w.target.value?Number(w.target.value):void 0}),className:"h-8 text-sm",placeholder:"Sem limite"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Label do item"}),o.jsx(ae,{value:e.itemLabel||"",onChange:w=>n({itemLabel:w.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Contato"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:'Prefixo exibido em cada item (ex: "Contato 1", "Contato 2")'})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Label do botão adicionar"}),o.jsx(ae,{value:e.addLabel||"",onChange:w=>n({addLabel:w.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Adicionar contato"})]}),o.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2",children:o.jsx("p",{className:"text-[11px] text-amber-700 dark:text-amber-400",children:"Os sub-campos são configurados visualmente no canvas: arraste campos da paleta para dentro da caixa laranja."})})]})]}),f&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Sub-formulário"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Título do grupo (opcional)"}),o.jsx(ae,{value:e.subSchemaTitle||"",onChange:w=>n({subSchemaTitle:w.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Endereço, Responsável..."})]}),o.jsx(g0,{subFields:e.subSchemaFields||[],onChange:w=>n({subSchemaFields:w})})]})]}),o.jsx(Ze,{}),o.jsx(x0,{condition:e.condition,selectedId:t,allFieldIds:r,getFieldLabel:a,onChange:w=>n({condition:w})}),e.condition&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Valor ao ocultar (clearedValue)"}),o.jsx(ae,{value:e.clearedValue??"",onChange:w=>n({clearedValue:w.target.value||void 0}),className:"h-8 text-sm",placeholder:"Deixar vazio = não limpar"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Valor aplicado automaticamente quando o campo fica oculto."})]}),!l&&!f&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs text-muted-foreground",children:"Resolver de props (avançado)"}),o.jsx(ae,{value:e.resolvePropsKey||"",onChange:w=>n({resolvePropsKey:w.target.value||void 0}),className:"h-8 text-xs font-mono",placeholder:"chaveDoResolver"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Registre este key em"," ",o.jsx("code",{children:"RendererContext.fieldResolvers"})," para opções dinâmicas."]})]})]})]})},b0=()=>{const{selectedId:e,getConfig:t,updateConfig:r,getAllFieldIds:a}=Je();if(!e)return o.jsx("div",{className:"rounded-xl border bg-card p-4 text-center text-sm text-muted-foreground",children:"Clique em um item para configurá-lo"});const n=t(e),s=Ne(e),i=c=>r(e,c),l=a().filter(c=>c!==e);return o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"text-sm font-bold text-foreground",children:s==="step"?"Step":s==="container"?"Container":"Campo"}),o.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:e})]}),o.jsx(Ze,{}),s==="step"&&o.jsx(Rb,{config:n,onUpdate:i}),s==="container"&&o.jsx(Ty,{config:n,onUpdate:i}),s==="field"&&o.jsx(v0,{config:n,selectedId:e,allFieldIds:l,getFieldLabel:c=>t(c).label||c,onUpdate:i})]})},y0=(e,t)=>{var r,a,n,s,i,l;const c=((a=(r=e==null?void 0:e.containers)==null?void 0:r.root)==null?void 0:a.children)||[],d=[];for(const u of c){if(Ne(u)!=="step")continue;const p=((s=(n=e==null?void 0:e.containers)==null?void 0:n[u])==null?void 0:s.children)||[],m=[];for(const x of p){if(Ne(x)!=="container")continue;const g=(((l=(i=e==null?void 0:e.containers)==null?void 0:i[x])==null?void 0:l.children)||[]).filter(f=>Ne(f)==="field").map(f=>{var v,b;const j=t(f),y={id:f,config:j};if(j.fieldType==="field_array"){const N=((b=(v=e==null?void 0:e.containers)==null?void 0:v[f])==null?void 0:b.children)??[];y.subFields=N.filter(C=>Ne(C)==="field").map(C=>({id:C,config:t(C)}))}return y});m.push({id:x,config:t(x),fields:g})}d.push({id:u,config:t(u),containers:m})}return d},Za=(e,t,r)=>{var a;if(!e||!e.when)return!0;const n=e.source==="evento"?(r==null?void 0:r[e.when])||"":t[e.when]||"",s=parseFloat(n),i=parseFloat(e.value||"");let l;switch(e.operator){case"igual":l=n===(e.value||"");break;case"diferente":l=n!==(e.value||"");break;case"vazio":l=!n;break;case"naoVazio":l=!!n;break;case"contem":l=n.includes(e.value||"");break;case"naoContem":l=!n.includes(e.value||"");break;case"maiorQue":l=!isNaN(s)&&!isNaN(i)&&s>i;break;case"menorQue":l=!isNaN(s)&&!isNaN(i)&&s<i;break;case"maiorOuIgual":l=!isNaN(s)&&!isNaN(i)&&s>=i;break;case"menorOuIgual":l=!isNaN(s)&&!isNaN(i)&&s<=i;break;default:l=!0}if(e.logicOperator&&(a=e.extraConditions)!=null&&a.length){const c=e.extraConditions.map(d=>Za(d,t,r));return e.logicOperator==="and"?l&&c.every(Boolean):l||c.some(Boolean)}return l},fi=(e,t,r,a)=>{if(!Za(t.condition,r,a))return;const n=t.validation,s=t.fieldType||"texto";if(t.required&&!e)return"Campo obrigatório";if(e){if(n!=null&&n.minLength&&e.length<n.minLength)return`Mínimo ${n.minLength} caracteres`;if(n!=null&&n.maxLength&&e.length>n.maxLength)return`Máximo ${n.maxLength} caracteres`;if(s==="number"){const i=Number(e);if(!isNaN(i)){if((n==null?void 0:n.min)!==void 0&&i<n.min)return`Valor mínimo: ${n.min}`;if((n==null?void 0:n.max)!==void 0&&i>n.max)return`Valor máximo: ${n.max}`}}if((s==="date"||s==="datetime")&&e){if(n!=null&&n.minDate&&e<n.minDate)return`Data mínima: ${n.minDate}`;if(n!=null&&n.maxDate&&e>n.maxDate)return`Data máxima: ${n.maxDate}`}if(n!=null&&n.regex)try{if(!new RegExp(n.regex).test(e))return n.regexMessage||"Formato inválido"}catch{}}},hi={email:"teste@email.com",number:"123",telefone:"(11) 99999-9999",cpf:"123.456.789-00",cep:"01001-000",date:new Date().toISOString().slice(0,10),datetime:new Date().toISOString().slice(0,10),textarea:"Texto de teste para preview",checkbox:"true",hidden:"",participation_type:JSON.stringify({tipo:"todos_os_dias",data:null,genero:null}),payment_method:JSON.stringify({metodo:"pix",valorTotal:0}),terms:""},Eu=(e,t)=>{var r;const a=e.fieldType||"texto";if(a==="field_array"){const n=Math.max(e.minItems??1,1),s=Array.from({length:n},()=>{const i={};return t==null||t.forEach(l=>{i[l.id]=Eu(l.config)}),i});return JSON.stringify(s)}return hi[a]!==void 0?hi[a]:(a==="select"||a==="radio")&&(r=e.options)!=null&&r.length?e.options[0].value||"":"Teste"},w0={glassmorphism:"Glass",card:"Card",flat:"Flat",bordered:"Bordered"},j0=()=>{const{previewTemplateId:e,setPreviewTemplateId:t}=Je(),[r,a]=E.useState(!1),n=Object.values(zt),s=zt[e];return o.jsxs(Ia,{open:r,onOpenChange:a,children:[o.jsx(La,{asChild:!0,children:o.jsxs(ye,{variant:"outline",size:"sm",className:"gap-1.5",title:"Selecionar template visual",children:[o.jsx("span",{className:"w-3.5 h-3.5 rounded-full shrink-0 border border-white/20",style:{background:(s==null?void 0:s.colors.primary)??"#3b82f6"}}),o.jsx(P.Palette,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"hidden sm:inline",children:(s==null?void 0:s.displayName)??"Template"})]})}),o.jsxs(Pr,{side:"bottom",align:"end",className:"w-80 p-3",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase tracking-wider",children:"Template de Preview"}),o.jsx("div",{className:"grid grid-cols-3 gap-1.5 max-h-72 overflow-y-auto pr-0.5",children:n.map(i=>{const l=i.id===e,c=wi(i),d=w0[i.layout.containerStyle]??"";return o.jsxs("button",{onClick:()=>{t(i.id),a(!1)},className:G("relative flex flex-col items-center gap-1.5 rounded-lg p-2 border text-center transition-all hover:scale-[1.02]",l?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsxs("div",{className:"w-full h-8 rounded-md flex items-center justify-center gap-0.5",style:{background:i.colors.background.startsWith("#")||i.colors.background.startsWith("rgba")?i.colors.background:void 0},"data-muted":!i.colors.background.startsWith("#")&&!i.colors.background.startsWith("rgba")?"true":void 0,children:[o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.primary}}),o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.accent}})]}),o.jsx("span",{className:"text-[10px] font-medium leading-tight line-clamp-2",children:i.displayName}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-wrap justify-center",children:[c&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-zinc-800 text-zinc-300",children:"dark"}),d&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-muted text-muted-foreground",children:d})]}),l&&o.jsx("div",{className:"absolute top-1 right-1",children:o.jsx(P.Check,{className:"w-3 h-3 text-primary"})})]},i.id)})})]})]})},N0=({onFillMock:e,onClear:t})=>o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(j0,{}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(ye,{variant:"outline",size:"sm",onClick:e,children:[o.jsx(P.FlaskConical,{className:"w-3.5 h-3.5 mr-1"}),"Preencher mock"]}),o.jsxs(ye,{variant:"ghost",size:"sm",onClick:t,children:[o.jsx(P.Eraser,{className:"w-3.5 h-3.5 mr-1"}),"Limpar"]})]})]}),C0={texto:"text",number:"number",email:"email",telefone:"tel",cpf:"text",cep:"text",date:"date",datetime:"datetime-local"},Pu=e=>C0[e]||"text",Jt=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,S0=({config:e,fieldId:t,subFields:r,tamanho:a,error:n,onChange:s,value:i})=>{const l=e.minItems??1,c=e.maxItems??10,d=e.itemLabel||"Item",u=e.addLabel||`Adicionar ${d}`,p=E.useRef(i||""),m=E.useCallback(()=>Object.fromEntries(r.map(C=>[C.id,""])),[r]),[x,g]=E.useState(()=>{if(i)try{const C=JSON.parse(i);if(Array.isArray(C)&&C.length>0)return C}catch{}return[m()]}),[f,v]=E.useState({});E.useEffect(()=>{if(i!==p.current){if(p.current=i||"",!i){g([m()]);return}try{const C=JSON.parse(i);Array.isArray(C)&&g(C)}catch{}}},[i,m]),E.useEffect(()=>{if(!n){v({});return}const C={};x.forEach((k,_)=>{r.forEach(w=>{const R=k[w.id]??"";w.config.required&&!R.trim()&&(C[`${_}.${w.id}`]="Campo obrigatório")})}),v(C)},[n,x,r]);const b=C=>{if(!s)return;const k=C.map(w=>{const R={};return r.forEach(A=>{R[A.id]=w[A.id]??""}),R}),_=JSON.stringify(k);p.current=_,s(_)},j=()=>{if(x.length>=c)return;const C=[...x,m()];g(C),b(C)},y=C=>{if(x.length<=l)return;const k=x.filter((_,w)=>w!==C);g(k),b(k)},N=(C,k,_)=>{const w=x.map((R,A)=>A===C?{...R,[k]:_}:R);g(w),b(w),v(R=>{const A={...R};return delete A[`${C}.${k}`],A})};return o.jsxs("div",{className:"space-y-2",style:{gridColumn:`span ${a}`},children:[e.label&&o.jsx(W,{className:"text-sm font-medium",children:e.label}),o.jsx("div",{className:"space-y-3",children:x.map((C,k)=>o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-3 shadow-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-orange-500 text-white text-xs font-bold shrink-0",children:k+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[d," ",k+1]})]}),x.length>l&&o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive/60 hover:text-destructive",onClick:()=>y(k),children:o.jsx(P.Trash2,{className:"h-4 w-4"})})]}),r.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Sem sub-campos configurados"}):o.jsx("div",{className:"grid grid-cols-12 gap-3",children:r.map(_=>{const w=_.config.fieldType||"texto",R=_.config.tamanho||6,A=C[_.id]??"",I=V=>N(k,_.id,V),F=f[`${k}.${_.id}`];return o.jsxs("div",{className:"space-y-1",style:{gridColumn:`span ${R}`},children:[o.jsxs(W,{className:"text-xs font-medium",children:[_.config.label,_.config.required&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w==="textarea"?o.jsx(Ba,{placeholder:_.config.placeholder,className:F?"text-sm border-destructive":"text-sm",value:A,onChange:V=>I(V.target.value)}):w==="select"?o.jsxs(Ge,{value:A,onValueChange:I,children:[o.jsx(He,{className:F?"text-sm border-destructive":"text-sm",children:o.jsx(Ye,{placeholder:_.config.placeholder||"Selecione..."})}),o.jsx(We,{children:(_.config.options||[]).map((V,M)=>o.jsx(Se,{value:V.value||`__opt_${M}`,children:V.label},`${M}-${V.value}`))})]}):w==="checkbox"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{checked:A==="true",onCheckedChange:V=>I(V?"true":"")}),o.jsx("span",{className:"text-sm text-muted-foreground",children:_.config.placeholder||_.config.label})]}):o.jsx(ae,{type:Pu(w),placeholder:_.config.placeholder,className:F?"text-sm border-destructive":"text-sm",value:A,onChange:V=>I(V.target.value)}),F&&o.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[o.jsx(P.AlertCircle,{className:"h-3 w-3 shrink-0"}),F]})]},_.id)})})]},k))}),o.jsxs(ye,{type:"button",variant:"outline",className:"w-full border-dashed border-orange-500 text-orange-500 hover:bg-orange-500/10 hover:text-orange-500 font-semibold",onClick:j,disabled:x.length>=c,children:[o.jsx(P.Plus,{className:"h-4 w-4 mr-2"}),u]}),e.maxItems&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",e.maxItems," ",d.toLowerCase(),e.maxItems!==1?"s":""]}),!e.maxItems&&e.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:e.hint}),n&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(P.AlertCircle,{className:"h-4 w-4 shrink-0"}),n]})]})},k0=({config:e,fieldId:t,value:r,onChange:a,visible:n,error:s,subFields:i,eventoData:l,allValues:c})=>{const d=e.fieldType||"texto",u=e.tamanho||6;if(!n)return null;if(d==="field_array")return o.jsx(S0,{config:e,fieldId:t,subFields:i??[],tamanho:u,error:s,onChange:a,value:r});const p=s?"border-destructive":"";return o.jsxs("div",{className:"space-y-1",style:{gridColumn:e.inicioColuna?`${e.inicioColuna} / span ${u}`:`span ${u}`},children:[d!=="terms"&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs(W,{className:"text-sm font-medium",children:[e.label,e.required&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.condition&&o.jsxs(qa,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 border-amber-500/50 text-amber-600",children:[o.jsx(P.Zap,{className:"h-2.5 w-2.5 mr-0.5"}),"cond"]})]}),d==="textarea"?o.jsx(Ba,{placeholder:e.placeholder,className:G("text-sm",p),value:r,onChange:m=>a(m.target.value)}):d==="select"?o.jsxs(Ge,{value:r,onValueChange:a,children:[o.jsx(He,{className:G("text-sm",p),children:o.jsx(Ye,{placeholder:e.placeholder||"Selecione..."})}),o.jsx(We,{children:(e.options||[]).map((m,x)=>o.jsx(Se,{value:m.value||`__opt_${x}`,children:m.label},`${x}-${m.value}`))})]}):d==="checkbox"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{checked:r==="true",onCheckedChange:m=>a(m?"true":"")}),o.jsx("span",{className:"text-sm text-muted-foreground",children:e.placeholder||e.label})]}):d==="checkbox_group"?o.jsx(_0,{config:e,value:r,onChange:a}):d==="radio"?o.jsx("div",{className:"space-y-2",children:(e.options||[{value:"1",label:"Opção 1"}]).map((m,x)=>e.visualStyle==="default"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"radio",readOnly:!0,checked:r===m.value,className:"accent-orange-500"}),o.jsx("span",{className:"text-sm",children:m.label})]},`${x}-${m.value}`):o.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border-2 transition-all cursor-pointer bg-card border-border",children:[o.jsx("input",{type:"radio",readOnly:!0,checked:r===m.value,className:"accent-orange-500"}),o.jsx("span",{className:"text-sm flex-1",children:m.label})]},`${x}-${m.value}`))}):d==="participation_type"?(()=>{const m=parseInt((l==null?void 0:l["evento.valor"])??"0")||0,x=parseInt((l==null?void 0:l["evento.valorPorDia"])??"0")||0,g=l==null?void 0:l["evento.vagasTotal"],f=l==null?void 0:l["evento.vagasPorDia"],v=l==null?void 0:l["evento.vagasMasculinas"],b=l==null?void 0:l["evento.vagasFemininas"],j=!!(v&&Number(v)>0)&&!!(b&&Number(b)>0),y=l==null?void 0:l["evento.dataInicioEvento"],N=l==null?void 0:l["evento.dataFimEvento"],C=T=>T?T.slice(8,10)+"/"+T.slice(5,7)+"/"+T.slice(0,4):"—",k=y&&N?`${C(y)} a ${C(N)}`:"Período do evento",_=(y&&N?Math.round((new Date(N.slice(0,10)+"T00:00:00Z").getTime()-new Date(y.slice(0,10)+"T00:00:00Z").getTime())/864e5)+1:0)>1;let w={};try{w=r?JSON.parse(r):{}}catch{}const R=w.tipo??null,A=w.data??null,I=w.genero??null,F=T=>a(JSON.stringify({tipo:T,data:null,...j?{genero:I}:{}})),V=T=>a(JSON.stringify({tipo:"por_dia",data:T,...j?{genero:I}:{}})),M=T=>a(JSON.stringify({tipo:R,data:A,genero:T})),U=[];if(_&&y&&N){const T=new Date(y.slice(0,10)+"T00:00:00Z"),D=new Date(N.slice(0,10)+"T00:00:00Z");let z=0;for(;T<=D&&z++<60;)U.push(T.toISOString().slice(0,10)),T.setUTCDate(T.getUTCDate()+1)}const $=T=>{const[D,z,L]=T.split("-").map(Number),ee=new Date(Date.UTC(D,z-1,L)),Y=String(L).padStart(2,"0"),J=String(z).padStart(2,"0"),q=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(ee);return`${Y}/${J} — ${q.charAt(0).toUpperCase()}${q.slice(1)}`};return o.jsxs("div",{className:"space-y-2",children:[j&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(T=>{const D=T==="masculino"?"Masculino":"Feminino";return o.jsx("button",{type:"button",onClick:()=>M(T),className:G("px-3 py-1 rounded-full text-xs font-medium border transition-all",I===T?"border-primary bg-primary text-primary-foreground":"border-border bg-card text-muted-foreground hover:border-primary/60"),children:D},T)})})]}),o.jsxs("button",{type:"button",onClick:()=>F("todos_os_dias"),className:G("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all bg-card",R==="todos_os_dias"?"border-primary bg-primary/10":"border-border hover:border-primary/40"),children:[o.jsx("div",{className:G("mt-0.5 p-2 rounded-lg shrink-0",R==="todos_os_dias"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:o.jsx(P.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar todos os dias"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:k})]}),o.jsxs("div",{className:"text-right shrink-0",children:[o.jsx("p",{className:G("text-sm font-bold",R==="todos_os_dias"?"text-primary":"text-foreground"),children:m>0?Jt(m):"R$ —,—"}),g&&o.jsxs("p",{className:"text-xs text-emerald-500 flex items-center justify-end gap-1",children:[o.jsx(P.Users,{className:"w-3 h-3"}),g," vagas"]})]})]}),_?o.jsxs("button",{type:"button",onClick:()=>F("por_dia"),className:G("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all bg-card",R==="por_dia"?"border-primary bg-primary/10":"border-border hover:border-primary/40"),children:[o.jsx("div",{className:G("mt-0.5 p-2 rounded-lg shrink-0",R==="por_dia"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:o.jsx(P.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[o.jsx("p",{className:G("text-sm font-bold",R==="por_dia"?"text-primary":"text-foreground"),children:x>0?Jt(x):"R$ —,—"}),f&&o.jsxs("p",{className:"text-xs text-emerald-500 flex items-center justify-end gap-1",children:[o.jsx(P.Users,{className:"w-3 h-3"}),f," vagas/dia"]})]})]}):y?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg bg-muted/50 border border-border",children:[o.jsx(P.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Evento de 1 dia — a opção "Participar um dia" não é exibida.'})]}):o.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl border-2 border-border bg-card opacity-40",children:[o.jsx("div",{className:"mt-0.5 p-2 rounded-lg shrink-0 bg-muted text-muted-foreground",children:o.jsx(P.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Visível se evento tiver 2+ dias"})]}),o.jsx("div",{className:"text-right shrink-0",children:o.jsx("p",{className:"text-sm font-bold text-primary",children:"R$ —,—"})})]}),R==="por_dia"&&U.length>0&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold text-primary uppercase tracking-wide",children:"Selecione o dia:"}),U.map(T=>o.jsxs("button",{type:"button",onClick:()=>V(T),className:G("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",A===T?"border-primary bg-primary/10 text-primary":"border-border bg-card hover:border-primary/40"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:G("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center",A===T?"border-primary bg-primary":"border-muted-foreground"),children:A===T&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-primary-foreground"})}),o.jsx("span",{className:"text-sm",children:$(T)})]}),f&&o.jsxs("span",{className:"text-xs text-emerald-500",children:[f," vagas"]})]},T))]})]})})():d==="payment_method"?(()=>{const m=(c==null?void 0:c._participation_type_field)??"";let x={};try{x=m?JSON.parse(m):{}}catch{}const g=x.tipo??null,f=Number((l==null?void 0:l["evento.valor"])??0)||0,v=Number((l==null?void 0:l["evento.valorPorDia"])??0)||0,b=g==="por_dia"&&v>0?v:f,j=g==="por_dia"?(()=>{if(!x.data)return"Um dia";const[_,w,R]=x.data.split("-");return`${R}/${w}/${_}`})():"Todos os dias",y=g==="por_dia"?[{id:"pix",label:"PIX",desc:"Transferência instantânea (à vista)",taxa:0,parcelas:0},{id:"dinheiro",label:"Dinheiro",desc:"Pagamento em espécie",taxa:0,parcelas:0},{id:"cartao",label:"Cartão de Crédito",desc:"Débito ou crédito na maquininha",taxa:.0315,parcelas:0,taxaLabel:`Taxa InfinityPay: ${(.0315*100).toFixed(2).replace(".",",")}%`}]:[{id:"pix",label:"PIX à Vista",desc:"Pagamento instantâneo sem parcelamento",taxa:0,parcelas:0},{id:"pix_parcelado",label:"PIX Parcelado",desc:"Parcelado em até 7x sem juros",taxa:0,parcelas:7},{id:"cartao",label:"Cartão de Crédito",desc:"Parcelado em até 12x",taxa:.124,parcelas:12,taxaLabel:`Taxa InfinityPay: ${(.124*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",desc:"Pagamento em espécie",taxa:0,parcelas:0}];let N={};try{N=r?JSON.parse(r):{}}catch{}const C=N.metodo??null,k=_=>{const w=Math.round(b*(1+_.taxa)*100)/100,R={metodo:_.id,valorTotal:w};_.parcelas>1&&(R.parcelas=_.parcelas),a(JSON.stringify(R))};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:j})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold text-primary",children:Jt(b)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2.5",children:[o.jsx(P.Info,{className:"h-4 w-4 text-amber-500 mt-0.5 shrink-0"}),o.jsxs("p",{className:"text-xs text-amber-200",children:[o.jsx("span",{className:"font-bold text-amber-400",children:"Importante:"})," ","Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:y.map(_=>{const w=C===_.id,R=Math.round(b*(1+_.taxa)*100)/100,A=_.parcelas>1,I=A?Math.round(R/_.parcelas*100)/100:null;return o.jsxs("button",{type:"button",onClick:()=>k(_),className:G("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all bg-card",w?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:[o.jsx("div",{className:G("flex items-center justify-center w-10 h-10 rounded-lg shrink-0",w?"bg-primary/20":"bg-muted"),children:o.jsx(P.Wallet,{className:G("h-5 w-5",w?"text-primary":"text-muted-foreground")})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:_.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:_.desc}),_.taxaLabel&&o.jsxs("p",{className:"text-xs text-amber-400 mt-0.5",children:["* ",_.taxaLabel]}),_.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",Jt(R)]})]}),o.jsx("div",{className:"text-right shrink-0",children:A?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[_.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:Jt(I)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:Jt(R)})})]},_.id)})})]})})():d==="terms"?(()=>{const m=r==="accepted",x=e.termoTexto,g=e.termoPdfUrl,f=!!e.termoPdfUploadId,v=!!(x||g||f);return o.jsxs("div",{className:G("rounded-lg border p-4 space-y-4 transition-colors",m?"border-green-500/40 bg-green-500/5":"border-border bg-muted/30"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(P.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:e.label||"Termos e condições"})]}),v?o.jsxs("div",{className:"flex items-center gap-1.5",children:[f&&o.jsx("span",{className:"flex items-center gap-1 text-[10px] text-green-600 dark:text-green-400 font-medium border border-green-500/40 bg-green-500/10 rounded px-1.5 py-0.5",children:"PDF enviado ✓"}),o.jsxs(ye,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{},children:[o.jsx(P.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]})]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(Pe,{checked:m,onCheckedChange:b=>a(b?"accepted":""),className:"mt-0.5"}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito"," ",e.label?`"${e.label}"`:"os termos e condições"]}),m&&o.jsx(P.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]})})():d==="file"?o.jsx(ae,{type:"file",className:G("text-sm",p)}):d==="hidden"?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Campo oculto"}):o.jsx(ae,{type:Pu(d),placeholder:e.placeholder,className:G("text-sm",p),value:r,onChange:m=>a(m.target.value)}),s?o.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[o.jsx(P.AlertCircle,{className:"h-3 w-3 shrink-0"}),s]}):e.hint?o.jsx("p",{className:"text-xs text-muted-foreground",children:e.hint}):null]})},_0=({config:e,value:t,onChange:r})=>{var a;const n=new Set(t?t.split(","):[]),s=(a=e.options)!=null&&a.length?e.options:[{value:"1",label:"Opção 1"}],i=l=>{const c=new Set(n);c.has(l)?c.delete(l):c.add(l),r(Array.from(c).join(","))};return o.jsx("div",{className:"space-y-1",children:s.map((l,c)=>o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{checked:n.has(l.value),onCheckedChange:()=>i(l.value),disabled:l.disabled}),o.jsx("span",{className:"text-sm",children:l.label})]},`${c}-${l.value}`))})},E0=({step:e,stepIndex:t,formValues:r,errors:a,eventoData:n,onChange:s})=>o.jsxs("div",{className:"rounded-xl border bg-card p-5 space-y-5",children:[o.jsxs("div",{children:[e.config.showLabel!==!1&&o.jsxs("h2",{className:"text-base font-bold text-foreground",children:["Step ",t+1," — ",e.config.label]}),e.config.description&&o.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:e.config.description})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4",children:e.containers.map(i=>o.jsxs("div",{className:G("space-y-3",i.config.showAsCard&&"rounded-lg border bg-card p-4 shadow-sm"),style:{gridColumn:i.config.inicioColuna?`${i.config.inicioColuna} / span ${i.config.tamanho||12}`:`span ${i.config.tamanho||12}`},children:[i.config.showLabel!==!1&&i.config.label!=="Novo Container"&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold text-foreground",children:i.config.label}),i.config.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:i.config.description})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-3",children:i.fields.map(l=>o.jsx(k0,{config:l.config,fieldId:l.id,subFields:l.subFields,value:r[l.id]||"",onChange:c=>s(l.id,c),visible:Za(l.config.condition,r,n),error:a[l.id],eventoData:n,allValues:r},l.id))})]},i.id))})]}),P0=({currentStep:e,isLastStep:t,onBack:r,onNext:a})=>o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs(ye,{variant:"outline",onClick:r,disabled:e===0,children:[o.jsx(P.ChevronLeft,{className:"w-4 h-4 mr-1"}),"Voltar"]}),o.jsx(ye,{onClick:a,children:t?o.jsxs(o.Fragment,{children:[o.jsx(P.Check,{className:"w-4 h-4 mr-1"}),"Finalizar"]}):o.jsxs(o.Fragment,{children:[o.jsx(P.ChevronRight,{className:"w-4 h-4 mr-1"}),"Próximo"]})})]}),T0=({onRestart:e})=>o.jsxs("div",{className:"max-w-4xl mx-auto flex flex-col items-center justify-center py-16 space-y-4",children:[o.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:o.jsx(P.PartyPopper,{className:"w-8 h-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Formulário enviado!"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Este é um preview simulado. Nenhum dado foi enviado."}),o.jsxs(ye,{variant:"outline",onClick:e,children:[o.jsx(P.RotateCcw,{className:"w-4 h-4 mr-1"}),"Recomeçar"]})]}),ca=e=>{if(e)return ct[e]},$0=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((a,n)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(n),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(n)),className:G("w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:n===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:n<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:n<t?o.jsx(P.Check,{className:"w-4 h-4"}):n+1},a.id))}),R0=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((a,n)=>{const s=ca(a.icone)??P.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(n),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(n)),className:G("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:n===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:n<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:n<t?o.jsx(P.Check,{className:"w-4 h-4"}):o.jsx(s,{className:"w-4 h-4"})},a.id)})}),O0=({steps:e,currentStep:t,position:r,orientation:a="horizontal",onStepClick:n})=>a==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,i)=>{const l=ca(s.icone)??P.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("button",{type:"button",onClick:()=>n==null?void 0:n(i),className:G("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",n&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(P.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!u&&o.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),o.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label})]},s.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((s,i)=>{const l=ca(s.icone)??P.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:G("flex items-start",!u&&"flex-1"),children:[o.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[o.jsx("button",{type:"button",onClick:()=>n==null?void 0:n(i),className:G("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",n&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(P.Check,{className:"w-4 h-4"}):o.jsx(l,{className:"w-4 h-4"})}),o.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label})]}),!u&&o.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),D0=({steps:e,currentStep:t,onStepClick:r,className:a})=>{const n=Wo(),{layout:s}=n;if(!s.showStepIndicators||e.length<=1)return null;const i=s.stepIndicatorVariant??"numbers",l=s.stepIndicatorPosition??"top-center",c=s.stepIndicatorOrientation??"horizontal",d=(t+1)/e.length*100,u=e[t],p=ca(u==null?void 0:u.icone)??P.CircleDot,m=o.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${d}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),x=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:u==null?void 0:u.label}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),m]}),g=o.jsxs("div",{className:"hidden sm:block",children:[i==="numbers"&&o.jsx($0,{steps:e,currentStep:t,onStepClick:r}),i==="icons"&&o.jsx(R0,{steps:e,currentStep:t,onStepClick:r}),i==="icons-labeled"&&o.jsx(O0,{steps:e,currentStep:t,position:l,orientation:c,onStepClick:r})]}),f=s.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:m}):null;return c==="vertical"?o.jsxs("div",{className:G("flex gap-6 items-start",a),children:[x,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[g,f&&o.jsx("div",{className:"flex-1 pt-4",children:f})]})]}):o.jsxs("div",{className:G("space-y-3",a),children:[x,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[g,f]})]})},A0=({eventoData:e})=>{const{getConfig:t,containers:r,previewTemplateId:a}=Je(),n=y0({containers:r},t),[s,i]=E.useState({}),[l,c]=E.useState(0),[d,u]=E.useState(!1),[p,m]=E.useState({}),[x,g]=E.useState(!1),f=Math.min(l,Math.max(n.length-1,0));E.useEffect(()=>{f!==l&&c(f)},[f,l,c]);const v=E.useCallback((I,F)=>{var V;if(i(M=>({...M,[I]:F})),x){const M=(V=n[f])==null?void 0:V.containers.flatMap(U=>U.fields).find(U=>U.id===I);if(M){const U=fi(F,M.config,{...s,[I]:F},e);m($=>{const T={...$};return U?T[I]=U:delete T[I],T})}}},[x,n,f,s,e,i,m]),b=E.useCallback(()=>{const I=n[f];if(!I)return!0;const F={};for(const M of I.containers)for(const U of M.fields){if(U.config.fieldType==="field_array"){let T=!1;try{const D=s[U.id],z=D?JSON.parse(D):[],L=U.config.minItems??1;if(z.length<L)F[U.id]=`Mínimo de ${L} item${L!==1?"s":""} obrigatório${L!==1?"s":""}`,T=!0;else{for(const ee of z){for(const Y of U.subFields??[]){const J=ee[Y.id]??"";if(Y.config.required&&!J.trim()){T=!0;break}}if(T)break}T&&(F[U.id]="Preencha todos os campos obrigatórios")}}catch{U.config.required&&(F[U.id]="Campo obrigatório")}continue}const $=fi(s[U.id]||"",U.config,s,e);$&&(F[U.id]=$)}m(F),g(!0);const V=Object.keys(F).length;return V>0?(console.warn(`Corrija ${V} campo(s) destacado(s) antes de continuar`),!1):!0},[n,f,s,e,m,g]),j=E.useCallback(()=>{b()&&(g(!1),m({}),f>=n.length-1?u(!0):c(I=>I+1))},[b,f,n.length,g,m,u,c]),y=E.useCallback(()=>{c(I=>I-1),g(!1),m({})},[c,g,m]),N=E.useCallback(()=>{const I={};for(const F of n)for(const V of F.containers)for(const M of V.fields)Za(M.config.condition,s,e)&&(I[M.id]=Eu(M.config,M.subFields));i(F=>({...F,...I}))},[n,s,e,i]),C=E.useCallback(()=>{i({}),m({}),g(!1)},[i,m,g]),k=E.useCallback(()=>{u(!1),c(0),C()},[u,c,C]);if(n.length===0)return o.jsx("div",{className:"rounded-lg border border-dashed border-border/40 p-6 text-center text-xs text-muted-foreground/50",children:"Adicione steps, containers e campos para ver o preview ao vivo"});if(d)return o.jsx(T0,{onRestart:k});const _=n[f],w=n.length,R=f===w-1,A=ua(a);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"px-1",children:o.jsx(N0,{onFillMock:N,onClear:C})}),o.jsx(Ho,{config:A,className:A.wrapperClass,style:{minHeight:"100%",padding:"12px",borderRadius:"12px"},children:o.jsxs("div",{className:"max-w-4xl mx-auto space-y-4",children:[o.jsx(D0,{steps:n.map(I=>({id:I.id,label:I.config.label,icone:I.config.icone})),currentStep:f}),o.jsx(E0,{step:_,stepIndex:f,formValues:s,errors:p,eventoData:e,onChange:v}),o.jsx(P0,{currentStep:f,isLastStep:R,onBack:y,onNext:j})]})})]})},Tu=({id:e,currentTamanho:t,inicioColuna:r,onResize:a,pushSnapshot:n})=>{const s=E.useRef(null),[i,l]=E.useState(!1),[c,d]=E.useState(null),u=E.useRef(null);E.useEffect(()=>()=>{var m;(m=u.current)==null||m.call(u)},[]);const p=E.useCallback(m=>{m.preventDefault(),m.stopPropagation(),n==null||n();const x=s.current;if(!x)return;const g=x.parentElement;if(!g)return;const f=g.getBoundingClientRect().width,v=x.getBoundingClientRect().width,b=m.clientX,j=r?13-r:12;l(!0);const y=C=>{const k=C.clientX-b,_=(v+k)/f,w=Math.max(1,Math.min(j,Math.round(_*12)));d(w),a(w)},N=()=>{l(!1),d(null),u.current=null,window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",N)};u.current=()=>{l(!1),d(null),window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",N)},window.addEventListener("mousemove",y),window.addEventListener("mouseup",N)},[r,a,n]);return{resizeRef:s,resizing:i,resizePreview:c,handleResizeStart:p}},I0=({id:e,elementRef:t,onPositionApply:r,setPositionDrag:a,setSelected:n,pushSnapshot:s})=>{const i=E.useRef(null);return E.useEffect(()=>()=>{var l;(l=i.current)==null||l.call(i)},[]),{handlePositionMouseDown:E.useCallback(l=>{l.preventDefault(),l.stopPropagation(),s==null||s(),n(e);const c=t.current;if(!c)return;const d=c.parentElement;if(!d)return;const u=d.getBoundingClientRect(),p=u.width/12,m=c.getBoundingClientRect(),x=Math.max(1,Math.round(m.width/p)),g=m.left-u.left,f=l.clientX-m.left,v=N=>{const C=N-u.left-f,k=Math.round(C/p)+1;return Math.max(1,Math.min(13-x,k))},b=Math.max(1,Math.min(12,Math.round(g/p)+1));a({itemId:e,ghostStart:b,ghostSpan:x,cursorX:l.clientX,cursorY:l.clientY});const j=N=>{a({itemId:e,ghostStart:v(N.clientX),ghostSpan:x,cursorX:N.clientX,cursorY:N.clientY})},y=N=>{r(v(N.clientX)),a(null),i.current=null,window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",y)};i.current=()=>{a(null),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",y)},window.addEventListener("mousemove",j),window.addEventListener("mouseup",y)},[e,t,r,a,n,s])}},Tr=({id:e,container:t})=>{const{attributes:r,listeners:a,setNodeRef:n,transform:s,transition:i,isDragging:l}=xt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{selectedId:c,setSelected:d,getConfig:u,updateConfig:p,removeItem:m,setPositionDrag:x,positionDrag:g,pushSnapshot:f}=Je(),v=u(e),b=Ji(e),j=(b==null?void 0:b.icon)||P.Type,y=c===e,N=v.tamanho||6,C=(g==null?void 0:g.itemId)===e,[k,_]=E.useState(!1),w="var(--t-primary, hsl(var(--primary)))",R=y?w:k?`color-mix(in srgb, ${w} 60%, transparent)`:`color-mix(in srgb, ${w} 25%, transparent)`,A=y?`0 0 0 2px color-mix(in srgb, ${w} 30%, transparent)`:void 0,{resizeRef:I,resizing:F,resizePreview:V,handleResizeStart:M}=Tu({id:e,currentTamanho:N,inicioColuna:v.inicioColuna,onResize:$=>p(e,{tamanho:$}),pushSnapshot:f}),{handlePositionMouseDown:U}=I0({id:e,elementRef:I,onPositionApply:$=>p(e,{inicioColuna:$}),setPositionDrag:x,setSelected:d,pushSnapshot:f});return o.jsxs("div",{ref:$=>{n($),I.current=$},onClick:$=>{$.stopPropagation(),d(e)},"data-field-id":e,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),className:G("relative flex items-center gap-2 rounded border bg-card/80 backdrop-blur-sm px-2.5 pt-1.5 pb-3.5 cursor-pointer transition-all text-xs",F&&"ring-2 ring-blue-400/50",C&&"opacity-0 pointer-events-none"),style:{gridColumn:v.inicioColuna?`${v.inicioColuna} / span ${N}`:`span ${N}`,transform:Cr.CSS.Transform.toString(s),transition:i,opacity:l?0:1,borderColor:R,boxShadow:A},children:[o.jsx("div",{onMouseDown:U,onClick:$=>$.stopPropagation(),className:"cursor-ew-resize shrink-0 p-0.5 rounded hover:bg-primary/20 transition-colors",title:"Arrastar para mudar coluna",children:o.jsx(P.ArrowLeftRight,{className:"h-3 w-3 text-primary/60"})}),o.jsx("div",{...a,...r,className:"cursor-grab shrink-0",onClick:$=>$.stopPropagation(),children:o.jsx(P.GripVertical,{className:"h-3 w-3 text-primary"})}),o.jsx(j,{className:"h-3.5 w-3.5 text-primary shrink-0"}),o.jsx("span",{className:"font-medium truncate flex-1",children:v.label}),v.condition&&o.jsx(P.Zap,{className:"h-3 w-3 text-amber-500 shrink-0"}),v.required&&o.jsx("span",{className:"text-destructive font-bold",children:"*"}),o.jsxs("span",{className:"text-[9px] text-muted-foreground shrink-0",children:[V??N,"/12"]}),o.jsx("button",{onClick:$=>{$.stopPropagation(),m(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:k?1:0},children:o.jsx(P.Trash2,{className:"h-3 w-3 text-destructive"})}),o.jsx("div",{className:"absolute left-2 -bottom-0.5 font-mono truncate max-w-[90%] pointer-events-none text-[8px] text-muted-foreground/30",children:e}),o.jsx("div",{"data-resize":!0,onMouseDown:M,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-primary/20 transition-colors flex items-center justify-center",children:o.jsx(P.GripHorizontal,{className:"h-3 w-3 text-primary/40 rotate-90"})})]})},L0=({id:e,container:t})=>{var r;const{attributes:a,listeners:n,setNodeRef:s,transform:i,transition:l,isDragging:c}=xt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{setNodeRef:d,isOver:u}=cr.useDroppable({id:`zone-${e}`}),{selectedId:p,setSelected:m,getConfig:x,removeItem:g,moveItem:f,containers:v}=Je(),b=x(e),j=(((r=v[e])==null?void 0:r.children)??[]).filter(C=>Ne(C)==="field"),y=p===e,N=b.tamanho||12;return o.jsxs("div",{ref:s,onClick:C=>{C.stopPropagation(),m(e)},className:G("group/fa relative rounded-lg border overflow-hidden transition-all",c&&"opacity-0 pointer-events-none",y?"border-amber-500 ring-2 ring-amber-500/20 shadow-lg":"border-amber-500/30 hover:border-amber-500/55"),style:{gridColumn:b.inicioColuna?`${b.inicioColuna} / span ${N}`:`span ${N}`,transform:Cr.CSS.Transform.toString(i),transition:l},children:[o.jsxs("div",{className:G("flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",y?"bg-amber-500/15 border-amber-500/30":"bg-amber-500/10 border-amber-500/20"),children:[o.jsx("div",{...n,...a,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-amber-500/20 transition-colors",onClick:C=>C.stopPropagation(),children:o.jsx(P.GripVertical,{className:"h-3.5 w-3.5 text-amber-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:C=>{C.stopPropagation(),f(e,"up")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(P.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})}),o.jsx("button",{onClick:C=>{C.stopPropagation(),f(e,"down")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(P.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})})]}),o.jsx(P.List,{className:"h-3.5 w-3.5 text-amber-500 shrink-0"}),o.jsx("span",{className:"text-xs font-semibold truncate flex-1 text-amber-700 dark:text-amber-300",children:b.label}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-amber-500/10 px-1.5 rounded",children:[b.itemLabel||"Item"," · ",j.length," campo",j.length!==1?"s":""]}),o.jsx("button",{onClick:C=>{C.stopPropagation(),g(e)},className:"opacity-0 group-hover/fa:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",children:o.jsx(P.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:d,className:G("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",u?"bg-amber-500/10 ring-2 ring-inset ring-amber-500/40":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[j.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(xt.SortableContext,{items:j,strategy:xt.rectSortingStrategy,children:j.map(C=>o.jsx(Tr,{id:C,container:e},C))})]})]})},xi=5,z0=({id:e,elementRef:t,tamanho:r,inicioColuna:a,onPositionApply:n,setPositionDrag:s,setSelected:i,reorderStrategy:l})=>{const c=E.useRef({inicioColuna:a,tamanho:r});c.current={inicioColuna:a,tamanho:r};const d=E.useRef(null);return E.useEffect(()=>()=>{var u;(u=d.current)==null||u.call(d)},[]),{handleGripMouseDown:E.useCallback(u=>{u.preventDefault(),u.stopPropagation(),i(e);const p=u.clientX,m=u.clientY;let x=!1;const g=()=>{d.current=null,window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",v)},f=y=>{const N=Math.abs(y.clientX-p),C=Math.abs(y.clientY-m);N<xi&&C<xi||(x=!0,g(),N>=C?b(y):j(y))},v=()=>{x||g()};window.addEventListener("mousemove",f),window.addEventListener("mouseup",v),d.current=g;const b=y=>{const N=t.current;if(!N)return;const C=N.parentElement;if(!C)return;const k=C.getBoundingClientRect(),_=k.width/12,{tamanho:w}=c.current,R=N.getBoundingClientRect(),A=R.left-k.left,I=Math.max(1,Math.min(12,Math.round(A/_)+1)),F=R.left;s({itemId:e,ghostStart:I,ghostSpan:w,cursorX:y.clientX,cursorY:y.clientY});const V=$=>{const T=$-F,D=Math.round(T/_)+1;return Math.max(1,Math.min(13-w,D))};s({itemId:e,ghostStart:V(y.clientX),ghostSpan:w,cursorX:y.clientX,cursorY:y.clientY});const M=$=>{s({itemId:e,ghostStart:V($.clientX),ghostSpan:w,cursorX:$.clientX,cursorY:$.clientY})},U=$=>{n(V($.clientX)),s(null),d.current=null,window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",U)};window.addEventListener("mousemove",M),window.addEventListener("mouseup",U),d.current=()=>{s(null),window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",U)}},j=y=>{const N=l,C=t.current;if(!C)return;const k=C.parentElement;if(!k)return;const _=N.dataAttribute||"data-container-id";N.pushSnapshot(),N.setReorderDrag({draggingId:e});let w=y.clientY;const R=I=>{const F=Array.from(k.children).filter(V=>V!==C&&V.getAttribute(_));for(const V of F){const M=V.getBoundingClientRect(),U=M.top+M.height/2;if(I.clientY<U&&I.clientY>M.top&&I.clientY<w){N.moveItemNoSnapshot(e,"up"),w=I.clientY;break}else if(I.clientY>U&&I.clientY<M.bottom&&I.clientY>w){N.moveItemNoSnapshot(e,"down"),w=I.clientY;break}}},A=()=>{N.setReorderDrag(null),d.current=null,window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",A)};window.addEventListener("mousemove",R),window.addEventListener("mouseup",A),d.current=()=>{N.setReorderDrag(null),window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",A)}}},[e,t,n,s,i,l])}},Bn=({showGuides:e,positionDrag:t})=>!e&&!t?null:o.jsxs(o.Fragment,{children:[e&&o.jsx("div",{className:"absolute inset-0 pointer-events-none z-10",style:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",padding:"inherit",gap:"inherit"},children:Array.from({length:12},(r,a)=>o.jsx("div",{className:"border border-dashed border-muted-foreground/20 rounded-sm flex items-end justify-center pb-1",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/40 font-mono",children:a+1})},a))}),t&&o.jsx("div",{className:"absolute pointer-events-none z-20 rounded-lg border-2 border-dashed border-destructive/60 bg-destructive/10",style:{top:"12px",bottom:"12px",left:`calc(${(t.ghostStart-1)/12*100}% + 12px)`,width:`calc(${t.ghostSpan/12*100}% - 8px)`,transition:"left 0.1s ease-out, width 0.1s ease-out"},children:o.jsxs("div",{className:"absolute -top-5 left-1/2 -translate-x-1/2 bg-destructive text-destructive-foreground text-[10px] font-bold px-2 py-0.5 rounded whitespace-nowrap",children:[t.ghostStart," →"," ",t.ghostStart+t.ghostSpan-1]})})]}),Un=({id:e,container:t})=>{var r;const{setNodeRef:a,isOver:n}=cr.useDroppable({id:`zone-${e}`}),{selectedId:s,setSelected:i,getConfig:l,updateConfig:c,removeItem:d,moveItem:u,moveItemNoSnapshot:p,setPositionDrag:m,positionDrag:x,reorderDrag:g,setReorderDrag:f,pushSnapshot:v,containers:b}=Je(),j=l(e),y=((r=b[e])==null?void 0:r.children)??[],N=y.filter(q=>Ne(q)==="field"),C=s===e,k=j.tamanho||12,_=(x==null?void 0:x.itemId)===e,w=(g==null?void 0:g.draggingId)===e,R=x&&y.includes(x.itemId),A=s&&y.includes(s)&&Ne(s)==="field",[I,F]=E.useState(!1),V="var(--t-primary, hsl(var(--primary)))",M=C?V:I?"rgba(59,130,246,0.55)":"rgba(59,130,246,0.3)",U=C?`color-mix(in srgb, ${V} 15%, transparent)`:I?"rgba(59,130,246,0.12)":"rgba(59,130,246,0.07)",$=C?`color-mix(in srgb, ${V} 30%, transparent)`:I?"rgba(59,130,246,0.28)":"rgba(59,130,246,0.18)",T=C?`0 0 0 3px color-mix(in srgb, ${V} 20%, transparent)`:I?"0 0 0 2px rgba(59,130,246,0.25)":void 0,{resizeRef:D,resizing:z,resizePreview:L,handleResizeStart:ee}=Tu({id:e,currentTamanho:k,inicioColuna:j.inicioColuna,onResize:q=>c(e,{tamanho:q}),pushSnapshot:v}),Y=E.useMemo(()=>({kind:"custom",moveItemNoSnapshot:p,pushSnapshot:v,setReorderDrag:f,dataAttribute:"data-container-id"}),[p,v,f]),{handleGripMouseDown:J}=z0({id:e,elementRef:D,tamanho:k,inicioColuna:j.inicioColuna||1,onPositionApply:q=>c(e,{inicioColuna:q}),setPositionDrag:m,setSelected:i,reorderStrategy:Y});return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:q=>{D.current=q},onClick:q=>{q.stopPropagation(),i(e)},onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),className:G("relative rounded-lg border overflow-hidden transition-all",z&&"ring-2 ring-blue-400/50",_&&"opacity-0 pointer-events-none",w&&"opacity-50"),"data-container-id":e,style:{gridColumn:j.inicioColuna?`${j.inicioColuna} / span ${k}`:`span ${k}`,minWidth:"80px",borderColor:M,boxShadow:T},children:[o.jsxs("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",style:{backgroundColor:U,borderColor:$},children:[o.jsx("div",{"data-grip":!0,onMouseDown:J,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-primary/20 transition-colors",children:o.jsx(P.GripVertical,{className:"h-3.5 w-3.5 text-blue-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:q=>{q.stopPropagation(),u(e,"up")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(P.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})}),o.jsx("button",{onClick:q=>{q.stopPropagation(),u(e,"down")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(P.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})})]}),o.jsx(P.BoxSelect,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),o.jsx("span",{className:G("text-xs font-semibold truncate flex-1",j.showLabel===!1?"text-blue-500/50 italic":"text-blue-700 dark:text-blue-300"),children:j.label}),j.showAsCard&&o.jsx(P.SquareStack,{className:"h-3 w-3 text-blue-400 shrink-0"}),j.showLabel===!1&&o.jsx(P.EyeOff,{className:"h-3 w-3 text-muted-foreground/50 shrink-0"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-blue-500/10 px-1.5 rounded",children:[L??k,"/12"]}),o.jsx("button",{onClick:q=>{q.stopPropagation(),d(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:I?1:0},children:o.jsx(P.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:a,className:G("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",n?"bg-primary/15 ring-2 ring-inset ring-primary/50":(R||A)&&"bg-muted/30"),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[o.jsx(Bn,{showGuides:!!R||!!A,positionDrag:R?x:null}),y.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(xt.SortableContext,{items:N,strategy:xt.rectSortingStrategy,children:y.filter(q=>Ne(q)==="field").map(q=>l(q).fieldType==="field_array"?o.jsx(L0,{id:q,container:e},q):o.jsx(Tr,{id:q,container:e},q))})]}),o.jsx("div",{onMouseDown:ee,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-blue-500/20 transition-colors flex items-center justify-center",children:o.jsx(P.GripHorizontal,{className:"h-3 w-3 text-blue-500/40 rotate-90"})})]}),_&&x&&Bo.createPortal(o.jsxs("div",{style:{position:"fixed",left:x.cursorX+14,top:x.cursorY-18,zIndex:9999,pointerEvents:"none"},className:"flex items-center gap-1 bg-foreground text-background text-[10px] font-mono px-2 py-0.5 rounded shadow-xl border border-border/20",children:[o.jsx(P.BoxSelect,{className:"h-2.5 w-2.5"}),"col ",x.ghostStart,"–",x.ghostStart+x.ghostSpan-1]}),document.body)," "]})},$u=({id:e,container:t,index:r})=>{var a;const{attributes:n,listeners:s,setNodeRef:i,transform:l,transition:c,isDragging:d}=xt.useSortable({id:e,data:{isCanvasItem:!0,type:"step",id:e}}),{setNodeRef:u,isOver:p}=cr.useDroppable({id:`zone-${e}`}),{selectedId:m,setSelected:x,getConfig:g,removeItem:f,containers:v,positionDrag:b}=Je(),j=g(e),y=((a=v[e])==null?void 0:a.children)??[],N=m===e,C=b&&y.includes(b.itemId),[k,_]=E.useState(!1),w="var(--t-primary, hsl(var(--primary)))",R=N?w:k?`color-mix(in srgb, ${w} 60%, transparent)`:`color-mix(in srgb, ${w} 25%, transparent)`,A=N?`color-mix(in srgb, ${w} 14%, transparent)`:k?`color-mix(in srgb, ${w} 10%, transparent)`:`color-mix(in srgb, ${w} 6%, transparent)`,I=N?`color-mix(in srgb, ${w} 28%, transparent)`:`color-mix(in srgb, ${w} 15%, transparent)`,F=N?`0 0 0 3px color-mix(in srgb, ${w} 20%, transparent)`:void 0,V={transform:Cr.CSS.Transform.toString(l),transition:c,opacity:d?0:1};return o.jsxs("div",{ref:i,style:{...V,borderWidth:"2px",borderStyle:"solid",borderColor:R,boxShadow:F},onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),onClick:M=>{M.stopPropagation(),x(e)},className:"group/step rounded-xl overflow-hidden transition-all",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2",style:{backgroundColor:A,borderColor:I},children:[o.jsx("div",{...s,...n,className:"cursor-grab shrink-0",onClick:M=>M.stopPropagation(),children:o.jsx(P.GripVertical,{className:"h-3.5 w-3.5 text-primary"})}),o.jsx(P.Layers,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{className:"text-sm font-bold truncate flex-1 text-primary",children:["Step ",r+1," — ",j.label]}),j.description&&o.jsx("span",{className:"text-[10px] text-muted-foreground truncate hidden md:block",children:j.description}),o.jsx("button",{onClick:M=>{M.stopPropagation(),f(e)},className:"transition-opacity shrink-0 p-1 rounded hover:bg-destructive/10",style:{opacity:k?1:0},children:o.jsx(P.Trash2,{className:"h-3.5 w-3.5 text-destructive"})})]}),o.jsxs("div",{ref:u,className:G("relative p-3 min-h-[80px] gap-2 items-start transition-all duration-150",p?"bg-blue-500/20 ring-2 ring-inset ring-blue-400/70 shadow-[inset_0_0_0_2px_theme(colors.blue.400/50%)]":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content",backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px)",backgroundSize:"16px 16px"},children:[o.jsx(Bn,{showGuides:!!C,positionDrag:C?b:null}),y.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground/50 text-center py-6 italic w-full",style:{gridColumn:"span 12"},children:"Arraste containers aqui"}),y.map(M=>Ne(M)==="container"?o.jsx(Un,{id:M,container:e},M):o.jsx(Tr,{id:M,container:e},M))]})]})},M0=()=>{var e;const{containers:t,setSelected:r}=Je(),a=((e=t.root)==null?void 0:e.children)??[],n=a.filter(l=>Ne(l)==="step"),{setNodeRef:s,isOver:i}=cr.useDroppable({id:"root"});return o.jsxs("div",{ref:s,onClick:()=>r(null),className:`min-h-[500px] rounded-xl border p-4 space-y-4 transition-all duration-150 ${i?"bg-primary/10 border-primary/60 ring-2 ring-primary/30 shadow-[0_0_0_4px_theme(colors.primary/10%)]":"border-border/40"}`,style:{backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.12) 1px, transparent 1px)",backgroundSize:"20px 20px",backgroundColor:i?void 0:"hsl(var(--muted) / 0.3)"},children:[a.length===0&&o.jsx("div",{className:"flex items-center justify-center h-[400px]",children:o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx(P.Layers,{className:"h-10 w-10 text-muted-foreground/30 mx-auto"}),o.jsxs("p",{className:"text-sm text-muted-foreground/50",children:["Arraste ",o.jsx("strong",{children:"Steps"})," da paleta para cá"]})]})}),o.jsx(xt.SortableContext,{items:n,strategy:xt.verticalListSortingStrategy,children:a.map((l,c)=>{const d=Ne(l);return d==="step"?o.jsx($u,{id:l,container:"root",index:c},l):d==="container"?o.jsx(Un,{id:l,container:"root"},l):o.jsx(Tr,{id:l,container:"root"},l)})})]})},F0={personal:"Pessoal",address:"Endereço",health:"Saúde",event:"Evento",payment:"Pagamento",emergency:"Emergência"},V0={texto:"Texto",selecao:"Seleção",range:"Numérico / Visual",data:"Data e Hora",contato:"Contato / Endereço",outros:"Arquivo / Outros"},B0=()=>{const e=St.reduce((t,r)=>{const a=r.group??"outros";return t[a]||(t[a]=[]),t[a].push(r),t},{});return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Estrutura"}),an.map(t=>o.jsx(gi,{component:t.component,label:t.label,icon:t.icon,color:t.color},t.component))]}),Object.entries(e).map(([t,r])=>o.jsx(ho,{label:V0[t]??t,children:r.map(a=>o.jsx(gi,{component:a.component,label:a.label,icon:a.icon,color:"border-border"},a.component))},t)),o.jsx(ho,{label:"Blocos pré-configurados",defaultOpen:!1,children:pa.map(t=>o.jsx(U0,{block:t},t.id))}),o.jsx(ho,{label:"Blocos de steps",defaultOpen:!1,children:qo.map(t=>o.jsx(H0,{block:t},t.id))})]})},ho=({label:e,children:t,defaultOpen:r=!0})=>{const[a,n]=E.useState(r);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{type:"button",onClick:()=>n(s=>!s),className:"flex w-full items-center justify-between text-xs font-semibold text-muted-foreground uppercase tracking-wide hover:text-foreground transition-colors",children:[e,o.jsx(P.ChevronDown,{className:`h-3.5 w-3.5 transition-transform ${a?"":"-rotate-90"}`})]}),a&&o.jsx("div",{className:"space-y-1.5",children:t})]})},gi=({component:e,label:t,icon:r,color:a})=>{const{attributes:n,listeners:s,setNodeRef:i,transform:l,isDragging:c}=cr.useDraggable({id:`palette-${e}`,data:{isPaletteItem:!0,componentType:e}});return o.jsxs("div",{ref:i,...s,...n,className:`cursor-grab flex items-center gap-2 rounded-lg border px-3 py-2 select-none hover:bg-accent transition-colors ${a} ${c?"opacity-50":""}`,style:{transform:c?void 0:Cr.CSS.Translate.toString(l)},children:[o.jsx(P.GripVertical,{className:"h-4 w-4 text-muted-foreground"}),o.jsx(r,{className:"h-4 w-4"}),o.jsx("span",{className:"text-sm font-medium",children:t})]})},U0=({block:e})=>{const{attributes:t,listeners:r,setNodeRef:a,transform:n,isDragging:s}=cr.useDraggable({id:`preset-${e.id}`,data:{isPalettePreset:!0,presetId:e.id}}),i=e.icon?ct[e.icon]:void 0,l=F0[e.category]??e.category;return o.jsxs("div",{ref:a,...r,...t,className:`cursor-grab flex items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2 select-none hover:bg-primary/10 transition-colors ${s?"opacity-50":""}`,style:{transform:s?void 0:Cr.CSS.Translate.toString(n)},title:e.description,children:[o.jsx(P.GripVertical,{className:"h-4 w-4 text-muted-foreground shrink-0"}),i?o.jsx(i,{className:"h-4 w-4 text-primary shrink-0"}):o.jsx(ct.Blocks,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:l})]})]})},H0=({block:e})=>{const{addPresetStepBlock:t}=Je(),r=e.icon?ct[e.icon]:void 0;return o.jsxs("button",{type:"button",onClick:()=>t(e),className:"w-full flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 cursor-pointer select-none hover:bg-amber-500/15 transition-colors text-left",title:e.description,children:[r?o.jsx(r,{className:"h-4 w-4 text-amber-400 shrink-0"}):o.jsx(ct.Layers,{className:"h-4 w-4 text-amber-400 shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.steps.length," steps"]})]}),o.jsxs("span",{className:"text-[10px] text-amber-400 border border-amber-500/30 rounded px-1.5 py-0.5 shrink-0",children:["+",e.steps.length," steps"]})]})},xo=e=>({when:e.campoId,operator:e.operador,value:e.valor,source:e.source}),Ru=e=>{var t;const r={campoId:e.when,operador:e.operator,valor:e.value,source:e.source};if(e.logicOperator&&(t=e.extraConditions)!=null&&t.length){const a=e.extraConditions.map(s=>({campoId:s.when,operador:s.operator,valor:s.value,source:s.source})),n=[r,...a];return e.logicOperator==="or"?{or:n}:{and:n}}return r},Ou=e=>{if("campoId"in e)return xo(e);const t=("and"in e?e.and:e.or)??[];if(t.length===0)return;const r="and"in e?"and":"or",[a,...n]=t;if(!("campoId"in a))return;const s=xo(a);return n.length===0?s:{...s,logicOperator:r,extraConditions:n.filter(i=>"campoId"in i).map(xo)}},W0=(e,t,r)=>{var a,n;const s=l=>t[l]||{label:l,name:l},i=(((n=(a=e==null?void 0:e.containers)==null?void 0:a.root)==null?void 0:n.children)||[]).filter(l=>Ne(l)==="step").map((l,c)=>{var d,u;const p=s(l),m=(((u=(d=e==null?void 0:e.containers)==null?void 0:d[l])==null?void 0:u.children)||[]).filter(x=>Ne(x)==="container").map((x,g)=>{var f,v;const b=s(x),j=(((v=(f=e==null?void 0:e.containers)==null?void 0:f[x])==null?void 0:v.children)||[]).filter(N=>Ne(N)==="field").map((N,C)=>{var k,_;const w=s(N),R=Fo(w,N,C);if(R.tipo===O.FIELD_ARRAY){const A=((_=(k=e==null?void 0:e.containers)==null?void 0:k[N])==null?void 0:_.children)??[];R.subFields=A.filter(I=>Ne(I)==="field").map((I,F)=>Fo(s(I),I,F))}return R}),y={id:x,titulo:b.label||"Container",descricao:b.description,icone:b.icone,ordem:g,colunas:b.columns||2,tamanho:b.tamanho||12,inicioColuna:b.inicioColuna,showLabel:b.showLabel,showAsCard:b.showAsCard,campos:j};return b.condition&&(y.condicional=Ru(b.condition)),y});return{id:l,titulo:p.label||"Step",descricao:p.description,icone:p.icone,ordem:c,showLabel:p.showLabel,containers:m}});return{id:r.id||"",nome:r.nome,descricao:r.descricao,status:r.status,template:r.template??null,steps:i}},Fo=(e,t,r)=>{var a,n,s,i;const l={id:t,nome:e.name||t,label:e.label||"",tipo:e.fieldType||"texto",obrigatorio:e.required||!1,tamanho:e.tamanho||6,inicioColuna:e.inicioColuna,ordem:r,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==void 0?e.clearedValue:void 0,initialValue:e.initialValue!==void 0?e.initialValue:void 0,resolvePropsKey:e.resolvePropsKey||void 0};if((a=e.validate)!=null&&a.length&&(l.validate=e.validate),(n=e.warn)!=null&&n.length&&(l.warn=e.warn),(s=e.options)!=null&&s.length&&(l.opcoes=e.options.map(c=>({valor:c.value,label:c.label,disabled:c.disabled}))),e.validation){const c=e.validation;l.validacao={},c.minLength!==void 0&&(l.validacao.minLength=c.minLength),c.maxLength!==void 0&&(l.validacao.maxLength=c.maxLength),c.min!==void 0&&(l.validacao.min=c.min),c.max!==void 0&&(l.validacao.max=c.max),c.regex&&(l.validacao.regex=c.regex),c.regexMessage&&(l.validacao.regexMessage=c.regexMessage),c.minDate&&(l.validacao.minDate=c.minDate),c.maxDate&&(l.validacao.maxDate=c.maxDate),c.minAge!==void 0&&(l.validacao.minAge=c.minAge),c.maxAge!==void 0&&(l.validacao.maxAge=c.maxAge),(i=c.fileTypes)!=null&&i.length&&(l.validacao.fileTypes=c.fileTypes),c.maxFileSize!==void 0&&(l.validacao.maxFileSize=c.maxFileSize)}if(l.tipo===O.FIELD_ARRAY&&(e.itemLabel&&(l.itemLabel=e.itemLabel),e.minItems!==void 0&&(l.minItems=e.minItems),e.maxItems!==void 0&&(l.maxItems=e.maxItems),e.addLabel&&(l.addLabel=e.addLabel)),l.tipo===O.TERMS&&(e.termoTexto&&(l.termoTexto=e.termoTexto),e.termoPdfUrl&&(l.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(l.termoPdfUploadId=e.termoPdfUploadId)),l.tipo===O.SLIDER&&(e.step!==void 0&&(l.step=e.step),e.minValue!==void 0&&(l.minValue=e.minValue),e.maxValue!==void 0&&(l.maxValue=e.maxValue)),l.tipo===O.RATING&&e.maxRating!==void 0&&(l.maxRating=e.maxRating),l.tipo===O.DATE_RANGE&&(e.dateRangeStartLabel&&(l.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(l.dateRangeEndLabel=e.dateRangeEndLabel)),l.tipo===O.SUB_FORM){const c=e.subSchemaFields??[];(c.length>0||e.subSchemaTitle)&&(l.subSchema={titulo:e.subSchemaTitle,fields:c.map((d,u)=>Fo(d,d.name??`subfield-${u}`,u))})}return e.condition&&(l.condicional=Ru(e.condition)),l},Du=e=>{const t={},r={root:{children:[]}},a=[...e.steps].sort((n,s)=>n.ordem-s.ordem);for(const n of a){const s=n.id||`step-${Fe()}`;r.root.children.push(s),t[s]={label:n.titulo,name:s,fieldType:"step",description:n.descricao,icone:n.icone,showLabel:n.showLabel};const i=[],l=[...n.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l){const d=c.id||`container-${Fe()}`;i.push(d);const u=c.condicional?Ou(c.condicional):void 0;t[d]={label:c.titulo,name:d,fieldType:"container",description:c.descricao,icone:c.icone,columns:c.colunas,tamanho:c.tamanho||12,inicioColuna:c.inicioColuna,showLabel:c.showLabel,showAsCard:c.showAsCard,...u?{condition:u}:{}};const p=[],m=[...c.campos].sort((x,g)=>x.ordem-g.ordem);for(const x of m){const g=x.id||`${x.tipo}-${Fe()}`;if(p.push(g),t[g]=Vo(x),x.tipo===O.FIELD_ARRAY){const f=[];for(const v of x.subFields??[]){const b=v.id||`${v.tipo}-${Fe()}`;f.push(b),t[b]=Vo(v)}r[g]={children:f}}}r[d]={children:p}}r[s]={children:i}}return{dndState:{containers:r},configs:t,templateId:e.template??null}},Vo=(e,t)=>{var r,a,n,s;const i={label:e.label,name:e.nome,fieldType:e.tipo,required:e.obrigatorio,tamanho:e.tamanho,inicioColuna:e.inicioColuna,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!=null?String(e.clearedValue):void 0,initialValue:e.initialValue!==void 0?String(e.initialValue):void 0,resolvePropsKey:e.resolvePropsKey||void 0,validate:(r=e.validate)!=null&&r.length?e.validate:void 0,warn:(a=e.warn)!=null&&a.length?e.warn:void 0};if((n=e.opcoes)!=null&&n.length&&(i.options=e.opcoes.map(l=>({value:l.valor,label:l.label,disabled:l.disabled}))),e.validacao){const l=e.validacao;i.validation={},l.minLength!==void 0&&(i.validation.minLength=l.minLength),l.maxLength!==void 0&&(i.validation.maxLength=l.maxLength),l.min!==void 0&&(i.validation.min=l.min),l.max!==void 0&&(i.validation.max=l.max),l.regex&&(i.validation.regex=l.regex),l.regexMessage&&(i.validation.regexMessage=l.regexMessage),l.minDate&&(i.validation.minDate=l.minDate),l.maxDate&&(i.validation.maxDate=l.maxDate),l.minAge!==void 0&&(i.validation.minAge=l.minAge),l.maxAge!==void 0&&(i.validation.maxAge=l.maxAge),(s=l.fileTypes)!=null&&s.length&&(i.validation.fileTypes=l.fileTypes),l.maxFileSize!==void 0&&(i.validation.maxFileSize=l.maxFileSize)}if(e.tipo===O.FIELD_ARRAY&&(e.itemLabel&&(i.itemLabel=e.itemLabel),e.minItems!==void 0&&(i.minItems=e.minItems),e.maxItems!==void 0&&(i.maxItems=e.maxItems),e.addLabel&&(i.addLabel=e.addLabel)),e.tipo===O.TERMS&&(e.termoTexto&&(i.termoTexto=e.termoTexto),e.termoPdfUrl&&(i.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(i.termoPdfUploadId=e.termoPdfUploadId)),e.tipo===O.SLIDER&&(e.step!==void 0&&(i.step=e.step),e.minValue!==void 0&&(i.minValue=e.minValue),e.maxValue!==void 0&&(i.maxValue=e.maxValue)),e.tipo===O.RATING&&e.maxRating!==void 0&&(i.maxRating=e.maxRating),e.tipo===O.DATE_RANGE&&(e.dateRangeStartLabel&&(i.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(i.dateRangeEndLabel=e.dateRangeEndLabel)),e.tipo===O.SUB_FORM&&e.subSchema&&(i.subSchemaTitle=e.subSchema.titulo,i.subSchemaFields=e.subSchema.fields.map(l=>Vo(l,l.id))),e.condicional){const l=Ou(e.condicional);l&&(i.condition=l)}return i},q0=(e,t)=>{var r,a,n,s,i,l,c;const d=[],u=[],p=g=>t[g]||{label:g,name:g},m=((a=(r=e==null?void 0:e.containers)==null?void 0:r.root)==null?void 0:a.children)||[],x=new Set;for(const g of m){if(Ne(g)!=="step")continue;const f=p(g).label||g,v=((s=(n=e==null?void 0:e.containers)==null?void 0:n[g])==null?void 0:s.children)||[];if(v.length===0){u.push(`Step "${f}" está vazio (sem containers).`);continue}for(const b of v){if(Ne(b)!=="container")continue;const j=p(b).label||b,y=((l=(i=e==null?void 0:e.containers)==null?void 0:i[b])==null?void 0:l.children)||[],N=new Map;for(const C of y){if(Ne(C)!=="field")continue;x.add(C);const k=p(C).name||C;N.has(k)||N.set(k,[]),N.get(k).push(C)}for(const[C,k]of N.entries())k.length>1&&d.push(`Nome duplicado "${C}" no container "${j}" (IDs: ${k.join(", ")}).`)}}for(const[g,f]of Object.entries(t)){if(!((c=f.condition)!=null&&c.when))continue;const v=f.condition.when;if(!x.has(v)){const b=f.label||g;u.push(`Campo "${b}" referencia campo inexistente na condição (when: "${v}").`)}}return{errors:d,warnings:u}},Z0=[...an,...St],X0=({data:e})=>{const{getConfig:t}=Je();if(!e)return null;const r=e;if(r.isPalettePreset){const a=ji(r.presetId);return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[o.jsx(ct.Blocks,{className:"h-3.5 w-3.5 shrink-0"}),(a==null?void 0:a.name)??"Bloco"]})}if(r.isPaletteItem){const a=Z0.find(s=>s.component===r.componentType),n=a==null?void 0:a.icon;return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[n&&o.jsx(n,{className:"h-3.5 w-3.5 shrink-0"}),(a==null?void 0:a.label)??r.componentType]})}if(r.isCanvasItem){const{type:a,id:n}=r,s=t(n),i={step:"border-primary/80 bg-primary text-primary-foreground",container:"border-blue-600 bg-blue-600 text-white",field:"border-primary/80 bg-primary text-primary-foreground"},l={step:"Step",container:"Container",field:"Campo"};return o.jsxs("div",{className:G("flex items-center gap-2 rounded-full px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none min-w-[100px] max-w-[200px]",i[a]??"border-border bg-card"),children:[o.jsx(P.GripVertical,{className:"h-3 w-3 opacity-60 shrink-0"}),o.jsxs("span",{className:"opacity-70 shrink-0",children:[l[a]??a,":"]}),o.jsx("span",{className:"truncate",children:s.label||n})]})}return null},G0=({schema:e,children:t})=>{var r;const a=E.useMemo(()=>{var n;return(n=e==null?void 0:e.steps)!=null&&n.length?Du(e):null},[e]);return o.jsx(n0,{children:o.jsx(rl,{initialConfigs:a==null?void 0:a.configs,initialContainers:(r=a==null?void 0:a.dndState)==null?void 0:r.containers,initialTemplateId:(a==null?void 0:a.templateId)??void 0,schemaId:(e==null?void 0:e.id)??void 0,children:t})})};exports.BuilderProvider=rl;exports.BuilderWrapper=G0;exports.Canvas=M0;exports.ConfigPanel=b0;exports.ContainerRenderer=Gi;exports.DFCepField=rn;exports.DFCheckbox=va;exports.DFCheckboxGroup=Qo;exports.DFDateField=ar;exports.DFFieldArray=Mi;exports.DFFileUpload=tn;exports.DFHidden=ba;exports.DFMaskedInput=Ct;exports.DFParticipationType=Fi;exports.DFPaymentMethod=Ui;exports.DFRadioGroup=en;exports.DFSelect=ga;exports.DFTerms=Hi;exports.DFTextField=Be;exports.DFTextarea=xa;exports.DragGhost=X0;exports.DroppedContainer=Un;exports.DroppedField=Tr;exports.DroppedStep=$u;exports.EVENT_VARIABLES=on;exports.FIELD_TYPES=St;exports.FIELD_TYPE_ICONS=op;exports.FIELD_TYPE_LABELS=ap;exports.FieldType=O;exports.FormRenderer=th;exports.FormSchemaStatus=vi;exports.FormSpy=rh;exports.GridOverlay=Bn;exports.LivePreview=A0;exports.MaskType=bi;exports.OPCOES_POR_DIA=Vi;exports.OPCOES_TODOS_OS_DIAS=Bi;exports.PRESET_BLOCKS=pa;exports.PRESET_STEP_BLOCKS=qo;exports.Palette=B0;exports.RendererContext=Jo;exports.STRUCTURE_TYPES=an;exports.StepRenderer=Yi;exports.TEMPLATE_REGISTRY=zt;exports.TemplateProvider=Ho;exports.builderToFormSchema=W0;exports.evaluateFieldCondition=rt;exports.findParentContainer=tl;exports.formSchemaToBuilder=Du;exports.generateId=yi;exports.getAllTemplates=yp;exports.getFieldMeta=ah;exports.getFieldMetaById=Ji;exports.getItemType=Ne;exports.getPresetById=ji;exports.getPresetStepBlockById=Sp;exports.getPresetsByCategory=Cp;exports.getTemplateConfig=ua;exports.interpolate=Xe;exports.interpolateContainer=ha;exports.interpolateField=Ii;exports.interpolateStep=Li;exports.isDarkTemplate=wi;exports.isGlassmorphism=wp;exports.makeStepResolver=Di;exports.makeStepWarnComputer=Ai;exports.useBuilder=Je;exports.useField=Yf;exports.useFieldApi=Kf;exports.useFormApi=Gf;exports.useFormState=Ki;exports.useRendererContext=dt;exports.useTemplate=Wo;exports.v4Fallback=Fe;exports.validateBuilderIntegrity=q0;
|