@aglyn/plugins-ai 1.15.2 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +17 -17
- package/src/lib/components/ai-site-import-plan.component.js +1 -1
- package/src/lib/components/ai-site-import-plan.component.js.map +1 -1
- package/src/lib/jobs/ai-job-import-step.js +6 -4
- package/src/lib/jobs/ai-job-import-step.js.map +1 -1
- package/src/lib/jobs/ai-job-page-language.d.ts +2 -0
- package/src/lib/jobs/ai-job-page-language.js +29 -14
- package/src/lib/jobs/ai-job-page-language.js.map +1 -1
- package/src/lib/jobs/ai-job-page-step.js +3 -1
- package/src/lib/jobs/ai-job-page-step.js.map +1 -1
- package/src/lib/jobs/ai-job-text-step.d.ts +1 -0
- package/src/lib/jobs/ai-job-text-step.js.map +1 -1
- package/src/lib/jobs/ai-site-import-compile.d.ts +9 -1
- package/src/lib/jobs/ai-site-import-compile.js +67 -1
- package/src/lib/jobs/ai-site-import-compile.js.map +1 -1
- package/src/lib/jobs/ai-site-import-honesty.d.ts +6 -2
- package/src/lib/jobs/ai-site-import-honesty.js +5 -5
- package/src/lib/jobs/ai-site-import-honesty.js.map +1 -1
- package/src/lib/jobs/ai-site-import-improve.d.ts +93 -4
- package/src/lib/jobs/ai-site-import-improve.js +465 -24
- package/src/lib/jobs/ai-site-import-improve.js.map +1 -1
- package/src/lib/jobs/ai-site-import-pictures.js +4 -2
- package/src/lib/jobs/ai-site-import-pictures.js.map +1 -1
- package/src/lib/jobs/ai-site-import-plan.d.ts +15 -1
- package/src/lib/jobs/ai-site-import-plan.js +27 -1
- package/src/lib/jobs/ai-site-import-plan.js.map +1 -1
- package/src/lib/layout-language/ai-layout-compiler.d.ts +6 -1
- package/src/lib/layout-language/ai-layout-compiler.js +20 -4
- package/src/lib/layout-language/ai-layout-compiler.js.map +1 -1
- package/src/lib/model/ai-site-import-fidelity.d.ts +18 -2
- package/src/lib/model/ai-site-import-fidelity.js +35 -11
- package/src/lib/model/ai-site-import-fidelity.js.map +1 -1
- package/src/lib/model/ai-site-import-ledger.js +10 -2
- package/src/lib/model/ai-site-import-ledger.js.map +1 -1
- package/src/lib/model/ai-site-import-marks.d.ts +30 -0
- package/src/lib/model/ai-site-import-marks.js +39 -0
- package/src/lib/model/ai-site-import-marks.js.map +1 -0
- package/src/lib/model/ai-site-import-view.js +6 -1
- package/src/lib/model/ai-site-import-view.js.map +1 -1
- package/src/lib/model/ai-site-import.d.ts +8 -1
- package/src/lib/model/ai-site-import.js +12 -4
- package/src/lib/model/ai-site-import.js.map +1 -1
- package/src/lib/runtime/ai-node-tree.js +8 -0
- package/src/lib/runtime/ai-node-tree.js.map +1 -1
- package/src/lib/runtime/ai-palette.generated.js +36 -5
- package/src/lib/runtime/ai-palette.generated.js.map +1 -1
|
@@ -42,7 +42,8 @@ import { aiLayoutDesignChoices, aiLayoutGroupVariant } from "../layout-language/
|
|
|
42
42
|
import { AI_LAYOUT_ALIGNS, AI_LAYOUT_BANDS, AI_LAYOUT_MAX_COLS, AI_LAYOUT_STYLES, aiReadLayoutBlock } from "../layout-language/ai-layout-language.js";
|
|
43
43
|
import { AI_ICON_WORDS } from "../runtime/ai-icon-library.js";
|
|
44
44
|
import { aiSiteHomeArc } from "../model/ai-site-home-arcs.js";
|
|
45
|
-
import { siteImportContentKept, siteImportContentWords } from "../model/ai-site-import-fidelity.js";
|
|
45
|
+
import { SITE_IMPORT_IMPROVED_MEANING, SITE_IMPORT_MEANING_FLOOR, siteImportContentKept, siteImportContentWords } from "../model/ai-site-import-fidelity.js";
|
|
46
|
+
import { aiSiteImportIsBrandMark } from "../model/ai-site-import-marks.js";
|
|
46
47
|
import { siteImportLedger } from "../model/ai-site-import-ledger.js";
|
|
47
48
|
import { AI_SITE_IMPORT_PAGE_CEILING_CREDITS } from "../model/ai-site-import.js";
|
|
48
49
|
import { estimateAiBilledUsd } from "../providers/catalog.js";
|
|
@@ -431,6 +432,20 @@ const short = (text, most = 80)=>text.length > most ? `${text.slice(0, most - 1)
|
|
|
431
432
|
for(let n = 1; n <= ((_input_sections = input.sections) != null ? _input_sections : 0); n += 1)out.set(`#${n}`, `#${n}`);
|
|
432
433
|
return out;
|
|
433
434
|
}
|
|
435
|
+
/**
|
|
436
|
+
* The page's own `page:<id>` on the new site (AGL-4152), by its address: a
|
|
437
|
+
* link to it from itself goes nowhere a visitor is not already. `null` where
|
|
438
|
+
* the import plans it under no id, as the home page.
|
|
439
|
+
*/ export function aiSiteImportOwnPage(doc) {
|
|
440
|
+
let path;
|
|
441
|
+
try {
|
|
442
|
+
path = new URL(doc.url).pathname.replace(/\/+$/, '') || '/';
|
|
443
|
+
} catch (unused) {
|
|
444
|
+
return null;
|
|
445
|
+
}
|
|
446
|
+
const own = doc.links.find((link)=>link.path === path);
|
|
447
|
+
return own ? `page:${own.id}` : null;
|
|
448
|
+
}
|
|
434
449
|
/** A redesign's user turn: the page, its kind of site, how its opening is drawn, and its ledger, fenced as the owner's data. */ export function aiSiteImportImprovePrompt(input) {
|
|
435
450
|
var _input_roleLines;
|
|
436
451
|
return [
|
|
@@ -465,6 +480,19 @@ const short = (text, most = 80)=>text.length > most ? `${text.slice(0, most - 1)
|
|
|
465
480
|
contact: 0,
|
|
466
481
|
faq: 0
|
|
467
482
|
};
|
|
483
|
+
/**
|
|
484
|
+
* The share of the old page's words a redesign keeps, by role (AGL-4152),
|
|
485
|
+
* where it is not `SITE_IMPORT_IMPROVED_MEANING`. A contact page is asked for
|
|
486
|
+
* a short, welcoming opening over its form: what it must keep is its form,
|
|
487
|
+
* its contact lines and its facts, each held whole on their own lines, and its
|
|
488
|
+
* intent, so its prose is held only at the floor a rewritten line is.
|
|
489
|
+
*/ export const AI_SITE_IMPORT_ROLE_MEANING = {
|
|
490
|
+
contact: SITE_IMPORT_MEANING_FLOOR
|
|
491
|
+
};
|
|
492
|
+
/** The share of its old words a page of a role keeps. */ export function aiSiteImportMeaningShare(role) {
|
|
493
|
+
var _AI_SITE_IMPORT_ROLE_MEANING_role;
|
|
494
|
+
return (_AI_SITE_IMPORT_ROLE_MEANING_role = AI_SITE_IMPORT_ROLE_MEANING[role]) != null ? _AI_SITE_IMPORT_ROLE_MEANING_role : SITE_IMPORT_IMPROVED_MEANING;
|
|
495
|
+
}
|
|
468
496
|
/** The fewest content words an old section says for a new one to be its rework (AGL-4152): fewer is a label, which any section may echo. */ export const AI_SITE_IMPORT_REWORK_LEAST_WORDS = 4;
|
|
469
497
|
/** The most sections a redesigned page runs to: a page the source already fills has no room for more. */ export const AI_SITE_IMPORT_IMPROVE_MOST_SECTIONS = 10;
|
|
470
498
|
/** What a page is for, as its plan says, else from its address and what it holds. */ export function aiSiteImportPageRoleOf(doc, slug) {
|
|
@@ -732,10 +760,18 @@ const WORD_KINDS = new Set([
|
|
|
732
760
|
'button'
|
|
733
761
|
]);
|
|
734
762
|
/** The longest quote a kept set of quotes sets side by side. */ const QUOTE_ACROSS_CHARS = 220;
|
|
735
|
-
/**
|
|
736
|
-
|
|
737
|
-
|
|
763
|
+
/**
|
|
764
|
+
* The height a source's picture is cropped to where a redesign places it on
|
|
765
|
+
* its own, in px (AGL-4152): wide across the page, closer in a column. A
|
|
766
|
+
* height, not a shape: the Image takes it as its own height field, so a page
|
|
767
|
+
* of pictures kept one by one repeats one style key on each (its rounding),
|
|
768
|
+
* never two, which rule 16 refuses as a repeated inline style. Pictures side
|
|
769
|
+
* by side in a row are cropped alike, whatever shapes they came in.
|
|
770
|
+
*/ export const AI_SITE_IMPORT_IMPROVE_FRAME_PX = {
|
|
771
|
+
wide: 420,
|
|
772
|
+
column: 300
|
|
738
773
|
};
|
|
774
|
+
/** The shape a picture on a card is cropped to (AGL-4152): every card of a row alike. */ const CARD_FRAME = '4 / 3';
|
|
739
775
|
/** The least share of a picture's own words a card says for the card to take that picture (AGL-4152). */ const CARD_PICTURE_KEPT = 0.5;
|
|
740
776
|
/**
|
|
741
777
|
* The source's own pictures each set of written cards takes (AGL-4152), by
|
|
@@ -801,8 +837,277 @@ const WORD_KINDS = new Set([
|
|
|
801
837
|
return name;
|
|
802
838
|
});
|
|
803
839
|
}
|
|
804
|
-
/**
|
|
840
|
+
/**
|
|
841
|
+
* The opening of a redesign without a brand's mark for its photo (AGL-4152):
|
|
842
|
+
* a picture the source names a logo, a badge or an icon (`aiSiteImportIsBrandMark`)
|
|
843
|
+
* that the answer keeps in its first section takes the page's widest photo no
|
|
844
|
+
* section placed instead, or, where it has none, is left out, and a row it
|
|
845
|
+
* leaves a column empty in is drawn as one column. A client's logo the source
|
|
846
|
+
* showed beside its words read, as a cover, as the page's own work.
|
|
847
|
+
*/ export function aiSiteImportOpeningPhoto(answer, input) {
|
|
848
|
+
const [first, ...rest] = answer;
|
|
849
|
+
if (!first) return [
|
|
850
|
+
...answer
|
|
851
|
+
];
|
|
852
|
+
const { doc, ledger } = input;
|
|
853
|
+
const items = new Map(ledger.items.map((item)=>[
|
|
854
|
+
item.ref,
|
|
855
|
+
item
|
|
856
|
+
]));
|
|
857
|
+
const imageOf = (ref)=>{
|
|
858
|
+
const item = items.get(ref);
|
|
859
|
+
const block = (item == null ? void 0 : item.kind) === 'picture' ? doc.blocks[item.lines[0]] : undefined;
|
|
860
|
+
return (block == null ? void 0 : block.kind) === 'image' ? block : null;
|
|
861
|
+
};
|
|
862
|
+
const markAt = (ref)=>{
|
|
863
|
+
const image = imageOf(ref);
|
|
864
|
+
return !!image && aiSiteImportIsBrandMark({
|
|
865
|
+
url: image.url,
|
|
866
|
+
alt: image.alt
|
|
867
|
+
});
|
|
868
|
+
};
|
|
869
|
+
const marks = new Set(first.blocks.filter((block)=>block.kind === 'keep' && markAt(block.ref)));
|
|
870
|
+
if (!marks.size) return [
|
|
871
|
+
...answer
|
|
872
|
+
];
|
|
873
|
+
const placed = new Set(aiSiteImportImprovedPlaced(answer, ledger));
|
|
874
|
+
const ratioOf = (ref)=>{
|
|
875
|
+
var _imageOf;
|
|
876
|
+
const url = (_imageOf = imageOf(ref)) == null ? void 0 : _imageOf.url;
|
|
877
|
+
const photo = url ? doc.photos.find((entry)=>entry.from === url) : undefined;
|
|
878
|
+
return (photo == null ? void 0 : photo.width) && photo.height ? photo.width / photo.height : 0;
|
|
879
|
+
};
|
|
880
|
+
const spare = ledger.items.filter((item)=>item.kind === 'picture' && !placed.has(item.ref) && !markAt(item.ref)).sort((a, b)=>ratioOf(b.ref) - ratioOf(a.ref));
|
|
881
|
+
let next = 0;
|
|
882
|
+
const blocks = first.blocks.flatMap((block)=>{
|
|
883
|
+
if (!marks.has(block) || block.kind !== 'keep') return [
|
|
884
|
+
block
|
|
885
|
+
];
|
|
886
|
+
const instead = spare[next++];
|
|
887
|
+
return instead ? [
|
|
888
|
+
_extends({}, block, {
|
|
889
|
+
ref: instead.ref
|
|
890
|
+
})
|
|
891
|
+
] : [];
|
|
892
|
+
});
|
|
893
|
+
// A row with a column left empty is no row.
|
|
894
|
+
const cols = first.cols;
|
|
895
|
+
const emptied = !!cols && cols.some((_, col)=>!blocks.some((block)=>block.col === col));
|
|
896
|
+
const opening = emptied ? _extends({}, first.band ? {
|
|
897
|
+
band: first.band
|
|
898
|
+
} : {}, first.align ? {
|
|
899
|
+
align: first.align
|
|
900
|
+
} : {}, {
|
|
901
|
+
blocks: blocks.map((_0)=>{
|
|
902
|
+
let { col: _col } = _0, block = _object_without_properties_loose(_0, [
|
|
903
|
+
"col"
|
|
904
|
+
]);
|
|
905
|
+
return block;
|
|
906
|
+
})
|
|
907
|
+
}) : _extends({}, first, {
|
|
908
|
+
blocks
|
|
909
|
+
});
|
|
910
|
+
return [
|
|
911
|
+
opening,
|
|
912
|
+
...rest
|
|
913
|
+
];
|
|
914
|
+
}
|
|
915
|
+
/** A button's words and where it goes, as one key: two that share it are the same action. */ const actionKey = (text, to)=>`${clean(text).toLowerCase()}\u0000${to != null ? to : ''}`;
|
|
916
|
+
/** Whether a button is drawn filled: the compiler's default, `primary` or `large`. */ const filled = (block)=>block.kind === 'button' && (block.style === undefined || block.style === 'primary' || block.style === 'large');
|
|
917
|
+
/**
|
|
918
|
+
* A redesigned section's calls to action, each once and each where it belongs
|
|
919
|
+
* (AGL-4152), whatever the answer and the source's kept groups gave:
|
|
920
|
+
*
|
|
921
|
+
* - Buttons placed in a row's columns under a group that runs the row's width,
|
|
922
|
+
* with nothing else in those columns, sit in the cards they go to where each
|
|
923
|
+
* goes where exactly one card does, else together under the group: a row of
|
|
924
|
+
* two buttons under three cards read as a grid half filled.
|
|
925
|
+
* - A link with the same words to the same place on every item of a group
|
|
926
|
+
* (each review's "See more reviews") is shown once, as a button after the
|
|
927
|
+
* group, unless the section already has that button. Where only some items
|
|
928
|
+
* carry it, each is that item's own action and stays.
|
|
929
|
+
* - The same button twice in a section is shown once, the first.
|
|
930
|
+
* - Two buttons side by side to the same place are one: the one with the
|
|
931
|
+
* header's words where one has them, else the first. Of buttons side by
|
|
932
|
+
* side, only the first is filled; the rest are outlined.
|
|
933
|
+
*/ export function aiSiteImportSectionActions(section, cta) {
|
|
934
|
+
let { cols, blocks } = section;
|
|
935
|
+
// Buttons in columns under a group across the row.
|
|
936
|
+
const placed = blocks.filter((block)=>block.col !== undefined);
|
|
937
|
+
const group = blocks.find((block)=>{
|
|
938
|
+
var _ref;
|
|
939
|
+
var _block_items;
|
|
940
|
+
return block.col === undefined && ((_ref = (_block_items = block.items) == null ? void 0 : _block_items.length) != null ? _ref : 0) >= 2 && block.kind !== 'list' && block.kind !== 'faq';
|
|
941
|
+
});
|
|
942
|
+
if (cols && cols.length >= 2 && group && placed.length && placed.every((block)=>block.kind === 'button')) {
|
|
943
|
+
const items = group.items;
|
|
944
|
+
const cards = placed.map((button)=>items.flatMap((item, at)=>{
|
|
945
|
+
var _item_links;
|
|
946
|
+
return button.to && item.to === button.to && !((_item_links = item.links) == null ? void 0 : _item_links.length) ? [
|
|
947
|
+
at
|
|
948
|
+
] : [];
|
|
949
|
+
}));
|
|
950
|
+
const own = cards.every((found)=>found.length === 1) && new Set(cards.map((found)=>found[0])).size === cards.length;
|
|
951
|
+
if (own) {
|
|
952
|
+
const into = new Map(placed.map((button, at)=>{
|
|
953
|
+
var _cards_at;
|
|
954
|
+
return [
|
|
955
|
+
(_cards_at = cards[at]) == null ? void 0 : _cards_at[0],
|
|
956
|
+
button
|
|
957
|
+
];
|
|
958
|
+
}));
|
|
959
|
+
const carded = _extends({}, group, {
|
|
960
|
+
items: items.map((item, at)=>{
|
|
961
|
+
var _ref;
|
|
962
|
+
var _into_get;
|
|
963
|
+
return into.has(at) ? _extends({}, item, {
|
|
964
|
+
links: [
|
|
965
|
+
{
|
|
966
|
+
text: (_ref = (_into_get = into.get(at)) == null ? void 0 : _into_get.text) != null ? _ref : '',
|
|
967
|
+
to: item.to,
|
|
968
|
+
style: 'secondary'
|
|
969
|
+
}
|
|
970
|
+
]
|
|
971
|
+
}) : item;
|
|
972
|
+
})
|
|
973
|
+
});
|
|
974
|
+
blocks = blocks.flatMap((block)=>block === group ? [
|
|
975
|
+
carded
|
|
976
|
+
] : placed.includes(block) ? [] : [
|
|
977
|
+
block
|
|
978
|
+
]);
|
|
979
|
+
} else blocks = blocks.map((block)=>placed.includes(block) ? ((_0)=>{
|
|
980
|
+
let { col: _col } = _0, rest = _object_without_properties_loose(_0, [
|
|
981
|
+
"col"
|
|
982
|
+
]);
|
|
983
|
+
return rest;
|
|
984
|
+
})(block) : block);
|
|
985
|
+
cols = undefined;
|
|
986
|
+
}
|
|
987
|
+
// A link repeated across a group's items, once after the group.
|
|
988
|
+
const buttons = new Set(blocks.flatMap((block)=>block.kind === 'button' ? [
|
|
989
|
+
actionKey(block.text, block.to)
|
|
990
|
+
] : []));
|
|
991
|
+
blocks = blocks.flatMap((block)=>{
|
|
992
|
+
const items = block.items;
|
|
993
|
+
if (!items || items.length < 2) return [
|
|
994
|
+
block
|
|
995
|
+
];
|
|
996
|
+
const counted = new Map();
|
|
997
|
+
for (const item of items){
|
|
998
|
+
var _item_links;
|
|
999
|
+
for (const key of new Set(((_item_links = item.links) != null ? _item_links : []).map((link)=>actionKey(link.text, link.to)))){
|
|
1000
|
+
var _ref;
|
|
1001
|
+
var _item_links1;
|
|
1002
|
+
const link = (_item_links1 = item.links) == null ? void 0 : _item_links1.find((entry)=>actionKey(entry.text, entry.to) === key);
|
|
1003
|
+
const was = counted.get(key);
|
|
1004
|
+
if (link) counted.set(key, _extends({
|
|
1005
|
+
text: link.text
|
|
1006
|
+
}, link.to ? {
|
|
1007
|
+
to: link.to
|
|
1008
|
+
} : {}, link.style ? {
|
|
1009
|
+
style: link.style
|
|
1010
|
+
} : {}, {
|
|
1011
|
+
on: ((_ref = was == null ? void 0 : was.on) != null ? _ref : 0) + 1
|
|
1012
|
+
}));
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
const repeated = new Map([
|
|
1016
|
+
...counted
|
|
1017
|
+
].filter(([, entry])=>entry.on === items.length));
|
|
1018
|
+
if (!repeated.size) return [
|
|
1019
|
+
block
|
|
1020
|
+
];
|
|
1021
|
+
const stripped = items.map((item)=>{
|
|
1022
|
+
var _item_links;
|
|
1023
|
+
if (!((_item_links = item.links) == null ? void 0 : _item_links.length)) return item;
|
|
1024
|
+
const links = item.links.filter((link)=>!repeated.has(actionKey(link.text, link.to)));
|
|
1025
|
+
const { links: _links } = item, rest = _object_without_properties_loose(item, [
|
|
1026
|
+
"links"
|
|
1027
|
+
]);
|
|
1028
|
+
return links.length ? _extends({}, rest, {
|
|
1029
|
+
links
|
|
1030
|
+
}) : rest;
|
|
1031
|
+
});
|
|
1032
|
+
const after = [
|
|
1033
|
+
...repeated
|
|
1034
|
+
].flatMap(([key, entry])=>{
|
|
1035
|
+
if (buttons.has(key)) return [];
|
|
1036
|
+
buttons.add(key);
|
|
1037
|
+
return [
|
|
1038
|
+
_extends({
|
|
1039
|
+
kind: 'button',
|
|
1040
|
+
text: entry.text
|
|
1041
|
+
}, entry.to ? {
|
|
1042
|
+
to: entry.to
|
|
1043
|
+
} : {}, entry.style ? {
|
|
1044
|
+
style: entry.style
|
|
1045
|
+
} : {}, block.col !== undefined ? {
|
|
1046
|
+
col: block.col
|
|
1047
|
+
} : {})
|
|
1048
|
+
];
|
|
1049
|
+
});
|
|
1050
|
+
return [
|
|
1051
|
+
_extends({}, block, {
|
|
1052
|
+
items: stripped
|
|
1053
|
+
}),
|
|
1054
|
+
...after
|
|
1055
|
+
];
|
|
1056
|
+
});
|
|
1057
|
+
// The same button twice, once.
|
|
1058
|
+
const seen = new Set();
|
|
1059
|
+
blocks = blocks.filter((block)=>{
|
|
1060
|
+
if (block.kind !== 'button' || !block.to) return true;
|
|
1061
|
+
const key = actionKey(block.text, block.to);
|
|
1062
|
+
if (seen.has(key)) return false;
|
|
1063
|
+
seen.add(key);
|
|
1064
|
+
return true;
|
|
1065
|
+
});
|
|
1066
|
+
// Buttons side by side: one to each place, the first filled.
|
|
1067
|
+
const wanted = clean(cta).toLowerCase();
|
|
1068
|
+
const out = [];
|
|
1069
|
+
for (const block of blocks){
|
|
1070
|
+
const before = out[out.length - 1];
|
|
1071
|
+
if (block.kind === 'button' && (before == null ? void 0 : before.kind) === 'button' && before.col === block.col) {
|
|
1072
|
+
var _out_, _out_1;
|
|
1073
|
+
// Back over the run this button stands in.
|
|
1074
|
+
let start = out.length - 1;
|
|
1075
|
+
while(start > 0 && ((_out_ = out[start - 1]) == null ? void 0 : _out_.kind) === 'button' && ((_out_1 = out[start - 1]) == null ? void 0 : _out_1.col) === block.col)start -= 1;
|
|
1076
|
+
const run = out.slice(start);
|
|
1077
|
+
const same = block.to ? run.findIndex((entry)=>entry.to === block.to) : -1;
|
|
1078
|
+
if (same !== -1) {
|
|
1079
|
+
// The header's words win the place; the run keeps its first button's place and fill.
|
|
1080
|
+
const kept = run[same];
|
|
1081
|
+
if (wanted && clean(block.text).toLowerCase() === wanted && clean(kept.text).toLowerCase() !== wanted) {
|
|
1082
|
+
const { style: _style } = block, words = _object_without_properties_loose(block, [
|
|
1083
|
+
"style"
|
|
1084
|
+
]);
|
|
1085
|
+
out[start + same] = _extends({}, words, kept.style ? {
|
|
1086
|
+
style: kept.style
|
|
1087
|
+
} : {});
|
|
1088
|
+
}
|
|
1089
|
+
continue;
|
|
1090
|
+
}
|
|
1091
|
+
out.push(run.some(filled) && filled(block) ? _extends({}, block, {
|
|
1092
|
+
style: 'secondary'
|
|
1093
|
+
}) : block);
|
|
1094
|
+
continue;
|
|
1095
|
+
}
|
|
1096
|
+
out.push(block);
|
|
1097
|
+
}
|
|
1098
|
+
return _extends({}, cols ? {
|
|
1099
|
+
cols
|
|
1100
|
+
} : {}, {
|
|
1101
|
+
blocks: out
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
/** The sections a redesign holds, in the compiler's language: every `keep` expanded to the source's own blocks, every link resolved. */ export function aiSiteImportImprovedPage(given, input) {
|
|
805
1105
|
const { doc, ledger, design, destinations } = input;
|
|
1106
|
+
// A brand's mark is never the opening's photo (AGL-4152).
|
|
1107
|
+
const answer = aiSiteImportOpeningPhoto(given, {
|
|
1108
|
+
doc,
|
|
1109
|
+
ledger
|
|
1110
|
+
});
|
|
806
1111
|
const scope = aiSiteImportMapScope(doc, {
|
|
807
1112
|
formId: input.formId,
|
|
808
1113
|
finish: 'improve'
|
|
@@ -815,10 +1120,16 @@ const WORD_KINDS = new Set([
|
|
|
815
1120
|
const written = [];
|
|
816
1121
|
// A brand band in a brand the theme had to deepen would read as neither: dark holds its place.
|
|
817
1122
|
const deepened = !!input.theme && !!input.theme.button.fill && input.theme.button.fill !== input.theme.light.brand;
|
|
818
|
-
|
|
1123
|
+
// A link to the page it is on, or to the section it sits in, goes nowhere (AGL-4152): to the page's form where it
|
|
1124
|
+
// keeps one, which is what a contact page's "Request a quote" means, else it is left out.
|
|
1125
|
+
const own = aiSiteImportOwnPage(doc);
|
|
1126
|
+
const resolve = (to, at)=>{
|
|
819
1127
|
var _destinations_get;
|
|
820
1128
|
if (!to) return undefined;
|
|
821
|
-
|
|
1129
|
+
const resolved = (_destinations_get = destinations.get(to)) != null ? _destinations_get : undefined;
|
|
1130
|
+
if (!resolved || resolved !== own && resolved !== `#${at + 1}`) return resolved;
|
|
1131
|
+
const form = destinations.get('form');
|
|
1132
|
+
return form && form !== `#${at + 1}` ? form : undefined;
|
|
822
1133
|
};
|
|
823
1134
|
const say = (text)=>{
|
|
824
1135
|
if (text == null ? void 0 : text.trim()) written.push(clean(text));
|
|
@@ -828,12 +1139,11 @@ const WORD_KINDS = new Set([
|
|
|
828
1139
|
if ((item == null ? void 0 : item.kind) !== 'picture') return null;
|
|
829
1140
|
const picture = aiSiteImportTakePicture(scope, item.lines[0]);
|
|
830
1141
|
return picture ? _extends({}, picture, {
|
|
831
|
-
fit: {
|
|
832
|
-
ratio: frame,
|
|
1142
|
+
fit: _extends({}, frame, {
|
|
833
1143
|
cropped: true,
|
|
834
1144
|
objectFit: 'cover',
|
|
835
1145
|
rounded: true
|
|
836
|
-
}
|
|
1146
|
+
})
|
|
837
1147
|
}) : null;
|
|
838
1148
|
};
|
|
839
1149
|
// A few short quotes kept whole sit side by side, as a designer sets them, wherever the old page stacked them; in a column, one under another.
|
|
@@ -852,7 +1162,9 @@ const WORD_KINDS = new Set([
|
|
|
852
1162
|
col
|
|
853
1163
|
} : {};
|
|
854
1164
|
if (item.kind === 'picture') {
|
|
855
|
-
const picture = pictureOf(ref,
|
|
1165
|
+
const picture = pictureOf(ref, {
|
|
1166
|
+
height: col !== undefined ? AI_SITE_IMPORT_IMPROVE_FRAME_PX.column : AI_SITE_IMPORT_IMPROVE_FRAME_PX.wide
|
|
1167
|
+
});
|
|
856
1168
|
return picture ? [
|
|
857
1169
|
_extends({
|
|
858
1170
|
kind: 'image',
|
|
@@ -874,7 +1186,7 @@ const WORD_KINDS = new Set([
|
|
|
874
1186
|
const carded = aiSiteImportCardPictures(answer, ledger);
|
|
875
1187
|
const sections = answer.map((section, index)=>{
|
|
876
1188
|
var _pictures__picture;
|
|
877
|
-
var _pictures_;
|
|
1189
|
+
var _input_plan_nav_primaryCta, _input_plan, _pictures_;
|
|
878
1190
|
scope.at = `sections[${index}]`;
|
|
879
1191
|
const words = section.blocks.flatMap((block)=>{
|
|
880
1192
|
var _block_text;
|
|
@@ -882,7 +1194,7 @@ const WORD_KINDS = new Set([
|
|
|
882
1194
|
(_block_text = block.text) != null ? _block_text : ''
|
|
883
1195
|
] : [];
|
|
884
1196
|
}).join(' ');
|
|
885
|
-
const
|
|
1197
|
+
const drawn = section.blocks.flatMap((raw)=>{
|
|
886
1198
|
var _block_items;
|
|
887
1199
|
if (raw.kind === 'keep') return keepOf(raw.ref, raw.col);
|
|
888
1200
|
const block = raw;
|
|
@@ -911,8 +1223,10 @@ const WORD_KINDS = new Set([
|
|
|
911
1223
|
];
|
|
912
1224
|
}
|
|
913
1225
|
if (block.kind === 'button') {
|
|
1226
|
+
const to = resolve(block.to, index);
|
|
1227
|
+
// A button that goes nowhere a visitor is not already is no call to action: it is left out.
|
|
1228
|
+
if (block.to && !to) return [];
|
|
914
1229
|
say(block.text);
|
|
915
|
-
const to = resolve(block.to);
|
|
916
1230
|
const { to: _asked } = block, rest = _object_without_properties_loose(block, [
|
|
917
1231
|
"to"
|
|
918
1232
|
]);
|
|
@@ -927,8 +1241,10 @@ const WORD_KINDS = new Set([
|
|
|
927
1241
|
say(item.title);
|
|
928
1242
|
say(item.text);
|
|
929
1243
|
const given = item.ref || ((_carded_get = carded.get(block)) == null ? void 0 : _carded_get[at]);
|
|
930
|
-
const picture = given ? pictureOf(given,
|
|
931
|
-
|
|
1244
|
+
const picture = given ? pictureOf(given, {
|
|
1245
|
+
ratio: CARD_FRAME
|
|
1246
|
+
}) : null;
|
|
1247
|
+
const to = resolve(item.to, index);
|
|
932
1248
|
const { ref: _ref, to: _to } = item, rest = _object_without_properties_loose(item, [
|
|
933
1249
|
"ref",
|
|
934
1250
|
"to"
|
|
@@ -965,6 +1281,12 @@ const WORD_KINDS = new Set([
|
|
|
965
1281
|
})
|
|
966
1282
|
];
|
|
967
1283
|
});
|
|
1284
|
+
// Each call to action once, in its place (AGL-4152).
|
|
1285
|
+
const tidy = aiSiteImportSectionActions({
|
|
1286
|
+
cols: section.cols,
|
|
1287
|
+
blocks: drawn
|
|
1288
|
+
}, (_input_plan = input.plan) == null ? void 0 : (_input_plan_nav_primaryCta = _input_plan.nav.primaryCta) == null ? void 0 : _input_plan_nav_primaryCta.label);
|
|
1289
|
+
const blocks = tidy.blocks;
|
|
968
1290
|
const pictures = blocks.filter((block)=>block.kind === 'image' || block.kind === 'video');
|
|
969
1291
|
const opens = index === 0 && pictures.length === 1 && blocks.every((block)=>block.kind === 'image' || block.kind === 'video' || WORD_KINDS.has(block.kind));
|
|
970
1292
|
const opening = ((_pictures_ = pictures[0]) == null ? void 0 : _pictures_.kind) === 'image' ? (_pictures__picture = pictures[0].picture) != null ? _pictures__picture : null : null;
|
|
@@ -974,8 +1296,8 @@ const WORD_KINDS = new Set([
|
|
|
974
1296
|
band
|
|
975
1297
|
} : {}, section.align ? {
|
|
976
1298
|
align: section.align
|
|
977
|
-
} : {},
|
|
978
|
-
cols:
|
|
1299
|
+
} : {}, tidy.cols && !hero ? {
|
|
1300
|
+
cols: tidy.cols
|
|
979
1301
|
} : {}, hero ? {
|
|
980
1302
|
hero,
|
|
981
1303
|
blocks: blocks.map((block)=>block.kind === 'image' && block.picture ? _extends({}, block, {
|
|
@@ -1129,25 +1451,140 @@ const plus = (a, b)=>({
|
|
|
1129
1451
|
'improve-columns',
|
|
1130
1452
|
'improve-framing'
|
|
1131
1453
|
]);
|
|
1454
|
+
/** The most reasons a page's record keeps of why its redesign missed (AGL-4152). */ export const AI_SITE_IMPORT_REDESIGN_WHY_MOST = 8;
|
|
1455
|
+
/** The most characters one reason keeps: the line it names and what it says of it. */ export const AI_SITE_IMPORT_REDESIGN_WHY_CHARS = 300;
|
|
1456
|
+
/**
|
|
1457
|
+
* Why a redesign missed, line by line (AGL-4152): each violation's code, its
|
|
1458
|
+
* message (which names the line it found, `section 1, block 2, "…"`) and its
|
|
1459
|
+
* detail, cut short, at most `AI_SITE_IMPORT_REDESIGN_WHY_MOST`. What the
|
|
1460
|
+
* page's log and its record say, so a miss can be read after the job, when
|
|
1461
|
+
* the answer itself is gone. For the job's record, never the owner's row.
|
|
1462
|
+
*/ export function aiSiteImportRedesignWhy(violations) {
|
|
1463
|
+
const out = [];
|
|
1464
|
+
for (const violation of violations){
|
|
1465
|
+
const said = clean(`${violation.code}: ${violation.message}${violation.detail ? ` ${violation.detail}` : ''}`);
|
|
1466
|
+
const line = said.length > AI_SITE_IMPORT_REDESIGN_WHY_CHARS ? `${said.slice(0, AI_SITE_IMPORT_REDESIGN_WHY_CHARS - 1)}…` : said;
|
|
1467
|
+
if (!out.includes(line)) out.push(line);
|
|
1468
|
+
if (out.length >= AI_SITE_IMPORT_REDESIGN_WHY_MOST) break;
|
|
1469
|
+
}
|
|
1470
|
+
return out;
|
|
1471
|
+
}
|
|
1132
1472
|
/** Whether every miss of an answer is one it may be taken with past its last re-ask. */ export function aiSiteImportImproveOnlySoft(violations) {
|
|
1133
1473
|
return violations.length > 0 && violations.every((violation)=>AI_SITE_IMPORT_IMPROVE_SOFT_CODES.has(violation.code));
|
|
1134
1474
|
}
|
|
1135
|
-
/**
|
|
1136
|
-
|
|
1475
|
+
/**
|
|
1476
|
+
* The words of a site's plan (AGL-4152): what it says the site is and who it
|
|
1477
|
+
* is for, its menu's and footer's labels, its call to action and its proposed
|
|
1478
|
+
* page. A redesign is told the plan as its digest, and the plan's own words
|
|
1479
|
+
* were held to what the site says when it was made, so a redesign that
|
|
1480
|
+
* repeats them invents nothing.
|
|
1481
|
+
*/ export function aiSiteImportPlanLines(plan) {
|
|
1482
|
+
if (!plan) return [];
|
|
1483
|
+
return [
|
|
1484
|
+
plan.site.what,
|
|
1485
|
+
plan.site.audience,
|
|
1486
|
+
...plan.nav.groups.map((group)=>group.label),
|
|
1487
|
+
...plan.nav.footer.map((group)=>group.label),
|
|
1488
|
+
...plan.nav.primaryCta ? [
|
|
1489
|
+
plan.nav.primaryCta.label
|
|
1490
|
+
] : [],
|
|
1491
|
+
...plan.proposed ? [
|
|
1492
|
+
plan.proposed.title,
|
|
1493
|
+
plan.proposed.purpose
|
|
1494
|
+
] : []
|
|
1495
|
+
].filter((line)=>typeof line === 'string' && !!line.trim());
|
|
1496
|
+
}
|
|
1497
|
+
/** A web address's top-level part, which says nothing of a name. */ const TLD = /\.(?:com|org|net|io|co|ai|app|dev|us|uk|ca|au|de|fr|info|biz|me|shop|store|site|online)(?:\.[a-z]{2})?$/i;
|
|
1498
|
+
/**
|
|
1499
|
+
* The ways a site's name is said (AGL-4152), where it is written as one run
|
|
1500
|
+
* of letters: a web address ("RidgelineBuilders.com") or a name run together.
|
|
1501
|
+
* Its address part dropped, its capitals and digits split ("Ridgeline
|
|
1502
|
+
* Builders"), a run of capitals on its own ("ABC" of "ABCroofing"), and a run
|
|
1503
|
+
* of small letters split into the words the site says elsewhere ("roofing
|
|
1504
|
+
* site" of "roofingsite"). A redesign that names the business as a visitor
|
|
1505
|
+
* would invents nothing.
|
|
1506
|
+
*/ export function aiSiteImportNameVariants(name, said) {
|
|
1507
|
+
const text = clean(name);
|
|
1508
|
+
if (!text || /\s/.test(text) || text.length < 4) return [];
|
|
1509
|
+
const bare = text.replace(/^https?:\/\//i, '').replace(/^www\./i, '').replace(/\/.*$/, '').replace(TLD, '');
|
|
1510
|
+
// A run of small letters as the words the site says, longest first; itself where they do not make it up.
|
|
1511
|
+
const segment = (run)=>{
|
|
1512
|
+
if (run.length < 6 || said.has(run.toLowerCase())) return [
|
|
1513
|
+
run
|
|
1514
|
+
];
|
|
1515
|
+
const out = [];
|
|
1516
|
+
let rest = run.toLowerCase();
|
|
1517
|
+
while(rest){
|
|
1518
|
+
let found = '';
|
|
1519
|
+
for(let end = rest.length; end >= 3 && !found; end -= 1)if (said.has(rest.slice(0, end))) found = rest.slice(0, end);
|
|
1520
|
+
if (!found) return [
|
|
1521
|
+
run
|
|
1522
|
+
];
|
|
1523
|
+
out.push(found);
|
|
1524
|
+
rest = rest.slice(found.length);
|
|
1525
|
+
}
|
|
1526
|
+
return out;
|
|
1527
|
+
};
|
|
1528
|
+
const words = bare.split(/[-_.]+|(?<=[a-z])(?=[A-Z])|(?<=[A-Za-z])(?=\d)|(?<=\d)(?=[A-Za-z])/).filter(Boolean).flatMap((part)=>{
|
|
1529
|
+
// A run of capitals before small letters: "ABCroofing" is "ABC" and "roofing", "ABCRoofing" "ABC" and "Roofing".
|
|
1530
|
+
const lead = /^([A-Z]{2,})([a-z]+)$/.exec(part);
|
|
1531
|
+
if (!lead) return segment(part);
|
|
1532
|
+
const caps = lead[1];
|
|
1533
|
+
const tail = `${caps.slice(-1)}${lead[2]}`;
|
|
1534
|
+
return said.has(tail.toLowerCase()) ? [
|
|
1535
|
+
caps.slice(0, -1),
|
|
1536
|
+
tail
|
|
1537
|
+
] : [
|
|
1538
|
+
caps,
|
|
1539
|
+
...segment(lead[2])
|
|
1540
|
+
];
|
|
1541
|
+
});
|
|
1542
|
+
const titled = words.map((word)=>{
|
|
1543
|
+
var _word_;
|
|
1544
|
+
return /^[a-z]/.test(word) ? `${(_word_ = word[0]) == null ? void 0 : _word_.toUpperCase()}${word.slice(1)}` : word;
|
|
1545
|
+
}).join(' ');
|
|
1546
|
+
return [
|
|
1547
|
+
...new Set([
|
|
1548
|
+
bare,
|
|
1549
|
+
titled
|
|
1550
|
+
])
|
|
1551
|
+
].filter((variant)=>variant && variant !== text);
|
|
1552
|
+
}
|
|
1553
|
+
/** Every line a redesign's facts may come from: its page, what the site says of itself, its wave's other pages, its plan, its name. */ export function aiSiteImportImproveScope(doc, siteName) {
|
|
1554
|
+
var _doc_siteLines, _doc_scope, _doc_siteLines1;
|
|
1137
1555
|
const own = doc.blocks.flatMap((block)=>block.kind === 'image' ? block.alt ? [
|
|
1138
1556
|
block.alt
|
|
1139
1557
|
] : [] : block.text ? [
|
|
1140
1558
|
block.text
|
|
1141
1559
|
] : []);
|
|
1142
|
-
|
|
1560
|
+
const lines = [
|
|
1143
1561
|
...own,
|
|
1144
1562
|
...(_doc_siteLines = doc.siteLines) != null ? _doc_siteLines : [],
|
|
1145
1563
|
...(_doc_scope = doc.scope) != null ? _doc_scope : [],
|
|
1564
|
+
...aiSiteImportPlanLines(doc.plan),
|
|
1146
1565
|
doc.title,
|
|
1147
1566
|
...siteName ? [
|
|
1148
1567
|
siteName
|
|
1149
1568
|
] : []
|
|
1150
1569
|
].map(clean).filter(Boolean);
|
|
1570
|
+
// The site's name as a visitor says it, where it is written as an address or run together (AGL-4152).
|
|
1571
|
+
const said = new Set(lines.flatMap((line)=>{
|
|
1572
|
+
var _line_toLowerCase_match;
|
|
1573
|
+
return (_line_toLowerCase_match = line.toLowerCase().match(RegExp("[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376-\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0560-\\u0588\\u05D0-\\u05EA\\u05EF-\\u05F2\\u0620-\\u064A\\u066E-\\u066F\\u0671-\\u06D3\\u06D5\\u06E5-\\u06E6\\u06EE-\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4-\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u0860-\\u086A\\u0870-\\u0887\\u0889-\\u088F\\u08A0-\\u08C9\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F-\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC-\\u09DD\\u09DF-\\u09E1\\u09F0-\\u09F1\\u09FC\\u0A05-\\u0A0A\\u0A0F-\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32-\\u0A33\\u0A35-\\u0A36\\u0A38-\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2-\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0-\\u0AE1\\u0AF9\\u0B05-\\u0B0C\\u0B0F-\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32-\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C-\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99-\\u0B9A\\u0B9C\\u0B9E-\\u0B9F\\u0BA3-\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58-\\u0C5A\\u0C5C-\\u0C5D\\u0C60-\\u0C61\\u0C80\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDC-\\u0CDE\\u0CE0-\\u0CE1\\u0CF1-\\u0CF2\\u0D04-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D54-\\u0D56\\u0D5F-\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32-\\u0E33\\u0E40-\\u0E46\\u0E81-\\u0E82\\u0E84\\u0E86-\\u0E8A\\u0E8C-\\u0EA3\\u0EA5\\u0EA7-\\u0EB0\\u0EB2-\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065-\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F5\\u13F8-\\u13FD\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16F1-\\u16F8\\u1700-\\u1711\\u171F-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1878\\u1880-\\u1884\\u1887-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19B0-\\u19C9\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4C\\u1B83-\\u1BA0\\u1BAE-\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1C80-\\u1C8A\\u1C90-\\u1CBA\\u1CBD-\\u1CBF\\u1CE9-\\u1CEC\\u1CEE-\\u1CF3\\u1CF5-\\u1CF6\\u1CFA\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2183-\\u2184\\u2C00-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2-\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3006\\u3031-\\u3035\\u303B-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312F\\u3131-\\u318E\\u31A0-\\u31BF\\u31F0-\\u31FF\\u3400-\\u4DBF\\u4E00-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A-\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6E5\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA7DC\\uA7F1-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA8FD-\\uA8FE\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5-\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB69\\uAB70-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40-\\uFB41\\uFB43-\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC\\u{10000}-\\u{1000B}\\u{1000D}-\\u{10026}\\u{10028}-\\u{1003A}\\u{1003C}-\\u{1003D}\\u{1003F}-\\u{1004D}\\u{10050}-\\u{1005D}\\u{10080}-\\u{100FA}\\u{10280}-\\u{1029C}\\u{102A0}-\\u{102D0}\\u{10300}-\\u{1031F}\\u{1032D}-\\u{10340}\\u{10342}-\\u{10349}\\u{10350}-\\u{10375}\\u{10380}-\\u{1039D}\\u{103A0}-\\u{103C3}\\u{103C8}-\\u{103CF}\\u{10400}-\\u{1049D}\\u{104B0}-\\u{104D3}\\u{104D8}-\\u{104FB}\\u{10500}-\\u{10527}\\u{10530}-\\u{10563}\\u{10570}-\\u{1057A}\\u{1057C}-\\u{1058A}\\u{1058C}-\\u{10592}\\u{10594}-\\u{10595}\\u{10597}-\\u{105A1}\\u{105A3}-\\u{105B1}\\u{105B3}-\\u{105B9}\\u{105BB}-\\u{105BC}\\u{105C0}-\\u{105F3}\\u{10600}-\\u{10736}\\u{10740}-\\u{10755}\\u{10760}-\\u{10767}\\u{10780}-\\u{10785}\\u{10787}-\\u{107B0}\\u{107B2}-\\u{107BA}\\u{10800}-\\u{10805}\\u{10808}\\u{1080A}-\\u{10835}\\u{10837}-\\u{10838}\\u{1083C}\\u{1083F}-\\u{10855}\\u{10860}-\\u{10876}\\u{10880}-\\u{1089E}\\u{108E0}-\\u{108F2}\\u{108F4}-\\u{108F5}\\u{10900}-\\u{10915}\\u{10920}-\\u{10939}\\u{10940}-\\u{10959}\\u{10980}-\\u{109B7}\\u{109BE}-\\u{109BF}\\u{10A00}\\u{10A10}-\\u{10A13}\\u{10A15}-\\u{10A17}\\u{10A19}-\\u{10A35}\\u{10A60}-\\u{10A7C}\\u{10A80}-\\u{10A9C}\\u{10AC0}-\\u{10AC7}\\u{10AC9}-\\u{10AE4}\\u{10B00}-\\u{10B35}\\u{10B40}-\\u{10B55}\\u{10B60}-\\u{10B72}\\u{10B80}-\\u{10B91}\\u{10C00}-\\u{10C48}\\u{10C80}-\\u{10CB2}\\u{10CC0}-\\u{10CF2}\\u{10D00}-\\u{10D23}\\u{10D4A}-\\u{10D65}\\u{10D6F}-\\u{10D85}\\u{10E80}-\\u{10EA9}\\u{10EB0}-\\u{10EB1}\\u{10EC2}-\\u{10EC7}\\u{10F00}-\\u{10F1C}\\u{10F27}\\u{10F30}-\\u{10F45}\\u{10F70}-\\u{10F81}\\u{10FB0}-\\u{10FC4}\\u{10FE0}-\\u{10FF6}\\u{11003}-\\u{11037}\\u{11071}-\\u{11072}\\u{11075}\\u{11083}-\\u{110AF}\\u{110D0}-\\u{110E8}\\u{11103}-\\u{11126}\\u{11144}\\u{11147}\\u{11150}-\\u{11172}\\u{11176}\\u{11183}-\\u{111B2}\\u{111C1}-\\u{111C4}\\u{111DA}\\u{111DC}\\u{11200}-\\u{11211}\\u{11213}-\\u{1122B}\\u{1123F}-\\u{11240}\\u{11280}-\\u{11286}\\u{11288}\\u{1128A}-\\u{1128D}\\u{1128F}-\\u{1129D}\\u{1129F}-\\u{112A8}\\u{112B0}-\\u{112DE}\\u{11305}-\\u{1130C}\\u{1130F}-\\u{11310}\\u{11313}-\\u{11328}\\u{1132A}-\\u{11330}\\u{11332}-\\u{11333}\\u{11335}-\\u{11339}\\u{1133D}\\u{11350}\\u{1135D}-\\u{11361}\\u{11380}-\\u{11389}\\u{1138B}\\u{1138E}\\u{11390}-\\u{113B5}\\u{113B7}\\u{113D1}\\u{113D3}\\u{11400}-\\u{11434}\\u{11447}-\\u{1144A}\\u{1145F}-\\u{11461}\\u{11480}-\\u{114AF}\\u{114C4}-\\u{114C5}\\u{114C7}\\u{11580}-\\u{115AE}\\u{115D8}-\\u{115DB}\\u{11600}-\\u{1162F}\\u{11644}\\u{11680}-\\u{116AA}\\u{116B8}\\u{11700}-\\u{1171A}\\u{11740}-\\u{11746}\\u{11800}-\\u{1182B}\\u{118A0}-\\u{118DF}\\u{118FF}-\\u{11906}\\u{11909}\\u{1190C}-\\u{11913}\\u{11915}-\\u{11916}\\u{11918}-\\u{1192F}\\u{1193F}\\u{11941}\\u{119A0}-\\u{119A7}\\u{119AA}-\\u{119D0}\\u{119E1}\\u{119E3}\\u{11A00}\\u{11A0B}-\\u{11A32}\\u{11A3A}\\u{11A50}\\u{11A5C}-\\u{11A89}\\u{11A9D}\\u{11AB0}-\\u{11AF8}\\u{11BC0}-\\u{11BE0}\\u{11C00}-\\u{11C08}\\u{11C0A}-\\u{11C2E}\\u{11C40}\\u{11C72}-\\u{11C8F}\\u{11D00}-\\u{11D06}\\u{11D08}-\\u{11D09}\\u{11D0B}-\\u{11D30}\\u{11D46}\\u{11D60}-\\u{11D65}\\u{11D67}-\\u{11D68}\\u{11D6A}-\\u{11D89}\\u{11D98}\\u{11DB0}-\\u{11DDB}\\u{11EE0}-\\u{11EF2}\\u{11F02}\\u{11F04}-\\u{11F10}\\u{11F12}-\\u{11F33}\\u{11FB0}\\u{12000}-\\u{12399}\\u{12480}-\\u{12543}\\u{12F90}-\\u{12FF0}\\u{13000}-\\u{1342F}\\u{13441}-\\u{13446}\\u{13460}-\\u{143FA}\\u{14400}-\\u{14646}\\u{16100}-\\u{1611D}\\u{16800}-\\u{16A38}\\u{16A40}-\\u{16A5E}\\u{16A70}-\\u{16ABE}\\u{16AD0}-\\u{16AED}\\u{16B00}-\\u{16B2F}\\u{16B40}-\\u{16B43}\\u{16B63}-\\u{16B77}\\u{16B7D}-\\u{16B8F}\\u{16D40}-\\u{16D6C}\\u{16E40}-\\u{16E7F}\\u{16EA0}-\\u{16EB8}\\u{16EBB}-\\u{16ED3}\\u{16F00}-\\u{16F4A}\\u{16F50}\\u{16F93}-\\u{16F9F}\\u{16FE0}-\\u{16FE1}\\u{16FE3}\\u{16FF2}-\\u{16FF3}\\u{17000}-\\u{18CD5}\\u{18CFF}-\\u{18D1E}\\u{18D80}-\\u{18DF2}\\u{1AFF0}-\\u{1AFF3}\\u{1AFF5}-\\u{1AFFB}\\u{1AFFD}-\\u{1AFFE}\\u{1B000}-\\u{1B122}\\u{1B132}\\u{1B150}-\\u{1B152}\\u{1B155}\\u{1B164}-\\u{1B167}\\u{1B170}-\\u{1B2FB}\\u{1BC00}-\\u{1BC6A}\\u{1BC70}-\\u{1BC7C}\\u{1BC80}-\\u{1BC88}\\u{1BC90}-\\u{1BC99}\\u{1D400}-\\u{1D454}\\u{1D456}-\\u{1D49C}\\u{1D49E}-\\u{1D49F}\\u{1D4A2}\\u{1D4A5}-\\u{1D4A6}\\u{1D4A9}-\\u{1D4AC}\\u{1D4AE}-\\u{1D4B9}\\u{1D4BB}\\u{1D4BD}-\\u{1D4C3}\\u{1D4C5}-\\u{1D505}\\u{1D507}-\\u{1D50A}\\u{1D50D}-\\u{1D514}\\u{1D516}-\\u{1D51C}\\u{1D51E}-\\u{1D539}\\u{1D53B}-\\u{1D53E}\\u{1D540}-\\u{1D544}\\u{1D546}\\u{1D54A}-\\u{1D550}\\u{1D552}-\\u{1D6A5}\\u{1D6A8}-\\u{1D6C0}\\u{1D6C2}-\\u{1D6DA}\\u{1D6DC}-\\u{1D6FA}\\u{1D6FC}-\\u{1D714}\\u{1D716}-\\u{1D734}\\u{1D736}-\\u{1D74E}\\u{1D750}-\\u{1D76E}\\u{1D770}-\\u{1D788}\\u{1D78A}-\\u{1D7A8}\\u{1D7AA}-\\u{1D7C2}\\u{1D7C4}-\\u{1D7CB}\\u{1DF00}-\\u{1DF1E}\\u{1DF25}-\\u{1DF2A}\\u{1E030}-\\u{1E06D}\\u{1E100}-\\u{1E12C}\\u{1E137}-\\u{1E13D}\\u{1E14E}\\u{1E290}-\\u{1E2AD}\\u{1E2C0}-\\u{1E2EB}\\u{1E4D0}-\\u{1E4EB}\\u{1E5D0}-\\u{1E5ED}\\u{1E5F0}\\u{1E6C0}-\\u{1E6DE}\\u{1E6E0}-\\u{1E6E2}\\u{1E6E4}-\\u{1E6E5}\\u{1E6E7}-\\u{1E6ED}\\u{1E6F0}-\\u{1E6F4}\\u{1E6FE}-\\u{1E6FF}\\u{1E7E0}-\\u{1E7E6}\\u{1E7E8}-\\u{1E7EB}\\u{1E7ED}-\\u{1E7EE}\\u{1E7F0}-\\u{1E7FE}\\u{1E800}-\\u{1E8C4}\\u{1E900}-\\u{1E943}\\u{1E94B}\\u{1EE00}-\\u{1EE03}\\u{1EE05}-\\u{1EE1F}\\u{1EE21}-\\u{1EE22}\\u{1EE24}\\u{1EE27}\\u{1EE29}-\\u{1EE32}\\u{1EE34}-\\u{1EE37}\\u{1EE39}\\u{1EE3B}\\u{1EE42}\\u{1EE47}\\u{1EE49}\\u{1EE4B}\\u{1EE4D}-\\u{1EE4F}\\u{1EE51}-\\u{1EE52}\\u{1EE54}\\u{1EE57}\\u{1EE59}\\u{1EE5B}\\u{1EE5D}\\u{1EE5F}\\u{1EE61}-\\u{1EE62}\\u{1EE64}\\u{1EE67}-\\u{1EE6A}\\u{1EE6C}-\\u{1EE72}\\u{1EE74}-\\u{1EE77}\\u{1EE79}-\\u{1EE7C}\\u{1EE7E}\\u{1EE80}-\\u{1EE89}\\u{1EE8B}-\\u{1EE9B}\\u{1EEA1}-\\u{1EEA3}\\u{1EEA5}-\\u{1EEA9}\\u{1EEAB}-\\u{1EEBB}\\u{20000}-\\u{2A6DF}\\u{2A700}-\\u{2B81D}\\u{2B820}-\\u{2CEAD}\\u{2CEB0}-\\u{2EBE0}\\u{2EBF0}-\\u{2EE5D}\\u{2F800}-\\u{2FA1D}\\u{30000}-\\u{3134A}\\u{31350}-\\u{33479}\\u0030-\\u0039\\u00B2-\\u00B3\\u00B9\\u00BC-\\u00BE\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u09F4-\\u09F9\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0B72-\\u0B77\\u0BE6-\\u0BF2\\u0C66-\\u0C6F\\u0C78-\\u0C7E\\u0CE6-\\u0CEF\\u0D58-\\u0D5E\\u0D66-\\u0D78\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F33\\u1040-\\u1049\\u1090-\\u1099\\u1369-\\u137C\\u16EE-\\u16F0\\u17E0-\\u17E9\\u17F0-\\u17F9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19DA\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\u2070\\u2074-\\u2079\\u2080-\\u2089\\u2150-\\u2182\\u2185-\\u2189\\u2460-\\u249B\\u24EA-\\u24FF\\u2776-\\u2793\\u2CFD\\u3007\\u3021-\\u3029\\u3038-\\u303A\\u3192-\\u3195\\u3220-\\u3229\\u3248-\\u324F\\u3251-\\u325F\\u3280-\\u3289\\u32B1-\\u32BF\\uA620-\\uA629\\uA6E6-\\uA6EF\\uA830-\\uA835\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19\\u{10107}-\\u{10133}\\u{10140}-\\u{10178}\\u{1018A}-\\u{1018B}\\u{102E1}-\\u{102FB}\\u{10320}-\\u{10323}\\u{10341}\\u{1034A}\\u{103D1}-\\u{103D5}\\u{104A0}-\\u{104A9}\\u{10858}-\\u{1085F}\\u{10879}-\\u{1087F}\\u{108A7}-\\u{108AF}\\u{108FB}-\\u{108FF}\\u{10916}-\\u{1091B}\\u{109BC}-\\u{109BD}\\u{109C0}-\\u{109CF}\\u{109D2}-\\u{109FF}\\u{10A40}-\\u{10A48}\\u{10A7D}-\\u{10A7E}\\u{10A9D}-\\u{10A9F}\\u{10AEB}-\\u{10AEF}\\u{10B58}-\\u{10B5F}\\u{10B78}-\\u{10B7F}\\u{10BA9}-\\u{10BAF}\\u{10CFA}-\\u{10CFF}\\u{10D30}-\\u{10D39}\\u{10D40}-\\u{10D49}\\u{10E60}-\\u{10E7E}\\u{10F1D}-\\u{10F26}\\u{10F51}-\\u{10F54}\\u{10FC5}-\\u{10FCB}\\u{11052}-\\u{1106F}\\u{110F0}-\\u{110F9}\\u{11136}-\\u{1113F}\\u{111D0}-\\u{111D9}\\u{111E1}-\\u{111F4}\\u{112F0}-\\u{112F9}\\u{11450}-\\u{11459}\\u{114D0}-\\u{114D9}\\u{11650}-\\u{11659}\\u{116C0}-\\u{116C9}\\u{116D0}-\\u{116E3}\\u{11730}-\\u{1173B}\\u{118E0}-\\u{118F2}\\u{11950}-\\u{11959}\\u{11BF0}-\\u{11BF9}\\u{11C50}-\\u{11C6C}\\u{11D50}-\\u{11D59}\\u{11DA0}-\\u{11DA9}\\u{11DE0}-\\u{11DE9}\\u{11F50}-\\u{11F59}\\u{11FC0}-\\u{11FD4}\\u{12400}-\\u{1246E}\\u{16130}-\\u{16139}\\u{16A60}-\\u{16A69}\\u{16AC0}-\\u{16AC9}\\u{16B50}-\\u{16B59}\\u{16B5B}-\\u{16B61}\\u{16D70}-\\u{16D79}\\u{16E80}-\\u{16E96}\\u{16FF4}-\\u{16FF6}\\u{1CCF0}-\\u{1CCF9}\\u{1D2C0}-\\u{1D2D3}\\u{1D2E0}-\\u{1D2F3}\\u{1D360}-\\u{1D378}\\u{1D7CE}-\\u{1D7FF}\\u{1E140}-\\u{1E149}\\u{1E2F0}-\\u{1E2F9}\\u{1E4F0}-\\u{1E4F9}\\u{1E5F1}-\\u{1E5FA}\\u{1E8C7}-\\u{1E8CF}\\u{1E950}-\\u{1E959}\\u{1EC71}-\\u{1ECAB}\\u{1ECAD}-\\u{1ECAF}\\u{1ECB1}-\\u{1ECB4}\\u{1ED01}-\\u{1ED2D}\\u{1ED2F}-\\u{1ED3D}\\u{1F100}-\\u{1F10C}\\u{1FBF0}-\\u{1FBF9}]+", "gu"))) != null ? _line_toLowerCase_match : [];
|
|
1574
|
+
}));
|
|
1575
|
+
const names = [
|
|
1576
|
+
...new Set([
|
|
1577
|
+
...siteName ? [
|
|
1578
|
+
siteName
|
|
1579
|
+
] : [],
|
|
1580
|
+
...((_doc_siteLines1 = doc.siteLines) != null ? _doc_siteLines1 : []).slice(0, 6)
|
|
1581
|
+
])
|
|
1582
|
+
];
|
|
1583
|
+
const variants = names.flatMap((name)=>aiSiteImportNameVariants(name, said)).filter((variant)=>!lines.includes(variant));
|
|
1584
|
+
return [
|
|
1585
|
+
...lines,
|
|
1586
|
+
...variants
|
|
1587
|
+
];
|
|
1151
1588
|
}
|
|
1152
1589
|
/** What each line that missed says to the one re-ask. */ const MISS = {
|
|
1153
1590
|
facts: 'The page leaves out a fact the owner gives. Say every name, number, price, date, phone and address the ledger shows.',
|
|
@@ -1199,7 +1636,7 @@ const plus = (a, b)=>({
|
|
|
1199
1636
|
* re-ask; a second miss is the caller's fallback.
|
|
1200
1637
|
*/ export function aiSiteImportImproveCheck(input) {
|
|
1201
1638
|
return (answer)=>{
|
|
1202
|
-
var _input_framing, _input_plan, _input_theme;
|
|
1639
|
+
var _input_framing, _input_vocabulary, _input_plan, _input_theme;
|
|
1203
1640
|
const read = aiReadImprovedPage(answer);
|
|
1204
1641
|
if (!read) return {
|
|
1205
1642
|
value: null,
|
|
@@ -1216,11 +1653,14 @@ const plus = (a, b)=>({
|
|
|
1216
1653
|
sections: read.length,
|
|
1217
1654
|
formSection: formAt === -1 ? null : formAt
|
|
1218
1655
|
});
|
|
1656
|
+
const own = aiSiteImportOwnPage(input.doc);
|
|
1219
1657
|
const honesty = aiSiteImportHonesty(read, {
|
|
1220
1658
|
ledger: input.ledger,
|
|
1221
1659
|
scope: input.scope,
|
|
1222
1660
|
destinations,
|
|
1223
|
-
framing: (_input_framing = input.framing) != null ? _input_framing : null
|
|
1661
|
+
framing: (_input_framing = input.framing) != null ? _input_framing : null,
|
|
1662
|
+
vocabulary: (_input_vocabulary = input.vocabulary) != null ? _input_vocabulary : [],
|
|
1663
|
+
own
|
|
1224
1664
|
});
|
|
1225
1665
|
// What it lost and how it is planned, named together, so the one re-ask mends both.
|
|
1226
1666
|
const planned = input.needs ? aiSiteImportImprovePlanMisses(read, {
|
|
@@ -1249,9 +1689,10 @@ const plus = (a, b)=>({
|
|
|
1249
1689
|
value: null,
|
|
1250
1690
|
violations: built.violations
|
|
1251
1691
|
};
|
|
1692
|
+
// A link the source makes to the page it is on asks nothing of the page (AGL-4152).
|
|
1252
1693
|
const wanted = input.ledger.links.flatMap((link)=>{
|
|
1253
1694
|
const to = destinations.get(link.ref);
|
|
1254
|
-
return to ? [
|
|
1695
|
+
return to && to !== own ? [
|
|
1255
1696
|
to
|
|
1256
1697
|
] : [];
|
|
1257
1698
|
});
|