@pie-players/pie-assessment-toolkit 0.3.75 → 1.0.0-beta.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/README.md +449 -541
- package/custom-elements.json +1315 -0
- package/dist/attempt/TestSession.d.ts +0 -1
- package/dist/attempt/TestSession.js +10 -5
- package/dist/components/ItemScope.custom-element.js +1 -1
- package/dist/components/ItemToolBar.custom-element.js +1 -1
- package/dist/components/PieAssessmentToolkit.custom-element.js +8 -8
- package/dist/components/SectionToolBar.custom-element.js +1 -1
- package/dist/components/chunks/{ItemToolBar-7tt7v2xp.js → ItemToolBar-3zrc4p3d.js} +4 -4
- package/dist/components/chunks/{ItemToolBar-jx38w99s.js → ItemToolBar-66hcwmfw.js} +2 -2
- package/dist/components/chunks/ItemToolBar-9gqhfxtn.js +40 -0
- package/dist/components/chunks/ItemToolBar-hzc5wyjp.js +2 -0
- package/dist/components/chunks/{ItemToolBar-97hx60z4.js → ItemToolBar-kkj69ptr.js} +1 -1
- package/dist/components/chunks/sre-engine-bj997w4b.js +1 -0
- package/dist/context/assessment-toolkit-context.d.ts +6 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +4 -10
- package/dist/policy/core/PolicySource.d.ts +1 -1
- package/dist/policy/core/ToolPolicyEngine.d.ts +46 -7
- package/dist/policy/core/ToolPolicyEngine.js +73 -16
- package/dist/policy/core/compose-decision.d.ts +3 -3
- package/dist/policy/core/compose-decision.js +30 -30
- package/dist/policy/core/decision-types.d.ts +44 -32
- package/dist/policy/core/feature-decision.d.ts +17 -15
- package/dist/policy/core/feature-decision.js +11 -13
- package/dist/policy/core/pnp-policy-inputs.d.ts +5 -2
- package/dist/policy/core/pnp-policy-inputs.js +12 -32
- package/dist/policy/core/provenance.d.ts +1 -1
- package/dist/policy/core/tool-parameters.d.ts +11 -0
- package/dist/policy/core/tool-parameters.js +15 -0
- package/dist/policy/engine.d.ts +1 -1
- package/dist/policy/sources/PnpPolicySource.d.ts +14 -22
- package/dist/policy/sources/PnpPolicySource.js +30 -28
- package/dist/runtime/SectionControllerBinding.d.ts +6 -2
- package/dist/runtime/SectionControllerBinding.js +21 -15
- package/dist/runtime/adapter/subscriber-fanout.d.ts +0 -1
- package/dist/runtime/adapter/subscriber-fanout.js +1 -4
- package/dist/runtime/composition-emit-scheduler.d.ts +3 -3
- package/dist/runtime/composition-emit-scheduler.js +1 -1
- package/dist/runtime/content-region.d.ts +0 -4
- package/dist/runtime/content-region.js +2 -2
- package/dist/runtime/core/SectionEngineCore.d.ts +0 -2
- package/dist/runtime/core/SectionEngineCore.js +0 -4
- package/dist/runtime/core/cohort.d.ts +0 -5
- package/dist/runtime/core/cohort.js +0 -9
- package/dist/runtime/core/engine-output.d.ts +3 -2
- package/dist/runtime/core/engine-transition.js +3 -2
- package/dist/runtime/registration-events.d.ts +11 -14
- package/dist/runtime/runtime-id.d.ts +1 -1
- package/dist/runtime/runtime-id.js +1 -1
- package/dist/runtime/shell-scope.d.ts +4 -4
- package/dist/runtime/shell-scope.js +15 -9
- package/dist/runtime/tool-host-contract.d.ts +0 -4
- package/dist/runtime/tool-host-contract.js +1 -1
- package/dist/services/AccessibilityCatalogResolver.d.ts +21 -31
- package/dist/services/AccessibilityCatalogResolver.js +29 -42
- package/dist/services/ElementToolStateStore.d.ts +32 -61
- package/dist/services/ElementToolStateStore.js +37 -67
- package/dist/services/HighlightCoordinator.d.ts +9 -21
- package/dist/services/HighlightCoordinator.js +52 -80
- package/dist/services/RangeSerializer.d.ts +4 -35
- package/dist/services/RangeSerializer.js +4 -48
- package/dist/services/SSMLExtractor.d.ts +8 -31
- package/dist/services/SSMLExtractor.js +18 -40
- package/dist/services/TTSService.d.ts +49 -56
- package/dist/services/TTSService.js +308 -283
- package/dist/services/ToolCoordinator.d.ts +6 -49
- package/dist/services/ToolCoordinator.js +25 -61
- package/dist/services/ToolRegistry.d.ts +82 -80
- package/dist/services/ToolRegistry.js +91 -67
- package/dist/services/ToolkitCoordinator.d.ts +83 -81
- package/dist/services/ToolkitCoordinator.js +186 -174
- package/dist/services/framework-error.d.ts +30 -7
- package/dist/services/framework-error.js +10 -13
- package/dist/services/interfaces.d.ts +47 -71
- package/dist/services/section-controller-types.d.ts +7 -7
- package/dist/services/section-session-assignment.js +6 -8
- package/dist/services/spoken-audio-cards.d.ts +2 -4
- package/dist/services/spoken-audio-cards.js +2 -4
- package/dist/services/tool-config-validation.d.ts +5 -7
- package/dist/services/tool-config-validation.js +11 -26
- package/dist/services/tool-context.d.ts +7 -23
- package/dist/services/tool-context.js +99 -53
- package/dist/services/tool-failure.d.ts +30 -0
- package/dist/services/tool-failure.js +11 -0
- package/dist/services/tool-icons.d.ts +1 -2
- package/dist/services/tool-icons.js +2 -2
- package/dist/services/tool-instance-id.d.ts +8 -6
- package/dist/services/tool-instance-id.js +12 -18
- package/dist/services/tool-providers/TTSToolProvider.d.ts +6 -43
- package/dist/services/tool-providers/TTSToolProvider.js +7 -63
- package/dist/services/tool-providers/ToolProviderApi.d.ts +0 -7
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts +7 -42
- package/dist/services/tool-providers/ToolProviderRegistry.js +21 -63
- package/dist/services/tool-request.d.ts +4 -0
- package/dist/services/tool-request.js +7 -2
- package/dist/services/toolbar-decided-tools.d.ts +1 -0
- package/dist/services/toolbar-decided-tools.js +1 -0
- package/dist/services/toolbar-items.js +2 -5
- package/dist/services/tools-config-normalizer.d.ts +18 -9
- package/dist/services/tools-config-normalizer.js +25 -19
- package/dist/services/tts/browser-provider.d.ts +2 -5
- package/dist/services/tts/browser-provider.js +4 -20
- package/dist/services/tts/catalog-span-alignment.js +14 -7
- package/dist/services/tts/flat-tree.d.ts +0 -7
- package/dist/services/tts/flat-tree.js +2 -2
- package/dist/services/tts/generated-speech/dom/to-chunk-inputs.d.ts +2 -2
- package/dist/services/tts/generated-speech/index.d.ts +1 -1
- package/dist/services/tts/generated-speech/index.js +1 -1
- package/dist/services/tts/generated-speech/types.d.ts +1 -1
- package/dist/services/tts/generated-speech/types.js +1 -1
- package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +10 -12
- package/dist/services/tts/highlight-target-resolver.d.ts +12 -0
- package/dist/services/tts/math-aware-text-processing.js +10 -29
- package/dist/services/tts/math-speech.d.ts +1 -1
- package/dist/services/tts/math-speech.js +3 -0
- package/dist/services/tts/mathml-sanitization.d.ts +7 -0
- package/dist/services/tts/mathml-sanitization.js +9 -1
- package/dist/services/tts/provider-options.d.ts +12 -1
- package/dist/services/tts/ssml/spoken-text.js +1 -1
- package/dist/services/tts/start-failure.d.ts +0 -7
- package/dist/services/tts/start-failure.js +1 -1
- package/dist/services/tts/text-segmentation.d.ts +5 -0
- package/dist/services/tts/text-segmentation.js +13 -10
- package/dist/services/tts-runtime-config.d.ts +32 -12
- package/dist/services/tts-runtime-config.js +14 -20
- package/dist/tools/content-capability-resolution.d.ts +2 -2
- package/dist/tools/registration.d.ts +6 -5
- package/dist/tools/registration.js +10 -9
- package/dist/tools/registrations/toolbar-registration-helpers.d.ts +6 -0
- package/dist/tools/registrations/toolbar-registration-helpers.js +6 -0
- package/dist/tools/tool-surface-host.js +1 -8
- package/package.json +8 -6
- package/dist/components/chunks/ItemToolBar-bxwyhr5p.js +0 -2
- package/dist/components/chunks/ItemToolBar-rd2bb4p6.js +0 -40
- package/dist/components/chunks/sre-engine-jd8cc08x.js +0 -1
- package/dist/services/ContextVariableStore.d.ts +0 -113
- package/dist/services/ContextVariableStore.js +0 -206
- package/dist/services/tts-control-events.d.ts +0 -13
- package/dist/services/tts-control-events.js +0 -7
- package/dist/utils/logger.d.ts +0 -6
- package/dist/utils/logger.js +0 -10
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SpeedRateBucket } from "@pie-players/pie-tts";
|
|
2
2
|
import type { TextToSpeechToolProviderConfig, ToolProviderConfig } from "./tools-config-normalizer.js";
|
|
3
3
|
import { type SREMathSpeechOptions } from "./tts/math-speech.js";
|
|
4
|
+
import type { ToolkitTTSConfig } from "./tts/provider-options.js";
|
|
4
5
|
export type TTSLayoutMode = "reserved-row" | "expanding-row" | "floating-overlay" | "left-aligned";
|
|
5
6
|
export interface TTSHostToolbarLayout {
|
|
6
|
-
mount: "before-buttons";
|
|
7
7
|
controlsRow: {
|
|
8
8
|
reserveSpace: boolean;
|
|
9
9
|
expandWhenToolActive: boolean;
|
|
@@ -50,6 +50,11 @@ export interface TTSRuntimeSettings {
|
|
|
50
50
|
language?: string;
|
|
51
51
|
transportMode?: "pie" | "custom";
|
|
52
52
|
endpointMode?: "synthesizePath" | "rootPost";
|
|
53
|
+
/**
|
|
54
|
+
* The probe the server provider runs before it reports ready: `voices` reads
|
|
55
|
+
* the voices route, `endpoint` sends OPTIONS to the synthesis route, `none`
|
|
56
|
+
* probes nothing. Defaults to `voices` on a `server` backend.
|
|
57
|
+
*/
|
|
53
58
|
endpointValidationMode?: "voices" | "endpoint" | "none";
|
|
54
59
|
includeAuthOnAssetFetch?: boolean;
|
|
55
60
|
/** Origins trusted with the `Authorization` header on asset fetches. */
|
|
@@ -58,9 +63,13 @@ export interface TTSRuntimeSettings {
|
|
|
58
63
|
credentials?: "omit" | "same-origin" | "include";
|
|
59
64
|
/** Headers sent with every request to the TTS server. */
|
|
60
65
|
headers?: Record<string, string>;
|
|
61
|
-
|
|
66
|
+
/** Server-side caching, sent on the `custom` transport. */
|
|
62
67
|
cache?: boolean;
|
|
63
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Speed bucket sent on the `custom` transport; derived from `rate` when
|
|
70
|
+
* unset.
|
|
71
|
+
*/
|
|
72
|
+
speedRate?: SpeedRateBucket;
|
|
64
73
|
/**
|
|
65
74
|
* The custom transport's locale, sent on every read in place of the content
|
|
66
75
|
* language. Where markup and the tool name no language it is also the read's
|
|
@@ -100,10 +109,16 @@ export interface TTSRuntimeSettings {
|
|
|
100
109
|
/**
|
|
101
110
|
* Options passed through to the provider. The fields derived from the
|
|
102
111
|
* settings above, such as `locale` and the Polly engine, win over these.
|
|
112
|
+
* The `custom` transport reads the three typed keys; the settings of the
|
|
113
|
+
* same names win over them.
|
|
103
114
|
*/
|
|
104
|
-
providerOptions?:
|
|
115
|
+
providerOptions?: {
|
|
116
|
+
speedRate?: SpeedRateBucket;
|
|
117
|
+
lang_id?: string;
|
|
118
|
+
cache?: boolean;
|
|
119
|
+
[option: string]: unknown;
|
|
120
|
+
};
|
|
105
121
|
}
|
|
106
|
-
export declare const normalizeTTSLayoutMode: (value: unknown, fallback?: TTSLayoutMode) => TTSLayoutMode;
|
|
107
122
|
export declare const normalizeTTSSpeedControlOptions: (value: unknown) => NormalizedTTSSpeedOption[];
|
|
108
123
|
export declare const formatTTSSpeedOptionsAsText: (values: number[]) => string;
|
|
109
124
|
/**
|
|
@@ -114,18 +129,23 @@ export declare const formatTTSSpeedOptionsAsText: (values: number[]) => string;
|
|
|
114
129
|
export declare const parseTTSSpeedOptionsFromText: (text: string) => number[];
|
|
115
130
|
/**
|
|
116
131
|
* The runtime settings of a `textToSpeech` provider entry: its top-level keys
|
|
117
|
-
* with defaults applied
|
|
118
|
-
* the
|
|
132
|
+
* with defaults applied, an unknown `layoutMode` resolved to `left-aligned`.
|
|
133
|
+
* `enabled` and the runtime `provider` object belong to the tool registration
|
|
134
|
+
* and are dropped.
|
|
119
135
|
*/
|
|
120
|
-
export declare const resolveTTSRuntimeSettings: (config: TextToSpeechToolProviderConfig | ToolProviderConfig | TTSRuntimeSettings | undefined) => TTSRuntimeSettings
|
|
136
|
+
export declare const resolveTTSRuntimeSettings: (config: TextToSpeechToolProviderConfig | ToolProviderConfig | TTSRuntimeSettings | undefined) => TTSRuntimeSettings & {
|
|
137
|
+
layoutMode: TTSLayoutMode;
|
|
138
|
+
};
|
|
121
139
|
export declare const resolveTTSBackend: (config: TTSRuntimeSettings) => NonNullable<TTSRuntimeSettings["backend"]>;
|
|
122
140
|
/**
|
|
123
141
|
* The provider configuration built from host settings: the contract's portable
|
|
124
142
|
* fields plus the server adapter's, under the adapter's names.
|
|
125
143
|
*/
|
|
126
|
-
export type RuntimeTTSConfig = Pick<
|
|
144
|
+
export type RuntimeTTSConfig = Pick<ToolkitTTSConfig, "voice" | "rate" | "pitch" | "providerOptions" | "mathTokenHighlighting"> & Pick<TTSRuntimeSettings, "apiEndpoint" | "language" | "transportMode" | "endpointMode" | "endpointValidationMode" | "includeAuthOnAssetFetch" | "assetOrigins" | "credentials" | "headers"> & {
|
|
127
145
|
provider?: TTSRuntimeSettings["serverProvider"];
|
|
128
146
|
};
|
|
129
147
|
export declare const buildRuntimeTTSConfig: (config: TTSRuntimeSettings) => RuntimeTTSConfig;
|
|
130
|
-
|
|
131
|
-
export declare const resolveTTSHostToolbarLayout: (config:
|
|
148
|
+
/** The toolbar layout hints for the layout mode of resolved settings. */
|
|
149
|
+
export declare const resolveTTSHostToolbarLayout: (config: {
|
|
150
|
+
layoutMode: TTSLayoutMode;
|
|
151
|
+
}) => TTSHostToolbarLayout;
|
|
@@ -7,10 +7,14 @@ const VALID_TTS_LAYOUT_MODES = new Set([
|
|
|
7
7
|
]);
|
|
8
8
|
const toRecord = (value) => value && typeof value === "object" ? value : {};
|
|
9
9
|
const withDefault = (value, fallback) => value === undefined ? fallback : value;
|
|
10
|
-
|
|
10
|
+
/** A custom server provider speaks the custom transport, as `ServerTTSProvider` does on its own. */
|
|
11
|
+
const defaultTransportMode = (config) => resolveTTSBackend(config) === "server" && config.serverProvider === "custom"
|
|
12
|
+
? "custom"
|
|
13
|
+
: "pie";
|
|
14
|
+
const normalizeTTSLayoutMode = (value) => typeof value === "string" &&
|
|
11
15
|
VALID_TTS_LAYOUT_MODES.has(value)
|
|
12
16
|
? value
|
|
13
|
-
:
|
|
17
|
+
: "left-aligned";
|
|
14
18
|
const DEFAULT_TTS_SPEED_CONTROL_OPTIONS = Object.freeze([
|
|
15
19
|
{ rate: 0.8, label: "Slow", ariaLabel: "Slow speed" },
|
|
16
20
|
{ rate: 1, label: "Normal", ariaLabel: "Normal speed", default: true },
|
|
@@ -57,11 +61,7 @@ export const normalizeTTSSpeedControlOptions = (value) => {
|
|
|
57
61
|
if (rate === undefined || dedupedRates.has(rate))
|
|
58
62
|
continue;
|
|
59
63
|
dedupedRates.add(rate);
|
|
60
|
-
const defaultLabel = rate === 1
|
|
61
|
-
? "Normal"
|
|
62
|
-
: typeof entry === "number"
|
|
63
|
-
? formatSpeedLabel(rate)
|
|
64
|
-
: formatSpeedLabel(rate);
|
|
64
|
+
const defaultLabel = rate === 1 ? "Normal" : formatSpeedLabel(rate);
|
|
65
65
|
const label = typeof entry === "number"
|
|
66
66
|
? defaultLabel
|
|
67
67
|
: trimOptionalText(record.label) || defaultLabel;
|
|
@@ -148,9 +148,8 @@ const applyRuntimeDefaults = (config) => {
|
|
|
148
148
|
const withServerDefaults = {
|
|
149
149
|
...withLayoutDefaults,
|
|
150
150
|
apiEndpoint: withDefault(withLayoutDefaults.apiEndpoint, "/api/tts"),
|
|
151
|
-
transportMode: withDefault(withLayoutDefaults.transportMode,
|
|
151
|
+
transportMode: withDefault(withLayoutDefaults.transportMode, defaultTransportMode(config)),
|
|
152
152
|
endpointValidationMode: withDefault(withLayoutDefaults.endpointValidationMode, "voices"),
|
|
153
|
-
validateEndpoint: withDefault(withLayoutDefaults.validateEndpoint, true),
|
|
154
153
|
includeAuthOnAssetFetch: withDefault(withLayoutDefaults.includeAuthOnAssetFetch, false),
|
|
155
154
|
rate: withDefault(withLayoutDefaults.rate, 1.0),
|
|
156
155
|
language: withDefault(withLayoutDefaults.language, "en-US"),
|
|
@@ -167,8 +166,9 @@ const applyRuntimeDefaults = (config) => {
|
|
|
167
166
|
};
|
|
168
167
|
/**
|
|
169
168
|
* The runtime settings of a `textToSpeech` provider entry: its top-level keys
|
|
170
|
-
* with defaults applied
|
|
171
|
-
* the
|
|
169
|
+
* with defaults applied, an unknown `layoutMode` resolved to `left-aligned`.
|
|
170
|
+
* `enabled` and the runtime `provider` object belong to the tool registration
|
|
171
|
+
* and are dropped.
|
|
172
172
|
*/
|
|
173
173
|
export const resolveTTSRuntimeSettings = (config) => {
|
|
174
174
|
const { enabled: _enabled, provider: _provider, ...settings } = toRecord(config);
|
|
@@ -178,7 +178,7 @@ export const resolveTTSBackend = (config) => config.backend || "browser";
|
|
|
178
178
|
export const buildRuntimeTTSConfig = (config) => {
|
|
179
179
|
const runtimeProvider = resolveTTSBackend(config) === "server" ? config.serverProvider : undefined;
|
|
180
180
|
const polly = runtimeProvider === "polly";
|
|
181
|
-
const transportMode = config.transportMode || (
|
|
181
|
+
const transportMode = config.transportMode || defaultTransportMode(config);
|
|
182
182
|
const mathSpeech = normalizeSREMathSpeechOptions(config.mathSpeech);
|
|
183
183
|
const runtimeConfig = {
|
|
184
184
|
voice: config.defaultVoice,
|
|
@@ -224,7 +224,6 @@ export const buildRuntimeTTSConfig = (config) => {
|
|
|
224
224
|
assetOrigins: config.assetOrigins,
|
|
225
225
|
credentials: config.credentials,
|
|
226
226
|
headers: config.headers,
|
|
227
|
-
validateEndpoint: config.validateEndpoint,
|
|
228
227
|
// Toolkit-level highlight setting carried through the config channel
|
|
229
228
|
// (like apiEndpoint/transportMode); consumed by the highlight pipeline,
|
|
230
229
|
// ignored by providers. Only forwarded when set so the pipeline default
|
|
@@ -235,13 +234,11 @@ export const buildRuntimeTTSConfig = (config) => {
|
|
|
235
234
|
};
|
|
236
235
|
return runtimeConfig;
|
|
237
236
|
};
|
|
238
|
-
|
|
237
|
+
/** The toolbar layout hints for the layout mode of resolved settings. */
|
|
239
238
|
export const resolveTTSHostToolbarLayout = (config) => {
|
|
240
|
-
|
|
241
|
-
switch (layoutMode) {
|
|
239
|
+
switch (config.layoutMode) {
|
|
242
240
|
case "reserved-row":
|
|
243
241
|
return {
|
|
244
|
-
mount: "before-buttons",
|
|
245
242
|
controlsRow: {
|
|
246
243
|
reserveSpace: true,
|
|
247
244
|
expandWhenToolActive: false,
|
|
@@ -252,7 +249,6 @@ export const resolveTTSHostToolbarLayout = (config) => {
|
|
|
252
249
|
};
|
|
253
250
|
case "expanding-row":
|
|
254
251
|
return {
|
|
255
|
-
mount: "before-buttons",
|
|
256
252
|
controlsRow: {
|
|
257
253
|
reserveSpace: false,
|
|
258
254
|
expandWhenToolActive: true,
|
|
@@ -263,7 +259,6 @@ export const resolveTTSHostToolbarLayout = (config) => {
|
|
|
263
259
|
};
|
|
264
260
|
case "floating-overlay":
|
|
265
261
|
return {
|
|
266
|
-
mount: "before-buttons",
|
|
267
262
|
controlsRow: {
|
|
268
263
|
reserveSpace: false,
|
|
269
264
|
expandWhenToolActive: false,
|
|
@@ -275,7 +270,6 @@ export const resolveTTSHostToolbarLayout = (config) => {
|
|
|
275
270
|
case "left-aligned":
|
|
276
271
|
default:
|
|
277
272
|
return {
|
|
278
|
-
mount: "before-buttons",
|
|
279
273
|
controlsRow: {
|
|
280
274
|
reserveSpace: false,
|
|
281
275
|
expandWhenToolActive: false,
|
|
@@ -34,7 +34,7 @@ import type { CatalogOwnerSnapshot } from "../services/AccessibilityCatalogResol
|
|
|
34
34
|
export type ContentCapabilityPolicy = {
|
|
35
35
|
outcome: "granted";
|
|
36
36
|
/** Feature parameters carried by the decision, if any. */
|
|
37
|
-
parameters?: unknown
|
|
37
|
+
parameters?: Record<string, unknown>;
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* No source granted it and none denied it. A capability declaring
|
|
@@ -65,7 +65,7 @@ export interface ResolvedContentCapability {
|
|
|
65
65
|
* tell them apart at render time.
|
|
66
66
|
*/
|
|
67
67
|
granted: boolean;
|
|
68
|
-
parameters?: unknown
|
|
68
|
+
parameters?: Record<string, unknown>;
|
|
69
69
|
/** Whatever the capability's own `resolve` returned; never inspected here. */
|
|
70
70
|
content: unknown;
|
|
71
71
|
}
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
export type { HostedToolContext, HostedToolSize, ToolContentDependencyContext, ToolModuleLoader, ToolProviderDescriptor, ToolRegistration, ToolRenderElement, ToolSurfaceRenderContext, ToolSurfaceRenderResult, ToolSurfaceServices, ToolToolbarButtonDefinition, ToolToolbarRenderResult, ToolbarContext, } from "../services/ToolRegistry.js";
|
|
24
24
|
export { ToolRegistry } from "../services/ToolRegistry.js";
|
|
25
25
|
export { resolveToolRegistrationName } from "../services/ToolRegistry.js";
|
|
26
|
+
export type { ToolFailurePhase } from "../services/tool-failure.js";
|
|
27
|
+
export { reportToolFailure } from "../services/tool-failure.js";
|
|
26
28
|
export type { CatalogOwnerSnapshot } from "../services/AccessibilityCatalogResolver.js";
|
|
27
29
|
export type { ToolSelectionAction, ToolSelectionContext, } from "../services/selection-action.js";
|
|
28
30
|
export { resolveFallbackToolIcon } from "../services/tool-icons.js";
|
|
@@ -31,12 +33,12 @@ export { resolveContentCapabilities } from "./content-capability-resolution.js";
|
|
|
31
33
|
export type { ToolSurfaceHost, ToolSurfaceHostInput, ToolSurfaceHostOptions, ToolSurfaceHostSnapshot, ToolSurfaceScope, } from "./tool-surface-host.js";
|
|
32
34
|
export { createToolSurfaceHost } from "./tool-surface-host.js";
|
|
33
35
|
export type { ToolContext } from "../services/tool-context.js";
|
|
34
|
-
export { hasChoiceInteraction, hasMathContent, hasReadableText, hasScienceContent, } from "../services/tool-context.js";
|
|
36
|
+
export { hasChoiceInteraction, hasMathContent, hasReadableText, hasSpokenContent, hasScienceContent, } from "../services/tool-context.js";
|
|
35
37
|
export type { ParsedToolInstanceId } from "../services/tool-instance-id.js";
|
|
36
38
|
export { createScopedToolId, parseScopedToolId, } from "../services/tool-instance-id.js";
|
|
37
39
|
export type { ToolComponentFactory, ToolComponentFactoryMap, ToolComponentOverrides, ToolTagMap, } from "./tool-tag-map.js";
|
|
38
40
|
export { createToolElement, resolveToolTag } from "./tool-tag-map.js";
|
|
39
|
-
export { applyOverlaySurface, createScopedVisibilityBinding, syncButtonAndOverlayVisibility, } from "./registrations/toolbar-registration-helpers.js";
|
|
41
|
+
export { applyOverlaySurface, createScopedVisibilityBinding, syncButtonAndOverlayVisibility, TOOL_ACTIVE_CHANGE_EVENT, } from "./registrations/toolbar-registration-helpers.js";
|
|
40
42
|
export type { HighlightCoordinatorApi, ToolCoordinatorApi, ToolkitCoordinatorApi, TtsServiceApi, } from "../services/interfaces.js";
|
|
41
43
|
export type { AssessmentToolkitRegionScopeContext, AssessmentToolkitRuntimeContext, AssessmentToolkitShellContext, } from "../context/assessment-toolkit-context.js";
|
|
42
44
|
export { connectToolRegionScopeContext, connectToolRuntimeContext, connectToolShellContext, createToolCoordinatorRegistration, type ToolCoordinatorRegistration, } from "../runtime/tool-host-contract.js";
|
|
@@ -48,11 +50,10 @@ export { findShellScopeHost, resolveContentRegion, } from "../runtime/content-re
|
|
|
48
50
|
export { composedClosest, composedContains, flatTextContent, isShadowRootNode, retargetToTree, } from "../services/tts/flat-tree.js";
|
|
49
51
|
export type { ToolPlacementLevel } from "../services/tools-config-normalizer.js";
|
|
50
52
|
export type { CalculatorToolProviderConfig, TextToSpeechToolProviderConfig, ToolProviderConfig, } from "../services/tools-config-normalizer.js";
|
|
51
|
-
export type { ToolProviderApi
|
|
53
|
+
export type { ToolProviderApi } from "../services/tool-providers/ToolProviderApi.js";
|
|
52
54
|
export { TTSToolProvider } from "../services/tool-providers/index.js";
|
|
53
55
|
export type { NormalizedTTSSpeedOption, TTSLayoutMode, TTSSpeedOption, } from "../services/tts-runtime-config.js";
|
|
54
|
-
export { buildRuntimeTTSConfig, formatTTSSpeedOptionsAsText,
|
|
55
|
-
export { PIE_TTS_CONTROL_HANDOFF_EVENT } from "../services/tts-control-events.js";
|
|
56
|
+
export { buildRuntimeTTSConfig, formatTTSSpeedOptionsAsText, normalizeTTSSpeedControlOptions, parseTTSSpeedOptionsFromText, resolveTTSHostToolbarLayout, resolveTTSRuntimeSettings, } from "../services/tts-runtime-config.js";
|
|
56
57
|
export { bindTtsAudioHandoff, pauseTtsForMediaAudio, } from "../services/audio-handoff.js";
|
|
57
58
|
export { isTTSStartFailure } from "../services/tts/start-failure.js";
|
|
58
59
|
export { browserVoiceMatchesLanguage, findBrowserVoice, waitForBrowserVoices, } from "../services/tts/browser-provider.js";
|
|
@@ -25,15 +25,17 @@ export { ToolRegistry } from "../services/ToolRegistry.js";
|
|
|
25
25
|
// title is the registration's name, so the shell needs the same `nameKey`-then-
|
|
26
26
|
// `name` precedence the toolbar uses rather than the raw English field.
|
|
27
27
|
export { resolveToolRegistrationName } from "../services/ToolRegistry.js";
|
|
28
|
+
export { reportToolFailure } from "../services/tool-failure.js";
|
|
28
29
|
// So a gateway button and the toolbar button for the same tool draw one icon.
|
|
29
30
|
export { resolveFallbackToolIcon } from "../services/tool-icons.js";
|
|
30
31
|
export { resolveContentCapabilities } from "./content-capability-resolution.js";
|
|
31
32
|
export { createToolSurfaceHost } from "./tool-surface-host.js";
|
|
32
|
-
export { hasChoiceInteraction, hasMathContent, hasReadableText, hasScienceContent, } from "../services/tool-context.js";
|
|
33
|
+
export { hasChoiceInteraction, hasMathContent, hasReadableText, hasSpokenContent, hasScienceContent, } from "../services/tool-context.js";
|
|
33
34
|
export { createScopedToolId, parseScopedToolId, } from "../services/tool-instance-id.js";
|
|
34
35
|
export { createToolElement, resolveToolTag } from "./tool-tag-map.js";
|
|
35
|
-
// Toolbar button/overlay wiring shared by every toolbar-toggle registration
|
|
36
|
-
|
|
36
|
+
// Toolbar button/overlay wiring shared by every toolbar-toggle registration,
|
|
37
|
+
// and the event a tool element announces its own active state with.
|
|
38
|
+
export { applyOverlaySurface, createScopedVisibilityBinding, syncButtonAndOverlayVisibility, TOOL_ACTIVE_CHANGE_EVENT, } from "./registrations/toolbar-registration-helpers.js";
|
|
37
39
|
export { connectToolRegionScopeContext, connectToolRuntimeContext, connectToolShellContext, createToolCoordinatorRegistration, } from "../runtime/tool-host-contract.js";
|
|
38
40
|
export { ZIndexLayer } from "../services/ToolCoordinator.js";
|
|
39
41
|
export { HighlightColor, HighlightCoordinator, } from "../services/HighlightCoordinator.js";
|
|
@@ -43,12 +45,11 @@ export { composedClosest, composedContains, flatTextContent, isShadowRootNode, r
|
|
|
43
45
|
// The TTS provider stays here because it is written against the `pie-tts`
|
|
44
46
|
// contract package, which the toolkit's own `TTSService` also depends on.
|
|
45
47
|
export { TTSToolProvider } from "../services/tool-providers/index.js";
|
|
46
|
-
export { buildRuntimeTTSConfig, formatTTSSpeedOptionsAsText,
|
|
47
|
-
// Read-aloud coordination for a tool that plays or controls speech:
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
export { PIE_TTS_CONTROL_HANDOFF_EVENT } from "../services/tts-control-events.js";
|
|
48
|
+
export { buildRuntimeTTSConfig, formatTTSSpeedOptionsAsText, normalizeTTSSpeedControlOptions, parseTTSSpeedOptionsFromText, resolveTTSHostToolbarLayout, resolveTTSRuntimeSettings, } from "../services/tts-runtime-config.js";
|
|
49
|
+
// Read-aloud coordination for a tool that plays or controls speech: pausing
|
|
50
|
+
// speech while a media element plays, recognising a start failure the TTS
|
|
51
|
+
// service reports, and choosing a browser voice for a language once the browser
|
|
52
|
+
// has published its voices.
|
|
52
53
|
export { bindTtsAudioHandoff, pauseTtsForMediaAudio, } from "../services/audio-handoff.js";
|
|
53
54
|
export { isTTSStartFailure } from "../services/tts/start-failure.js";
|
|
54
55
|
export { browserVoiceMatchesLanguage, findBrowserVoice, waitForBrowserVoices, } from "../services/tts/browser-provider.js";
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { ToolToolbarButtonDefinition, ToolToolbarRenderResult, ToolbarContext } from "../../services/ToolRegistry.js";
|
|
2
2
|
export type ToolOverlaySurface = "default" | "frameless";
|
|
3
|
+
/**
|
|
4
|
+
* The event a tool element dispatches, bubbling and composed, with
|
|
5
|
+
* `{ active: boolean }` as its detail when it opens or closes its own panel.
|
|
6
|
+
* A registration relays it as the toolbar button's active state.
|
|
7
|
+
*/
|
|
8
|
+
export declare const TOOL_ACTIVE_CHANGE_EVENT = "pie-tool-active-change";
|
|
3
9
|
export declare function createScopedVisibilityBinding(toolId: string, toolbarContext: ToolbarContext): {
|
|
4
10
|
fullToolId: string;
|
|
5
11
|
isActive: () => boolean;
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { createScopedToolId } from "../../services/tool-instance-id.js";
|
|
2
|
+
/**
|
|
3
|
+
* The event a tool element dispatches, bubbling and composed, with
|
|
4
|
+
* `{ active: boolean }` as its detail when it opens or closes its own panel.
|
|
5
|
+
* A registration relays it as the toolbar button's active state.
|
|
6
|
+
*/
|
|
7
|
+
export const TOOL_ACTIVE_CHANGE_EVENT = "pie-tool-active-change";
|
|
2
8
|
export function createScopedVisibilityBinding(toolId, toolbarContext) {
|
|
3
9
|
const fullToolId = createScopedToolId(toolId, toolbarContext.scope.level, toolbarContext.scope.scopeId);
|
|
4
10
|
return {
|
|
@@ -43,12 +43,6 @@ function stableSerializableJson(value) {
|
|
|
43
43
|
if (typeof current === "undefined") {
|
|
44
44
|
return undefined;
|
|
45
45
|
}
|
|
46
|
-
if (typeof current === "function" || typeof current === "symbol") {
|
|
47
|
-
throw new TypeError(`${path} is not JSON-serializable`);
|
|
48
|
-
}
|
|
49
|
-
if (typeof current === "bigint") {
|
|
50
|
-
throw new TypeError(`${path} is not JSON-serializable`);
|
|
51
|
-
}
|
|
52
46
|
if (typeof current !== "object") {
|
|
53
47
|
throw new TypeError(`${path} is not JSON-serializable`);
|
|
54
48
|
}
|
|
@@ -339,7 +333,7 @@ export function createToolSurfaceHost(onSnapshot, options) {
|
|
|
339
333
|
// test-administration override grants it.
|
|
340
334
|
placed = true;
|
|
341
335
|
granted = entry.required || entry.alwaysAvailable;
|
|
342
|
-
parameters = entry.
|
|
336
|
+
parameters = entry.parameters;
|
|
343
337
|
break;
|
|
344
338
|
}
|
|
345
339
|
if (!placed)
|
|
@@ -465,7 +459,6 @@ export function createToolSurfaceHost(onSnapshot, options) {
|
|
|
465
459
|
}
|
|
466
460
|
}
|
|
467
461
|
report(toolId, "render", `Tool "${toolId}" failed to render into the "${current.surface}" surface.`, error);
|
|
468
|
-
return;
|
|
469
462
|
}
|
|
470
463
|
}
|
|
471
464
|
function reconcile() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-players/pie-assessment-toolkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "PIE assessment toolkit: composable services + reference implementation for assessment players and tool coordination",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,8 +54,10 @@
|
|
|
54
54
|
"import": "./dist/policy/engine.js"
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
+
"customElements": "custom-elements.json",
|
|
57
58
|
"files": [
|
|
58
59
|
"dist",
|
|
60
|
+
"custom-elements.json",
|
|
59
61
|
"README.md"
|
|
60
62
|
],
|
|
61
63
|
"scripts": {
|
|
@@ -67,16 +69,16 @@
|
|
|
67
69
|
"test": "bun test"
|
|
68
70
|
},
|
|
69
71
|
"dependencies": {
|
|
70
|
-
"@pie-players/pie-calculator": "0.
|
|
71
|
-
"@pie-players/pie-context": "0.
|
|
72
|
-
"@pie-players/pie-players-shared": "0.
|
|
73
|
-
"@pie-players/pie-tts": "0.
|
|
72
|
+
"@pie-players/pie-calculator": "1.0.0-beta.0",
|
|
73
|
+
"@pie-players/pie-context": "1.0.0-beta.0",
|
|
74
|
+
"@pie-players/pie-players-shared": "1.0.0-beta.0",
|
|
75
|
+
"@pie-players/pie-tts": "1.0.0-beta.0",
|
|
74
76
|
"speech-rule-engine": "5.0.0-rc.4"
|
|
75
77
|
},
|
|
76
78
|
"devDependencies": {
|
|
77
79
|
"@biomejs/biome": "^2.5.15",
|
|
78
80
|
"@happy-dom/global-registrator": "^20.14.5",
|
|
79
|
-
"@pie-players/tts-client-server": "0.
|
|
81
|
+
"@pie-players/tts-client-server": "1.0.0-beta.0",
|
|
80
82
|
"svelte": "^5.57.1",
|
|
81
83
|
"svelte-check": "^4.7.6",
|
|
82
84
|
"typescript": "^5.9.3"
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{ia as h,ja as F}from"./ItemToolBar-7tt7v2xp.js";var Y=["assessment","section","item","passage","rubric"],H=new Set(Y);function U(f){return H.has(f)}function N(f,p,c){let w=f.trim(),E=c.trim();if(!w||!E)throw Error("Tool instance ids require non-empty tool and scope ids");if(!U(p))throw Error(`Unknown tool scope level '${p}'. Register custom levels with registerToolScopeLevel().`);return`${w}:${p}:${E}`}function q(f){let p=f.split(":");if(p.length!==3)return null;let[c,w,E]=p;if(!c||!E)return null;if(!U(w))return null;return{baseToolId:c,scopeLevel:w,scopeId:E}}function B(f){return(...p)=>{console.debug(`[${f}]`,...p)}}var z=B("ToolCoordinator"),T;(function(f){f[f.BASE=0]="BASE",f[f.TOOL=1000]="TOOL",f[f.MODAL=2000]="MODAL",f[f.CONTROL=3000]="CONTROL",f[f.HIGHLIGHT=4000]="HIGHLIGHT"})(T||(T={}));function J(f,p){if(!p?.baseId)return!0;return(q(f)?.baseToolId??f)===p.baseId}function M(f){return{id:f.id,name:f.name,isVisible:f.isVisible,element:f.element,layer:f.layer}}class V{tools=new Map;listeners=new Set;subscribe(f){return this.listeners.add(f),()=>{this.listeners.delete(f)}}notifyListeners(){for(let f of this.listeners)try{f()}catch(p){console.warn("[ToolCoordinator] listener failed:",p)}}registerTool(f,p,c,w){z("registerTool called:",{id:f,name:p,hasElement:!!c,layer:w});let E=this.tools.get(f);if(E){E.name=p;let u=E.registered;if(E.registered=!0,w!==void 0&&!E.layerDeclared)E.layer=w,E.layerDeclared=!0,this.stackOnTop(E);else if(!u)this.stackOnTop(E)}else E={id:f,name:p,registered:!0,element:null,layer:w??T.TOOL,layerDeclared:w!==void 0,isVisible:!1,baseZIndex:0},this.tools.set(f,E),this.stackOnTop(E);if(c)this.updateToolElement(f,c)}unregisterTool(f){let p=this.tools.get(f);if(!p?.registered)return;this.detachElement(p),p.registered=!1}releaseTool(f){let p=this.tools.get(f);if(!p)return;if(this.detachElement(p),this.tools.delete(f),p.isVisible)this.notifyListeners()}showTool(f){let p=this.tools.get(f);if(!p){z(`Tool ${f} not found`);return}if(p.element)this.bringToFront(p.element);this.setVisible(p,!0)}hideTool(f){let p=this.tools.get(f);if(!p){z(`Tool ${f} not found`);return}this.setVisible(p,!1)}toggleTool(f){let p=this.tools.get(f);if(!p){z(`Tool ${f} not found`);return}if(p.isVisible)this.hideTool(f);else this.showTool(f)}isToolVisible(f){return this.tools.get(f)?.isVisible??!1}bringToFront(f){let p=Array.from(this.tools.values()).find((c)=>c.element===f);if(!p)return;this.stackOnTop(p)}getRegisteredTools(){return Array.from(this.tools.values()).filter((f)=>f.registered).map((f)=>f.id)}getToolElement(f){return this.tools.get(f)?.element??null}setVisible(f,p){if(f.isVisible===p)return;f.isVisible=p,this.notifyListeners()}detachElement(f){if(f.element&&f.mouseDownHandler)f.element.removeEventListener("mousedown",f.mouseDownHandler);f.element=null,f.mouseDownHandler=void 0}stackOnTop(f){let p=Array.from(this.tools.values()).filter((w)=>w.registered&&w.layer===f.layer&&w!==f).sort((w,E)=>w.baseZIndex-E.baseZIndex),c=f.layer+p.length+1;if(f.baseZIndex===c&&p.every((w)=>w.baseZIndex<c))return;[...p,f].forEach((w,E)=>{if(w.baseZIndex=f.layer+1+E,w.element)w.element.style.zIndex=String(w.baseZIndex)})}updateToolElement(f,p){let c=this.tools.get(f);if(!c?.registered){z(`Tool ${f} not found`);return}if(c.element===p)return;if(c.element?.isConnected&&c.element.contains(p))return;this.detachElement(c);let w=()=>this.bringToFront(p);if(p.addEventListener("mousedown",w),c.element=p,c.mouseDownHandler=w,p.style.zIndex=String(c.baseZIndex),c.isVisible)this.bringToFront(p)}hideAllTools(f){let p=!1;for(let c of this.tools.values()){if(!c.isVisible||!J(c.id,f))continue;c.isVisible=!1,p=!0}if(p)this.notifyListeners()}getToolState(f){let p=this.tools.get(f);return p?.registered?M(p):void 0}getVisibleTools(f){return Array.from(this.tools.values()).filter((p)=>p.isVisible&&J(p.id,f)).map(M)}}import{dynamicMessageKey as a}from"@pie-players/pie-players-shared/i18n/provider";import{validateCustomElementTag as W}from"@pie-players/pie-players-shared/pie/tag-names";var P=(f,p)=>{let c=p?.toolTagMap?.[f];if(c===void 0&&!f.includes("-"))throw Error(`No element tag is mapped for tool "${f}". Install a tag map on the registry via setComponentOverrides({ toolTagMap }) — for the packaged capabilities, PACKAGED_TOOL_TAG_MAP from "@pie-players/pie-default-tool-loaders".`);return W(c??f,`tool component tag for "${f}"`)};var R=["assessment","section","item","passage","rubric","element"];function j(f,p){if(typeof f!=="string"||f.trim().length===0)throw Error(`Invalid tool registration: "${p}" must be a non-empty string.`)}var S=[{pattern:/<script\b/i,reason:"contains a <script> tag"},{pattern:/\son[a-z]+\s*=/i,reason:"contains an inline event handler (on*=) attribute"},{pattern:/javascript:/i,reason:"contains a javascript: URL"},{pattern:/<foreignObject\b/i,reason:"contains a <foreignObject> element"}];function G(f,p,c){let w=p.trimStart(),E=w.toLowerCase().startsWith("<svg"),u=/^https?:/i.test(w);if(/^data:/i.test(w))throw Error(`Invalid tool registration "${f}": "${c}" may not be a data: URL.`);if(!E&&!u)return;for(let{pattern:X,reason:_}of S)if(X.test(p))throw Error(`Invalid tool registration "${f}": "${c}" ${_}. Inline SVG icons must not include scriptable content.`)}function Q(f){j(f.toolId,"toolId"),j(f.name,"name"),j(f.description,"description");let p=f.activation==="region";if(!p||f.icon!==void 0){if(typeof f.icon!=="string"&&typeof f.icon!=="function")throw Error(`Invalid tool registration "${f.toolId}": "icon" must be a string or function.`)}if(typeof f.icon==="string")G(f.toolId,f.icon,"icon");if(!Array.isArray(f.supportedLevels)||f.supportedLevels.length===0)throw Error(`Invalid tool registration "${f.toolId}": "supportedLevels" must be a non-empty array.`);let c=f.supportedLevels.find((w)=>!R.includes(w));if(c)throw Error(`Invalid tool registration "${f.toolId}": unsupported level "${c}".`);if(f.activation!==void 0&&f.activation!=="toolbar-toggle"&&f.activation!=="selection-gateway"&&f.activation!=="region")throw Error(`Invalid tool registration "${f.toolId}": unsupported activation "${String(f.activation)}".`);if(f.surfaces!==void 0&&(!Array.isArray(f.surfaces)||f.surfaces.some((w)=>typeof w!=="string"||w.trim().length===0)))throw Error(`Invalid tool registration "${f.toolId}": "surfaces" must be an array of non-empty strings.`);if(p&&!f.surfaces?.length)throw Error(`Invalid tool registration "${f.toolId}": region tools must declare at least one host surface in "surfaces".`);if(p&&typeof f.renderSurface!=="function")throw Error(`Invalid tool registration "${f.toolId}": region tools must implement "renderSurface".`);if(f.resolvesWithoutGrant!==void 0&&typeof f.resolvesWithoutGrant!=="boolean")throw Error(`Invalid tool registration "${f.toolId}": "resolvesWithoutGrant" must be a boolean.`);if(f.resolvesWithoutGrant&&!f.requiresAuthoredContent)throw Error(`Invalid tool registration "${f.toolId}": "resolvesWithoutGrant" requires "requiresAuthoredContent".`);if(f.renderSurface!==void 0&&typeof f.renderSurface!=="function")throw Error(`Invalid tool registration "${f.toolId}": "renderSurface" must be a function.`);if(f.renderSurface&&!f.surfaces?.length)throw Error(`Invalid tool registration "${f.toolId}": "renderSurface" requires at least one entry in "surfaces".`);if(f.singletonScope!==void 0&&f.singletonScope!=="section")throw Error(`Invalid tool registration "${f.toolId}": unsupported singletonScope "${String(f.singletonScope)}".`);if(f.activation==="selection-gateway"&&f.singletonScope!=="section")throw Error(`Invalid tool registration "${f.toolId}": selection-gateway tools must declare singletonScope "section".`);if(f.activation!=="region"&&typeof f.isVisibleInContext!=="function")throw Error(`Invalid tool registration "${f.toolId}": "isVisibleInContext" must be a function.`);if(f.isVisibleInContext!==void 0&&typeof f.isVisibleInContext!=="function")throw Error(`Invalid tool registration "${f.toolId}": "isVisibleInContext" must be a function when present.`);if(f.isApplicableToContent!==void 0&&typeof f.isApplicableToContent!=="function")throw Error(`Invalid tool registration "${f.toolId}": "isApplicableToContent" must be a function when present.`);if(f.requiresAuthoredContent!==void 0){if(typeof f.requiresAuthoredContent!=="object"||f.requiresAuthoredContent===null||typeof f.requiresAuthoredContent.resolve!=="function")throw Error(`Invalid tool registration "${f.toolId}": "requiresAuthoredContent" must be an object with a "resolve" function.`)}if(f.renderToolbar!==void 0){if(typeof f.renderToolbar!=="function")throw Error(`Invalid tool registration "${f.toolId}": "renderToolbar" must be a function.`)}else if(!p)throw Error(`Invalid tool registration "${f.toolId}": "renderToolbar" must be a function.`)}class D{tools=new Map;componentOverrides={};watchedUndefinedToolElements=new Set;moduleLoaders=new Map;loadedToolModules=new Set;warnedLoaderReplacements=new Set;warnedUnregisteredAllowedTools=new Set;moduleLoadPromises=new Map;changeListeners=new Set;emitChange(f){for(let p of this.changeListeners)try{p(f)}catch(c){console.warn("[ToolRegistry] change listener failed:",c)}}onRegistryChange(f){this.changeListeners.add(f);let p=!0;return()=>{if(!p)return;p=!1,this.changeListeners.delete(f)}}normalizeToolId(f){return f.trim()}normalizeToolIds(f){return f.map((p)=>this.normalizeToolId(p))}register(f){if(Q(f),this.tools.has(f.toolId))throw Error(`Tool '${f.toolId}' is already registered`);this.tools.set(f.toolId,f),this.emitChange({kind:"register",toolIds:[f.toolId]})}override(f){if(Q(f),!this.tools.has(f.toolId))throw Error(`Cannot override non-existent tool '${f.toolId}'`);this.tools.set(f.toolId,f),this.emitChange({kind:"override",toolIds:[f.toolId]})}unregister(f){if(!this.tools.has(f))return;this.tools.delete(f),this.emitChange({kind:"unregister",toolIds:[f]})}get(f){return this.tools.get(f)}has(f){return this.tools.has(f)}getAllToolIds(){return Array.from(this.tools.keys())}getAllTools(){return Array.from(this.tools.values())}getToolsByLevel(f){return this.getAllTools().filter((p)=>p.supportedLevels.includes(f))}getToolActivation(f){return this.get(f)?.activation||"toolbar-toggle"}getToolSingletonScope(f){return this.get(f)?.singletonScope||null}getToolsBySurface(f){if(!f)return[];return this.getAllTools().filter((p)=>typeof p.renderSurface==="function"&&p.surfaces?.includes(f))}getContentDependentSupportIds(){return this.getAllTools().filter((f)=>f.requiresAuthoredContent).map((f)=>f.toolId).sort()}filterToolIdsByActivation(f,p){return f.filter((c)=>this.getToolActivation(c)===p)}filterVisibleInContext(f,p){let c=[];for(let w of f){let E=this.get(w);if(!E){if(!this.warnedUnregisteredAllowedTools.has(w))this.warnedUnregisteredAllowedTools.add(w),console.warn(`Tool '${w}' is allowed but not registered`);continue}if(!E.supportedLevels.includes(p.level))continue;try{if(E.isVisibleInContext?.(p))c.push(E)}catch(u){console.error(`Error evaluating visibility for tool '${w}':`,u)}}return c}isApplicableToAnyContext(f,p){let c=this.get(f);if(!c?.isApplicableToContent)return!0;if(p.length===0)return!0;return p.some((w)=>{try{return c.isApplicableToContent?.(w)??!0}catch(E){return console.error(`Error evaluating applicability for tool '${f}':`,E),!0}})}getToolMetadata(){return this.getAllTools().map((f)=>({toolId:f.toolId,name:f.name,description:f.description,supportedLevels:f.supportedLevels,activation:f.activation||"toolbar-toggle",singletonScope:f.singletonScope||null,surfaces:f.surfaces||[],requiresAuthoredContent:Boolean(f.requiresAuthoredContent),contentDependencyDescription:f.requiresAuthoredContent?.description??null}))}clear(){let f=this.getAllToolIds();if(f.length===0)return;this.tools.clear(),this.emitChange({kind:"clear",toolIds:f})}setComponentOverrides(f){if(this.componentOverrides===f)return;this.componentOverrides=f,this.emitChange({kind:"component-overrides",toolIds:[]})}setToolModuleLoaders(f){let p=Object.entries(f).filter((w)=>w[1]!==void 0);for(let[w,E]of p)if(j(w,"tool module loader id"),typeof E!=="function")throw Error(`Invalid tool module loader for "${w}": expected a function.`);let c=[];for(let[w,E]of p){if(this.moduleLoaders.get(w)===E)continue;if(this.loadedToolModules.has(w)||this.moduleLoadPromises.has(w)){this.warnLoaderReplacedAfterLoad(w);continue}this.moduleLoaders.set(w,E),c.push(w)}if(c.length>0)this.emitChange({kind:"module-loaders",toolIds:c})}warnLoaderReplacedAfterLoad(f){if(this.warnedLoaderReplacements.has(f))return;this.warnedLoaderReplacements.add(f),console.warn(`[ToolRegistry] Ignored a new module loader for "${f}": its module already loaded, so the elements it defines stay in place. Register loaders before the tool first renders.`)}async ensureToolModuleLoaded(f){if(this.loadedToolModules.has(f))return;let p=this.moduleLoadPromises.get(f);if(p){await p;return}let c=this.moduleLoaders.get(f);if(!c){this.watchUndefinedToolElement(f);return}let w=(async()=>{await c(),this.loadedToolModules.add(f),this.warnIfLoadedToolElementUndefined(f)})();this.moduleLoadPromises.set(f,w);try{await w}finally{this.moduleLoadPromises.delete(f)}}undefinedToolElementTag(f){if(typeof customElements>"u"||typeof document>"u")return null;let p=this.componentOverrides;if(p.toolComponentFactories?.[f])return null;let c;try{c=P(f,p)}catch{return null}return customElements.get(c)?null:c}warnIfLoadedToolElementUndefined(f){let p=this.undefinedToolElementTag(f);if(!p)return;F(document,`loadedToolElementUndefined.${f}.${p}`,`[ToolRegistry] Tool "${f}" renders <${p}>, but its module loader finished without defining it, so the tool renders blank. The tag map and the loader disagree: map "${f}" to the tag its loader defines, or register a loader that defines <${p}>. Reported once per page.`)}watchUndefinedToolElement(f){if(this.watchedUndefinedToolElements.has(f))return;let p=this.undefinedToolElementTag(f);if(!p)return;this.watchedUndefinedToolElements.add(f);let c=document,w=setTimeout(()=>{if(customElements.get(p))return;F(c,`undefinedToolElement.${f}`,`[ToolRegistry] Tool "${f}" renders <${p}>, which is still undefined after ${h/1000} s, and its registry has no module loader for it. Pass toolModuleLoaders to createPackagedToolRegistry (DEFAULT_TOOL_MODULE_LOADERS from @pie-players/pie-default-tool-loaders loads the stock tools), register one with setToolModuleLoaders, or import the tool's package before it renders. Reported once per page.`)},h);customElements.whenDefined(p).then(()=>clearTimeout(w))}async ensureToolModulesLoaded(f){let p=await Promise.allSettled(f.map((w)=>this.ensureToolModuleLoaded(w))),c=new Map;return p.forEach((w,E)=>{if(w.status==="rejected")c.set(f[E],w.reason)}),c}isToolModuleLoaded(f){return this.loadedToolModules.has(f)}renderForToolbar(f,p,c){let w=this.get(f);if(!w)throw Error(`Tool '${f}' is not registered`);if(typeof w.renderToolbar!=="function")throw Error(`Tool '${f}' has activation "${w.activation||"toolbar-toggle"}" and renders into a host surface, not a toolbar. Remove it from toolbar placement.`);let E={...c,componentOverrides:{...this.componentOverrides||{},...c.componentOverrides||{}}};return w.renderToolbar(p,E)}renderForSurface(f,p){let c=this.get(f);if(!c)throw Error(`Tool '${f}' is not registered`);if(typeof c.renderSurface!=="function")throw Error(`Tool '${f}' does not render into a host surface. Surface capabilities declare "surfaces" and implement "renderSurface".`);return c.renderSurface({...p,componentOverrides:{...this.componentOverrides||{},...p.componentOverrides||{}}})}}var b={assessment:[],section:[],item:[],passage:[],rubric:[],element:[]};var C={section:[...b.section],item:[...b.item],passage:[...b.passage]};function A(f){return typeof f==="object"&&f!==null&&!Array.isArray(f)}function O(f,p){if(f==null)return[];if(!Array.isArray(f))throw Error(`Invalid tools config at "${p}": expected an array of tool ids.`);if(f.find((w)=>typeof w!=="string")!==void 0)throw Error(`Invalid tools config at "${p}": all entries must be strings.`);return f}function K(f){if(f==null)return;if(!A(f))throw Error('Invalid tools config at "placement": expected an object with section/item/passage arrays.');return f}function k(f){if(f==null)return;if(!A(f))throw Error('Invalid tools config at "policy": expected an object with allowed/blocked arrays.');return f}function L(f,p){if(p==null)return;if(!A(p))throw Error(`Invalid tools config at "providers.${f}": expected an object.`);let c=p;if("enabled"in c&&c.enabled!==void 0&&typeof c.enabled!=="boolean")throw Error(`Invalid tools config at "providers.${f}.enabled": expected a boolean.`);if("settings"in c&&c.settings!==void 0&&!A(c.settings))throw Error(`Invalid tools config at "providers.${f}.settings": expected an object.`);if("provider"in c&&c.provider!==void 0&&!A(c.provider))throw Error(`Invalid tools config at "providers.${f}.provider": expected an object.`);return c}function Z(f){if(f==null)return{};if(!A(f))throw Error('Invalid tools config at "providers": expected an object keyed by tool id.');let p={};for(let[c,w]of Object.entries(f))p[c]=L(c,w);return p}function $(f){if(!f||f.length===0)return[];let p=new Set;for(let c of f){if(typeof c!=="string")throw Error("Invalid tools config: tool list entries must be strings.");let w=c.trim();if(!w)continue;p.add(w)}return Array.from(p)}function ff(f){if(!f)return[];return $(f.split(",").map((p)=>p.trim()).filter(Boolean))}function v(f,p){if(f==null)return;if(f==="on"||f==="off")return f;throw Error(`Invalid tools config at "${p}": expected "on" or "off", got ${JSON.stringify(f)}.`)}function pf(f){if(f!=null&&!A(f))throw Error('Invalid tools config: expected an object with "policy", "placement", and "providers".');let p=k(f?.policy),c=K(f?.placement),w=Z(f?.providers),E=v(f?.pnpEnforcement,"pnpEnforcement"),u={policy:{allowed:$(O(p?.allowed,"policy.allowed")),blocked:$(O(p?.blocked,"policy.blocked"))},placement:{section:$(O(c?.section,"placement.section")).length?$(O(c?.section,"placement.section")):[...C.section],item:$(O(c?.item,"placement.item")).length?$(O(c?.item,"placement.item")):[...C.item],passage:$(O(c?.passage,"placement.passage")).length?$(O(c?.passage,"placement.passage")):[...C.passage]},providers:w};if(E)u.pnpEnforcement=E;return u}
|
|
2
|
-
export{N as m,T as n,V as o,D as p,$ as q,ff as r,pf as s};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import{m as rJ,n as lJ,p as nJ,r as tJ}from"./ItemToolBar-bxwyhr5p.js";import{$ as sJ,A as mJ,B as c0,C as Q0,E as wj,F as Z0,G as L0,H as j,J as Jj,K as hJ,L as M0,M as X0,N as H,P as Y0,Q as Bj,R as Zj,S as Uj,U as uJ,V as B0,W as T0,X as U0,Y as f0,Z as cJ,_ as o,aa as iJ,fa as aJ,ga as dJ,ia as tj,ja as oJ,ka as bJ,t as N0,u as gJ,v as $J,w as O,x as l,y as R0,z as V0}from"./ItemToolBar-7tt7v2xp.js";import{ContextProvider as hZ}from"@pie-players/pie-context";function lj(B){return typeof B.href==="string"}function CJ(B){if(!B||typeof B!=="object"||Array.isArray(B))return!1;let F=B;if(typeof F.id!=="string"||F.id.trim().length===0)return!1;if(typeof F.label!=="string"||F.label.trim().length===0)return!1;if(F.ariaLabel!==void 0&&typeof F.ariaLabel!=="string")return!1;if(F.icon!==void 0&&typeof F.icon!=="string")return!1;if(F.tooltip!==void 0&&typeof F.tooltip!=="string")return!1;if(F.active!==void 0&&typeof F.active!=="boolean")return!1;if(F.disabled!==void 0&&typeof F.disabled!=="boolean")return!1;let v=typeof F.href==="string",W0=typeof F.onClick==="function";if(v===W0)return!1;if(v)return!0;return W0}function oj(B){return typeof B==="string"&&B.trimStart().startsWith("<svg")}function nj(B){return typeof B==="string"&&B.trimStart().startsWith("http")}import{sanitizeSvgIcon as kj}from"@pie-players/pie-players-shared/security";import{resolveInterfaceI18n as uZ}from"@pie-players/pie-players-shared/i18n/provider";import{collectFocusable as cZ,createFocusTrap as sZ,createPointerGesture as iZ,FOCUSABLE_SELECTOR as aZ,isProgrammaticFocusTarget as dZ}from"@pie-players/pie-players-shared";var $Z={calculator:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M7 2h10a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm0 2v4h10V4H7Zm0 6v2h2v-2H7Zm4 0v2h2v-2h-2Zm4 0v2h2v-2h-2Zm-8 4v2h2v-2H7Zm4 0v2h2v-2h-2Zm4 0v2h2v-2h-2Zm-8 4v2h2v-2H7Zm4 0v2h2v-2h-2Zm4 0v2h2v-2h-2Z" fill="currentColor"/></svg>',"volume-up":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 3.23v2.06A7.002 7.002 0 0 1 19 12a7 7 0 0 1-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77Zm-2 17.75V3L7 8H3v8h4l5 5Zm4.5-9a4.5 4.5 0 0 0-2.5-4.03v8.05A4.5 4.5 0 0 0 16.5 12Z" fill="currentColor"/></svg>',swatch:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 3a9 9 0 1 0 9 9c0-.55-.45-1-1-1h-2.5a1.5 1.5 0 0 1 0-3H20a1 1 0 0 0 1-1 8.99 8.99 0 0 0-9-4Zm-5.5 9A1.5 1.5 0 1 1 8 13.5 1.5 1.5 0 0 1 6.5 12Zm3-4A1.5 1.5 0 1 1 11 9.5 1.5 1.5 0 0 1 9.5 8Zm5 0A1.5 1.5 0 1 1 16 9.5 1.5 1.5 0 0 1 14.5 8Z" fill="currentColor"/></svg>',"chart-bar":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4.75 5a.76.76 0 0 1 .75.75v11c0 .438.313.75.75.75h13a.76.76 0 0 1 .696 1.039.74.74 0 0 1-.696.461h-13C5 19 4 18 4 16.75v-11A.74.74 0 0 1 4.75 5ZM8 8.25a.74.74 0 0 1 .75-.75h6.5a.76.76 0 0 1 .696 1.039.74.74 0 0 1-.696.461h-6.5A.722.722 0 0 1 8 8.25Zm.75 2.25h4.5a.76.76 0 0 1 .696 1.039.74.74 0 0 1-.696.461h-4.5a.723.723 0 0 1-.75-.75.74.74 0 0 1 .75-.75Zm0 3h8.5a.76.76 0 0 1 .696 1.039.74.74 0 0 1-.696.461h-8.5a.723.723 0 0 1-.75-.75.74.74 0 0 1 .75-.75Z" fill="currentColor"/></svg>',beaker:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5 21c-.85 0-1.454-.38-1.813-1.137-.358-.759-.27-1.463.263-2.113L9 11V5H8a.968.968 0 0 1-.713-.287A.968.968 0 0 1 7 4c0-.283.096-.52.287-.712A.968.968 0 0 1 8 3h8c.283 0 .52.096.712.288.192.191.288.429.288.712s-.096.52-.288.713A.968.968 0 0 1 16 5h-1v6l5.55 6.75c.533.65.62 1.354.262 2.113C20.454 20.62 19.85 21 19 21H5Zm2-3h10l-3.4-4h-3.2L7 18Zm-2 1h14l-6-7.3V5h-2v6.7L5 19Z" fill="currentColor"/></svg>',protractor:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m6.75 21-.25-2.2 2.85-7.85a3.95 3.95 0 0 0 1.75.95l-2.75 7.55L6.75 21Zm10.5 0-1.6-1.55-2.75-7.55a3.948 3.948 0 0 0 1.75-.95l2.85 7.85-.25 2.2ZM12 11a2.893 2.893 0 0 1-2.125-.875A2.893 2.893 0 0 1 9 8c0-.65.188-1.23.563-1.737A2.935 2.935 0 0 1 11 5.2V3h2v2.2c.583.2 1.063.554 1.438 1.063C14.812 6.77 15 7.35 15 8c0 .833-.292 1.542-.875 2.125A2.893 2.893 0 0 1 12 11Zm0-2c.283 0 .52-.096.713-.287A.967.967 0 0 0 13 8a.967.967 0 0 0-.287-.713A.968.968 0 0 0 12 7a.968.968 0 0 0-.713.287A.967.967 0 0 0 11 8c0 .283.096.52.287.713.192.191.43.287.713.287Z" fill="currentColor"/></svg>',"bars-3":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6.85 15c.517 0 .98-.15 1.388-.45.408-.3.695-.692.862-1.175l.375-1.15c.267-.8.2-1.537-.2-2.213C8.875 9.337 8.3 9 7.55 9H4.025l.475 3.925c.083.583.346 1.075.787 1.475.442.4.963.6 1.563.6Zm10.3 0c.6 0 1.12-.2 1.563-.6.441-.4.704-.892.787-1.475L19.975 9h-3.5c-.75 0-1.325.342-1.725 1.025-.4.683-.467 1.425-.2 2.225l.35 1.125c.167.483.454.875.862 1.175.409.3.871.45 1.388.45Zm-10.3 2c-1.1 0-2.063-.363-2.887-1.088a4.198 4.198 0 0 1-1.438-2.737L2 9H1V7h6.55c.733 0 1.404.18 2.013.537A3.906 3.906 0 0 1 11 9h2.025c.35-.617.83-1.104 1.438-1.463A3.892 3.892 0 0 1 16.474 7H23v2h-1l-.525 4.175a4.198 4.198 0 0 1-1.438 2.737A4.238 4.238 0 0 1 17.15 17c-.95 0-1.804-.27-2.562-.813A4.234 4.234 0 0 1 13 14.026l-.375-1.125a21.35 21.35 0 0 1-.1-.363 4.926 4.926 0 0 1-.1-.537h-.85c-.033.2-.067.363-.1.488a21.35 21.35 0 0 1-.1.362L11 14a4.3 4.3 0 0 1-1.588 2.175A4.258 4.258 0 0 1 6.85 17Z" fill="currentColor"/></svg>',ruler:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m8.8 10.95 2.15-2.175-1.4-1.425-1.1 1.1-1.4-1.4 1.075-1.1L7 4.825 4.825 7 8.8 10.95Zm8.2 8.225L19.175 17l-1.125-1.125-1.1 1.075-1.4-1.4 1.075-1.1-1.425-1.4-2.15 2.15L17 19.175ZM7.25 21H3v-4.25l4.375-4.375L2 7l5-5 5.4 5.4 3.775-3.8c.2-.2.425-.35.675-.45a2.068 2.068 0 0 1 1.55 0c.25.1.475.25.675.45L20.4 4.95c.2.2.35.425.45.675.1.25.15.508.15.775a1.975 1.975 0 0 1-.6 1.425l-3.775 3.8L22 17l-5 5-5.375-5.375L7.25 21ZM5 19h1.4l9.8-9.775L14.775 7.8 5 17.6V19Z" fill="currentColor"/></svg>',"book-open":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 6.25a6.6 6.6 0 0 0-2.3-1.32A8.6 8.6 0 0 0 7 4.5c-.63 0-1.25.06-1.85.18-.6.12-1.19.3-1.76.54a1.5 1.5 0 0 0-.93 1.4v10.1c0 .52.26.98.68 1.24.42.26.92.28 1.35.06.36-.18.75-.31 1.18-.4.42-.09.86-.13 1.33-.13.78 0 1.53.14 2.24.42.7.28 1.35.7 1.93 1.24l.83-.75.83.75c.58-.54 1.22-.96 1.93-1.24a6.1 6.1 0 0 1 2.24-.42c.47 0 .91.04 1.33.13.43.09.82.22 1.18.4.43.22.93.2 1.35-.06.42-.26.68-.72.68-1.24V6.62c0-.6-.36-1.15-.93-1.4a9.3 9.3 0 0 0-1.76-.54A9.8 9.8 0 0 0 17 4.5a8.6 8.6 0 0 0-2.7.43A6.6 6.6 0 0 0 12 6.25Zm1 10.06V8.02c.55-.5 1.16-.88 1.84-1.13A6 6 0 0 1 17 6.5c.45 0 .89.04 1.32.11.43.08.85.19 1.26.34v9.24a8.2 8.2 0 0 0-1.28-.24A10 10 0 0 0 17 15.85c-.72 0-1.42.09-2.09.26a7.7 7.7 0 0 0-1.91.8Zm-2 0a7.7 7.7 0 0 0-1.91-.8 8.4 8.4 0 0 0-2.09-.26c-.44 0-.87.02-1.3.07-.43.05-.86.13-1.28.24V6.95c.41-.15.83-.26 1.26-.34A7.7 7.7 0 0 1 7 6.5c.76 0 1.48.13 2.16.39.68.25 1.29.63 1.84 1.13Z" fill="currentColor"/></svg>',photo:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 21c-.55 0-1.02-.2-1.41-.59A1.93 1.93 0 0 1 2 19V5c0-.55.2-1.02.59-1.41A1.93 1.93 0 0 1 4 3h16c.55 0 1.02.2 1.41.59.39.39.59.86.59 1.41v14c0 .55-.2 1.02-.59 1.41-.39.39-.86.59-1.41.59H4Zm0-2h16V5H4v14Zm1.5-2.5h13l-4.1-5.47-3.4 4.47-2.5-3.25L5.5 16.5ZM8.5 10a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z" fill="currentColor"/></svg>'};function yJ(B){return $Z[B]||null}function pJ(){let B=null;return(F,v)=>{if(!F)return B=null,null;let W0=F.visibleTools.map((s0)=>({toolId:s0.toolId,required:s0.required,alwaysAvailable:s0.alwaysAvailable}));if(B?.renderVersion===v&&bJ(B.tools,W0))return B.tools;return B={renderVersion:v,tools:W0},W0}}import"@pie-players/pie-players-shared/nds-icon-button";var mZ=(B,F)=>{if(customElements.get(B))return;try{customElements.define(B,F)}catch(v){if(!(v instanceof DOMException&&v.name==="NotSupportedError"||v&&typeof v==="object"&&v.name==="NotSupportedError")||!customElements.get(B))throw v}},zj=M0('<span class="item-toolbar__element-host svelte-1c13522"></span>'),rZ=M0('<span class="item-toolbar__nds-button-zoom svelte-1c13522"><nds-icon-button></nds-icon-button></span>',2),Hj=M0('<span aria-hidden="true"></span>'),_J=M0('<img class="item-toolbar__icon-image svelte-1c13522" alt=""/>'),EJ=M0('<i aria-hidden="true"></i>'),lZ=M0("<a><!></a>"),oZ=M0('<button type="button"><!></button>'),vJ=M0('<span class="item-toolbar__controls-host svelte-1c13522"></span>'),nZ=M0("<div></div>"),tZ=M0('<div><div class="item-toolbar__tools-row svelte-1c13522"><!> <!> <!></div> <!></div>'),eZ={hash:"svelte-1c13522",code:`.item-toolbar.svelte-1c13522 {display:flex;flex-direction:column;align-items:flex-end;min-width:0;max-width:100%;gap:0;--pie-toolbar-tools-row-height: 2rem;--pie-tts-controls-row-height: 2.875rem;}.item-toolbar__tools-row.svelte-1c13522 {display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:0.5rem;max-width:100%;min-height:var(--pie-toolbar-tools-row-height);}
|
|
2
|
-
|
|
3
|
-
/* A granted section tool must stay reachable even when there isn't room for
|
|
4
|
-
every button: scroll the row rather than clipping items past the edge,
|
|
5
|
-
which left them impossible to focus, tab to, or click. \`min-width: 0\`
|
|
6
|
-
beats the flex default (\`auto\`, i.e. never shrink below content), which
|
|
7
|
-
would otherwise keep the row at full content width and make overflow-x
|
|
8
|
-
moot. Item and passage rows wrap without an overflow clip so an inline
|
|
9
|
-
reading-controls panel can still extend outside the row. */.item-toolbar[data-level="section"].svelte-1c13522 .item-toolbar__tools-row:where(.svelte-1c13522) {flex-wrap:nowrap;justify-content:flex-start;
|
|
10
|
-
/* Keep the focus outline inside the scrolling box on both axes. */padding:4px;scroll-padding:4px;box-sizing:border-box;overflow-x:auto;max-width:100%;min-width:0;}.item-toolbar__controls-row.svelte-1c13522 {display:flex;align-items:center;justify-content:flex-end;width:100%;min-height:0;height:auto;}.item-toolbar__controls-row--reserve.svelte-1c13522 {min-height:var(--pie-tts-controls-row-height);height:var(--pie-tts-controls-row-height);}.item-toolbar__controls-row--active.svelte-1c13522 {min-height:var(--pie-tts-controls-row-height);height:var(--pie-tts-controls-row-height);}.item-toolbar__controls-row--align-start.svelte-1c13522 {justify-content:flex-start;}.item-toolbar__controls-host.svelte-1c13522 {display:inline-flex;align-items:center;justify-content:flex-end;width:100%;}.item-toolbar--top.svelte-1c13522,
|
|
11
|
-
.item-toolbar--bottom.svelte-1c13522 {align-items:flex-end;}.item-toolbar--left.svelte-1c13522,
|
|
12
|
-
.item-toolbar--right.svelte-1c13522 {align-items:stretch;}.item-toolbar--left.svelte-1c13522 .item-toolbar__tools-row:where(.svelte-1c13522),
|
|
13
|
-
.item-toolbar--right.svelte-1c13522 .item-toolbar__tools-row:where(.svelte-1c13522) {flex-direction:column;align-items:center;justify-content:flex-start;flex-wrap:nowrap;}.item-toolbar--left.svelte-1c13522 .item-toolbar__controls-row:where(.svelte-1c13522),
|
|
14
|
-
.item-toolbar--right.svelte-1c13522 .item-toolbar__controls-row:where(.svelte-1c13522) {justify-content:flex-start;width:auto;min-height:0;height:auto;}.item-toolbar__button.svelte-1c13522 {display:flex;flex-shrink:0;align-items:center;justify-content:center;width:2rem;height:2rem;padding:0.25rem;border:1px solid var(--pie-button-border, var(--pie-border, #ccc));border-radius:0.25rem;background-color:var(--pie-button-bg, var(--pie-background, white));color:var(--pie-button-color, var(--pie-text, #333));cursor:pointer;transition:all 0.15s ease;text-decoration:none;}
|
|
15
|
-
|
|
16
|
-
/* Drive the vendored NDS icon button's outer size via its own \`--height-32\`
|
|
17
|
-
custom property so its light-DOM inner button matches the toolbar's
|
|
18
|
-
md/sm/lg dimensions (32 / 44 / 40 px) without a layout shift. The glyph
|
|
19
|
-
keeps the NDS-native icon size (we render size="small"), so it isn't
|
|
20
|
-
oversized. */.item-toolbar__nds-button-zoom.svelte-1c13522 {display:inline-flex;flex-shrink:0;}.item-toolbar.svelte-1c13522 nds-icon-button:where(.svelte-1c13522) {
|
|
21
|
-
/* Host-settable button size per toolbar size (drives the NDS outer button
|
|
22
|
-
via its own --height-32). */--height-32: var(--pie-calculator-button-size, 2rem);
|
|
23
|
-
/* Host-settable accent for the calculator button: the NDS tertiary glyph
|
|
24
|
-
colour derives from --color-interactive-blue, remapped here to a
|
|
25
|
-
themeable variable. --pie-calculator-button-color is package-private, so
|
|
26
|
-
nothing sets it and the default is what ships: it now resolves through
|
|
27
|
-
--pie-button-color (DaisyUI base-content) instead of holding the Figma
|
|
28
|
-
blue on every theme, with the literal as the no-theme last resort.
|
|
29
|
-
Not --pie-primary or --pie-tertiary: both are \`direct\` mappings of
|
|
30
|
-
DaisyUI slots chosen to pair with their own -content colour, so a glyph
|
|
31
|
-
taken from either sits at 1.37:1 against the page under \`pastel\` and 11
|
|
32
|
-
of the 35 shipped themes fall under SC 1.4.11's 3:1. */--color-interactive-blue: var(--pie-calculator-button-color, var(--pie-button-color, var(--pie-text, #222)));
|
|
33
|
-
/* NDS palette bridge — keep in sync with the copies in tool-tts-inline
|
|
34
|
-
and section-player SectionItemsPane (asserted by
|
|
35
|
-
scripts/check-theme-tokens.mjs). The vendored button paints its fill,
|
|
36
|
-
its on-accent glyph, its hover ring and its focus ring from the NDS
|
|
37
|
-
design-system palette, which no PIE theme sets, so a tertiary button
|
|
38
|
-
kept a #f3f5f7 pill on every page — and once the glyph followed the
|
|
39
|
-
theme, a light glyph landed on that light pill. */--color-new-gray: var(--pie-background-dark, #f3f5f7);--color-primary-white: var(--pie-white, #ffffff);--color-primary-black: var(--pie-text, #000000);--color-focus-blue: var(--pie-button-focus-outline, #2b87ff);}.item-toolbar--sm.svelte-1c13522 nds-icon-button:where(.svelte-1c13522) {--height-32: var(--pie-calculator-button-size-sm, 2.75rem);}.item-toolbar--lg.svelte-1c13522 nds-icon-button:where(.svelte-1c13522) {--height-32: var(--pie-calculator-button-size-lg, 2.5rem);}.item-toolbar__element-host.svelte-1c13522 {display:contents;}.item-toolbar--sm.svelte-1c13522 .item-toolbar__button:where(.svelte-1c13522) {width:2.75rem;height:2.75rem;}.item-toolbar--sm.svelte-1c13522 {--pie-toolbar-tools-row-height: 2.75rem;--pie-tts-controls-row-height: 3.625rem;}.item-toolbar--lg.svelte-1c13522 .item-toolbar__button:where(.svelte-1c13522) {width:2.5rem;height:2.5rem;}.item-toolbar--lg.svelte-1c13522 {--pie-toolbar-tools-row-height: 2.5rem;--pie-tts-controls-row-height: 3.375rem;}.item-toolbar__button.svelte-1c13522:hover:not(:disabled) {background-color:var(--pie-button-hover-bg, var(--pie-secondary-background, #f5f5f5));border-color:var(--pie-button-hover-border, var(--pie-button-border, var(--pie-border, #ccc)));color:var(--pie-button-hover-color, var(--pie-button-color, var(--pie-text, #333)));transform:translateY(-1px);box-shadow:0 2px 4px color-mix(in srgb, var(--pie-black, #000) 10%, transparent);}.item-toolbar__button.svelte-1c13522:active:not(:disabled) {transform:translateY(0);box-shadow:none;}.item-toolbar__button--active.svelte-1c13522 {background-color:var(--pie-primary, #1976d2);color:var(--pie-white, #fff);border-color:var(--pie-primary, #1976d2);}.item-toolbar__button--active.svelte-1c13522:hover:not(:disabled) {background-color:var(--pie-primary-dark, #1565c0);}.item-toolbar__button.svelte-1c13522:focus-visible {outline:2px solid var(--pie-button-focus-outline, var(--pie-primary, #1976d2));outline-offset:2px;}.item-toolbar__button.svelte-1c13522:disabled {opacity:0.5;cursor:not-allowed;}.item-toolbar__button.svelte-1c13522 svg {width:100%;height:100%;}.item-toolbar__icon-image.svelte-1c13522 {width:100%;height:100%;object-fit:contain;}`};function eJ(B,F){gJ(F,!0),uJ(B,eZ);let v=typeof window<"u",W0=["/_fa-pro/fontawesome.min.css","/_fa-pro/light.min.css"],s0="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.5.2/css/all.min.css",jZ="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap",ej=/font.?awesome|fa-?pro/i,xj=(J)=>{if(document.querySelector(`link[href="${J}"]`))return;let Z=document.createElement("link");Z.rel="stylesheet",Z.href=J,Z.addEventListener("error",()=>{Z.dataset.pieLoadFailed=""},{once:!0}),document.head.appendChild(Z)},jJ=!1,Aj=()=>{if(!v||jJ)return;if(jJ=!0,!document.querySelector('link[href*="Roboto"]'))xj(jZ);if(Array.from(document.querySelectorAll('link[rel="stylesheet"][href]')).some((Z)=>ej.test(Z.href)))return;xj(s0);for(let Z of W0)xj(Z)},JJ="__pieFaToolbarShadowInstalled",JZ=(J)=>{let Z=J.getRootNode();if(!(Z instanceof ShadowRoot))return;let U=Z;if(U[JJ])return;U[JJ]=!0;let Q=new Set,q=(X)=>{if(!X||Q.has(X))return;Q.add(X);let G=document.createElement("link");G.rel="stylesheet",G.href=X,Z.appendChild(G)},S=Array.from(document.querySelectorAll('link[rel="stylesheet"][href]')).filter((X)=>ej.test(X.href));for(let X of S){if("pieLoadFailed"in X.dataset)continue;if(X.sheet){q(X.href);continue}let G=(a)=>{if(X.removeEventListener("load",G),X.removeEventListener("error",G),a.type==="load")q(X.href)};X.addEventListener("load",G),X.addEventListener("error",G)}},ZZ=(J)=>{return Aj(),JZ(J),{}},UZ=(J,Z)=>{let U=Z,Q=()=>{let S=J.querySelector("button");if(S)S.setAttribute("aria-pressed",U?"true":"false")};Q();let q=new MutationObserver(Q);return q.observe(J,{childList:!0,subtree:!0}),{update(S){U=S,Q()},destroy(){q.disconnect()}}},ZJ=(J)=>J.faIconName||null,KZ=new nJ,I0=R0(mJ({})),v0=o(F,"level",7,"item"),Kj=o(F,"scopeId",7,""),Sj=o(F,"itemId",7,""),Tj=o(F,"sectionId",7,""),fj=o(F,"catalogId",7,""),Ij=o(F,"tools",7,""),Cj=o(F,"contentKind",7,"assessment-item"),x0=o(F,"position",7,"bottom"),Qj=o(F,"scopeElement",7,null),Lj=o(F,"toolRegistry",7,null),yj=o(F,"item",7,null),Xj=o(F,"hostButtons",23,()=>[]),bj=o(F,"class",7,""),Yj=o(F,"size",7,"md"),pj=o(F,"language",7,""),D0=R0(null),x=R0(null),g0=O(()=>j(x)?.ndsIcons===!0),Vj=O(()=>uZ(j(x))),QZ=O(()=>pj()||j(x)?.contentLanguage||void 0),$0=R0(null),i0=R0(0),a0=R0(0),_j=R0(0),Ej=R0(0);Z0(()=>{if(!j(D0))return;return aJ(j(D0),(J)=>{V0(x,J,!0)})}),Z0(()=>{if(!j(D0))return;return dJ(j(D0),(J)=>{V0($0,J,!0)})}),Z0(()=>{let J=j(x)?.toolkitCoordinator;if(!J||typeof J.onPolicyChange!=="function")return;let Z=J.onPolicyChange((U)=>{if(V0(a0,j(a0)+1),U?.reason!=="item-settings")V0(_j,j(_j)+1)});return()=>{try{Z?.()}catch{}}}),Z0(()=>{let J=j(x)?.toolkitCoordinator;if(!J||typeof J.onToolContextResolverChange!=="function")return;let Z=J.onToolContextResolverChange(()=>{V0(Ej,j(Ej)+1)});return()=>{try{Z?.()}catch{}}});let P0=O(()=>j(x)?.toolCoordinator),LZ=O(()=>j(x)?.ttsService),vj=O(()=>j(x)?.elementToolStateStore),UJ=O(()=>j(x)?.assessmentId??""),Dj=O(()=>Sj()||j($0)?.itemId||""),C0=O(()=>j($0)?.canonicalItemId||j(Dj)),d0=O(()=>Tj()||j(x)?.sectionId||""),r0=O(()=>Cj()||j($0)?.contentKind||(v0()==="section"?"section":"assessment-item")),b=O(()=>{if(v0()&&v0()!=="item")return v0();if(j(r0)==="rubric-block-stimulus")return"passage";return"item"}),y0=O(()=>{if(Kj())return Kj();if(j(b)==="section")return j(d0)||j(x)?.sectionId||"default-section";if(j(b)==="assessment")return j(x)?.assessmentId||"default-assessment";return j(C0)||j(Dj)||"default-item"}),XZ=O(()=>fj()||j(y0)),k0=O(()=>yj()||j($0)?.item||null),i=O(()=>{if(Lj())return Lj();return j(a0),j(x)?.toolkitCoordinator?.getToolRegistry?.()||KZ}),YZ=O(()=>tJ(Ij())),VZ=O(()=>j(i).normalizeToolIds(j(YZ)).filter(Boolean)),KJ=O(()=>{if(j(b)==="section")return"section";if(j(b)==="passage"||j(r0)==="rubric-block-stimulus")return"passage";return"item"}),QJ=O(()=>{j(a0);let J=j(x)?.toolkitCoordinator;if(!J||typeof J.decideToolPolicy!=="function")return null;return J.decideToolPolicy({level:j(KJ),scope:{level:j(b),scopeId:j(y0),assessmentId:j(x)?.assessmentId,sectionId:j(d0)||void 0,itemId:j(Dj)||void 0,canonicalItemId:j(C0)||void 0,contentKind:j(r0)}})}),DZ=pJ(),Oj=O(()=>DZ(j(QJ),j(_j))),Gj=O(()=>{let J=(Z)=>Array.from(new Set(Z));if(j(Oj))return J(j(i).normalizeToolIds(j(Oj).map((Z)=>Z.toolId)).filter(Boolean));return J(j(VZ))});Z0(()=>{if(!j(QJ)||j(Gj).length===0)return;if(j(i).getAllTools().length>0)return;let J=j(D0)?.ownerDocument,Z=j(Gj).join(", "),U=setTimeout(()=>{oJ(J,"toolbarWithoutRegistry",`[pie-item-toolbar] Policy places ${Z} on this toolbar, but its tool registry is still empty after ${tj/1000} s, so it renders no buttons. Pass a toolRegistry to <pie-assessment-toolkit> or its coordinator; @pie-players/pie-default-tool-loaders builds the stock one. Reported once per page.`)},tj);return()=>clearTimeout(U)});let OZ=O(()=>{let J=new Set;if(!j(Oj))return J;for(let Z of j(Oj)){if(!Z.required&&!Z.alwaysAvailable)continue;for(let U of j(i).normalizeToolIds([Z.toolId]).filter(Boolean))J.add(U)}return J}),gj=O(()=>{if(j(b)==="section"||j(b)==="assessment")return!0;let J=j(k0)?.config;return!!(j(k0)&&J&&typeof J==="object")}),GZ=O(()=>{j(a0);let J=j(x)?.toolkitCoordinator;if(!J||typeof J.getPolicyInputs!=="function")return null;return J.getPolicyInputs()}),m0=O(()=>j(GZ)?.assessment??null),Nj=O(()=>({id:j(C0)})),b0=O(()=>{if(j(b)==="section")return{level:"section",assessment:j(m0)||{},section:{}};if(j(b)==="assessment")return{level:"assessment",assessment:j(m0)||{}};if(!j(gj)||!j(k0))return null;if(j(b)==="passage")return{level:"passage",assessment:j(m0)||{},itemRef:j(Nj),passage:j(k0)};return{level:"item",assessment:j(m0)||{},itemRef:j(Nj),item:j(k0)}}),LJ=O(()=>{if(j(b0))return j(b0);return{level:"item",assessment:j(m0)||{},itemRef:j(Nj),item:j(k0)||{id:j(C0),config:{}}}}),Mj=O(()=>{if(j(b)!=="item"&&j(b)!=="passage")return[];if(!j(gj)||!j(k0))return[];let J=j(k0)?.config?.models;return(Array.isArray(J)?J:J&&typeof J==="object"?Object.values(J):[]).filter((U)=>U&&typeof U==="object"&&typeof U.id==="string").map((U)=>({level:"element",assessment:j(m0)||{},itemRef:j(Nj),item:j(k0),elementId:U.id}))});function $j(J){return rJ(J,j(b),j(y0))}let l0=null;function XJ(J,Z){let U=$j(Z);if(!J.getToolState(U)){if(J.registerTool(U,Z),l0?.coordinator!==J)l0={coordinator:J,ids:new Set};l0.ids.add(U)}return U}Z0(()=>{return j(P0),j(b),j(y0),()=>{let J=l0;if(l0=null,!J)return;for(let Z of J.ids)J.coordinator.releaseTool(Z)}});function NZ(J){if(!j(vj)||!j(UJ)||!j(d0)||!j(C0))return null;return j(vj).getGlobalElementId(j(UJ),j(d0),j(C0),J)}function MZ(){if(Qj())return Qj();return j($0)?.scopeElement||null}function YJ(){let J=j(P0)||null;return{scope:{level:j(b),scopeId:j(y0),assessmentId:j(x)?.assessmentId,sectionId:j(d0),itemId:j(Dj),canonicalItemId:j(C0),contentKind:j(r0)},itemId:j(y0),catalogId:j(XZ),language:j(QZ),i18n:j(Vj),ui:{size:Yj()},getScopeElement:MZ,getGlobalElementId:NZ,toolCoordinator:J,toolkitCoordinator:j(x)?.toolkitCoordinator||null,ttsService:j(LZ)||null,elementToolStateStore:j(vj)||null,toggleTool:(Z)=>{if(!J)return;J.toggleTool(XJ(J,Z))},isToolVisible:(Z)=>J?.isToolVisible($j(Z))??!1,subscribeVisibility:J?(Z)=>J.subscribe(Z):null}}let PZ=O(YJ),mj=O(()=>{j(Ej);let J=j(x)?.toolkitCoordinator;if(!J||typeof J.hasToolContextResolver!=="function"||typeof J.resolveToolContext!=="function")return{};let Z={};for(let U of j(Gj)){if(!j(i).get(U)?.supportedLevels.includes(j(b)))continue;if(!J.hasToolContextResolver(U))continue;let q=J.resolveToolContext({toolId:U,context:j(LJ),toolbarContext:j(PZ)});if(q)Z[U]=q}return Z}),qZ=O(()=>{let J=j(Gj).filter((X)=>{let G=j(i).get(X);return G?G.supportedLevels.includes(j(b)):!1}),Z=Object.values(j(mj)),U=new Set(Z.map((X)=>X.toolId)),Q=new Set(Z.filter((X)=>X.visible).map((X)=>X.toolId)),q=J.filter((X)=>!U.has(X));if(j(b)==="section")return q.forEach((X)=>Q.add(X)),Array.from(Q);if(!j(gj))return q.forEach((X)=>Q.add(X)),Array.from(Q);if(!j(b0)&&j(Mj).length===0)return q.forEach((X)=>Q.add(X)),Array.from(Q);if(q.filter((X)=>j(OZ).has(X)).forEach((X)=>Q.add(X)),j(b0))j(i).filterVisibleInContext(q,j(b0)).forEach((X)=>Q.add(X.toolId));for(let X of j(Mj))j(i).filterVisibleInContext(q,X).forEach((G)=>Q.add(G.toolId));let S=j(b0)?[j(b0),...j(Mj)]:j(Mj);for(let X of Array.from(Q)){if(U.has(X))continue;if(!j(i).isApplicableToAnyContext(X,S))Q.delete(X)}return Array.from(Q)}),o0=R0(null),n0=O(()=>{let J=j(o0)?.registry===j(i)?j(o0).toolIds:null,Z=j(i).filterToolIdsByActivation(j(qZ),"toolbar-toggle");return J?Z.filter((U)=>!J.has(U)):Z});function FZ(J,Z){let U=j(x)?.toolkitCoordinator;if(typeof U?.reportToolModuleFailure==="function"){U.reportToolModuleFailure(J,Z);return}console.error(`[ItemToolBar] Tool "${J}" failed to load:`,Z)}Z0(()=>{if(!v)return;let J=j(i),Z=!1;return J.ensureToolModulesLoaded(j(n0)).then((U)=>{if(U.size>0){let Q=j(o0)?.registry===J?j(o0).toolIds:[];V0(o0,{registry:J,toolIds:new Set([...Q,...U.keys()])},!0);for(let[q,S]of U)FZ(q,S)}if(!Z)V0(i0,j(i0)+1)}),()=>{Z=!0}});let p0=O(()=>{return{...YJ(),getResolvedToolContext:(J)=>j(mj)[J]??null,getToolRenderParams:(J)=>{let Z=j(mj)[J]?.params??null,U=VJ.get(J);if(!U)return Z;return{...Z??{},...U}}}}),VJ=new Map,DJ=0,z0=O(()=>{if(!v)return[];j(i0);let J=[];for(let Z of j(n0)){let U=j(i).renderForToolbar(Z,j(LJ),j(p0));if(U)J.push(U)}return J}),RZ=O(()=>{if(!Array.isArray(Xj()))return[];let J=[];return Xj().forEach((Z,U)=>{if(CJ(Z)){J.push(Z);return}console.warn(`[ItemToolBar] Ignoring invalid host button at index ${U}. Expected { id, label, href | onClick } with valid types.`)}),J}),WZ=O(()=>j(z0).filter((J)=>!!J.button).map((J)=>{let Z=J.button;return{id:J.toolId,label:Z.label,ariaLabel:Z.ariaLabel||Z.label,icon:Z.icon,faIconName:Z.faIconName,tooltip:Z.tooltip||Z.label,disabled:Z.disabled,active:j(I0)[J.toolId]??Z.active??!1,onClick:()=>{Z.onClick(),h0()}}})),OJ=O(()=>[...j(WZ),...j(RZ)]),t0=O(()=>{let J={};for(let Z of j(z0))J[Z.toolId]=j(I0)[Z.toolId]??Z.button?.active??!1;return J}),kZ=O(()=>j(z0).flatMap((J)=>(J.elements||[]).filter((Z)=>Z.mount==="before-buttons").filter((Z)=>Boolean(Z.element)).map((Z,U)=>({key:`before-${J.toolId}-${U}`,toolId:J.toolId,entry:Z})))),zZ=O(()=>j(z0).flatMap((J)=>(J.elements||[]).filter((Z)=>Z.mount==="after-buttons").filter((Z)=>Boolean(Z.element)).map((Z,U)=>({key:`after-${J.toolId}-${U}`,toolId:J.toolId,entry:Z})))),GJ=O(()=>j(z0).flatMap((J)=>(J.elements||[]).filter((Z)=>Z.mount==="controls-row").filter((Z)=>Boolean(Z.element)).map((Z,U)=>({key:`controls-row-${J.toolId}-${U}`,toolId:J.toolId,entry:Z})))),NJ=O(()=>j(z0).flatMap((J)=>(J.elements||[]).map((Z)=>({toolId:J.toolId,hint:Z.layoutHints?.controlsRow})).filter((Z)=>Boolean(Z.hint)))),MJ=O(()=>j(z0).flatMap((J)=>(J.elements||[]).map((Z)=>({toolId:J.toolId,hint:Z.layoutHints?.headerOverlay})).filter((Z)=>Boolean(Z.hint)))),PJ=O(()=>j(NJ).some((J)=>J.hint?.reserveSpace===!0)),qJ=O(()=>j(NJ).some((J)=>J.hint?.showWhenToolActive===!0&&(j(t0)[J.toolId]??!1))),HZ=O(()=>x0()==="left"||x0()==="right"),FJ=O(()=>j(MJ).some((J)=>J.hint?.showWhenToolActive===!0&&(j(t0)[J.toolId]??!1))),wZ=O(()=>j(GJ).length>0||j(PJ)||j(qJ));function BZ(){if(!j(D0))return null;let J=j(D0).getRootNode();if(J instanceof ShadowRoot)return J.host;return null}Z0(()=>{let J=BZ();if(!J)return;let Z=j(MJ).length>0,U=j(FJ);return J.setAttribute("data-pie-header-overlay",Z?"true":"false"),J.setAttribute("data-pie-header-overlay-active",U?"true":"false"),()=>{J.removeAttribute("data-pie-header-overlay"),J.removeAttribute("data-pie-header-overlay-active")}}),Z0(()=>{if(!v||!j(g0))return;if(j(OJ).some((J)=>!!ZJ(J)))Aj()});function Pj(J){if(J.id in j(I0))return j(I0)[J.id]===!0;return J.active===!0}function RJ(J){return yJ(J)}function h0(){let J={};for(let Z of j(z0))if(Z.sync?.(),Z.button)J[Z.toolId]=Z.button.active??!1;V0(I0,J,!0)}Z0(()=>{let J=[];h0();for(let Z of j(z0))if(Z.subscribeActive){let U=!1,Q=Z.subscribeActive((q)=>{queueMicrotask(()=>{if(U)return;V0(I0,{...j(I0),[Z.toolId]:q},!0),Z.sync?.()})});J.push(()=>{U=!0,Q()})}return()=>{J.forEach((Z)=>Z())}}),Z0(()=>{let J=j(x)?.toolkitCoordinator;if(typeof J?.registerToolRequestTarget!=="function")return;let Z=j(KJ);return J.registerToolRequestTarget({level:Z,get scopeId(){return j(y0)},hostsTool:(U)=>j(n0).includes(U),open:(U,Q)=>{if(!j(P0))return;if(!j(n0).includes(U))return;if(Q&&Object.keys(Q).length>0)DJ+=1,VJ.set(U,{...Q,toolRequestId:DJ});let q=XJ(j(P0),U);j(P0).showTool(q),queueMicrotask(()=>h0())}})}),Z0(()=>{if(!j(p0).subscribeVisibility)return;let J=!1,Z=j(p0).subscribeVisibility(()=>{queueMicrotask(()=>{if(J)return;h0()})});return()=>{J=!0,Z?.()}}),Z0(()=>{let J=j(p0).toolkitCoordinator;if(typeof J?.subscribeTelemetry!=="function")return;let Z=!1,U=J.subscribeTelemetry(({eventName:Q,payload:q})=>{if(Q!=="pie-toolkit-tool-config-updated")return;if(q?.toolId&&!j(n0).includes(q.toolId))return;queueMicrotask(()=>{if(Z)return;V0(i0,j(i0)+1),h0()})});return()=>{Z=!0,U?.()}});let xZ="[data-pie-tool-overlay-boundary]";function AZ(J,Z){if(Z.container!=="content-boundary")return J;let U=J;while(U){if(U instanceof HTMLElement&&U.matches(xZ))return U;if(U instanceof HTMLElement&&U.parentElement){U=U.parentElement;continue}let Q=U.getRootNode();U=Q instanceof ShadowRoot?Q.host:null}return J}function hj(J,Z){let U=Z,Q=null,q=J,S=(G)=>{if(!G)return;let a=G.__pieToolElementUnmount;if(typeof a==="function")a()},X=(G)=>{if(Q===G)return;if(Q){if(S(Q),Q.parentNode===q)q.removeChild(Q)}if(Q=G,Q){if(q=AZ(J,U),Q.parentNode&&Q.parentNode!==q)Q.parentNode.removeChild(Q);q.appendChild(Q)}};return X(Z.element),{update(G){U=G,X(G.element)},destroy(){X(null)}}}function uj(J,Z){let U=Z,Q=null,q=null,S=[],X=null,G=null,a=null,k=null,D=null,t=null,e=null,m=!1,d=!1,y=()=>U.mounted.entry.shell?.pageTabOrder===!0,A=()=>U.mounted.entry.shell?.ndsHeaderControls===!0,z=null,T=null,s=iZ({onMove:(K)=>gZ(K),onEnd:()=>{T=null}}),p=0,W=0,w=0,g=0,q0=0,h=0,O0=0,_0=0,H0=null,E0=[],_=0,E=0,f=U.mounted.entry.shell?.initialWidth??720,R=U.mounted.entry.shell?.initialHeight??560,I=f,A0=R,w0=!1,F0=null,j0=null,u=!1,r=(K)=>{if(!K)return;let Y=K.__pieToolElementUnmount;if(typeof Y==="function")Y()},cj=()=>{let K=U.mounted.entry.shell;if(!K)return null;return{toolId:U.mounted.toolId,toolbarContext:j(p0),shellConfig:K}},IZ=(K)=>{let Y=j(i).get(U.mounted.toolId),N=cj();if(!Y?.onHostedMount||!N)return;Y.onHostedMount(K,N)},qj=()=>{let K=j(i).get(U.mounted.toolId),Y=cj();if(!K?.onHostedResize||!Y)return;K.onHostedResize({width:f,height:R},U.mounted.entry.element,Y)},CZ=()=>{let K=j(i).get(U.mounted.toolId),Y=cj();if(!K?.onHostedUnmount||!Y)return;K.onHostedUnmount(U.mounted.entry.element,Y)},J0=(K,Y,N)=>Math.max(Y,Math.min(K,N)),yZ=()=>{let K=U.mounted.entry.shell,Y=K?.minWidth??320,N=K?.minHeight??240,V=K?.maxWidth??window.innerWidth,L=K?.maxHeight??window.innerHeight;return{minWidth:Y,minHeight:N,maxWidth:V,maxHeight:L}},sj=()=>{let K=U.mounted.entry.shell?.minWidth,Y=typeof K==="number"&&K>0&&f<K,N=Y?`${K}px`:"";if(z)z.style.minWidth=N;if(X)X.style.minWidth="0";if(G)G.style.minWidth="0",G.style.overflowX=Y?"auto":"hidden"},kJ=()=>U.mounted.entry.shell?.content?.overflowY==="auto"?"auto":"hidden",bZ=()=>{if(!X)return 0;let K=X.getBoundingClientRect().height;if(K>0)return K;return X.offsetHeight||0},ij=()=>{if(!G)return;let K=U.mounted.entry.shell;if(G.style.overflowY=kJ(),!z)return;if(K?.content?.preserveMinHeight===!0){let Y=bZ(),N=K.minHeight??240,V=Math.max(0,N-Y),L=Math.max(0,R-Y),M=Math.max(L,V);z.style.height=`${M}px`,z.style.minHeight="0",z.style.flex=`0 0 ${M}px`;return}z.style.height="100%",z.style.minHeight="0",z.style.flex="1 1 auto"},pZ=()=>{let K=U.mounted.entry.shell,Y=K?.initialWidth??720,N=K?.initialHeight??560;if(Y===I&&N===A0)return;if(I=Y,A0=N,w0)return;f=Y,R=N,Wj()},Fj=()=>{let{minWidth:K,minHeight:Y,maxWidth:N,maxHeight:V}=yZ(),L=Math.min(K,window.innerWidth),M=Math.min(Y,window.innerHeight);f=J0(f,L,Math.max(L,Math.min(N,window.innerWidth))),R=J0(R,M,Math.max(M,Math.min(V,window.innerHeight))),_=J0(_,0,Math.max(0,window.innerWidth-f)),E=J0(E,0,Math.max(0,window.innerHeight-R)),e0(),sj(),ij(),qj()},S0=(K,Y)=>{w0=!0,_+=K,E+=Y,Fj()},Rj=(K,Y)=>{w0=!0,f+=K,R+=Y,Fj()},zJ=(K,Y,N,V="fa-regular")=>{let L=document.createElement("nds-icon-button");if(L.setAttribute("variant","tertiary"),L.setAttribute("size","small"),L.setAttribute("type","circle"),L.setAttribute("icon-name",Y),L.setAttribute("button-aria-label",K),L.title=K,L.addEventListener("click",(M)=>{M.stopPropagation(),N(),u0()}),V!=="fa-light"){let M=(C)=>{C.classList.remove("fa-light"),C.classList.add(V)},P=L.querySelector("i.fa-light");if(P)M(P);else{let C=new MutationObserver(()=>{let c=L.querySelector("i.fa-light");if(c)M(c),C.disconnect()});C.observe(L,{childList:!0,subtree:!0})}}return L},HJ=(K,Y,N)=>{let V=document.createElement("button");return V.type="button",V.className="pie-tool-shell__control",V.setAttribute("aria-label",K),V.title=K,V.textContent=Y,V.style.border="1px solid transparent",V.style.background="color-mix(in srgb, var(--pie-white, #fff) 10%, transparent)",V.style.color="inherit",V.style.cursor="pointer",V.style.display="inline-flex",V.style.alignItems="center",V.style.justifyContent="center",V.style.width="28px",V.style.height="28px",V.style.padding="0",V.style.fontSize="14px",V.style.fontWeight="700",V.style.borderRadius="8px",V.style.lineHeight="1",V.onclick=(L)=>{L.stopPropagation(),N(),u0()},V.onfocus=()=>{V.style.outline="2px solid var(--pie-button-focus-outline, var(--pie-primary, #4A90E2))",V.style.outlineOffset="2px"},V.onblur=()=>{V.style.outline="none",V.style.outlineOffset="0"},V},e0=()=>{if(!Q)return;Q.style.left=`${_}px`,Q.style.top=`${E}px`,Q.style.width=`${f}px`,Q.style.height=`${R}px`,Q.style.display=U.active?"flex":"none"},wJ=()=>{if(a)a.textContent=U.mounted.entry.shell?.title||U.mounted.toolId;for(let{el:K,key:Y}of S){let N=U.i18n.t(Y);if(K.tagName==="NDS-ICON-BUTTON")K.setAttribute("button-aria-label",N);else K.setAttribute("aria-label",N);if(K.title)K.title=N}},BJ=()=>{if(!G)return;let K=U.mounted.entry.element;if(K.style.display="block",K.style.width="100%",K.style.height="100%",K.style.flex="1 1 auto",K.style.minHeight="0",z&&z!==K){if(z.parentNode===G)r(z),G.removeChild(z);z=null}if(K.parentNode&&K.parentNode!==G)K.parentNode.removeChild(K);if(K.parentNode!==G)G.appendChild(K);z=K,sj(),ij(),IZ(K)},u0=()=>{if(j(P0)&&Q)j(P0).bringToFront(Q)},xJ=()=>{if(!Q||!j(P0)||!U.active)return;let K=$j(U.mounted.toolId);if(j(P0).getToolState(K)?.element===Q)return;j(P0).updateToolElement(K,Q)},Wj=()=>{let{innerWidth:K,innerHeight:Y}=window,N=U.mounted.entry.shell,V=N?.initialAlign??"center",L=N?.initialMargin??16,M=L+60;switch(V){case"top-left":_=L,E=M;break;case"top-right":_=Math.max(0,K-f-L),E=M;break;case"bottom-left":_=L,E=Math.max(0,Y-R-M);break;case"bottom-right":_=Math.max(0,K-f-L),E=Math.max(0,Y-R-M);break;default:_=Math.max(0,Math.round((K-f)/2)),E=Math.max(0,Math.round((Y-R)/2))}Fj()},_Z=()=>{let K=j0;if(!K)return;queueMicrotask(()=>{if(!K.isConnected)return;try{K.focus()}catch{}})},AJ=()=>{if(typeof document>"u")return null;let K=document.activeElement;while(K){let Y=K.shadowRoot;if(Y&&Y.activeElement&&Y.activeElement!==K)K=Y.activeElement;else break}return K??null},SJ=()=>{if(!Q||F0)return;let K=AJ();if(!j0&&K&&!Q.contains(K))j0=K;if(y()&&!d)document.addEventListener("keydown",dj,!0),d=!0;F0=sZ(Q,{initialFocus:D,onEscape:()=>{rj()},wrap:!y(),onTabExit:y()?(Y,N)=>{if(Y==="backward"){if(j0?.isConnected){N.preventDefault();try{j0.focus()}catch{}}return}let V=aj();if(V){N.preventDefault();try{V.focus()}catch{}}}:void 0})},aj=()=>{let K=j(p0).getScopeElement?.()??null;if(!K)return null;let Y=(V)=>{if(j(D0)&&j(D0).contains(V))return!0;if(Q&&Q.contains(V))return!0;return!1},N=(V)=>{if(V instanceof HTMLElement){if(Y(V))return null;if(V.matches?.(aZ)&&dZ(V))return V}let L=V.shadowRoot;if(L)for(let M=0;M<L.children.length;M++){let P=N(L.children[M]);if(P)return P}for(let M=0;M<V.children.length;M++){let P=N(V.children[M]);if(P)return P}return null};return N(K)},EZ=()=>{if(!Q)return[];return cZ(Q).filter((K)=>K!==t&&K!==e)},dj=(K)=>{if(K.key!=="Tab")return;if(!Q||!U.active)return;let Y=AJ();if(!Y)return;if(Q.contains(Y))return;let N=EZ();if(N.length===0)return;if(K.shiftKey){let V=aj();if(Y!==V)return;K.preventDefault();try{N[N.length-1].focus()}catch{}return}if(Y!==j0)return;K.preventDefault();try{N[0].focus()}catch{}},TJ=()=>{if(d)document.removeEventListener("keydown",dj,!0),d=!1;if(!F0)return;let K=F0;F0=null;try{K()}catch{}_Z()},rj=()=>{j(p0).toggleTool(U.mounted.toolId),h0()},fJ=(K)=>{if(!U.mounted.entry.shell?.draggable)return;if(K.target.closest("button")||!Q)return;if(!s.begin(K,Q))return;T="drag",w0=!0,p=K.clientX-_,W=K.clientY-E,Q.setPointerCapture(K.pointerId),u0()},vZ=(K)=>(Y)=>{if(!Q||!U.mounted.entry.shell?.resizable)return;if(Y.stopPropagation(),!s.begin(Y,Q))return;T="resize",w0=!0,H0=K,w=f,g=R,q0=Y.clientX,h=Y.clientY,O0=_,_0=E,Q.setPointerCapture(Y.pointerId),u0()},gZ=(K)=>{if(!Q)return;if(T==="drag"){K.preventDefault();let Y=Math.max(0,window.innerWidth-f),N=Math.max(0,window.innerHeight-R);_=J0(K.clientX-p,0,Y),E=J0(K.clientY-W,0,N),e0();return}if(T==="resize"){K.preventDefault();let Y=U.mounted.entry.shell,N=Y?.minWidth??320,V=Y?.minHeight??240,L=Math.min(N,window.innerWidth),M=Math.min(V,window.innerHeight),P=Y?.maxWidth??window.innerWidth,C=Y?.maxHeight??window.innerHeight,c=K.clientX-q0,K0=K.clientY-h;if(H0==="se")f=J0(w+c,L,Math.max(L,Math.min(P,window.innerWidth-_))),R=J0(g+K0,M,Math.max(M,Math.min(C,window.innerHeight-E)));else if(H0==="sw"){let n=O0+w,G0=J0(w-c,L,Math.min(P,n));_=n-G0,f=G0,R=J0(g+K0,M,Math.max(M,Math.min(C,window.innerHeight-E)))}else if(H0==="ne"){let n=_0+g;f=J0(w+c,L,Math.max(L,Math.min(P,window.innerWidth-_)));let G0=J0(g-K0,M,Math.min(C,n));E=n-G0,R=G0}else if(H0==="nw"){let n=O0+w,G0=_0+g,$=J0(w-c,L,Math.min(P,n));_=n-$,f=$;let jj=J0(g-K0,M,Math.min(C,G0));E=G0-jj,R=jj}e0(),sj(),ij(),qj()}},IJ=()=>{Fj()};if(v&&U.mounted.entry.shell){let K=U.mounted.entry.shell?.ndsHeaderControls===!0&&j(g0);if(K)Aj();if(Q=document.createElement("div"),Q.className="pie-tool-shell",Q.setAttribute("data-pie-tool-shell",U.mounted.toolId),Q.style.position="fixed",Q.style.zIndex=String(lJ.TOOL),Q.style.background="var(--pie-background, #fff)",Q.style.border="1px solid var(--pie-border-light, #d1d5db)",Q.style.borderRadius="12px",Q.style.boxShadow="0 10px 40px color-mix(in srgb, var(--pie-black, #000) 25%, transparent)",Q.style.setProperty("--color-interactive-blue","var(--pie-calculator-button-color, var(--pie-button-color, var(--pie-text, #222)))"),Q.style.setProperty("--color-new-gray","var(--pie-background-dark, #f3f5f7)"),Q.style.setProperty("--color-primary-white","var(--pie-white, #ffffff)"),Q.style.setProperty("--color-primary-black","var(--pie-text, #000000)"),Q.style.setProperty("--color-focus-blue","var(--pie-button-focus-outline, #2b87ff)"),Q.style.overflow="visible",Q.style.display=U.active?"flex":"none",Q.style.flexDirection="column",Q.style.userSelect="none",Q.style.webkitUserSelect="none",Q.style.touchAction="none",Q.setAttribute("draggable","false"),Q.addEventListener("dragstart",(L)=>L.preventDefault()),X=document.createElement("div"),X.className="pie-tool-shell__header",X.style.display="flex",X.style.flexWrap="wrap",X.style.alignItems="center",X.style.justifyContent="space-between",X.style.gap="6px",X.style.padding=A()?"12px 12px 12px 28px":"10px 12px",A())X.style.minHeight="48px";if(A())X.style.background="var(--pie-section-player-card-header-background, var(--pie-button-active-bg, #f3f4f6))",X.style.color="var(--pie-text, #111827)",X.style.borderBottom="1px solid var(--pie-border-light, #e5e7eb)";else X.style.background="var(--pie-primary-dark, #2c3e50)",X.style.color="var(--pie-white, #fff)";X.style.cursor=U.mounted.entry.shell.draggable===!1?"default":"move",X.style.flex="0 0 auto",X.style.borderRadius="12px 12px 0 0",X.style.overflow="hidden",X.style.userSelect="none",X.style.webkitUserSelect="none",X.style.touchAction="none",X.setAttribute("draggable","false"),X.addEventListener("dragstart",(L)=>L.preventDefault()),a=document.createElement("span"),a.className="pie-tool-shell__title",a.style.minWidth="0",a.style.overflowWrap="anywhere",a.textContent=U.mounted.entry.shell.title||U.mounted.toolId,X.appendChild(a),k=document.createElement("div"),k.className="pie-tool-shell__controls",k.style.display="inline-flex",k.style.flexWrap="wrap",k.style.minWidth="0",k.style.alignItems="center",k.style.gap=A()?"6px":"4px";let Y=U.mounted.entry.shell,N=(L,M,P,C,c="fa-regular")=>{if(!k)return;let K0=U.i18n.t(L),n=K?zJ(K0,P,C,c):HJ(K0,M,C);S.push({el:n,key:L}),k.appendChild(n)};if(Y?.draggable!==!1)N("toolkit.window.moveLeftA11y","←","chevron-left",()=>S0(-24,0)),N("toolkit.window.moveRightA11y","→","chevron-right",()=>S0(24,0)),N("toolkit.window.moveUpA11y","↑","chevron-up",()=>S0(0,-24)),N("toolkit.window.moveDownA11y","↓","chevron-down",()=>S0(0,24));if(Y?.resizable!==!1)N("toolkit.window.shrinkA11y","−","magnifying-glass-minus",()=>Rj(-40,-40)),N("toolkit.window.growA11y","+","magnifying-glass-plus",()=>Rj(40,40));if(!A()){let L=HJ(U.i18n.t("toolkit.window.centerA11y"),"◎",Wj);S.push({el:L,key:"toolkit.window.centerA11y"}),k.appendChild(L)}let V=null;if(A())V=document.createElement("div"),V.className="pie-tool-shell__header-right",V.style.display="inline-flex",V.style.flexWrap="wrap",V.style.maxWidth="100%",V.style.justifyContent="flex-end",V.style.alignItems="center",V.style.gap="6px",V.appendChild(k),X.appendChild(V);else X.appendChild(k);if(K)D=zJ(U.i18n.t("toolkit.window.closeA11y"),"xmark",rj,"fa-regular"),S.push({el:D,key:"toolkit.window.closeA11y"}),D.style.display=U.mounted.entry.shell.closeable===!1?"none":"inline-block";else{let L=document.createElement("button");L.type="button",L.className="pie-tool-shell__close",L.setAttribute("aria-label",U.i18n.t("toolkit.window.closeA11y")),S.push({el:L,key:"toolkit.window.closeA11y"});let M="http://www.w3.org/2000/svg",P=document.createElementNS(M,"svg");P.setAttribute("xmlns",M),P.setAttribute("viewBox","0 0 16 16"),P.setAttribute("aria-hidden","true");let C=document.createElementNS(M,"path");C.setAttribute("d","M3.5 3.5L12.5 12.5M12.5 3.5L3.5 12.5"),C.setAttribute("stroke","currentColor"),C.setAttribute("stroke-width","1.8"),C.setAttribute("stroke-linecap","round"),P.appendChild(C),L.appendChild(P);let c=P.style;c.width="16px",c.height="16px",c.display="block",c.flexShrink="0",c.pointerEvents="none";let K0="color-mix(in srgb, var(--pie-white, #fff) 8%, transparent)",n="color-mix(in srgb, var(--pie-white, #fff) 18%, transparent)";L.style.border="1px solid transparent",L.style.background=K0,L.style.color="inherit",L.style.cursor="pointer",L.style.display="inline-flex",L.style.alignItems="center",L.style.justifyItems="center",L.style.width="28px",L.style.height="28px",L.style.padding="0",L.style.borderRadius="8px",L.style.lineHeight="0",L.style.transition="background-color 0.15s ease, border-color 0.15s ease",L.style.display=U.mounted.entry.shell.closeable===!1?"none":"inline-flex",L.onmouseenter=()=>{L.style.background=n},L.onmouseleave=()=>{L.style.background=K0},L.onfocus=()=>{L.style.outline="2px solid var(--pie-button-focus-outline, var(--pie-primary, #4A90E2))",L.style.outlineOffset="2px"},L.onblur=()=>{L.style.outline="none",L.style.outlineOffset="0"},L.onclick=rj,D=L}if(V)V.appendChild(D);else X.appendChild(D);if(X.tabIndex=0,X.onkeydown=(L)=>{if(L.key==="Home"){L.preventDefault(),Wj();return}let M=U.mounted.entry.shell;if(L.shiftKey&&M?.resizable!==!1){if(L.key==="ArrowRight"||L.key==="ArrowDown"){L.preventDefault(),Rj(40,40);return}if(L.key==="ArrowLeft"||L.key==="ArrowUp"){L.preventDefault(),Rj(-40,-40);return}}if(M?.draggable!==!1){if(L.key==="ArrowLeft")L.preventDefault(),S0(-24,0);else if(L.key==="ArrowRight")L.preventDefault(),S0(24,0);else if(L.key==="ArrowUp")L.preventDefault(),S0(0,-24);else if(L.key==="ArrowDown")L.preventDefault(),S0(0,24)}},G=document.createElement("div"),G.className="pie-tool-shell__content",G.style.position="relative",G.style.width="100%",G.style.flex="1 1 auto",G.style.minHeight="0",G.style.overflowX="hidden",G.style.overflowY=kJ(),G.style.borderRadius="0 0 12px 12px",A()){let L=(M)=>{let P=document.createElement("div");return P.tabIndex=0,P.setAttribute("aria-hidden","true"),P.setAttribute("data-pie-tool-shell-focus-guard",M),P.style.position="absolute",P.style.width="1px",P.style.height="1px",P.style.padding="0",P.style.margin="-1px",P.style.overflow="hidden",P.style.clipPath="inset(50%)",P.style.whiteSpace="nowrap",P.style.border="0",P};t=L("start"),e=L("end"),t.addEventListener("focus",(M)=>{if(m)return;m=!0;try{if(M.stopPropagation(),j0?.isConnected)try{j0.focus()}catch{}}finally{queueMicrotask(()=>{m=!1})}}),e.addEventListener("focus",(M)=>{if(m)return;m=!0;try{M.stopPropagation();let P=aj();if(P)try{P.focus()}catch{}}finally{queueMicrotask(()=>{m=!1})}}),Q.appendChild(t)}if(Q.appendChild(X),Q.appendChild(G),A()&&e)Q.appendChild(e);if(U.mounted.entry.shell.resizable!==!1){let L=(M,P,C,c,K0,n,G0)=>{let $=document.createElement("div");if($.className="pie-tool-shell__resize",$.style.position="absolute",$.style.width="24px",$.style.height="24px",$.style.cursor=n,$.style.zIndex="10",$.style.touchAction="none",$.setAttribute("draggable","false"),P!==null)$.style.top=P;if(C!==null)$.style.right=C;if(c!==null)$.style.bottom=c;if(K0!==null)$.style.left=K0;if(G0!==null)$.style.background=`linear-gradient(${G0}, transparent 0%, transparent 40%, rgba(0,0,0,0.35) 40%, rgba(0,0,0,0.35) 60%, transparent 60%, transparent 100%)`;let jj=vZ(M);$.addEventListener("pointerdown",jj),Q.appendChild($),E0.push({el:$,handler:jj})};L("se",null,"0","0",null,"nwse-resize",null),L("nw","0",null,null,"0","nwse-resize","135deg"),L("ne","0","0",null,null,"nesw-resize",null),L("sw",null,null,"0","0","nesw-resize",null)}if(X.addEventListener("pointerdown",fJ),Q.addEventListener("pointerdown",u0),window.addEventListener("resize",IJ),document.body.appendChild(Q),q=new hZ(Q,{context:iJ,initialValue:U.runtime}),q.connect(),Wj(),e0(),xJ(),wJ(),BJ(),qj(),U.active)SJ();u=U.active}return{update(K){if(U=K,!Q||!G||!a||!D)return;q?.setValue(U.runtime),wJ(),pZ();let Y=D.tagName.toLowerCase()==="nds-icon-button"?"inline-block":"inline-flex";if(D.style.display=U.mounted.entry.shell?.closeable===!1?"none":Y,e0(),xJ(),BJ(),qj(),!u&&U.active)SJ();else if(u&&!U.active)TJ(),j0=null;u=U.active},destroy(){if(CZ(),q?.disconnect(),q=null,S.length=0,F0)TJ();if(d)document.removeEventListener("keydown",dj,!0),d=!1;for(let{el:K,handler:Y}of E0)K.removeEventListener("pointerdown",Y);if(j0=null,E0.length=0,X)X.removeEventListener("pointerdown",fJ),X.onkeydown=null;if(s.release(),Q)Q.removeEventListener("pointerdown",u0);if(window.removeEventListener("resize",IJ),z&&G&&z.parentNode===G)r(z),G.removeChild(z);if(z=null,Q&&Q.parentElement)Q.remove()}}}var SZ={get level(){return v0()},set level(J){v0(J),l()},get scopeId(){return Kj()},set scopeId(J){Kj(J),l()},get itemId(){return Sj()},set itemId(J){Sj(J),l()},get sectionId(){return Tj()},set sectionId(J){Tj(J),l()},get catalogId(){return fj()},set catalogId(J){fj(J),l()},get tools(){return Ij()},set tools(J){Ij(J),l()},get contentKind(){return Cj()},set contentKind(J){Cj(J),l()},get position(){return x0()},set position(J){x0(J),l()},get scopeElement(){return Qj()},set scopeElement(J){Qj(J),l()},get toolRegistry(){return Lj()},set toolRegistry(J){Lj(J),l()},get item(){return yj()},set item(J){yj(J),l()},get hostButtons(){return Xj()},set hostButtons(J){Xj(J),l()},get class(){return bj()},set class(J){bj(J),l()},get size(){return Yj()},set size(J){Yj(J),l()},get language(){return pj()},set language(J){pj(J),l()}},WJ=X0(),TZ=Q0(WJ);{var fZ=(J)=>{var Z=tZ();let U;var Q=c0(Z),q=c0(Q);Zj(q,17,()=>j(kZ),(k)=>k.key,(k,D)=>{var t=X0(),e=Q0(t);{var m=(y)=>{var A=X0(),z=Q0(A);Bj(z,()=>j(g0),(T)=>{var s=zj();B0(s,(p,W)=>uj?.(p,W),()=>({mounted:j(D),active:j(t0)[j(D).toolId]??!1,runtime:j(x),i18n:j(Vj)})),H(T,s)}),H(y,A)},d=(y)=>{var A=zj();B0(A,(z,T)=>hj?.(z,T),()=>j(D).entry),H(y,A)};Y0(e,(y)=>{if(j(D).entry.shell)y(m);else y(d,-1)})}H(k,t)});var S=wj(q,2);Zj(S,17,()=>j(OJ),(k)=>k.id,(k,D,t,e)=>{let m=O(()=>j(g0)&&!lj(j(D))?ZJ(j(D)):null);var d=X0(),y=Q0(d);{var A=(p)=>{var W=rZ(),w=c0(W);T0(w,1,"item-toolbar__nds-button svelte-1c13522"),f0(w,"type","circle"),f0(w,"size","small"),f0(w,"variant","tertiary"),L0(()=>f0(w,"icon-name",j(m))),L0(()=>f0(w,"button-aria-label",j(D).ariaLabel||j(D).label)),L0(()=>f0(w,"title",j(D).tooltip||j(D).label)),L0(()=>f0(w,"disabled",j(D).disabled)),B0(w,(g)=>ZZ?.(g)),B0(w,(g,q0)=>UZ?.(g,q0),()=>Pj(j(D))),N0(W),Jj("click",w,function(...g){j(D).onClick?.apply(this,g)}),H(p,W)},z=(p)=>{var W=lZ();let w;var g=c0(W);{var q0=(h)=>{var O0=X0(),_0=Q0(O0);{var H0=(R)=>{var I=Hj();Uj(I,()=>kj(j(D).icon),!0),N0(I),H(R,I)},E0=O(()=>oj(j(D).icon)),_=(R)=>{var I=_J();L0(()=>U0(I,"src",j(D).icon)),H(R,I)},E=O(()=>nj(j(D).icon)),f=(R)=>{let I=O(()=>RJ(j(D).icon));var A0=X0(),w0=Q0(A0);{var F0=(u)=>{var r=Hj();Uj(r,()=>kj(j(I)),!0),N0(r),H(u,r)},j0=(u)=>{var r=EJ();L0(()=>T0(r,1,`icon icon-${j(D).icon}`,"svelte-1c13522")),H(u,r)};Y0(w0,(u)=>{if(j(I))u(F0);else u(j0,-1)})}H(R,A0)};Y0(_0,(R)=>{if(j(E0))R(H0);else if(j(E))R(_,1);else R(f,-1)})}H(h,O0)};Y0(g,(h)=>{if(j(D).icon)h(q0)})}N0(W),L0((h)=>{w=T0(W,1,"item-toolbar__button svelte-1c13522",null,w,{"item-toolbar__button--active":h}),U0(W,"href",j(D).disabled?void 0:j(D).href),U0(W,"target",j(D).target),U0(W,"rel",j(D).rel),U0(W,"aria-label",j(D).ariaLabel||j(D).label),U0(W,"title",j(D).tooltip||j(D).label),U0(W,"aria-disabled",j(D).disabled?"true":void 0)},[()=>Pj(j(D))]),Jj("click",W,(h)=>{if(j(D).disabled)h.preventDefault()}),H(p,W)},T=O(()=>lj(j(D))),s=(p)=>{var W=oZ();let w;var g=c0(W);{var q0=(h)=>{var O0=X0(),_0=Q0(O0);{var H0=(R)=>{var I=Hj();Uj(I,()=>kj(j(D).icon),!0),N0(I),H(R,I)},E0=O(()=>oj(j(D).icon)),_=(R)=>{var I=_J();L0(()=>U0(I,"src",j(D).icon)),H(R,I)},E=O(()=>nj(j(D).icon)),f=(R)=>{let I=O(()=>RJ(j(D).icon));var A0=X0(),w0=Q0(A0);{var F0=(u)=>{var r=Hj();Uj(r,()=>kj(j(I)),!0),N0(r),H(u,r)},j0=(u)=>{var r=EJ();L0(()=>T0(r,1,`icon icon-${j(D).icon}`,"svelte-1c13522")),H(u,r)};Y0(w0,(u)=>{if(j(I))u(F0);else u(j0,-1)})}H(R,A0)};Y0(_0,(R)=>{if(j(E0))R(H0);else if(j(E))R(_,1);else R(f,-1)})}H(h,O0)};Y0(g,(h)=>{if(j(D).icon)h(q0)})}N0(W),L0((h,O0)=>{w=T0(W,1,"item-toolbar__button svelte-1c13522",null,w,{"item-toolbar__button--active":h}),U0(W,"aria-label",j(D).ariaLabel||j(D).label),U0(W,"aria-pressed",O0),U0(W,"title",j(D).tooltip||j(D).label),W.disabled=j(D).disabled},[()=>Pj(j(D)),()=>Pj(j(D))]),Jj("click",W,function(...h){j(D).onClick?.apply(this,h)}),H(p,W)};Y0(y,(p)=>{if(j(m))p(A);else if(j(T))p(z,1);else p(s,-1)})}H(k,d)});var X=wj(S,2);Zj(X,17,()=>j(zZ),(k)=>k.key,(k,D)=>{var t=X0(),e=Q0(t);{var m=(y)=>{var A=X0(),z=Q0(A);Bj(z,()=>j(g0),(T)=>{var s=zj();B0(s,(p,W)=>uj?.(p,W),()=>({mounted:j(D),active:j(t0)[j(D).toolId]??!1,runtime:j(x),i18n:j(Vj)})),H(T,s)}),H(y,A)},d=(y)=>{var A=zj();B0(A,(z,T)=>hj?.(z,T),()=>j(D).entry),H(y,A)};Y0(e,(y)=>{if(j(D).entry.shell)y(m);else y(d,-1)})}H(k,t)}),N0(Q);var G=wj(Q,2);{var a=(k)=>{var D=nZ();let t;Zj(D,21,()=>j(GJ),(e)=>e.key,(e,m)=>{var d=X0(),y=Q0(d);{var A=(T)=>{var s=X0(),p=Q0(s);Bj(p,()=>j(g0),(W)=>{var w=vJ();B0(w,(g,q0)=>uj?.(g,q0),()=>({mounted:j(m),active:j(t0)[j(m).toolId]??!1,runtime:j(x),i18n:j(Vj)})),H(W,w)}),H(T,s)},z=(T)=>{var s=vJ();B0(s,(p,W)=>hj?.(p,W),()=>j(m).entry),H(T,s)};Y0(y,(T)=>{if(j(m).entry.shell)T(A);else T(z,-1)})}H(e,d)}),N0(D),L0(()=>t=T0(D,1,"item-toolbar__controls-row svelte-1c13522",null,t,{"item-toolbar__controls-row--reserve":j(PJ),"item-toolbar__controls-row--active":j(qJ),"item-toolbar__controls-row--align-start":j(HZ)})),H(k,D)};Y0(G,(k)=>{if(j(wZ))k(a)})}N0(Z),cJ(Z,(k)=>V0(D0,k),()=>j(D0)),L0(()=>{U=T0(Z,1,`item-toolbar ${bj()??""} item-toolbar--${Yj()??""}`,"svelte-1c13522",U,{"item-toolbar--top":x0()==="top","item-toolbar--right":x0()==="right","item-toolbar--bottom":x0()==="bottom","item-toolbar--left":x0()==="left","item-toolbar--header-overlay-active":j(FJ)}),U0(Z,"data-content-kind",j(r0)),U0(Z,"data-level",j(b))}),Jj("focusin",Q,(k)=>{if(j(b)==="section"&&k.target instanceof HTMLElement)k.target.scrollIntoView({block:"nearest",inline:"nearest"})}),H(J,Z)};Y0(TZ,(J)=>{if(v)J(fZ)})}return H(B,WJ),$J(SZ)}hJ(["focusin","click"]);mZ("pie-item-toolbar",sJ(eJ,{level:{attribute:"level",type:"String"},scopeId:{attribute:"scope-id",type:"String"},itemId:{attribute:"item-id",type:"String"},sectionId:{attribute:"section-id",type:"String"},catalogId:{attribute:"catalog-id",type:"String"},tools:{attribute:"tools",type:"String"},contentKind:{attribute:"content-kind",type:"String"},position:{attribute:"position",type:"String"},size:{attribute:"size",type:"String"},language:{attribute:"language",type:"String"},scopeElement:{type:"Object"},toolRegistry:{type:"Object"},item:{type:"Object"},hostButtons:{type:"Object"},class:{}},[],[],{mode:"open"}));
|
|
40
|
-
export{eJ as l};
|