PageSourceSearch

https://smart.giustizia.it/scripts/js_includes_now_canvas.jsx?v=09…t_Sep_19_08_15_40_PDT_2026&c=31_867&lang=it

js giustizia.it collected 2026-09-24 08:45:40 UTC 4,687 bytes, 167 lines download raw bytes

1/*! RESOURCE: /scripts/js_includes_now_canvas.js */
2(function () {
3	let librariesLoaded = false;
4	const librariesMap = {};
5	function shouldLaunchOnParentFrame(portalType) {
6		const isPortal = !!portalType;
7		return window.frameElement?.id === 'gsft_main' && !isPortal;
8	}
9	async function loadLibraries() {
10		if (!librariesLoaded) {
11			try {
12				await loadAiexAssets();
13				librariesLoaded = true;
14			} catch (err) {
15				console.error(err);
16			}
17		}
18	}
19	function makeDirectPagePayload(payload) {
20		payload = {...payload, remAdjustmentRequired: true};
21		if (window.GJSV) {
22			const launchMode = payload.launchMode || '';
23			const isPinned = launchMode.includes('docked');
24			payload = {
25				...payload,
26				launchMode: isPinned ? 'floating' : launchMode,
27				windowConfigOverrides: {canDock: false, closeToTop: false},
28			};
29		}
30		return payload;
31	}
32	window.aiex = {
33		...(window.aiex || {}),
34		async launch(payload = {}, host) {
35			if (shouldLaunchOnParentFrame(payload.portalType)) {
36				launchExperienceOnParentFrame(payload, window.frameElement);
37			} else {
38				await loadLibraries();
39				payload = makeDirectPagePayload(payload);
40				librariesMap.aiexLibrary?.launchExperience(payload, host);
41			}
42		},
43		async skillExecutionInCanvasRequested(payload = {}, host) {
44			if (shouldLaunchOnParentFrame(payload.portalType)) {
45				launchSkillExecutionOnParentFrame(payload, window.frameElement);
46			} else {
47				await loadLibraries();
48				payload = makeDirectPagePayload(payload);
49				librariesMap.aiexLibrary?.launchSkillExecution(payload, host);
50			}
51		},
52		async getPageContext() {
53			await loadLibraries();
54			return librariesMap.aiexLibrary?.getPageContext();
55		},
56		async publish(payload = {}) {
57			if (window.frameElement) {
58				try {
59					return window.top.aiex?.publish(payload);
60} catch (_) {
61					console.error('Failed to AIEX publish to parent frame');
62					return null;
63				}
64			} else {
65				await loadLibraries();
66				return librariesMap.aiexLibrary?.publish(payload);
67			}
68		},
69		async subscribe(payload = {}) {
70			if (window.frameElement) {
71				try {
72					return window.top.aiex?.subscribe(payload);
73} catch (_) {
74					console.error('Failed to AIEX subscribe to parent frame');
75					return null;
76				}
77			} else {
78				await loadLibraries();
79				return librariesMap.aiexLibrary?.subscribe(payload);
80			}
81		},
82		async getAllSubscribers(payload = {}) {
83			if (window.frameElement) {
84				try {
85					return window.top.aiex?.getAllSubscribers(payload);
86} catch (_) {
87					console.error('Failed to execute AIEX getAllSubscribers from parent frame');
88					return null;
89				}
90			} else {
91				await loadLibraries();
92				return librariesMap.aiexLibrary?.getAllSubscribers(payload);
93			}
94		},
95		async loadAIEngagementExperienceAsset() {
96			try {
97				window.uxf.getComponentsByTagNames(['sn-ai-engagement-experience']);
98			} catch (err) {
99				console.debug(
100`Failed to load @servicenow/sn-ai-engagement-experience with error: `,
101				);
102			}
103		},
104	};
105	function findNearestShadowRoot(element) {
106		while (element) {
107			if (element.shadowRoot) {
108				return element;
109			}
110			if (element instanceof ShadowRoot) {
111				return element.host;
112			}
113			element = element.parentNode || element.host;
114		}
115		return null;
116	}
117	async function loadAiexAssets() {
118		const libraryImports = [
119			{
120				path:
121'/uxasset/externals/@servicenow/ai-engagement-library/latest/index.jsdbx?sysparm_use_cache_buster=true&uxpcb=' +
122					window.aiex.cacheBuster,
123				key: 'aiexLibrary',
124			},
125			{
126				path:
127'/uxasset/externals/@devsnc/library-intent-channel/index.jsdbx?sysparm_use_cache_buster=true&uxpcb=' +
128					window.aiex.cacheBuster,
129				key: 'intentChannel',
130				windowKey: 'intentChannel',
131			},
132		];
133		const results = await Promise.allSettled(
134			libraryImports.map(({path, key, windowKey}) =>
135				import(path).then((library) => ({library, key, windowKey})),
136			),
137		);
138		results.forEach((result, i) => {
139			if (result.status === 'fulfilled') {
140				const {library, key, windowKey} = result.value;
141				librariesMap[key] = library;
142				if (windowKey) {
143					window[windowKey] = library;
144				}
145			} else {
146				const {path, windowKey} = libraryImports[i];
147				console.error(
148					`Failed to load [] from :`,
149					result.reason,
150				);
151			}
152		});
153		return librariesMap;
154	}
155	function launchExperienceOnParentFrame(payload, windObj) {
156		const nearestSeismicElement = findNearestShadowRoot(windObj);
157		nearestSeismicElement?.dispatch('AI_ENGAGEMENT_LAUNCH_EXPERIENCE', payload);
158	}
159	function launchSkillExecutionOnParentFrame(payload, windObj) {
160		const nearestSeismicElement = findNearestShadowRoot(windObj);
161		nearestSeismicElement?.dispatch(
162			'AI_ENGAGEMENT_SKILL_EXECUTION_REQUESTED',
163			payload,
164		);
165	}
166})();
167;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.