PageSourceSearch

https://invoicecraftly.com/_assets/js/app.87e595d0f2fd.js

js invoicecraftly.com collected 2026-10-02 01:32:40 UTC 17,048 bytes, 267 lines download raw bytes

1import './features/chrome-extension-handoff/preflight.2c1f47cf0d22.js';
2import './features/analytics/google-tag.8ed49c1fc649.js';
3import { createApp } from './app/main.0accad1b06f2.js';
4import { DEFAULT_APP_SETTINGS } from './features/invoice-schema/schema.0a478cdabba4.js';
5import { getStorageAdapter } from './features/invoice-storage/storage-adapter.09d906827518.js';
6import { ensureWorkspaceFoundation } from './features/workspace-domain/workspace-repository.d9b340a57667.js';
7import { rebuildDocumentProjection } from './features/workspace-domain/document-projection.b3643b37819c.js';
8import { installWorkspaceV1BackupUi } from './features/workspace-domain/workspace-backup-ui.ad0f79891915.js';
9import { installDocumentLanguagePresentation } from './features/localization/document-language-presentation.886636e1656d.js';
10import { matchEditorRouteCountry } from './features/localization/country-profiles.26c48477d6b6.js';
11import { registerEditorLocale, registerEditorMessageOverlay, setEditorMessageLocale } from './features/localization/editor-message-runtime.733edc866aeb.js';
12import { EDITOR_POSTAL_ADDRESS_MESSAGES as EDITOR_POSTAL_ADDRESS_MESSAGES_EN } from './features/localization/editor-postal-address-locales/en.e560085ee851.js';
13import { installEditorMarketSwitcher } from './features/localization/market-switcher.1621d66422af.js';
14import { installExportSharePrompt } from './features/product-sharing/export-share-prompt.55f9ce58cd44.js';
15import { installFirstPartyProductEvents } from './features/product-events/first-party-product-events.cdac7f34e736.js';
16import { installEditorMeasurement } from './features/product-events/editor-measurement.2f0dd2e71371.js';
17import { installLocalBusinessOverview } from './features/local-business-overview/local-business-overview.8d25641d93f7.js';
18import { installChromeExtensionHandoff } from './features/chrome-extension-handoff/editor-adapter.e6d3dd328d85.js';
19import { installCompanyRegistryEditorExtension } from './features/company-registry/editor-extension.38b4f6a677a3.js';
20import { installSepaPaymentEditorHandoff } from './features/qr/sepa-payment-editor-adapter.216cb3ce03cf.js';
21import { installWorkspaceSplitPanel } from './features/workspace-layout/workspace-split-panel.6edf1218f65c.js';
22import { installDocumentIdentityInlineRename } from './features/workspace-layout/document-identity-inline-rename.e0dc59bbf91b.js';
23
24registerEditorMessageOverlay('en', EDITOR_POSTAL_ADDRESS_MESSAGES_EN);
25
26const workspaceStorage = getStorageAdapter();
27// Deliberately not filtered by isCountryPublic(): the editor route for a
28// non-public market (Finland) must still resolve so its editor keeps working.
29const editorRouteCountry = matchEditorRouteCountry(window.location.pathname);
30const editorRouteMarketId = editorRouteCountry?.id ?? 'international';
31const isInternationalEditor = editorRouteCountry?.id === 'international';
32const isDanishEditor = editorRouteCountry?.id === 'denmark';
33const isNorwayEditor = editorRouteCountry?.id === 'norway';
34const isSwedenEditor = editorRouteCountry?.id === 'sweden';
35const isFinlandEditor = editorRouteCountry?.id === 'finland';
36
37async function initializeEditor() {
38  const requestedTemplate = new URLSearchParams(window.location.search).get('template');
39  const captureMode = requestedTemplate === 'social-video-demo';
40  if (!captureMode) {
41    const foundation = await ensureWorkspaceFoundation(workspaceStorage, DEFAULT_APP_SETTINGS);
42    await rebuildDocumentProjection(workspaceStorage);
43    if (isInternationalEditor) {
44      const { prepareInternationalEditorDocumentBoundary } = await import('./features/localization/international-route-document-boundary.ceeb45f6ed94.js');
45      await prepareInternationalEditorDocumentBoundary({ storage: workspaceStorage });
46    }
47    if (isDanishEditor) {
48      const { prepareDanishEditorDocumentBoundary } = await import('./features/localization/danish-route-document-boundary.5807d93491dc.js');
49      await prepareDanishEditorDocumentBoundary({ storage: workspaceStorage });
50    }
51    if (isNorwayEditor) {
52      const [{ prepareNorwayEditorDocumentBoundary }, { ensureNorwayNumberingContinuityGate }] = await Promise.all([
53        import('./features/localization/norway-route-document-boundary.750483dc8881.js'),
54        import('./features/localization/norway-numbering-continuity-gate.b10f29e62179.js')
55      ]);
56      await prepareNorwayEditorDocumentBoundary({ storage: workspaceStorage });
57      await ensureNorwayNumberingContinuityGate({ storage: workspaceStorage, foundation });
58    }
59    if (isSwedenEditor) {
60      const [{ prepareSwedenEditorDocumentBoundary }, { ensureSwedenNumberingContinuityGate }] = await Promise.all([
61        import('./features/localization/sweden-route-document-boundary.c71ef19aa988.js'),
62        import('./features/localization/sweden-numbering-continuity-gate.c349d6951356.js')
63      ]);
64      await prepareSwedenEditorDocumentBoundary({ storage: workspaceStorage });
65      await ensureSwedenNumberingContinuityGate({ storage: workspaceStorage, foundation });
66    }
67    if (isFinlandEditor) {
68      const { prepareFinlandEditorDocumentBoundary } = await import('./features/localization/finland-route-document-boundary.029527c3aa9c.js');
69      await prepareFinlandEditorDocumentBoundary({ storage: workspaceStorage });
70    }
71  }
72  return createApp({ marketId: editorRouteMarketId });
73}
74
75installWorkspaceSplitPanel();
76installDocumentIdentityInlineRename();
77installFirstPartyProductEvents();
78installWorkspaceV1BackupUi({ storage: workspaceStorage });
79installDocumentLanguagePresentation();
80// Slice B2: country foundation/presentation/native-polish modules are fetched
81// only for the matching route, via dynamic import — this is what keeps the
82// English /editor/ route's network fetch list free of Nordic/Finland code.
83// These MUST be top-level-awaited (not fire-and-forget): install*Presentation/
84// Foundation populate EDITOR_MESSAGES_*/native-polish/shell localization that
85// later render calls depend on for correct on-screen copy. (Market identity
86// itself is resolved independently and earlier — see editorRouteMarketId
87// above, passed straight into createApp({ marketId }) — so unlike copy
88// correctness, new-document currency/locale defaults no longer depend on
89// this await or on these installs succeeding at all; Slice 1 of the
90// editor-kernel post-#126 hardening skill closed that dependency.)
91//
92// Slice I: one data-driven table instead of four hand-copied `if` blocks (Slice H's manual per-block
93// try/catch is now this one shared mechanism). Flipping a country's `localeId` from `null` to a real
94// code is a one-line change once that locale's content lands as its own editor-locales/XX.js package
95// (Slice 2 of the editor-kernel post-#126 hardening skill split what used to be one shared
96// editor-messages.js registry into a per-locale package loaded via `localePackage`, below) — full
97// static-shell coverage comes for free at that point, zero new code for the shell layer, since
98// localizeEditorShell() (editor-static-shell.js) has no locale-specific logic of its own (see that
99// file's header comment). Slice J flipped Norway's `localeId` to `'nb'` this way (its own
100// MutationObserver stayed running as a safety net until Slice L removed it), Slice M did the same for
101// Sweden's `'sv'` (Slice O later removed sweden-editor-presentation.js's observer once Slice N closed
102// its content gap), and Slice P did the same for Finland's `'fi'` — the separate post-appReady block
103// below (finland-editor-safe-presentation.js, a bounded, deferred observer, not part of this table)
104// stays running as Finland's safety net until Slice R closes the gap and removes it. Every import()
105// call below (`localePackage` and `modules`) still has a literal string argument (not built from a
106// variable), so build-production.mjs's per-route fingerprinting/network-isolation is unaffected by
107// this being a table instead of four separate `if` bodies — same literals, same static analysis. It's
108// also what keeps the international /editor/ route's module graph from ever statically reaching a
109// Nordic/Finnish editor-locales/XX.js package (Slice 2's isolation guarantee) — those literal paths
110// exist only inside this table's per-country closures, which never execute on a non-matching route.
111const EDITOR_LOCALE_INSTALLERS = {
112  denmark: {
113    localeId: 'da',
114    localePackage: () => import('./features/localization/editor-locales/da.9c20acce67d7.js'),
115    postalAddressMessages: () => import('./features/localization/editor-postal-address-locales/da.ba35d108677e.js'),
116    modules: () => Promise.all([
117      import('./features/localization/danish-editor-presentation.bc96d313744f.js')
118    ]),
119    // Slice D: render-time Danish for main.js's t() calls. The still-running
120    // danish-editor-presentation.js observer (installed below) remains the sole translator for
121    // content neither catalogue covers (the two standalone import/records dialogs, and any key
122    // left out on purpose).
123    // Slice 7 of the editor-kernel post-#126 hardening skill: danish-editor-native-polish.js is gone —
124    // date lang, unit/tax placeholders, and currency display names all moved to render-time inputs
125    // (main.js's fieldHTML()/currency-combobox.js), so no separate polish module is installed here
126    // anymore.
127    install: ([{ installDanishEditorPresentation }]) => {
128      installDanishEditorPresentation();
129    }
130  },
131  norway: {
132    localeId: 'nb',
133    localePackage: () => import('./features/localization/editor-locales/nb.cc609739ee0e.js'),
134    postalAddressMessages: () => import('./features/localization/editor-postal-address-locales/nb.4cf039a6c6a9.js'),
135    modules: () => Promise.all([
136      import('./features/localization/norway-editor-foundation.bb659068d584.js'),
137      import('./features/localization/norway-editor-presentation.4b1b46e604ac.js')
138    ]),
139    // Slice J: render-time Norwegian for main.js's t() calls. The still-running
140    // norway-editor-presentation.js observer (installed below) remains the sole translator for
141    // content EDITOR_MESSAGES_NB doesn't cover yet (Slice K closes that gap; Slice L removes the
142    // observer).
143    // Slice 7: norway-editor-native-polish.js is gone — see Denmark's comment above for where its
144    // concerns moved to; its locale-selector-option patching moved to country-profiles.js's
145    // documentLocaleOptions/numberLocaleOptions (consumed by main.js), and its first-session-cue
146    // copy override is gone now that the kernel's own t()-driven copy (already correct) is no longer
147    // overwritten after the fact.
148    install: ([{ installNorwayEditorFoundation }, { installNorwayEditorPresentation }]) => {
149      installNorwayEditorFoundation();
150      installNorwayEditorPresentation();
151    }
152  },
153  sweden: {
154    localeId: 'sv',
155    localePackage: () => import('./features/localization/editor-locales/sv.38cb1c8f8ff5.js'),
156    postalAddressMessages: () => import('./features/localization/editor-postal-address-locales/sv.a42994a12543.js'),
157    modules: () => Promise.all([
158      import('./features/localization/sweden-editor-foundation.211ecf812cc6.js'),
159      import('./features/localization/sweden-editor-presentation.5a2c71089732.js')
160    ]),
161    // Slice M: render-time Swedish for main.js's t() calls. The still-running
162    // sweden-editor-presentation.js observer (installed below) remains the sole translator for
163    // content EDITOR_MESSAGES_SV doesn't cover yet (Slice N closes that gap; Slice O removes the
164    // observer).
165    // Slice 7: sweden-editor-native-polish.js is gone — its body class and boundary-note DOM injection
166    // both moved to declarative market data (country-profiles.js's bodyClassName/editorPaneNotice),
167    // applied by createApp()/renderEditor() (main.js) instead of a MutationObserver.
168    install: ([{ installSwedenEditorFoundation }, { installSwedenEditorPresentation }]) => {
169      installSwedenEditorFoundation();
170      installSwedenEditorPresentation();
171    }
172  },
173  finland: {
174    localeId: 'fi',
175    localePackage: () => import('./features/localization/editor-locales/fi.9b255faf6cd3.js'),
176    postalAddressMessages: () => import('./features/localization/editor-postal-address-locales/fi.697361c395fa.js'),
177    modules: () => Promise.all([
178      import('./features/localization/finland-editor-foundation.edc807494443.js')
179    ]),
180    // Slice P: render-time Finnish for main.js's t() calls. This table only powers
181    // setEditorMessageLocale()/localizeEditorShell() — the separate post-appReady block below (which
182    // installs finland-editor-safe-presentation.js, a bounded, deferred observer) is untouched by this
183    // flip and remains the sole translator for content EDITOR_MESSAGES_FI doesn't cover yet (Slice Q
184    // closes that gap; Slice R removes that observer). The older, unsafe finland-editor-presentation.js
185    // — whose TEXT/TYPE_COPY dictionaries and translateFinlandEditorText() the safe file imports and
186    // reuses — is untouched by this migration; its dead characterData observer wiring is a separate,
187    // larger "Finland rebuild" out of scope here.
188    // Slice 7: finland-editor-native-polish.js is gone — see Denmark's comment above for where its date
189    // lang/placeholder concerns moved to.
190    install: ([{ installFinlandEditorFoundation }]) => {
191      installFinlandEditorFoundation();
192    }
193  }
194};
195
196const editorLocaleInstaller = EDITOR_LOCALE_INSTALLERS[editorRouteCountry?.id];
197if (editorLocaleInstaller) {
198  try {
199    if (editorLocaleInstaller.localeId) {
200      const [{ localizeEditorShell }, { EDITOR_LOCALE_PACKAGE }, { EDITOR_POSTAL_ADDRESS_MESSAGES }] = await Promise.all([
201        import('./features/localization/editor-static-shell.7e3e60ba1895.js'),
202        editorLocaleInstaller.localePackage(),
203        editorLocaleInstaller.postalAddressMessages()
204      ]);
205      registerEditorLocale(EDITOR_LOCALE_PACKAGE);
206      registerEditorMessageOverlay(editorLocaleInstaller.localeId, EDITOR_POSTAL_ADDRESS_MESSAGES);
207      setEditorMessageLocale(editorLocaleInstaller.localeId);
208      localizeEditorShell();
209    }
210    editorLocaleInstaller.install(await editorLocaleInstaller.modules());
211  } catch (error) {
212    console.error(`Editor localization install failed for ${editorRouteCountry.id}:`, error);
213  }
214}
215// Finland remains an isolated, non-public foundation preview. Keep the public
216// market switcher off that route until Finland is promoted to an active market.
217if (!isFinlandEditor) installEditorMarketSwitcher();
218const appReady = initializeEditor();
219if (isDanishEditor) {
220  void import('./features/invoice-route-advisor/private-work/editor-extension.ad3eb292f085.js')
221    .then(({ installPrivateWorkEditorExtension }) => installPrivateWorkEditorExtension({ appReady }))
222    .catch((error) => {
223      console.warn('Private-work editor scenario skipped:', error);
224    });
225}
226// P0 stability boundary: Finland uses a bounded child-list observer. The older
227// presentation installer observes character-data mutations and must not be
228// installed from the editor shell.
229if (isFinlandEditor) {
230  void appReady.then(async () => {
231    const { installFinlandEditorSafePresentation } = await import('./features/localization/finland-editor-safe-presentation.ea42ddf796db.js');
232    installFinlandEditorSafePresentation();
233  });
234}
235if (new URLSearchParams(window.location.search).get('source') === 'e-invoice-xml') {
236  void import('./features/invoice-interoperability/editor-handoff.c1f4a42e55ee.js')
237    .then(({ installStructuredInvoiceImportHandoff }) => installStructuredInvoiceImportHandoff({ appReady }))
238    .catch((error) => {
239      console.warn('Structured invoice draft handoff skipped:', error);
240    });
241}
242installChromeExtensionHandoff({ appReady });
243const companyRegistryReady = installCompanyRegistryEditorExtension({ appReady });
244if (isNorwayEditor) {
245  void companyRegistryReady.then(async () => {
246    const { installRecipientCapabilityEditorExtension } = await import('./features/invoice-compliance/editor/recipient-capability-editor-extension.75f32ab3d261.js');
247    installRecipientCapabilityEditorExtension();
248  }).catch((error) => {
249    console.warn('Recipient capability editor extension skipped:', error);
250  });
251}
252void appReady.then(async () => {
253  const { installStructuredExportEditorExtension } = await import('./features/invoice-compliance/editor/structured-export-editor-extension.806a58d5744d.js');
254  installStructuredExportEditorExtension();
255}).catch((error) => {
256  console.warn('Structured export editor extension skipped:', error);
257});
258void appReady.then(async () => {
259  const { installEconomicExportEditorExtension } = await import('./features/structured-export/economic/economic-export-editor-extension.b0718a6d003b.js');
260  installEconomicExportEditorExtension();
261}).catch((error) => {
262  console.warn('e-conomic export editor extension skipped:', error);
263});
264installSepaPaymentEditorHandoff({ appReady });
265installEditorMeasurement({ appReady });
266installLocalBusinessOverview({ appReady });
267installExportSharePrompt();

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.