{"version":3,"file":"link.cjs","names":["createFaker","prismic","capitalCase","sentenceCase"],"sources":["../../src/model/link.ts"],"sourcesContent":["import * as prismic from \"@prismicio/client\"\n\nimport { capitalCase, sentenceCase } from \"../lib/changeCase\"\nimport { createFaker } from \"../lib/createFaker\"\nimport type { MockModelConfig } from \"../types\"\n\ntype MockLinkModel<\n\tAllowTargetBlank extends boolean = boolean,\n\tAllowText extends boolean = boolean,\n\tRepeat extends boolean = boolean,\n> = prismic.CustomTypeModelLinkField & {\n\tconfig: AllowTargetBlank extends true\n\t\t? { allowTargetBlank: true }\n\t\t: { allowTargetBlank?: undefined }\n} & {\n\tconfig: AllowText extends true ? { allowText: true } : { allowText?: undefined }\n} & {\n\tconfig: Repeat extends true ? { repeat: true } : { repeat?: undefined }\n}\n\nexport type MockLinkModelConfig<\n\tAllowTargetBlank extends boolean = boolean,\n\tAllowText extends boolean = boolean,\n\tRepeat extends boolean = boolean,\n> = {\n\tallowTargetBlank?: AllowTargetBlank\n\tallowText?: AllowText\n\trepeat?: Repeat\n} & MockModelConfig\n\nexport const link = <\n\tAllowTargetBlank extends boolean = boolean,\n\tAllowText extends boolean = boolean,\n\tRepeat extends boolean = boolean,\n>(\n\tconfig: MockLinkModelConfig<AllowTargetBlank, AllowText, Repeat>,\n): MockLinkModel<AllowTargetBlank, AllowText, Repeat> => {\n\tconst faker = config.faker || createFaker(config.seed)\n\n\treturn {\n\t\ttype: prismic.CustomTypeModelFieldType.Link,\n\t\tconfig: {\n\t\t\tlabel: capitalCase(faker.word()),\n\t\t\tplaceholder: sentenceCase(faker.words(3)),\n\t\t\tselect: null,\n\t\t\tallowTargetBlank:\n\t\t\t\t(\"allowTargetBlank\" in config ? config.allowTargetBlank : faker.boolean()) || undefined,\n\t\t\tallowText: (\"allowText\" in config ? config.allowText : faker.boolean()) || undefined,\n\t\t\trepeat: (\"repeat\" in config ? config.repeat : faker.boolean()) || undefined,\n\t\t},\n\t} as MockLinkModel<AllowTargetBlank, AllowText, Repeat>\n}\n"],"mappings":";;;;;;AA8BA,MAAa,QAKZ,WACwD;CACxD,MAAM,QAAQ,OAAO,SAASA,oBAAAA,YAAY,OAAO,KAAK;AAEtD,QAAO;EACN,MAAMC,kBAAQ,yBAAyB;EACvC,QAAQ;GACP,OAAOC,mBAAAA,YAAY,MAAM,MAAM,CAAC;GAChC,aAAaC,mBAAAA,aAAa,MAAM,MAAM,EAAE,CAAC;GACzC,QAAQ;GACR,mBACE,sBAAsB,SAAS,OAAO,mBAAmB,MAAM,SAAS,KAAK,KAAA;GAC/E,YAAY,eAAe,SAAS,OAAO,YAAY,MAAM,SAAS,KAAK,KAAA;GAC3E,SAAS,YAAY,SAAS,OAAO,SAAS,MAAM,SAAS,KAAK,KAAA;GAClE;EACD"}