{"version":3,"file":"SingleFontInitializer.36rlkAVA.mjs","names":[],"sources":["https:/framerusercontent.com/modules/PtUeqkuedcIpSOr7NIG5/CkBw3GqfXFSIifgSSpRQ/SingleFontInitializer.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect}from\"react\";import{getFont,getInstanceFromTextArea,getAxesFromTextArea,getAxisName,getLineArrayWithText,getLineArrayWithParagraph,loadFont,useStore}from\"https://framer.com/m/Utils-dICi.js\";/**\n * @framerDisableUnlink\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n * Develop By Mahmut\n */export default function SingleFontInitializer(props){const{familyName,familySlug,familyProductId,familyProductPrice,familyProductPrefix,collectionName,collectionSlug,collectionProductId,collectionProductPrice,fontFile,name,sampleText,sampleParagraph,weight,style,isVariableFont,customInstances,customAxes,buyLink,productId,productPrefix,price}=props;const[,setStore]=useStore();useEffect(()=>{if(!window||!document)return;setStore(store=>({...store,loading:true}));const returnedObject=loadFont({url:fontFile,name:familyName,weight:isVariableFont?\"normal\":weight,style}).then(()=>{if(isVariableFont){getFont({fontFamily:familyName,style:style},fontFile,options=>{const customAxesMap=getAxesFromTextArea(customAxes);const sampleTextList=getLineArrayWithText(sampleText);const sampleParagraphList=getLineArrayWithParagraph(sampleParagraph);const axes=(customAxesMap?.length?customAxesMap:options.axes).map(axis=>({...axis,label:getAxisName(axis?.name),familyName:familyName||\"familyName\"}));const customInstancesMap=getInstanceFromTextArea(customInstances||\"\");let instances=customInstancesMap?.length?customInstancesMap:options.instances;instances=instances.map((item,index)=>{return{...item,file:fontFile,familyName:familyName||\"familyName\",familySlug:familySlug,familyProductId:familyProductId,familyProductPrice:familyProductPrice,familyProductPrefix:familyProductPrefix,collectionName:collectionName,collectionSlug:collectionSlug,collectionProductId:collectionProductId,collectionProductPrice:collectionProductPrice,fontStyle:style||\"normal\",fontWeight:weight||\"400\",buyLink,productId,productPrefix,price,shortName:isVariableFont?name:null,sampleParagraph:item?.sampleText||sampleParagraphList?.[index]||\"\",sampleText:item?.sampleText||sampleTextList?.[index]||\"\"};});setStore(store=>({...store,loading:false,instances:[...store.instances,...instances],axes:[...store.axes,...axes],name:familyName,files:[...store.files,fontFile]}));});}else{const instance={value:`fontWeight ${weight}, fontStyle ${style}`,name:\"staticVariable\",fontStyle:style||\"normal\",fontWeight:weight||\"400\",label:name,buyLink,price,productId,productPrefix,sampleText,sampleParagraph,file:fontFile,familyName:familyName||\"familyName\",familySlug:familySlug,familyProductId:familyProductId,familyProductPrice:familyProductPrice,familyProductPrefix:familyProductPrefix,collectionName:collectionName,collectionSlug:collectionSlug,collectionProductId:collectionProductId,collectionProductPrice:collectionProductPrice};setStore(store=>({...store,loading:false,instances:[...store.instances,instance],axes:store?.axes||[],name:familyName,files:[...store.files,fontFile]}));}}).catch(e=>{//console.log(\"error\", e)\n});},[fontFile]);return /*#__PURE__*/_jsx(\"span\",{});}export const SingleFontInitializerProps={familyName:{type:ControlType.String},openTypeFeatures:{type:ControlType.String},fontFile:{type:ControlType.File,allowedFileTypes:[\"woff2\",\"ttf\",\"otf\"]},isVariableFont:{type:ControlType.Boolean,label:\"Is Variable Font\"},name:{type:ControlType.String},weight:{type:ControlType.Number},style:{type:ControlType.String},sampleText:{type:ControlType.String},sampleParagraph:{type:ControlType.String},customInstances:{type:ControlType.String},customAxes:{type:ControlType.String},buyLink:{type:ControlType.Link},productId:{type:ControlType.String},price:{type:ControlType.String},productPrefix:{type:ControlType.String}};addPropertyControls(SingleFontInitializer,SingleFontInitializerProps);\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SingleFontInitializer\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"* @framerSupportedLayoutWidth auto\"}},\"SingleFontInitializerProps\":{\"type\":\"variable\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMet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