{"version":3,"file":"FormPageLabel.89LRepyu.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/CAiPOh5jW8sjhKQGY1KE/X3afoIg1yCvGCBNaiQSt/FormPageLabel.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";import{useEffect,useRef,useState}from\"react\";import{useMultiStepFormStore,getCanvasState,getFormInfo}from\"https://framerusercontent.com/modules/DwWOdDzQZGCuvkNlbUjZ/RhTkfEJwV2NS1uN2FS3e/FramerFormsShared.js\";/**\n * @framerSupportedLayoutWidth any\n * @framerSupportedLayoutHeight any\n */export default function FormPageLabel(props){var _props_style;const Tag=props.htmlTag||\"p\";const isCanvas=RenderTarget.current()===RenderTarget.canvas;const[multiStepFormState,setMultiStepFormState]=useMultiStepFormStore();const[canvasState,setCanvasState]=useState(null);const[formId,setFormId]=useState(null);const ref=useRef(null);const state=isCanvas?canvasState:multiStepFormState[formId];useEffect(()=>{const newFormId=getFormInfo(ref.current).formId;setFormId(newFormId);if(!multiStepFormState[newFormId]){setMultiStepFormState({});}if(isCanvas){setCanvasState(getCanvasState(ref.current));}},[]);var _state_totalPages;return /*#__PURE__*/_jsx(Tag,{ref:ref,style:{color:props.color,userSelect:props.textSelect?\"auto\":\"none\",whiteSpace:((_props_style=props.style)===null||_props_style===void 0?void 0:_props_style.width)?\"pre\":\"nowrap\",margin:0,...props.font,...props.style},children:props.text.replace(/\\[page\\]/g,(state===null||state===void 0?void 0:state.pageHistory)?state.pageHistory.length:1).replace(/\\[totalPages\\]/g,(_state_totalPages=state===null||state===void 0?void 0:state.totalPages)!==null&&_state_totalPages!==void 0?_state_totalPages:1)});}FormPageLabel.displayName=\"Form Page Label\";addPropertyControls(FormPageLabel,{text:{type:ControlType.String,defaultValue:\"Page [page] / [totalPages]\",description:\"*[page]*: current page\\n*[totalPages]*: total number of pages\"},font:{type:\"font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:14,lineHeight:1.4}},color:{type:ControlType.Color,defaultValue:\"#888\"},textSelect:{type:ControlType.Boolean,defaultValue:true},htmlTag:{type:ControlType.Enum,options:[\"p\",\"span\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\"],title:\"HTML Tag\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FormPageLabel\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"any\",\"framerSupportedLayoutHeight\":\"any\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}"],"mappings":"qQAGG,SAAwB,EAAc,EAAM,CAAkB,IAAM,EAAI,EAAM,SAAS,IAAU,EAAS,EAAa,SAAS,GAAG,EAAa,OAAY,CAAC,EAAmB,GAAuB,GAAuB,CAAM,CAAC,EAAY,GAAgBA,EAAS,KAAK,CAAM,CAAC,EAAO,GAAWA,EAAS,KAAK,CAAO,EAAIC,EAAO,KAAK,CAAO,EAAM,EAAS,EAAY,EAAmB,GAAgP,OAAxO,MAAc,CAAC,IAAM,EAAU,EAAY,EAAI,QAAQ,CAAC,OAAO,EAAU,EAAU,CAAK,EAAmB,IAAY,EAAsB,EAAE,CAAC,CAAK,GAAU,EAAe,EAAe,EAAI,QAAQ,CAAC,EAAI,EAAE,CAAC,CAA2C,EAAK,EAAI,CAAK,MAAI,MAAM,CAAC,MAAM,EAAM,MAAM,WAAW,EAAM,WAAW,OAAO,OAAO,WAA0B,EAAM,OAAyD,MAAO,MAAM,SAAS,OAAO,EAAE,GAAG,EAAM,KAAK,GAAG,EAAM,MAAM,CAAC,SAAS,EAAM,KAAK,QAAQ,YAAa,GAA0C,YAAa,EAAM,YAAY,OAAO,EAAE,CAAC,QAAQ,kBAAqC,GAA0C,YAAiE,EAAE,CAAC,CAAC,kBAHjmC,IAAiE,IAA6C,IAAmK,CAGk1B,EAAc,YAAY,kBAAkB,EAAoB,EAAc,CAAC,KAAK,CAAC,KA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