{"version":3,"file":"TypewriterOpos.Dig_2J5B.mjs","names":["useRef","useState","_Fragment"],"sources":["https:/framerusercontent.com/modules/c8KCu2XyI0RgM1HNWhiD/fBVEuTajyG3VVzMzc1GT/TypewriterOpos.js"],"sourcesContent":["// Encargo de Guille: titular con efecto máquina de escribir que escribe y\n// borra los nombres de las oposiciones que preparamos, para los H1 de las\n// landings de registro del Sistema Ninja (genérica, FCS, Bomberos).\n// Prefijo estático + palabra rotando con cursor. Lista editable por landing.\n//\n// Modos de layout:\n// - \"inline\": la palabra va en la misma línea que el prefijo, con el hueco\n//   de la palabra más larga reservado (comportamiento original).\n// - \"debajo\": el prefijo queda fijo en su(s) línea(s) — con text-wrap\n//   balance para que en móvil parta en líneas equilibradas — y la palabra\n//   rota en una línea propia, centrada según su propia longitud, con la\n//   altura siempre reservada para que nada salte.\n//\n// El estilo de referencia del H1 en las landings SN por academia es el del\n// título de Testimonios: National 2 Condensed Bold, line 1em, letter -0.04em,\n// 42px en móvil (tamanoFuente y ajustes van por props para no tocar los\n// usos antiguos del componente en el maestro).\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{useInView}from\"framer-motion\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight auto\n */export default function TypewriterOpos(props){const{prefijo,palabras,tag,modoPalabra,velocidadEscritura,velocidadBorrado,pausaFinal,colorPrefijo,colorPalabra,mostrarCursor,colorCursor,interlineado,interletraje,tamanoFuente,font,style}=props;const lista=(palabras||\"\").split(\"\\n\").map(s=>s.trim()).filter(Boolean);const isStatic=useIsStaticRenderer();const ref=useRef(null);const inView=useInView(ref,{amount:.1});const[texto,setTexto]=useState(lista[0]||\"\");const[idx,setIdx]=useState(0);const[borrando,setBorrando]=useState(false);const reducedMotion=typeof window!==\"undefined\"&&window.matchMedia&&window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;const animar=!isStatic&&!reducedMotion&&inView&&lista.length>1;useEffect(()=>{if(!animar)return;const palabra=lista[idx%lista.length];let delay;if(!borrando&&texto===palabra){delay=Math.max(pausaFinal,.3)*1e3;}else if(borrando&&texto===\"\"){delay=350;}else{delay=borrando?Math.max(velocidadBorrado,15):Math.max(velocidadEscritura,25);}const t=setTimeout(()=>{startTransition(()=>{if(!borrando&&texto===palabra){setBorrando(true);}else if(borrando&&texto===\"\"){setBorrando(false);setIdx(v=>(v+1)%lista.length);}else if(borrando){setTexto(palabra.slice(0,texto.length-1));}else{setTexto(palabra.slice(0,texto.length+1));}});},delay);return()=>clearTimeout(t);},[animar,texto,borrando,idx,lista.join(\"|\"),velocidadEscritura,velocidadBorrado,pausaFinal]);const Tag=tag||\"h1\";const visible=animar?texto:lista[idx%lista.length]||\"\";// Palabra objetivo del ciclo actual (la que se está escribiendo/borrando)\n// y la más larga de la lista (reserva de hueco en modo inline).\nconst objetivo=lista[idx%lista.length]||\"\";const masLarga=lista.reduce((a,b)=>b.length>a.length?b:a,\"\");const debajo=modoPalabra===\"debajo\";const cursorEl=mostrarCursor&&/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{display:\"inline-block\",width:\"0.08em\",height:\"0.9em\",marginLeft:\"0.06em\",verticalAlign:\"baseline\",transform:\"translateY(0.12em)\",backgroundColor:colorCursor,animation:animar?\"twoCursorBlink 1s steps(1) infinite\":\"none\"}});return /*#__PURE__*/_jsxs(Tag,{ref:ref,style:{position:\"relative\",margin:0,width:\"100%\",textAlign:\"center\",overflowWrap:\"break-word\",// Tipografía del H1 de las landings de registro SN; el\n// control \"Tipografía\" del panel la sobreescribe si se toca.\nfontFamily:'\"National 2 Condensed\", \"National 2 Condensed Bold\", \"National 2\", sans-serif',fontWeight:700,fontSize:tamanoFuente,lineHeight:interlineado,letterSpacing:`${interletraje}em`,color:colorPrefijo,...font,...style},children:[debajo?/*#__PURE__*/_jsxs(_Fragment,{children:[prefijo&&/*#__PURE__*/_jsx(\"span\",{style:{display:\"block\",// Reparte el prefijo en líneas equilibradas\n// (en móvil: 2 líneas parejas, nunca una\n// palabra suelta en la tercera).\ntextWrap:\"balance\"},children:prefijo}),/*#__PURE__*/_jsx(\"span\",{style:{display:\"block\",textAlign:\"center\",color:colorPalabra},children:/*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-grid\",justifyItems:\"start\"},children:[/*#__PURE__*/_jsxs(\"span\",{\"aria-hidden\":\"true\",style:{gridArea:\"1 / 1\",visibility:\"hidden\",whiteSpace:\"nowrap\"},children:[objetivo,mostrarCursor&&/*#__PURE__*/_jsx(\"span\",{style:{display:\"inline-block\",width:\"0.08em\",marginLeft:\"0.06em\"}})]}),/*#__PURE__*/_jsxs(\"span\",{style:{gridArea:\"1 / 1\",whiteSpace:\"nowrap\"},children:[visible,cursorEl]})]})})]}):/*#__PURE__*/_jsxs(_Fragment,{children:[prefijo?prefijo+\" \":\"\",/*#__PURE__*/_jsxs(\"span\",{style:{display:\"inline-grid\",verticalAlign:\"baseline\",justifyItems:\"start\",color:colorPalabra},children:[/*#__PURE__*/_jsx(\"span\",{\"aria-hidden\":\"true\",style:{gridArea:\"1 / 1\",visibility:\"hidden\",whiteSpace:\"nowrap\"},children:masLarga}),/*#__PURE__*/_jsxs(\"span\",{style:{gridArea:\"1 / 1\",whiteSpace:\"nowrap\"},children:[visible,cursorEl]})]})]}),/*#__PURE__*/_jsx(\"style\",{children:`@keyframes twoCursorBlink { 0%, 55% { opacity: 1 } 56%, 100% { opacity: 0 } }`})]});}TypewriterOpos.defaultProps={prefijo:\"No es cu\\xe1nto estudias. Es c\\xf3mo estudias… para ser\",palabras:\"Polic\\xeda Nacional\\nGuardia Civil\\nBombero\\nAuxiliar Administrativo\\nTramitaci\\xf3n Procesal\\nAgente de Hacienda\",tag:\"h1\",modoPalabra:\"inline\",velocidadEscritura:65,velocidadBorrado:35,pausaFinal:1.6,colorPrefijo:\"#151923\",colorPalabra:\"#151923\",mostrarCursor:true,colorCursor:\"#FF4D00\",interlineado:1.1,interletraje:0,tamanoFuente:\"clamp(30px, 5.5vw, 56px)\"};addPropertyControls(TypewriterOpos,{prefijo:{type:ControlType.String,title:\"Prefijo\",defaultValue:\"No es cu\\xe1nto estudias. Es c\\xf3mo estudias… para ser\",displayTextArea:true},palabras:{type:ControlType.String,title:\"Oposiciones\",displayTextArea:true,defaultValue:\"Polic\\xeda Nacional\\nGuardia Civil\\nBombero\\nAuxiliar Administrativo\\nTramitaci\\xf3n Procesal\\nAgente de Hacienda\",description:\"Una por l\\xednea\"},modoPalabra:{type:ControlType.Enum,title:\"Palabra\",options:[\"inline\",\"debajo\"],optionTitles:[\"En l\\xednea\",\"L\\xednea propia\"],defaultValue:\"inline\"},tag:{type:ControlType.Enum,title:\"Etiqueta\",options:[\"h1\",\"h2\",\"div\"],optionTitles:[\"H1\",\"H2\",\"Div\"],defaultValue:\"h1\"},font:{type:ControlType.Font,title:\"Tipograf\\xeda\",controls:\"extended\",displayFontSize:true,displayTextAlignment:false},tamanoFuente:{type:ControlType.String,title:\"Tama\\xf1o (CSS)\",defaultValue:\"clamp(30px, 5.5vw, 56px)\",description:\"Acepta clamp()/px/vw\"},interlineado:{type:ControlType.Number,title:\"Interlineado\",defaultValue:1.1,min:.9,max:1.6,step:.01},interletraje:{type:ControlType.Number,title:\"Interletraje (em)\",defaultValue:0,min:-.05,max:.1,step:.005},colorPrefijo:{type:ControlType.Color,title:\"Color prefijo\",defaultValue:\"#151923\"},colorPalabra:{type:ControlType.Color,title:\"Color palabra\",defaultValue:\"#151923\"},velocidadEscritura:{type:ControlType.Number,title:\"ms/letra\",defaultValue:65,min:25,max:200,step:5},velocidadBorrado:{type:ControlType.Number,title:\"ms/borrado\",defaultValue:35,min:15,max:150,step:5},pausaFinal:{type:ControlType.Number,title:\"Pausa (s)\",defaultValue:1.6,min:.3,max:5,step:.1},mostrarCursor:{type:ControlType.Boolean,title:\"Cursor\",defaultValue:true},colorCursor:{type:ControlType.Color,title:\"Color cursor\",defaultValue:\"#FF4D00\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"TypewriterOpos\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./TypewriterOpos.map"],"mappings":"0QAoBG,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,UAAQ,WAAS,MAAI,cAAY,qBAAmB,mBAAiB,aAAW,eAAa,eAAa,gBAAc,cAAY,eAAa,eAAa,eAAa,OAAK,SAAO,EAAY,GAAO,GAAU,GAAA,CAAI,MAAM;CAAI,CAAC,CAAC,IAAI,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,EAAQ,EAAS,EAAoB,EAAQ,EAAIA,EAAO,IAAI,EAAQ,EAAO,EAAU,EAAI,CAAC,OAAO,EAAE,CAAC,EAAO,CAAC,EAAM,GAAUC,EAAS,EAAM,IAAI,EAAE,EAAO,CAAC,EAAI,GAAQA,EAAS,CAAC,EAAO,CAAC,EAAS,GAAaA,EAAS,EAAK,EAAQ,EAAqB,IAAS,QAAa,EAAO,YAAY,EAAO,WAAW,kCAAkC,CAAC,CAAC,QAAc,EAAO,CAAC,GAAU,CAAC,GAAe,GAAQ,EAAM,OAAO,EAAE,MAAc,CAAC,GAAG,CAAC,EAAO,OAAO,IAAM,EAAQ,EAAM,EAAI,EAAM,QAAY,EAAM,AAAgH,EAA7G,CAAC,GAAU,IAAQ,EAAe,KAAK,IAAI,EAAW,EAAE,EAAE,IAAa,GAAU,IAAQ,GAAU,IAAgB,EAAS,KAAK,IAAI,EAAiB,EAAE,EAAE,KAAK,IAAI,EAAmB,EAAE,EAAG,IAAM,EAAE,eAAe,CAAC,MAAoB,CAAI,CAAC,GAAU,IAAQ,EAAS,EAA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