@horizon-labs/property-model-v3
Version:
Modelo de propriedades imobiliárias v3 - Sistema de atributos dinâmicos
1 lines • 58.8 kB
Source Map (JSON)
{"version":3,"sources":["../src/models/property-attributes-model.ts","../src/models/property-attributes-fields-list-model.ts","../src/utils/index.ts","../src/custom-mapper/index.ts"],"sourcesContent":["/* prettier-ignore */\n\nexport const PropertyAttributesModel = [\n // Comercial\n { key: \"operacao\", \t\t\t\t\t\t\t label: \"Operação\", type: \"String[]\", cat: \"comercial\", order: 1, },\n { key: \"etapa_lancamento\", label: \"Etapa do lançamento\", type: \"String[]\", cat: \"comercial\", order: 2, },\n { key: \"status_comercial\", label: \"Status comercial\", type: \"String[]\", cat: \"comercial\", order: 3, },\n { key: \"destaque\", label: \"Imóvel em destaque\", type: \"Boolean\", cat: \"comercial\", order: 4, },\n { key: \"exclusividade\", label: \"Exclusividade do imóvel\", type: \"Boolean\", cat: \"comercial\", order: 5, },\n { key: \"financiavel\", label: \"Financiável\", type: \"Boolean\", cat: \"comercial\", order: 6, },\n { key: \"seguro_fianca\", label: \"Seguro fiança\", type: \"Boolean\", cat: \"comercial\", order: 7, },\n { key: \"aceita_permuta\", label: \"Aceita permuta\", type: \"Boolean\", cat: \"comercial\", order: 8, },\n { key: \"aceita_parcelamento\", label: \"Aceita parcelamento\", type: \"Boolean\", cat: \"comercial\", order: 9, },\n\n // Valores\n { key: \"valor_condominio\", label: \"Valor do condomínio\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", order: 20, },\n { key: \"valor_total_venda\", label: \"Valor total de venda\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", composedLabel: \"{{valueLabel}}\", order: 21, },\n { key: \"valor_total_mensal\", label: \"Valor total de locação\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", composedLabel: \"{{valueLabel}} /mês\", order: 22, },\n { key: \"valor_venda\", label: \"Valor de venda\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", composedLabel: \"{{valueLabel}}\", order: 23, },\n { key: \"valor_locacao\", label: \"Valor de locação mensal\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", composedLabel: \"{{valueLabel}} /mês\", order: 24, },\n { key: \"valor_diaria\", label: \"Valor da diária\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", composedLabel: \"{{valueLabel}} /dia\", order: 25, },\n { key: \"valor_pacote_dias\", label: \"Valor do pacote de dias\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", order: 26, },\n { key: \"valor_iptu\", label: \"Valor do IPTU\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", order: 27, },\n { key: \"valor_fci\", label: \"Valor do Fundo de conservação\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", order: 28, },\n { key: \"valor_seguro_incendio\", label: \"Valor do seguro incêndio\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", order: 29, },\n { key: \"valor_m2\", label: \"Valor do m²\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", order: 30, },\n { key: \"valor_taxa_limpeza\", label: \"Valor da taxa de limpeza\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", order: 31, },\n { key: \"valor_taxa_esgoto\", label: \"Valor da taxa de esgoto\", type: \"Number\", role:\"currency\", unit: \"BRL\", cat: \"valores\", order: 32, },\n { key: \"moeda\", label: \"Unidade monetária\", type: \"String\", cat: \"valores\", order: 33, },\n\n // Situações\n { key: \"alugado\", label: \"Alugado\", type: \"Boolean\", cat: \"situacoes\", order: 40, },\n { key: \"vendido\", label: \"Vendido\", type: \"Boolean\", cat: \"situacoes\", order: 41, },\n { key: \"reservado\", label: \"Reservado\", type: \"Boolean\", cat: \"situacoes\", order: 42, },\n { key: \"situacao_ocupacao\", label: \"Situação de ocupação\", type: \"String\", cat: \"situacoes\", order: 43, },\n { key: \"financiado\", label: \"Financiado\", type: \"Boolean\", cat: \"situacoes\", order: 44, },\n\n // Legal / Documental\n { key: \"averbado\", label: \"Averbado\", type: \"Boolean\", cat: \"legal\", order: 60, },\n { key: \"escriturado\", label: \"Escriturado\", type: \"Boolean\", cat: \"legal\", order: 61, },\n { key: \"incorporado\", label: \"Incorporado\", type: \"Boolean\", cat: \"legal\", order: 62, },\n\n // Normas / Permissões / Exigências\n { key: \"numero_pessoas\", label: \"Número de pessoas\", type: \"Number\", role:\"count\", cat: \"normas\", order: 81, },\n { key: \"aceita_pet\", label: \"Aceita Pet\", type: \"Boolean\", cat: \"normas\", order: 82, },\n\n // Localização\n { key: \"endereco_pais\", label: \"País\", type: \"String\", cat: \"localizacao\", order: 101, },\n { key: \"endereco_cep\", label: \"CEP\", type: \"String\", cat: \"localizacao\", order: 102, },\n { key: \"endereco_estado\", label: \"Estado\", type: \"String\", cat: \"localizacao\", order: 103, },\n { key: \"endereco_cidade\", label: \"Cidade\", type: \"String\", cat: \"localizacao\", order: 104, },\n { key: \"endereco_bairro\", label: \"Bairro\", type: \"String\", cat: \"localizacao\", order: 105, },\n { key: \"endereco_logradouro\", label: \"Logradouro\", type: \"String\", cat: \"localizacao\", order: 106, },\n { key: \"endereco_numero\", label: \"Número do imóvel\", type: \"String\", cat: \"localizacao\", order: 107, },\n { key: \"endereco_complemento\", label: \"Complemento\", type: \"String\", cat: \"localizacao\", order: 108, },\n { key: \"endereco_referencia\", label: \"Referência (endereço)\", type: \"String\", cat: \"localizacao\", order: 109, },\n { key: \"latitude\", label: \"Latitude\", type: \"Number\", cat: \"localizacao\", order: 110, },\n { key: \"longitude\", label: \"Longitude\", type: \"Number\", cat: \"localizacao\", order: 111, },\n { key: \"geoposicionamento\", label: \"Geoposicionamento\", type: \"String\", cat: \"localizacao\", order: 112, },\n { key: \"endereco_completo\", label: \"Endereço completo\", type: \"String\", cat: \"localizacao\", order: 113, },\n { key: \"endereco_bairro_cidade_uf\", label: \"Bairro + Cidade + UF\", type: \"String\", cat: \"localizacao\", order: 114, },\n\n // Condomínio\n { key: \"condominio_nome\", label: \"Nome do condomínio\", type: \"String\", cat: \"condominio\", order: 120, },\n { key: \"condominio_tipo\", label: \"Tipo do condomínio\", type: \"String\", cat: \"condominio\", order: 121, },\n { key: \"condominio_fechado\", label: \"Condomínio fechado\", type: \"Boolean\", cat: \"condominio\", order: 122, },\n\n // Localidade\n { key: \"distancia_mar\", label: \"Distância do mar\", type: \"Number\", role:\"distance\", unit: \"m\", cat: \"localidade\", order: 141, },\n { key: \"imovel_no_litoral\", label: \"Imóvel no litoral\", type: \"Boolean\", cat: \"localidade\", order: 142, },\n { key: \"frente_mar\", label: \"Frente para o mar\", type: \"Boolean\", cat: \"localidade\", order: 144, },\n { key: \"vista_mar\", label: \"Vista para o mar\", type: \"Boolean\", cat: \"localidade\", order: 146, },\n\n // Estrutura do imóvel\n { key: \"tipo\", label: \"Tipo\", type: \"String\", cat: \"estrutura\", order: 160, },\n { key: \"subtipo\", label: \"Subtipo\", type: \"String\", cat: \"estrutura\", order: 161, },\n { key: \"area_privativa\", label: \"Área privativa\", type: \"Number\", role:\"area\", unit: \"m²\", cat: \"estrutura\", composedLabel: \"{{valueLabel}} priv.\", iconName: \"area\" , order: 163, },\n { key: \"area_total\", label: \"Área Total\", type: \"Number\", role:\"area\", unit: \"m²\", cat: \"estrutura\", composedLabel: \"{{valueLabel}} total\", iconName: \"area\" , order: 164, },\n { key: \"area_terreno\", label: \"Área do terreno\", type: \"Number\", role:\"area\", unit: \"m²\", cat: \"estrutura\", composedLabel: \"{{valueLabel}} terreno\", iconName: \"area\" , order: 165, },\n { key: \"padrao_imovel\", label: \"Padrão do imóvel\", type: \"String\", cat: \"estrutura\", order: 166, },\n { key: \"fase_obra\", label: \"Fase da obra\", type: \"String\", cat: \"estrutura\", order: 167, },\n { key: \"em_condominio\", label: \"Em condomínio\", type: \"Boolean\", cat: \"estrutura\", order: 168, },\n { key: \"finalidade\", label: \"Finalidade (propósito)\", type: \"String\", cat: \"estrutura\", order: 169, },\n { key: \"estado_conservacao\", label: \"Estado da conservação do imóvel\", type: \"String\", cat: \"estrutura\", order: 170, },\n { key: \"estado_imovel\", label: \"Status da obra + uso do imóvel\", type: \"String\", cat: \"estrutura\", order: 171, },\n { key: \"posicao_solar\", label: \"Posição solar\", type: \"String\", cat: \"estrutura\", order: 172, },\n { key: \"posicao_no_terreno\", label: \"Posição do imóvel no terreno\", type: \"String\", cat: \"estrutura\", order: 173, },\n { key: \"tipo_piso\", label: \"Tipo de piso\", type: \"String\", cat: \"estrutura\", order: 174, },\n { key: \"tipos_piso\", label: \"Tipos de piso\", type: \"String[]\", cat: \"estrutura\", order: 175, },\n { key: \"material_imovel\", label: \"Material do imóvel\", type: \"String\", cat: \"estrutura\", order: 176, },\n { key: \"materiais_imovel\", label: \"Materiais do imóvel\", type: \"String[]\", cat: \"estrutura\", order: 177, },\n { key: \"area_construida\", label: \"Área construída\", type: \"Number\", role:\"area\", unit: \"m²\", cat: \"estrutura\", order: 178, },\n { key: \"area_util\", label: \"Área útil\", type: \"Number\", role:\"area\", unit: \"m²\", cat: \"estrutura\", order: 179, },\n { key: \"data_entrega_obra\", label: \"Data de entrega da obra\", type: \"String\", role: \"date\", cat: \"estrutura\", order: 180, },\n { key: \"ano_construcao\", label: \"Ano da construção\", type: \"String\", role: \"year\", cat: \"estrutura\", order: 181, },\n { key: \"topografia_terreno\", label: \"Topografia do terreno\", type: \"String\", cat: \"estrutura\", order: 182, },\n { key: \"pintura\", label: \"Pintura\", type: \"String\", cat: \"estrutura\", order: 183, },\n { key: \"pinturas_revestimentos\", label: \"Pinturas e revestimentos\", type: \"String[]\", cat: \"estrutura\", order: 184, },\n { key: \"tipo_esquadria\", label: \"Tipo de esquadrias\", type: \"String\", cat: \"estrutura\", order: 185, },\n { key: \"tipos_esquadrias\", label: \"Tipos de esquadrias\", type: \"String[]\", cat: \"estrutura\", order: 186, },\n { key: \"tipo_forro\", label: \"Tipo do forro\", type: \"String\", cat: \"estrutura\", order: 187, },\n { key: \"tipos_forros\", label: \"Tipos de forros\", type: \"String[]\", cat: \"estrutura\", order: 188, },\n { key: \"tipos_coberturas\", label: \"Tipos de coberturas\", type: \"String[]\", cat: \"estrutura\", order: 189, },\n { key: \"terreno_comprimento\", label: \"Comprimento do terreno\", type: \"Number\", role:\"distance\", unit: \"m\", cat: \"estrutura\", order: 190, },\n { key: \"terreno_largura\", label: \"Largura do Terreno\", type: \"Number\", role:\"distance\", unit: \"m\", cat: \"estrutura\", order: 191, },\n { key: \"cores\", label: \"Cores do imóvel\", type: \"String[]\", cat: \"estrutura\", order: 192, },\n { key: \"andares\", label: \"Número de andares\", type: \"Number\", role:\"count\", cat: \"estrutura\", order: 193, },\n { key: \"medida_distancia\", label: \"Tipo de medida de distância\", type: \"String\", cat: \"estrutura\", order: 194, },\n { key: \"medida_area\", label: \"Tipo de medida de área\", type: \"String\", cat: \"estrutura\", order: 195, },\n\n // Corretor\n { key: \"corretor_id\", label: \"Corretor → ID\", type: \"String\", cat: \"corretor\", order: 210, },\n { key: \"corretor_nome\", label: \"Corretor → Nome\", type: \"String\", cat: \"corretor\", order: 211, },\n\n // Dependências\n { key: \"dormitorios\", label: \"Dormitórios\", type: \"Number\", role:\"count\", cat: \"dependencias\", composedLabel: \"{{valueLabel}} dormitório{{p:s}}\", iconName: \"bedroom\", order: 230, },\n { key: \"banheiros\", label: \"Banheiros\", type: \"Number\", role:\"count\", cat: \"dependencias\", composedLabel: \"{{valueLabel}} banheiro{{p:s}}\", iconName: \"bathroom\", order: 231, },\n { key: \"suites\", label: \"Suítes\", type: \"Number\", role:\"count\", cat: \"dependencias\", composedLabel: \"Sendo {{valueLabel}} suíte{{p:s}}\", iconName: \"suite\", order: 232, },\n { key: \"vagas_garagem\", label: \"Vagas na garagem\", type: \"Number\", role:\"count\", cat: \"dependencias\", composedLabel: \"{{valueLabel}} vaga{{p:s}}\", iconName: \"garage\", order: 233, },\n\n // Características em geral\n { key: \"mobiliado\", label: \"Mobiliado\", type: \"Boolean\", cat: \"caracteristicas\", order: 250, },\n // { key: \"caracteristicas\", label: \"Características (lista)\", type: \"String[]\", cat: \"caracteristicas\" order: 1, },\n];","export const unitListModel = {\n\tarea: [\n\t\t{\n\t\t\tkey: \"m²\",\n\t\t\taliases: [\"m2\"],\n\t\t\tlabel: \"m²\",\n\t\t\tlabelDisplay: \"Metros quadrados\",\n\t\t},\n\t\t{\n\t\t\tkey: \"ha\",\n\t\t\taliases: [\"hectare\", \"hectares\"],\n\t\t\tlabel: \"ha\",\n\t\t\tlabelDisplay: \"Hectares\",\n\t\t},\n\t\t{\n\t\t\tkey: \"km²\",\n\t\t\taliases: [\"km2\"],\n\t\t\tlabel: \"km²\",\n\t\t\tlabelDisplay: \"Quilômetros quadrados\",\n\t\t},\n\t],\n\n\tlength: [\n\t\t{\n\t\t\tkey: \"m\",\n\t\t\taliases: [\"metro\", \"meter\", \"meters\"],\n\t\t\tlabel: \"m\",\n\t\t\tlabelDisplay: \"Metros\",\n\t\t},\n\t\t{\n\t\t\tkey: \"km\",\n\t\t\taliases: [\"quilometro\", \"kilometer\", \"kilometers\"],\n\t\t\tlabel: \"km\",\n\t\t\tlabelDisplay: \"Quilômetros\",\n\t\t},\n\t],\n\n\tcurrency: [\n\t\t{\n\t\t\tkey: \"BRL\",\n\t\t\taliases: [],\n\t\t\tlabel: \"R$\",\n\t\t\tlabelDisplay: \"Real Brasileiro\",\n\t\t\tlocale: \"pt-BR\",\n\t\t},\n\t],\n};\n\n// {\n// \tkey: \"cm\",\n// \taliases: [\"centimetro\", \"centimeter\", \"centimeters\"],\n// \tlabel: \"cm\",\n// \tlabelDisplay: \"Centímetros\",\n// },\n// {\n// \tkey: \"mm\",\n// \taliases: [\"milimetro\", \"millimeter\", \"millimeters\"],\n// \tlabel: \"mm\",\n// \tlabelDisplay: \"Milímetros\",\n// },\n// {\n// \tkey: \"ft\",\n// \taliases: [\"foot\", \"feet\"],\n// \tlabel: \"ft\",\n// \tlabelDisplay: \"Pés\",\n// },\n// {\n// \tkey: \"in\",\n// \taliases: [\"inch\", \"inches\"],\n// \tlabel: \"in\",\n// \tlabelDisplay: \"Polegadas\",\n// },\n// {\n// \tkey: \"USD\",\n// \taliases: [\"$\", \"dolar\", \"dólar\", \"usd\"],\n// \tlabel: \"US$\",\n// \tlabelDisplay: \"Dólar Americano\",\n// \tlocale: \"en-US\",\n// },\n// {\n// \tkey: \"EUR\",\n// \taliases: [\"€\", \"euro\", \"eur\"],\n// \tlabel: \"€\",\n// \tlabelDisplay: \"Euro\",\n// \tlocale: \"de-DE\",\n// },\n// {\n// \tkey: \"GBP\",\n// \taliases: [\"£\", \"libra\", \"pound\", \"gbp\"],\n// \tlabel: \"£\",\n// \tlabelDisplay: \"Libra Esterlina\",\n// \tlocale: \"en-GB\",\n// },\n\nexport const formatListModel = {\n\t// Em desenvolvimento futuro\n\t// color: [\n\t// \t{\n\t// \t\tkey: \"rgb\",\n\t// \t\tlabel: \"RGB\",\n\t// \t},\n\t// \t{\n\t// \t\tkey: \"cmyk\",\n\t// \t\tlabel: \"CMYK\",\n\t// \t},\n\t// ],\n};","import { PropertyAttributesModel } from \"../models/property-attributes-model\";\nimport { mergeDeepLeft } from \"ramda\";\n\nexport function verifyAttrKeyInPropertyV3Model(key: string) {\n\treturn PropertyAttributesModel.find((attr) => attr.key == key);\n}\n\n// Mescla dados estendidos sobre o model de atributos padrão do Property V3\n\nexport function mergePropertyAttributesModel(base: any[], overrides: any[]) {\n\t// Indexa os atributos da base por key\n\tconst map = new Map(base.map((attr) => [attr.key, { ...attr }]));\n\n\tfor (const overrideAttr of overrides) {\n\t\tconst baseAttr = map.get(overrideAttr.key);\n\n\t\tif (baseAttr) {\n\t\t\t// Atualiza apenas os campos existentes no overrideAttr\n\t\t\tfor (const field in overrideAttr) {\n\t\t\t\t// Sobrescreve campo do base apenas se estiver presente no override\n\t\t\t\t(baseAttr as any)[field] = overrideAttr[field];\n\t\t\t}\n\t\t\tmap.set(overrideAttr.key, baseAttr);\n\t\t} else {\n\t\t\t// Novo atributo que não existe no base\n\t\t\tmap.set(overrideAttr.key, { ...overrideAttr });\n\t\t}\n\t}\n\n\treturn Array.from(map.values());\n}\n\nexport function sortAttributes(attributes: any[], sortKeys: string[] = []) {\n\treturn [...attributes].sort((a, b) => {\n\t\tfor (const rule of sortKeys) {\n\t\t\tconst [field, direction] = rule.split(\":\");\n\t\t\tconst valA = a[field];\n\t\t\tconst valB = b[field];\n\n\t\t\tif (valA === undefined || valB === undefined) continue;\n\n\t\t\tconst isAsc = direction === \"asc\";\n\t\t\tconst isDesc = direction === \"desc\";\n\n\t\t\tif (!isAsc && !isDesc) {\n\t\t\t\tconsole.warn(`Direção inválida: \"${direction}\". Use \"asc\" ou \"desc\".`);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (valA < valB) return isAsc ? -1 : 1;\n\t\t\tif (valA > valB) return isAsc ? 1 : -1;\n\t\t}\n\t\treturn 0;\n\t});\n}\n\nexport const preparaAttrValueLabel = function (valor: any) {\n\treturn Array.isArray(valor)\n\t\t? `${valor.slice(0, -1).join(\", \")} e ${valor[valor.length - 1]}`\n\t\t: valor;\n};","import { clone, union } from \"ramda\";\nimport { PropertyAttribute, PropertyObject, MapAction, AttributeRule, MapRules } from \"./types\";\n\nfunction upsertAttribute(attributes: PropertyAttribute[], attr: PropertyAttribute): void {\n\tconst index = attributes.findIndex((item) => item.key === attr.key);\n\tif (index !== -1) {\n\t\tattributes[index] = attr;\n\t} else {\n\t\tattributes.push(attr);\n\t}\n}\n\nfunction addTags(property: PropertyObject, list: string[]): void {\n\tconst current = property.tags ? property.tags.split(\" \") : [];\n\tproperty.tags = union(current, list).join(\" \");\n}\n\nfunction removeTags(property: PropertyObject, list: string[]): void {\n\tconst current = property.tags ? property.tags.split(\" \") : [];\n\tproperty.tags = current.filter((tag) => !list.includes(tag)).join(\" \");\n}\n\nfunction removeAttr(attributes: PropertyAttribute[], key: string): void {\n\tconst index = attributes.findIndex((item) => item.key === key);\n\tif (index !== -1) attributes.splice(index, 1);\n}\n\nconst actionRunner = {\n\tupsertAttr: (property: PropertyObject, action: MapAction): void => {\n\t\tconst { key, fn, ...rest } = action;\n\t\tupsertAttribute(property.attributes, {\n\t\t\tkey: key!,\n\t\t\t...rest,\n\t\t});\n\t},\n\tremoveAttr: (property: PropertyObject, action: MapAction): void => {\n\t\tremoveAttr(property.attributes, action.key!);\n\t},\n\taddTags: (property: PropertyObject, action: MapAction): void => {\n\t\taddTags(property, action.list!);\n\t},\n\tremoveTags: (property: PropertyObject, action: MapAction): void => {\n\t\tremoveTags(property, action.list!);\n\t},\n};\n\nfunction applyAttrRules(attr: PropertyAttribute, rules: Record<string, MapAction[]>, property: PropertyObject): PropertyObject {\n\tconst actions = rules?.[attr.value];\n\tif (!actions) return property;\n\n\tactions.forEach((action) => {\n\t\tconst fn = actionRunner[action.fn as keyof typeof actionRunner];\n\t\tif (fn) {\n\t\t\tconst resolvedAction = resolvePlaceholders(action, attr);\n\t\t\tfn(property, resolvedAction);\n\t\t}\n\t});\n\treturn property;\n}\n\nfunction applyTagRules(tags: string, rules: Record<string, MapAction[]>, property: PropertyObject): void {\n\tconst tagsArray = tags.split(\" \");\n\n\ttagsArray.forEach((tag) => {\n\t\tconst actions = rules?.[tag];\n\t\tif (!actions) return;\n\n\t\tactions.forEach((action) => {\n\t\t\tconst fn = actionRunner[action.fn as keyof typeof actionRunner];\n\t\t\tif (fn) fn(property, action);\n\t\t});\n\t});\n}\n\nfunction applyReferenceRules(reference: string, rules: Record<string, MapAction[]>, property: PropertyObject): void {\n\tconst actions = rules?.[reference];\n\tif (!actions) return;\n\n\tactions.forEach((action) => {\n\t\tconst fn = actionRunner[action.fn as keyof typeof actionRunner];\n\t\tif (fn) fn(property, action);\n\t});\n}\n\nfunction matchCondition(attrValue: any, condition: any): boolean {\n\tif (!condition) return true;\n\n\t// Sempre normalize attrValue como array (se for necessário para has/not_has)\n\tconst attrAsArray = Array.isArray(attrValue)\n\t\t? attrValue\n\t\t: typeof attrValue === \"string\"\n\t\t? [attrValue]\n\t\t: [];\n\n\tfor (const operator in condition) {\n\t\tconst expected = condition[operator];\n\n\t\tswitch (operator) {\n\t\t\tcase \"eq\":\n\t\t\t\tif (attrValue !== expected) return false;\n\t\t\t\tbreak;\n\t\t\tcase \"not_eq\":\n\t\t\t\tif (attrValue === expected) return false;\n\t\t\t\tbreak;\n\t\t\tcase \"has\": {\n\t\t\t\tconst attrAsArray = Array.isArray(attrValue) ? attrValue : [attrValue];\n\t\t\t\tconst expectedArray = Array.isArray(expected) ? expected : [expected];\n\t\t\t\tif (!expectedArray.every((val) => attrAsArray.includes(val)))\n\t\t\t\t\treturn false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"has_any\": {\n\t\t\t\tconst attrAsArray = Array.isArray(attrValue) ? attrValue : [attrValue];\n\t\t\t\tconst expectedArray = Array.isArray(expected) ? expected : [expected];\n\t\t\t\tif (!expectedArray.some((val) => attrAsArray.includes(val)))\n\t\t\t\t\treturn false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"not_has\":\n\t\t\t\tif (Array.isArray(expected)) {\n\t\t\t\t\tif (expected.some((val) => attrAsArray.includes(val))) return false;\n\t\t\t\t} else {\n\t\t\t\t\tif (attrAsArray.includes(expected)) return false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"gt\":\n\t\t\t\tif (!(attrValue > expected)) return false;\n\t\t\t\tbreak;\n\t\t\tcase \"gte\":\n\t\t\t\tif (!(attrValue >= expected)) return false;\n\t\t\t\tbreak;\n\t\t\tcase \"lt\":\n\t\t\t\tif (!(attrValue < expected)) return false;\n\t\t\t\tbreak;\n\t\t\tcase \"lte\":\n\t\t\t\tif (!(attrValue <= expected)) return false;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn false; // operador desconhecido\n\t\t}\n\t}\n\n\treturn true;\n}\n\nfunction resolvePlaceholders(action: MapAction, sourceAttr: PropertyAttribute): MapAction {\n\tconst resolved = { ...action };\n\n\tif (resolved.value === \"{{value}}\") {\n\t\tresolved.value = sourceAttr.value;\n\t} else if (\n\t\ttypeof resolved.value === \"string\" &&\n\t\tresolved.value.includes(\"{{value}}\")\n\t) {\n\t\tresolved.value = resolved.value.replace(\n\t\t\t\"{{value}}\",\n\t\t\tString(sourceAttr.value)\n\t\t);\n\t}\n\n\t// Você pode expandir para mais placeholders, como:\n\t// {{label}}, {{key}}, etc.\n\n\treturn resolved;\n}\n\nfunction applyAttributesRules(attributes: PropertyAttribute[], rules: AttributeRule[], property: PropertyObject): void {\n\tfor (const rule of rules) {\n\t\tconst attr = attributes.find((a) => a.key === rule.key);\n\t\tif (!attr) continue;\n\n\t\tif (matchCondition(attr.value, rule.condition)) {\n\t\t\tfor (const action of rule.rules) {\n\t\t\t\tconst fn = actionRunner[action.fn as keyof typeof actionRunner];\n\t\t\t\tif (fn) {\n\t\t\t\t\tconst resolvedAction = resolvePlaceholders(action, attr);\n\t\t\t\t\tfn(property, resolvedAction);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function propertyV3CustomMapper(property: PropertyObject, mapRules: MapRules): PropertyObject {\n\tconst newProperty = clone(property);\n\tconst { attributes, reference, tags } = newProperty;\n\n\tconst { attrTipoRules, referenceRules, tagsRules, attributesRules } = mapRules;\n\n\t// Aplica regras baseadas em atributos\n\tattrTipoRules &&\n\t\tattributes.forEach((attr) => {\n\t\t\tif (attr.key === \"tipo\") {\n\t\t\t\tapplyAttrRules(attr, attrTipoRules, newProperty);\n\t\t\t}\n\t\t});\n\n\t// Aplica regras baseadas em tags\n\ttagsRules && applyTagRules(tags, tagsRules, newProperty);\n\n\t// Aplica regras baseadas na referência\n\treferenceRules && applyReferenceRules(reference, referenceRules, newProperty);\n\n\t// Aplica regras baseadas em atributo avançado\n\tattributesRules &&\n\t\tapplyAttributesRules(attributes, attributesRules, newProperty);\n\n\treturn newProperty;\n}"],"mappings":";AAEO,IAAM,0BAA0B;AAAA;AAAA,EAErC,EAAE,KAAK,YA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