diff --git a/.github/workflows/containers-build-template.yml b/.github/workflows/containers-build-template.yml index f088ce8..b356f11 100644 --- a/.github/workflows/containers-build-template.yml +++ b/.github/workflows/containers-build-template.yml @@ -1,4 +1,4 @@ -name: Build containers template +name: Build Containers Template permissions: contents: read @@ -11,14 +11,16 @@ on: description: "Build using the Release configuration" default: false +env: + DEVELOPER_DIR: "/Applications/Xcode_26.6.app/Contents/Developer" + jobs: - buildAndTest: - name: Build and Test + build: + name: Build if: github.repository == 'try-containers/Containers' timeout-minutes: 60 runs-on: macos-26 env: - DEVELOPER_DIR: "/Applications/Xcode_26.6.app/Contents/Developer" BUILD_CONFIGURATION: ${{ inputs.release && 'Release' || 'Debug' }} steps: @@ -36,6 +38,10 @@ jobs: git diff if ! git diff --quiet ; then echo the following files require formatting: ; git diff --name-only ; false ; fi + - name: Lint + run: | + swift format lint --strict --recursive --configuration .swift-format $(find . -type f -name '*.swift' -not -path "*/.*") + - name: Resolve packages run: | xcodebuild -resolvePackageDependencies \ @@ -52,12 +58,33 @@ jobs: -destination 'platform=macOS' \ CODE_SIGNING_ALLOWED=NO - - name: Test + test: + name: Test + if: github.repository == 'try-containers/Containers' + timeout-minutes: 60 + runs-on: macos-26 + + steps: + - name: Checkout repository + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + with: + fetch-depth: 0 + + - name: Show Xcode version + run: xcodebuild -version + + - name: Resolve packages + run: | + xcodebuild -resolvePackageDependencies \ + -project Containers.xcodeproj \ + -scheme ContainersCoreTests + + - name: Test run: | set -o pipefail xcodebuild test \ -project Containers.xcodeproj \ - -scheme ContainerSystemTests \ + -scheme ContainersCoreTests \ -destination 'platform=macOS' \ -resultBundlePath TestResults.xcresult \ CODE_SIGNING_ALLOWED=NO diff --git a/.github/workflows/containers-build.yml b/.github/workflows/containers-build.yml index 732dabe..0029b7a 100644 --- a/.github/workflows/containers-build.yml +++ b/.github/workflows/containers-build.yml @@ -1,4 +1,4 @@ -name: Build containers +name: Build & Test permissions: contents: read diff --git a/.github/workflows/containers-release.yml b/.github/workflows/containers-release.yml index 6d7d927..eaa47aa 100644 --- a/.github/workflows/containers-release.yml +++ b/.github/workflows/containers-release.yml @@ -1,4 +1,4 @@ -name: Publish containers release +name: Publish Release permissions: contents: write diff --git a/.github/workflows/containers-testflight.yml b/.github/workflows/containers-testflight.yml index 96e680c..ce2ed34 100644 --- a/.github/workflows/containers-testflight.yml +++ b/.github/workflows/containers-testflight.yml @@ -1,4 +1,4 @@ -name: Deploy containers to TestFlight +name: Deploy to TestFlight permissions: contents: read diff --git a/AGENTS.md b/AGENTS.md index 8b689db..aadf25b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -6,8 +6,8 @@ Guidance for coding agents working in this repository. The project is a single Xcode project with two schemes: -- `Containers (macOS)` builds the app and the `ContainerSystem` framework it embeds. -- `ContainerSystemTests` runs the framework's tests. The app target has no tests. +- `Containers (macOS)` builds the app and the `ContainersCore` framework it embeds. +- `ContainersCoreTests` runs the framework's tests. The app target has no tests. Signing reads `DEVELOPMENT_TEAM` from `Configuration/Local.xcconfig`, which is ignored by git. Copy `Configuration/Local.xcconfig.example` and fill in a team ID. @@ -16,11 +16,11 @@ xcodebuild -project Containers.xcodeproj -scheme 'Containers (macOS)' build ``` ```bash -xcodebuild -project Containers.xcodeproj -scheme ContainerSystemTests test +xcodebuild -project Containers.xcodeproj -scheme ContainersCoreTests test ``` ```bash -xcrun swift-format lint -r --configuration .swift-format Containers ContainerSystem ContainerSystemTests +xcrun swift-format lint -r --configuration .swift-format Containers ContainersCore ContainersCoreTests ``` - The app target runs the same lint as a build phase, so warnings show up in every build. Keep it clean. @@ -29,71 +29,79 @@ xcrun swift-format lint -r --configuration .swift-format Containers ContainerSys ## Architecture -The app runs Linux containers with Apple's [Containerization](https://github.com/apple/containerization) package, in process: the engine runs as actors inside the sandboxed app, with no separate server, XPC service or helper processes. +The app runs Linux containers with Apple's [Containerization](https://github.com/apple/containerization) package, in process: the container system runs inside the sandboxed app, with no separate server, XPC service or helper processes. Calls flow in one direction: ``` SwiftUI / AppKit views - → Managers (ContainerSystem, @MainActor, public) - → ContainerRuntime.get…Service() - → Services (ContainerSystem, actors, internal) + → ContainerSystem and managers (ContainersCore, @MainActor, public) + → ContainerSystem.…Service (internal) + → Services (ContainersCore, internal) → Containerization ``` -- `ContainerRuntime` (`ContainerRuntime.shared`) owns the services and the runtime's shared state: system status, setup progress and reports. It also installs the prerequisites (kernel, init image) on first start. -- Managers are thin handles over the runtime, one per domain. `ImageManager()` uses the shared runtime; tests pass a `MockContainerRuntime` through `init(testRuntime:)`. A manager can use any service, but never another manager. -- Services are the engine: internal actors that hold the state of containers, images, kernels and reports. Only the runtime creates them, when the system starts, and lets go of them when it stops. Everything else reaches them through the runtime's `get…Service()` accessors: managers and `Build/`. Nothing works while the system is stopped, by design. +- `ContainerSystem` (`ContainerSystem.shared`) is the container system itself: its status and lifecycle, the folders it can keep its data in (`+AppRoot`), and the services it runs, created on start and released on stop. It holds the state the managers share, such as setup progress and reports, and installs the prerequisites (kernel, init image) on first start. +- The framework's public objects are `ContainerSystem` and one manager per domain, along with the value types they take and return. The system is not a manager: it's the one running thing the managers work in. The services and everything else below them are internal. +- Managers are thin handles over the container system, one per domain. `ImageManager()` uses `ContainerSystem.shared`; tests pass a `MockContainerSystem` through `init(testSystem:)`. A manager can use any service, but never another manager. +- Services are what the container system runs: internal types that hold the state of containers, images, kernels and reports. There's one service per domain (`ContainerService`, `ImageService`, `NetworkService`, `VolumeService`, `KernelService`, `ReportService`, `DNSService`). A service is an actor only when it has mutable state to protect (`ContainerService`, `ReportService`, `DNSService`); one that only holds `let`s is a `Sendable` struct. Only the container system creates them, when the system starts, and lets go of them when it stops. Everything else reaches them through the container system's internal, throwing `…Service` properties: managers and `Build/`. Nothing works while the system is stopped, by design. - Progress is Foundation's `Progress`. A method that reports progress takes `progress: Progress? = nil`, sets `totalUnitCount` to its own steps and runs each with `progress.performStep("…") { step in … }` (`Progress/Progress+Steps.swift`). Callers compose operations by weighting steps with `pendingUnitCount`. -- Failed work is recorded by `ReportManager` through `ReportsService` into `ReportStore`: a plist manifest plus one gzipped body per report. Managers that delete items also delete their reports through `ReportsService`. +- Failed work is recorded by `ReportManager` through `ReportService` into `ReportStore`: a plist manifest plus one gzipped body per report. Managers that delete resources also delete their reports through `ReportService`. - Errors are thrown as they are. Views turn them into an `ErrorAlert`; the framework and app models never build alerts. +- Managers return resources: `ManagedContainer`, `ImageResource`, `VolumeResource` and `NetworkResource`, each conforming to `ManagedResource` with validated `ResourceLabels`. A resource is its `…Configuration`, the part that's stored, plus what it is doing now where the app knows it (`ManagedContainer.status`). A relation between resources isn't part of either: whether an image or volume is in use comes from its own call (`ImageManager.digestsInUse()`, `VolumeManager.namesInUse()`). +- Each resource type is designed for what the app needs. Where the container CLI's source file for a type then fits as written, it's used verbatim with its Apache 2.0 header (`ContainerStatus.swift`); such a file is never adapted, and the app's design never bends to fit one. -## ContainerSystem layout +## ContainersCore layout -Role first, with domains inside each role: +Layer first, with domains inside each layer: -- `Managers/`: `ContainerManager`, `ImageManager`, `VolumeManager`, `NetworkManager`, `SystemManager`, `ReportManager`. -- `Runtime/`: `ContainerRuntime` and its extensions, with `Services/` inside it (`ContainersService`, `ImagesService`, `KernelService`, `ReportsService`), since the runtime owns the services. -- `Container/`, `Image/`, `Network/`, `Volume/`: value types for each domain (`ContainerConfiguration`, `ContainerSnapshot`, `ImageSummary`, `VolumeSummary`, …). +- `System/`: the public `ContainerSystem` and its extensions (`+AppRoot`, `+Configuration`, `+Prerequisites`, `+Services`), with the internal `Services/` inside it, since the system owns the services. A service split across files gets a folder of its own (`Container/`, `DNS/`); the rest are single files (`ImageService`, `NetworkService`, `VolumeService`, `KernelService`, `ReportService`). "Runtime" is kept for the helper that runs one container (`runtimeHandler`). +- `Managers/`: `ContainerManager`, `ImageManager`, `VolumeManager`, `NetworkManager`, `ReportManager`. +- `Container/`, `Image/`, `Network/`, `Volume/`: value types for each domain: what's stored (`ContainerConfiguration`, `VolumeConfiguration`, `NetworkConfiguration`) and the resources the managers return (`ManagedContainer`, `ImageResource`, `VolumeResource`, `NetworkResource`). `ContainerSnapshot` is the container service's own record of a running container; `ContainerManager` turns it into a `ManagedContainer`, and nothing outside the framework sees it. +- `Common/`: types every domain shares, such as `ManagedResource` and `ResourceLabels`. - `Build/`: the BuildKit client. `Builder/` holds the gRPC client and the builder container's controller; `BuildPipeline/` handles the stream, split by concern (`+ImageResolver`, `+ContentStore`, `+FSSync`, `+Export`, `+Stdio`). -- `Persistence/`, `Plugin/`, `Log/`, `Progress/`, `Reports/`, `Common/`: one folder per infrastructure concern. +- `Persistence/`, `Log/`, `Progress/`, `Reports/`: one folder per infrastructure concern. ## Containers (app) layout -Layer first, like Apple's SwiftUI samples: +Layer first: - `ContainersApp.swift`: scenes, window IDs and the objects put in the environment. -- `Models/`: value types, grouped by feature to mirror `Views/` (`Containers/`, `Images/`, `Volumes/`, `Reports/`, `Dashboard/`, `Shared/`). Models never fetch or do work. +- `Models/`: value types, grouped by feature to mirror `Views/` (`Containers/`, `Images/`, `Volumes/`, `Reports/`, `Dashboard/`, `System/`), with `App/` for what describes the app itself (`AppInfo`, `AppVersion`, `AppLink`) and `Shared/` for what several features use (`Icon`, `Tips`, `ResourceID`, `ResourceEntry`). Models never fetch or do work. How the app presents a model, including a `ContainersCore` type, is a `Type+Topic.swift` extension beside it in the same feature folder (`Report+Appearance`, `ContainerSystem.Status+Message`, `ImageResource+Display`). Detail windows, Info and Inspect panes and sheets use the resources themselves; there's no app-side copy of a resource. - `ViewModels/`: `@Observable` objects that hold state and actions for views: `RegistryLookup`, owned by the pull sheet with `@State`, and `SystemActions`, created by the app and shared by the menu bar and the status bar. -- `Utilities/`: app-wide objects not tied to a screen (`ActivityCenter`), plus support types (`ProgressObserver`, `WindowResizer`). +- `Utilities/`: app-wide objects not tied to a screen (`ActivityCenter`), support types (`ProgressObserver`, `WindowResizer`), and every extension of Apple's framework types that isn't a view, even one a single feature uses (`UserDefaults+Settings`, `NSSavePanel+Sheet`, `NSToolbar+Shape`, `OpenWindowAction+Report`). - `Controllers/`: AppKit controllers only, such as the `NSToolbarDelegate` objects. Their `NSViewRepresentable` binders live in `Views/`. -- `Views//`: one folder per screen. `Views/Shared/` holds complete units that appear once on a screen (`TableView`, `DetailView`, `CreateView`, `ScopeBar`). `Views/Components/` holds small reusable elements that can repeat on a screen (`BarToggle`, `SearchToken`, form rows). -- `Extensions/`: one `Type+Topic.swift` per extension. +- `Views//`: views only, one folder per screen, plus extensions of view types that screen uses (`View+FixedSidebarWidth` in `Views/Settings/`). `Views/Shared/` holds complete units that appear once on a screen (`TableView`, `DetailView`, `CreateView`, `ScopeBar`). `Views/Components/` holds small reusable elements that can repeat on a screen (`BarToggle`, `SearchToken`, form rows), and the view extensions several screens share (`View+RowTint`, `View+DefaultAction`, `Image+Icon`). - `Supporting Files/`: Info.plist, assets and entitlements. Don't rename it; the Info.plist membership exception depends on the path. Rules for where logic goes: - Split a large view into subviews or modifiers first. Add a view model only when that isn't enough. - Exactly one place drives each fetch: a view, its view model, or an app-owned object. Fetching for display never happens in a model. -- Form state for a sheet lives in value models (`ImagePullRequest`, `ImageBuildRequest`, `ImageLoadRequest`) with an `isComplete` check. -- Long-running work (pull, build, create, start) runs through `ActivityCenter`, so its progress and failures show on the item's row. +- A sheet with up to three fields keeps them as `@State` properties. From four fields on, they go into a `…Form` value model with an `isComplete` check (`ContainerCreateForm`, `ImageBuildForm`, `VolumeCreateForm`), held in a `form` property. A form keeps what the person entered as entered; the view turns it into the framework's types when the work starts. +- Long-running work (pull, build, create, start, stop, delete) runs through `ActivityCenter`, so its progress and failures show on the resource's row. + - A task (`ContainerSystemTask`) is identified by what it works on, its `Subject`: a resource's `ResourceID`, or for a load, the archive it reads. Its `target` is the `ResourceID` of what it acts on or makes, which a load learns once it has read the archive. A `ResourceID` carries its kind (`.container`, `.image`, `.volume`), as names are unique only within a kind; an image's is its normalized reference. Reports are filed under the target's name. + - Work starts with `start(on:)`, or `start(making:from:)` for a load, which claims the images it will make with `claim(_:forWorkOn:)` once it has read the archive and before it records any, failing if other work on them is under way. There's one task per subject at a time, as two pieces of work on the same resource would race: starting work replaces one that has ended there, and does nothing while one runs. A table row's ID is the same `Subject`, so a row and the task on it are known alike. + - A table gets its entries from `activityCenter.entries(for:ofKind:…)`: a `ResourceEntry` holds the resource (`nil` while work is still making it), a snapshot of its task or unread failure, and whether it's in use. Columns sort by key paths on the entry, in a `nonisolated extension ResourceEntry where Resource == …` beside the resource's display extension, and its name column draws a `ResourceNameCell`. + - Anywhere else, ask the activity center about a resource by its `ResourceID` (`isWorking(on:)`) rather than storing the task on the resource. + - Work isn't resumed, so work that's stopped removes everything it made: temporary folders, images a pull, load or build added (`ImageService.discard(references:)`), and the container, the image it pulled and the volumes made for a container being created. What existed before the work started is never removed. Anything the work makes belongs inside it, so a retry makes it again. What a quit or crash interrupts is removed when the system next starts, before any work can run: the work folders (`ContainerSystem.workFolders(in:)`), container bundles that can't be read, and content and snapshots no image uses. ## Naming - Suffixes mean one thing each: - `Store`: persistence (`ReportStore`, `DefaultsStore`). - - `Manager`: a framework facade. - - `Service`: a framework engine actor. + - `Manager`: a framework facade over a collection of resources (containers, images, …). A type that is one running thing is named after it instead (`ContainerSystem`). + - `Service`: an internal type the container system runs. - `Controller`: an AppKit controller. - `Center`: an app-wide hub (`ActivityCenter`). -- Entries in a table are `…Item` (`ContainerItem`); framework list results are `…Summary`; value copies of live state are `…Snapshot`; a description of one operation to perform is `…Request`; a lifecycle enum is a nested `Status` (`SystemManager.Status`). -- Where a type mirrors one in Containerization, keep Apple's name and shape. +- What the container system manages is a resource (`ManagedContainer`, `ImageResource`, `VolumeResource`, `NetworkResource`); the part of it that's stored is its `…Configuration`. A model a view draws one of per row or point is an `…Entry` (`ResourceEntry`, for every resource table), never a `…Row`: `…Row` and `…Cell` are the views that draw it. `TableView` and `TableRowActions` call that value `RowValue`. Value copies of live state are `…Snapshot` (`ContainerSystemTask.Snapshot`); what a person enters in a sheet is a `…Form`, named subject first (`ContainerCreateForm`, `ImageBuildForm`); a description of work handed to whatever performs it is `…Request` (`RegistryRequest`); a lifecycle enum is a nested `Status` (`ContainerSystem.Status`). +- Where a type mirrors one in Containerization, keep its name and shape. Never give a model a bare `Container`, `Image` or `Network` name: Containerization already uses them for its own types. - Extension files are `Type+Topic.swift`, never `Type+Extensions.swift`. One primary type per file. ## Conventions - **Concurrency:** Swift 6 language mode. The app target defaults to `MainActor` isolation; the framework is nonisolated by default. Add `nonisolated` only where the compiler needs it (table sort key paths, `Layout`, AppKit overrides that AppKit calls off the main actor), and group such constants in a `nonisolated` enum rather than marking each one. -- **Layout:** write like Apple's Containerization code. 180 columns is a ceiling, not a target: most lines stay under about 110. A call or signature that gets long goes one argument per line, with `)` on its own line. Don't nest a call inside another call's arguments (`append(Item(…))`); name the value first. Long `if`/`guard` conditions break at their commas, with `else {` on its own line. Blank lines contain no spaces. +- **Layout:** 180 columns is a ceiling, not a target: most lines stay under about 110. A call or signature that gets long goes one argument per line, with `)` on its own line. Don't nest a call inside another call's arguments (`append(Item(…))`); name the value first. Long `if`/`guard` conditions break at their commas, with `else {` on its own line. Blank lines contain no spaces. - **Comments:** few, around 6% of lines. Comment only where the code would otherwise be "fixed" into something broken: an AppKit or SwiftUI ordering constraint, an API contract, an isolation assumption. State the reason itself. Don't narrate what the code does, record history, or justify a design by pointing at another app ("as Xcode does"). - **`let` over `var`:** a stored property is `var` only when something writes it after creation, such as a binding, a modified copy or state filled in later. - **Native over forced:** accept AppKit's and SwiftUI's own sizing, toolbar behavior and dividers instead of working around them. The dashboard and detail toolbars are AppKit's for that reason. @@ -102,10 +110,10 @@ Rules for where logic goes: ## Tests -- Swift Testing only. Tests cover `ContainerSystem` and don't start virtual machines. +- Swift Testing only. Tests cover `ContainersCore` and don't start virtual machines. - One suite per file: `FooTests.swift` holds `@Suite("Foo") struct FooTests`, with traits after the name (`@Suite("Volume manager", .serialized)`). - Tests read `@Test("Short sentence-case phrase") func camelCaseName()`, with no `test` prefix. -- Each test works in its own `TemporaryDirectory` (`ContainerSystemTests/Support`) and removes it with `defer`. Tests that need managers use `MockContainerRuntime` (`ContainerSystemTests/Mocks`); service tests build the service directly over a temporary folder. +- Each test works in its own `TemporaryDirectory` (`ContainersCoreTests/Support`) and removes it with `defer`. Tests that need managers use `MockContainerSystem` (`ContainersCoreTests/Mocks`); service tests build the service directly over a temporary folder. ## Releases diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1ecd663..e74402a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -47,7 +47,7 @@ When preparing a pull request, follow this checklist: * Imitate the conventions of surrounding code. * Set your own `DEVELOPMENT_TEAM` in `Configuration/Local.xcconfig` (copy it from `Configuration/Local.xcconfig.example`) rather than in Xcode's Signing & Capabilities tab, which writes it into the project file. * Format code as described in [Formatting contributions](#formatting-contributions) (otherwise the build will fail). -* Verify that the app builds and that the unit tests pass (`xcodebuild test -project Containers.xcodeproj -scheme ContainerSystemTests -destination 'platform=macOS'`). +* Verify that the app builds and that the unit tests pass (`xcodebuild test -project Containers.xcodeproj -scheme ContainersCoreTests -destination 'platform=macOS'`). * If you changed the UI, add a screenshot or video to the pull request. * Follow the [seven rules](https://cbea.ms/git-commit/#seven-rules) of great Git commit messages: * Separate subject from body with a blank line. @@ -76,7 +76,7 @@ Make sure your contributions are consistent with the rest of the project's forma This covers every Swift file your branch adds or changes compared with `main`, committed or not. The build runs the linter, so you can check the result before pushing: ```bash -swift format lint --recursive --configuration .swift-format Containers ContainerSystem ContainerSystemTests +swift format lint --recursive --configuration .swift-format Containers ContainersCore ContainersCoreTests ``` ### .gitignore contributions diff --git a/ContainerSystem/Build/HTTP2ConnectBufferingHandler.swift b/ContainerSystem/Build/HTTP2ConnectBufferingHandler.swift deleted file mode 100644 index 366cbcb..0000000 --- a/ContainerSystem/Build/HTTP2ConnectBufferingHandler.swift +++ /dev/null @@ -1,49 +0,0 @@ -// -// HTTP2ConnectBufferingHandler.swift -// Containers -// -// Created by Axel Martinez on 2026/02/09. -// - -import NIOCore - -/// Buffers incoming bytes until the gRPC HTTP/2 pipeline is configured. -final class HTTP2ConnectBufferingHandler: - ChannelDuplexHandler, RemovableChannelHandler -{ - typealias InboundIn = ByteBuffer - typealias InboundOut = ByteBuffer - typealias OutboundIn = ByteBuffer - typealias OutboundOut = ByteBuffer - - private var removalScheduled = false - private var bufferedReads: [NIOAny] = [] - - func channelRead(context: ChannelHandlerContext, data: NIOAny) { - bufferedReads.append(data) - } - - func channelReadComplete(context: ChannelHandlerContext) {} - - func flush(context: ChannelHandlerContext) { - if !removalScheduled { - removalScheduled = true - context.eventLoop.assumeIsolatedUnsafeUnchecked().execute { - context.pipeline.syncOperations.removeHandler(self, promise: nil) - } - } - context.flush() - } - - func removeHandler(context: ChannelHandlerContext, removalToken: ChannelHandlerContext.RemovalToken) { - var didRead = false - while !bufferedReads.isEmpty { - context.fireChannelRead(bufferedReads.removeFirst()) - didRead = true - } - if didRead { - context.fireChannelReadComplete() - } - context.leavePipeline(removalToken: removalToken) - } -} diff --git a/ContainerSystem/Container/ContainerResourceUsage.swift b/ContainerSystem/Container/ContainerResourceUsage.swift deleted file mode 100644 index ce4e118..0000000 --- a/ContainerSystem/Container/ContainerResourceUsage.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// ContainerResourceUsage.swift -// Containers -// -// Created by Axel Martinez on 15/09/2026. -// - -import Foundation - -public struct ContainerResourceUsage: Sendable { - public let id: String - public let memoryBytes: UInt64 - public let cpuUsageMicroseconds: UInt64 -} diff --git a/ContainerSystem/Container/PublishSocket.swift b/ContainerSystem/Container/PublishSocket.swift deleted file mode 100644 index 9c9023d..0000000 --- a/ContainerSystem/Container/PublishSocket.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// PublishSocket.swift -// Containers -// -// Local implementation of PublishSocket (replaces ContainerResource.PublishSocket) -// - -import Foundation -import SystemPackage - -/// Represents a socket that should be published from container to host. -public struct PublishSocket: Sendable, Codable { - public var containerPath: URL - public var hostPath: URL - public var permissions: FilePermissions? - - public init( - containerPath: URL, - hostPath: URL, - permissions: FilePermissions? = nil - ) { - self.containerPath = containerPath - self.hostPath = hostPath - self.permissions = permissions - } -} diff --git a/ContainerSystem/Image/ImageSummary.swift b/ContainerSystem/Image/ImageSummary.swift deleted file mode 100644 index afd2b56..0000000 --- a/ContainerSystem/Image/ImageSummary.swift +++ /dev/null @@ -1,48 +0,0 @@ -// -// ImageSummary.swift -// Containers -// -// Created by Axel Martinez on 03/10/2026. -// - -import Foundation - -/// An image as a list shows it: what it is, what it holds for one platform, -/// and whether a container uses it. -public struct ImageSummary { - public struct Platform { - public let variant: String? - public let created: Date - public let os: String - public let architecture: String - public let size: Int64 - - public init(variant: String?, created: Date, os: String, architecture: String, size: Int64) { - self.variant = variant - self.created = created - self.os = os - self.architecture = architecture - self.size = size - } - } - - public static let unknownCreationDate = Date(timeIntervalSince1970: 0) - - public let description: ImageDescription - /// `nil` unless the list was asked for a platform. - public let platform: Platform? - public let variants: [ImageResource.Variant] - public let isInUse: Bool - - public init( - description: ImageDescription, - platform: Platform?, - variants: [ImageResource.Variant] = [], - isInUse: Bool - ) { - self.description = description - self.platform = platform - self.variants = variants - self.isInUse = isInUse - } -} diff --git a/ContainerSystem/Image/Reference+Normalized.swift b/ContainerSystem/Image/Reference+Normalized.swift deleted file mode 100644 index 54c8081..0000000 --- a/ContainerSystem/Image/Reference+Normalized.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// Reference+Normalized.swift -// Containers -// -// Created by Axel Martinez on 03/10/2026. -// - -import ContainerizationOCI -import Foundation - -extension Reference { - /// Parses a reference as typed, filling in what a short name leaves out: - /// Docker Hub as the registry, `library/` for its official images, and - /// the `latest` tag. - public static func normalized(_ reference: String) throws -> Reference { - let trimmed = reference.trimmingCharacters(in: .whitespacesAndNewlines) - var parsed = try parse(trimmed) - - if parsed.domain == nil { - parsed = try parse("docker.io/\(trimmed)") - } - - parsed.normalize() - - return parsed - } -} diff --git a/ContainerSystem/Managers/SystemManager.swift b/ContainerSystem/Managers/SystemManager.swift deleted file mode 100644 index 93ac6b4..0000000 --- a/ContainerSystem/Managers/SystemManager.swift +++ /dev/null @@ -1,120 +0,0 @@ -// -// SystemManager.swift -// Containers -// -// System lifecycle management -// -// Created by Axel Martinez on 2026/02/08. -// - -import Foundation -import Logging -import Observation - -/// A manager that starts and stops the container system, and reports its status. -/// -/// Start the container system before you use the other managers. The first start installs what the -/// system needs, such as the Linux kernel, and reports it through ``setupProgress``. -@Observable -@MainActor -public final class SystemManager { - - let runtime: ContainerRuntime - private let logger: Logger - private var startTask: Task? - - /// The error that made the last start fail, or `nil` if it didn't fail. - public var startupError: (any Error)? { runtime.startupError } - - /// The stages of the container system's life cycle. - public enum Status: Equatable { - /// The container system isn't running. - case notStarted - /// The container system is starting, and may be installing what it needs first. - case starting - /// The container system is running, and containers can be created and run. - case running - /// The container system is stopping its containers and services. - case stopping - /// The last start failed. ``SystemManager/startupError`` describes why. - case failed - } - - /// The stage the container system is in. - public var status: Status { - if runtime.isStopping { return .stopping } - if runtime.isStarting { return .starting } - if runtime.isRunning { return .running } - if runtime.startupError != nil { return .failed } - return .notStarted - } - - /// The progress of installing what the container system needs, such as the Linux kernel and the - /// init image, while a start installs it. - /// - /// This property is `nil` when nothing is being installed. - public var setupProgress: Progress? { - runtime.setupProgress - } - - /// Creates a manager for the shared container system. - public init() { - self.runtime = ContainerRuntime.shared - self.logger = Logger(label: "app.containers.manager.system") - } - - #if DEBUG - /// Creates a manager for the given runtime, so tests can use a runtime of their own. - init(testRuntime: ContainerRuntime) { - self.runtime = testRuntime - self.logger = Logger(label: "app.containers.manager.system.test") - } - #endif - - // MARK: - Lifecycle Methods - - /// Starts the container system, installing what it needs the first time. - /// - /// - Parameter appRoot: The folder where the container system keeps its data. - /// - Throws: An error if the system can't install what it needs, or start its storage or services. - public func start(appRoot: URL) async throws { - logger.info("Starting system", metadata: ["appRoot": "\(appRoot.path)"]) - - let task = Task { [runtime] in - try await runtime.start(appRoot: appRoot) - } - - startTask = task - - defer { - if startTask == task { - startTask = nil - } - } - - try await withTaskCancellationHandler { - try await task.value - } onCancel: { - task.cancel() - } - } - - /// Cancels a start that's in progress, including one another caller began. - public func cancelStart() { - logger.info("Cancelling start") - startTask?.cancel() - } - - /// Returns the disk space the container system's data uses, in bytes, or `nil` if it isn't running. - public func diskUsage() async -> Int64? { - guard let appRoot = try? runtime.getAppRoot() else { return nil } - - return await FileIO.shared.allocatedSize(of: appRoot) - } - - /// Stops the container system, and every container that's running. - public func stop() async throws { - logger.info("Stopping system") - try await runtime.stop() - } -} diff --git a/ContainerSystem/Managers/VolumeManager.swift b/ContainerSystem/Managers/VolumeManager.swift deleted file mode 100644 index cdb9e85..0000000 --- a/ContainerSystem/Managers/VolumeManager.swift +++ /dev/null @@ -1,243 +0,0 @@ -// -// VolumeManager.swift -// Containers -// -// Manager for volume operations -// -// Created by Axel Martinez on 2026/02/04. -// - -import ContainerizationEXT4 -import ContainerizationError -import Foundation -import Logging -import Observation -import SystemPackage - -/// A manager that creates, lists and deletes volumes. -/// -/// Each volume is an ext4 disk image in the container system's storage folder. -@Observable -@MainActor -public final class VolumeManager { - - let runtime: ContainerRuntime - - private let logger: Logger - - // Storage constants - private static let blockFile = "volume.ext4" - - /// Creates a manager for the shared container system. - public init() { - self.runtime = ContainerRuntime.shared - - var logger = Logger(label: "app.containers.manager.volume") - logger.logLevel = .info - - self.logger = logger - } - - #if DEBUG - /// Creates a manager for the given runtime, so tests can use a runtime of their own. - init(testRuntime: ContainerRuntime) { - self.runtime = testRuntime - - var logger = Logger(label: "app.containers.manager.volumes.test") - logger.logLevel = .debug - - self.logger = logger - } - #endif - - // MARK: - Public API - - /// Creates a volume. - /// - /// - Parameters: - /// - name: The volume's name, which must be unique and use only valid characters. - /// - labels: Labels to add to the volume. - /// - options: Driver options for the volume. - /// - sizeInBytes: The volume's size, or `nil` for the default size. - /// - Returns: The new volume. - /// - Throws: An error if the name isn't valid, a volume with that name exists, or the volume can't be - /// created. - @discardableResult - public func create( - name: String, - labels: [KeyValue], - options: [KeyValue], - sizeInBytes: UInt64? - ) async throws -> Volume { - guard VolumeStorage.isValidVolumeName(name) else { - throw VolumeError.invalidVolumeName("invalid volume name '\(name)': must match \(VolumeStorage.volumeNamePattern)") - } - - let store = try await getStore() - let existingVolumes = try await store.list() - - if existingVolumes.contains(where: { $0.name == name }) { - throw VolumeError.volumeAlreadyExists(name) - } - - let volumesRoot = try getVolumesRoot() - let volumeDir = volumesRoot.appendingPathComponent(name) - - try FileManager.default.createDirectory(at: volumeDir, withIntermediateDirectories: true) - - let blockPath = volumeDir.appendingPathComponent(Self.blockFile).path - let filesystemSize = sizeInBytes ?? VolumeStorage.defaultVolumeSizeBytes - let labelsDict = labels.reduce(into: [String: String]()) { - $0[$1.key] = $1.value - } - let optionsDict = options.reduce(into: [String: String]()) { - $0[$1.key] = $1.value - } - - do { - let formatter = try EXT4.Formatter( - FilePath(blockPath), - blockSize: 4096, - minDiskSize: filesystemSize - ) - - try formatter.close() - } catch { - // Clean up the directory on failure - try? FileManager.default.removeItem(at: volumeDir) - - throw VolumeError.storageError("failed to create volume image: \(error)") - } - - let volume = Volume( - name: name, - driver: "local", - format: "ext4", - source: blockPath, - labels: labelsDict, - options: optionsDict, - sizeInBytes: filesystemSize - ) - - try await store.create(volume) - - logger.info("Created volume: \(name)") - - return volume - } - - /// Returns every volume. - public func list() async throws -> [Volume] { - let store = try await getStore() - - return try await store.list() - } - - /// Returns every volume, with whether a container uses it. - public func summaries() async throws -> [VolumeSummary] { - let store = try await getStore() - let service = try await runtime.getContainersService() - let usedVolumeNames = Set(await service.list().flatMap(\.volumeNames)) - - return try await store.list().map { volume in - VolumeSummary(volume: volume, isInUse: usedVolumeNames.contains(volume.name)) - } - } - - /// Deletes volumes, along with their data and any reports about them. - /// - /// A volume that a container uses isn't deleted. - /// - /// - Parameter volumes: The volumes to delete. - /// - Throws: An error that lists each volume that couldn't be deleted. - public func delete(volumes: [Volume]) async throws { - let store = try await getStore() - let service = try await runtime.getContainersService() - let containers = await service.list() - - var failed: [(String, Error)] = [] - var deleted: [String] = [] - - for volume in volumes { - do { - // Check if volume is in use by any container - let isInUse = containers.contains { container in - container.configuration.mounts.contains { mount in - mount.isVolume && mount.volumeName == volume.name - } - } - - if isInUse { - throw VolumeError.volumeInUse(volume.name) - } - - try await store.delete(volume.name) - - let volumesRoot = try getVolumesRoot() - let volumeDir = volumesRoot.appendingPathComponent(volume.name) - - if FileManager.default.fileExists(atPath: volumeDir.path) { - try FileManager.default.removeItem(at: volumeDir) - } - - deleted.append(volume.name) - logger.info("Deleted volume: \(volume.name)") - } catch { - logger.error("Failed to delete volume \(volume.name): \(error)") - failed.append((volume.name, error)) - } - } - - try await runtime.getReportsService().delete(named: deleted, ofKind: [.volume]) - - if !failed.isEmpty { - throw ContainerizationError( - .internalError, - message: - "Failed to delete one or more volumes: \n\(failed.map({"\($0.0): \($0.1)"}).joined(separator: "\n"))" - ) - } - } - - // MARK: - Private Helpers - - private func getVolumesRoot() throws -> URL { - let appRoot = try runtime.getAppRoot() - let volumesRoot = appRoot.appendingPathComponent("volumes") - - try FileManager.default.createDirectory(at: volumesRoot, withIntermediateDirectories: true) - - return volumesRoot - } - - private func getStore() async throws -> FilesystemEntityStore { - let volumesRoot = try getVolumesRoot() - - return try FilesystemEntityStore(path: volumesRoot, type: "volumes", log: logger) - } -} - -extension VolumeManager { - /// Returns the volume with a name, creating it if it doesn't exist yet. - /// - /// - Parameters: - /// - name: The volume's name. An empty name creates a new anonymous volume. - /// - existing: The volumes that exist, to look the name up in. - /// - Returns: The existing or new volume. - /// - Throws: An error if the volume can't be created. - public func volume(named name: String, among existing: [Volume]) async throws -> Volume { - if !name.isEmpty, let match = existing.first(where: { $0.name == name }) { - return match - } - - var volumeName = name - var labels: [KeyValue] = [] - - if volumeName.isEmpty { - volumeName = VolumeStorage.generateAnonymousVolumeName() - labels.append(.init(key: Volume.anonymousLabel)) - } - - return try await create(name: volumeName, labels: labels, options: [], sizeInBytes: nil) - } -} diff --git a/ContainerSystem/Persistence/DefaultsStore.swift b/ContainerSystem/Persistence/DefaultsStore.swift deleted file mode 100644 index cd1a807..0000000 --- a/ContainerSystem/Persistence/DefaultsStore.swift +++ /dev/null @@ -1,100 +0,0 @@ -// -// DefaultsStore.swift -// Containers -// -// Provides default configuration values for the container system. -// - -import Foundation - -/// Provides access to default configuration values. -public enum DefaultsStore { - - /// Suite name for shared defaults. - private static let suiteName = "app.containers.defaults" - - /// Known configuration keys. - public enum Key: String { - case defaultInitImage = "defaultInitImage" - case defaultBuilderImage = "defaultBuilderImage" - case defaultKernelURL = "defaultKernelURL" - case defaultKernelBinaryPath = "defaultKernelBinaryPath" - case defaultDNSDomain = "defaultDNSDomain" - case buildRosetta = "buildRosetta" - case defaultContainerCPUs = "defaultContainerCPUs" - case defaultContainerMemory = "defaultContainerMemory" - case defaultBuildCPUs = "defaultBuildCPUs" - case defaultBuildMemory = "defaultBuildMemory" - case defaultSubnet = "defaultSubnet" - case registryDomain = "registryDomain" - } - - /// Default values for each key. - /// Image tags match the containerization package version pinned in Package.resolved. - private static nonisolated(unsafe) let defaults: [Key: String] = [ - .defaultInitImage: "ghcr.io/apple/containerization/vminit:0.28.0", - .defaultBuilderImage: "ghcr.io/apple/container-builder-shim/builder:0.12.0", - .defaultKernelURL: "https://github.com/kata-containers/kata-containers/releases/download/3.26.0/kata-static-3.26.0-arm64.tar.zst", - .defaultKernelBinaryPath: "opt/kata/share/kata-containers/vmlinux-6.18.5-177", - .buildRosetta: "true", - .defaultContainerCPUs: "2", - .defaultContainerMemory: "2147483648", - .defaultBuildCPUs: "4", - .defaultBuildMemory: "4294967296", - .defaultSubnet: "192.168.64.1/24", - ] - - /// UserDefaults instance using the shared suite, falling back to standard. - private static var userDefaults: UserDefaults { - UserDefaults(suiteName: suiteName) ?? .standard - } - - /// Get a required configuration value. Uses UserDefaults override, then falls back to built-in defaults. - public static func get(key: Key) -> String { - if let override = userDefaults.string(forKey: key.rawValue), !override.isEmpty { - return override - } - return defaults[key] ?? "" - } - - /// Get an optional configuration value. Returns nil if not set. - public static func getOptional(key: Key) -> String? { - if let override = userDefaults.string(forKey: key.rawValue), !override.isEmpty { - return override - } - return defaults[key] - } - - /// Get a boolean configuration value. Returns nil if not set. - public static func getBool(key: Key) -> Bool? { - if userDefaults.object(forKey: key.rawValue) != nil { - return userDefaults.bool(forKey: key.rawValue) - } - if let defaultValue = defaults[key] { - return defaultValue.lowercased() == "true" - } - return nil - } - - /// Get an integer configuration value. Returns nil if not set. - public static func getInt(key: Key) -> Int? { - if userDefaults.object(forKey: key.rawValue) != nil { - return userDefaults.integer(forKey: key.rawValue) - } - if let defaultValue = defaults[key] { - return Int(defaultValue) - } - return nil - } - - /// Get a UInt64 configuration value. Returns nil if not set. - public static func getUInt64(key: Key) -> UInt64? { - if let str = userDefaults.string(forKey: key.rawValue), let val = UInt64(str) { - return val - } - if let defaultValue = defaults[key] { - return UInt64(defaultValue) - } - return nil - } -} diff --git a/ContainerSystem/Persistence/FilesystemEntityStore.swift b/ContainerSystem/Persistence/FilesystemEntityStore.swift deleted file mode 100644 index bee6b16..0000000 --- a/ContainerSystem/Persistence/FilesystemEntityStore.swift +++ /dev/null @@ -1,79 +0,0 @@ -// -// FilesystemEntityStore.swift -// Containers -// -// Generic JSON-based filesystem persistence for entity types. -// - -import Foundation -import Logging - -/// A simple JSON-based store that persists entities as individual files in a directory. -public struct FilesystemEntityStore: Sendable { - private let path: URL - private let type: String - private let logger: Logger - private let metadataDir: URL - - public init(path: URL, type: String, log: Logger) throws { - self.path = path - self.type = type - self.logger = log - self.metadataDir = path.appendingPathComponent(".metadata") - - try FileManager.default.createDirectory( - at: metadataDir, - withIntermediateDirectories: true - ) - } - - public func list() async throws -> [T] { - let fm = FileManager.default - - guard fm.fileExists(atPath: metadataDir.path) else { - return [] - } - - let contents = try fm.contentsOfDirectory( - at: metadataDir, - includingPropertiesForKeys: nil - ) - let decoder = JSONDecoder() - decoder.dateDecodingStrategy = .iso8601 - - var entities: [T] = [] - - for file in contents where file.pathExtension == "json" { - do { - let data = try Data(contentsOf: file) - let entity = try decoder.decode(T.self, from: data) - entities.append(entity) - } catch { - logger.warning( - "Failed to decode \(type) from \(file.lastPathComponent): \(error)" - ) - } - } - - return entities - } - - public func create(_ entity: T) async throws where T: Identifiable, T.ID == String { - let encoder = JSONEncoder() - encoder.dateEncodingStrategy = .iso8601 - encoder.outputFormatting = [.prettyPrinted, .withoutEscapingSlashes] - - let data = try encoder.encode(entity) - let file = metadataDir.appendingPathComponent("\(entity.id).json") - - try data.write(to: file) - } - - public func delete(_ id: String) async throws { - let file = metadataDir.appendingPathComponent("\(id).json") - - if FileManager.default.fileExists(atPath: file.path) { - try FileManager.default.removeItem(at: file) - } - } -} diff --git a/ContainerSystem/Plugin/Plugin.swift b/ContainerSystem/Plugin/Plugin.swift deleted file mode 100644 index 3a1e4fc..0000000 --- a/ContainerSystem/Plugin/Plugin.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// Plugin.swift -// Containers -// -// Represents a container plugin that can be registered with the runtime. -// - -import Foundation - -/// Represents a container plugin. -public struct Plugin: Sendable { - public let name: String - public let binaryURL: URL - - public init(name: String, binaryURL: URL) { - self.name = name - self.binaryURL = binaryURL - } -} diff --git a/ContainerSystem/Plugin/PluginLoader.swift b/ContainerSystem/Plugin/PluginLoader.swift deleted file mode 100644 index 7d9a3c2..0000000 --- a/ContainerSystem/Plugin/PluginLoader.swift +++ /dev/null @@ -1,9 +0,0 @@ -// -// PluginLoader.swift -// Containers -// - -/// Placeholder for future plugin loading support. -public struct PluginLoader: Sendable { - public init() {} -} diff --git a/ContainerSystem/Runtime/ContainerRuntime+Plugins.swift b/ContainerSystem/Runtime/ContainerRuntime+Plugins.swift deleted file mode 100644 index 0f0aaaf..0000000 --- a/ContainerSystem/Runtime/ContainerRuntime+Plugins.swift +++ /dev/null @@ -1,198 +0,0 @@ -// -// ContainerRuntime+Plugins.swift -// Containers -// -// Plugin process management extension for ContainerRuntime. -// Manages plugin processes spawned directly as child processes instead of using launchd. -// This allows the app to work within the macOS sandbox. -// -// Created by Axel Martinez on 2026/02/08. -// - -import ContainerizationError -import Foundation -import Logging - -extension ContainerRuntime { - - // MARK: - Plugin Process Management - - /// Register and start a plugin as a child process - func registerPlugin( - plugin: Plugin, - appRoot: URL, - installRoot: URL, - containerRoot: URL, - args: [String], - instanceId: String - ) async throws { - let processKey = "\(plugin.name).\(instanceId)" - - // Check if already running - if let existing = pluginProcesses[processKey], existing.process.isRunning { - logger.info("Plugin already running: \(processKey)") - return - } - - logger.info("Starting plugin process: \(plugin.name) with instanceId: \(instanceId)") - logger.info("Binary path: \(plugin.binaryURL.path)") - logger.info("Arguments: \(args)") - - let process = Process() - process.executableURL = plugin.binaryURL - process.arguments = args - - // Set up environment - var env = Foundation.ProcessInfo.processInfo.environment - env["CONTAINER_APP_ROOT"] = appRoot.path - env["CONTAINER_INSTALL_ROOT"] = installRoot.path - - process.environment = env - - // Set up pipes for output - let stdoutPipe = Pipe() - let stderrPipe = Pipe() - - process.standardOutput = stdoutPipe - process.standardError = stderrPipe - - // Log output from the process - let pluginName = plugin.name - let logger = self.logger - - stdoutPipe.fileHandleForReading.readabilityHandler = { handle in - let data = handle.availableData - if !data.isEmpty, let str = String(data: data, encoding: .utf8) { - logger.debug( - "[\(pluginName)] stdout: \(str.trimmingCharacters(in: .whitespacesAndNewlines))" - ) - } - } - - stderrPipe.fileHandleForReading.readabilityHandler = { handle in - let data = handle.availableData - if !data.isEmpty, let str = String(data: data, encoding: .utf8) { - logger.info( - "[\(pluginName)] stderr: \(str.trimmingCharacters(in: .whitespacesAndNewlines))" - ) - } - } - - // Handle process termination - process.terminationHandler = { [weak self] proc in - Task { @MainActor in - self?.handlePluginTermination( - processKey: processKey, - exitCode: proc.terminationStatus - ) - } - } - - do { - try process.run() - - logger.info("Plugin process started with PID: \(process.processIdentifier)") - - pluginProcesses[processKey] = PluginProcessInfo( - process: process, - plugin: plugin, - instanceId: instanceId, - standardOutput: stdoutPipe, - standardError: stderrPipe - ) - - // Give the process a moment to start up and create its XPC server - try await Task.sleep(for: .milliseconds(500)) - } catch { - logger.error("Failed to start plugin process: \(error)") - throw ContainerizationError( - .internalError, - message: "Failed to start plugin \(plugin.name): \(error)" - ) - } - } - - /// Deregister and stop a plugin process - func deregisterPlugin(pluginName: String, instanceId: String) { - let processKey = "\(pluginName).\(instanceId)" - - guard let info = pluginProcesses[processKey] else { - logger.warning("No running process found for: \(processKey)") - return - } - - logger.info("Stopping plugin process: \(processKey)") - - if info.process.isRunning { - info.process.terminate() - - // Give it a moment to terminate gracefully - DispatchQueue.global().asyncAfter(deadline: .now() + 2) { - if info.process.isRunning { - info.process.interrupt() - } - } - } - - // Clean up pipes - info.standardOutput?.fileHandleForReading.readabilityHandler = nil - info.standardError?.fileHandleForReading.readabilityHandler = nil - - pluginProcesses.removeValue(forKey: processKey) - } - - /// Check if a plugin is running - func isPluginRunning(pluginName: String, instanceId: String) -> Bool { - let processKey = "\(pluginName).\(instanceId)" - - guard let info = pluginProcesses[processKey] else { - return false - } - - return info.process.isRunning - } - - /// Get the PID of a running plugin - func getPluginPid( - pluginName: String, - instanceId: String - ) -> Int32? { - let processKey = "\(pluginName).\(instanceId)" - - guard let info = pluginProcesses[processKey], info.process.isRunning - else { - return nil - } - - return info.process.processIdentifier - } - - /// Stop all running plugin processes - func stopAllPlugins() { - logger.info("Stopping all plugin processes...") - - for (key, info) in pluginProcesses { - logger.info("Stopping: \(key)") - if info.process.isRunning { - info.process.terminate() - } - info.standardOutput?.fileHandleForReading.readabilityHandler = nil - info.standardError?.fileHandleForReading.readabilityHandler = nil - } - - pluginProcesses.removeAll() - } - - private func handlePluginTermination(processKey: String, exitCode: Int32) { - logger.info( - "Plugin process terminated: \(processKey) with exit code: \(exitCode)" - ) - - if let info = pluginProcesses[processKey] { - info.standardOutput?.fileHandleForReading.readabilityHandler = nil - info.standardError?.fileHandleForReading.readabilityHandler = nil - } - - pluginProcesses.removeValue(forKey: processKey) - } -} diff --git a/ContainerSystem/Runtime/ContainerRuntime.swift b/ContainerSystem/Runtime/ContainerRuntime.swift deleted file mode 100644 index a25b42d..0000000 --- a/ContainerSystem/Runtime/ContainerRuntime.swift +++ /dev/null @@ -1,366 +0,0 @@ -// -// ContainerRuntime.swift -// Containers -// -// Manages the container system lifecycle and services -// -// Created by Axel Martinez on 2026/02/04. -// - -import Containerization -import ContainerizationError -import ContainerizationOCI -import Foundation -import Logging - -/// `ContainerRuntime` manages the lifecycle of the in-process container system, and owns -/// the services that run it. -/// -/// The services are created when the system starts and released when it stops. Managers -/// reach them through the `get…Service()` accessors, which throw while the system is stopped. -/// The runtime also holds the state the app observes, such as the system's status and its reports. -@Observable -@MainActor -class ContainerRuntime { - /// The runtime every manager uses, unless a test provides its own. - static let shared = ContainerRuntime() - - /// Creates the shared runtime. - private init() { - _ = Self._bootstrapLogging - var l = Logger(label: "app.containers.system") - #if DEBUG - l.logLevel = .debug - #else - l.logLevel = .info - #endif - self.logger = l - } - - #if DEBUG - /// Creates a runtime for tests, which subclass it to provide services of their own. - init(forTesting: Bool) { - _ = Self._bootstrapLogging - var l = Logger(label: "app.containers.system.test") - l.logLevel = .debug - self.logger = l - } - #endif - - // MARK: - Nested Types - - struct PluginProcessInfo { - let process: Foundation.Process - let plugin: Plugin - let instanceId: String - let standardOutput: Pipe? - let standardError: Pipe? - } - - // MARK: - Observable State - - var isRunning: Bool = false - var isStarting: Bool = false - var isStopping: Bool = false - var startupError: Error? - var lastContainerStateChange: Date = Date() - var reports: [Report] = [] - - /// What a first start is fetching, while it fetches it. - var setupProgress: Progress? - var pluginProcesses: [String: PluginProcessInfo] = [:] - - // Current configuration - var appRoot: URL? - var isAccessingAppRootSecurityScope = false - - // MARK: - Private State - - private var servicesInitialized = false - private var pluginLoader: PluginLoader? - private var containersService: ContainersService? - private var imagesService: ImagesService? - private var kernelService: KernelService? - private var reportsService: ReportsService? - private var contentStore: ContentStore? - - let logger: Logger - - private static let _bootstrapLogging: Void = LoggingSystem.bootstrap { label in - let category = label.split(separator: ".").last.map(String.init) ?? label - return OSLogHandler(subsystem: "app.containers", category: category) - } - - // MARK: - Service Accessors - - func getContainersService() async throws -> ContainersService { - guard let service = containersService else { - throw ContainerizationError( - .internalError, - message: "Containers service not initialized" - ) - } - return service - } - - func getImagesService() async throws -> ImagesService { - guard let service = imagesService else { - throw ContainerizationError( - .internalError, - message: "Images service not initialized" - ) - } - - return service - } - - func getKernelService() async throws -> KernelService { - guard let service = kernelService else { - throw ContainerizationError( - .internalError, - message: "Kernel service not initialized" - ) - } - - return service - } - - func getReportsService() throws -> ReportsService { - guard let service = reportsService else { - throw ContainerizationError( - .internalError, - message: "Reports service not initialized" - ) - } - - return service - } - - func getAppRoot() throws -> URL { - guard let appRoot = appRoot else { - throw ContainerizationError( - .internalError, - message: "App root not initialized" - ) - } - - return appRoot - } - - func getContentStore() throws -> ContentStore { - guard let contentStore = contentStore else { - throw ContainerizationError( - .internalError, - message: "Content store not initialized" - ) - } - - return contentStore - } - - // MARK: - Internal API - - /// Start the container system and initialize all managers - func start(appRoot: URL) async throws { - guard !isRunning && !isStarting else { - logger.info("System already running or starting") - return - } - - logger.info("Starting container system...") - - self.isStarting = true - self.startupError = nil - self.appRoot = appRoot - self.isAccessingAppRootSecurityScope = - appRoot.startAccessingSecurityScopedResource() - - defer { - isStarting = false - } - - do { - try createDataDirectories(appRoot: appRoot) - try await initializeServices(appRoot: appRoot) - try await installPrerequisites() - - isRunning = true - startupError = nil - - logger.info("Container system started successfully") - - } catch { - self.isRunning = false - - let wasCancelled = error is CancellationError || Task.isCancelled - - self.startupError = wasCancelled ? nil : error - - if isAccessingAppRootSecurityScope { - appRoot.stopAccessingSecurityScopedResource() - isAccessingAppRootSecurityScope = false - } - - self.appRoot = nil - - // Cleanup on failure. - stopAllPlugins() - discardServices() - - if wasCancelled { - logger.info("Start cancelled; system left stopped") - } else { - logger.error("Failed to start system: \(error)") - } - - throw error - } - } - - /// Stop the container system and all managers - func stop() async throws { - guard isRunning && !isStopping else { - logger.info("System not running or already stopping") - return - } - - isStopping = true - - defer { isStopping = false } - - logger.info("Stopping container system...") - - stopAllPlugins() - - await shutdownServices() - - isRunning = false - - if isAccessingAppRootSecurityScope { - appRoot?.stopAccessingSecurityScopedResource() - isAccessingAppRootSecurityScope = false - } - appRoot = nil - - logger.info("Container system stopped") - } - - // MARK: - Private Helpers - - /// Initialize all services for sandboxed mode - private func initializeServices(appRoot: URL) async throws { - guard !servicesInitialized else { - logger.info("Services already initialized") - return - } - - logger.info("Initializing services...") - - // Initialize images service (must come before containers service) - let imagesRoot = appRoot.appendingPathComponent("images") - - try FileManager.default.createDirectory( - at: imagesRoot, - withIntermediateDirectories: true - ) - - let contentStore = try LocalContentStore( - path: imagesRoot.appendingPathComponent("content") - ) - let imageStore = try ImageStore( - path: imagesRoot, - contentStore: contentStore - ) - let snapshotsPath = imagesRoot.appendingPathComponent("snapshots") - let imagesService = try ImagesService( - contentStore: contentStore, - imageStore: imageStore, - snapshotsPath: snapshotsPath, - log: logger - ) - - self.imagesService = imagesService - self.contentStore = contentStore - - let service = try ContainersService( - appRoot: appRoot, - imagesService: imagesService, - log: logger - ) - - self.containersService = service - - let kernel = try KernelService(log: logger, appRoot: appRoot) - - self.kernelService = kernel - - let reportsService = try ReportsService(appRoot: appRoot, log: logger) - - self.reportsService = reportsService - - servicesInitialized = true - - logger.info("Services initialized successfully") - - // Register callback to update runtime state when containers change - await service.addStateChangeCallback { @MainActor [weak self] in - guard let self = self else { return } - - self.lastContainerStateChange = Date() - } - - await reportsService.addChangeCallback { @MainActor [weak self] reports in - self?.reports = reports - } - } - - /// Shutdown all services - private func shutdownServices() async { - // Stop all running containers - if let service = containersService { - let list = await service.list() - for container in list where container.status == .running { - do { - try await service.stop( - id: container.configuration.id, - options: .default - ) - } catch { - logger.error( - "Error stopping container \(container.configuration.id): \(error)" - ) - } - } - } - - discardServices() - } - - /// Lets go of the services, so that the next start builds them again - /// rather than reaching for ones whose plugins have been stopped. - private func discardServices() { - containersService = nil - imagesService = nil - kernelService = nil - reportsService = nil - contentStore = nil - pluginLoader = nil - servicesInitialized = false - } - - private func createDataDirectories(appRoot: URL) throws { - logger.info("Creating data directories...") - - // Create app data directory with subdirectories - try FileManager.default.createDirectory( - at: appRoot, - withIntermediateDirectories: true - ) - - // Create content directory (for image storage) - try FileManager.default.createDirectory( - at: appRoot.appendingPathComponent("content"), - withIntermediateDirectories: true - ) - } -} diff --git a/ContainerSystem/Runtime/Services/Containers/ContainersService+Networking.swift b/ContainerSystem/Runtime/Services/Containers/ContainersService+Networking.swift deleted file mode 100644 index c386c33..0000000 --- a/ContainerSystem/Runtime/Services/Containers/ContainersService+Networking.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// ContainersService+Networking.swift -// Containers -// -// IP addresses for containers on the NAT network. -// -// Created by Axel Martinez on 2026/10/24. -// - -import ContainerizationError - -extension ContainersService { - func allocateIP(for id: String) throws -> (address: String, gateway: String) { - let hostNumber = ipAllocations[id] ?? (UInt8(2)...254).first { !ipAllocations.values.contains($0) } - - guard let hostNumber else { - throw ContainerizationError(.internalError, message: "no available IP addresses") - } - - ipAllocations[id] = hostNumber - return (address: "192.168.64.\(hostNumber)/24", gateway: "192.168.64.1") - } - - func releaseIP(for id: String) { - ipAllocations.removeValue(forKey: id) - } -} diff --git a/ContainerSystem/Runtime/Services/ImagesService.swift b/ContainerSystem/Runtime/Services/ImagesService.swift deleted file mode 100644 index 9b5a18f..0000000 --- a/ContainerSystem/Runtime/Services/ImagesService.swift +++ /dev/null @@ -1,190 +0,0 @@ -// -// ImagesService.swift -// Containers -// -// In-process image management service wrapping ImageStore and EXT4Unpacker. -// -// Created by Axel on 17/3/26. -// - -import Containerization -import ContainerizationError -import ContainerizationExtras -import ContainerizationOCI -import ContainerizationOS -import Foundation -import Logging - -/// A service that handles container images, wrapping ImageStore and EXT4Unpacker. -actor ImagesService { - private let imageStore: ImageStore - private let contentStore: ContentStore - private let snapshotsPath: URL - private let log: Logger - - init(contentStore: ContentStore, imageStore: ImageStore, snapshotsPath: URL, log: Logger) throws { - self.contentStore = contentStore - self.imageStore = imageStore - self.snapshotsPath = snapshotsPath - self.log = log - - try FileManager.default.createDirectory(at: snapshotsPath, withIntermediateDirectories: true) - } - - // MARK: - Internal API - - /// List all images in the store. - func list() async throws -> [ImageDescription] { - let images = try await imageStore.list() - return images.map { $0.description } - } - - /// Pull an image from a remote registry. - func pull( - reference: String, - platform: Platform?, - insecure: Bool, - auth: Authentication? = nil, - progressUpdate: ProgressHandler? - ) async throws -> ImageDescription { - // Try provided auth first, then keychain, then environment variables - let resolvedAuth = auth ?? resolveAuthentication(for: reference) - - let image = try await imageStore.pull( - reference: reference, - platform: platform, - insecure: insecure, - auth: resolvedAuth, - progress: progressUpdate - ) - return image.description - } - - /// Unpack an image to an EXT4 block device for use as a container rootfs. - func unpack( - description: ImageDescription, - platform: Platform?, - progressUpdate: ProgressHandler? - ) async throws { - let image = try await imageStore.get(reference: description.reference) - let targetPlatform = platform ?? .current - - // Determine the EXT4 file path for this image+platform combination - let ext4Path = snapshotFilePath(for: description, platform: targetPlatform) - - // Skip if already unpacked - if FileManager.default.fileExists(atPath: ext4Path.path) { - return - } - - let initImage = DefaultsStore.get(key: .defaultInitImage) - let blockSize = image.reference == initImage ? 512.mib() : 512.gib() - let unpacker = EXT4Unpacker(blockSizeInBytes: blockSize) - _ = try await unpacker.unpack(image, for: targetPlatform, at: ext4Path, progress: progressUpdate) - } - - /// Get a Filesystem representing the unpacked image snapshot. - func getImageSnapshot(description: ImageDescription, platform: Platform) async throws -> Filesystem { - let ext4Path = snapshotFilePath(for: description, platform: platform) - - guard FileManager.default.fileExists(atPath: ext4Path.path) else { - throw ContainerizationError( - .notFound, - message: "image snapshot not found at \(ext4Path.path). Was the image unpacked?" - ) - } - - return Filesystem(type: .block(format: "ext4"), source: ext4Path.path, destination: "/", options: []) - } - - /// Load images from an OCI layout directory on disk. - func load(from directory: URL, force: Bool = false) async throws -> ([ImageDescription], [String]) { - let images = try await imageStore.load(from: directory) - let descriptions = images.map { $0.description } - let references = descriptions.map { $0.reference } - return (descriptions, references) - } - - /// Tag an image with a new reference. - func tag(existing: String, new: String) async throws -> ImageDescription { - let image = try await imageStore.tag(existing: existing, new: new) - return image.description - } - - /// Save images to an OCI layout directory. - func save(references: [String], out: URL, platform: Platform?) async throws { - try await imageStore.save(references: references, out: out, platform: platform) - } - - /// Push an image to a remote registry. - func push( - reference: String, - platform: Platform?, - insecure: Bool, - auth: Authentication? = nil, - progressUpdate: ProgressHandler? - ) async throws { - let resolvedAuth = auth ?? resolveAuthentication(for: reference) - - try await imageStore.push( - reference: reference, - platform: platform, - insecure: insecure, - auth: resolvedAuth, - progress: progressUpdate - ) - } - - /// Delete an image by reference. - func delete(reference: String, garbageCollect: Bool = false) async throws { - try await imageStore.delete(reference: reference, performCleanup: garbageCollect) - } - - // MARK: - Private Helpers - - private func snapshotFilePath(for description: ImageDescription, platform: Platform) -> URL { - // Use a stable hash of the digest + platform for the snapshot file name - let key = "\(description.digest)-\(platform.os)-\(platform.architecture)" - let fileName = key.replacingOccurrences(of: ":", with: "-") - .replacingOccurrences(of: "/", with: "-") - return snapshotsPath.appendingPathComponent(fileName) - } - - /// Security domain for keychain credential lookups. - private static let keychainDomain = "app.containers.registry" - - /// Resolve authentication for a registry reference. - private func resolveAuthentication(for reference: String) -> Authentication? { - guard let hostname = Self.extractHostname(from: reference) else { - return nil - } - - // 1. Check environment variables (highest priority, enables CI/CD) - let env = ProcessInfo.processInfo.environment - if env["CONTAINER_REGISTRY_HOST"] == hostname, - let user = env["CONTAINER_REGISTRY_USER"], - let token = env["CONTAINER_REGISTRY_TOKEN"] - { - return BasicAuthentication(username: user, password: token) - } - - // 2. Check macOS Keychain (credentials stored via `container registry login`) - let keychain = KeychainHelper(securityDomain: Self.keychainDomain) - if let keychainAuth = try? keychain.lookup(hostname: hostname) { - return keychainAuth - } - - // 3. No credentials found — return nil for anonymous access. - // The RegistryClient handles the 401 → Bearer token exchange for public images. - return nil - } - - /// Extract the registry hostname from an image reference. - private static func extractHostname(from reference: String) -> String? { - guard let parsed = try? ContainerizationOCI.Reference.parse(reference) - else { - return nil - } - return parsed.resolvedDomain - } -} diff --git a/ContainerSystem/Volume/VolumeSummary.swift b/ContainerSystem/Volume/VolumeSummary.swift deleted file mode 100644 index 28b63b3..0000000 --- a/ContainerSystem/Volume/VolumeSummary.swift +++ /dev/null @@ -1,17 +0,0 @@ -// -// VolumeSummary.swift -// Containers -// -// Created by Axel Martinez on 03/10/2026. -// - -/// A volume as a list shows it: the volume, and whether a container uses it. -public struct VolumeSummary: Sendable { - public let volume: Volume - public let isInUse: Bool - - public init(volume: Volume, isInUse: Bool) { - self.volume = volume - self.isInUse = isInUse - } -} diff --git a/ContainerSystemTests/ContainerSystemTests.swift b/ContainerSystemTests/ContainerSystemTests.swift deleted file mode 100644 index 15cc86a..0000000 --- a/ContainerSystemTests/ContainerSystemTests.swift +++ /dev/null @@ -1,69 +0,0 @@ -// -// ContainerSystemTests.swift -// ContainerSystemTests -// -// Created by Axel Martinez on 2026/02/08. -// - -import Foundation -import Testing - -@testable import ContainerSystem - -@Suite("Container system", .serialized) -struct ContainerSystemTests { - - @Test("Start system") - @MainActor - func startSystem() async throws { - let testRuntime = MockContainerRuntime() - let system = SystemManager(testRuntime: testRuntime) - - let appRoot = FileManager.default.temporaryDirectory - .appendingPathComponent("test-containers-\(UUID().uuidString)") - - try await system.start(appRoot: appRoot) - - #expect(system.status == .running) - - try await system.stop() - } - - @Test("Start twice") - @MainActor - func startTwice() async throws { - let testRuntime = MockContainerRuntime() - let system = SystemManager(testRuntime: testRuntime) - - let appRoot = FileManager.default.temporaryDirectory - .appendingPathComponent("test-containers-\(UUID().uuidString)") - - try await system.start(appRoot: appRoot) - #expect(system.status == .running) - - // Starting again should not cause error - try await system.start(appRoot: appRoot) - #expect(system.status == .running) - - try await system.stop() - } - - @Test("Stop system") - @MainActor - func stopSystem() async throws { - let testRuntime = MockContainerRuntime() - let system = SystemManager(testRuntime: testRuntime) - - // Ensure system is started - let appRoot = FileManager.default.temporaryDirectory - .appendingPathComponent("test-containers-\(UUID().uuidString)") - - try await system.start(appRoot: appRoot) - #expect(system.status == .running) - - // Stop the system - try await system.stop() - - #expect(system.status == .notStarted) - } -} diff --git a/ContainerSystemTests/ImageManagerTests.swift b/ContainerSystemTests/ImageManagerTests.swift deleted file mode 100644 index 92d4c31..0000000 --- a/ContainerSystemTests/ImageManagerTests.swift +++ /dev/null @@ -1,139 +0,0 @@ -// -// ImageManagerTests.swift -// ContainerSystemTests -// -// Created by Axel Martinez on 2026/02/08. -// - -import Containerization -import ContainerizationOCI -import Foundation -import Testing - -@testable import ContainerSystem - -@Suite("Image manager") -struct ImageManagerTests { - - // MARK: - Setup Helper - - @MainActor - private func setupTestSystem() async throws -> (URL, ContainerRuntime) { - let appRoot = FileManager.default.temporaryDirectory - .appendingPathComponent("test-containers-\(UUID().uuidString)") - - let testRuntime = MockContainerRuntime() - let system = SystemManager(testRuntime: testRuntime) - try await system.start(appRoot: appRoot) - - return (appRoot, testRuntime) - } - - // MARK: - List Images Tests - - @Test("Empty store lists no images") - @MainActor - func emptyStoreListsNoImages() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let manager = ImageManager(testRuntime: testRuntime) - let images = try await manager.list() - - #expect(images.isEmpty) - } - - @Test("List fails after stop") - @MainActor - func listFailsAfterStop() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let manager = ImageManager(testRuntime: testRuntime) - try await testRuntime.stop() - - await #expect(throws: (any Error).self) { - _ = try await manager.list() - } - } - - @Test("List hides infrastructure images") - @MainActor - func listHidesInfrastructureImages() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let manager = ImageManager(testRuntime: testRuntime) - let images = try await manager.list() - - // Verify no infra images - let hasInfraImages = images.contains { image in - image.description.reference.hasPrefix("infra:") - } - #expect(hasInfraImages == false) - } - - // MARK: - Save Images Tests - - @Test("Save to directory") - @MainActor - func saveToDirectory() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let tempDir = FileManager.default.temporaryDirectory - .appendingPathComponent("ImageManagerTests") - .appendingPathComponent(UUID().uuidString) - - try FileManager.default.createDirectory( - at: tempDir, - withIntermediateDirectories: true - ) - - let manager = ImageManager(testRuntime: testRuntime) - try await manager.save( - images: [], - platform: .current, - outputURL: tempDir.appendingPathComponent("images.tar") - ) - - // Cleanup - try? FileManager.default.removeItem( - at: tempDir.deletingLastPathComponent() - ) - } - - @Test("Save empty list") - @MainActor - func saveEmptyList() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let tempDir = FileManager.default.temporaryDirectory - .appendingPathComponent("ImageManagerTests") - .appendingPathComponent(UUID().uuidString) - - try FileManager.default.createDirectory( - at: tempDir, - withIntermediateDirectories: true - ) - - let manager = ImageManager(testRuntime: testRuntime) - try await manager.save( - images: [], - platform: .current, - outputURL: tempDir.appendingPathComponent("images.tar") - ) - - // Cleanup - try? FileManager.default.removeItem( - at: tempDir.deletingLastPathComponent() - ) - } - - // MARK: - Delete Images Tests - - @Test("Delete empty list") - @MainActor - func deleteEmptyList() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let manager = ImageManager(testRuntime: testRuntime) - try await manager.delete(images: []) - } -} diff --git a/ContainerSystemTests/Mocks/MockContainerRuntime.swift b/ContainerSystemTests/Mocks/MockContainerRuntime.swift deleted file mode 100644 index def05be..0000000 --- a/ContainerSystemTests/Mocks/MockContainerRuntime.swift +++ /dev/null @@ -1,185 +0,0 @@ -// -// MockContainerRuntime.swift -// ContainerSystemTests -// -// Mock runtime for isolated testing without real container operations. -// - -import Containerization -import ContainerizationError -import ContainerizationOCI -import Foundation -import Logging - -@testable import ContainerSystem - -/// Mock runtime that provides isolated services for testing. -/// -/// Creates real but lightweight service instances backed by temporary -/// directories. All stores (ContentStore, ImageStore) are filesystem-only -/// and safe to use in a test host without special entitlements. -/// -/// The services live here rather than in the superclass's own storage, which -/// is private; the runtime's accessors are the seam, so they are overridden -/// to hand back these instances. -@MainActor -final class MockContainerRuntime: ContainerRuntime { - - private var mockContainersService: ContainersService? - private var mockImagesService: ImagesService? - private var mockKernelService: KernelService? - private var mockReportsService: ReportsService? - private var mockContentStore: ContentStore? - - init() { - super.init(forTesting: true) - } - - // MARK: - Service Accessors - - override func getContainersService() async throws -> ContainersService { - guard let service = mockContainersService else { - throw ContainerizationError( - .internalError, - message: "Containers service not initialized" - ) - } - - return service - } - - override func getImagesService() async throws -> ImagesService { - guard let service = mockImagesService else { - throw ContainerizationError( - .internalError, - message: "Images service not initialized" - ) - } - - return service - } - - override func getKernelService() async throws -> KernelService { - guard let service = mockKernelService else { - throw ContainerizationError( - .internalError, - message: "Kernel service not initialized" - ) - } - - return service - } - - override func getReportsService() throws -> ReportsService { - guard let service = mockReportsService else { - throw ContainerizationError( - .internalError, - message: "Reports service not initialized" - ) - } - - return service - } - - override func getContentStore() throws -> ContentStore { - guard let store = mockContentStore else { - throw ContainerizationError( - .internalError, - message: "Content store not initialized" - ) - } - - return store - } - - // MARK: - Lifecycle - - // Override start to set up isolated services in a temp directory - override func start(appRoot: URL) async throws { - guard !isRunning && !isStarting else { - return - } - - isStarting = true - defer { isStarting = false } - - // Create directory structure - let fm = FileManager.default - try fm.createDirectory(at: appRoot, withIntermediateDirectories: true) - - let imagesRoot = appRoot.appendingPathComponent("images") - try fm.createDirectory( - at: imagesRoot, - withIntermediateDirectories: true - ) - - // Set appRoot so getAppRoot() works - self.appRoot = appRoot - - let reports = try ReportsService(appRoot: appRoot, log: logger) - - await reports.addChangeCallback { @MainActor [weak self] reports in - self?.reports = reports - } - - self.mockReportsService = reports - - // Create stores — these are filesystem-only and safe in test hosts - let localContentStore = try LocalContentStore( - path: imagesRoot.appendingPathComponent("content") - ) - let imageStore = try ImageStore( - path: imagesRoot, - contentStore: localContentStore - ) - let snapshotsPath = imagesRoot.appendingPathComponent("snapshots") - - let images = try ImagesService( - contentStore: localContentStore, - imageStore: imageStore, - snapshotsPath: snapshotsPath, - log: logger - ) - self.mockImagesService = images - self.mockContentStore = localContentStore - - // ContainersService — reads existing containers from disk (empty in tests) - self.mockContainersService = try ContainersService( - appRoot: appRoot, - imagesService: images, - log: logger - ) - - // KernelService — just creates a directory - self.mockKernelService = try KernelService( - log: logger, - appRoot: appRoot - ) - - isRunning = true - startupError = nil - } - - // Override stop to clean up - override func stop() async throws { - guard isRunning && !isStopping else { - return - } - - isStopping = true - defer { isStopping = false } - - mockContainersService = nil - mockImagesService = nil - mockKernelService = nil - mockReportsService = nil - mockContentStore = nil - isRunning = false - - // Clean up temp directory - if let root = appRoot { - try? FileManager.default.removeItem(at: root) - self.appRoot = nil - } - } -} diff --git a/ContainerSystemTests/ReportManagerTests.swift b/ContainerSystemTests/ReportManagerTests.swift deleted file mode 100644 index 71debca..0000000 --- a/ContainerSystemTests/ReportManagerTests.swift +++ /dev/null @@ -1,74 +0,0 @@ -// -// ReportManagerTests.swift -// ContainerSystemTests -// -// Recording reports, and keeping the runtime's list in step with the store. -// - -import Foundation -import Testing - -@testable import ContainerSystem - -@Suite("Report manager") -@MainActor -struct ReportManagerTests { - private struct Failure: Error {} - - private func makeManager(in directory: TemporaryDirectory) async throws -> ReportManager { - let runtime = MockContainerRuntime() - - try await SystemManager(testRuntime: runtime).start(appRoot: directory.url) - - return ReportManager(testRuntime: runtime) - } - - @Test("Recorded report comes first") - func recordedReportComesFirst() async throws { - let directory = try TemporaryDirectory() - - defer { directory.remove() } - - let manager = try await makeManager(in: directory) - - await manager.record(kind: .image, name: "alpine", message: "The pull failed.", error: Failure()) - let latest = try #require( - await manager.record(kind: .build, name: "nginx", message: "The build failed.", error: Failure()) - ) - - #expect(manager.reports.first == latest) - #expect(manager.reports.count == 2) - #expect(manager.unreadCount == 2) - } - - @Test("Marking read updates the list and the store") - func markingReadUpdatesListAndStore() async throws { - let directory = try TemporaryDirectory() - - defer { directory.remove() } - - let manager = try await makeManager(in: directory) - let report = try #require( - await manager.record(kind: .container, name: "web", message: "The container stopped.", error: Failure()) - ) - - await manager.markRead([report.id]) - - #expect(manager.isRead(report.id)) - #expect(manager.unreadCount == 0) - - await manager.refresh() - - #expect(manager.isRead(report.id)) - } - - @Test("Stopped system records nothing") - func stoppedSystemRecordsNothing() async { - let manager = ReportManager(testRuntime: MockContainerRuntime()) - - let report = await manager.record(kind: .image, name: "alpine", message: "The pull failed.", error: Failure()) - - #expect(report == nil) - #expect(manager.reports.isEmpty) - } -} diff --git a/ContainerSystemTests/SystemManagerTests.swift b/ContainerSystemTests/SystemManagerTests.swift deleted file mode 100644 index 3241f7d..0000000 --- a/ContainerSystemTests/SystemManagerTests.swift +++ /dev/null @@ -1,94 +0,0 @@ -// -// SystemManagerTests.swift -// ContainerSystemTests -// -// Stopping a start that is under way. -// - -import Foundation -import Testing - -@testable import ContainerSystem - -/// A start that never finishes of its own accord, so that only cancelling -/// brings it to an end. -@MainActor -private final class NeverFinishingRuntime: ContainerRuntime { - private(set) var didFinish = false - - init() { - super.init(forTesting: true) - } - - override func start(appRoot: URL) async throws { - isStarting = true - - defer { - isStarting = false - } - - try await Task.sleep(for: .seconds(30)) - - didFinish = true - } -} - -@Suite("System manager") -@MainActor -struct SystemManagerTests { - - /// The sheet that offers to stop a first run is not always the thing that - /// began it: the dashboard starts the system on later launches and the - /// sheet only opens onto the work. Cancelling has to reach it either way. - @Test("Cancel start begun elsewhere") - func cancelsStartBegunElsewhere() async throws { - let runtime = NeverFinishingRuntime() - let system = SystemManager(testRuntime: runtime) - - // Whoever is waiting here never cancels its own task, the way the - // dashboard's start task does not. - let work = Task { try await system.start(appRoot: .temporaryDirectory) } - - while system.status != .starting { - try await Task.sleep(for: .milliseconds(10)) - } - - system.cancelStart() - - await #expect(throws: CancellationError.self) { - try await work.value - } - - #expect(runtime.didFinish == false) - #expect(system.status == .notStarted) - } - - @Test("Cancel start from caller") - func cancelsStartFromTheCaller() async throws { - let runtime = NeverFinishingRuntime() - let system = SystemManager(testRuntime: runtime) - - let work = Task { try await system.start(appRoot: .temporaryDirectory) } - - while system.status != .starting { - try await Task.sleep(for: .milliseconds(10)) - } - - work.cancel() - - await #expect(throws: CancellationError.self) { - try await work.value - } - - #expect(runtime.didFinish == false) - } - - @Test("Cancel with nothing starting") - func cancelsNothingSafely() { - let system = SystemManager(testRuntime: NeverFinishingRuntime()) - - system.cancelStart() - - #expect(system.status == .notStarted) - } -} diff --git a/ContainerSystemTests/VolumeManagerTests.swift b/ContainerSystemTests/VolumeManagerTests.swift deleted file mode 100644 index c6eb386..0000000 --- a/ContainerSystemTests/VolumeManagerTests.swift +++ /dev/null @@ -1,195 +0,0 @@ -// -// VolumeManagerTests.swift -// ContainerSystemTests -// -// Created by Axel Martinez on 2026/02/08. -// - -import ContainerizationError -import Foundation -import Testing - -@testable import ContainerSystem - -@Suite("Volume manager", .serialized) -struct VolumeManagerTests { - - // MARK: - Setup Helper - - @MainActor - private func setupTestSystem() async throws -> (URL, ContainerRuntime) { - let appRoot = FileManager.default.temporaryDirectory - .appendingPathComponent("test-containers-\(UUID().uuidString)") - - let testRuntime = MockContainerRuntime() - let system = SystemManager(testRuntime: testRuntime) - - try await system.start(appRoot: appRoot) - - return (appRoot, testRuntime) - } - - // MARK: - List Volumes Tests - - @Test("Empty store lists no volumes") - @MainActor - func emptyStoreListsNoVolumes() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let manager = VolumeManager(testRuntime: testRuntime) - let volumes = try await manager.list() - - #expect(volumes.isEmpty) - } - - // MARK: - Create Volume Tests - - @Test("Created volume is listed") - @MainActor - func createdVolumeIsListed() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let volumeName = "test-volume-\(UUID().uuidString)" - let manager = VolumeManager(testRuntime: testRuntime) - - let volume = try await manager.create( - name: volumeName, - labels: [], - options: [], - sizeInBytes: 1024 * 1024 // 1 MB - ) - - #expect(volume.name == volumeName) - #expect(volume.driver == "local") - #expect(volume.format == "ext4") - #expect(volume.source.hasSuffix("volume.ext4")) - #expect(volume.sizeInBytes == 1024 * 1024) - - let volumes = try await manager.list() - #expect(volumes.contains(where: { $0.name == volumeName })) - } - - @Test("Default size when none given") - @MainActor - func createWithDefaultSize() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let volumeName = "test-volume-\(UUID().uuidString)" - let manager = VolumeManager(testRuntime: testRuntime) - - let volume = try await manager.create( - name: volumeName, - labels: [], - options: [], - sizeInBytes: nil - ) - - #expect(volume.source.hasSuffix("volume.ext4")) - #expect(volume.sizeInBytes == VolumeStorage.defaultVolumeSizeBytes) - - let volumes = try await manager.list() - #expect( - volumes.first(where: { $0.name == volumeName })?.sizeInBytes - == VolumeStorage.defaultVolumeSizeBytes - ) - } - - @Test("Invalid name throws") - @MainActor - func invalidNameThrows() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let manager = VolumeManager(testRuntime: testRuntime) - - await #expect(throws: VolumeError.self) { - _ = try await manager.create( - name: "invalid name!", - labels: [], - options: [], - sizeInBytes: nil - ) - } - } - - @Test("Duplicate name throws") - @MainActor - func duplicateNameThrows() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let volumeName = "test-volume-\(UUID().uuidString)" - let manager = VolumeManager(testRuntime: testRuntime) - - _ = try await manager.create( - name: volumeName, - labels: [], - options: [], - sizeInBytes: 1024 * 1024 - ) - - await #expect(throws: VolumeError.self) { - _ = try await manager.create( - name: volumeName, - labels: [], - options: [], - sizeInBytes: 1024 * 1024 - ) - } - } - - // MARK: - Delete Volume Tests - - @Test("Delete empty list") - @MainActor - func deleteEmptyList() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let manager = VolumeManager(testRuntime: testRuntime) - - try await manager.delete(volumes: []) - } - - @Test("Delete removes volume") - @MainActor - func deleteRemovesVolume() async throws { - let (_, testRuntime) = try await setupTestSystem() - - let volumeName = "test-volume-\(UUID().uuidString)" - let manager = VolumeManager(testRuntime: testRuntime) - - let volume = try await manager.create( - name: volumeName, - labels: [], - options: [], - sizeInBytes: 1024 * 1024 - ) - - try await manager.delete(volumes: [volume]) - - let volumes = try await manager.list() - #expect(!volumes.contains(where: { $0.name == volumeName })) - } - - @Test("Delete removes the volume's reports") - @MainActor - func deleteRemovesVolumeReports() async throws { - struct Failure: Error {} - - let (_, testRuntime) = try await setupTestSystem() - - let volumeName = "test-volume-\(UUID().uuidString)" - let manager = VolumeManager(testRuntime: testRuntime) - let reportManager = ReportManager(testRuntime: testRuntime) - - let volume = try await manager.create( - name: volumeName, - labels: [], - options: [], - sizeInBytes: 1024 * 1024 - ) - - await reportManager.record(kind: .volume, name: volumeName, message: "The volume failed.", error: Failure()) - try await manager.delete(volumes: [volume]) - - #expect(reportManager.reports.isEmpty) - } -} diff --git a/Containers.xcodeproj/project.pbxproj b/Containers.xcodeproj/project.pbxproj index 5ea11dd..cab63be 100644 --- a/Containers.xcodeproj/project.pbxproj +++ b/Containers.xcodeproj/project.pbxproj @@ -7,16 +7,18 @@ objects = { /* Begin PBXBuildFile section */ - 773509582F34FC7D00C5471F /* libContainerSystem.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 773509102F34EA2F00C5471F /* libContainerSystem.dylib */; }; - 77350BA92F35B17100C5471F /* libContainerSystem.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 773509102F34EA2F00C5471F /* libContainerSystem.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 77350BAB2F35B53700C5471F /* libContainerSystem.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 773509102F34EA2F00C5471F /* libContainerSystem.dylib */; }; - 77350BAC2F35B53700C5471F /* libContainerSystem.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 773509102F34EA2F00C5471F /* libContainerSystem.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 773509582F34FC7D00C5471F /* libContainersCore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 773509102F34EA2F00C5471F /* libContainersCore.dylib */; }; + 77350BA92F35B17100C5471F /* libContainersCore.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 773509102F34EA2F00C5471F /* libContainersCore.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; + 77350BAB2F35B53700C5471F /* libContainersCore.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 773509102F34EA2F00C5471F /* libContainersCore.dylib */; }; + 77350BAC2F35B53700C5471F /* libContainersCore.dylib in Embed Libraries */ = {isa = PBXBuildFile; fileRef = 773509102F34EA2F00C5471F /* libContainersCore.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 77C44F1B2F698D0600167C4D /* Containerization in Frameworks */ = {isa = PBXBuildFile; productRef = 77C44F1A2F698D0600167C4D /* Containerization */; }; 77C44F1D2F698D0600167C4D /* ContainerizationArchive in Frameworks */ = {isa = PBXBuildFile; productRef = 77C44F1C2F698D0600167C4D /* ContainerizationArchive */; }; 77C44F1F2F698D0600167C4D /* ContainerizationEXT4 in Frameworks */ = {isa = PBXBuildFile; productRef = 77C44F1E2F698D0600167C4D /* ContainerizationEXT4 */; }; 77C44F212F698D0600167C4D /* ContainerizationExtras in Frameworks */ = {isa = PBXBuildFile; productRef = 77C44F202F698D0600167C4D /* ContainerizationExtras */; }; 77C44F232F698D0600167C4D /* ContainerizationIO in Frameworks */ = {isa = PBXBuildFile; productRef = 77C44F222F698D0600167C4D /* ContainerizationIO */; }; 77C44F252F698E9A00167C4D /* ContainerizationOCI in Frameworks */ = {isa = PBXBuildFile; productRef = 77C44F242F698E9A00167C4D /* ContainerizationOCI */; }; + A1C0F16E2FB0000100C0FFEE /* Configuration in Frameworks */ = {isa = PBXBuildFile; productRef = A1C0F16C2FB0000100C0FFEE /* Configuration */; }; + A1C0F16F2FB0000100C0FFEE /* ConfigurationTOML in Frameworks */ = {isa = PBXBuildFile; productRef = A1C0F16D2FB0000100C0FFEE /* ConfigurationTOML */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -25,21 +27,21 @@ containerPortal = 9829EC3A2E17BA3C00A9F8D3 /* Project object */; proxyType = 1; remoteGlobalIDString = 7735090F2F34EA2F00C5471F; - remoteInfo = ContainerSystem; + remoteInfo = ContainersCore; }; 7735094D2F34EB8100C5471F /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9829EC3A2E17BA3C00A9F8D3 /* Project object */; proxyType = 1; remoteGlobalIDString = 7735090F2F34EA2F00C5471F; - remoteInfo = ContainerSystem; + remoteInfo = ContainersCore; }; 77350BAD2F35B53700C5471F /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 9829EC3A2E17BA3C00A9F8D3 /* Project object */; proxyType = 1; remoteGlobalIDString = 7735090F2F34EA2F00C5471F; - remoteInfo = ContainerSystem; + remoteInfo = ContainersCore; }; /* End PBXContainerItemProxy section */ @@ -50,7 +52,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 77350BA92F35B17100C5471F /* libContainerSystem.dylib in Embed Libraries */, + 77350BA92F35B17100C5471F /* libContainersCore.dylib in Embed Libraries */, ); name = "Embed Libraries"; runOnlyForDeploymentPostprocessing = 0; @@ -61,7 +63,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 77350BAC2F35B53700C5471F /* libContainerSystem.dylib in Embed Libraries */, + 77350BAC2F35B53700C5471F /* libContainersCore.dylib in Embed Libraries */, ); name = "Embed Libraries"; runOnlyForDeploymentPostprocessing = 0; @@ -69,8 +71,8 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 773508642F34E40500C5471F /* ContainerSystemTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ContainerSystemTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 773509102F34EA2F00C5471F /* libContainerSystem.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libContainerSystem.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; + 773508642F34E40500C5471F /* ContainersCoreTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ContainersCoreTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 773509102F34EA2F00C5471F /* libContainersCore.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libContainersCore.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; 9829EC422E17BA3C00A9F8D3 /* Containers.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Containers.app; sourceTree = BUILT_PRODUCTS_DIR; }; A1C0F1A12F80000000C0F1A1 /* Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Base.xcconfig; sourceTree = ""; }; /* End PBXFileReference section */ @@ -86,14 +88,14 @@ /* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ /* Begin PBXFileSystemSynchronizedRootGroup section */ - 773508652F34E40500C5471F /* ContainerSystemTests */ = { + 773508652F34E40500C5471F /* ContainersCoreTests */ = { isa = PBXFileSystemSynchronizedRootGroup; - path = ContainerSystemTests; + path = ContainersCoreTests; sourceTree = ""; }; - 77C44F6E2F69C4EE00167C4D /* ContainerSystem */ = { + 77C44F6E2F69C4EE00167C4D /* ContainersCore */ = { isa = PBXFileSystemSynchronizedRootGroup; - path = ContainerSystem; + path = ContainersCore; sourceTree = ""; }; 9829EC442E17BA3C00A9F8D3 /* Containers */ = { @@ -111,7 +113,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 77350BAB2F35B53700C5471F /* libContainerSystem.dylib in Frameworks */, + 77350BAB2F35B53700C5471F /* libContainersCore.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -125,6 +127,8 @@ 77C44F1F2F698D0600167C4D /* ContainerizationEXT4 in Frameworks */, 77C44F212F698D0600167C4D /* ContainerizationExtras in Frameworks */, 77C44F1B2F698D0600167C4D /* Containerization in Frameworks */, + A1C0F16E2FB0000100C0FFEE /* Configuration in Frameworks */, + A1C0F16F2FB0000100C0FFEE /* ConfigurationTOML in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -132,7 +136,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 773509582F34FC7D00C5471F /* libContainerSystem.dylib in Frameworks */, + 773509582F34FC7D00C5471F /* libContainersCore.dylib in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -143,8 +147,8 @@ isa = PBXGroup; children = ( 9829EC442E17BA3C00A9F8D3 /* Containers */, - 77C44F6E2F69C4EE00167C4D /* ContainerSystem */, - 773508652F34E40500C5471F /* ContainerSystemTests */, + 77C44F6E2F69C4EE00167C4D /* ContainersCore */, + 773508652F34E40500C5471F /* ContainersCoreTests */, A1C0F1A22F80000000C0F1A1 /* Configuration */, 9829EC432E17BA3C00A9F8D3 /* Products */, ); @@ -154,8 +158,8 @@ isa = PBXGroup; children = ( 9829EC422E17BA3C00A9F8D3 /* Containers.app */, - 773508642F34E40500C5471F /* ContainerSystemTests.xctest */, - 773509102F34EA2F00C5471F /* libContainerSystem.dylib */, + 773508642F34E40500C5471F /* ContainersCoreTests.xctest */, + 773509102F34EA2F00C5471F /* libContainersCore.dylib */, ); name = Products; sourceTree = ""; @@ -181,9 +185,9 @@ /* End PBXHeadersBuildPhase section */ /* Begin PBXNativeTarget section */ - 773508632F34E40500C5471F /* ContainerSystemTests */ = { + 773508632F34E40500C5471F /* ContainersCoreTests */ = { isa = PBXNativeTarget; - buildConfigurationList = 7735086A2F34E40500C5471F /* Build configuration list for PBXNativeTarget "ContainerSystemTests" */; + buildConfigurationList = 7735086A2F34E40500C5471F /* Build configuration list for PBXNativeTarget "ContainersCoreTests" */; buildPhases = ( 773508602F34E40500C5471F /* Sources */, 773508612F34E40500C5471F /* Frameworks */, @@ -197,18 +201,18 @@ 77350BAE2F35B53700C5471F /* PBXTargetDependency */, ); fileSystemSynchronizedGroups = ( - 773508652F34E40500C5471F /* ContainerSystemTests */, + 773508652F34E40500C5471F /* ContainersCoreTests */, ); - name = ContainerSystemTests; + name = ContainersCoreTests; packageProductDependencies = ( ); productName = ContainersTests; - productReference = 773508642F34E40500C5471F /* ContainerSystemTests.xctest */; + productReference = 773508642F34E40500C5471F /* ContainersCoreTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; - 7735090F2F34EA2F00C5471F /* ContainerSystem */ = { + 7735090F2F34EA2F00C5471F /* ContainersCore */ = { isa = PBXNativeTarget; - buildConfigurationList = 773509112F34EA2F00C5471F /* Build configuration list for PBXNativeTarget "ContainerSystem" */; + buildConfigurationList = 773509112F34EA2F00C5471F /* Build configuration list for PBXNativeTarget "ContainersCore" */; buildPhases = ( 7735090C2F34EA2F00C5471F /* Headers */, 7735090D2F34EA2F00C5471F /* Sources */, @@ -219,9 +223,9 @@ dependencies = ( ); fileSystemSynchronizedGroups = ( - 77C44F6E2F69C4EE00167C4D /* ContainerSystem */, + 77C44F6E2F69C4EE00167C4D /* ContainersCore */, ); - name = ContainerSystem; + name = ContainersCore; packageProductDependencies = ( 77C44F1A2F698D0600167C4D /* Containerization */, 77C44F1C2F698D0600167C4D /* ContainerizationArchive */, @@ -229,9 +233,11 @@ 77C44F202F698D0600167C4D /* ContainerizationExtras */, 77C44F222F698D0600167C4D /* ContainerizationIO */, 77C44F242F698E9A00167C4D /* ContainerizationOCI */, + A1C0F16C2FB0000100C0FFEE /* Configuration */, + A1C0F16D2FB0000100C0FFEE /* ConfigurationTOML */, ); - productName = ContainerSystem; - productReference = 773509102F34EA2F00C5471F /* libContainerSystem.dylib */; + productName = ContainersCore; + productReference = 773509102F34EA2F00C5471F /* libContainersCore.dylib */; productType = "com.apple.product-type.library.dynamic"; }; 9829EC412E17BA3C00A9F8D3 /* Containers */ = { @@ -291,6 +297,8 @@ minimizedProjectReferenceProxies = 1; packageReferences = ( 77C44F192F698D0600167C4D /* XCRemoteSwiftPackageReference "containerization" */, + A1C0F16A2FB0000100C0FFEE /* XCRemoteSwiftPackageReference "swift-configuration" */, + A1C0F16B2FB0000100C0FFEE /* XCRemoteSwiftPackageReference "swift-configuration-toml" */, ); preferredProjectObjectVersion = 77; productRefGroup = 9829EC432E17BA3C00A9F8D3 /* Products */; @@ -298,8 +306,8 @@ projectRoot = ""; targets = ( 9829EC412E17BA3C00A9F8D3 /* Containers */, - 7735090F2F34EA2F00C5471F /* ContainerSystem */, - 773508632F34E40500C5471F /* ContainerSystemTests */, + 7735090F2F34EA2F00C5471F /* ContainersCore */, + 773508632F34E40500C5471F /* ContainersCoreTests */, ); }; /* End PBXProject section */ @@ -369,17 +377,17 @@ /* Begin PBXTargetDependency section */ 773509152F34EA4700C5471F /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 7735090F2F34EA2F00C5471F /* ContainerSystem */; + target = 7735090F2F34EA2F00C5471F /* ContainersCore */; targetProxy = 773509142F34EA4700C5471F /* PBXContainerItemProxy */; }; 7735094E2F34EB8100C5471F /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 7735090F2F34EA2F00C5471F /* ContainerSystem */; + target = 7735090F2F34EA2F00C5471F /* ContainersCore */; targetProxy = 7735094D2F34EB8100C5471F /* PBXContainerItemProxy */; }; 77350BAE2F35B53700C5471F /* PBXTargetDependency */ = { isa = PBXTargetDependency; - target = 7735090F2F34EA2F00C5471F /* ContainerSystem */; + target = 7735090F2F34EA2F00C5471F /* ContainersCore */; targetProxy = 77350BAD2F35B53700C5471F /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ @@ -488,6 +496,7 @@ COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; + DEVELOPMENT_TEAM = ZTW69M5NDR; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; ENABLE_USER_SCRIPT_SANDBOXING = YES; @@ -555,6 +564,7 @@ COPY_PHASE_STRIP = NO; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DEVELOPMENT_TEAM = ZTW69M5NDR; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_USER_SCRIPT_SANDBOXING = YES; @@ -585,6 +595,7 @@ AUTOMATION_APPLE_EVENTS = NO; CODE_SIGN_ENTITLEMENTS = "Containers/Supporting Files/Containers.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; @@ -615,7 +626,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 26.0; - MARKETING_VERSION = 0.1; + MARKETING_VERSION = 0.2; OTHER_SWIFT_FLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = app.containers.Containers; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -643,6 +654,7 @@ AUTOMATION_APPLE_EVENTS = NO; CODE_SIGN_ENTITLEMENTS = "Containers/Supporting Files/Containers.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 1; @@ -673,7 +685,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 26.0; - MARKETING_VERSION = 0.1; + MARKETING_VERSION = 0.2; OTHER_SWIFT_FLAGS = ""; PRODUCT_BUNDLE_IDENTIFIER = app.containers.Containers; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -696,7 +708,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 7735086A2F34E40500C5471F /* Build configuration list for PBXNativeTarget "ContainerSystemTests" */ = { + 7735086A2F34E40500C5471F /* Build configuration list for PBXNativeTarget "ContainersCoreTests" */ = { isa = XCConfigurationList; buildConfigurations = ( 7735086B2F34E40500C5471F /* Debug */, @@ -705,7 +717,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 773509112F34EA2F00C5471F /* Build configuration list for PBXNativeTarget "ContainerSystem" */ = { + 773509112F34EA2F00C5471F /* Build configuration list for PBXNativeTarget "ContainersCore" */ = { isa = XCConfigurationList; buildConfigurations = ( 773509122F34EA2F00C5471F /* Debug */, @@ -738,9 +750,25 @@ 77C44F192F698D0600167C4D /* XCRemoteSwiftPackageReference "containerization" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/apple/containerization"; + requirement = { + kind = exactVersion; + version = 0.53.0; + }; + }; + A1C0F16A2FB0000100C0FFEE /* XCRemoteSwiftPackageReference "swift-configuration" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/apple/swift-configuration"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 0.28.0; + minimumVersion = 1.2.0; + }; + }; + A1C0F16B2FB0000100C0FFEE /* XCRemoteSwiftPackageReference "swift-configuration-toml" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/mattt/swift-configuration-toml"; + requirement = { + kind = upToNextMajorVersion; + minimumVersion = 2.0.0; }; }; /* End XCRemoteSwiftPackageReference section */ @@ -776,6 +804,16 @@ package = 77C44F192F698D0600167C4D /* XCRemoteSwiftPackageReference "containerization" */; productName = ContainerizationOCI; }; + A1C0F16C2FB0000100C0FFEE /* Configuration */ = { + isa = XCSwiftPackageProductDependency; + package = A1C0F16A2FB0000100C0FFEE /* XCRemoteSwiftPackageReference "swift-configuration" */; + productName = Configuration; + }; + A1C0F16D2FB0000100C0FFEE /* ConfigurationTOML */ = { + isa = XCSwiftPackageProductDependency; + package = A1C0F16B2FB0000100C0FFEE /* XCRemoteSwiftPackageReference "swift-configuration-toml" */; + productName = ConfigurationTOML; + }; /* End XCSwiftPackageProductDependency section */ }; rootObject = 9829EC3A2E17BA3C00A9F8D3 /* Project object */; diff --git a/Containers.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Containers.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index b48f2b1..e28416c 100644 --- a/Containers.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Containers.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "bf267a3d407ae7e6ed913576e17f1ea11f47ddc5955b04771eb158664fe3319a", + "originHash" : "c7aaff6d7c62768080efdce268f2b0d86e7e8ad9ad757915fbfee80ff614a5bc", "pins" : [ { "identity" : "async-http-client", @@ -15,8 +15,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/containerization.git", "state" : { - "revision" : "f8a18e8dcd965eefcfe65ead986405533c7e3872", - "version" : "0.32.1" + "revision" : "f79e412d7c31b00c65c8a6f80dd0b0bb55f6a4f7", + "version" : "0.53.0" } }, { @@ -33,8 +33,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/grpc/grpc-swift-nio-transport.git", "state" : { - "revision" : "f37e0c2d293cea668b11e10e1fb1c24cb40781ff", - "version" : "2.4.4" + "revision" : "9765a256477383b9d441f20952118b75104304e8", + "version" : "2.11.0" } }, { @@ -109,6 +109,24 @@ "version" : "1.3.0" } }, + { + "identity" : "swift-configuration", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-configuration", + "state" : { + "revision" : "4e916072eb34f3c136ae64bd2859d6072cdb1b6e", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-configuration-toml", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mattt/swift-configuration-toml", + "state" : { + "revision" : "4ea16b4dfa4b023cecae5ae0368402c4d846d613", + "version" : "2.0.0" + } + }, { "identity" : "swift-crypto", "kind" : "remoteSourceControl", @@ -145,13 +163,22 @@ "version" : "1.10.1" } }, + { + "identity" : "swift-metrics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-metrics", + "state" : { + "revision" : "2c13e7385089ea705ee3009ea6cbe41db843930e", + "version" : "2.13.0" + } + }, { "identity" : "swift-nio", "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio.git", "state" : { - "revision" : "a18bddb0acf7a40d982b2f128ce73ce4ee31f352", - "version" : "2.86.2" + "revision" : "6db9d9abd92ad7399b8a564cafbb87d3507245fa", + "version" : "2.104.0" } }, { @@ -168,8 +195,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-nio-http2.git", "state" : { - "revision" : "5e9e99ec96c53bc2c18ddd10c1e25a3cd97c55e5", - "version" : "1.38.0" + "revision" : "0f3e54e29c944c2e835ad52159da7d9e1c94ac69", + "version" : "1.46.0" } }, { @@ -226,6 +253,15 @@ "version" : "1.6.4" } }, + { + "identity" : "swift-toml", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mattt/swift-toml.git", + "state" : { + "revision" : "8227201d741c82183c9b0531a7d9ec7fa9240a2f", + "version" : "2.1.0" + } + }, { "identity" : "zstd", "kind" : "remoteSourceControl", diff --git a/Containers.xcodeproj/xcshareddata/xcschemes/Containers (macOS).xcscheme b/Containers.xcodeproj/xcshareddata/xcschemes/Containers (macOS).xcscheme index 0882f9a..2cea698 100644 --- a/Containers.xcodeproj/xcshareddata/xcschemes/Containers (macOS).xcscheme +++ b/Containers.xcodeproj/xcshareddata/xcschemes/Containers (macOS).xcscheme @@ -36,8 +36,8 @@ diff --git a/Containers.xcodeproj/xcshareddata/xcschemes/ContainerSystemTests.xcscheme b/Containers.xcodeproj/xcshareddata/xcschemes/ContainersCoreTests.xcscheme similarity index 91% rename from Containers.xcodeproj/xcshareddata/xcschemes/ContainerSystemTests.xcscheme rename to Containers.xcodeproj/xcshareddata/xcschemes/ContainersCoreTests.xcscheme index f7f7f51..57a64fe 100644 --- a/Containers.xcodeproj/xcshareddata/xcschemes/ContainerSystemTests.xcscheme +++ b/Containers.xcodeproj/xcshareddata/xcschemes/ContainersCoreTests.xcscheme @@ -31,8 +31,8 @@ @@ -59,8 +59,8 @@ diff --git a/Containers/ContainersApp.swift b/Containers/ContainersApp.swift index 454d9f6..ccd8c0d 100644 --- a/Containers/ContainersApp.swift +++ b/Containers/ContainersApp.swift @@ -6,34 +6,18 @@ // import AppKit -import ContainerSystem +import ContainersCore import SwiftUI import TipKit class AppDelegate: NSObject, NSApplicationDelegate { - func applicationDidFinishLaunching(_ notification: Notification) { - // Start with dock icon showing since dashboard opens on launch - NSApp.setActivationPolicy(.regular) - - // Observe window close notifications - NotificationCenter.default.addObserver( - self, - selector: #selector(windowWillClose(_:)), - name: NSWindow.willCloseNotification, - object: nil - ) + // Before launch finishes, so a menu bar only app shows no Dock icon until a window opens. + func applicationWillFinishLaunching(_ notification: Notification) { + NSApp.setActivationPolicy(UserDefaults.appIconPlacement.activationPolicy) } - @objc func windowWillClose(_ notification: Notification) { - guard let window = notification.object as? NSWindow else { return } - - // Check if this is the dashboard window by title - if window.title == "Containers" { - // Hide dock icon immediately when dashboard closes - DispatchQueue.main.async { - NSApp.setActivationPolicy(.accessory) - } - } + func applicationDidFinishLaunching(_ notification: Notification) { + NSApp.beginUpdatingActivationPolicy() } } @@ -41,26 +25,33 @@ class AppDelegate: NSObject, NSApplicationDelegate { struct ContainersApp: App { @NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate + @AppStorage(UserDefaults.appIconPlacementKey) private var appIconPlacement: AppIconPlacement = .dockAndMenuBar + + @State private var containerSystem: ContainerSystem + // MARK: Domain Managers @State private var containerManager = ContainerManager() @State private var imageManager = ImageManager() @State private var volumeManager = VolumeManager() @State private var networkManager = NetworkManager() @State private var reportManager: ReportManager - @State private var systemManager: SystemManager // MARK: Utilities @State private var activityCenter: ActivityCenter @State private var systemActions: SystemActions init() { - let systemManager = SystemManager() + // ContainerSystem is initalized here to allow for testability and previews + let containerSystem = ContainerSystem.shared let reportManager = ReportManager() + let systemActions = SystemActions(containerSystem: containerSystem) - _systemManager = State(initialValue: systemManager) + containerSystem.resolverDirectory = UserDefaults.resolverDirectory + + _containerSystem = State(initialValue: containerSystem) _reportManager = State(initialValue: reportManager) - _activityCenter = State(initialValue: ActivityCenter(reports: reportManager)) - _systemActions = State(initialValue: SystemActions(manager: systemManager)) + _activityCenter = State(initialValue: ActivityCenter(reportManager: reportManager)) + _systemActions = State(initialValue: systemActions) do { try Tips.configure() @@ -75,6 +66,7 @@ struct ContainersApp: App { static let imageDetailWindowID = "image-detail" static let volumeDetailWindowID = "volume-detail" static let reportDetailWindowID = "report-detail" + static let helpWindowID = "help" var body: some Scene { Window( @@ -85,35 +77,28 @@ struct ContainersApp: App { .environment(containerManager) .environment(imageManager) .environment(volumeManager) - .environment(systemManager) + .environment(containerSystem) .environment(networkManager) .environment(activityCenter) .environment(reportManager) .environment(systemActions) - .onAppear { - // Show dock icon when dashboard appears - NSApp.setActivationPolicy(.regular) - } } ) .defaultSize(width: 800, height: 520) .defaultPosition(.center) - .windowResizability(.contentSize) // Links into the app are the dashboard's to open. .handlesExternalEvents(matching: ["\(AppLink.scheme)://"]) MenuBarExtra( + isInserted: showsMenuBarItem, content: { MenuBarItem() - .environment(systemManager) + .environment(containerSystem) .environment(systemActions) }, label: { - Image( - systemManager.status == .running - ? "container.stack.fill" : "container.stack" - ) - .font(.system(size: 28)) + Image(menuBarSymbol) + .font(.system(size: 28)) } ) .menuBarExtraStyle(.menu) @@ -121,19 +106,30 @@ struct ContainersApp: App { Window("Settings", id: Self.settingsWindowID) { SettingsView() .environment(networkManager) - .environment(systemManager) + .environment(containerSystem) } .defaultSize(width: 600, height: 400) .defaultPosition(.center) + .windowResizability(.contentMinSize) .handlesExternalEvents(matching: []) .commands { PreferencesCommands() } + Window("Containers Help", id: Self.helpWindowID) { + HelpView() + } + .defaultSize(width: 1100, height: 760) + .defaultPosition(.center) + .handlesExternalEvents(matching: []) + .commands { HelpCommands() } + windowGroup( "Container Details", id: Self.containerDetailWindowID, placeholder: DetailPlaceholder.container ) { id in ContainerDetailWindow(id: id) + .environment(containerSystem) + .environment(networkManager) .environment(containerManager) .environment(volumeManager) .environment(imageManager) @@ -147,11 +143,13 @@ struct ContainersApp: App { placeholder: DetailPlaceholder.image ) { reference in ImageDetailWindow(imageReference: reference) + .environment(containerSystem) + .environment(networkManager) .environment(imageManager) .environment(containerManager) .environment(volumeManager) - .environment(activityCenter) .environment(reportManager) + .environment(activityCenter) } windowGroup( @@ -174,6 +172,23 @@ struct ContainersApp: App { } } + /// Taking the item out of the menu bar leaves the Dock icon, so the app is never hidden from both. + private var showsMenuBarItem: Binding { + Binding( + get: { appIconPlacement.showsInMenuBar }, + set: { isShown in + guard !isShown else { return } + + appIconPlacement = .dock + NSApp.updateActivationPolicy() + } + ) + } + + private var menuBarSymbol: String { + containerSystem.status == .running ? "container.stack.fill" : "container.stack" + } + /// A detail window group, keyed by the id of what it shows. private func windowGroup( _ title: String, @@ -206,8 +221,20 @@ struct ContainersApp: App { Button { openWindow(id: ContainersApp.settingsWindowID) } label: { - Label("Settings...", systemImage: "gearshape") + Label("Settings…", systemImage: "gearshape") + } + } + } + } + + struct HelpCommands: Commands { + @Environment(\.openWindow) private var openWindow + var body: some Commands { + CommandGroup(replacing: .help) { + Button("Containers Help") { + openWindow(id: ContainersApp.helpWindowID) } + .keyboardShortcut("?", modifiers: .command) } } } diff --git a/Containers/Controllers/DashboardToolbarController+Items.swift b/Containers/Controllers/DashboardToolbarController+Items.swift index b515465..876023e 100644 --- a/Containers/Controllers/DashboardToolbarController+Items.swift +++ b/Containers/Controllers/DashboardToolbarController+Items.swift @@ -55,7 +55,7 @@ extension DashboardToolbarController: NSToolbarDelegate { /// A one-entry group, since only `.selectAny` draws an on state. private func filterItem(_ identifier: NSToolbarItem.Identifier) -> NSToolbarItemGroup { - let title = "Running containers only" + let title = "Running Containers Only" let image = NSImage( systemSymbolName: "line.3.horizontal.decrease", @@ -72,7 +72,7 @@ extension DashboardToolbarController: NSToolbarDelegate { ) group.setSelected(isFilterOn, at: 0) group.isEnabled = isEnabled - group.toolTip = title + group.toolTip = "Show only running containers" return group } diff --git a/Containers/Controllers/DashboardToolbarController+Search.swift b/Containers/Controllers/DashboardToolbarController+Search.swift index 29d6ba7..7b12f66 100644 --- a/Containers/Controllers/DashboardToolbarController+Search.swift +++ b/Containers/Controllers/DashboardToolbarController+Search.swift @@ -106,7 +106,7 @@ extension DashboardToolbarController: NSSearchFieldDelegate { onSearch(searchText) } - /// Return turns the text into a token where the section supports it, as in Console. + /// Return turns the text into a token where the section supports it. func control( _ control: NSControl, textView: NSTextView, diff --git a/Containers/Extensions/SwiftUI/View+Foreground.swift b/Containers/Extensions/SwiftUI/View+Foreground.swift deleted file mode 100644 index 9ab47d3..0000000 --- a/Containers/Extensions/SwiftUI/View+Foreground.swift +++ /dev/null @@ -1,15 +0,0 @@ -// -// View+Foreground.swift -// Containers -// -// Created by Axel Martinez on 12/10/2026. -// - -import SwiftUI - -extension View { - /// Shows a cell's content as secondary while nothing can be done with its row, or while `isDimmed` holds. - func rowForeground(for row: some ActivityRow, isDimmed: Bool = false) -> some View { - foregroundStyle(row.isDisabled || isDimmed ? .secondary : .primary) - } -} diff --git a/Containers/Models/App/AppIconPlacement.swift b/Containers/Models/App/AppIconPlacement.swift new file mode 100644 index 0000000..256282a --- /dev/null +++ b/Containers/Models/App/AppIconPlacement.swift @@ -0,0 +1,33 @@ +// +// AppIconPlacement.swift +// Containers +// +// Created by Axel Martinez on 2026/10/30. +// + +import AppKit + +/// Where the app shows its icon. There's no choice without either, which would leave no way back into the app. +enum AppIconPlacement: String, CaseIterable, Identifiable { + case dockAndMenuBar + case dock + case menuBar + + var id: Self { self } + + var title: String { + switch self { + case .dockAndMenuBar: "Dock and Menu Bar" + case .dock: "Dock Only" + case .menuBar: "Menu Bar Only" + } + } + + var showsInMenuBar: Bool { + self != .dock + } + + var activationPolicy: NSApplication.ActivationPolicy { + self == .menuBar ? .accessory : .regular + } +} diff --git a/Containers/Models/Shared/AppInfo.swift b/Containers/Models/App/AppInfo.swift similarity index 90% rename from Containers/Models/Shared/AppInfo.swift rename to Containers/Models/App/AppInfo.swift index f80fb23..a9beb15 100644 --- a/Containers/Models/Shared/AppInfo.swift +++ b/Containers/Models/App/AppInfo.swift @@ -11,7 +11,7 @@ import Foundation /// what changed in this release after an update. enum AppInfo { struct Feature { - let icon: String + let icon: Icon let title: String let description: String } @@ -23,7 +23,7 @@ enum AppInfo { static let release: (title: String, features: [Feature]) = UserDefaults.isFirstLaunch ? ("Welcome to", welcomeFeatures) - : ("What's New in", updateFeatures) + : ("What’s New in", updateFeatures) /// Whether an update to the version in the Info.plist shows `updateFeatures`. /// Set it for releases worth announcing; leave it off for small fixes. @@ -34,17 +34,17 @@ enum AppInfo { private static let welcomeFeatures: [Feature] = [ Feature( - icon: "shippingbox", + icon: .container, title: "Run Linux containers", description: "Create and run Linux containers as lightweight virtual machines on your Mac." ), Feature( - icon: "cube.transparent", + icon: .image, title: "OCI-compatible images support", description: "Pull and run images from container registries, build from a Dockerfile, or load from a local archive." ), Feature( - icon: "cpu", + icon: .system("cpu"), title: "Optimized for Apple Silicon", description: "Written in Swift and designed to get the most out of Apple Silicon." ), diff --git a/Containers/Models/Shared/AppLink.swift b/Containers/Models/App/AppLink.swift similarity index 100% rename from Containers/Models/Shared/AppLink.swift rename to Containers/Models/App/AppLink.swift diff --git a/Containers/Models/Shared/AppVersion.swift b/Containers/Models/App/AppVersion.swift similarity index 100% rename from Containers/Models/Shared/AppVersion.swift rename to Containers/Models/App/AppVersion.swift diff --git a/Containers/Models/Containers/ContainerCreateForm.swift b/Containers/Models/Containers/ContainerCreateForm.swift new file mode 100644 index 0000000..12d72bb --- /dev/null +++ b/Containers/Models/Containers/ContainerCreateForm.swift @@ -0,0 +1,62 @@ +// +// ContainerCreateForm.swift +// Containers +// +// Created by Axel Martinez on 2026/11/22. +// + +import Containerization +import ContainerizationOCI +import ContainersCore +import Foundation + +/// The container a person describes in the Create Container sheet. +struct ContainerCreateForm { + var imageReference: String + var process = ContainerProcess() + var configuration = ContainerConfiguration() + var options = ContainerManagementOptions() + var network = NetworkConfiguration.defaultName + var platform = Platform.current.description + var sharedMemorySize = "" + var environments: [KeyValue] = [] + var volumes: [VolumeMount] = [] + var mounts: [Mount] = [] + var ports: [PortMapping] = [] + var capabilities: [Capability] = [] + let registryScheme = RequestScheme.auto.rawValue + + var trimmedImageReference: String { + imageReference.trimmingCharacters(in: .whitespacesAndNewlines) + } + + var isComplete: Bool { + !trimmedImageReference.isEmpty + } + + /// The networks to attach to. The default network is the one a container gets without naming any. + var networks: [String] { + network == NetworkConfiguration.defaultName ? [] : [network] + } + + /// `KEY=value` for each row that has both a key and a value. + var environmentVariables: [String] { + environments + .filter { + !$0.key.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + && !$0.value.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + } + .map { "\($0.key)=\($0.value)" } + } + + /// The size of `/dev/shm` in bytes, or `nil` to keep the default. + func sharedMemoryInBytes() throws -> UInt64? { + let trimmedSize = sharedMemorySize.trimmingCharacters(in: .whitespacesAndNewlines) + + guard !trimmedSize.isEmpty else { + return nil + } + + return try Parser.memoryInBytes(from: trimmedSize) + } +} diff --git a/Containers/Models/Containers/ContainerItem.swift b/Containers/Models/Containers/ContainerItem.swift deleted file mode 100644 index c66cd16..0000000 --- a/Containers/Models/Containers/ContainerItem.swift +++ /dev/null @@ -1,137 +0,0 @@ -// -// ContainerItem.swift -// Containers -// -// Created by Axel Martinez on 2026/02/05. -// - -import ContainerSystem -import Containerization -import ContainerizationExtras -import ContainerizationOCI -import Foundation - -/// Nonisolated so that a column can sort by one of its fields: the target -/// takes its types as main-actor by default, and a key path into one of those -/// is not the sendable key path a sort comparator asks for. -nonisolated struct ContainerItem: Identifiable, Hashable, Equatable, Sendable { - let id: String - let imageName: String - let status: ContainerStatus - let ports: String - let ipAddress: String? - let os: String - let arch: String - let startedDate: Date? - - /// Whether the container exists yet, rather than the row standing in for one still being made. - private(set) var exists = true - - /// Set while work on the container is under way or has failed: its - /// making, which the row stands in for until it is made, or a start. - var activity: ActivitySnapshot? - - /// A container is known by its id once it exists; until then it is known - /// by what it was asked to be called. - var name: String { activity?.title ?? id } - - /// A row that only stands for the work of making a container. - var isPending: Bool { activity != nil && !exists } - - /// A row for a container that is still being made, which has none of what - /// a made one is described by. - init(pending activity: ActivitySnapshot) { - self.id = activity.id - self.imageName = activity.subtitle - self.status = .unknown - self.ports = "" - self.ipAddress = nil - self.os = Platform.current.os - self.arch = Platform.current.architecture - self.startedDate = nil - self.activity = activity - self.exists = false - } - - init(_ snapshot: ContainerSnapshot) { - self.id = snapshot.configuration.id - self.imageName = snapshot.configuration.image.reference - self.status = snapshot.status - self.ports = snapshot.configuration.publishedPorts.map { - "\($0.hostAddress):\($0.hostPort)\u{2192}\($0.containerPort)/\($0.proto.rawValue)" - }.joined(separator: "\n") - self.ipAddress = snapshot.networks.first.map { network in - let addressString = network.ipv4Address.description - return String( - addressString.split(separator: "/").first - ?? Substring(addressString) - ) - } - self.os = snapshot.configuration.platform.os - self.arch = snapshot.configuration.platform.architecture - self.startedDate = snapshot.startedDate - self.activity = nil - } - - func hash(into hasher: inout Hasher) { - hasher.combine(id) - hasher.combine(status) - hasher.combine(activity) - } - - static func == (lhs: ContainerItem, rhs: ContainerItem) -> Bool { - lhs.id == rhs.id && lhs.status == rhs.status && lhs.activity == rhs.activity - } -} - -// MARK: - Display Formatting - -extension ContainerItem { - var formattedPorts: String { - ports.isEmpty ? "-" : ports - } - - var hasIPAddress: Bool { - ipAddress != nil - } - - var formattedIPAddress: String { - ipAddress ?? "-" - } - - var formattedOS: String { - os.localizedCapitalized - } - - /// What the Uptime column sorts by: one never started sorts oldest. - var startedSort: Date { - startedDate ?? .distantPast - } - - var formattedState: String { - status.rawValue.localizedCapitalized - } - - var formattedStarted: String { - guard let startedDate else { - return "" - } - let formatter = DateFormatter() - formatter.dateStyle = .short - formatter.timeStyle = .medium - return formatter.string(from: startedDate) - } - - func formattedUptime(at date: Date = Date()) -> String { - guard status == .running, let startedDate else { - return "-" - } - - let interval = max(0, date.timeIntervalSince(startedDate)) - let formatter = DateComponentsFormatter() - formatter.allowedUnits = [.day, .hour, .minute] - formatter.maximumUnitCount = 2 - formatter.unitsStyle = .abbreviated - return formatter.string(from: interval) ?? "-" - } -} diff --git a/Containers/Models/Containers/ManagedContainer+Display.swift b/Containers/Models/Containers/ManagedContainer+Display.swift new file mode 100644 index 0000000..86dd1a1 --- /dev/null +++ b/Containers/Models/Containers/ManagedContainer+Display.swift @@ -0,0 +1,113 @@ +// +// ManagedContainer+Display.swift +// Containers +// +// Created by Axel Martinez on 2026/02/05. +// + +import Containerization +import ContainerizationExtras +import ContainerizationOCI +import ContainersCore +import Foundation + +// Nonisolated so that a column can sort by one of these: the target takes +// its declarations as main-actor by default, and a key path into one of +// those is not the sendable key path a sort comparator asks for. +nonisolated extension ManagedContainer { + var state: RuntimeStatus { status.state } + var imageName: String { configuration.image.reference } + + /// The published ports, one per line. + var ports: String { + configuration.publishedPorts.map { + "\($0.hostAddress):\($0.hostPort)\u{2192}\($0.containerPort)/\($0.proto.rawValue)" + }.joined(separator: "\n") + } + + /// The address on the first network the container joins, without its prefix length. + var ipAddress: String? { + status.networks.first.map { network in + let addressString = network.ipv4Address.description + return String( + addressString.split(separator: "/").first + ?? Substring(addressString) + ) + } + } + + /// The networks other than the built-in one that the container joins. + var customNetworks: [String] { + configuration.networks.map(\.network).filter { $0 != NetworkConfiguration.defaultName } + } + + /// Whether the app can start the container. One on a custom network can't start in the sandbox, which has no + /// vmnet. See ``NetworkManager/supportsCustomNetworks``. + var isRunnable: Bool { + NetworkManager.supportsCustomNetworks || customNetworks.isEmpty + } + + /// Why the app can't start the container, for its row to explain, or `nil` if it can. + var runNotice: RowNotice? { + guard !isRunnable else { return nil } + + let networks = customNetworks.map { "“\($0)”" }.formatted(.list(type: .and)) + let noun = customNetworks.count == 1 ? "network" : "networks" + + return RowNotice( + title: "Custom networks aren’t supported", + message: "This container joins the \(networks) \(noun), and Containers can only run containers on the default network.", + help: "Show why the container can’t start" + ) + } +} + +// MARK: - Display Formatting + +nonisolated extension ManagedContainer { + var formattedPorts: String { + ports.isEmpty ? "-" : ports + } + + var formattedIPAddress: String { + ipAddress ?? "-" + } + + var formattedOS: String { + platform.os.localizedCapitalized + } + + var formattedState: String { + state.rawValue.localizedCapitalized + } + + func formattedUptime(at date: Date = Date()) -> String { + guard state == .running, let startedDate = status.startedDate else { + return "-" + } + + let interval = max(0, date.timeIntervalSince(startedDate)) + let formatter = DateComponentsFormatter() + formatter.allowedUnits = [.day, .hour, .minute] + formatter.maximumUnitCount = 2 + formatter.unitsStyle = .abbreviated + + return formatter.string(from: interval) ?? "-" + } +} + +// MARK: - Entries + +/// What a container's columns show and sort by, which an entry standing in for one still being made has too. +nonisolated extension ResourceEntry where Resource == ManagedContainer { + var state: RuntimeStatus { resource?.state ?? .unknown } + /// A container being made shows the image it's made from, which its work carries. + var imageName: String { resource?.imageName ?? task?.subtitle ?? "" } + var formattedState: String { resource?.formattedState ?? RuntimeStatus.unknown.rawValue.localizedCapitalized } + var formattedPorts: String { resource?.formattedPorts ?? "-" } + var formattedIPAddress: String { resource?.formattedIPAddress ?? "-" } + var hasIPAddress: Bool { resource?.ipAddress != nil } + /// What the Uptime column sorts by: one never started sorts oldest. + var startedSort: Date { resource?.status.startedDate ?? .distantPast } + var isRunnable: Bool { resource?.isRunnable ?? true } +} diff --git a/Containers/Models/Containers/PortMapping.swift b/Containers/Models/Containers/PortMapping.swift index 6d015e9..2760597 100644 --- a/Containers/Models/Containers/PortMapping.swift +++ b/Containers/Models/Containers/PortMapping.swift @@ -5,10 +5,10 @@ // Created by Axel Martinez on 03/08/2026. // -import ContainerSystem import Containerization import ContainerizationExtras import ContainerizationOCI +import ContainersCore import Foundation struct PortMapping: Identifiable { diff --git a/Containers/Models/Containers/ResolvedMounts.swift b/Containers/Models/Containers/ResolvedMounts.swift index ae7079b..b0f7d0a 100644 --- a/Containers/Models/Containers/ResolvedMounts.swift +++ b/Containers/Models/Containers/ResolvedMounts.swift @@ -5,8 +5,8 @@ // Created by Axel Martinez on 03/08/2026. // -import ContainerSystem import Containerization +import ContainersCore import Foundation /// The mounts a container is created with, resolved from what the create @@ -106,12 +106,12 @@ struct ResolvedMounts { /// a bind mount has to follow it, or the bind covers it over. /// /// `found` holds the volume for each of ``volumes``, in the same order. - func filesystems(with found: [Volume]) -> [Filesystem] { + func filesystems(with found: [VolumeResource]) -> [Filesystem] { let resolvedVolumes = zip(volumes, found).map { request, volume in Filesystem.volume( name: volume.name, - format: volume.format, - source: volume.source, + format: volume.configuration.format, + source: volume.configuration.source, destination: request.destination, options: options ) diff --git a/Containers/Models/Dashboard/ContainerStatsSummary.swift b/Containers/Models/Dashboard/ContainerStatsSummary.swift new file mode 100644 index 0000000..2281cfa --- /dev/null +++ b/Containers/Models/Dashboard/ContainerStatsSummary.swift @@ -0,0 +1,60 @@ +// +// ContainerStatsSummary.swift +// Containers +// +// Created by Axel Martinez on 10/2/26. +// + +import Foundation + +/// What the running containers use between them, as `container stats` shows it for each one. +struct ContainerStatsSummary { + static let zero = ContainerStatsSummary( + memoryBytes: 0, + memoryLimitBytes: 0, + cpuPercent: 0, + networkReceivedBytes: 0, + networkSentBytes: 0, + diskReadBytes: 0, + diskWriteBytes: 0 + ) + + let memoryBytes: UInt64 + let memoryLimitBytes: UInt64 + let cpuPercent: Double + /// The bytes the containers' network interfaces received since each started. + let networkReceivedBytes: UInt64 + /// The bytes the containers' network interfaces sent since each started. + let networkSentBytes: UInt64 + /// The bytes read from the containers' disks since each started. + let diskReadBytes: UInt64 + /// The bytes written to the containers' disks since each started. + let diskWriteBytes: UInt64 + + // One value each, with the values that make it up in its details. + + var cpuText: String { String(format: "%.2f%%", cpuPercent) } + var memoryText: String { Self.formatted(memoryBytes) } + var memoryDetails: String { "Memory used \(Self.formatted(memoryBytes)) of \(Self.formatted(memoryLimitBytes))" } + var networkText: String { Self.formatted(networkReceivedBytes + networkSentBytes) } + var networkDetails: String { "Network received \(Self.formatted(networkReceivedBytes)), sent \(Self.formatted(networkSentBytes))" } + + var diskText: String { Self.formatted(diskReadBytes + diskWriteBytes) } + var diskDetails: String { "Block I/O read \(Self.formatted(diskReadBytes)), written \(Self.formatted(diskWriteBytes))" } + + /// A byte count in binary units with two decimals, and never less than KiB, as `container stats` formats it. + private static func formatted(_ bytes: UInt64) -> String { + let kib = 1024.0 + let mib = kib * 1024 + let gib = mib * 1024 + let value = Double(bytes) + + if value >= gib { + return String(format: "%.2f GiB", value / gib) + } else if value >= mib { + return String(format: "%.2f MiB", value / mib) + } else { + return String(format: "%.2f KiB", value / kib) + } + } +} diff --git a/Containers/Models/Dashboard/NavigationTab.swift b/Containers/Models/Dashboard/NavigationTab.swift index 67c3622..898eee3 100644 --- a/Containers/Models/Dashboard/NavigationTab.swift +++ b/Containers/Models/Dashboard/NavigationTab.swift @@ -5,7 +5,7 @@ // Created by Axel Martinez on 2026/02/05. // -import ContainerSystem +import ContainersCore enum NavigationTab: String, Identifiable, Equatable { case containers @@ -26,21 +26,21 @@ enum NavigationTab: String, Identifiable, Equatable { } } - var icon: String { + var icon: Icon { switch self { case .containers: - "shippingbox" + .container case .images: - "cube.transparent" + .image case .volumes: - "internaldrive" + .volume case .reports: - "list.clipboard" + .system("list.clipboard") } } /// Reports have no work of their own. - var activityKind: ActivityCenter.Kind? { + var activityKind: ResourceID.Kind? { switch self { case .containers: .container case .images: .image diff --git a/Containers/Models/Dashboard/ResourceUsage.swift b/Containers/Models/Dashboard/ResourceUsage.swift deleted file mode 100644 index 62e1f93..0000000 --- a/Containers/Models/Dashboard/ResourceUsage.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// ResourceUsage.swift -// Containers -// -// Created by Axel Martinez on 10/2/26. -// - -struct ResourceUsage { - static let zero = ResourceUsage(memoryUsage: 0, cpuUsage: 0, diskUsage: 0) - - let memoryUsage: Double // in GB - let cpuUsage: Double // percentage - let diskUsage: Double // in GB -} diff --git a/Containers/Models/Dashboard/SelectionToolbarItem.swift b/Containers/Models/Dashboard/SelectionToolbarItem.swift index c3f5e59..ad4a8c5 100644 --- a/Containers/Models/Dashboard/SelectionToolbarItem.swift +++ b/Containers/Models/Dashboard/SelectionToolbarItem.swift @@ -33,7 +33,7 @@ enum SelectionToolbarItem: String { var symbolName: String { switch self { - case .details: "info.circle" + case .details: "list.bullet.below.rectangle" case .run, .start: "play" case .stop: "stop" case .delete: "trash" diff --git a/Containers/Models/Help/HelpTopic.swift b/Containers/Models/Help/HelpTopic.swift new file mode 100644 index 0000000..942794d --- /dev/null +++ b/Containers/Models/Help/HelpTopic.swift @@ -0,0 +1,102 @@ +// +// HelpTopic.swift +// Containers +// +// Created by Axel Martinez on 2026/11/29. +// + +import Foundation + +/// A page of the documentation, or a heading that groups pages, as the website's DocC index lists them. +nonisolated struct HelpTopic: Decodable, Hashable, Identifiable, Sendable { + let title: String + let path: String? + let type: String + let children: [HelpTopic]? + + var id: String { path ?? "\(type):\(title)" } + + /// The pages under this one, or `nil` when there are none, as an outline expects. + var subtopics: [HelpTopic]? { + guard let children, !children.isEmpty else { return nil } + + return children + } + + var isGroupHeading: Bool { type == "groupMarker" } + + var symbol: String { + switch type { + case "module": "book.closed" + case "collection": "list.bullet" + default: "doc.text" + } + } +} + +/// The documentation's table of contents: its overview page, and the pages under it in titled sections. +nonisolated struct HelpContents: Sendable { + struct Section: Identifiable, Sendable { + let title: String + let topics: [HelpTopic] + + var id: String { title } + } + + let overview: HelpTopic + let sections: [Section] + + /// Every page, depth first, for search. + var pages: [HelpTopic] { + func flattened(_ topics: [HelpTopic]) -> [HelpTopic] { + topics.flatMap { [$0] + flattened($0.children ?? []) } + } + + return [overview] + flattened(sections.flatMap(\.topics)) + } + + /// The topics that contain the page at `path`, outermost first, or none if it's at the top level or unknown. + func ancestors(of path: String) -> [HelpTopic] { + func search(_ topics: [HelpTopic], trail: [HelpTopic]) -> [HelpTopic]? { + for topic in topics { + if topic.path == path { return trail } + if let found = search(topic.children ?? [], trail: trail + [topic]) { return found } + } + return nil + } + + return search(sections.flatMap(\.topics), trail: []) ?? [] + } + + func contains(path: String) -> Bool { + pages.contains { $0.path == path } + } + + /// Reads the index DocC publishes, whose single top-level topic is the overview, with group headings among its + /// children that start each section. + init(indexData: Data) throws { + struct Index: Decodable { + let interfaceLanguages: [String: [HelpTopic]] + } + + let index = try JSONDecoder().decode(Index.self, from: indexData) + + guard let overview = index.interfaceLanguages.values.first?.first else { + throw CocoaError(.coderValueNotFound) + } + + var sections: [Section] = [] + for topic in overview.children ?? [] { + if topic.isGroupHeading { + sections.append(Section(title: topic.title, topics: [])) + } else if let last = sections.popLast() { + sections.append(Section(title: last.title, topics: last.topics + [topic])) + } else { + sections.append(Section(title: "", topics: [topic])) + } + } + + self.overview = overview + self.sections = sections + } +} diff --git a/Containers/Models/Images/ImageBuildRequest.swift b/Containers/Models/Images/ImageBuildForm.swift similarity index 84% rename from Containers/Models/Images/ImageBuildRequest.swift rename to Containers/Models/Images/ImageBuildForm.swift index d778fe9..fc0ecac 100644 --- a/Containers/Models/Images/ImageBuildRequest.swift +++ b/Containers/Models/Images/ImageBuildForm.swift @@ -1,14 +1,14 @@ // -// ImageBuildRequest.swift +// ImageBuildForm.swift // Containers // -import ContainerSystem import ContainerizationOCI +import ContainersCore import Foundation -/// What the Create Image sheet builds. -struct ImageBuildRequest { +/// The image a person describes to build in the Create Image sheet. +struct ImageBuildForm { var contextDirectory: URL? var dockerFile: URL? var tag = "" diff --git a/Containers/Models/Images/ImageItem.swift b/Containers/Models/Images/ImageItem.swift deleted file mode 100644 index 9c1f100..0000000 --- a/Containers/Models/Images/ImageItem.swift +++ /dev/null @@ -1,187 +0,0 @@ -// -// ImageItem.swift -// Containers -// -// Created by Axel Martinez on 2026/02/05. -// - -import ContainerSystem -import Containerization -import ContainerizationOCI -import Foundation - -nonisolated struct ImageItem: Identifiable, Hashable, Equatable, Sendable { - let name: String - let tag: String - let os: String - let arch: String - let variant: String - let sizeInBytes: Int64 - let createdDate: Date - let indexDigest: String - /// One per platform in the image's index, as apple/container's - /// `ImageResource.variants`. - let variants: [Variant] - let isInUse: Bool - let imageDescription: ImageDescription - var activity: ActivitySnapshot? - /// Whether the image has landed, rather than the row standing in for one - /// still on its way. - private(set) var exists = true - - /// A row that only stands for the work of fetching an image. - var isPending: Bool { - activity != nil && !exists - } - - var id: String { - if let activity { - return activity.id - } - - // The reference is what the work that fetches an image knows it by, - // so the row it arrives in is the row it was being fetched in. What - // has no reference to be known by — an image left behind by a build - // that has been retagged — keeps to its digest. - return Self.identity(for: imageDescription.reference) - ?? indexDigest + createdDate.description - } - - /// The reference as the registry knows it, which is how an image arriving - /// is recognised as the one that was asked for. - static func identity(for reference: String) -> String? { - guard !reference.isEmpty, !reference.contains("") else { - return nil - } - - return (try? Reference.normalized(reference).description) ?? reference - } - - init(_ summary: ImageSummary) { - self.init( - summary.description, - variant: summary.platform?.variant, - created: summary.platform?.created, - os: summary.platform?.os, - architecture: summary.platform?.architecture, - isInUse: summary.isInUse, - sizeInBytes: summary.platform?.size, - variants: summary.variants.map(Variant.init) - ) - } - - /// Initialize from ImageDescription (simplified, without full image details) - init( - _ description: ImageDescription, - variant: String? = nil, - created: Date? = nil, - os: String? = nil, - architecture: String? = nil, - isInUse: Bool, - sizeInBytes: Int64? = nil, - variants: [Variant] = [] - ) { - self.imageDescription = description - - let (name, tag) = Self.nameAndTag(from: description.reference) - self.name = name - self.tag = tag - - self.indexDigest = description.digest - self.variants = variants - self.os = os ?? Platform.current.os - self.arch = architecture ?? Platform.current.architecture - self.variant = variant ?? "" - self.sizeInBytes = sizeInBytes ?? description.descriptor.size - self.createdDate = created ?? ImageSummary.unknownCreationDate - self.isInUse = isInUse - } - - /// A row for an image that is still arriving, which has no digest of its - /// own to be known by until it has. - init(pending activity: ActivitySnapshot) { - self.imageDescription = ImageDescription( - reference: activity.title, - descriptor: Descriptor(mediaType: "", digest: "", size: 0) - ) - - let (name, tag) = Self.nameAndTag(from: activity.title) - - self.name = name - self.tag = tag - self.indexDigest = "" - self.variants = [] - self.os = Platform.current.os - self.arch = Platform.current.architecture - self.variant = "" - self.sizeInBytes = 0 - self.createdDate = ImageSummary.unknownCreationDate - self.isInUse = false - self.activity = activity - self.exists = false - } - - /// What an image with no tag is shown as wherever it is named in full. - private static let noTag = "" - - var hasTag: Bool { tag != Self.noTag } - - /// The name with its tag, where it has one. - var displayName: String { hasTag ? "\(name):\(tag)" : name } - - private static func nameAndTag(from reference: String) -> (String, String) { - guard - let parsed = try? ContainerizationOCI.Reference.parse(reference) - else { - return (reference, noTag) - } - - return (parsed.name, parsed.tag ?? noTag) - } - - // Hashable conformance - func hash(into hasher: inout Hasher) { - hasher.combine(indexDigest) - hasher.combine(activity) - } - - // Equatable conformance - static func == (lhs: ImageItem, rhs: ImageItem) -> Bool { - lhs.indexDigest == rhs.indexDigest - && lhs.variants == rhs.variants - && lhs.activity == rhs.activity - } -} - -extension ImageItem { - nonisolated struct Variant: Hashable, Sendable { - let platform: Platform - let digest: String - let size: Int64 - - init(_ variant: ImageResource.Variant) { - self.platform = variant.platform - self.digest = variant.digest - self.size = variant.size - } - } -} - -// MARK: - Display Formatting - -extension ImageItem { - var formattedSize: String { - ByteCountFormatter.string(fromByteCount: sizeInBytes, countStyle: .file) - } - - var formattedOS: String { - os.localizedCapitalized - } - - var formattedCreated: String { - let formatter = DateFormatter() - formatter.dateStyle = .medium - formatter.timeStyle = .short - return formatter.string(from: createdDate) - } -} diff --git a/Containers/Models/Images/ImageLoadRequest.swift b/Containers/Models/Images/ImageLoadRequest.swift deleted file mode 100644 index 144ca8d..0000000 --- a/Containers/Models/Images/ImageLoadRequest.swift +++ /dev/null @@ -1,16 +0,0 @@ -// -// ImageLoadRequest.swift -// Containers -// - -import Foundation - -/// What the Create Image sheet loads. -struct ImageLoadRequest { - var tarFile: URL? - var force = false - - var isComplete: Bool { - tarFile != nil - } -} diff --git a/Containers/Models/Images/ImagePullRequest.swift b/Containers/Models/Images/ImagePullRequest.swift deleted file mode 100644 index 0f74a63..0000000 --- a/Containers/Models/Images/ImagePullRequest.swift +++ /dev/null @@ -1,21 +0,0 @@ -// -// ImagePullRequest.swift -// Containers -// - -import Foundation - -/// What the Create Image sheet pulls. -struct ImagePullRequest { - var imageName = "" - var tag = "latest" - var platform: PlatformSelection = .any - - var isComplete: Bool { - !imageName.isEmpty - } - - var reference: String { - tag.isEmpty ? imageName : "\(imageName):\(tag)" - } -} diff --git a/Containers/Models/Images/ImageResource+Display.swift b/Containers/Models/Images/ImageResource+Display.swift new file mode 100644 index 0000000..8f4cca2 --- /dev/null +++ b/Containers/Models/Images/ImageResource+Display.swift @@ -0,0 +1,71 @@ +// +// ImageResource+Display.swift +// Containers +// +// Created by Axel Martinez on 2026/02/05. +// + +import Containerization +import ContainerizationOCI +import ContainersCore +import Foundation + +// Nonisolated so that a column can sort by one of these, as a container's can. +nonisolated extension ImageResource { + /// What an image with no tag is shown as wherever it is named in full. + static let noTag = "-" + + /// The reference without its tag, as the registry's repository is called. + var repository: String { Self.repositoryAndTag(from: name).repository } + var tag: String { Self.repositoryAndTag(from: name).tag } + var hasTag: Bool { tag != Self.noTag } + /// The repository with its tag, where it has one. + var displayName: String { hasTag ? "\(repository):\(tag)" : repository } + var indexDigest: String { configuration.descriptor.digest } + + /// The size of the variant for this Mac, where it was read, or else of the index. + var sizeInBytes: Int64 { + variant(for: .current)?.size ?? configuration.descriptor.size + } + + static func repositoryAndTag(from reference: String) -> (repository: String, tag: String) { + guard let parsed = try? Reference.parse(reference) else { + return (reference, noTag) + } + + return (parsed.name, parsed.tag ?? noTag) + } +} + +// MARK: - Display Formatting + +nonisolated extension ImageResource { + var formattedSize: String { + ByteCountFormatter.string(fromByteCount: sizeInBytes, countStyle: .file) + } + + var formattedCreated: String { + let formatter = DateFormatter() + formatter.dateStyle = .medium + formatter.timeStyle = .short + return formatter.string(from: creationDate) + } +} + +// MARK: - Entries + +/// What an image's columns show and sort by, which an entry standing in for one +/// still on its way has too, named by the reference its work was asked for. +nonisolated extension ResourceEntry where Resource == ImageResource { + var repository: String { + resource?.repository ?? ImageResource.repositoryAndTag(from: name).repository + } + + var tag: String { + resource?.tag ?? ImageResource.repositoryAndTag(from: name).tag + } + + var hasTag: Bool { tag != ImageResource.noTag } + var displayName: String { hasTag ? "\(repository):\(tag)" : repository } + var indexDigest: String { resource?.indexDigest ?? "" } +} diff --git a/Containers/Extensions/ContainerSystem/Report+Appearance.swift b/Containers/Models/Reports/Report+Appearance.swift similarity index 57% rename from Containers/Extensions/ContainerSystem/Report+Appearance.swift rename to Containers/Models/Reports/Report+Appearance.swift index c124d80..34bb661 100644 --- a/Containers/Extensions/ContainerSystem/Report+Appearance.swift +++ b/Containers/Models/Reports/Report+Appearance.swift @@ -5,7 +5,7 @@ // Created by Axel Martinez on 22/09/2026. // -import ContainerSystem +import ContainersCore import SwiftUI extension Report { @@ -27,3 +27,23 @@ extension Report { } } } + +extension Report.Kind { + var title: String { + switch self { + case .build: "Build" + case .image: "Image" + case .container: "Container" + case .volume: "Volume" + } + } +} + +extension Report.Level { + var title: String { + switch self { + case .warning: "Warning" + case .error: "Error" + } + } +} diff --git a/Containers/Extensions/ContainerSystem/Report+DateText.swift b/Containers/Models/Reports/Report+DateText.swift similarity index 92% rename from Containers/Extensions/ContainerSystem/Report+DateText.swift rename to Containers/Models/Reports/Report+DateText.swift index 50f4b40..9da0a05 100644 --- a/Containers/Extensions/ContainerSystem/Report+DateText.swift +++ b/Containers/Models/Reports/Report+DateText.swift @@ -5,7 +5,7 @@ // Created by Axel Martinez on 02/10/2026. // -import ContainerSystem +import ContainersCore import Foundation extension Report { diff --git a/Containers/Models/Reports/ReportFilter.swift b/Containers/Models/Reports/ReportFilter.swift index 110cc3c..47349ec 100644 --- a/Containers/Models/Reports/ReportFilter.swift +++ b/Containers/Models/Reports/ReportFilter.swift @@ -5,7 +5,7 @@ // Created by Axel Martinez on 25/09/2026. // -import ContainerSystem +import ContainersCore import Foundation /// A search kept under a name, which the bar over the reports offers beside @@ -60,7 +60,7 @@ struct ReportFilter: Codable, Hashable, Sendable { } } - /// How what is looked at has to compare, as Console asks it. + /// How what is looked at has to compare. enum Match: String, Codable, CaseIterable, Sendable { case contains case doesNotContain @@ -104,7 +104,7 @@ struct ReportFilter: Codable, Hashable, Sendable { } /// The kind of work a tab of the bar stands for, compared the usual way, - /// as Console's own tabs are: no kind's name holds another's. + /// which is exact enough since no kind's name holds another's. static func kind(_ kind: Report.Kind) -> ReportFilter { ReportFilter(field: .kind, value: kind.title) } diff --git a/Containers/Models/Shared/ActivitySnapshot.swift b/Containers/Models/Shared/ActivitySnapshot.swift deleted file mode 100644 index 942adca..0000000 --- a/Containers/Models/Shared/ActivitySnapshot.swift +++ /dev/null @@ -1,134 +0,0 @@ -// -// ActivitySnapshot.swift -// Containers -// -// Created by Axel Martinez on 12/09/2026. -// - -import ContainerSystem -import Foundation - -nonisolated struct ActivitySnapshot: Hashable, Sendable { - enum Phase: Hashable, Sendable { - case executing - case stopped - case failed(reportID: String?) - } - - enum Source: Sendable { - case work(ActivityCenter.Activity) - case report(Report) - } - - let id: String - let title: String - let subtitle: String - let phase: Phase - let source: Source - - /// `id` can differ from `report.name`: an image is reported under the - /// reference asked for, but its row is known by the resolved one. - init(report: Report, id: String? = nil) { - self.id = id ?? report.name - self.title = report.name - self.subtitle = "" - self.phase = .failed(reportID: report.id) - self.source = .report(report) - } - - @MainActor - init(_ activity: ActivityCenter.Activity) { - self.id = activity.id - self.title = activity.title - self.subtitle = activity.subtitle - self.source = .work(activity) - - if activity.error != nil { - self.phase = .failed(reportID: activity.reportID) - } else if activity.isStopped { - self.phase = .stopped - } else { - self.phase = .executing - } - } - - var isExecuting: Bool { phase == .executing } - var isStopped: Bool { phase == .stopped } - - var reportID: String? { - guard case .failed(let reportID) = phase else { return nil } - - return reportID - } - - var isReported: Bool { - guard case .report = source else { return false } - - return true - } - - static func == (lhs: ActivitySnapshot, rhs: ActivitySnapshot) -> Bool { - lhs.id == rhs.id && lhs.title == rhs.title - && lhs.subtitle == rhs.subtitle && lhs.phase == rhs.phase - && lhs.source.isSame(as: rhs.source) - } - - func hash(into hasher: inout Hasher) { - hasher.combine(id) - hasher.combine(phase) - } -} - -@MainActor -extension ActivitySnapshot { - var canRetry: Bool { - guard case .work(let activity) = source else { return false } - - return activity.canRetry - } - - var failureTitle: String? { - switch source { - case .work(let activity): failure(of: activity)?.title - case .report(let report): report.message - } - } - - var failureMessage: String? { - switch source { - case .work(let activity): failure(of: activity)?.message - case .report(let report): report.message - } - } - - private func failure(of activity: ActivityCenter.Activity) -> ErrorAlert? { - activity.error.map { ErrorAlert(activity.failureTitle, error: $0) } - } - - /// A failure or a stop always shows, so it can be read or run again. - var showsProgress: Bool { - guard isExecuting, case .work(let activity) = source else { return true } - - return activity.showsProgress - } - - var step: String { progress?.localizedDescription ?? "" } - var detail: String { progress?.localizedAdditionalDescription ?? "" } - var fraction: Double? { progress?.fractionCompleted } - - private var progress: ProgressObserver? { - guard case .work(let activity) = source else { return nil } - - return activity.progress - } -} - -extension ActivitySnapshot.Source { - nonisolated fileprivate func isSame(as other: Self) -> Bool { - switch (self, other) { - case (.work(let lhs), .work(let rhs)): lhs === rhs - case (.report(let lhs), .report(let rhs)): lhs.id == rhs.id - default: false - } - } -} diff --git a/Containers/Models/Shared/ContainerSystemTask+Snapshot.swift b/Containers/Models/Shared/ContainerSystemTask+Snapshot.swift new file mode 100644 index 0000000..8658697 --- /dev/null +++ b/Containers/Models/Shared/ContainerSystemTask+Snapshot.swift @@ -0,0 +1,135 @@ +// +// ContainerSystemTask+Snapshot.swift +// Containers +// +// Created by Axel Martinez on 12/09/2026. +// + +import ContainersCore +import Foundation + +extension ContainerSystemTask { + nonisolated struct Snapshot: Hashable, Sendable { + enum Phase: Hashable, Sendable { + case executing + case stopped + case failed(reportID: String?) + } + + enum Source: Sendable { + case work(ContainerSystemTask) + case report(Report) + } + + /// Nil for a failure read back from a report, which has no task left. + let taskID: ContainerSystemTask.ID? + /// What the work acts on or makes, where that's known. + let target: ResourceID? + let title: String + let subtitle: String + let phase: Phase + let source: Source + + init(report: Report) { + self.taskID = nil + self.target = nil + self.title = report.name + self.subtitle = "" + self.phase = .failed(reportID: report.id) + self.source = .report(report) + } + + @MainActor + init(_ task: ContainerSystemTask) { + self.taskID = task.id + self.target = task.target + self.title = task.title + self.subtitle = task.subtitle + self.source = .work(task) + + if task.error != nil { + self.phase = .failed(reportID: task.reportID) + } else if task.isStopped { + self.phase = .stopped + } else { + self.phase = .executing + } + } + + var isExecuting: Bool { phase == .executing } + var isStopped: Bool { phase == .stopped } + + var reportID: String? { + guard case .failed(let reportID) = phase else { return nil } + + return reportID + } + + var isReported: Bool { + guard case .report = source else { return false } + + return true + } + + static func == (lhs: Snapshot, rhs: Snapshot) -> Bool { + lhs.taskID == rhs.taskID && lhs.target == rhs.target && lhs.title == rhs.title + && lhs.subtitle == rhs.subtitle && lhs.phase == rhs.phase + && lhs.source.isSame(as: rhs.source) + } + + func hash(into hasher: inout Hasher) { + hasher.combine(taskID) + hasher.combine(target) + hasher.combine(phase) + } + } +} + +@MainActor +extension ContainerSystemTask.Snapshot { + var canRetry: Bool { + guard case .work(let task) = source else { return false } + return task.canRetry + } + + var failureTitle: String? { + switch source { + case .work(let task): task.error.map { _ in task.failureTitle } + case .report(let report): report.message + } + } + + var failureMessage: String? { + switch source { + case .work(let task): task.error?.alertMessage + case .report(let report): report.message + } + } + + /// A failure or a stop always shows, so it can be read or run again. + var showsProgress: Bool { + guard isExecuting, case .work(let task) = source else { return true } + + return task.showsProgress + } + + var step: String { progress?.localizedDescription ?? "" } + var detail: String { progress?.localizedAdditionalDescription ?? "" } + var fraction: Double? { progress?.fractionCompleted } + + private var progress: ProgressObserver? { + guard case .work(let task) = source else { return nil } + + return task.progress + } +} + +extension ContainerSystemTask.Snapshot.Source { + nonisolated fileprivate func isSame(as other: Self) -> Bool { + switch (self, other) { + case (.work(let lhs), .work(let rhs)): lhs === rhs + case (.report(let lhs), .report(let rhs)): lhs.id == rhs.id + default: false + } + } +} diff --git a/Containers/Models/Shared/Icon.swift b/Containers/Models/Shared/Icon.swift new file mode 100644 index 0000000..39a30db --- /dev/null +++ b/Containers/Models/Shared/Icon.swift @@ -0,0 +1,16 @@ +// +// Icon.swift +// Containers +// +// Created by Axel Martinez on 2026/11/18. +// + +/// A system symbol, or one of the app's own in the asset catalog. +enum Icon { + case system(String) + case asset(String) + + static let container = Icon.asset("container") + static let image = Icon.system("square.3.layers.3d") + static let volume = Icon.asset("volume") +} diff --git a/Containers/Models/Shared/ResourceEntry.swift b/Containers/Models/Shared/ResourceEntry.swift new file mode 100644 index 0000000..6ba4432 --- /dev/null +++ b/Containers/Models/Shared/ResourceEntry.swift @@ -0,0 +1,63 @@ +// +// ResourceEntry.swift +// Containers +// +// Created by Axel Martinez on 08/10/2026. +// + +import ContainersCore +import Foundation + +/// One entry in a table of resources, which a row draws: a resource, with any +/// work under way on it or the failure work left, or work that will make one, +/// standing in for it until it does. +nonisolated struct ResourceEntry: Identifiable, Sendable { + /// The same as its work's, so an entry and the task on it are known alike. + typealias ID = ContainerSystemTask.Subject + + let id: ID + /// Nil while the entry only stands in for work that will make it. + let resource: Resource? + /// Whether a container uses the resource, which the list works out. + let isInUse: Bool + var task: ContainerSystemTask.Snapshot? + + init(_ resource: Resource, isInUse: Bool = false) { + self.id = .resource(resource.resourceID) + self.resource = resource + self.isInUse = isInUse + } + + /// An entry for work that will make a resource, keyed by the one it will + /// make where that's known, so it becomes that resource's entry in place. + @MainActor + init(pending task: ContainerSystemTask) { + self.id = task.target.map(ID.resource) ?? task.id + self.resource = nil + self.isInUse = false + self.task = ContainerSystemTask.Snapshot(task) + } + + /// What the entry is called: the resource's name, or what its work is called until there is one. + var name: String { resource?.name ?? task?.title ?? "" } + /// Whether the entry only stands in for work, rather than for something that exists. + var isPending: Bool { resource == nil } + /// Whether an action is under way on the resource. + var isExecuting: Bool { task?.isExecuting == true } + var isDisabled: Bool { isPending || isExecuting } + /// The work the entry only stands in for, whose own menu its row gets instead. + var pendingWork: ContainerSystemTask.Snapshot? { isPending ? task : nil } + /// The failure marked on the entry, reported or not. + var failure: ContainerSystemTask.Snapshot? { + guard let task, case .failed = task.phase else { return nil } + return task + } +} + +/// Why nothing can be done with a resource, which its row's mark explains as a task's explains the work under way. +nonisolated struct RowNotice: Hashable, Sendable { + let title: String + let message: String + /// The mark's tooltip. + let help: String +} diff --git a/Containers/Models/Shared/ResourceID.swift b/Containers/Models/Shared/ResourceID.swift new file mode 100644 index 0000000..7e42178 --- /dev/null +++ b/Containers/Models/Shared/ResourceID.swift @@ -0,0 +1,68 @@ +// +// ResourceID.swift +// Containers +// +// Created by Axel Martinez on 22/11/2026. +// + +import ContainerizationOCI +import ContainersCore +import Foundation + +/// What work can be done on: a container, an image or a volume, known by the name that is unique among its kind. +nonisolated enum ResourceID: Hashable, Sendable { + case container(String) + /// Known by its normalized reference, as each reference is an image of its own even where several share a digest. + case image(String) + case volume(String) + + enum Kind: Hashable, Sendable { + case container + case image + case volume + } + + /// An image's, by its reference as the registry knows it, so a fetched image is recognized as the one asked for. + init(imageReference reference: String) { + self = .image((try? Reference.normalized(reference).description) ?? reference) + } + + var kind: Kind { + switch self { + case .container: .container + case .image: .image + case .volume: .volume + } + } + + /// The name the resource is known by, which reports are filed under too. + var name: String { + switch self { + case .container(let name), .image(let name), .volume(let name): name + } + } +} + +/// A resource that work can be done on, known by a ``ResourceID``. +nonisolated protocol ResourceIdentifiable: ManagedResource { + var resourceID: ResourceID { get } +} + +extension ManagedContainer: ResourceIdentifiable { + nonisolated var resourceID: ResourceID { .container(id) } +} + +extension VolumeResource: ResourceIdentifiable { + nonisolated var resourceID: ResourceID { .volume(name) } +} + +extension ImageResource: ResourceIdentifiable { + /// An image with no reference to be known by, such as one a retagged build left behind, keeps to its digest. + nonisolated var resourceID: ResourceID { + guard !name.isEmpty, !name.contains("") else { + return .image(configuration.descriptor.digest) + } + + return ResourceID(imageReference: name) + } +} diff --git a/Containers/Models/Shared/Tips.swift b/Containers/Models/Shared/Tips.swift index ac46129..402781e 100644 --- a/Containers/Models/Shared/Tips.swift +++ b/Containers/Models/Shared/Tips.swift @@ -10,7 +10,7 @@ import TipKit struct AddFirstImageTip: Tip { @Parameter static var shouldShow: Bool = false - var title: Text { Text("Start with an image") } + var title: Text { Text("Start with an Image") } var message: Text? { Text( "Add your first image to get started. Images are the foundation for running containers." @@ -23,6 +23,6 @@ struct AddFirstImageTip: Tip { } struct RunContainerTip: Tip { - var title: Text { Text("Run a container") } + var title: Text { Text("Run a Container") } var message: Text? { Text("Create and run a new container from this image.") } } diff --git a/Containers/Extensions/ContainerSystem/SystemManager.Status+Message.swift b/Containers/Models/System/ContainerSystem.Status+Message.swift similarity index 77% rename from Containers/Extensions/ContainerSystem/SystemManager.Status+Message.swift rename to Containers/Models/System/ContainerSystem.Status+Message.swift index e56405b..1ee8e0d 100644 --- a/Containers/Extensions/ContainerSystem/SystemManager.Status+Message.swift +++ b/Containers/Models/System/ContainerSystem.Status+Message.swift @@ -1,20 +1,20 @@ // -// SystemManager.Status+Message.swift +// ContainerSystem.Status+Message.swift // Containers // // Created by Axel Martinez on 17/09/2026. // import AppKit -import ContainerSystem +import ContainersCore import SwiftUI -extension SystemManager.Status { +extension ContainerSystem.Status { var message: String { switch self { case .running: "System running" - case .starting: "Starting system..." - case .stopping: "Stopping system..." + case .starting: "Starting system…" + case .stopping: "Stopping system…" case .notStarted: "System stopped" case .failed: "System failed to start" } @@ -41,11 +41,19 @@ extension SystemManager.Status { } } + /// The share of the gauge the needle points to, matching `symbol`. + var gaugeLevel: Double { + switch self { + case .running: 1 + case .starting: 0.33 + case .stopping: 0.67 + case .notStarted, .failed: 0 + } + } + /// Darkened in light mode, where the system green reads faintly as text. private static let runningGreen = NSColor(name: nil) { appearance in - let isDark = - appearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua - + let isDark = appearance.bestMatch(from: [.aqua, .darkAqua]) == .darkAqua return isDark ? .systemGreen : NSColor.systemGreen.blended(withFraction: 0.3, of: .black) @@ -57,7 +65,6 @@ extension SystemManager.Status { switch self { case .running: Self.runningGreen case .starting, .stopping: .systemOrange - // Grey, not red: a system asked to stop is not a fault. case .notStarted: .secondaryLabelColor case .failed: .systemRed } diff --git a/Containers/Models/Volumes/VolumeCreateForm.swift b/Containers/Models/Volumes/VolumeCreateForm.swift new file mode 100644 index 0000000..b832732 --- /dev/null +++ b/Containers/Models/Volumes/VolumeCreateForm.swift @@ -0,0 +1,52 @@ +// +// VolumeCreateForm.swift +// Containers +// +// Created by Axel Martinez on 2026/11/22. +// + +import ContainersCore +import Foundation + +/// The volume a person describes in the Create Volume sheet. +struct VolumeCreateForm { + var name = "" + var size: Double = 512 + var sizeUnit: UnitInformationStorage = .gigabytes + var labels: [KeyValue] = [] + var options: [KeyValue] = [] + + var trimmedName: String { + name.trimmingCharacters(in: .whitespacesAndNewlines) + } + + var isComplete: Bool { + !trimmedName.isEmpty + } + + /// The maximum capacity in bytes, or `nil` to leave it unlimited. + var sizeInBytes: UInt64? { + guard size > 0 else { + return nil + } + + let measurement = Measurement(value: size, unit: sizeUnit) + + return UInt64(measurement.converted(to: .bytes).value) + } + + /// The labels whose rows have both a key and a value. + var completeLabels: [KeyValue] { + labels.filter(Self.isComplete) + } + + /// The driver options whose rows have both a key and a value. + var completeOptions: [KeyValue] { + options.filter(Self.isComplete) + } + + private static func isComplete(_ pair: KeyValue) -> Bool { + !pair.key.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + && !pair.value.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + } +} diff --git a/Containers/Models/Volumes/VolumeItem.swift b/Containers/Models/Volumes/VolumeItem.swift deleted file mode 100644 index d502c8c..0000000 --- a/Containers/Models/Volumes/VolumeItem.swift +++ /dev/null @@ -1,95 +0,0 @@ -// -// VolumeItem.swift -// Containers -// -// Created by Axel Martinez on 2026/02/05. -// - -import ContainerSystem -import Foundation - -enum VolumeType: String, CaseIterable, Identifiable { - case named = "Named" - case anonymous = "Anonymous" - - var id: String { rawValue } -} - -@dynamicMemberLookup -nonisolated struct VolumeItem: Identifiable, Hashable, Equatable, Sendable { - let volume: Volume - let isInUse: Bool - var activity: ActivitySnapshot? - var id: String { volume.id } - var name: String { volume.name } - var createdAt: Date { volume.createdAt } - var sizeSort: UInt64 { volume.sizeInBytes ?? 0 } - var typeText: String { volumeType.rawValue } - var stateText: String { isInUse ? "In use" : "Unused" } - - var volumeType: VolumeType { - self.volume.isAnonymous ? .anonymous : .named - } - - var labels: [String: String] { - self.volume.labels.filter({ $0.key != Volume.anonymousLabel }) - } - - var options: [String: String] { - self.volume.options.filter({ $0.key != "KB" }) - } - - init(_ item: VolumeSummary) { - self.volume = item.volume - self.isInUse = item.isInUse - } - - init(_ volume: Volume, isInUse: Bool = false) { - self.volume = volume - self.isInUse = isInUse - } - - func hash(into hasher: inout Hasher) { - hasher.combine(volume.id) - hasher.combine(volume.name) - hasher.combine(isInUse) - hasher.combine(activity) - } - - static func == (lhs: VolumeItem, rhs: VolumeItem) -> Bool { - lhs.volume.id == rhs.volume.id && lhs.volume.name == rhs.volume.name - && lhs.isInUse == rhs.isInUse && lhs.activity == rhs.activity - } - -} - -extension VolumeItem { - subscript(dynamicMember keyPath: KeyPath) -> T { - volume[keyPath: keyPath] - } -} - -// MARK: - Display Formatting - -extension VolumeItem { - var formattedCreated: String { - let formatter = DateFormatter() - formatter.dateStyle = .medium - formatter.timeStyle = .short - - return formatter.string(from: volume.createdAt) - } - - var formattedSize: String? { - guard let volumeSize = volume.sizeInBytes else { - return nil - } - - let formattedSize = ByteCountFormatter.string( - fromByteCount: Int64(volumeSize), - countStyle: .file - ) - - return formattedSize - } -} diff --git a/Containers/Models/Volumes/VolumeResource+Display.swift b/Containers/Models/Volumes/VolumeResource+Display.swift new file mode 100644 index 0000000..0ae89ed --- /dev/null +++ b/Containers/Models/Volumes/VolumeResource+Display.swift @@ -0,0 +1,66 @@ +// +// VolumeResource+Display.swift +// Containers +// +// Created by Axel Martinez on 2026/02/05. +// + +import ContainersCore +import Foundation + +enum VolumeType: String, CaseIterable, Identifiable { + case named = "Named" + case anonymous = "Anonymous" + + var id: String { rawValue } +} + +// Nonisolated so that a column can sort by one of these, as a container's can. +nonisolated extension VolumeResource { + var volumeType: VolumeType { + isAnonymous ? .anonymous : .named + } + + /// The labels a person set, without the one that marks a volume anonymous. + var userLabels: [String: String] { + configuration.labels.filter { $0.key != VolumeConfiguration.anonymousLabel } + } + + /// The driver options a person set, without the size recorded alongside them. + var userOptions: [String: String] { + configuration.options.filter { $0.key != "KB" } + } +} + +// MARK: - Display Formatting + +nonisolated extension VolumeResource { + var formattedCreated: String { + let formatter = DateFormatter() + formatter.dateStyle = .medium + formatter.timeStyle = .short + + return formatter.string(from: creationDate) + } + + var formattedSize: String? { + guard let sizeInBytes = configuration.sizeInBytes else { + return nil + } + + return ByteCountFormatter.string(fromByteCount: Int64(sizeInBytes), countStyle: .file) + } +} + +// MARK: - Entries + +/// What a volume's columns sort by. +nonisolated extension ResourceEntry where Resource == VolumeResource { + var typeText: String { resource?.volumeType.rawValue ?? "" } + + var stateText: String { isInUse ? "In use" : "Unused" } + + var sizeSort: UInt64 { resource?.configuration.sizeInBytes ?? 0 } + + var createdAt: Date { resource?.creationDate ?? .distantPast } +} diff --git a/Containers/Supporting Files/Assets.xcassets/container.fill.symbolset/Contents.json b/Containers/Supporting Files/Assets.xcassets/container.fill.symbolset/Contents.json new file mode 100644 index 0000000..0dd62a7 --- /dev/null +++ b/Containers/Supporting Files/Assets.xcassets/container.fill.symbolset/Contents.json @@ -0,0 +1,12 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "symbols" : [ + { + "filename" : "container.fill.svg", + "idiom" : "universal" + } + ] +} diff --git a/Containers/Supporting Files/Assets.xcassets/container.fill.symbolset/container.fill.svg b/Containers/Supporting Files/Assets.xcassets/container.fill.symbolset/container.fill.svg new file mode 100644 index 0000000..fc238f3 --- /dev/null +++ b/Containers/Supporting Files/Assets.xcassets/container.fill.symbolset/container.fill.svg @@ -0,0 +1,103 @@ + + + + + + + + + + Weight/Scale Variations + Ultralight + Thin + Light + Regular + Medium + Semibold + Bold + Heavy + Black + + + + + + + + + + + Design Variations + Symbols are supported in up to nine weights and three scales. + For optimal layout with text and other symbols, vertically align + symbols with the adjacent text. + + + + + + Margins + Leading and trailing margins on the left and right side of each symbol + can be adjusted by modifying the x-location of the margin guidelines. + Modifications are automatically applied proportionally to all + scales and weights. + + + + Exporting + Symbols should be outlined when exporting to ensure the + design is preserved when submitting to Xcode. + Template v.7.0 + Requires Xcode 26 or greater + Generated from symbol + Typeset at 100.0 points + Small + Medium + Large + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Containers/Supporting Files/Assets.xcassets/container.symbolset/Contents.json b/Containers/Supporting Files/Assets.xcassets/container.symbolset/Contents.json new file mode 100644 index 0000000..552d1fb --- /dev/null +++ b/Containers/Supporting Files/Assets.xcassets/container.symbolset/Contents.json @@ -0,0 +1,12 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "symbols" : [ + { + "filename" : "container.svg", + "idiom" : "universal" + } + ] +} diff --git a/Containers/Supporting Files/Assets.xcassets/container.symbolset/container.svg b/Containers/Supporting Files/Assets.xcassets/container.symbolset/container.svg new file mode 100644 index 0000000..25a652e --- /dev/null +++ b/Containers/Supporting Files/Assets.xcassets/container.symbolset/container.svg @@ -0,0 +1,103 @@ + + + + + + + + + + Weight/Scale Variations + Ultralight + Thin + Light + Regular + Medium + Semibold + Bold + Heavy + Black + + + + + + + + + + + Design Variations + Symbols are supported in up to nine weights and three scales. + For optimal layout with text and other symbols, vertically align + symbols with the adjacent text. + + + + + + Margins + Leading and trailing margins on the left and right side of each symbol + can be adjusted by modifying the x-location of the margin guidelines. + Modifications are automatically applied proportionally to all + scales and weights. + + + + Exporting + Symbols should be outlined when exporting to ensure the + design is preserved when submitting to Xcode. + Template v.7.0 + Requires Xcode 26 or greater + Generated from symbol + Typeset at 100.0 points + Small + Medium + Large + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Containers/Supporting Files/Assets.xcassets/gauge.dial.symbolset/Contents.json b/Containers/Supporting Files/Assets.xcassets/gauge.dial.symbolset/Contents.json new file mode 100644 index 0000000..f6aebf7 --- /dev/null +++ b/Containers/Supporting Files/Assets.xcassets/gauge.dial.symbolset/Contents.json @@ -0,0 +1,12 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "symbols" : [ + { + "filename" : "gauge.dial.svg", + "idiom" : "universal" + } + ] +} diff --git a/Containers/Supporting Files/Assets.xcassets/gauge.dial.symbolset/gauge.dial.svg b/Containers/Supporting Files/Assets.xcassets/gauge.dial.symbolset/gauge.dial.svg new file mode 100644 index 0000000..2a60dd7 --- /dev/null +++ b/Containers/Supporting Files/Assets.xcassets/gauge.dial.symbolset/gauge.dial.svg @@ -0,0 +1,114 @@ + + + + + + + + + + Weight/Scale Variations + Ultralight + Thin + Light + Regular + Medium + Semibold + Bold + Heavy + Black + + + + + + + + + + + Design Variations + Symbols are supported in up to nine weights and three scales. + For optimal layout with text and other symbols, vertically align + symbols with the adjacent text. + + + + + + Margins + Leading and trailing margins on the left and right side of each symbol + can be adjusted by modifying the x-location of the margin guidelines. + Modifications are automatically applied proportionally to all + scales and weights. + + + + Exporting + Symbols should be outlined when exporting to ensure the + design is preserved when submitting to Xcode. + Template v.7.0 + Requires Xcode 26 or greater + Generated from symbol + Typeset at 100.0 points + Small + Medium + Large + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Containers/Supporting Files/Assets.xcassets/gauge.needle.clearance.symbolset/Contents.json b/Containers/Supporting Files/Assets.xcassets/gauge.needle.clearance.symbolset/Contents.json new file mode 100644 index 0000000..1e0c6b8 --- /dev/null +++ b/Containers/Supporting Files/Assets.xcassets/gauge.needle.clearance.symbolset/Contents.json @@ -0,0 +1,12 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "symbols" : [ + { + "filename" : "gauge.needle.clearance.svg", + "idiom" : "universal" + } + ] +} diff --git a/Containers/Supporting Files/Assets.xcassets/gauge.needle.clearance.symbolset/gauge.needle.clearance.svg b/Containers/Supporting Files/Assets.xcassets/gauge.needle.clearance.symbolset/gauge.needle.clearance.svg new file mode 100644 index 0000000..062d86d --- /dev/null +++ b/Containers/Supporting Files/Assets.xcassets/gauge.needle.clearance.symbolset/gauge.needle.clearance.svg @@ -0,0 +1,111 @@ + + + + + + + + + + Weight/Scale Variations + Ultralight + Thin + Light + Regular + Medium + Semibold + Bold + Heavy + Black + + + + + + + + + + + Design Variations + Symbols are supported in up to nine weights and three scales. + For optimal layout with text and other symbols, vertically align + symbols with the adjacent text. + + + + + + Margins + Leading and trailing margins on the left and right side of each symbol + can be adjusted by modifying the x-location of the margin guidelines. + Modifications are automatically applied proportionally to all + scales and weights. + + + + Exporting + Symbols should be outlined when exporting to ensure the + design is preserved when submitting to Xcode. + Template v.7.0 + Requires Xcode 26 or greater + Generated from symbol + Typeset at 100.0 points + Small + Medium + Large + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Containers/Supporting Files/Assets.xcassets/gauge.needle.symbolset/Contents.json b/Containers/Supporting Files/Assets.xcassets/gauge.needle.symbolset/Contents.json new file mode 100644 index 0000000..9b1577d --- /dev/null +++ b/Containers/Supporting Files/Assets.xcassets/gauge.needle.symbolset/Contents.json @@ -0,0 +1,12 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "symbols" : [ + { + "filename" : "gauge.needle.svg", + "idiom" : "universal" + } + ] +} diff --git a/Containers/Supporting Files/Assets.xcassets/gauge.needle.symbolset/gauge.needle.svg b/Containers/Supporting Files/Assets.xcassets/gauge.needle.symbolset/gauge.needle.svg new file mode 100644 index 0000000..b06c35f --- /dev/null +++ b/Containers/Supporting Files/Assets.xcassets/gauge.needle.symbolset/gauge.needle.svg @@ -0,0 +1,111 @@ + + + + + + + + + + Weight/Scale Variations + Ultralight + Thin + Light + Regular + Medium + Semibold + Bold + Heavy + Black + + + + + + + + + + + Design Variations + Symbols are supported in up to nine weights and three scales. + For optimal layout with text and other symbols, vertically align + symbols with the adjacent text. + + + + + + Margins + Leading and trailing margins on the left and right side of each symbol + can be adjusted by modifying the x-location of the margin guidelines. + Modifications are automatically applied proportionally to all + scales and weights. + + + + Exporting + Symbols should be outlined when exporting to ensure the + design is preserved when submitting to Xcode. + Template v.7.0 + Requires Xcode 26 or greater + Generated from symbol + Typeset at 100.0 points + Small + Medium + Large + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Containers/Supporting Files/Assets.xcassets/volume.symbolset/Contents.json b/Containers/Supporting Files/Assets.xcassets/volume.symbolset/Contents.json new file mode 100644 index 0000000..17f0b50 --- /dev/null +++ b/Containers/Supporting Files/Assets.xcassets/volume.symbolset/Contents.json @@ -0,0 +1,12 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + }, + "symbols" : [ + { + "filename" : "volume.svg", + "idiom" : "universal" + } + ] +} diff --git a/Containers/Supporting Files/Assets.xcassets/volume.symbolset/volume.svg b/Containers/Supporting Files/Assets.xcassets/volume.symbolset/volume.svg new file mode 100644 index 0000000..ddca959 --- /dev/null +++ b/Containers/Supporting Files/Assets.xcassets/volume.symbolset/volume.svg @@ -0,0 +1,103 @@ + + + + + + + + + + Weight/Scale Variations + Ultralight + Thin + Light + Regular + Medium + Semibold + Bold + Heavy + Black + + + + + + + + + + + Design Variations + Symbols are supported in up to nine weights and three scales. + For optimal layout with text and other symbols, vertically align + symbols with the adjacent text. + + + + + + Margins + Leading and trailing margins on the left and right side of each symbol + can be adjusted by modifying the x-location of the margin guidelines. + Modifications are automatically applied proportionally to all + scales and weights. + + + + Exporting + Symbols should be outlined when exporting to ensure the + design is preserved when submitting to Xcode. + Template v.7.0 + Requires Xcode 26 or greater + Generated from symbol + Typeset at 100.0 points + Small + Medium + Large + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Containers/Supporting Files/Help.bundle/css/482.01b3b97a.css b/Containers/Supporting Files/Help.bundle/css/482.01b3b97a.css new file mode 100644 index 0000000..33955b6 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/css/482.01b3b97a.css @@ -0,0 +1,9 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */.badge[data-v-ffe39a30]{--badge-color:var(--color-badge-default);--badge-dark-color:var(--color-badge-dark-default);font-size:.7058823529rem;line-height:1.3333333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);display:inline-block;padding:2px 4px;white-space:nowrap;border-radius:var(--badge-border-radius,1px);border-style:var(--badge-border-style,none);border-width:var(--badge-border-width,1px);margin:auto;margin-inline-start:5px;color:var(--colors-badge-text,var(--color-badge-text));background-color:var(--badge-color)}@media screen{[data-color-scheme=dark] .badge[data-v-ffe39a30]{background-color:var(--badge-dark-color)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .badge[data-v-ffe39a30]{background-color:var(--badge-dark-color)}}.badge-deprecated[data-v-ffe39a30]{--badge-color:var(--color-badge-deprecated);--badge-dark-color:var(--color-badge-dark-deprecated)}.badge-beta[data-v-ffe39a30]{--badge-color:var(--color-badge-beta);--badge-dark-color:var(--color-badge-dark-beta)}[data-v-3a32ffd0] .code-listing{background:var(--background,var(--color-code-background));color:var(--text,var(--color-code-plain));border-color:var(--colors-grid,var(--color-grid));border-width:var(--code-border-width,1px);border-style:var(--code-border-style,solid)}[data-v-3a32ffd0] .code-listing pre{padding:var(--code-block-style-elements-padding)}[data-v-3a32ffd0] .code-listing pre>code{font-size:.8823529412rem;line-height:1.6666666667;font-weight:400;font-family:var(--typography-html-font-mono,Menlo,monospace)}[data-v-3a32ffd0] *+.code-listing,[data-v-3a32ffd0] *+.endpoint-example,[data-v-3a32ffd0] *+.inline-image-container,[data-v-3a32ffd0] *+aside,[data-v-3a32ffd0] *+figure,[data-v-3a32ffd0] .code-listing+*,[data-v-3a32ffd0] .endpoint-example+*,[data-v-3a32ffd0] .inline-image-container+*,[data-v-3a32ffd0] aside+*,[data-v-3a32ffd0] figure+*{margin-top:var(--spacing-stacked-margin-xlarge)}[data-v-3a32ffd0] *+dl,[data-v-3a32ffd0] dl+*{margin-top:var(--spacing-stacked-margin-large)}[data-v-3a32ffd0] img{display:block;margin:auto;max-width:100%}[data-v-3a32ffd0] ol,[data-v-3a32ffd0] ol li:not(:first-child),[data-v-3a32ffd0] ul,[data-v-3a32ffd0] ul li:not(:first-child){margin-top:var(--spacing-stacked-margin-large)}@media only screen and (max-width:735px){[data-v-3a32ffd0] ol,[data-v-3a32ffd0] ul{margin-left:1.25rem}}[data-v-3a32ffd0] dt:not(:first-child){margin-top:var(--spacing-stacked-margin-large)}[data-v-3a32ffd0] dd{margin-left:2em}.topic-icon-wrapper[data-v-58794252]{display:flex;align-items:center;justify-content:center;height:1.4705882353rem;flex:0 0 1.294rem;width:1.294rem;margin-inline-end:1rem}.topic-icon[data-v-58794252]{height:.8823529412rem;transform:scale(1);-webkit-transform:scale(1);overflow:visible}.topic-icon[data-v-58794252] img{margin:0;display:block;width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.topic-icon.curly-brackets-icon[data-v-58794252]{height:1rem}.token-method[data-v-295ad0ff]{font-weight:700}.token-keyword[data-v-295ad0ff]{color:var(--syntax-keyword,var(--color-syntax-keywords))}.token-number[data-v-295ad0ff]{color:var(--syntax-number,var(--color-syntax-numbers))}.token-string[data-v-295ad0ff]{color:var(--syntax-string,var(--color-syntax-strings))}.attribute-link[data-v-295ad0ff],.token-attribute[data-v-295ad0ff]{color:var(--syntax-attribute,var(--color-syntax-keywords))}.token-internalParam[data-v-295ad0ff]{color:var(--color-syntax-param-internal-name)}.type-identifier-link[data-v-295ad0ff]{color:var(--syntax-type,var(--color-syntax-other-type-names))}.token-removed[data-v-295ad0ff]{background-color:var(--color-highlight-red)}.token-added[data-v-295ad0ff]{background-color:var(--color-highlight-green)}.decorated-title[data-v-2d744be4]{direction:ltr}.decorator[data-v-2d744be4],.label[data-v-2d744be4]{color:var(--colors-secondary-label,var(--color-secondary-label))}.label[data-v-2d744be4]{font-size:1rem;line-height:1.4705882353;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.empty-token[data-v-2d744be4]{font-size:0}.empty-token[data-v-2d744be4]:after{content:" ";font-size:1rem}.abstract[data-v-e1f11a1a],.link-block[data-v-e1f11a1a] .badge{margin-inline-start:2.294rem}.link-block .badge+.badge[data-v-e1f11a1a]{margin-inline-start:1rem}.link[data-v-e1f11a1a]{display:flex}.link-block .badge[data-v-e1f11a1a]{margin-top:.5rem}.link-block.has-inline-element[data-v-e1f11a1a]{display:flex;align-items:flex-start;flex-flow:row wrap}.link-block.has-inline-element .badge[data-v-e1f11a1a]{margin-inline-start:1rem;margin-top:0}.link-block .has-adjacent-elements[data-v-e1f11a1a]{padding-top:5px;padding-bottom:5px;display:inline-flex}.link-block[data-v-e1f11a1a],.link[data-v-e1f11a1a]{box-sizing:inherit}.link-block.changed[data-v-e1f11a1a],.link.changed[data-v-e1f11a1a]{padding-right:1rem;padding-left:2.1764705882rem;padding-top:8px;padding-bottom:8px;display:inline-flex;width:100%;box-sizing:border-box}.link-block.changed.changed[data-v-e1f11a1a],.link.changed.changed[data-v-e1f11a1a]{padding-right:1rem}@media only screen and (max-width:735px){.link-block.changed[data-v-e1f11a1a],.link.changed[data-v-e1f11a1a]{padding-left:0;padding-right:0}.link-block.changed.changed[data-v-e1f11a1a],.link.changed.changed[data-v-e1f11a1a]{padding-right:17px;padding-left:2.1764705882rem}.link-block.changed[data-v-e1f11a1a],.link.changed[data-v-e1f11a1a]{padding-left:0;padding-right:0}}.abstract .topic-required[data-v-e1f11a1a]:not(:first-child){margin-top:4px}.topic-required[data-v-e1f11a1a]{font-size:.8em}.deprecated[data-v-e1f11a1a]{text-decoration:line-through} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/css/671.47827da6.css b/Containers/Supporting Files/Help.bundle/css/671.47827da6.css new file mode 100644 index 0000000..ad5b002 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/css/671.47827da6.css @@ -0,0 +1,9 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */aside[data-v-50d24223]{-moz-column-break-inside:avoid;break-inside:avoid;border-radius:var(--aside-border-radius,var(--border-radius,4px));border-style:var(--aside-border-style,solid);border-block-width:var(--aside-border-width-block,0);border-inline-width:var(--aside-border-width-inline,6px 0);padding:.9411764706rem;text-align:start}aside .label[data-v-50d24223]{font-size:1rem;line-height:1.5294117647;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}aside .label+[data-v-50d24223]{margin-top:var(--spacing-stacked-margin-small)}aside.deprecated[data-v-50d24223]{background-color:var(--color-aside-deprecated-background);border-color:var(--color-aside-deprecated-border);box-shadow:0 0 0 0 var(--color-aside-deprecated-border) inset,0 0 0 0 var(--color-aside-deprecated-border)}aside.deprecated .label[data-v-50d24223]{color:var(--color-aside-deprecated)}aside.experiment[data-v-50d24223]{background-color:var(--color-aside-experiment-background);border-color:var(--color-aside-experiment-border);box-shadow:0 0 0 0 var(--color-aside-experiment-border) inset,0 0 0 0 var(--color-aside-experiment-border)}aside.experiment .label[data-v-50d24223]{color:var(--color-aside-experiment)}aside.important[data-v-50d24223]{background-color:var(--color-aside-important-background);border-color:var(--color-aside-important-border);box-shadow:0 0 0 0 var(--color-aside-important-border) inset,0 0 0 0 var(--color-aside-important-border)}aside.important .label[data-v-50d24223]{color:var(--color-aside-important)}aside.note[data-v-50d24223]{background-color:var(--color-aside-note-background);border-color:var(--color-aside-note-border);box-shadow:0 0 0 0 var(--color-aside-note-border) inset,0 0 0 0 var(--color-aside-note-border)}aside.note .label[data-v-50d24223]{color:var(--color-aside-note)}aside.tip[data-v-50d24223]{background-color:var(--color-aside-tip-background);border-color:var(--color-aside-tip-border);box-shadow:0 0 0 0 var(--color-aside-tip-border) inset,0 0 0 0 var(--color-aside-tip-border)}aside.tip .label[data-v-50d24223]{color:var(--color-aside-tip)}aside.warning[data-v-50d24223]{background-color:var(--color-aside-warning-background);border-color:var(--color-aside-warning-border);box-shadow:0 0 0 0 var(--color-aside-warning-border) inset,0 0 0 0 var(--color-aside-warning-border)}aside.warning .label[data-v-50d24223]{color:var(--color-aside-warning)}code[data-v-c21375ec]{direction:ltr}code[data-v-c21375ec]:before{content:attr(data-before-code)}code[data-v-c21375ec]:after{content:attr(data-after-code)}code[data-v-c21375ec]:after,code[data-v-c21375ec]:before{display:block;position:absolute;clip:rect(1px,1px,1px,1px);clip-path:inset(0 0 99.9% 99.9%);overflow:hidden;height:1px;width:1px;padding:0;border:0}.CopyIcon[data-v-5308ccb8]{opacity:.8}.CheckmarkIcon[data-v-4c718f32],.CrossIcon[data-v-27a90ea3]{opacity:1;stroke:currentColor}.swift-file-icon.file-icon[data-v-c01a6890]{height:1rem}.file-icon[data-v-7c381064]{position:relative;align-items:flex-end;height:24px;margin:0 .5rem 0 1rem}.filename[data-v-c8c40662]{color:var(--text,var(--colors-secondary-label,var(--color-secondary-label)));font-size:.9411764706rem;line-height:1.1875;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);margin-top:1rem}@media only screen and (max-width:735px){.filename[data-v-c8c40662]{font-size:.8235294118rem;line-height:1.4285714286;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);margin-top:0}}.filename>a[data-v-c8c40662],.filename>span[data-v-c8c40662]{display:flex;align-items:center;line-height:normal}a[data-v-c8c40662]{color:var(--url,var(--color-link))}.code-line-container[data-v-28c1cdd6]{display:inline-block;width:100%;box-sizing:border-box}.code-number[data-v-28c1cdd6]{display:inline-block;padding:0 1rem 0 8px;text-align:right;min-width:2em;color:#666;-webkit-user-select:none;-moz-user-select:none;user-select:none}.code-number[data-v-28c1cdd6]:before{content:attr(data-line-number)}.code-listing:not(:has(.code-number)):has(.highlighted) .code-line-container[data-v-28c1cdd6]{padding-left:8px;border-left:4px solid transparent}.code-listing:not(:has(.code-number)):has(.highlighted) .highlighted[data-v-28c1cdd6]{border-left-color:var(--color-code-line-highlight-border)}.highlighted[data-v-28c1cdd6]{background:var(--line-highlight,var(--color-code-line-highlight))}.highlighted .code-number[data-v-28c1cdd6]{border-left:4px solid var(--color-code-line-highlight-border);padding-left:4px}.strikethrough[data-v-28c1cdd6]{text-decoration-line:line-through;text-decoration-color:var(--color-figure-gray);opacity:.85}pre[data-v-28c1cdd6]{padding:14px 0;display:flex;overflow:unset;-webkit-overflow-scrolling:touch;white-space:pre;word-wrap:normal;height:100%;-moz-tab-size:var(--code-indentationWidth,4);-o-tab-size:var(--code-indentationWidth,4);tab-size:var(--code-indentationWidth,4)}@media only screen and (max-width:735px){pre[data-v-28c1cdd6]{padding-top:.8235294118rem}}code[data-v-28c1cdd6]{white-space:pre;word-wrap:normal;flex-grow:9999}.code-listing[data-v-28c1cdd6],.container-general[data-v-28c1cdd6]{display:flex}.code-listing[data-v-28c1cdd6]{flex-direction:column;border-radius:var(--code-border-radius,var(--border-radius,4px));overflow:hidden;position:relative;filter:blur(0)}.code-listing.single-line[data-v-28c1cdd6]{border-radius:var(--border-radius,4px)}.is-wrapped code[data-v-28c1cdd6],.is-wrapped pre[data-v-28c1cdd6]{white-space:pre-wrap;overflow-wrap:anywhere;word-break:normal}.is-wrapped pre[data-v-28c1cdd6]{max-width:calc(var(--wrap-ch)*1ch)}.container-general[data-v-28c1cdd6]{overflow:auto}.container-general[data-v-28c1cdd6],pre[data-v-28c1cdd6]{flex-grow:1}.copy-button[data-v-28c1cdd6]{position:absolute;top:.2em;right:.2em;width:1.5em;height:1.5em;background:var(--color-fill-gray-tertiary);border:none;border-radius:var(--button-border-radius,var(--border-radius,4px));padding:4px}@media(hover:hover){.copy-button[data-v-28c1cdd6]{opacity:0;transition:all .2s ease-in-out}.copy-button[data-v-28c1cdd6]:hover{background-color:var(--color-fill-gray)}.copy-button .copy-icon[data-v-28c1cdd6]{opacity:.8}.container-general:hover .copy-button[data-v-28c1cdd6],.copy-button:hover .copy-icon[data-v-28c1cdd6]{opacity:1}}@media(hover:none){.copy-button[data-v-28c1cdd6]{opacity:1}}.copy-button .copy-icon[data-v-28c1cdd6]{fill:var(--color-figure-gray)}.copy-button.success .checkmark-icon[data-v-28c1cdd6]{color:var(--color-figure-blue);fill:currentColor}.copy-button.failure .cross-icon[data-v-28c1cdd6]{color:var(--color-figure-red);fill:currentColor}.header-anchor[data-v-e5954aca]{color:inherit;text-decoration:none;position:relative;padding-inline-end:23px;display:inline-block}.header-anchor[data-v-e5954aca]:after{position:absolute;clip:rect(1px,1px,1px,1px);clip-path:inset(0 0 99.9% 99.9%);overflow:hidden;height:1px;width:1px;padding:0;border:0;content:attr(data-after-text)}.header-anchor .icon[data-v-e5954aca]{position:absolute;inset-inline-end:0;bottom:.2em;display:none;height:16px;margin-inline-start:7px}.header-anchor:focus .icon[data-v-e5954aca],.header-anchor:hover .icon[data-v-e5954aca]{display:inline}code[data-v-acd07e4e]{speak-punctuation:code}.inline-code[data-v-acd07e4e]{background-color:var(--color-inline-code-background);padding:var(--inline-code-padding);border-radius:var(--inline-code-border-radius)}.container-general[data-v-25a17a0e]{display:flex;flex-flow:row wrap}.container-general .code-line[data-v-25a17a0e]{flex:1 0 auto}.code-line-container[data-v-25a17a0e]{width:100%;align-items:center;display:flex;border-left:4px solid transparent;counter-increment:linenumbers;padding-right:14px}.code-number[data-v-25a17a0e]{font-size:.7058823529rem;line-height:1.5;font-weight:400;font-family:var(--typography-html-font-mono,Menlo,monospace);padding:0 1rem 0 8px;text-align:right;min-width:2.01em;-webkit-user-select:none;-moz-user-select:none;user-select:none}.code-number[data-v-25a17a0e]:before{content:counter(linenumbers)}.code-line[data-v-25a17a0e]{display:flex}pre[data-v-25a17a0e]{padding:14px 0;display:flex;flex-flow:row wrap;overflow:auto;-webkit-overflow-scrolling:touch;white-space:pre;word-wrap:normal}@media only screen and (max-width:735px){pre[data-v-25a17a0e]{padding-top:.8235294118rem}}.collapsible-code-listing[data-v-25a17a0e]{background:var(--background,var(--color-code-background));border-color:var(--colors-grid,var(--color-grid));color:var(--text,var(--color-code-plain));border-radius:var(--border-radius,4px);border-style:solid;border-width:1px;counter-reset:linenumbers;font-size:15px}.collapsible-code-listing.single-line[data-v-25a17a0e]{border-radius:var(--border-radius,4px)}.collapsible[data-v-25a17a0e]{background:var(--color-code-collapsible-background);color:var(--color-code-collapsible-text)}.collapsed[data-v-25a17a0e]:before{content:"⋯";display:inline-block;font-family:monospace;font-weight:700;height:100%;line-height:1;text-align:right;width:2.3rem}.collapsed .code-line-container[data-v-25a17a0e]{height:0;visibility:hidden}.row[data-v-be73599c]{box-sizing:border-box;display:flex;flex-flow:row wrap}.col[data-v-2ee3ad8b]{box-sizing:border-box;flex:none}.xlarge-1[data-v-2ee3ad8b]{flex-basis:8.3333333333%;max-width:8.3333333333%}.xlarge-2[data-v-2ee3ad8b]{flex-basis:16.6666666667%;max-width:16.6666666667%}.xlarge-3[data-v-2ee3ad8b]{flex-basis:25%;max-width:25%}.xlarge-4[data-v-2ee3ad8b]{flex-basis:33.3333333333%;max-width:33.3333333333%}.xlarge-5[data-v-2ee3ad8b]{flex-basis:41.6666666667%;max-width:41.6666666667%}.xlarge-6[data-v-2ee3ad8b]{flex-basis:50%;max-width:50%}.xlarge-7[data-v-2ee3ad8b]{flex-basis:58.3333333333%;max-width:58.3333333333%}.xlarge-8[data-v-2ee3ad8b]{flex-basis:66.6666666667%;max-width:66.6666666667%}.xlarge-9[data-v-2ee3ad8b]{flex-basis:75%;max-width:75%}.xlarge-10[data-v-2ee3ad8b]{flex-basis:83.3333333333%;max-width:83.3333333333%}.xlarge-11[data-v-2ee3ad8b]{flex-basis:91.6666666667%;max-width:91.6666666667%}.xlarge-12[data-v-2ee3ad8b]{flex-basis:100%;max-width:100%}.xlarge-centered[data-v-2ee3ad8b]{margin-left:auto;margin-right:auto}.xlarge-uncentered[data-v-2ee3ad8b]{margin-left:0;margin-right:0}.large-1[data-v-2ee3ad8b]{flex-basis:8.3333333333%;max-width:8.3333333333%}.large-2[data-v-2ee3ad8b]{flex-basis:16.6666666667%;max-width:16.6666666667%}.large-3[data-v-2ee3ad8b]{flex-basis:25%;max-width:25%}.large-4[data-v-2ee3ad8b]{flex-basis:33.3333333333%;max-width:33.3333333333%}.large-5[data-v-2ee3ad8b]{flex-basis:41.6666666667%;max-width:41.6666666667%}.large-6[data-v-2ee3ad8b]{flex-basis:50%;max-width:50%}.large-7[data-v-2ee3ad8b]{flex-basis:58.3333333333%;max-width:58.3333333333%}.large-8[data-v-2ee3ad8b]{flex-basis:66.6666666667%;max-width:66.6666666667%}.large-9[data-v-2ee3ad8b]{flex-basis:75%;max-width:75%}.large-10[data-v-2ee3ad8b]{flex-basis:83.3333333333%;max-width:83.3333333333%}.large-11[data-v-2ee3ad8b]{flex-basis:91.6666666667%;max-width:91.6666666667%}.large-12[data-v-2ee3ad8b]{flex-basis:100%;max-width:100%}.large-centered[data-v-2ee3ad8b]{margin-left:auto;margin-right:auto}.large-uncentered[data-v-2ee3ad8b]{margin-left:0;margin-right:0}@media only screen and (max-width:1250px){.medium-1[data-v-2ee3ad8b]{flex-basis:8.3333333333%;max-width:8.3333333333%}.medium-2[data-v-2ee3ad8b]{flex-basis:16.6666666667%;max-width:16.6666666667%}.medium-3[data-v-2ee3ad8b]{flex-basis:25%;max-width:25%}.medium-4[data-v-2ee3ad8b]{flex-basis:33.3333333333%;max-width:33.3333333333%}.medium-5[data-v-2ee3ad8b]{flex-basis:41.6666666667%;max-width:41.6666666667%}.medium-6[data-v-2ee3ad8b]{flex-basis:50%;max-width:50%}.medium-7[data-v-2ee3ad8b]{flex-basis:58.3333333333%;max-width:58.3333333333%}.medium-8[data-v-2ee3ad8b]{flex-basis:66.6666666667%;max-width:66.6666666667%}.medium-9[data-v-2ee3ad8b]{flex-basis:75%;max-width:75%}.medium-10[data-v-2ee3ad8b]{flex-basis:83.3333333333%;max-width:83.3333333333%}.medium-11[data-v-2ee3ad8b]{flex-basis:91.6666666667%;max-width:91.6666666667%}.medium-12[data-v-2ee3ad8b]{flex-basis:100%;max-width:100%}.medium-centered[data-v-2ee3ad8b]{margin-left:auto;margin-right:auto}.medium-uncentered[data-v-2ee3ad8b]{margin-left:0;margin-right:0}}@media only screen and (max-width:735px){.small-1[data-v-2ee3ad8b]{flex-basis:8.3333333333%;max-width:8.3333333333%}.small-2[data-v-2ee3ad8b]{flex-basis:16.6666666667%;max-width:16.6666666667%}.small-3[data-v-2ee3ad8b]{flex-basis:25%;max-width:25%}.small-4[data-v-2ee3ad8b]{flex-basis:33.3333333333%;max-width:33.3333333333%}.small-5[data-v-2ee3ad8b]{flex-basis:41.6666666667%;max-width:41.6666666667%}.small-6[data-v-2ee3ad8b]{flex-basis:50%;max-width:50%}.small-7[data-v-2ee3ad8b]{flex-basis:58.3333333333%;max-width:58.3333333333%}.small-8[data-v-2ee3ad8b]{flex-basis:66.6666666667%;max-width:66.6666666667%}.small-9[data-v-2ee3ad8b]{flex-basis:75%;max-width:75%}.small-10[data-v-2ee3ad8b]{flex-basis:83.3333333333%;max-width:83.3333333333%}.small-11[data-v-2ee3ad8b]{flex-basis:91.6666666667%;max-width:91.6666666667%}.small-12[data-v-2ee3ad8b]{flex-basis:100%;max-width:100%}.small-centered[data-v-2ee3ad8b]{margin-left:auto;margin-right:auto}.small-uncentered[data-v-2ee3ad8b]{margin-left:0;margin-right:0}}@media only screen and (max-width:320px){.xsmall-1[data-v-2ee3ad8b]{flex-basis:8.3333333333%;max-width:8.3333333333%}.xsmall-2[data-v-2ee3ad8b]{flex-basis:16.6666666667%;max-width:16.6666666667%}.xsmall-3[data-v-2ee3ad8b]{flex-basis:25%;max-width:25%}.xsmall-4[data-v-2ee3ad8b]{flex-basis:33.3333333333%;max-width:33.3333333333%}.xsmall-5[data-v-2ee3ad8b]{flex-basis:41.6666666667%;max-width:41.6666666667%}.xsmall-6[data-v-2ee3ad8b]{flex-basis:50%;max-width:50%}.xsmall-7[data-v-2ee3ad8b]{flex-basis:58.3333333333%;max-width:58.3333333333%}.xsmall-8[data-v-2ee3ad8b]{flex-basis:66.6666666667%;max-width:66.6666666667%}.xsmall-9[data-v-2ee3ad8b]{flex-basis:75%;max-width:75%}.xsmall-10[data-v-2ee3ad8b]{flex-basis:83.3333333333%;max-width:83.3333333333%}.xsmall-11[data-v-2ee3ad8b]{flex-basis:91.6666666667%;max-width:91.6666666667%}.xsmall-12[data-v-2ee3ad8b]{flex-basis:100%;max-width:100%}.xsmall-centered[data-v-2ee3ad8b]{margin-left:auto;margin-right:auto}.xsmall-uncentered[data-v-2ee3ad8b]{margin-left:0;margin-right:0}}.tabnav[data-v-5572fe1d]{margin:0 0 1.4705882353rem 0;display:flex}.tabnav--center[data-v-5572fe1d]{justify-content:center}.tabnav--end[data-v-5572fe1d]{justify-content:flex-end}.tabnav--vertical[data-v-5572fe1d]{flex-flow:column wrap}.tabnav--vertical .tabnav-items[data-v-5572fe1d]{flex-flow:column;overflow:hidden}.tabnav--vertical[data-v-5572fe1d] .tabnav-item{padding-left:0}.tabnav--vertical[data-v-5572fe1d] .tabnav-item .tabnav-link{padding-top:8px}.tabnav-items[data-v-5572fe1d]{display:flex;margin:0;text-align:center}.tabnav-item[data-v-34546b25]{border-bottom:1px solid;border-color:var(--colors-tabnav-item-border-color,var(--color-tabnav-item-border-color));display:flex;list-style:none;padding-inline-start:1.7647058824rem;margin:0;outline:none}.tabnav-item[data-v-34546b25]:first-child{padding-inline-start:0}.tabnav-item[data-v-34546b25]:nth-child(n+1){margin:0}.tabnav-link[data-v-34546b25]{color:var(--colors-secondary-label,var(--color-secondary-label));font-size:.8235294118rem;line-height:1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);padding:6px 0;margin-top:4px;margin-bottom:4px;text-align:left;text-decoration:none;display:block;position:relative;z-index:0;width:100%}.tabnav-link[data-v-34546b25]:hover{text-decoration:none}.tabnav-link[data-v-34546b25]:focus{outline-offset:-1px}.tabnav-link[data-v-34546b25]:after{content:"";position:absolute;bottom:-5px;inset-inline-start:0;width:100%;border:1px solid transparent}.tabnav-link.active[data-v-34546b25]{color:var(--colors-text,var(--color-text));cursor:default;z-index:10}.tabnav-link.active[data-v-34546b25]:after{border-bottom-color:var(--colors-text,var(--color-text))}.controls[data-v-c84e62a6]{margin-top:5px;font-size:14px;display:flex;justify-content:flex-end}.controls a[data-v-c84e62a6]{color:var(--colors-text,var(--color-text));display:flex;align-items:center}.controls .control-icon[data-v-c84e62a6]{width:1.05em;margin-right:.3em}.caption[data-v-869c6f6e]{font-size:.8235294118rem;line-height:1.5;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);margin:0 0 var(--spacing-stacked-margin-large) 0}.caption.trailing[data-v-869c6f6e]{margin:var(--spacing-stacked-margin-large) 0 0 0;text-align:center}caption.trailing[data-v-869c6f6e]{caption-side:bottom}[data-v-869c6f6e] p{display:inline-block}[data-v-bf997940] img{max-width:100%}.table-wrapper[data-v-f3322390]{overflow:auto;-webkit-overflow-scrolling:touch}*+.table-wrapper[data-v-f3322390],.table-wrapper[data-v-f3322390]+*{margin-top:var(--spacing-stacked-margin-xlarge)}table[data-v-f3322390]{border-style:hidden}[data-v-f3322390] th{font-weight:600;word-break:keep-all;hyphens:auto}[data-v-f3322390] td,[data-v-f3322390] th{border-color:var(--color-fill-gray-tertiary);border-style:solid;border-width:var(--table-border-width,1px 1px);padding:.5882352941rem}[data-v-f3322390] td.left-cell,[data-v-f3322390] th.left-cell{text-align:left}[data-v-f3322390] td.right-cell,[data-v-f3322390] th.right-cell{text-align:right}[data-v-f3322390] td.center-cell,[data-v-f3322390] th.center-cell{text-align:center}s[data-v-7fc51673]:before{content:attr(data-before-text)}s[data-v-7fc51673]:after{content:attr(data-after-text)}s[data-v-7fc51673]:after,s[data-v-7fc51673]:before{position:absolute;clip:rect(1px,1px,1px,1px);clip-path:inset(0 0 99.9% 99.9%);overflow:hidden;height:1px;width:1px;padding:0;border:0}small[data-v-77035f61]{font-size:.8235294118rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-figure-gray)}.device-frame[data-v-c2eac128]{position:relative;width:var(--frame-width);aspect-ratio:var(--frame-aspect);max-width:100%;margin-left:auto;margin-right:auto;overflow:hidden}*+.device-frame[data-v-c2eac128],.device-frame[data-v-c2eac128]+*{margin-top:40px}.device[data-v-c2eac128]{background-image:var(--device-light-url);background-repeat:no-repeat;background-size:100%;width:100%;height:100%;position:relative;pointer-events:none}@media screen{[data-color-scheme=dark] .device[data-v-c2eac128]{background-image:var(--device-dark-url,var(--device-light-url))}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .device[data-v-c2eac128]{background-image:var(--device-dark-url,var(--device-light-url))}}.no-device .device[data-v-c2eac128]{display:none}.device-screen.with-device[data-v-c2eac128]{position:absolute;left:var(--screen-left);top:var(--screen-top);height:var(--screen-height);width:var(--screen-width);display:flex}.device-screen.with-device>[data-v-c2eac128]{flex:1}.device-screen.with-device[data-v-c2eac128] img{width:100%;height:100%;-o-object-fit:contain;object-fit:contain;-o-object-position:top;object-position:top;margin:0}.device-screen.with-device[data-v-c2eac128] video{-o-object-fit:contain;object-fit:contain;-o-object-position:top;object-position:top;width:100%;height:auto}.video-replay-container .control-button[data-v-3fb37a97]{display:flex;align-items:center;justify-content:center;cursor:pointer;margin-top:.5rem;-webkit-tap-highlight-color:rgba(0,0,0,0)}.video-replay-container .control-button svg.control-icon[data-v-3fb37a97]{height:12px;width:12px;margin-left:.3em}[data-v-6ab0b718] img,[data-v-6ab0b718] video{display:block;margin-left:auto;margin-right:auto;-o-object-fit:contain;object-fit:contain;max-width:100%}.asset[data-v-4f18340d]{margin-left:auto;margin-right:auto}*+.asset[data-v-4f18340d],.asset[data-v-4f18340d]+*{margin-top:var(--spacing-stacked-margin-xlarge)}[data-v-4f18340d] video{display:block;margin-left:auto;margin-right:auto;-o-object-fit:contain;object-fit:contain;max-width:100%}.column[data-v-0f654188]{grid-column:span var(--col-span);min-width:0}@media only screen and (max-width:735px){.column[data-v-0f654188]{grid-column:span 1}}.row[data-v-1bcb2d0f]{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;grid-gap:var(--col-gap,20px)}@media only screen and (max-width:735px){.row[data-v-1bcb2d0f]{grid-template-columns:1fr;grid-auto-flow:row}}.row.with-columns[data-v-1bcb2d0f]{--col-count:var(--col-count-large);grid-template-columns:repeat(var(--col-count),1fr);grid-auto-flow:row}@media only screen and (max-width:1250px){.row.with-columns[data-v-1bcb2d0f]{--col-count:var(--col-count-medium,var(--col-count-large))}}@media only screen and (max-width:735px){.row.with-columns[data-v-1bcb2d0f]{--col-count:var(--col-count-small)}}*+.TabNavigator[data-v-ae2b1b30],*+.row[data-v-1bcb2d0f],.TabNavigator[data-v-ae2b1b30]+*,.row[data-v-1bcb2d0f]+*{margin-top:var(--spacing-stacked-margin-xlarge)}.TabNavigator .tabnav[data-v-ae2b1b30]{overflow:auto;white-space:nowrap}.TabNavigator .tabs-content-container[data-v-ae2b1b30]{position:relative;overflow:hidden}.tabs--vertical[data-v-ae2b1b30]{display:flex;flex-flow:row-reverse}@media only screen and (max-width:735px){.tabs--vertical[data-v-ae2b1b30]{flex-flow:column-reverse}}.tabs--vertical .tabnav[data-v-ae2b1b30]{width:30%;flex:0 0 auto;white-space:normal;margin:0}@media only screen and (max-width:735px){.tabs--vertical .tabnav[data-v-ae2b1b30]{width:100%}}.tabs--vertical .tabs-content[data-v-ae2b1b30]{flex:1 1 auto;min-width:0;padding-inline-end:var(--spacing-stacked-margin-xlarge)}@media only screen and (max-width:735px){.tabs--vertical .tabs-content[data-v-ae2b1b30]{padding-inline-end:0;padding-bottom:var(--spacing-stacked-margin-large)}}.fade-enter-active[data-v-ae2b1b30],.fade-leave-active[data-v-ae2b1b30]{transition:opacity .2s ease-in-out}.fade-enter[data-v-ae2b1b30],.fade-leave-to[data-v-ae2b1b30]{opacity:0}.fade-leave-active[data-v-ae2b1b30]{position:absolute;top:0;left:0;right:0}.tasklist[data-v-6a56a858]{--checkbox-width:1rem;--indent-width:calc(var(--checkbox-width)/2);--content-margin:var(--indent-width);list-style-type:none;margin-left:var(--indent-width)}p[data-v-6a56a858]{margin-left:var(--content-margin)}p[data-v-6a56a858]:only-child{--content-margin:calc(var(--checkbox-width) + var(--indent-width))}input[type=checkbox]+p[data-v-6a56a858]{display:inline-block}.pager-control[data-v-58c8390a]{align-items:center;background:var(--control-color-fill,var(--color-fill));border:1px solid var(--control-color-fill,var(--color-grid));border-radius:50%;display:flex;height:var(--control-size,1rem);justify-content:center;opacity:1;transition:opacity .15s ease-in-out;width:var(--control-size,1rem)}.pager-control[disabled][data-v-58c8390a]{opacity:.6}@media only screen and (min-width:1251px){.pager-control[disabled][data-v-58c8390a]{opacity:0}.with-compact-controls .pager-control[disabled][data-v-58c8390a]{opacity:.6}}.icon[data-v-58c8390a]{height:var(--control-icon-size,50%);width:var(--control-icon-size,50%)}.pager-control.next .icon[data-v-58c8390a]{transform:scale(1)}.pager-control.previous .icon[data-v-58c8390a]{transform:scaleX(-1)}.pager[data-v-1ed6aae0]{--control-size:3em;--control-color-fill:var(--color-fill-tertiary);--control-color-figure:currentColor;--indicator-size:0.65em;--indicator-color-fill-active:currentColor;--indicator-color-fill-inactive:var(--color-fill-tertiary);--color-svg-icon:currentColor;--gutter-width:80px}.viewport[data-v-1ed6aae0]{display:flex;overflow-x:auto;scroll-behavior:smooth;scroll-snap-type:x mandatory;scrollbar-width:none;-webkit-overflow-scrolling:touch}.viewport[data-v-1ed6aae0]::-webkit-scrollbar{height:0;width:0}.container[data-v-1ed6aae0]{position:relative}.gutter[data-v-1ed6aae0]{align-items:center;display:flex;justify-content:center;position:absolute;height:100%;top:0;width:var(--gutter-width);z-index:42}.with-compact-controls .gutter[data-v-1ed6aae0]{display:none}.gutter.left[data-v-1ed6aae0]{left:calc(var(--gutter-width)*-1)}.gutter.right[data-v-1ed6aae0]{right:calc(var(--gutter-width)*-1)}.page[data-v-1ed6aae0]{flex-shrink:0;margin-right:var(--gutter-width);position:relative;scroll-snap-align:start;transform:scale(1);transform-origin:center center;transition:transform .5s ease-in-out;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}@media(prefers-reduced-motion){.page[data-v-1ed6aae0]{transition:none}}.page.active[data-v-1ed6aae0]{-webkit-user-select:auto;-moz-user-select:auto;user-select:auto}.gutter .pager-control[data-v-1ed6aae0]{margin-top:calc(var(--control-size)*-1)}.indicators[data-v-1ed6aae0]{display:flex;flex-wrap:wrap;gap:1em;justify-content:center;margin-top:1rem}.with-compact-controls .indicators[data-v-1ed6aae0]{display:none}.indicator[data-v-1ed6aae0]{background:var(--indicator-color-fill-inactive);border:1px solid var(--indicator-color-fill-inactive);border-radius:50%;color:currentColor;display:block;flex:0 0 auto;height:var(--indicator-size);width:var(--indicator-size)}.indicator.active[data-v-1ed6aae0]{background:var(--indicator-color-fill-active);border-color:var(--indicator-color-fill-active)}.compact-controls[data-v-1ed6aae0]{display:none;gap:1em;justify-content:flex-end}.with-compact-controls .compact-controls[data-v-1ed6aae0]{display:flex}.button-cta[data-v-3d3ff4c8]{background:var(--colors-button-light-background,var(--color-button-background));border-color:var(--color-button-border,currentcolor);border-radius:var(--button-border-radius,var(--border-radius,4px));border-style:var(--button-border-style,none);border-width:var(--button-border-width,medium);color:var(--colors-button-text,var(--color-button-text));cursor:pointer;min-width:1.7647058824rem;padding:.2352941176rem .8823529412rem;text-align:center;white-space:nowrap;display:inline-block;font-size:1rem;line-height:1.4705882353;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.button-cta[data-v-3d3ff4c8]:active{background:var(--colors-button-light-backgroundActive,var(--color-button-background-active));outline:none}.button-cta[data-v-3d3ff4c8]:hover:not([disabled]){background:var(--colors-button-light-backgroundHover,var(--color-button-background-hover));text-decoration:none}.button-cta[data-v-3d3ff4c8]:disabled{opacity:.32;cursor:default}.fromkeyboard .button-cta[data-v-3d3ff4c8]:focus{box-shadow:0 0 0 4px var(--color-focus-color);outline:none}.button-cta.is-dark[data-v-3d3ff4c8]{background:var(--colors-button-dark-background,#06f)}.button-cta.is-dark[data-v-3d3ff4c8]:active{background:var(--colors-button-dark-backgroundActive,var(--color-button-background-active))}.button-cta.is-dark[data-v-3d3ff4c8]:hover:not([disabled]){background:var(--colors-button-dark-backgroundHover,var(--color-button-background-hover))}.card-cover-wrap.rounded[data-v-28b14a83]{border-radius:var(--border-radius,4px);overflow:hidden}.card-cover[data-v-28b14a83]{background-color:var(--color-card-background);display:block;height:var(--card-cover-height,180px)}.card-cover.fallback[data-v-28b14a83],.card-cover[data-v-28b14a83] img{width:100%;-o-object-fit:cover;object-fit:cover;-o-object-position:center;object-position:center;display:block;margin:0}.card-cover[data-v-28b14a83] img{height:100%}.card[data-v-0f7a4f31]{--margin-link:17px;overflow:hidden;display:flex;flex-direction:column;transition:box-shadow,transform .16s ease-out;will-change:box-shadow,transform;backface-visibility:hidden;border-radius:var(--border-radius,4px)}.card.large[data-v-0f7a4f31]{--margin-link:25.5px}.card.large.floating-style[data-v-0f7a4f31]{--margin-link:var(--spacing-stacked-margin-large)}.card[data-v-0f7a4f31]:hover{text-decoration:none}.card:hover .link[data-v-0f7a4f31]{text-decoration:underline}.card[data-v-0f7a4f31]:hover{transform:scale(1.007)}@media(prefers-reduced-motion:reduce){.card[data-v-0f7a4f31]:hover{transform:none}}.card.small[data-v-0f7a4f31]{--card-cover-height:235px}@media only screen and (max-width:1250px){.card.small[data-v-0f7a4f31]{--card-cover-height:163px}}.card.large[data-v-0f7a4f31]{--card-cover-height:359px}@media only screen and (max-width:1250px){.card.large[data-v-0f7a4f31]{--card-cover-height:249px}}.card.floating-style[data-v-0f7a4f31]{--color-card-shadow:transparent}.details[data-v-0f7a4f31]{flex-grow:1;display:flex;flex-direction:column;background-color:var(--color-card-background);padding:17px;position:relative;font-size:.8235294118rem;line-height:1.2857142857}.details[data-v-0f7a4f31],.large .details[data-v-0f7a4f31]{font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.large .details[data-v-0f7a4f31]{font-size:1rem;line-height:1.4705882353}@media only screen and (max-width:1250px){.large .details[data-v-0f7a4f31]{font-size:.8235294118rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.floating-style .details[data-v-0f7a4f31]{--color-card-background:transparent;padding:17px 0}.eyebrow[data-v-0f7a4f31]{color:var(--color-card-eyebrow);display:block;margin-bottom:4px;font-size:.8235294118rem;line-height:1.2857142857}.eyebrow[data-v-0f7a4f31],.large .eyebrow[data-v-0f7a4f31]{font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.large .eyebrow[data-v-0f7a4f31]{font-size:1rem;line-height:1.2352941176}@media only screen and (max-width:1250px){.large .eyebrow[data-v-0f7a4f31]{font-size:.8235294118rem;line-height:1.2857142857;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.title[data-v-0f7a4f31]{color:var(--color-card-content-text);font-size:1rem;line-height:1.2352941176;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){.title[data-v-0f7a4f31]{font-size:.8235294118rem;line-height:1.2857142857;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.title[data-v-0f7a4f31]{font-size:1rem;line-height:1.2352941176;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.large .title[data-v-0f7a4f31]{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){.large .title[data-v-0f7a4f31]{font-size:1rem;line-height:1.2352941176;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.card-content[data-v-0f7a4f31]{flex-grow:1;color:var(--color-card-content-text);margin-top:4px}.link[data-v-0f7a4f31]{margin-top:var(--margin-link);display:flex;align-items:center}.link .link-icon[data-v-0f7a4f31]{height:.6em;width:.6em;margin-left:.3em}@media only screen and (max-width:735px){.card[data-v-0f7a4f31]{margin-left:auto;margin-right:auto}.card+.card[data-v-0f7a4f31]{margin-bottom:20px;margin-top:20px}.card.large[data-v-0f7a4f31],.card.small[data-v-0f7a4f31]{min-width:280px;--card-cover-height:227px}.card.large .link[data-v-0f7a4f31],.card.small .link[data-v-0f7a4f31]{margin-top:7px;position:relative}}.two-letter-icon[data-v-baad8018]{direction:ltr}.TopicTypeIcon[data-v-3b1b4787]{width:1em;height:1em;flex:0 0 auto;color:var(--icon-color,var(--color-figure-gray-secondary))}.TopicTypeIcon[data-v-3b1b4787] picture{flex:1}.TopicTypeIcon svg[data-v-3b1b4787],.TopicTypeIcon[data-v-3b1b4787] img{display:block;width:100%;height:100%}.reference-card-grid-item[data-v-87dd3302]{--card-cover-height:auto}.reference-card-grid-item.card.large[data-v-87dd3302]{--card-cover-height:auto;min-width:0;max-width:none}.reference-card-grid-item[data-v-87dd3302] .card-cover{aspect-ratio:16/9}.reference-card-grid-item[data-v-87dd3302] .card-cover-wrap{border:1px solid var(--color-link-block-card-border)}.reference-card-grid-item__image[data-v-87dd3302]{display:flex;align-items:center;justify-content:center;font-size:80px;background-color:var(--color-fill-gray-quaternary)}.reference-card-grid-item__icon[data-v-87dd3302]{margin:0;display:flex;justify-content:center}.reference-card-grid-item__icon[data-v-87dd3302] .icon-inline{flex:1 1 auto}.nav-menu-items[data-v-a101abb4]{display:flex;justify-content:flex-end}.nav--in-breakpoint-range .nav-menu-items[data-v-a101abb4]{display:block;opacity:0;padding:1rem 1.8823529412rem 1.6470588235rem 1.8823529412rem;transform:translate3d(0,-50px,0);transition:transform 1s cubic-bezier(.07,1.06,.27,.95) .5s,opacity .7s cubic-bezier(.07,1.06,.27,.95) .2s}.nav--is-open.nav--in-breakpoint-range .nav-menu-items[data-v-a101abb4]{opacity:1;transform:translateZ(0);transition-delay:.2s,.4s}.nav--in-breakpoint-range .nav-menu-items[data-v-a101abb4]:not(:only-child):not(:last-child){padding-bottom:0}.nav--in-breakpoint-range .nav-menu-items[data-v-a101abb4]:not(:only-child):last-child{padding-top:0}*+.links-block[data-v-b1a75c1c],.links-block[data-v-b1a75c1c]+*{margin-top:var(--spacing-stacked-margin-xlarge)}.topic-link-block[data-v-b1a75c1c]{margin-top:15px}.thematic-break[data-v-62d2922a]{border-top-color:var(--color-grid,currentColor);border-top-style:solid;border-width:1px 0 0 0}*+.thematic-break[data-v-62d2922a],.thematic-break[data-v-62d2922a]+*{margin-top:var(--spacing-stacked-margin-xlarge)}.nav[data-v-5ee249d6]{position:sticky;top:0;width:100%;height:3.0588235294rem;z-index:9997;--nav-padding:1.2941176471rem;color:var(--color-nav-color)}@media print{.nav[data-v-5ee249d6]{position:relative}}@media only screen and (max-width:767px){.nav[data-v-5ee249d6]{--nav-padding:0.9411764706rem;min-width:320px;height:2.8235294118rem}}.theme-dark.nav[data-v-5ee249d6]{background:none;color:var(--color-nav-dark-color)}.nav__wrapper[data-v-5ee249d6]{position:absolute;top:0;left:0;width:100%;height:auto;min-height:100%;z-index:1}.nav__background[data-v-5ee249d6]{position:absolute;left:0;top:0;width:100%;height:100%;z-index:1;transition:background-color 0s ease-in;background-color:var(--color-nav-background,none)}.nav__background[data-v-5ee249d6]:after{background-color:var(--color-nav-keyline)}.nav--is-sticking.nav__background[data-v-5ee249d6]{background-color:none}.nav--no-bg-transition .nav__background[data-v-5ee249d6]{transition:none!important}.nav--solid-background .nav__background[data-v-5ee249d6]{background-color:var(--color-nav-solid-background);backdrop-filter:none}.nav--is-open.nav--solid-background .nav__background[data-v-5ee249d6],.nav--is-sticking.nav--solid-background .nav__background[data-v-5ee249d6]{background-color:var(--color-nav-solid-background)}.nav--is-open.theme-dark.nav--solid-background .nav__background[data-v-5ee249d6],.nav--is-sticking.theme-dark.nav--solid-background .nav__background[data-v-5ee249d6],.theme-dark.nav--solid-background .nav__background[data-v-5ee249d6]{background-color:var(--color-nav-dark-solid-background)}.nav--in-breakpoint-range .nav__background[data-v-5ee249d6]{min-height:2.8235294118rem;transition:background-color 0s ease .7s}.nav--is-sticking .nav__background[data-v-5ee249d6]{background-color:var(--color-nav-expanded);max-height:none;transition:background-color 0s ease;transition-property:background-color,backdrop-filter}.nav--is-sticking .nav__background[data-v-5ee249d6]:after{background-color:var(--color-nav-sticking-expanded-keyline)}@supports(backdrop-filter:initial){.nav--is-sticking .nav__background[data-v-5ee249d6]{backdrop-filter:saturate(180%) blur(20px);background-color:var(--color-nav-uiblur-stuck)}}.theme-dark.nav--is-sticking .nav__background[data-v-5ee249d6]{background-color:var(--color-nav-dark-stuck)}@supports(backdrop-filter:initial){.theme-dark.nav--is-sticking .nav__background[data-v-5ee249d6]{background-color:var(--color-nav-dark-uiblur-stuck)}}.nav--is-open .nav__background[data-v-5ee249d6]{background-color:var(--color-nav-expanded);max-height:none;transition:background-color 0s ease;transition-property:background-color,backdrop-filter}.nav--is-open .nav__background[data-v-5ee249d6]:after{background-color:var(--color-nav-sticking-expanded-keyline)}@supports(backdrop-filter:initial){.nav--is-open .nav__background[data-v-5ee249d6]{backdrop-filter:saturate(180%) blur(20px);background-color:var(--color-nav-uiblur-expanded)}}.theme-dark.nav--is-open .nav__background[data-v-5ee249d6]{background-color:var(--color-nav-dark-expanded)}@supports(backdrop-filter:initial){.theme-dark.nav--is-open .nav__background[data-v-5ee249d6]{background-color:var(--color-nav-dark-uiblur-expanded)}}.theme-dark .nav__background[data-v-5ee249d6]:after{background-color:var(--color-nav-dark-keyline)}.nav--is-open.theme-dark .nav__background[data-v-5ee249d6]:after,.nav--is-sticking.theme-dark .nav__background[data-v-5ee249d6]:after{background-color:var(--color-nav-dark-sticking-expanded-keyline)}.nav__background[data-v-5ee249d6]:after{content:"";display:block;position:absolute;bottom:0;left:50%;transform:translateX(-50%);width:980px;height:1px;z-index:1}@media only screen and (max-width:1023px){.nav__background[data-v-5ee249d6]:after{width:100%}}.nav--noborder .nav__background[data-v-5ee249d6]:after{display:none}.nav--is-sticking.nav--noborder .nav__background[data-v-5ee249d6]:after{display:block}.nav--fullwidth-border .nav__background[data-v-5ee249d6]:after,.nav--is-open .nav__background[data-v-5ee249d6]:after,.nav--is-sticking .nav__background[data-v-5ee249d6]:after,.nav--solid-background .nav__background[data-v-5ee249d6]:after{width:100%}.nav-overlay[data-v-5ee249d6]{position:fixed;left:0;right:0;top:0;display:block;opacity:0}.nav--is-open .nav-overlay[data-v-5ee249d6]{background-color:rgba(51,51,51,.4);transition:opacity .7s cubic-bezier(.07,1.06,.27,.95) .2s;bottom:0;opacity:1}.nav-wrapper[data-v-5ee249d6]{position:absolute;top:0;left:0;width:100%;height:auto;min-height:100%;z-index:1}.pre-title[data-v-5ee249d6]{display:flex}.nav-content[data-v-5ee249d6]{display:flex;padding:0 var(--nav-padding);max-width:980px;margin:0 auto;position:relative;z-index:2;justify-content:space-between}.nav--is-wide-format .nav-content[data-v-5ee249d6]{box-sizing:border-box;max-width:1920px;margin-left:auto;margin-right:auto}@supports(padding:calc(max(0px))){.nav-content[data-v-5ee249d6]{padding-left:max(var(--nav-padding),env(safe-area-inset-left));padding-right:max(var(--nav-padding),env(safe-area-inset-right))}}.nav--in-breakpoint-range .nav-content[data-v-5ee249d6]{display:grid;grid-template-columns:auto 1fr auto;grid-auto-rows:minmax(min-content,max-content);grid-template-areas:"pre-title title actions" "menu menu menu"}.nav-menu[data-v-5ee249d6]{font-size:.7058823529rem;line-height:1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);flex:1 1 auto;display:flex;justify-content:flex-end;min-width:0}@media only screen and (max-width:767px){.nav-menu[data-v-5ee249d6]{font-size:.8235294118rem;line-height:1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.nav--in-breakpoint-range .nav-menu[data-v-5ee249d6]{font-size:.8235294118rem;line-height:1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);grid-area:menu}.nav-menu-tray[data-v-5ee249d6]{align-items:center;display:flex;justify-content:space-between}.nav--in-breakpoint-range .nav-menu-tray[data-v-5ee249d6]{display:block;overflow:hidden;pointer-events:none;visibility:hidden;max-height:0;transition:max-height .4s ease-in 0s,visibility 0s linear 1s;width:100%}.nav--is-open.nav--in-breakpoint-range .nav-menu-tray[data-v-5ee249d6]{max-height:calc(100vh - 5.64706rem);overflow-y:auto;-webkit-overflow-scrolling:touch;pointer-events:auto;visibility:visible;transition-delay:.2s,0s}.nav--is-transitioning.nav--is-open.nav--in-breakpoint-range .nav-menu-tray[data-v-5ee249d6]{overflow-y:hidden}.nav--is-sticking.nav--is-open.nav--in-breakpoint-range .nav-menu-tray[data-v-5ee249d6]{max-height:calc(100vh - 2.82353rem)}.nav-actions[data-v-5ee249d6]{display:flex;align-items:center}.nav--in-breakpoint-range .nav-actions[data-v-5ee249d6]{grid-area:actions;justify-content:flex-end}.nav--in-breakpoint-range .pre-title+.nav-title[data-v-5ee249d6]{grid-area:title}.nav--is-wide-format.nav--in-breakpoint-range .pre-title+.nav-title[data-v-5ee249d6]{width:100%}.nav-title[data-v-5ee249d6]{height:3.0588235294rem;font-size:1.1176470588rem;line-height:1.4210526316;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);display:flex;align-items:center;white-space:nowrap;box-sizing:border-box;overflow:hidden}@media only screen and (max-width:767px){.nav-title[data-v-5ee249d6]{padding-top:0;height:2.8235294118rem}}.nav-title[data-v-5ee249d6] span{line-height:normal}.nav-title a[data-v-5ee249d6]{letter-spacing:inherit;line-height:normal;margin:0;text-decoration:none;white-space:nowrap}.nav-title a[data-v-5ee249d6]:hover{text-decoration:none}@media only screen and (max-width:767px){.nav-title a[data-v-5ee249d6]{display:flex}}.nav-title a[data-v-5ee249d6],.nav-title[data-v-5ee249d6]{color:var(--color-figure-gray);transition:color 0s ease-in}.nav--is-open.theme-dark .nav-title a[data-v-5ee249d6],.nav--is-open.theme-dark .nav-title[data-v-5ee249d6],.nav--is-sticking.theme-dark .nav-title a[data-v-5ee249d6],.nav--is-sticking.theme-dark .nav-title[data-v-5ee249d6],.theme-dark .nav-title a[data-v-5ee249d6],.theme-dark .nav-title[data-v-5ee249d6]{color:var(--color-nav-dark-link-color)}.nav-ax-toggle[data-v-5ee249d6]{display:none;position:absolute;top:0;left:0;width:1px;height:1px;z-index:10}.nav-ax-toggle[data-v-5ee249d6]:focus{outline-offset:-6px;width:100%;height:100%}.nav--in-breakpoint-range .nav-ax-toggle[data-v-5ee249d6]{display:block}.nav-menucta[data-v-5ee249d6]{cursor:pointer;display:none;align-items:center;overflow:hidden;width:1.1764705882rem;-webkit-tap-highlight-color:rgba(0,0,0,0);height:2.8235294118rem}.nav--in-breakpoint-range .nav-menucta[data-v-5ee249d6]{display:flex}.nav-menucta-chevron[data-v-5ee249d6]{display:block;position:relative;width:100%;height:.7058823529rem;transition:transform .3s linear}.nav-menucta-chevron[data-v-5ee249d6]:after,.nav-menucta-chevron[data-v-5ee249d6]:before{content:"";display:block;position:absolute;top:.5882352941rem;width:.7058823529rem;height:.0588235294rem;transition:transform .3s linear;background:var(--color-figure-gray)}.nav-menucta-chevron[data-v-5ee249d6]:before{right:50%;border-radius:.5px 0 0 .5px}.nav-menucta-chevron[data-v-5ee249d6]:after{left:50%;border-radius:0 .5px .5px 0}.nav-menucta-chevron[data-v-5ee249d6]:before{transform-origin:100% 100%;transform:rotate(40deg) scaleY(1.5)}.nav-menucta-chevron[data-v-5ee249d6]:after{transform-origin:0 100%;transform:rotate(-40deg) scaleY(1.5)}.nav--is-open .nav-menucta-chevron[data-v-5ee249d6]{transform:scaleY(-1)}.theme-dark .nav-menucta-chevron[data-v-5ee249d6]:after,.theme-dark .nav-menucta-chevron[data-v-5ee249d6]:before{background:var(--color-nav-dark-link-color)}[data-v-5ee249d6] .nav-menu-link{color:var(--color-nav-link-color)}[data-v-5ee249d6] .nav-menu-link:hover{color:var(--color-nav-link-color-hover);text-decoration:none}.theme-dark[data-v-5ee249d6] .nav-menu-link{color:var(--color-nav-dark-link-color)}.theme-dark[data-v-5ee249d6] .nav-menu-link:hover{color:var(--color-nav-dark-link-color-hover)}[data-v-5ee249d6] .nav-menu-link.current{color:var(--color-nav-current-link);cursor:default}[data-v-5ee249d6] .nav-menu-link.current:hover{color:var(--color-nav-current-link)}.theme-dark[data-v-5ee249d6] .nav-menu-link.current,.theme-dark[data-v-5ee249d6] .nav-menu-link.current:hover{color:var(--color-nav-dark-current-link)}.nav-menu-item[data-v-6d4d011a]{margin-inline-start:1.4117647059rem;list-style:none;min-width:0}.nav--in-breakpoint-range .nav-menu-item[data-v-6d4d011a]{margin-inline-start:0;width:100%;min-height:2.4705882353rem}.nav--in-breakpoint-range .nav-menu-item[data-v-6d4d011a]:first-child .nav-menu-link{border-top:0}.nav--in-breakpoint-range .nav-menu-item--animated[data-v-6d4d011a]{opacity:0;transform:none;transition:.5s ease;transition-property:transform,opacity}.nav--is-open.nav--in-breakpoint-range .nav-menu-item--animated[data-v-6d4d011a]{opacity:1;transform:translateZ(0);transition-delay:0s}.overviewcard[data-v-73743ed9]{--overviewcard-border-radius:var(--border-radius,4px);--overviewcard-border-style:solid;--overviewcard-border-width:1px;--overviewcard-color-border:var(--color-overviewcard-border);--overviewcard-color-content:var(--color-overviewcard-fill);--overviewcard-color-head:var(--color-overviewcard-fill-secondary);background:var(--overviewcard-color-content);border:var(--overviewcard-border-width) var(--overviewcard-border-style) var(--overviewcard-color-border);border-radius:var(--overviewcard-border-radius)}*+.overviewcard[data-v-73743ed9],.overviewcard[data-v-73743ed9]+*{margin-top:var(--spacing-stacked-margin-xlarge)}.overviewcard>[data-v-73743ed9]{padding:20px}.overviewcard-head[data-v-73743ed9]{background:var(--overviewcard-color-head);border-start-start-radius:inherit;border-start-end-radius:inherit} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/css/documentation-topic.2b6fdee5.css b/Containers/Supporting Files/Help.bundle/css/documentation-topic.2b6fdee5.css new file mode 100644 index 0000000..bd98197 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/css/documentation-topic.2b6fdee5.css @@ -0,0 +1,9 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */.betainfo[data-v-ba3b3cc0]{font-size:.9411764706rem;padding:3rem 0;background-color:var(--color-fill-secondary)}.full-width-container .betainfo-container[data-v-ba3b3cc0]{max-width:820px;margin-left:auto;margin-right:auto;padding-left:80px;padding-right:80px;box-sizing:border-box}@media print{.full-width-container .betainfo-container[data-v-ba3b3cc0]{padding-left:20px;padding-right:20px;max-width:none}}@media only screen and (min-width:1251px){.full-width-container .betainfo-container[data-v-ba3b3cc0]{max-width:980px}}@media only screen and (min-width:1500px){.full-width-container .betainfo-container[data-v-ba3b3cc0]{max-width:1080px}}@media only screen and (max-width:735px){.full-width-container .betainfo-container[data-v-ba3b3cc0]{width:auto;padding-left:20px;padding-right:20px}}.static-width-container .betainfo-container[data-v-ba3b3cc0]{margin-left:auto;margin-right:auto;width:1536px;width:980px}@media only screen and (max-width:1250px){.static-width-container .betainfo-container[data-v-ba3b3cc0]{width:692px}}@media only screen and (max-width:735px){.static-width-container .betainfo-container[data-v-ba3b3cc0]{width:87.5%}}@media only screen and (max-width:320px){.static-width-container .betainfo-container[data-v-ba3b3cc0]{width:215px}}.betainfo-label[data-v-ba3b3cc0]{font-weight:600;font-size:.9411764706rem}.betainfo-content[data-v-ba3b3cc0] p{margin-bottom:10px}a[data-v-2ca5e993]{text-decoration:underline;color:inherit;font-weight:600}.summary-section[data-v-3aa6f694]:last-of-type{margin-right:0}@media only screen and (max-width:735px){.summary-section[data-v-3aa6f694]{margin-right:0}}.title[data-v-246c819c]{color:var(--colors-text,var(--color-text));font-size:.8235294118rem;margin-right:.5rem;text-rendering:optimizeLegibility}.language[data-v-0e39c0ba]{padding-bottom:10px;justify-content:flex-end}.language-list[data-v-0e39c0ba],.language[data-v-0e39c0ba]{font-size:.8235294118rem;line-height:1.4285714286;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);margin-top:0;display:flex;align-items:center}.language-option.swift[data-v-0e39c0ba]{padding-right:10px;border-right:1px solid var(--colors-secondary-label,var(--color-secondary-label))}.language-option.objc[data-v-0e39c0ba]{padding-left:10px}.view-more-link[data-v-3f54e653]{font-size:.8235294118rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);display:flex;flex-flow:row-reverse;margin-bottom:1.3rem}.documentation-hero[data-v-0958f035]{color:var(--color-documentation-intro-figure,var(--color-figure-gray));overflow:hidden;position:relative;padding-inline-end:var(--doc-hero-right-offset)}.documentation-hero[data-v-0958f035]:before{content:"";background:var(--standard-accent-color,var(--color-documentation-intro-fill,var(--color-fill-tertiary)));position:absolute;width:100%;height:100%}.documentation-hero[data-v-0958f035]:after{background:transparent;opacity:.85;width:100%;position:absolute;content:"";height:100%;inset-inline-start:0;top:0}@media screen{[data-color-scheme=dark] .documentation-hero[data-v-0958f035]:after{opacity:.55}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .documentation-hero[data-v-0958f035]:after{opacity:.55}}.documentation-hero .icon[data-v-0958f035]{position:absolute;margin-top:10px;margin-inline-end:25px;inset-inline-end:0;width:250px;height:calc(100% - 20px);box-sizing:border-box}@media only screen and (max-width:735px){.documentation-hero .icon[data-v-0958f035]{display:none}}.documentation-hero .background-icon[data-v-0958f035]{color:var(--color-documentation-intro-accent,var(--color-figure-gray-secondary));display:block;width:250px;height:auto;opacity:.15;mix-blend-mode:normal;position:absolute;top:50%;inset-inline-start:0;transform:translateY(-50%);max-height:100%}.documentation-hero .background-icon[data-v-0958f035] img,.documentation-hero .background-icon[data-v-0958f035] svg{width:100%;height:100%}@media screen{[data-color-scheme=dark] .documentation-hero .background-icon[data-v-0958f035]{mix-blend-mode:normal;opacity:.15}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .documentation-hero .background-icon[data-v-0958f035]{mix-blend-mode:normal;opacity:.15}}.documentation-hero__content[data-v-0958f035]:not(.minimized-hero){padding-top:2.3529411765rem;padding-bottom:2.3529411765rem;position:relative;z-index:1}.full-width-container .documentation-hero__content[data-v-0958f035]:not(.minimized-hero){max-width:820px;margin-left:auto;margin-right:auto;padding-left:80px;padding-right:80px;box-sizing:border-box}@media print{.full-width-container .documentation-hero__content[data-v-0958f035]:not(.minimized-hero){padding-left:20px;padding-right:20px;max-width:none}}@media only screen and (min-width:1251px){.full-width-container .documentation-hero__content[data-v-0958f035]:not(.minimized-hero){max-width:980px}}@media only screen and (min-width:1500px){.full-width-container .documentation-hero__content[data-v-0958f035]:not(.minimized-hero){max-width:1080px}}@media only screen and (max-width:735px){.full-width-container .documentation-hero__content[data-v-0958f035]:not(.minimized-hero){width:auto;padding-left:20px;padding-right:20px}}.static-width-container .documentation-hero__content[data-v-0958f035]:not(.minimized-hero){margin-left:auto;margin-right:auto;width:1536px;width:980px}@media only screen and (max-width:1250px){.static-width-container .documentation-hero__content[data-v-0958f035]:not(.minimized-hero){width:692px}}@media only screen and (max-width:735px){.static-width-container .documentation-hero__content[data-v-0958f035]:not(.minimized-hero){width:87.5%}}@media only screen and (max-width:320px){.static-width-container .documentation-hero__content[data-v-0958f035]:not(.minimized-hero){width:215px}}.documentation-hero .minimized-hero[data-v-0958f035]{padding:1.3em 1.4em;position:relative;z-index:1}.documentation-hero__above-content[data-v-0958f035]{position:relative;z-index:1}.documentation-hero--disabled[data-v-0958f035]{background:none;color:var(--colors-text,var(--color-text))}.documentation-hero--disabled[data-v-0958f035]:after,.documentation-hero--disabled[data-v-0958f035]:before{content:none}.short-hero[data-v-0958f035]{padding-top:3.5294117647rem;padding-bottom:3.5294117647rem}.extra-bottom-padding[data-v-0958f035]{padding-bottom:3.8235294118rem}ul[data-v-068842ec]{list-style-type:none;margin:0}ul li:first-child .base-link[data-v-068842ec]{margin-top:0}.parent-item .base-link[data-v-068842ec]{font-weight:700}.base-link[data-v-068842ec]{color:var(--color-figure-gray-secondary);font-size:.8235294118rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);display:inline-block;margin:5px 0;transition:color .15s ease-in;max-width:100%}.active .base-link[data-v-068842ec]{color:var(--color-text)}[data-v-3a32ffd0] .code-listing{background:var(--background,var(--color-code-background));color:var(--text,var(--color-code-plain));border-color:var(--colors-grid,var(--color-grid));border-width:var(--code-border-width,1px);border-style:var(--code-border-style,solid)}[data-v-3a32ffd0] .code-listing pre{padding:var(--code-block-style-elements-padding)}[data-v-3a32ffd0] .code-listing pre>code{font-size:.8823529412rem;line-height:1.6666666667;font-weight:400;font-family:var(--typography-html-font-mono,Menlo,monospace)}[data-v-3a32ffd0] *+.code-listing,[data-v-3a32ffd0] *+.endpoint-example,[data-v-3a32ffd0] *+.inline-image-container,[data-v-3a32ffd0] *+aside,[data-v-3a32ffd0] *+figure,[data-v-3a32ffd0] .code-listing+*,[data-v-3a32ffd0] .endpoint-example+*,[data-v-3a32ffd0] .inline-image-container+*,[data-v-3a32ffd0] aside+*,[data-v-3a32ffd0] figure+*{margin-top:var(--spacing-stacked-margin-xlarge)}[data-v-3a32ffd0] *+dl,[data-v-3a32ffd0] dl+*{margin-top:var(--spacing-stacked-margin-large)}[data-v-3a32ffd0] img{display:block;margin:auto;max-width:100%}[data-v-3a32ffd0] ol,[data-v-3a32ffd0] ol li:not(:first-child),[data-v-3a32ffd0] ul,[data-v-3a32ffd0] ul li:not(:first-child){margin-top:var(--spacing-stacked-margin-large)}@media only screen and (max-width:735px){[data-v-3a32ffd0] ol,[data-v-3a32ffd0] ul{margin-left:1.25rem}}[data-v-3a32ffd0] dt:not(:first-child){margin-top:var(--spacing-stacked-margin-large)}[data-v-3a32ffd0] dd{margin-left:2em}.conditional-constraints[data-v-4c6f3ed1] code{color:var(--colors-secondary-label,var(--color-secondary-label))}.token-method[data-v-295ad0ff]{font-weight:700}.token-keyword[data-v-295ad0ff]{color:var(--syntax-keyword,var(--color-syntax-keywords))}.token-number[data-v-295ad0ff]{color:var(--syntax-number,var(--color-syntax-numbers))}.token-string[data-v-295ad0ff]{color:var(--syntax-string,var(--color-syntax-strings))}.attribute-link[data-v-295ad0ff],.token-attribute[data-v-295ad0ff]{color:var(--syntax-attribute,var(--color-syntax-keywords))}.token-internalParam[data-v-295ad0ff]{color:var(--color-syntax-param-internal-name)}.type-identifier-link[data-v-295ad0ff]{color:var(--syntax-type,var(--color-syntax-other-type-names))}.token-removed[data-v-295ad0ff]{background-color:var(--color-highlight-red)}.token-added[data-v-295ad0ff]{background-color:var(--color-highlight-green)}.source[data-v-dc9cfb3a]{background:var(--background,var(--color-code-background));border-color:var(--color-grid);color:var(--text,var(--color-code-plain));border-radius:var(--border-radius,4px);border-style:solid;border-width:1px;padding:var(--code-block-style-elements-padding);speak:literal-punctuation;line-height:25px;filter:blur(0)}.source.displays-multiple-lines[data-v-dc9cfb3a]{border-radius:var(--border-radius,4px)}.source>code[data-v-dc9cfb3a]{font-size:.8823529412rem;line-height:1.6666666667;font-weight:400;font-family:var(--typography-html-font-mono,Menlo,monospace);display:block}.platforms[data-v-f961f3da]{font-size:.8235294118rem;line-height:1.4285714286;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);margin-bottom:.45rem;margin-top:var(--spacing-stacked-margin-xlarge)}.changed .platforms[data-v-f961f3da]{padding-left:.588rem}.platforms[data-v-f961f3da]:first-of-type{margin-top:1rem}.source[data-v-f961f3da]{transition:margin .3s linear}.platforms+.source[data-v-f961f3da]{margin:0}.declaration-pill:not(.declaration-pill--expanded) .source[data-v-f961f3da] .highlighted{background:unset;font-weight:400}.declaration-pill--expanded .source[data-v-f961f3da]{border-width:1px}.declaration-pill--expanded .source[data-v-f961f3da] a{pointer-events:none}.declaration-pill--expanded.selected-declaration .source[data-v-f961f3da]{border-color:var(--color-focus-border-color,var(--color-focus-border-color))}.declaration-pill--expanded:not(.selected-declaration) .source[data-v-f961f3da]{background:none}.changed .source[data-v-f961f3da]{background:none;border:none;margin-top:0;margin-bottom:0;margin-left:2.1764705882rem;padding-left:0}.expand-enter-active,.expand-leave-active{transition:height .3s ease-in-out;overflow:hidden}.expand-enter,.expand-leave-to{height:0}.declaration-pill--expanded[data-v-18e7c20c]{transition-timing-function:linear;transition-property:opacity,height;margin:var(--declaration-code-listing-margin)}.declaration-pill--expanded>button[data-v-18e7c20c]{display:block;width:100%}.declaration-pill--expanded.expand-enter[data-v-18e7c20c],.declaration-pill--expanded.expand-leave-to[data-v-18e7c20c]{opacity:0}.declaration-pill--expanded.expand-enter .source[data-v-18e7c20c],.declaration-pill--expanded.expand-leave-to .source[data-v-18e7c20c]{margin:0}.declaration-pill--expanded[data-v-18e7c20c] .highlighted{background:var(--color-syntax-highlighted,mark);font-weight:600;transition:background .3s linear,font-weight .3s linear}.changed.selected-declaration[data-v-18e7c20c],.declaration-diff[data-v-0c2301a5]{background:var(--background,var(--color-code-background))}.declaration-diff-version[data-v-0c2301a5]{padding-left:.588rem;padding-left:2.1764705882rem;font-size:1rem;line-height:1.5294117647;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-figure-gray-secondary);margin:0}.declaration-diff-current[data-v-0c2301a5]{padding-top:8px;padding-bottom:5px}.declaration-diff-previous[data-v-0c2301a5]{padding-top:5px;padding-bottom:8px;background-color:var(--color-changes-modified-previous-background);border-radius:0 0 var(--border-radius,4px) var(--border-radius,4px);position:relative}.declaration-source-link[data-v-5863919c]{font-size:.8235294118rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);display:flex;align-items:center;margin-top:var(--declaration-source-link-margin,var(--spacing-stacked-margin-large))}.declaration-icon[data-v-5863919c]{width:1em;margin-right:5px}.conditional-constraints[data-v-722d45cf],.declaration-list[data-v-722d45cf]:not(:first-child){margin-top:var(--declaration-conditional-constraints-margin,20px)}.abstract[data-v-f3f57cbe]{font-size:1.2352941176rem;line-height:1.380952381;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:735px){.abstract[data-v-f3f57cbe]{font-size:1.1176470588rem;line-height:1.4210526316;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}[data-v-f3f57cbe] p:last-child{margin-bottom:0}.full-width-container .container[data-v-0e6b292c]:not(.minimized-container){max-width:820px;margin-left:auto;margin-right:auto;padding-left:80px;padding-right:80px;box-sizing:border-box}@media print{.full-width-container .container[data-v-0e6b292c]:not(.minimized-container){padding-left:20px;padding-right:20px;max-width:none}}@media only screen and (min-width:1251px){.full-width-container .container[data-v-0e6b292c]:not(.minimized-container){max-width:980px}}@media only screen and (min-width:1500px){.full-width-container .container[data-v-0e6b292c]:not(.minimized-container){max-width:1080px}}@media only screen and (max-width:735px){.full-width-container .container[data-v-0e6b292c]:not(.minimized-container){width:auto;padding-left:20px;padding-right:20px}}.static-width-container .container[data-v-0e6b292c]:not(.minimized-container){margin-left:auto;margin-right:auto;width:1536px;width:980px}@media only screen and (max-width:1250px){.static-width-container .container[data-v-0e6b292c]:not(.minimized-container){width:692px}}@media only screen and (max-width:735px){.static-width-container .container[data-v-0e6b292c]:not(.minimized-container){width:87.5%}}@media only screen and (max-width:320px){.static-width-container .container[data-v-0e6b292c]:not(.minimized-container){width:215px}}.container[data-v-0e6b292c]{--section-spacing-single-side:40px;padding-bottom:var(--section-spacing-single-side)}.container.minimized-container[data-v-0e6b292c]{--section-spacing-single-side:1.5em}.container.minimized-container .contenttable-section[data-v-0e6b292c],.title[data-v-0e6b292c]{padding-top:var(--section-spacing-single-side)}.title[data-v-0e6b292c]{font-size:1.8823529412rem;line-height:1.125;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);border-top-color:var(--color-grid);border-top-style:solid;border-top-width:var(--content-table-title-border-width,1px)}@media only screen and (max-width:1250px){.title[data-v-0e6b292c]{font-size:1.6470588235rem;line-height:1.1428571429;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.title[data-v-0e6b292c]{font-size:1.4117647059rem;line-height:1.1666666667;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.title+.contenttable-section[data-v-1b0546d9]{margin-top:0}.contenttable-section[data-v-1b0546d9]{align-items:baseline;padding-top:2.353rem}.contenttable-section[data-v-1b0546d9]:last-child{margin-bottom:0}[data-v-1b0546d9] .contenttable-title{font-size:1.4117647059rem;line-height:1.1666666667;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){[data-v-1b0546d9] .contenttable-title{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.contenttable-section[data-v-1b0546d9]{align-items:unset;border-top:none;display:inherit;margin:0}.section-content[data-v-1b0546d9],.section-title[data-v-1b0546d9]{padding:0}[data-v-1b0546d9] .contenttable-title{margin:0 0 2.353rem 0;padding-bottom:.5rem}}.badge[data-v-ffe39a30]{--badge-color:var(--color-badge-default);--badge-dark-color:var(--color-badge-dark-default);font-size:.7058823529rem;line-height:1.3333333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);display:inline-block;padding:2px 4px;white-space:nowrap;border-radius:var(--badge-border-radius,1px);border-style:var(--badge-border-style,none);border-width:var(--badge-border-width,1px);margin:auto;margin-inline-start:5px;color:var(--colors-badge-text,var(--color-badge-text));background-color:var(--badge-color)}@media screen{[data-color-scheme=dark] .badge[data-v-ffe39a30]{background-color:var(--badge-dark-color)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .badge[data-v-ffe39a30]{background-color:var(--badge-dark-color)}}.badge-deprecated[data-v-ffe39a30]{--badge-color:var(--color-badge-deprecated);--badge-dark-color:var(--color-badge-dark-deprecated)}.badge-beta[data-v-ffe39a30]{--badge-color:var(--color-badge-beta);--badge-dark-color:var(--color-badge-dark-beta)}.topic-icon-wrapper[data-v-58794252]{display:flex;align-items:center;justify-content:center;height:1.4705882353rem;flex:0 0 1.294rem;width:1.294rem;margin-inline-end:1rem}.topic-icon[data-v-58794252]{height:.8823529412rem;transform:scale(1);-webkit-transform:scale(1);overflow:visible}.topic-icon[data-v-58794252] img{margin:0;display:block;width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.topic-icon.curly-brackets-icon[data-v-58794252]{height:1rem}.decorated-title[data-v-2d744be4]{direction:ltr}.decorator[data-v-2d744be4],.label[data-v-2d744be4]{color:var(--colors-secondary-label,var(--color-secondary-label))}.label[data-v-2d744be4]{font-size:1rem;line-height:1.4705882353;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.empty-token[data-v-2d744be4]{font-size:0}.empty-token[data-v-2d744be4]:after{content:" ";font-size:1rem}.abstract[data-v-e1f11a1a],.link-block[data-v-e1f11a1a] .badge{margin-inline-start:2.294rem}.link-block .badge+.badge[data-v-e1f11a1a]{margin-inline-start:1rem}.link[data-v-e1f11a1a]{display:flex}.link-block .badge[data-v-e1f11a1a]{margin-top:.5rem}.link-block.has-inline-element[data-v-e1f11a1a]{display:flex;align-items:flex-start;flex-flow:row wrap}.link-block.has-inline-element .badge[data-v-e1f11a1a]{margin-inline-start:1rem;margin-top:0}.link-block .has-adjacent-elements[data-v-e1f11a1a]{padding-top:5px;padding-bottom:5px;display:inline-flex}.link-block[data-v-e1f11a1a],.link[data-v-e1f11a1a]{box-sizing:inherit}.link-block.changed[data-v-e1f11a1a],.link.changed[data-v-e1f11a1a]{padding-right:1rem;padding-left:2.1764705882rem;padding-top:8px;padding-bottom:8px;display:inline-flex;width:100%;box-sizing:border-box}.link-block.changed.changed[data-v-e1f11a1a],.link.changed.changed[data-v-e1f11a1a]{padding-right:1rem}@media only screen and (max-width:735px){.link-block.changed[data-v-e1f11a1a],.link.changed[data-v-e1f11a1a]{padding-left:0;padding-right:0}.link-block.changed.changed[data-v-e1f11a1a],.link.changed.changed[data-v-e1f11a1a]{padding-right:17px;padding-left:2.1764705882rem}.link-block.changed[data-v-e1f11a1a],.link.changed[data-v-e1f11a1a]{padding-left:0;padding-right:0}}.abstract .topic-required[data-v-e1f11a1a]:not(:first-child){margin-top:4px}.topic-required[data-v-e1f11a1a]{font-size:.8em}.deprecated[data-v-e1f11a1a]{text-decoration:line-through}.section-content>.content[data-v-1c2724f5],.topic[data-v-1c2724f5]{margin-top:15px}.no-title .section-content>.content[data-v-1c2724f5]:first-child,.no-title .topic[data-v-1c2724f5]:first-child{margin-top:0}.property-metadata[data-v-f911f232]{color:var(--color-figure-gray-secondary)}.parameter-attributes[data-v-c0edcb84]{margin-left:1rem}[data-v-c0edcb84] .property-metadata{color:currentColor}.datalist dd{padding-left:2rem}.datalist dt{font-weight:600;padding-left:1rem;padding-top:var(--spacing-param)}.datalist dt:first-of-type{padding-top:0}.type[data-v-380373e1]:first-letter{text-transform:capitalize}.detail-type[data-v-d66cd00c]{font-weight:600;padding-left:1rem;padding-top:var(--spacing-param)}.detail-type[data-v-d66cd00c]:first-child{padding-top:0}@media only screen and (max-width:735px){.detail-type[data-v-d66cd00c]{padding-left:0}}.detail-content[data-v-d66cd00c]{padding-left:2rem}@media only screen and (max-width:735px){.detail-content[data-v-d66cd00c]{padding-left:0}}.param-name[data-v-b258c830]{font-weight:600;padding-inline-start:1rem;padding-top:var(--spacing-param)}.param-name[data-v-b258c830]:first-child{padding-top:0}@media only screen and (max-width:735px){.param-name[data-v-b258c830]{padding-inline-start:0}}.param-content[data-v-b258c830]{padding-inline-start:2rem}@media only screen and (max-width:735px){.param-content[data-v-b258c830]{padding-inline-start:0}}.param-content[data-v-b258c830] dt{font-weight:600}.param-content[data-v-b258c830] dd{margin-inline-start:1em}.parameters-table[data-v-eee7e94e] .change-added,.parameters-table[data-v-eee7e94e] .change-removed{display:inline-block;max-width:100%}.parameters-table[data-v-eee7e94e] .change-removed,.parameters-table[data-v-eee7e94e] .token-removed{text-decoration:line-through}.param[data-v-eee7e94e]{font-size:.8823529412rem;box-sizing:border-box}.param.changed[data-v-eee7e94e]{display:flex;flex-flow:row wrap;padding-right:1rem;padding-left:2.1764705882rem;padding-top:8px;padding-bottom:8px;display:inline-flex;width:100%;box-sizing:border-box}.param.changed.changed[data-v-eee7e94e]{padding-right:1rem}@media only screen and (max-width:735px){.param.changed[data-v-eee7e94e]{padding-left:0;padding-right:0}.param.changed.changed[data-v-eee7e94e]{padding-right:17px;padding-left:2.1764705882rem}.param.changed[data-v-eee7e94e]{padding-left:0;padding-right:0}}.param.changed.changed[data-v-eee7e94e]{padding-left:0;padding-right:0}.param.changed+.param.changed[data-v-eee7e94e]{margin-top:calc(var(--spacing-param)/2)}.changed .param-content[data-v-eee7e94e],.changed .param-symbol[data-v-eee7e94e]{padding-top:2px;padding-bottom:2px}@media only screen and (max-width:735px){.changed .param-content[data-v-eee7e94e]{padding-top:0}.changed .param-symbol[data-v-eee7e94e]{padding-bottom:0}}.param-symbol[data-v-eee7e94e]{text-align:right}.changed .param-symbol[data-v-eee7e94e]{padding-left:2.1764705882rem}@media only screen and (max-width:735px){.param-symbol[data-v-eee7e94e]{text-align:left}.changed .param-symbol[data-v-eee7e94e]{padding-left:0}}.param-symbol[data-v-eee7e94e] .type-identifier-link{color:var(--color-link)}.param+.param[data-v-eee7e94e]{margin-top:var(--spacing-param)}.param+.param[data-v-eee7e94e]:first-child{margin-top:0}.param-content[data-v-eee7e94e]{padding-left:1rem;padding-left:2.1764705882rem}.changed .param-content[data-v-eee7e94e]{padding-right:1rem}@media only screen and (max-width:735px){.param-content[data-v-eee7e94e]{padding-left:0;padding-right:0}}.property-text{font-weight:700}.property-metadata[data-v-549ed0a8]{color:var(--color-figure-gray-secondary)}.property-name[data-v-39899ccf]{font-weight:700}.property-name.deprecated[data-v-39899ccf]{text-decoration:line-through}.property-deprecated[data-v-39899ccf]{margin-left:0}.content[data-v-39899ccf],.content[data-v-39899ccf] p:first-child{display:inline}.response-mimetype[data-v-18890a0f]{color:var(--color-figure-gray-secondary)}.part-name[data-v-68facc94]{font-weight:700}.content[data-v-68facc94],.content[data-v-68facc94] p:first-child{display:inline}.param-name[data-v-0d9b752e]{font-weight:700}.param-name.deprecated[data-v-0d9b752e]{text-decoration:line-through}.param-deprecated[data-v-0d9b752e]{margin-left:0}.content[data-v-0d9b752e],.content[data-v-0d9b752e] p:first-child{display:inline}.response-name[data-v-362f5b54],.response-reason[data-v-362f5b54]{font-weight:700}@media only screen and (max-width:735px){.response-reason[data-v-362f5b54]{display:none}}.response-name>code>.reason[data-v-362f5b54]{display:none}@media only screen and (max-width:735px){.response-name>code>.reason[data-v-362f5b54]{display:initial}}.link[data-v-0a954b0c]{display:flex;margin-bottom:.5rem}.link-block[data-v-0a954b0c],.link[data-v-0a954b0c]{box-sizing:inherit}.link-block.changed[data-v-0a954b0c],.link.changed[data-v-0a954b0c]{padding-right:1rem;padding-left:2.1764705882rem;padding-top:8px;padding-bottom:8px;display:inline-flex;width:100%;box-sizing:border-box}.link-block.changed.changed[data-v-0a954b0c],.link.changed.changed[data-v-0a954b0c]{padding-right:1rem}@media only screen and (max-width:735px){.link-block.changed[data-v-0a954b0c],.link.changed[data-v-0a954b0c]{padding-left:0;padding-right:0}.link-block.changed.changed[data-v-0a954b0c],.link.changed.changed[data-v-0a954b0c]{padding-right:17px;padding-left:2.1764705882rem}.link-block.changed[data-v-0a954b0c],.link.changed[data-v-0a954b0c]{padding-left:0;padding-right:0}}.mention-icon[data-v-0a954b0c]{margin-inline-end:.25rem}.primary-content.with-border[data-v-65c116be]:before{border-top-color:var(--colors-grid,var(--color-grid));border-top-style:solid;border-top-width:var(--content-table-title-border-width,1px);content:"";display:block}.primary-content[data-v-65c116be]>*{margin-bottom:40px;margin-top:40px}.primary-content[data-v-65c116be]>:first-child{margin-top:2.353rem}.relationships-list[data-v-58f192c5]{list-style:none}.relationships-list.column[data-v-58f192c5]{margin-inline-start:0;margin-top:15px}.relationships-list.inline[data-v-58f192c5]{display:flex;flex-direction:row;flex-wrap:wrap;margin-top:15px;margin-inline-start:0}.relationships-list.inline li[data-v-58f192c5]:not(:last-child):after{content:", "}.relationships-list.changed[data-v-58f192c5]{padding-right:1rem;padding-left:2.1764705882rem;padding-top:8px;padding-bottom:8px;display:inline-flex;width:100%;box-sizing:border-box}.relationships-list.changed.changed[data-v-58f192c5]{padding-right:1rem}@media only screen and (max-width:735px){.relationships-list.changed[data-v-58f192c5]{padding-left:0;padding-right:0}.relationships-list.changed.changed[data-v-58f192c5]{padding-right:17px;padding-left:2.1764705882rem}.relationships-list.changed[data-v-58f192c5]{padding-left:0;padding-right:0}}.relationships-list.changed[data-v-58f192c5]:after{margin-top:.6176470588rem}.relationships-list.changed.column[data-v-58f192c5]{display:block;box-sizing:border-box}.relationships-item[data-v-58f192c5],.relationships-list[data-v-58f192c5]{box-sizing:inherit}.conditional-constraints[data-v-58f192c5]{font-size:.8235294118rem;margin:.1764705882rem 0 .5882352941rem 1.1764705882rem}.platform[data-v-2415d233],.technology[data-v-2415d233]{display:inline-flex;align-items:center}.tech-icon[data-v-2415d233]{height:12px;padding-right:5px;--color-svg-icon:var(--color-figure-gray)}.changed[data-v-2415d233]{padding-inline-start:17px;border:none}.changed[data-v-2415d233]:after{all:unset}.changed[data-v-2415d233]:before{background-image:url(../img/modified-icon.efb2697d.svg);background-repeat:no-repeat;bottom:0;content:" ";margin:auto;margin-right:8px;position:absolute;top:0;width:20px;height:20px;margin:0;inset-inline-start:-5px}@media screen{[data-color-scheme=dark] .changed[data-v-2415d233]:before{background-image:url(../img/modified-icon.efb2697d.svg)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .changed[data-v-2415d233]:before{background-image:url(../img/modified-icon.efb2697d.svg)}}.changed-added[data-v-2415d233]:before{background-image:url(../img/added-icon.832a5d2c.svg)}@media screen{[data-color-scheme=dark] .changed-added[data-v-2415d233]:before{background-image:url(../img/added-icon.832a5d2c.svg)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .changed-added[data-v-2415d233]:before{background-image:url(../img/added-icon.832a5d2c.svg)}}.changed-deprecated[data-v-2415d233]:before{background-image:url(../img/deprecated-icon.7bf1740a.svg)}@media screen{[data-color-scheme=dark] .changed-deprecated[data-v-2415d233]:before{background-image:url(../img/deprecated-icon.7bf1740a.svg)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .changed-deprecated[data-v-2415d233]:before{background-image:url(../img/deprecated-icon.7bf1740a.svg)}}.availability[data-v-2415d233]{display:flex;flex-flow:row wrap;gap:10px;margin-top:.8823529412rem;font-size:.8235294118rem;line-height:1.4285714286;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.availability>[data-v-2415d233]:after{content:"";display:inline-block;width:1px;height:1em;background:currentColor;margin-inline-start:10px}.availability>[data-v-2415d233]:last-child:after{content:none}.topictitle[data-v-a7c0bc44]{margin-bottom:.7058823529rem}.topictitle[data-v-a7c0bc44]:last-child{margin-bottom:0}@media only screen and (max-width:735px){.topictitle[data-v-a7c0bc44]{margin:0}}.eyebrow[data-v-a7c0bc44]{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-documentation-intro-eyebrow,var(--colors-secondary-label,var(--color-secondary-label)));display:block;margin-bottom:.8823529412rem}@media only screen and (max-width:735px){.eyebrow[data-v-a7c0bc44]{font-size:1.1176470588rem;line-height:1.2105263158;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.title[data-v-a7c0bc44]{font-size:2.3529411765rem;line-height:1.1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-documentation-intro-title,var(--colors-header-text,var(--color-header-text)))}@media only screen and (max-width:1250px){.title[data-v-a7c0bc44]{font-size:1.8823529412rem;line-height:1.125;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.title[data-v-a7c0bc44]{font-size:1.6470588235rem;line-height:1.1428571429;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}small[data-v-a7c0bc44]{font-size:1.4117647059rem;line-height:1.1666666667;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);padding-inline-start:10px}@media only screen and (max-width:1250px){small[data-v-a7c0bc44]{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}small[data-v-a7c0bc44]:before{content:attr(data-tag-name)}small.Beta[data-v-a7c0bc44]{color:var(--color-badge-beta)}@media screen{[data-color-scheme=dark] small.Beta[data-v-a7c0bc44]{color:var(--color-badge-dark-beta)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] small.Beta[data-v-a7c0bc44]{color:var(--color-badge-dark-beta)}}small.Deprecated[data-v-a7c0bc44]{color:var(--color-badge-deprecated)}@media screen{[data-color-scheme=dark] small.Deprecated[data-v-a7c0bc44]{color:var(--color-badge-dark-deprecated)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] small.Deprecated[data-v-a7c0bc44]{color:var(--color-badge-dark-deprecated)}}.OnThisPageStickyContainer[data-v-51908d5a]{margin-top:2.353rem;position:sticky;top:3.8235294118rem;align-self:flex-start;flex:0 0 auto;width:192px;padding-inline-end:1.2941176471rem;box-sizing:border-box;padding-bottom:var(--spacing-stacked-margin-small);max-height:calc(100vh - 3.82353rem);overflow:auto}@media print{.OnThisPageStickyContainer[data-v-51908d5a]{display:none}}@media only screen and (max-width:735px){.OnThisPageStickyContainer[data-v-51908d5a]{display:none}}.nav-menu-link[data-v-2ad31daf]{display:inline-block;line-height:22px;white-space:nowrap}.nav--in-breakpoint-range .nav-menu-link[data-v-2ad31daf]{line-height:42px;border-top:1px solid;border-color:var(--color-nav-rule);display:flex;flex:1 0 100%;height:100%;align-items:center}.theme-dark.nav--in-breakpoint-range .nav-menu-link[data-v-2ad31daf]{border-color:var(--color-nav-dark-rule)}.hierarchy-collapsed-items[data-v-a5015456]{position:relative;display:inline-flex;align-items:center}.hierarchy-collapsed-items[data-v-a5015456]:before{content:"/";width:.2941176471rem;margin:0 .2941176471rem}.nav--in-breakpoint-range .hierarchy-collapsed-items[data-v-a5015456],:root.no-js .hierarchy-collapsed-items[data-v-a5015456]{display:none}.hierarchy-collapsed-items .toggle[data-v-a5015456]{background:var(--color-nav-hierarchy-collapse-background);border-color:var(--color-nav-hierarchy-collapse-borders);border-radius:var(--border-radius,4px);border-style:solid;border-width:0;font-weight:600;height:1.1176470588rem;text-align:center;width:2.1176470588rem;display:flex;align-items:center;justify-content:center}.theme-dark .hierarchy-collapsed-items .toggle[data-v-a5015456]{background:var(--color-nav-dark-hierarchy-collapse-background)}.hierarchy-collapsed-items .toggle.focused[data-v-a5015456],.hierarchy-collapsed-items .toggle[data-v-a5015456]:active,.hierarchy-collapsed-items .toggle[data-v-a5015456]:focus{box-shadow:0 0 0 4px var(--color-focus-color);outline:none}.indicator[data-v-a5015456]{width:1em;height:1em;display:flex;align-items:center}.indicator .toggle-icon[data-v-a5015456]{width:100%}.dropdown[data-v-a5015456]{background:var(--color-nav-hierarchy-collapse-background);margin:0;list-style-type:none;border-color:var(--color-nav-hierarchy-collapse-borders);border-radius:var(--border-radius,4px);border-style:solid;box-shadow:0 1px 4px -1px var(--color-figure-gray-secondary);border-width:0;padding:0 .5rem;position:absolute;z-index:42;top:calc(100% + .41176rem)}.theme-dark .dropdown[data-v-a5015456]{background:var(--color-nav-dark-hierarchy-collapse-background);border-color:var(--color-nav-dark-hierarchy-collapse-borders)}.dropdown.collapsed[data-v-a5015456]{opacity:0;transform:translate3d(0,-.4117647059rem,0);transition:opacity .25s ease,transform .25s ease,visibility 0s linear .25s;visibility:hidden}.dropdown[data-v-a5015456]:not(.collapsed){opacity:1;transform:none;transition:opacity .25s ease,transform .25s ease,visibility 0s linear 0s;visibility:visible}.nav--in-breakpoint-range .dropdown[data-v-a5015456]:not(.collapsed){display:none}.dropdown[data-v-a5015456]:before{border-bottom-color:var(--color-nav-hierarchy-collapse-background);border-bottom-style:solid;border-bottom-width:.5rem;border-left-color:transparent;border-left-style:solid;border-left-width:.5rem;border-right-color:transparent;border-right-style:solid;border-right-width:.5rem;content:"";inset-inline-start:1.4411764706rem;position:absolute;top:-.4411764706rem}.theme-dark .dropdown[data-v-a5015456]:before{border-bottom-color:var(--color-nav-dark-hierarchy-collapse-background)}.dropdown-item[data-v-a5015456]{border-top-color:var(--color-nav-hierarchy-collapse-borders);border-top-style:solid;border-top-width:1px}.theme-dark .dropdown-item[data-v-a5015456]{border-top-color:var(--color-nav-dark-hierarchy-collapse-borders)}.dropdown-item[data-v-a5015456]:first-child{border-top:none}.nav-menu-link[data-v-a5015456]{max-width:57.6470588235rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;padding:.75rem 1rem}.hierarchy-item[data-v-288a0b84]{display:flex;align-items:center;margin-inline-start:0}.hierarchy-item[data-v-288a0b84]:not(:first-child):before{content:"/";width:.2941176471rem;margin-block:0;margin-inline:.2941176471rem}.nav--in-breakpoint-range .hierarchy-item[data-v-288a0b84]{border-top:1px solid var(--color-nav-hierarchy-item-borders);display:flex;align-items:center}.theme-dark.nav--in-breakpoint-range .hierarchy-item[data-v-288a0b84]{border-top-color:var(--color-nav-dark-hierarchy-item-borders)}.nav--in-breakpoint-range .hierarchy-item[data-v-288a0b84]:first-of-type{border-top:none}.hierarchy-item.collapsed[data-v-288a0b84]{display:none}:root.no-js .hierarchy-item.collapsed[data-v-288a0b84]{display:flex}.nav--in-breakpoint-range .hierarchy-item.collapsed[data-v-288a0b84]{display:inline-block}.item[data-v-288a0b84]{display:inline-block;vertical-align:middle}.nav--in-breakpoint-range .item[data-v-288a0b84]{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;height:100%;line-height:2.4705882353rem}@media only screen and (min-width:768px){.hierarchy-item:first-child:last-child .item[data-v-288a0b84],.hierarchy-item:first-child:last-child~.hierarchy-item .item[data-v-288a0b84]{max-width:45rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.has-badge .hierarchy-item:first-child:last-child .item[data-v-288a0b84],.has-badge .hierarchy-item:first-child:last-child~.hierarchy-item .item[data-v-288a0b84],.hierarchy-item:first-child:nth-last-child(2) .item[data-v-288a0b84],.hierarchy-item:first-child:nth-last-child(2)~.hierarchy-item .item[data-v-288a0b84]{max-width:36rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.has-badge .hierarchy-item:first-child:nth-last-child(2) .item[data-v-288a0b84],.has-badge .hierarchy-item:first-child:nth-last-child(2)~.hierarchy-item .item[data-v-288a0b84]{max-width:28.8rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hierarchy-item:first-child:nth-last-child(3) .item[data-v-288a0b84],.hierarchy-item:first-child:nth-last-child(3)~.hierarchy-item .item[data-v-288a0b84]{max-width:27rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.has-badge .hierarchy-item:first-child:nth-last-child(3) .item[data-v-288a0b84],.has-badge .hierarchy-item:first-child:nth-last-child(3)~.hierarchy-item .item[data-v-288a0b84]{max-width:21.6rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hierarchy-item:first-child:nth-last-child(4) .item[data-v-288a0b84],.hierarchy-item:first-child:nth-last-child(4)~.hierarchy-item .item[data-v-288a0b84]{max-width:18rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.has-badge .hierarchy-item:first-child:nth-last-child(4) .item[data-v-288a0b84],.has-badge .hierarchy-item:first-child:nth-last-child(4)~.hierarchy-item .item[data-v-288a0b84]{max-width:14.4rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hierarchy-item:first-child:nth-last-child(5) .item[data-v-288a0b84],.hierarchy-item:first-child:nth-last-child(5)~.hierarchy-item .item[data-v-288a0b84]{max-width:9rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.has-badge .hierarchy-item:first-child:nth-last-child(5) .item[data-v-288a0b84],.has-badge .hierarchy-item:first-child:nth-last-child(5)~.hierarchy-item .item[data-v-288a0b84]{max-width:7.2rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hierarchy-collapsed-items~.hierarchy-item .item[data-v-288a0b84]{max-width:10.8rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.hierarchy-collapsed-items~.hierarchy-item:last-child .item[data-v-288a0b84]{max-width:none}.has-badge .hierarchy-collapsed-items~.hierarchy-item .item[data-v-288a0b84]{max-width:8.64rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}.hierarchy[data-v-d54f3438]{font-size:.8235294118rem;line-height:1.4285714286;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);justify-content:flex-start;align-items:center;margin:0 0 1.1764705882rem 0;min-width:0}.nav--in-breakpoint-range .hierarchy[data-v-d54f3438]{margin:0}.hierarchy .root-hierarchy .item[data-v-d54f3438]{max-width:10rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}[data-v-d54f3438] a.nav-menu-link{color:inherit;text-decoration:underline}.declaration-list-menu[data-v-6dcef09a]{position:relative;width:100%}.declaration-list-menu .declaration-list-toggle[data-v-6dcef09a]{display:flex;flex-direction:row;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background-color:var(--color-other-decl-button);padding:5px 15px;color:var(--colors-link,var(--color-link));z-index:1;gap:5px;white-space:nowrap;align-items:center}.declaration-list-menu .icon[data-v-6dcef09a]{display:flex}.declaration-list-menu .icon svg[data-v-6dcef09a]{transition-duration:.4s;transition-timing-function:linear;transition-property:transform;width:15px;height:15px;fill:var(--colors-link,var(--color-link))}.declaration-list-menu .icon svg.expand[data-v-6dcef09a]{transform:rotate(45deg)}.doc-topic[data-v-6dcef09a]{display:flex;flex-direction:column;height:100%}.doc-topic.with-on-this-page[data-v-6dcef09a]{--doc-hero-right-offset:192px}#app-main[data-v-6dcef09a]{outline-style:none;height:100%}[data-v-6dcef09a] .minimized-title{margin-bottom:.833rem}[data-v-6dcef09a] .minimized-title .title{font-size:1.416rem;font-weight:700}[data-v-6dcef09a] .minimized-title small{font-size:1rem;padding-inline-start:.416rem}.minimized-abstract[data-v-6dcef09a]{font-size:1rem;line-height:1.4705882353;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.container[data-v-6dcef09a]:not(.minimized-container){outline-style:none}.full-width-container .container[data-v-6dcef09a]:not(.minimized-container){max-width:820px;margin-left:auto;margin-right:auto;padding-left:80px;padding-right:80px;box-sizing:border-box}@media print{.full-width-container .container[data-v-6dcef09a]:not(.minimized-container){padding-left:20px;padding-right:20px;max-width:none}}@media only screen and (min-width:1251px){.full-width-container .container[data-v-6dcef09a]:not(.minimized-container){max-width:980px}}@media only screen and (min-width:1500px){.full-width-container .container[data-v-6dcef09a]:not(.minimized-container){max-width:1080px}}@media only screen and (max-width:735px){.full-width-container .container[data-v-6dcef09a]:not(.minimized-container){width:auto;padding-left:20px;padding-right:20px}}.static-width-container .container[data-v-6dcef09a]:not(.minimized-container){margin-left:auto;margin-right:auto;width:1536px;width:980px}@media only screen and (max-width:1250px){.static-width-container .container[data-v-6dcef09a]:not(.minimized-container){width:692px}}@media only screen and (max-width:735px){.static-width-container .container[data-v-6dcef09a]:not(.minimized-container){width:87.5%}}@media only screen and (max-width:320px){.static-width-container .container[data-v-6dcef09a]:not(.minimized-container){width:215px}}[data-v-6dcef09a] .minimized-container{outline-style:none;--spacing-stacked-margin-large:0.667em;--spacing-stacked-margin-xlarge:1em;--declaration-code-listing-margin:1em 0 0 0;--declaration-conditional-constraints-margin:1em;--declaration-source-link-margin:0.833em;--code-block-style-elements-padding:7px 12px;--spacing-param:var(--spacing-stacked-margin-large);--aside-border-radius:6px;--code-border-radius:6px}[data-v-6dcef09a] .minimized-container:not(.declarations-container){padding-left:1.4rem;padding-right:1.4rem}[data-v-6dcef09a] .minimized-container .description{margin-bottom:1.5em}[data-v-6dcef09a] .minimized-container>.primary-content>*{margin-top:1.5em;margin-bottom:1.5em}[data-v-6dcef09a] .minimized-container .description{margin-top:0}[data-v-6dcef09a] .minimized-container h1,[data-v-6dcef09a] .minimized-container h2,[data-v-6dcef09a] .minimized-container h3,[data-v-6dcef09a] .minimized-container h4,[data-v-6dcef09a] .minimized-container h5,[data-v-6dcef09a] .minimized-container h6{font-size:1rem;font-weight:700}[data-v-6dcef09a] .minimized-container h2{font-size:1.083rem}[data-v-6dcef09a] .minimized-container h1{font-size:1.416rem}[data-v-6dcef09a] .minimized-container aside{padding:.667rem 1rem}[data-v-6dcef09a] .minimized-container .source{border-radius:var(--code-border-radius);margin:var(--declaration-code-listing-margin)}[data-v-6dcef09a] .minimized-container .single-line{border-radius:var(--code-border-radius)}.description[data-v-6dcef09a]{margin-bottom:2.353rem}.description[data-v-6dcef09a]:empty{display:none}.description.after-enhanced-hero[data-v-6dcef09a]{margin-top:2.353rem}.description[data-v-6dcef09a] .content+*{margin-top:var(--spacing-stacked-margin-large)}[data-v-6dcef09a] .no-primary-content{--content-table-title-border-width:0px}.sample-download[data-v-6dcef09a]{margin-top:20px}.declarations-container[data-v-6dcef09a]{margin-top:40px}.declarations-container.minimized-container[data-v-6dcef09a]{margin-top:0}[data-v-6dcef09a] h1{font-size:2.3529411765rem;line-height:1.1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){[data-v-6dcef09a] h1{font-size:1.8823529412rem;line-height:1.125;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){[data-v-6dcef09a] h1{font-size:1.6470588235rem;line-height:1.1428571429;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}[data-v-6dcef09a] h2{font-size:1.8823529412rem;line-height:1.125;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){[data-v-6dcef09a] h2{font-size:1.6470588235rem;line-height:1.1428571429;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){[data-v-6dcef09a] h2{font-size:1.4117647059rem;line-height:1.1666666667;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}[data-v-6dcef09a] h3{font-size:1.6470588235rem;line-height:1.1428571429;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){[data-v-6dcef09a] h3{font-size:1.4117647059rem;line-height:1.1666666667;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){[data-v-6dcef09a] h3{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}[data-v-6dcef09a] h4{font-size:1.4117647059rem;line-height:1.1666666667;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){[data-v-6dcef09a] h4{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}[data-v-6dcef09a] h5{font-size:1.2941176471rem;line-height:1.1818181818;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){[data-v-6dcef09a] h5{font-size:1.1764705882rem;line-height:1.2;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){[data-v-6dcef09a] h5{font-size:1.0588235294rem;line-height:1.4444444444;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}[data-v-6dcef09a] h6{font-size:1rem;line-height:1.4705882353;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.doc-content-wrapper[data-v-6dcef09a]{display:flex;justify-content:center}.doc-content-wrapper .doc-content[data-v-6dcef09a]{min-width:0;width:100%}.doc-content-wrapper .doc-content .container:only-child .declaration-list-menu[data-v-6dcef09a]:last-child:before{border-top-color:var(--colors-grid,var(--color-grid));border-top-style:solid;border-top-width:var(--content-table-title-border-width,1px);content:"";display:block;margin-bottom:40px}.with-on-this-page .doc-content-wrapper .doc-content[data-v-6dcef09a]{max-width:820px}@media only screen and (min-width:1251px){.with-on-this-page .doc-content-wrapper .doc-content[data-v-6dcef09a]{max-width:980px}}@media only screen and (min-width:1500px){.with-on-this-page .doc-content-wrapper .doc-content[data-v-6dcef09a]{max-width:1080px}}.quick-navigation-open[data-v-96c35eb8]{display:flex;align-items:center;justify-content:center;width:16px;border:1px solid var(--color-grid);height:100%;border-radius:var(--border-radius,4px);transition:background-color .15s;box-sizing:border-box}.quick-navigation-open[data-v-96c35eb8]:hover{background-color:var(--color-fill-tertiary)}@media only screen and (max-width:1023px){.quick-navigation-open[data-v-96c35eb8]{display:none}}.fromkeyboard .quick-navigation-open[data-v-96c35eb8]:focus{box-shadow:0 0 0 4px var(--color-focus-color);outline:none;border-color:var(--color-focus-border-color)}.tag[data-v-7e76f326]{display:inline-block;padding-right:.5882352941rem}.tag[data-v-7e76f326]:focus{outline:none}.tag button[data-v-7e76f326]{color:var(--color-figure-gray);background-color:var(--color-fill-tertiary);font-size:.8235294118rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);border-radius:.8235294118rem;padding:.2352941176rem .5882352941rem;white-space:nowrap;border:1px solid transparent}@media(hover:hover){.tag button[data-v-7e76f326]:hover{transition:background-color .2s,color .2s;background-color:var(--color-fill-blue);color:#fff}}.tag button[data-v-7e76f326]:focus:active{background-color:var(--color-fill-blue);color:#fff}.fromkeyboard .tag button[data-v-7e76f326]:focus,.tag button.focus[data-v-7e76f326],.tag button[data-v-7e76f326]:focus{box-shadow:0 0 0 4px var(--color-focus-color);outline:none;border-color:var(--color-focus-border-color)}.tags[data-v-1f2bd813]{position:relative;margin:0;list-style:none;box-sizing:border-box;transition:padding-right .8s,padding-bottom .8s,max-height 1s,opacity 1s;padding:0}.tags .scroll-wrapper[data-v-1f2bd813]{overflow-x:auto;overflow-y:hidden;-ms-overflow-style:none;scrollbar-color:var(--color-figure-gray-tertiary) transparent;scrollbar-width:thin}.tags .scroll-wrapper[data-v-1f2bd813]::-webkit-scrollbar{height:0}@supports not ((-webkit-touch-callout:none) or (scrollbar-width:none) or (-ms-overflow-style:none)){.tags .scroll-wrapper.scrolling[data-v-1f2bd813]{--scrollbar-height:11px;padding-top:var(--scrollbar-height);height:calc(var(--scroll-target-height) - var(--scrollbar-height));display:flex;align-items:center}}.tags .scroll-wrapper.scrolling[data-v-1f2bd813]::-webkit-scrollbar{height:11px}.tags .scroll-wrapper.scrolling[data-v-1f2bd813]::-webkit-scrollbar-thumb{border-radius:10px;background-color:var(--color-figure-gray-tertiary);border:2px solid transparent;background-clip:padding-box}.tags .scroll-wrapper.scrolling[data-v-1f2bd813]::-webkit-scrollbar-track-piece:end{margin-right:8px}.tags .scroll-wrapper.scrolling[data-v-1f2bd813]::-webkit-scrollbar-track-piece:start{margin-left:8px}.tags ul[data-v-1f2bd813]{margin:0;padding:0;display:flex}.filter[data-v-152b2512]{--input-vertical-padding:0.7647058824rem;--input-horizontal-spacing:0.5882352941rem;--input-height:1.6470588235rem;--input-border-color:var(--color-fill-gray-secondary);--input-text:var(--color-fill-gray-secondary);position:relative;box-sizing:border-box;-webkit-tap-highlight-color:rgba(0,0,0,0);border-radius:calc(var(--border-radius, 4px) + 1px)}.fromkeyboard .filter[data-v-152b2512]:focus{outline:none}.filter__top-wrapper[data-v-152b2512]{display:flex}.filter__filter-button[data-v-152b2512]{position:relative;z-index:1;cursor:text;margin-inline:var(--input-horizontal-spacing) .1764705882rem}@media only screen and (max-width:735px){.filter__filter-button[data-v-152b2512]{margin-inline-end:.4117647059rem}}.filter__filter-button .svg-icon[data-v-152b2512]{fill:var(--input-text);display:block;height:21px}.filter__filter-button.blue[data-v-152b2512]>*{fill:var(--color-figure-blue);color:var(--color-figure-blue)}.filter.focus .filter__wrapper[data-v-152b2512]{box-shadow:0 0 0 3pt var(--color-focus-color);--input-border-color:var(--color-fill-blue)}.filter__wrapper[data-v-152b2512]{border:1px solid var(--input-border-color);background:var(--color-fill);border-radius:var(--border-radius,4px)}.filter__wrapper--reversed[data-v-152b2512]{display:flex;flex-direction:column-reverse}.filter__wrapper--no-border-style[data-v-152b2512]{border:none}.filter__suggested-tags[data-v-152b2512]{border-top:1px solid var(--color-fill-gray-tertiary);z-index:1;overflow:hidden}.filter__suggested-tags[data-v-152b2512] ul{padding:var(--input-vertical-padding) .5294117647rem;border:1px solid transparent;border-bottom-left-radius:calc(var(--border-radius, 4px) - 1px);border-bottom-right-radius:calc(var(--border-radius, 4px) - 1px)}.fromkeyboard .filter__suggested-tags[data-v-152b2512] ul:focus{outline:none;box-shadow:0 0 0 5px var(--color-focus-color)}.filter__wrapper--reversed .filter__suggested-tags[data-v-152b2512]{border-bottom:1px solid var(--color-fill-gray-tertiary);border-top:none}.filter__selected-tags[data-v-152b2512]{z-index:1;padding-inline-start:4px;margin:-4px 0}@media only screen and (max-width:735px){.filter__selected-tags[data-v-152b2512]{padding-inline-start:0}}.filter__selected-tags[data-v-152b2512] ul{padding:4px}@media only screen and (max-width:735px){.filter__selected-tags[data-v-152b2512] ul{padding-inline-end:.4117647059rem}}.filter__selected-tags[data-v-152b2512] ul .tag:last-child{padding-inline-end:0}.filter__delete-button[data-v-152b2512]{position:relative;margin:0;z-index:1;border-radius:100%}.fromkeyboard .filter__delete-button[data-v-152b2512]:focus{box-shadow:0 0 0 4px var(--color-focus-color);outline:none}.filter__delete-button .clear-rounded-icon[data-v-152b2512]{height:.7058823529rem;width:.7058823529rem;fill:var(--input-text);display:block}.filter__delete-button-wrapper[data-v-152b2512]{display:flex;align-items:center;padding-inline:.1764705882rem var(--input-horizontal-spacing);border-top-right-radius:var(--border-radius,4px);border-bottom-right-radius:var(--border-radius,4px)}.filter__input-label[data-v-152b2512]{position:relative;flex-grow:1;height:var(--input-height);padding:var(--input-vertical-padding) 0}.filter__input-label[data-v-152b2512]:after{content:attr(data-value);visibility:hidden;width:auto;white-space:nowrap;min-width:130px;display:block;text-indent:.4117647059rem}@media only screen and (max-width:735px){.filter__input-label[data-v-152b2512]:after{text-indent:.1764705882rem}}.filter__input-box-wrapper[data-v-152b2512]{overflow-y:hidden;-ms-overflow-style:none;scrollbar-color:var(--color-figure-gray-tertiary) transparent;scrollbar-width:thin;display:flex;overflow-x:auto;align-items:center;cursor:text;flex:1}.filter__input-box-wrapper[data-v-152b2512]::-webkit-scrollbar{height:0}@supports not ((-webkit-touch-callout:none) or (scrollbar-width:none) or (-ms-overflow-style:none)){.filter__input-box-wrapper.scrolling[data-v-152b2512]{--scrollbar-height:11px;padding-top:var(--scrollbar-height);height:calc(var(--scroll-target-height) - var(--scrollbar-height));display:flex;align-items:center}}.filter__input-box-wrapper.scrolling[data-v-152b2512]::-webkit-scrollbar{height:11px}.filter__input-box-wrapper.scrolling[data-v-152b2512]::-webkit-scrollbar-thumb{border-radius:10px;background-color:var(--color-figure-gray-tertiary);border:2px solid transparent;background-clip:padding-box}.filter__input-box-wrapper.scrolling[data-v-152b2512]::-webkit-scrollbar-track-piece:end{margin-right:8px}.filter__input-box-wrapper.scrolling[data-v-152b2512]::-webkit-scrollbar-track-piece:start{margin-left:8px}.filter__input[data-v-152b2512]{font-size:1.2352941176rem;line-height:1.380952381;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-text);height:var(--input-height);border:none;width:100%;position:absolute;background:transparent;z-index:1;text-indent:.4117647059rem}@media only screen and (max-width:735px){.filter__input[data-v-152b2512]{font-size:1.1176470588rem;line-height:1.4210526316;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);text-indent:.1764705882rem}}.filter__input[data-v-152b2512]:focus{outline:none}.filter__input[placeholder][data-v-152b2512]::-moz-placeholder{color:var(--input-text);opacity:1}.filter__input[placeholder][data-v-152b2512]::placeholder{color:var(--input-text);opacity:1}.filter__input[placeholder][data-v-152b2512]:-ms-input-placeholder{color:var(--input-text)}.filter__input[placeholder][data-v-152b2512]::-ms-input-placeholder{color:var(--input-text)}.generic-modal[data-v-795f7b59]{position:fixed;top:0;left:0;right:0;bottom:0;margin:0;z-index:11000;display:flex;align-items:center;justify-content:center;flex-wrap:wrap;background:none;overflow:auto}.modal-fullscreen[data-v-795f7b59]{align-items:stretch}.modal-fullscreen .container[data-v-795f7b59]{margin:0;flex:1;width:100%;height:100%;padding-top:env(safe-area-inset-top);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom);padding-left:env(safe-area-inset-left)}.modal-standard[data-v-795f7b59]{padding:20px}.modal-standard .container[data-v-795f7b59]{padding:60px;border-radius:var(--border-radius,4px)}@media screen{[data-color-scheme=dark] .modal-standard .container[data-v-795f7b59]{background:#1d1d1f}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .modal-standard .container[data-v-795f7b59]{background:#1d1d1f}}@media only screen and (max-width:735px){.modal-standard[data-v-795f7b59]{padding:0;align-items:stretch}.modal-standard .container[data-v-795f7b59]{margin:20px 0 0;padding:50px 30px;flex:1;width:100%;border-bottom-left-radius:0;border-bottom-right-radius:0}}.backdrop[data-v-795f7b59]{overflow:auto;background:var(--backdrop-background,rgba(0,0,0,.4));-webkit-overflow-scrolling:touch;width:100%;height:100%;position:fixed}.container[data-v-795f7b59]{margin-left:auto;margin-right:auto;width:1536px;width:980px;background:var(--colors-generic-modal-background,var(--color-generic-modal-background));z-index:1;position:relative;overflow:auto;max-width:100%}@media only screen and (max-width:1250px){.container[data-v-795f7b59]{width:692px}}@media only screen and (max-width:735px){.container[data-v-795f7b59]{width:87.5%}}@media only screen and (max-width:320px){.container[data-v-795f7b59]{width:215px}}.close[data-v-795f7b59]{position:absolute;z-index:9999;top:22px;left:22px;width:17px;height:17px;color:#666;cursor:pointer;background:none;border:0;display:flex;align-items:center}.close .close-icon[data-v-795f7b59]{fill:currentColor;width:100%;height:100%}.theme-dark .container[data-v-795f7b59]{background:#000}.theme-dark .container .close[data-v-795f7b59]{color:#b0b0b0}.theme-code .container[data-v-795f7b59]{background-color:var(--code-background,var(--color-code-background))}.highlight[data-v-4a2ce75d]{display:inline}.highlight[data-v-4a2ce75d] .match{font-weight:600;background:var(--color-fill-light-blue-secondary)}@media only screen and (max-width:735px){.preview[data-v-779b8b01]{display:none}}.unavailable[data-v-779b8b01]{align-items:center;display:flex;height:100%;justify-content:center}.loading[data-v-779b8b01]{padding:20px}.loading-row[data-v-779b8b01]{animation:pulse 2.5s ease;animation-delay:calc(1s + .3s*var(--index));animation-fill-mode:forwards;animation-iteration-count:infinite;background-color:var(--color-fill-gray-tertiary);border-radius:4px;height:12px;margin:20px 0;opacity:0}.loading-row[data-v-779b8b01]:first-of-type{margin-top:0}.loading-row[data-v-779b8b01]:last-of-type{margin-bottom:0}.quick-navigation[data-v-0081cd10]{--input-border-color:var(--color-grid)}.quick-navigation input[type=text][data-v-0081cd10]{font-size:1.2352941176rem;line-height:1.380952381;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:735px){.quick-navigation input[type=text][data-v-0081cd10]{font-size:1.1176470588rem;line-height:1.4210526316;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.quick-navigation__filter[data-v-0081cd10]{--input-horizontal-spacing:0.8823529412rem}.quick-navigation[data-v-0081cd10] .filter__wrapper{background-color:var(--color-fill-secondary)}.quick-navigation__container[data-v-0081cd10]{background-color:var(--color-fill-secondary);border:solid 1px var(--input-border-color);border-radius:var(--border-radius,4px);margin:0 .9411764706rem}.quick-navigation__container>[data-v-0081cd10]{--input-text:var(--color-figure-gray-secondary)}.quick-navigation__container.focus[data-v-0081cd10]{box-shadow:0 0 0 4px var(--color-focus-color);outline:none;border-color:var(--color-focus-border-color)}.quick-navigation__container[data-v-0081cd10] .declaration-list-toggle{background-color:var(--color-fill-secondary)}.quick-navigation__magnifier-icon-container[data-v-0081cd10]{width:1rem}.quick-navigation__magnifier-icon-container>[data-v-0081cd10]{width:100%}.quick-navigation__magnifier-icon-container.blue .magnifier-icon[data-v-0081cd10]{fill:var(--color-figure-blue);color:var(--color-figure-blue)}.quick-navigation__match-list[data-v-0081cd10]{display:flex;max-height:26.4705882353rem;height:0}.quick-navigation__match-list>[data-v-0081cd10]{min-width:0}.quick-navigation__match-list.active[data-v-0081cd10]{height:auto;border-top:1px solid var(--input-border-color)}.quick-navigation__match-list .no-results[data-v-0081cd10]{margin:.8823529412rem auto;width:-moz-fit-content;width:fit-content}.quick-navigation__refs[data-v-0081cd10]{flex:1;overflow:auto}.quick-navigation__preview[data-v-0081cd10]{border-inline-start:1px solid var(--color-grid);flex:0 0 61.8%;overflow:auto;position:sticky;top:0}.quick-navigation__reference[data-v-0081cd10]{display:block;padding:.5882352941rem .8823529412rem}.quick-navigation__reference[data-v-0081cd10]:hover{text-decoration:none;background-color:var(--color-navigator-item-hover)}.quick-navigation__reference[data-v-0081cd10]:focus{margin:0 .2941176471rem;padding:.5882352941rem .5882352941rem;background-color:var(--color-navigator-item-hover)}.quick-navigation__symbol-match[data-v-0081cd10]{display:flex;height:2.3529411765rem;color:var(--color-figure-gray)}.quick-navigation__symbol-match .symbol-info[data-v-0081cd10]{margin:auto;width:100%}.quick-navigation__symbol-match .symbol-info .navigator-icon[data-v-0081cd10]{margin-inline-end:.5882352941rem}.quick-navigation__symbol-match .symbol-info .symbol-name[data-v-0081cd10]{display:flex}.quick-navigation__symbol-match .symbol-info .symbol-name .symbol-title[data-v-0081cd10]{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.quick-navigation__symbol-match .symbol-info .symbol-path[data-v-0081cd10]{font-size:.8235294118rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-figure-gray-secondary);display:flex;margin-inline-start:1.5882352941rem;overflow:hidden;white-space:nowrap}.quick-navigation__symbol-match .symbol-info .symbol-path .parent-path[data-v-0081cd10]{padding-inline-end:.2941176471rem}@media print{.sidebar[data-v-55e81445]{display:none}}.adjustable-sidebar-width[data-v-55e81445]{display:flex}@media only screen and (max-width:1023px){.adjustable-sidebar-width[data-v-55e81445]{display:block;position:relative}}.adjustable-sidebar-width.dragging[data-v-55e81445] *{cursor:col-resize!important}.adjustable-sidebar-width.sidebar-hidden.dragging[data-v-55e81445] *{cursor:e-resize!important}.sidebar[data-v-55e81445]{position:relative}@media only screen and (max-width:1023px){.sidebar[data-v-55e81445]{position:static}}.aside[data-v-55e81445]{width:250px;position:relative;height:100%;max-width:100vw}.aside.no-transition[data-v-55e81445]{transition:none!important}@media only screen and (min-width:1024px){.aside[data-v-55e81445]{transition:width .3s ease-in,visibility 0s linear var(--visibility-transition-time,0s)}.aside.dragging[data-v-55e81445]:not(.is-opening-on-large):not(.hide-on-large){transition:none}.aside.hide-on-large[data-v-55e81445]{width:0!important;visibility:hidden;pointer-events:none;--visibility-transition-time:0.3s}}@media only screen and (max-width:1023px){.aside[data-v-55e81445]{width:100%!important;overflow:hidden;min-width:0;max-width:100%;height:calc(var(--app-height) - var(--top-offset-mobile));position:fixed;top:var(--top-offset-mobile);bottom:0;inset-inline-start:0;z-index:9998;transform:translateX(-100%);transition:transform var(--nav-transition-duration) ease-in}.aside[data-v-55e81445] .aside-animated-child{opacity:0}.aside.show-on-mobile[data-v-55e81445]{transform:translateX(0)}.aside.show-on-mobile[data-v-55e81445] .aside-animated-child{--index:0;opacity:1;transition:opacity var(--nav-transition-duration) linear;transition-delay:calc(var(--index)*var(--nav-transition-duration) + var(--nav-transition-duration))}.aside.has-mobile-top-offset[data-v-55e81445]{border-top:1px solid var(--color-fill-gray-tertiary)}}.content[data-v-55e81445]{display:flex;flex-flow:column;min-width:0;flex:1 1 auto;height:100%}.resize-handle[data-v-55e81445]{position:absolute;cursor:col-resize;top:0;bottom:0;inset-inline-end:0;width:5px;height:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1;transition:background-color .15s;transform:translateX(50%)}@media only screen and (max-width:1023px){.resize-handle[data-v-55e81445]{display:none}}.resize-handle[data-v-55e81445]:hover{background:var(--color-fill-gray-tertiary)}.navigator-card-item[data-v-21117456]{--nav-head-wrapper-left-space:20px;--nav-head-wrapper-right-space:20px;--head-wrapper-vertical-space:5px;--nav-depth-spacer:20px;--nesting-index:0;display:flex;align-items:stretch;min-height:32px;box-sizing:border-box;padding-block:0;padding-inline-start:var(--nav-head-wrapper-left-space);padding-inline-end:var(--nav-head-wrapper-right-space)}.navigator-card-item.active .head-wrapper[data-v-21117456]{background:var(--color-fill-gray-quaternary)}.hover .navigator-card-item:not(.is-group) .head-wrapper[data-v-21117456]{background:var(--color-navigator-item-hover)}.depth-spacer[data-v-21117456]{width:calc(var(--nesting-index)*15px + var(--nav-depth-spacer));height:100%;position:relative;flex:0 0 auto}.title-container[data-v-21117456]{width:100%;min-width:0;display:flex;align-items:center}.navigator-icon-wrapper[data-v-21117456]{margin-inline-end:7px}.head-wrapper[data-v-21117456]{position:relative;display:flex;align-items:center;flex:1;min-width:0;border-radius:var(--border-radius,4px);padding:var(--head-wrapper-vertical-space) 0}.fromkeyboard .head-wrapper[data-v-21117456]:focus-within{outline:4px solid var(--color-focus-color);outline-offset:-4px}@supports(padding:max(0px)){.head-wrapper[data-v-21117456]{padding-right:max(var(--nav-head-wrapper-right-space),env(safe-area-inset-right))}html[dir=rtl] .navigator-card-item .head-wrapper{padding-inline-end:max(var(--nav-head-wrapper-left-space),env(safe-area-inset-right));padding-inline-start:0}}.highlight[data-v-7b81ca08]{display:inline}.highlight[data-v-7b81ca08] .match{font-weight:600;background:var(--color-fill-light-blue-secondary)}.is-group .leaf-link[data-v-aae93440]{color:var(--color-figure-gray-tertiary);font-weight:600}.is-group .leaf-link[data-v-aae93440]:after{display:none}.navigator-icon[data-v-aae93440]{display:flex;flex:0 0 auto}.navigator-icon.changed[data-v-aae93440]{border:none;width:1em;height:1em;z-index:0}.navigator-icon.changed[data-v-aae93440]:after{top:50%;left:50%;right:auto;bottom:auto;transform:translate(-50%,-50%);background-image:url(../img/modified-icon.efb2697d.svg);margin:0}@media screen{[data-color-scheme=dark] .navigator-icon.changed[data-v-aae93440]:after{background-image:url(../img/modified-icon.efb2697d.svg)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .navigator-icon.changed[data-v-aae93440]:after{background-image:url(../img/modified-icon.efb2697d.svg)}}.navigator-icon.changed-added[data-v-aae93440]:after{background-image:url(../img/added-icon.832a5d2c.svg)}@media screen{[data-color-scheme=dark] .navigator-icon.changed-added[data-v-aae93440]:after{background-image:url(../img/added-icon.832a5d2c.svg)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .navigator-icon.changed-added[data-v-aae93440]:after{background-image:url(../img/added-icon.832a5d2c.svg)}}.navigator-icon.changed-deprecated[data-v-aae93440]:after{background-image:url(../img/deprecated-icon.7bf1740a.svg)}@media screen{[data-color-scheme=dark] .navigator-icon.changed-deprecated[data-v-aae93440]:after{background-image:url(../img/deprecated-icon.7bf1740a.svg)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .navigator-icon.changed-deprecated[data-v-aae93440]:after{background-image:url(../img/deprecated-icon.7bf1740a.svg)}}.leaf-link[data-v-aae93440]{color:var(--color-figure-gray);text-overflow:ellipsis;overflow:hidden;white-space:nowrap;max-width:100%;display:inline;vertical-align:middle;font-size:1rem;line-height:1.4705882353;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.fromkeyboard .leaf-link[data-v-aae93440]:focus{outline:none}.leaf-link[data-v-aae93440]:hover{text-decoration:none}.leaf-link.bolded[data-v-aae93440]{font-weight:600}.leaf-link[data-v-aae93440]:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0}.extended-content[data-v-aae93440]{font-size:.8235294118rem;line-height:1.4285714286;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-figure-gray-secondary);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tree-toggle[data-v-aae93440]{overflow:hidden;position:absolute;width:100%;height:100%;padding-inline-end:5px;box-sizing:border-box;z-index:1;display:flex;align-items:center;justify-content:flex-end}.chevron[data-v-aae93440]{width:10px}.chevron.animating[data-v-aae93440]{transition:transform .15s ease-in}.chevron.rotate[data-v-aae93440]{transform:rotate(90deg)}.navigator-card[data-v-5b6607c4]{--card-vertical-spacing:10px;--card-horizontal-spacing:20px;--nav-filter-horizontal-padding:20px;--visibility-delay:1s;display:flex;flex-direction:column;min-height:0;height:calc(var(--app-height) - 3.05882rem);position:sticky;top:3.0588235294rem}@media only screen and (max-width:1023px){.navigator-card[data-v-5b6607c4]{height:100%;position:static;background:var(--color-fill)}}.navigator-card .navigator-card-full-height[data-v-5b6607c4]{min-height:0;flex:1 1 auto}.navigator-card .head-inner[data-v-5b6607c4]{display:none;width:100%;font-size:1.2352941176rem;line-height:1.1904761905;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);height:2.8235294118rem}@media only screen and (max-width:767px){.navigator-card .head-inner[data-v-5b6607c4]{font-size:1rem;line-height:1;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:1023px){.navigator-card .head-inner[data-v-5b6607c4]{display:flex;justify-content:flex-end;align-items:center}}.navigator-card .head-inner span[data-v-5b6607c4],.navigator-card .head-inner>a[data-v-5b6607c4]{color:var(--color-figure-gray);width:100%}.navigator-card .head-wrapper[data-v-5b6607c4]{display:flex;justify-content:space-between;flex:1 0 auto}@supports(padding:max(0px)){.navigator-card .head-wrapper[data-v-5b6607c4]{margin-left:max(var(--card-horizontal-spacing),env(safe-area-inset-left));margin-right:max(var(--card-horizontal-spacing),env(safe-area-inset-right))}}.close-card[data-v-5b6607c4]{margin:0}.close-card .close-icon[data-v-5b6607c4]{width:19px;height:19px}[data-v-5b6607c4] .card-body{display:flex;flex-direction:column;padding-inline-end:0;flex:1 1 auto;min-height:0;height:100%}@media only screen and (max-width:1023px){[data-v-5b6607c4] .card-body{--card-vertical-spacing:0px}}.navigator-card-inner[data-v-5b6607c4]{display:flex;flex-flow:column;height:100%;padding-top:10px;box-sizing:border-box}@media only screen and (max-width:1023px){.navigator-card-inner[data-v-5b6607c4]{padding-top:0}}.filter-on-top .navigator-card-inner[data-v-5b6607c4]{padding-top:0}.vue-recycle-scroller{position:relative}.vue-recycle-scroller.direction-vertical:not(.page-mode){overflow-y:auto}.vue-recycle-scroller.direction-horizontal:not(.page-mode){overflow-x:auto}.vue-recycle-scroller.direction-horizontal{display:-webkit-box;display:-ms-flexbox;display:flex}.vue-recycle-scroller__slot{-webkit-box-flex:1;-ms-flex:auto 0 0px;flex:auto 0 0}.vue-recycle-scroller__item-wrapper{-webkit-box-flex:1;-ms-flex:1;flex:1;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;position:relative}.vue-recycle-scroller.ready .vue-recycle-scroller__item-view{position:absolute;top:0;left:0;will-change:transform}.vue-recycle-scroller.direction-vertical .vue-recycle-scroller__item-wrapper{width:100%}.vue-recycle-scroller.direction-horizontal .vue-recycle-scroller__item-wrapper{height:100%}.vue-recycle-scroller.ready.direction-vertical .vue-recycle-scroller__item-view{width:100%}.vue-recycle-scroller.ready.direction-horizontal .vue-recycle-scroller__item-view{height:100%}.resize-observer[data-v-b329ee4c]{border:none;background-color:transparent;opacity:0}.resize-observer[data-v-b329ee4c],.resize-observer[data-v-b329ee4c] object{position:absolute;top:0;left:0;z-index:-1;width:100%;height:100%;pointer-events:none;display:block;overflow:hidden}.navigator-card.filter-on-top .filter-wrapper[data-v-abcea74e]{order:1;position:static}.navigator-card.filter-on-top .card-body[data-v-abcea74e]{order:2}.no-items-wrapper[data-v-abcea74e]{overflow:hidden;color:var(--color-figure-gray-tertiary)}.no-items-wrapper .no-items[data-v-abcea74e]:not(:empty){font-size:.8235294118rem;line-height:1.4285714286;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);padding:var(--card-vertical-spacing) var(--card-horizontal-spacing);min-width:200px;box-sizing:border-box}.technology-title[data-v-abcea74e]{padding:8px 10px;padding-inline-start:20px;background:var(--color-fill);border-radius:var(--border-radius,4px);display:flex;white-space:nowrap}@supports(padding:max(0px)){.technology-title[data-v-abcea74e]{margin-left:max(var(--card-horizontal-spacing),env(safe-area-inset-left));margin-right:max(var(--card-horizontal-spacing),env(safe-area-inset-right))}}@media only screen and (max-width:767px){.technology-title[data-v-abcea74e]{margin-top:0}}.technology-title .card-link[data-v-abcea74e]{color:var(--color-text);font-size:1.1176470588rem;line-height:1.2105263158;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);font-weight:600;overflow:hidden;text-overflow:ellipsis}.technology-title.router-link-exact-active[data-v-abcea74e]{background:var(--color-fill-gray-quaternary)}.technology-title[data-v-abcea74e]:hover{background:var(--color-navigator-item-hover);text-decoration:none}.navigator-filter[data-v-abcea74e]{box-sizing:border-box;padding:15px var(--nav-filter-horizontal-padding);border-top:1px solid var(--color-grid);height:71px;display:flex;align-items:flex-end}.filter-on-top .navigator-filter[data-v-abcea74e]{border-top:none;align-items:flex-start}@supports(padding:max(0px)){.navigator-filter[data-v-abcea74e]{padding-left:max(var(--nav-filter-horizontal-padding),env(safe-area-inset-left));padding-right:max(var(--nav-filter-horizontal-padding),env(safe-area-inset-right))}}@media only screen and (max-width:1023px){.navigator-filter[data-v-abcea74e]{--nav-filter-horizontal-padding:20px;border:none;padding-top:10px;padding-bottom:10px;height:60px}}.navigator-filter .input-wrapper[data-v-abcea74e]{position:relative;flex:1;min-width:0}.navigator-filter .filter-component[data-v-abcea74e]{--input-vertical-padding:8px;--input-height:22px;--input-border-color:var(--color-grid);--input-text:var(--color-figure-gray-secondary)}.navigator-filter .filter-component[data-v-abcea74e] .filter__input{font-size:1rem;line-height:1.4705882353;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.navigator-filter .filter-component[data-v-abcea74e] .filter__input-label:after{min-width:70px}.scroller[data-v-abcea74e]{height:100%;box-sizing:border-box;padding-bottom:calc(var(--top-offset, 0px) + var(--card-vertical-spacing));transition:padding-bottom .15s ease-in}@media only screen and (max-width:1023px){.scroller[data-v-abcea74e]{padding-bottom:10em}}.scroller[data-v-abcea74e] .vue-recycle-scroller__item-wrapper{transform:translateZ(0)}.filter-wrapper[data-v-abcea74e]{position:sticky;bottom:0;background:var(--color-fill)}.sidebar-transitioning .filter-wrapper[data-v-abcea74e]{flex:1 0 71px;overflow:hidden}@media only screen and (max-width:1023px){.sidebar-transitioning .filter-wrapper[data-v-abcea74e]{flex-basis:60px}}.loader[data-v-0de29914]{height:.7058823529rem;background-color:var(--color-fill-gray-tertiary);border-radius:4px}.navigator-icon[data-v-0de29914]{width:16px;height:16px;border-radius:2px;background-color:var(--color-fill-gray-tertiary)}.loading-navigator-item[data-v-0de29914]{animation:pulse 2.5s ease;animation-iteration-count:infinite;animation-fill-mode:forwards;opacity:0;animation-delay:calc(var(--visibility-delay) + .3s*var(--index))}.delay-visibility-enter-active[data-v-3b7cf3a4]{transition:visibility var(--visibility-delay);visibility:hidden}.loading-navigator[data-v-3b7cf3a4]{padding-top:10px}.navigator[data-v-5611024b]{height:100%;display:flex;flex-flow:column}@media only screen and (max-width:1023px){.navigator[data-v-5611024b]{position:static;transition:none}}[data-v-5611024b] .nav-title{font-size:inherit;font-weight:inherit;flex-grow:1}.sidenav-icon[data-v-11f8cb90]{transform:scaleX(var(--scale-inline,1))}.nav-menu-setting-label[data-v-68a9881c]{display:inline-block;margin-inline-end:.2941176471rem;white-space:nowrap}.language-container[data-v-68a9881c]{flex:1 0 auto}.language-dropdown[data-v-68a9881c]{-webkit-text-size-adjust:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background-color:transparent;box-sizing:inherit;padding-inline:4px 11px;margin-inline-start:-4px;font-size:.8235294118rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);cursor:pointer;position:relative;z-index:1}@media only screen and (max-width:1023px){.language-dropdown[data-v-68a9881c]{font-size:.8235294118rem;line-height:1.5;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.language-dropdown[data-v-68a9881c]:focus{outline:none}.fromkeyboard .language-dropdown[data-v-68a9881c]:focus{outline:4px solid var(--color-focus-color);outline-offset:1px}.language-sizer[data-v-68a9881c]{position:absolute;opacity:0;pointer-events:none;padding:0}.language-toggle-container[data-v-68a9881c]{display:flex;align-items:center;padding-inline-end:.1764705882rem;position:relative}.nav--in-breakpoint-range .language-toggle-container[data-v-68a9881c]{display:none}.language-toggle-container .toggle-icon[data-v-68a9881c]{width:.6em;height:.6em;position:absolute;inset-inline-end:7px}.language-toggle-label[data-v-68a9881c]{margin-inline-end:2px}.language-toggle.nav-menu-toggle-label[data-v-68a9881c]{margin-inline-end:6px}.language-list[data-v-68a9881c]{display:inline-block;margin-top:0}.language-list-container[data-v-68a9881c]{display:none}.language-list-item[data-v-68a9881c],.nav--in-breakpoint-range .language-list-container[data-v-68a9881c]{display:inline-block}.language-list-item[data-v-68a9881c]:not(:first-child){border-inline-start:1px solid var(--color-grid);margin-inline-start:6px;padding-inline-start:6px}[data-v-0799dea4] .nav-menu{line-height:1.5}[data-v-0799dea4] .nav-menu,[data-v-0799dea4] .nav-menu-settings{font-size:.8235294118rem;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}[data-v-0799dea4] .nav-menu-settings{min-width:0;gap:.5882352941rem;line-height:1.2857142857}@media only screen and (max-width:1023px){[data-v-0799dea4] .nav-menu-settings{font-size:.8235294118rem;line-height:1.5;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (min-width:1024px){[data-v-0799dea4] .nav-menu-settings{margin-inline-start:.5882352941rem}}[data-v-0799dea4] .nav-menu-settings .nav-menu-setting{display:flex;align-items:center;color:var(--color-nav-current-link);margin-inline-start:0;min-width:0}[data-v-0799dea4] .nav-menu-settings .nav-menu-setting .nav-menu-link{font-weight:600;text-decoration:underline}.theme-dark[data-v-0799dea4] .nav-menu-settings .nav-menu-setting{color:var(--color-nav-dark-current-link)}.nav--in-breakpoint-range[data-v-0799dea4] .nav-menu-settings .nav-menu-setting:not(:first-child){border-top:1px solid var(--color-fill-gray-tertiary)}.documentation-nav[data-v-0799dea4]{--color-nav-background:var(--color-fill)}.documentation-nav[data-v-0799dea4] .nav-title{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:767px){.documentation-nav[data-v-0799dea4] .nav-title{font-size:1rem;line-height:1;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.sidenav-toggle-wrapper[data-v-0799dea4]{display:flex;margin-top:1px;margin-inline-end:.6470588235rem}.nav--in-breakpoint-range .sidenav-toggle-wrapper[data-v-0799dea4]{display:flex!important}@media only screen and (min-width:1024px){.sidenav-toggle-enter-active[data-v-0799dea4],.sidenav-toggle-leave-active[data-v-0799dea4]{transition:margin .3s ease-in 0s}.sidenav-toggle-enter[data-v-0799dea4],.sidenav-toggle-leave-to[data-v-0799dea4]{margin-inline-start:-3.7647058824rem}}.sidenav-toggle[data-v-0799dea4]{align-self:center;color:var(--color-nav-link-color);position:relative;margin:0 -5px;border-radius:var(--border-radius,4px)}.theme-dark .sidenav-toggle[data-v-0799dea4]{color:var(--color-nav-dark-link-color)}.sidenav-toggle:hover .sidenav-icon-wrapper[data-v-0799dea4]{background:var(--color-fill-gray-quaternary)}.theme-dark .sidenav-toggle:hover .sidenav-icon-wrapper[data-v-0799dea4]{background:#424242}.sidenav-toggle__separator[data-v-0799dea4]{height:.8em;width:1px;background:var(--color-nav-color);align-self:center;margin:0 1.2941176471rem}.nav--in-breakpoint-range .sidenav-toggle__separator[data-v-0799dea4]{display:none}.sidenav-icon-wrapper[data-v-0799dea4]{padding:5px;display:flex;align-items:center;justify-content:center;border-radius:var(--border-radius,4px)}.sidenav-icon[data-v-0799dea4]{display:flex;width:19px;height:19px}[data-v-376a4b96] .generic-modal{overflow-y:overlay}[data-v-376a4b96] .modal-fullscreen>.container{background-color:transparent;height:-moz-fit-content;height:fit-content;flex:auto;margin:9.4117647059rem 0;max-width:47.0588235294rem;overflow:visible}[data-v-376a4b96] .navigator-filter .quick-navigation-open{margin-inline-start:var(--nav-filter-horizontal-padding);width:calc(var(--nav-filter-horizontal-padding)*2)}.documentation-layout[data-v-376a4b96]{--nav-transition-duration:0.15s;display:flex;flex-flow:column;background:var(--colors-text-background,var(--color-text-background))}.documentation-layout .delay-hiding-leave-active[data-v-376a4b96]{transition:display var(--nav-transition-duration)}.documentation-layout-aside[data-v-376a4b96]{height:100%;box-sizing:border-box;border-inline-end:1px solid var(--color-grid)}@media only screen and (max-width:1023px){.documentation-layout-aside[data-v-376a4b96]{background:var(--color-fill);border-inline-end:none}.sidebar-transitioning .documentation-layout-aside[data-v-376a4b96]{border-inline-end:1px solid var(--color-grid)}}.topic-wrapper[data-v-376a4b96]{flex:1 1 auto;width:100%}:root.no-js .topic-wrapper[data-v-376a4b96] .sidebar{display:none}.full-width-container[data-v-376a4b96]{max-width:1920px;margin-left:auto;margin-right:auto}@media only screen and (min-width:1920px){.full-width-container[data-v-376a4b96]{border-inline:1px solid var(--color-grid);box-sizing:border-box}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/css/index.63be42cf.css b/Containers/Supporting Files/Help.bundle/css/index.63be42cf.css new file mode 100644 index 0000000..07b726a --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/css/index.63be42cf.css @@ -0,0 +1,9 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */.color-scheme-toggle[data-v-0c0360ce]{--toggle-color-fill:var(--color-button-background);--toggle-color-text:var(--color-fill-blue);font-size:.7058823529rem;line-height:1.3333333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);border:1px solid var(--toggle-color-fill);border-radius:var(--toggle-border-radius-outer,var(--border-radius,4px));display:inline-flex;padding:1px}@media screen{[data-color-scheme=dark] .color-scheme-toggle[data-v-0c0360ce]{--toggle-color-text:var(--color-figure-blue)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .color-scheme-toggle[data-v-0c0360ce]{--toggle-color-text:var(--color-figure-blue)}}@media print{.color-scheme-toggle[data-v-0c0360ce]{display:none}}:root.no-js .color-scheme-toggle[data-v-0c0360ce]{visibility:hidden}input[data-v-0c0360ce]{position:absolute;clip:rect(1px,1px,1px,1px);clip-path:inset(0 0 99.9% 99.9%);overflow:hidden;height:1px;width:1px;padding:0;border:0;-webkit-appearance:none;-moz-appearance:none;appearance:none}.fromkeyboard label[data-v-0c0360ce]:focus-within{outline:4px solid var(--color-focus-color);outline-offset:1px}.text[data-v-0c0360ce]{border:1px solid transparent;border-radius:var(--toggle-border-radius-inner,2px);color:var(--toggle-color-text);display:inline-block;text-align:center;padding:1px 6px;min-width:42px;box-sizing:border-box}.text[data-v-0c0360ce]:hover{cursor:pointer}input:checked+.text[data-v-0c0360ce]{--toggle-color-text:var(--color-button-text);background:var(--toggle-color-fill);border-color:var(--toggle-color-fill)}.footer[data-v-f1d65b2a]{border-top:1px solid var(--color-grid)}.row[data-v-f1d65b2a]{margin-left:auto;margin-right:auto;width:1536px;width:980px;display:flex;flex-direction:row-reverse;margin:20px auto}@media only screen and (max-width:1250px){.row[data-v-f1d65b2a]{width:692px}}@media only screen and (max-width:735px){.row[data-v-f1d65b2a]{width:87.5%}}@media only screen and (max-width:320px){.row[data-v-f1d65b2a]{width:215px}}@media only screen and (max-width:735px){.row[data-v-f1d65b2a]{width:100%;padding:0 .9411764706rem;box-sizing:border-box}}.InitialLoadingPlaceholder[data-v-35c356b6]{background:var(--colors-loading-placeholder-background,var(--color-loading-placeholder-background));height:100vh;width:100%}.svg-icon[data-v-06e5463e]{fill:var(--colors-svg-icon-fill-light,var(--color-svg-icon));transform:scale(1);-webkit-transform:scale(1);overflow:visible}.theme-dark .svg-icon[data-v-06e5463e]{fill:var(--colors-svg-icon-fill-dark,var(--color-svg-icon))}@media screen{[data-color-scheme=dark] .svg-icon[data-v-06e5463e]{fill:var(--colors-svg-icon-fill-dark,var(--color-svg-icon))}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .svg-icon[data-v-06e5463e]{fill:var(--colors-svg-icon-fill-dark,var(--color-svg-icon))}}.svg-icon.icon-inline[data-v-06e5463e]{display:inline-block;vertical-align:middle;fill:currentColor}.svg-icon.icon-inline[data-v-06e5463e] .svg-icon-stroke{stroke:currentColor}[data-v-06e5463e] .svg-icon-stroke{stroke:var(--colors-svg-icon-fill-light,var(--color-svg-icon))}.theme-dark[data-v-06e5463e] .svg-icon-stroke{stroke:var(--colors-svg-icon-fill-dark,var(--color-svg-icon))}@media screen{[data-color-scheme=dark][data-v-06e5463e] .svg-icon-stroke{stroke:var(--colors-svg-icon-fill-dark,var(--color-svg-icon))}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto][data-v-06e5463e] .svg-icon-stroke{stroke:var(--colors-svg-icon-fill-dark,var(--color-svg-icon))}}.inline-chevron-right-icon[data-v-7413f2a0]{transform:scaleX(var(--scale-inline,1))}.suggest-lang[data-v-c2dca0ae]{background:#000;color:#fff;display:flex;justify-content:center;border-bottom:1px solid var(--color-grid)}.suggest-lang__wrapper[data-v-c2dca0ae]{display:flex;align-items:center;width:100%;max-width:var(--wrapper-max-width,1920px);margin:0 .9411764706rem;position:relative;height:52px}.suggest-lang__link[data-v-c2dca0ae]{font-size:.8235294118rem;line-height:1.4285714286;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);margin:0 auto;color:#09f}.suggest-lang__close-icon-wrapper[data-v-c2dca0ae]{position:absolute;right:-.2352941176rem;top:0;height:100%;box-sizing:border-box;display:flex;align-items:center;z-index:1}.suggest-lang__close-icon-button[data-v-c2dca0ae]{padding:.2352941176rem}.suggest-lang__close-icon-button .close-icon[data-v-c2dca0ae]{width:8px;display:block}.suggest-lang .inline-chevron-right-icon[data-v-c2dca0ae]{padding-left:.2352941176rem;width:8px}select[data-v-d21858a2]{font-size:.7058823529rem;line-height:1.3333333333;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-fill-blue);padding-right:15px;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:transparent;border:none;cursor:pointer}select[data-v-d21858a2]:hover{text-decoration:underline}.locale-selector[data-v-d21858a2]{position:relative}.svg-icon.icon-inline[data-v-d21858a2]{position:absolute;fill:var(--color-fill-blue);right:2px;bottom:7px;height:5px}html{-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%;background-color:var(--colors-text-background,var(--color-text-background));height:100%}abbr,blockquote,body,button,dd,dl,dt,fieldset,figure,form,h1,h2,h3,h4,h5,h6,hgroup,input,legend,li,ol,p,pre,ul{margin:0;padding:0}address,caption,code,figcaption,pre,th{font-size:1em;font-weight:400;font-style:normal}fieldset,iframe,img{border:0}caption,th{text-align:start}table{border-collapse:collapse;border-spacing:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}button{background:none;border:0;box-sizing:content-box;color:inherit;cursor:pointer;font:inherit;line-height:inherit;overflow:visible;vertical-align:inherit}button:disabled{cursor:default}:focus{outline:4px solid var(--color-focus-color);outline-offset:1px}::-moz-focus-inner{border:0;padding:0}@media print{#app-main,#content,body{color:#000}a,a:link,a:visited{color:#000;text-decoration:none}.hide,.noprint{display:none}}body{height:100%;min-width:320px}html{font:var(--typography-html-font,17px "Helvetica Neue","Helvetica","Arial",sans-serif);quotes:"“" "”"}html:lang(ja-JP){quotes:"「" "」"}body{font-size:1rem;line-height:1.4705882353;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);background-color:var(--color-text-background);color:var(--colors-text,var(--color-text));font-style:normal;word-wrap:break-word;--spacing-stacked-margin-small:0.4em;--spacing-stacked-margin-large:0.8em;--spacing-stacked-margin-xlarge:calc(var(--spacing-stacked-margin-large)*2);--spacing-param:1.6470588235rem;--declaration-code-listing-margin:30px 0 0 0;--code-block-style-elements-padding:8px 14px}body,button,input,select,textarea{font-synthesis:none;-moz-font-feature-settings:"kern";-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:start}h1,h2,h3,h4,h5,h6{color:var(--colors-header-text,var(--color-header-text))}h1+*,h2+*,h3+*,h4+*,h5+*,h6+*{margin-top:var(--spacing-stacked-margin-large)}ol+h1,ol+h2,ol+h3,ol+h4,ol+h5,ol+h6,p+h1,p+h2,p+h3,p+h4,p+h5,p+h6,ul+h1,ul+h2,ul+h3,ul+h4,ul+h5,ul+h6{margin-top:1.6em}ol+*,p+*,ul+*{margin-top:var(--spacing-stacked-margin-large)}ol,ul{margin-inline-start:1.1764705882em}ol ol,ol ul,ul ol,ul ul{margin-top:0;margin-bottom:0}nav ol,nav ul{margin:0;list-style:none}li li{font-size:1em}a{color:var(--colors-link,var(--color-link))}a:link,a:visited{text-decoration:none}a.inline-link,a:hover{text-decoration:underline}a:active{text-decoration:none}p+a{display:inline-block}b,strong{font-weight:600}cite,dfn,em,i{font-style:italic}sup{font-size:.6em;vertical-align:top;position:relative;bottom:-.2em}h1 sup,h2 sup,h3 sup{font-size:.4em}sup a{vertical-align:inherit;color:inherit}sup a:hover{color:var(--figure-blue);text-decoration:none}sub{line-height:1}abbr{border:0}pre{overflow:auto;-webkit-overflow-scrolling:auto;white-space:pre;word-wrap:normal}code{font-family:var(--typography-html-font-mono,Menlo,monospace);font-weight:inherit;letter-spacing:0}.syntax-addition{color:var(--syntax-addition,var(--color-syntax-addition))}.syntax-comment{color:var(--syntax-comment,var(--color-syntax-comments))}.syntax-quote{color:var(--syntax-quote,var(--color-syntax-comments))}.syntax-deletion{color:var(--syntax-deletion,var(--color-syntax-deletion))}.syntax-keyword{color:var(--syntax-keyword,var(--color-syntax-keywords))}.syntax-literal{color:var(--syntax-literal,var(--color-syntax-keywords))}.syntax-selector-tag{color:var(--syntax-selector-tag,var(--color-syntax-keywords))}.syntax-string{color:var(--syntax-string,var(--color-syntax-strings))}.syntax-bullet{color:var(--syntax-bullet,var(--color-syntax-characters))}.syntax-meta{color:var(--syntax-meta,var(--color-syntax-characters))}.syntax-number{color:var(--syntax-number,var(--color-syntax-characters))}.syntax-symbol{color:var(--syntax-symbol,var(--color-syntax-characters))}.syntax-tag{color:var(--syntax-tag,var(--color-syntax-characters))}.syntax-attr{color:var(--syntax-attr,var(--color-syntax-other-type-names))}.syntax-built_in{color:var(--syntax-built_in,var(--color-syntax-other-type-names))}.syntax-builtin-name{color:var(--syntax-builtin-name,var(--color-syntax-other-type-names))}.syntax-class{color:var(--syntax-class,var(--color-syntax-other-type-names))}.syntax-params{color:var(--syntax-params,var(--color-syntax-other-type-names))}.syntax-section{color:var(--syntax-section,var(--color-syntax-other-type-names))}.syntax-title{color:var(--syntax-title,var(--color-syntax-other-type-names))}.syntax-type{color:var(--syntax-type,var(--color-syntax-other-type-names))}.syntax-attribute{color:var(--syntax-attribute,var(--color-syntax-plain-text))}.syntax-identifier{color:var(--syntax-identifier,var(--color-syntax-plain-text))}.syntax-subst{color:var(--syntax-subst,var(--color-syntax-plain-text))}.syntax-doctag,.syntax-strong{font-weight:700}.syntax-emphasis,.syntax-link{font-style:italic}[data-syntax=swift] .syntax-meta{color:var(--syntax-meta,var(--color-syntax-keywords))}[data-syntax=swift] .syntax-class,[data-syntax=swift] .syntax-keyword+.syntax-params,[data-syntax=swift] .syntax-params+.syntax-params{color:unset}[data-syntax=json] .syntax-attr{color:var(--syntax-attr,var(--color-syntax-strings))}#skip-nav{position:absolute;clip:rect(1px,1px,1px,1px);clip-path:inset(0 0 99.9% 99.9%);overflow:hidden;height:1px;width:1px;padding:0;border:0}#skip-nav:active,#skip-nav:focus{position:relative;float:left;width:-moz-fit-content;width:fit-content;color:var(--color-figure-blue);font-size:1em;padding:0 10px;z-index:100000;top:0;left:0;height:44px;line-height:44px;clip-path:unset}.nav--in-breakpoint-range #skip-nav{display:none}.visuallyhidden{position:absolute;clip:rect(1px,1px,1px,1px);clip-path:inset(0 0 99.9% 99.9%);overflow:hidden;height:1px;width:1px;padding:0;border:0}@keyframes pulse{0%{opacity:0}33%{opacity:1}66%{opacity:1}to{opacity:0}}.changed{border:1px solid var(--color-changes-modified);position:relative}.changed,.changed.displays-multiple-lines,.displays-multiple-lines .changed{border-radius:var(--border-radius,4px)}.changed:after{left:8px;background-image:url(../img/modified-icon.efb2697d.svg);background-repeat:no-repeat;bottom:0;content:" ";margin:auto;margin-right:8px;position:absolute;top:0;width:1.1764705882rem;height:1.1764705882rem;margin-top:.6176470588rem;z-index:2}@media screen{[data-color-scheme=dark] .changed:after{background-image:url(../img/modified-icon.efb2697d.svg)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .changed:after{background-image:url(../img/modified-icon.efb2697d.svg)}}.changed-added{border-color:var(--color-changes-added)}.changed-added:after{background-image:url(../img/added-icon.832a5d2c.svg)}@media screen{[data-color-scheme=dark] .changed-added:after{background-image:url(../img/added-icon.832a5d2c.svg)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .changed-added:after{background-image:url(../img/added-icon.832a5d2c.svg)}}.changed-deprecated{border-color:var(--color-changes-deprecated)}.changed-deprecated:after{background-image:url(../img/deprecated-icon.7bf1740a.svg)}@media screen{[data-color-scheme=dark] .changed-deprecated:after{background-image:url(../img/deprecated-icon.7bf1740a.svg)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .changed-deprecated:after{background-image:url(../img/deprecated-icon.7bf1740a.svg)}}.changed.link-block:after,.changed.relationships-item:after,.link-block .changed:after{margin-top:10px}.change-added,.change-removed{padding:2px 0}.change-removed{background-color:var(--color-highlight-red)}.change-added{background-color:var(--color-highlight-green)}body{color-scheme:light dark}body[data-color-scheme=light]{color-scheme:light}body[data-color-scheme=dark]{color-scheme:dark}body{--color-fill:#fff;--color-fill-secondary:#f7f7f7;--color-fill-tertiary:#f0f0f0;--color-fill-quaternary:#282828;--color-fill-blue:#00f;--color-fill-light-blue-secondary:#d1d1ff;--color-fill-gray:#ccc;--color-fill-gray-secondary:#f5f5f5;--color-fill-gray-tertiary:#f0f0f0;--color-fill-gray-quaternary:#f0f0f0;--color-fill-green-secondary:#f0fff0;--color-fill-orange-secondary:#fffaf6;--color-fill-red-secondary:#fff0f5;--color-figure-blue:#36f;--color-figure-gray:#000;--color-figure-gray-secondary:#666;--color-figure-gray-secondary-alt:#666;--color-figure-gray-tertiary:#666;--color-figure-green:green;--color-figure-light-gray:#666;--color-figure-orange:#c30;--color-figure-red:red;--color-tutorials-teal:#000;--color-article-background:var(--color-fill-tertiary);--color-article-body-background:var(--color-fill);--color-aside-deprecated:var(--color-figure-gray);--color-aside-deprecated-background:var(--color-fill-orange-secondary);--color-aside-deprecated-border:var(--color-figure-orange);--color-aside-experiment:var(--color-figure-gray);--color-aside-experiment-background:var(--color-fill-gray-secondary);--color-aside-experiment-border:var(--color-figure-light-gray);--color-aside-important:var(--color-figure-gray);--color-aside-important-background:var(--color-fill-gray-secondary);--color-aside-important-border:var(--color-figure-light-gray);--color-aside-note:var(--color-figure-gray);--color-aside-note-background:var(--color-fill-gray-secondary);--color-aside-note-border:var(--color-figure-light-gray);--color-aside-tip:var(--color-figure-gray);--color-aside-tip-background:var(--color-fill-gray-secondary);--color-aside-tip-border:var(--color-figure-light-gray);--color-aside-warning:var(--color-figure-gray);--color-aside-warning-background:var(--color-fill-red-secondary);--color-aside-warning-border:var(--color-figure-red);--color-badge-text:#fff;--color-badge-default:var(--color-figure-gray);--color-badge-beta:var(--color-figure-gray-tertiary);--color-badge-deprecated:var(--color-figure-orange);--color-badge-dark-default:#fff;--color-badge-dark-beta:#b0b0b0;--color-badge-dark-deprecated:#f60;--color-button-background:var(--color-fill-blue);--color-button-background-active:#36f;--color-button-background-hover:var(--color-figure-blue);--color-button-text:#fff;--color-call-to-action-background:var(--color-fill-secondary);--color-changes-added:var(--color-figure-light-gray);--color-changes-added-hover:var(--color-figure-light-gray);--color-changes-deprecated:var(--color-figure-light-gray);--color-changes-deprecated-hover:var(--color-figure-light-gray);--color-changes-modified:var(--color-figure-light-gray);--color-changes-modified-hover:var(--color-figure-light-gray);--color-changes-modified-previous-background:var(--color-fill);--color-code-background:var(--color-fill-secondary);--color-code-collapsible-background:var(--color-fill-tertiary);--color-code-collapsible-text:var(--color-figure-gray-secondary-alt);--color-code-line-highlight:rgba(51,102,255,.08);--color-code-line-highlight-border:var(--color-figure-blue);--color-inline-code-background:transparent;--color-code-plain:var(--color-figure-gray);--color-dropdown-background:hsla(0,0%,100%,.8);--color-dropdown-border:#ccc;--color-dropdown-option-text:#666;--color-dropdown-text:#000;--color-dropdown-dark-background:hsla(0,0%,100%,.1);--color-dropdown-dark-border:hsla(0,0%,94%,.2);--color-dropdown-dark-option-text:#ccc;--color-dropdown-dark-text:#fff;--color-eyebrow:var(--color-figure-gray-secondary);--color-focus-border-color:var(--color-fill-blue);--color-focus-color:rgba(0,125,250,.6);--color-form-error:var(--color-figure-red);--color-form-error-background:var(--color-fill-red-secondary);--color-form-valid:var(--color-figure-green);--color-form-valid-background:var(--color-fill-green-secondary);--color-generic-modal-background:var(--color-fill);--color-grid:var(--color-fill-gray);--color-header-text:var(--color-figure-gray);--color-hero-eyebrow:#ccc;--color-link:var(--color-figure-blue);--color-loading-placeholder-background:var(--color-fill);--color-nav-color:#000;--color-nav-current-link:#000;--color-nav-expanded:#fff;--color-nav-hierarchy-collapse-background:#f0f0f0;--color-nav-hierarchy-collapse-borders:#ccc;--color-nav-hierarchy-item-borders:#ccc;--color-nav-keyline:rgba(0,0,0,.2);--color-nav-link-color:#000;--color-nav-link-color-hover:#36f;--color-nav-outlines:#ccc;--color-nav-rule:hsla(0,0%,94%,.5);--color-nav-solid-background:#fff;--color-nav-sticking-expanded-keyline:rgba(0,0,0,.1);--color-nav-stuck:hsla(0,0%,100%,.9);--color-nav-uiblur-expanded:hsla(0,0%,100%,.9);--color-nav-uiblur-stuck:hsla(0,0%,100%,.7);--color-nav-root-subhead:var(--color-tutorials-teal);--color-nav-dark-border-top-color:hsla(0,0%,100%,.4);--color-nav-dark-color:#fff;--color-nav-dark-current-link:#fff;--color-nav-dark-expanded:#2a2a2a;--color-nav-dark-hierarchy-collapse-background:#424242;--color-nav-dark-hierarchy-collapse-borders:#666;--color-nav-dark-hierarchy-item-borders:#424242;--color-nav-dark-keyline:rgba(66,66,66,.95);--color-nav-dark-link-color:#fff;--color-nav-dark-link-color-hover:#09f;--color-nav-dark-outlines:#575757;--color-nav-dark-rule:#575757;--color-nav-dark-solid-background:#000;--color-nav-dark-sticking-expanded-keyline:rgba(66,66,66,.7);--color-nav-dark-stuck:rgba(42,42,42,.9);--color-nav-dark-uiblur-expanded:rgba(42,42,42,.9);--color-nav-dark-uiblur-stuck:rgba(42,42,42,.7);--color-nav-dark-root-subhead:#fff;--color-other-decl-button:var(--color-text-background);--color-overviewcard-border:var(--color-fill);--color-overviewcard-fill:var(--color-fill-secondary);--color-overviewcard-fill-secondary:var(--color-fill-tertiary);--color-runtime-preview-background:var(--color-fill-tertiary);--color-runtime-preview-disabled-text:hsla(0,0%,40%,.6);--color-runtime-preview-text:var(--color-figure-gray-secondary);--color-secondary-label:var(--color-figure-gray-secondary);--color-step-background:var(--color-fill-secondary);--color-step-caption:var(--color-figure-gray-secondary);--color-step-focused:var(--color-figure-light-gray);--color-step-text:var(--color-figure-gray-secondary);--color-svg-icon:#666;--color-syntax-addition:var(--color-figure-green);--color-syntax-attributes:#947100;--color-syntax-characters:#272ad8;--color-syntax-comments:#707f8c;--color-syntax-deletion:var(--color-figure-red);--color-syntax-documentation-markup:#506375;--color-syntax-documentation-markup-keywords:#506375;--color-syntax-heading:#ba2da2;--color-syntax-highlighted:rgba(0,113,227,.2);--color-syntax-keywords:#ad3da4;--color-syntax-marks:#000;--color-syntax-numbers:#272ad8;--color-syntax-other-class-names:#703daa;--color-syntax-other-constants:#4b21b0;--color-syntax-other-declarations:#047cb0;--color-syntax-other-function-and-method-names:#4b21b0;--color-syntax-other-instance-variables-and-globals:#703daa;--color-syntax-other-preprocessor-macros:#78492a;--color-syntax-other-type-names:#703daa;--color-syntax-param-internal-name:#404040;--color-syntax-plain-text:#000;--color-syntax-preprocessor-statements:#78492a;--color-syntax-project-class-names:#3e8087;--color-syntax-project-constants:#2d6469;--color-syntax-project-function-and-method-names:#2d6469;--color-syntax-project-instance-variables-and-globals:#3e8087;--color-syntax-project-preprocessor-macros:#78492a;--color-syntax-project-type-names:#3e8087;--color-syntax-strings:#d12f1b;--color-syntax-type-declarations:#03638c;--color-syntax-urls:#1337ff;--color-tabnav-item-border-color:var(--color-fill-gray);--color-text:var(--color-figure-gray);--color-text-background:var(--color-fill);--color-tutorial-assessments-background:var(--color-fill-secondary);--color-tutorial-background:var(--color-fill);--color-tutorial-navbar-dropdown-background:var(--color-fill);--color-tutorial-navbar-dropdown-border:var(--color-fill-gray);--color-tutorial-quiz-border-active:var(--color-figure-blue);--color-tutorials-overview-background:#161616;--color-tutorials-overview-content:#fff;--color-tutorials-overview-content-alt:#fff;--color-tutorials-overview-eyebrow:#ccc;--color-tutorials-overview-icon:#b0b0b0;--color-tutorials-overview-link:#09f;--color-tutorials-overview-navigation-link:#ccc;--color-tutorials-overview-navigation-link-active:#fff;--color-tutorials-overview-navigation-link-hover:#fff;--color-tutorial-hero-text:#fff;--color-tutorial-hero-background:#000;--color-navigator-item-hover:rgba(0,0,255,.05);--color-card-background:var(--color-fill);--color-card-content-text:var(--color-figure-gray);--color-card-eyebrow:var(--color-figure-gray-secondary-alt);--color-card-shadow:rgba(0,0,0,.04);--color-link-block-card-border:rgba(0,0,0,.04);--color-standard-red:#ffc2c2;--color-standard-orange:#fc9;--color-standard-yellow:#ffe0a3;--color-standard-blue:#9cf;--color-standard-green:#9cc;--color-standard-purple:#ccf;--color-standard-gray:#f0f0f0}@media screen{body[data-color-scheme=dark]{--color-fill:#000;--color-fill-secondary:#161616;--color-fill-tertiary:#2a2a2a;--color-fill-blue:#06f;--color-fill-light-blue-secondary:#004ec4;--color-fill-gray:#575757;--color-fill-gray-secondary:#222;--color-fill-gray-tertiary:#424242;--color-fill-gray-quaternary:#424242;--color-fill-green-secondary:#030;--color-fill-orange-secondary:#472400;--color-fill-red-secondary:#300;--color-figure-blue:#09f;--color-figure-gray:#fff;--color-figure-gray-secondary:#ccc;--color-figure-gray-secondary-alt:#b0b0b0;--color-figure-gray-tertiary:#b0b0b0;--color-figure-green:#090;--color-figure-light-gray:#b0b0b0;--color-figure-orange:#f60;--color-figure-red:#f33;--color-tutorials-teal:#fff;--color-article-body-background:#111;--color-badge-text:#000;--color-badge-default:var(--color-badge-dark-default);--color-button-background-active:#06f;--color-code-line-highlight:rgba(0,153,255,.08);--color-inline-code-background:transparent;--color-dropdown-background:var(--color-dropdown-dark-background);--color-dropdown-border:var(--color-dropdown-dark-border);--color-dropdown-option-text:var(--color-dropdown-dark-option-text);--color-dropdown-text:var(--color-dropdown-dark-text);--color-nav-color:var(--color-nav-dark-color);--color-nav-current-link:var(--color-nav-dark-current-link);--color-nav-expanded:var(--color-nav-dark-expanded);--color-nav-hierarchy-collapse-background:var(--color-nav-dark-hierarchy-collapse-background);--color-nav-hierarchy-collapse-borders:var(--color-nav-dark-hierarchy-collapse-borders);--color-nav-hierarchy-item-borders:var(--color-nav-dark-hierarchy-item-borders);--color-nav-keyline:var(--color-nav-dark-keyline);--color-nav-link-color:var(--color-nav-dark-link-color);--color-nav-link-color-hover:var(--color-nav-dark-link-color-hover);--color-nav-outlines:var(--color-nav-dark-outlines);--color-nav-rule:var(--color-nav-dark-rule);--color-nav-solid-background:var(--color-nav-dark-solid-background);--color-nav-sticking-expanded-keyline:var(--color-nav-dark-sticking-expanded-keyline);--color-nav-stuck:var(--color-nav-dark-stuck);--color-nav-uiblur-expanded:var(--color-nav-dark-uiblur-expanded);--color-nav-uiblur-stuck:var(--color-nav-dark-uiblur-stuck);--color-runtime-preview-disabled-text:hsla(0,0%,80%,.6);--color-syntax-attributes:#cc9768;--color-syntax-characters:#d9c97c;--color-syntax-comments:#7f8c98;--color-syntax-documentation-markup:#7f8c98;--color-syntax-documentation-markup-keywords:#a3b1bf;--color-syntax-highlighted:rgba(0,113,227,.6);--color-syntax-keywords:#ff7ab2;--color-syntax-marks:#fff;--color-syntax-numbers:#d9c97c;--color-syntax-other-class-names:#dabaff;--color-syntax-other-constants:#a7ebdd;--color-syntax-other-declarations:#4eb0cc;--color-syntax-other-function-and-method-names:#b281eb;--color-syntax-other-instance-variables-and-globals:#b281eb;--color-syntax-other-preprocessor-macros:#ffa14f;--color-syntax-other-type-names:#dabaff;--color-syntax-param-internal-name:#bfbfbf;--color-syntax-plain-text:#fff;--color-syntax-preprocessor-statements:#ffa14f;--color-syntax-project-class-names:#acf2e4;--color-syntax-project-constants:#78c2b3;--color-syntax-project-function-and-method-names:#78c2b3;--color-syntax-project-instance-variables-and-globals:#78c2b3;--color-syntax-project-preprocessor-macros:#ffa14f;--color-syntax-project-type-names:#acf2e4;--color-syntax-strings:#ff8170;--color-syntax-type-declarations:#6bdfff;--color-syntax-urls:#69f;--color-tutorial-background:var(--color-fill-tertiary);--color-navigator-item-hover:rgba(0,102,255,.5);--color-card-shadow:hsla(0,0%,100%,.04);--color-link-block-card-border:hsla(0,0%,100%,.25);--color-standard-red:#8b0000;--color-standard-orange:#8b4000;--color-standard-yellow:#8f7200;--color-standard-blue:#002d75;--color-standard-green:#023b2d;--color-standard-purple:#512b55;--color-standard-gray:#2a2a2a}}@media screen and (prefers-color-scheme:dark){body[data-color-scheme=auto]{--color-fill:#000;--color-fill-secondary:#161616;--color-fill-tertiary:#2a2a2a;--color-fill-blue:#06f;--color-fill-light-blue-secondary:#004ec4;--color-fill-gray:#575757;--color-fill-gray-secondary:#222;--color-fill-gray-tertiary:#424242;--color-fill-gray-quaternary:#424242;--color-fill-green-secondary:#030;--color-fill-orange-secondary:#472400;--color-fill-red-secondary:#300;--color-figure-blue:#09f;--color-figure-gray:#fff;--color-figure-gray-secondary:#ccc;--color-figure-gray-secondary-alt:#b0b0b0;--color-figure-gray-tertiary:#b0b0b0;--color-figure-green:#090;--color-figure-light-gray:#b0b0b0;--color-figure-orange:#f60;--color-figure-red:#f33;--color-tutorials-teal:#fff;--color-article-body-background:#111;--color-badge-text:#000;--color-badge-default:var(--color-badge-dark-default);--color-button-background-active:#06f;--color-code-line-highlight:rgba(0,153,255,.08);--color-inline-code-background:transparent;--color-dropdown-background:var(--color-dropdown-dark-background);--color-dropdown-border:var(--color-dropdown-dark-border);--color-dropdown-option-text:var(--color-dropdown-dark-option-text);--color-dropdown-text:var(--color-dropdown-dark-text);--color-nav-color:var(--color-nav-dark-color);--color-nav-current-link:var(--color-nav-dark-current-link);--color-nav-expanded:var(--color-nav-dark-expanded);--color-nav-hierarchy-collapse-background:var(--color-nav-dark-hierarchy-collapse-background);--color-nav-hierarchy-collapse-borders:var(--color-nav-dark-hierarchy-collapse-borders);--color-nav-hierarchy-item-borders:var(--color-nav-dark-hierarchy-item-borders);--color-nav-keyline:var(--color-nav-dark-keyline);--color-nav-link-color:var(--color-nav-dark-link-color);--color-nav-link-color-hover:var(--color-nav-dark-link-color-hover);--color-nav-outlines:var(--color-nav-dark-outlines);--color-nav-rule:var(--color-nav-dark-rule);--color-nav-solid-background:var(--color-nav-dark-solid-background);--color-nav-sticking-expanded-keyline:var(--color-nav-dark-sticking-expanded-keyline);--color-nav-stuck:var(--color-nav-dark-stuck);--color-nav-uiblur-expanded:var(--color-nav-dark-uiblur-expanded);--color-nav-uiblur-stuck:var(--color-nav-dark-uiblur-stuck);--color-runtime-preview-disabled-text:hsla(0,0%,80%,.6);--color-syntax-attributes:#cc9768;--color-syntax-characters:#d9c97c;--color-syntax-comments:#7f8c98;--color-syntax-documentation-markup:#7f8c98;--color-syntax-documentation-markup-keywords:#a3b1bf;--color-syntax-highlighted:rgba(0,113,227,.6);--color-syntax-keywords:#ff7ab2;--color-syntax-marks:#fff;--color-syntax-numbers:#d9c97c;--color-syntax-other-class-names:#dabaff;--color-syntax-other-constants:#a7ebdd;--color-syntax-other-declarations:#4eb0cc;--color-syntax-other-function-and-method-names:#b281eb;--color-syntax-other-instance-variables-and-globals:#b281eb;--color-syntax-other-preprocessor-macros:#ffa14f;--color-syntax-other-type-names:#dabaff;--color-syntax-param-internal-name:#bfbfbf;--color-syntax-plain-text:#fff;--color-syntax-preprocessor-statements:#ffa14f;--color-syntax-project-class-names:#acf2e4;--color-syntax-project-constants:#78c2b3;--color-syntax-project-function-and-method-names:#78c2b3;--color-syntax-project-instance-variables-and-globals:#78c2b3;--color-syntax-project-preprocessor-macros:#ffa14f;--color-syntax-project-type-names:#acf2e4;--color-syntax-strings:#ff8170;--color-syntax-type-declarations:#6bdfff;--color-syntax-urls:#69f;--color-tutorial-background:var(--color-fill-tertiary);--color-navigator-item-hover:rgba(0,102,255,.5);--color-card-shadow:hsla(0,0%,100%,.04);--color-link-block-card-border:hsla(0,0%,100%,.25);--color-standard-red:#8b0000;--color-standard-orange:#8b4000;--color-standard-yellow:#8f7200;--color-standard-blue:#002d75;--color-standard-green:#023b2d;--color-standard-purple:#512b55;--color-standard-gray:#2a2a2a}}#app-main{outline-style:none}:root{--app-height:100vh}html{--scale-inline:1}html[dir=rtl]{--scale-inline:-1}[data-v-1fc6db09] :focus:not(input):not(textarea):not(select){outline:none}.fromkeyboard[data-v-1fc6db09] :focus:not(input):not(textarea):not(select){outline:4px solid var(--color-focus-color);outline-offset:1px}#app[data-v-1fc6db09]{display:flex;flex-flow:column;min-height:100%}#app[data-v-1fc6db09]>*{min-width:0}#app .router-content[data-v-1fc6db09]{flex:1}.container[data-v-1f05d9ec]{margin-left:auto;margin-right:auto;width:1536px;width:980px;outline-style:none;margin-top:92px;margin-bottom:140px}@media only screen and (max-width:1250px){.container[data-v-1f05d9ec]{width:692px}}@media only screen and (max-width:735px){.container[data-v-1f05d9ec]{width:87.5%}}@media only screen and (max-width:320px){.container[data-v-1f05d9ec]{width:215px}}.error-content[data-v-1f05d9ec]{box-sizing:border-box;width:502px;margin-left:auto;margin-right:auto;margin-bottom:54px}@media only screen and (max-width:1250px){.error-content[data-v-1f05d9ec]{width:420px;margin-bottom:45px}}@media only screen and (max-width:735px){.error-content[data-v-1f05d9ec]{max-width:330px;width:auto;margin-bottom:35px}}.title[data-v-1f05d9ec]{text-align:center;font-size:2.8235294118rem;line-height:1.0833333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){.title[data-v-1f05d9ec]{font-size:2.3529411765rem;line-height:1.1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.title[data-v-1f05d9ec]{font-size:1.8823529412rem;line-height:1.125;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/css/topic.c7af1fb5.css b/Containers/Supporting Files/Help.bundle/css/topic.c7af1fb5.css new file mode 100644 index 0000000..6b859e9 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/css/topic.c7af1fb5.css @@ -0,0 +1,9 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */.nav-title-content[data-v-854b4dd6]{max-width:100%}.title[data-v-854b4dd6]{color:var(--color-nav-root-title,currentColor);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:inline-block;vertical-align:top;max-width:296px}@media only screen and (max-width:1023px){.title[data-v-854b4dd6]{max-width:205px}}@media only screen and (max-width:767px){.title[data-v-854b4dd6]{flex-basis:fill;display:initial;vertical-align:initial;max-width:none}}.subhead[data-v-854b4dd6]{color:var(--color-nav-root-subhead)}.theme-dark .subhead[data-v-854b4dd6]{color:var(--color-nav-dark-root-subhead)}.mobile-dropdown[data-v-2c27d339]{box-sizing:border-box}.nav--in-breakpoint-range .mobile-dropdown[data-v-2c27d339]{padding-left:.2352941176rem;padding-right:.2352941176rem}.mobile-dropdown ul[data-v-2c27d339]{list-style:none}.mobile-dropdown .option[data-v-2c27d339]{cursor:pointer;font-size:.7058823529rem;padding:.5rem 0;display:block;text-decoration:none;color:inherit}.mobile-dropdown .option[data-v-2c27d339]:focus{outline-offset:0}.mobile-dropdown .option.depth1[data-v-2c27d339]{padding-left:.4705882353rem}.active[data-v-2c27d339],.tutorial.router-link-active[data-v-2c27d339]{font-weight:600}.active[data-v-2c27d339]:focus,.tutorial.router-link-active[data-v-2c27d339]:focus{outline:none}.chapter-list[data-v-2c27d339]:not(:first-child){margin-top:1rem}.chapter-name[data-v-2c27d339],.tutorial[data-v-2c27d339]{padding:.5rem 0;font-size:1rem;line-height:1.4705882353;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.section-list[data-v-2c27d339],.tutorial-list[data-v-2c27d339]{padding:0 .5882352941rem}.chapter-list:last-child .tutorial-list[data-v-2c27d339]:last-child{padding-bottom:10em}.chapter-list[data-v-2c27d339]{display:inline-block}.form-element[data-v-f934959a]{position:relative}.form-dropdown[data-v-f934959a]{font-size:1rem;line-height:1.2352941176;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);display:block;box-sizing:border-box;width:100%;height:3.3em;color:var(--color-dropdown-text);padding:1.1176470588rem 2.3529411765rem 0 .9411764706rem;text-align:left;border:1px solid var(--color-dropdown-border);border-radius:var(--border-radius,4px);background-clip:padding-box;margin-bottom:.8235294118rem;-webkit-appearance:none;-moz-appearance:none;appearance:none;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;min-height:32px}.form-dropdown[data-v-f934959a]:focus{box-shadow:0 0 0 4px var(--color-focus-color);outline:none;border-color:var(--color-focus-border-color)}.form-dropdown.no-eyebrow[data-v-f934959a]{padding-top:0}.form-dropdown[data-v-f934959a]:-moz-focusring{color:transparent;text-shadow:0 0 0 var(--color-dropdown-text)}.form-dropdown[data-v-f934959a]::-ms-expand{opacity:0}.form-dropdown~.form-icon[data-v-f934959a]{position:absolute;display:block;pointer-events:none;fill:var(--color-figure-gray-tertiary);right:14px;width:13px;height:auto;top:50%;transform:translateY(-50%)}.is-open .form-dropdown~.form-icon[data-v-f934959a]{transform:translateY(-50%) scale(-1)}@media only screen and (max-width:735px){.form-dropdown~.form-icon[data-v-f934959a]{right:14px}}.form-dropdown~.form-label[data-v-f934959a]{font-size:.7058823529rem;line-height:1.75;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);position:absolute;top:.4705882353rem;left:17px;color:var(--color-figure-gray-secondary);pointer-events:none;padding:0;z-index:1}.form-dropdown[data-v-f934959a] option{color:var(--color-dropdown-text)}.form-dropdown-selectnone[data-v-f934959a]{color:transparent}.form-dropdown-selectnone~.form-label[data-v-f934959a]{font-size:1rem;line-height:1.2352941176;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);top:19px;left:17px;color:var(--color-figure-gray-tertiary)}.form-dropdown-selectnone[data-v-f934959a]:-moz-focusring{text-shadow:none}.form-dropdown-selectnone[data-v-f934959a]::-ms-value{display:none}.theme-dark .form-dropdown[data-v-f934959a]{color:var(--color-dropdown-dark-text);background-color:var(--color-dropdown-dark-background);border-color:var(--color-dropdown-dark-border)}.theme-dark .form-dropdown~.form-label[data-v-f934959a]{color:#ccc}.theme-dark .form-dropdown[data-v-f934959a]:-moz-focusring{color:transparent;text-shadow:0 0 0 var(--color-dropdown-dark-text)}.theme-dark .form-dropdown.form-dropdown-selectnone[data-v-f934959a]{color:transparent}.theme-dark .form-dropdown.form-dropdown-selectnone[data-v-f934959a]:-moz-focusring{text-shadow:none}.theme-dark .form-dropdown-selectnone~.form-label[data-v-f934959a]{color:#b0b0b0}.dropdown-small[data-v-6adda760]{height:30px;display:flex;align-items:center;position:relative;background:var(--color-fill)}.dropdown-small .form-dropdown-toggle[data-v-6adda760]{line-height:1.5;font-size:12px;padding-top:0;padding-bottom:0;padding-left:20px;min-height:unset;height:30px;display:flex;align-items:center}.dropdown-small .form-dropdown-toggle[data-v-6adda760]:focus{box-shadow:none;border-color:var(--color-dropdown-border)}.fromkeyboard .dropdown-small .form-dropdown-toggle[data-v-6adda760]:focus{box-shadow:0 0 0 2px var(--color-focus-color);outline:none;border-color:var(--color-focus-border-color)}.form-dropdown-toggle[data-v-6adda760]{margin:0}.is-open .form-dropdown-toggle[data-v-6adda760]{border-radius:var(--border-radius,4px) var(--border-radius,4px) 0 0;border-bottom:none;padding-bottom:1px}.fromkeyboard .is-open .form-dropdown-toggle[data-v-6adda760]{box-shadow:1px -1px 0 1px var(--color-focus-color),-1px -1px 0 1px var(--color-focus-color);border-color:var(--color-focus-border-color)}.form-dropdown-title[data-v-6adda760]{margin:0;padding:0;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.dropdown-custom[data-v-6adda760]{border-radius:var(--border-radius,4px)}.dropdown-custom.is-open[data-v-6adda760]{border-radius:var(--border-radius,4px) var(--border-radius,4px) 0 0}.dropdown-custom[data-v-6adda760] .form-dropdown-content{background:var(--color-fill);position:absolute;right:0;left:0;top:100%;border-bottom-left-radius:var(--border-radius,4px);border-bottom-right-radius:var(--border-radius,4px);border:1px solid var(--color-dropdown-border);border-top:none;display:none;overflow-y:auto}.dropdown-custom[data-v-6adda760] .form-dropdown-content.is-open{display:block}.fromkeyboard .dropdown-custom[data-v-6adda760] .form-dropdown-content.is-open{box-shadow:1px 1px 0 1px var(--color-focus-color),-1px 1px 0 1px var(--color-focus-color);border-color:var(--color-focus-border-color);border-top-color:transparent}.nav .dropdown-custom[data-v-6adda760] .form-dropdown-content{max-height:calc(100vh - 116px - 3.05882rem)}.nav--is-sticking.nav .dropdown-custom[data-v-6adda760] .form-dropdown-content{max-height:calc(100vh - 3.05882rem - 72px)}.dropdown-custom[data-v-6adda760] .options{list-style:none;margin:0;padding:0 0 20px}.dropdown-custom[data-v-6adda760] .option{cursor:pointer;padding:5px 20px;font-size:12px;line-height:20px;outline:none}.dropdown-custom[data-v-6adda760] .option:hover{background-color:var(--color-fill-tertiary)}.dropdown-custom[data-v-6adda760] .option.option-active{font-weight:600}.fromkeyboard .dropdown-custom[data-v-6adda760] .option:hover{background-color:transparent}.fromkeyboard .dropdown-custom[data-v-6adda760] .option:focus{background-color:var(--color-fill-tertiary);outline:none}.tutorial-dropdown[data-v-618ff780]{grid-column:3}.section-tracker[data-v-618ff780]{font-size:.7058823529rem;line-height:1.3333333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-figure-gray-secondary);margin-left:15px}.tutorial-dropdown[data-v-03cbd7f7]{grid-column:1/2}.tutorial-dropdown .options[data-v-03cbd7f7]{padding-top:1rem;padding-bottom:0}.tutorial-dropdown .option[data-v-03cbd7f7]{padding:5px 20px 5px 30px}.chapter-list[data-v-03cbd7f7]{padding-bottom:20px}.chapter-name[data-v-03cbd7f7]{margin:0 20px 5px 20px;line-height:normal;color:var(--color-figure-gray-secondary)}.chevron-icon[data-v-367fa5fc]{padding:0;color:var(--color-nav-outlines);grid-column:2;height:20px;width:20px;margin:0 4px}@media only screen and (min-width:768px){.nav[data-v-367fa5fc] .nav-content{display:grid;grid-template-columns:auto auto 3fr;align-items:center}.nav[data-v-367fa5fc] .nav-menu{padding:0;justify-content:flex-start;grid-column:3/5}.nav[data-v-367fa5fc] .nav-menu-item{margin:0}}.dropdown-container[data-v-367fa5fc]{height:3.0588235294rem;display:grid;grid-template-columns:minmax(230px,285px) auto minmax(230px,1fr);align-items:center}@media only screen and (max-width:1023px){.dropdown-container[data-v-367fa5fc]{grid-template-columns:minmax(173px,216px) auto minmax(173px,1fr)}}@media(scripting:none){.dropdown-container[data-v-367fa5fc]{display:none}}.separator[data-v-367fa5fc]{height:20px;border-right:1px solid;border-color:var(--color-nav-outlines);margin:0 20px;grid-column:2}@media(scripting:none){.separator[data-v-367fa5fc]{display:none}}.mobile-dropdown-container[data-v-367fa5fc],.nav--in-breakpoint-range.nav .dropdown-container[data-v-367fa5fc],.nav--in-breakpoint-range.nav .separator[data-v-367fa5fc]{display:none}.nav--in-breakpoint-range.nav .mobile-dropdown-container[data-v-367fa5fc]{display:block}.nav--in-breakpoint-range.nav[data-v-367fa5fc] .nav-title{grid-area:title}.nav--in-breakpoint-range.nav[data-v-367fa5fc] .pre-title{display:none}.nav[data-v-367fa5fc] .nav-title{grid-column:1;padding-top:0}.primary-dropdown[data-v-367fa5fc],.secondary-dropdown[data-v-367fa5fc]{background:var(--color-tutorial-navbar-dropdown-background);border-color:var(--color-tutorial-navbar-dropdown-border)}.primary-dropdown[data-v-367fa5fc] .form-dropdown,.primary-dropdown[data-v-367fa5fc] .form-dropdown:focus,.secondary-dropdown[data-v-367fa5fc] .form-dropdown,.secondary-dropdown[data-v-367fa5fc] .form-dropdown:focus{border-color:var(--color-tutorial-navbar-dropdown-border)}.primary-dropdown[data-v-367fa5fc] .options,.secondary-dropdown[data-v-367fa5fc] .options{background:var(--color-tutorial-navbar-dropdown-background);border-color:var(--color-tutorial-navbar-dropdown-border)}[data-v-0861b5be] .code-listing+*,[data-v-0861b5be] aside+*,[data-v-0861b5be] h2+*,[data-v-0861b5be] h3+*,[data-v-0861b5be] ol+*,[data-v-0861b5be] p+*,[data-v-0861b5be] ul+*{margin-top:20px}[data-v-0861b5be] ol ol,[data-v-0861b5be] ol ul,[data-v-0861b5be] ul ol,[data-v-0861b5be] ul ul{margin-top:0}[data-v-0861b5be] h2{font-size:1.8823529412rem;line-height:1.25;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){[data-v-0861b5be] h2{font-size:1.6470588235rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){[data-v-0861b5be] h2{font-size:1.4117647059rem;line-height:1.3333333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}[data-v-0861b5be] h3{font-size:1.4117647059rem;line-height:1.1666666667;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){[data-v-0861b5be] h3{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}[data-v-0861b5be] .code-listing{background:var(--color-code-background);border-color:var(--colors-grid,var(--color-grid));border-style:solid;border-width:1px}[data-v-0861b5be] .code-listing pre{font-size:.7058823529rem;line-height:1.8333333333;font-weight:400;font-family:var(--typography-html-font-mono,Menlo,monospace);padding:20px 0}.columns[data-v-30edf911]{display:grid;grid-template-rows:repeat(2,auto)}.columns.cols-2[data-v-30edf911]{gap:20px 8.3333333333%;grid-template-columns:repeat(2,1fr)}.columns.cols-3[data-v-30edf911]{gap:20px 4.1666666667%;grid-template-columns:repeat(3,1fr)}.asset[data-v-30edf911]{align-self:end;grid-row:1}.content[data-v-30edf911]{grid-row:2}@media only screen and (max-width:735px){.columns.cols-2[data-v-30edf911],.columns.cols-3[data-v-30edf911]{grid-template-columns:unset}.asset[data-v-30edf911],.content[data-v-30edf911]{grid-row:auto}}.content-and-media[data-v-3fa44f9e]{display:flex}.content-and-media.media-leading[data-v-3fa44f9e]{flex-direction:row-reverse}.content-and-media.media-trailing[data-v-3fa44f9e]{flex-direction:row}@media only screen and (min-width:736px){.content-and-media[data-v-3fa44f9e]{align-items:center;justify-content:center}}.content[data-v-3fa44f9e]{width:62.5%}.asset[data-v-3fa44f9e]{width:29.1666666667%}.media-leading .asset[data-v-3fa44f9e]{margin-right:8.3333333333%}.media-trailing .asset[data-v-3fa44f9e]{margin-left:8.3333333333%}@media only screen and (max-width:735px){.content-and-media.media-leading[data-v-3fa44f9e],.content-and-media.media-trailing[data-v-3fa44f9e]{flex-direction:column}.asset[data-v-3fa44f9e],.content[data-v-3fa44f9e]{width:100%}.media-leading .asset[data-v-3fa44f9e],.media-trailing .asset[data-v-3fa44f9e]{margin:20px 0 0 0}}.group[id][data-v-5b4a8b3c]{margin-top:20px;padding-top:20px}[data-v-5b4a8b3c] img,[data-v-5b4a8b3c] video{display:block;margin:0 auto;max-width:100%}.layout+[data-v-4d5a806e]{margin-top:40px}@media only screen and (max-width:735px){.layout[data-v-4d5a806e]:first-child>:not(.group[id]){margin-top:40px}}.body[data-v-20dca692]{background:var(--colors-text-background,var(--color-article-body-background));margin-left:auto;margin-right:auto;width:1536px;width:980px;border-radius:10px;transform:translateY(-120px)}@media only screen and (max-width:1250px){.body[data-v-20dca692]{width:692px}}@media only screen and (max-width:735px){.body[data-v-20dca692]{width:87.5%}}@media only screen and (max-width:320px){.body[data-v-20dca692]{width:215px}}@media only screen and (max-width:735px){.body[data-v-20dca692]{border-radius:0;transform:none}}.body[data-v-20dca692]~*{margin-top:-40px}.body-content[data-v-20dca692]{padding:40px 8.3333333333% 80px 8.3333333333%}@media only screen and (max-width:735px){.body-content[data-v-20dca692]{padding:0 0 40px 0}}.call-to-action[data-v-2bfdf182]{padding:65px 0;background:var(--color-call-to-action-background)}.theme-dark .call-to-action[data-v-2bfdf182]{--color-call-to-action-background:#424242}.row[data-v-2bfdf182]{margin-left:auto;margin-right:auto;width:1536px;width:980px;display:flex;align-items:center}@media only screen and (max-width:1250px){.row[data-v-2bfdf182]{width:692px}}@media only screen and (max-width:735px){.row[data-v-2bfdf182]{width:87.5%}}@media only screen and (max-width:320px){.row[data-v-2bfdf182]{width:215px}}[data-v-2bfdf182] img,[data-v-2bfdf182] video{max-height:560px}h2[data-v-2bfdf182]{font-size:1.8823529412rem;line-height:1.25;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){h2[data-v-2bfdf182]{font-size:1.6470588235rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){h2[data-v-2bfdf182]{font-size:1.4117647059rem;line-height:1.3333333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.label[data-v-2bfdf182]{display:block;font-size:1.2352941176rem;line-height:1.1904761905;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);margin-bottom:var(--spacing-stacked-margin-small);color:var(--color-eyebrow)}@media only screen and (max-width:735px){.label[data-v-2bfdf182]{font-size:1.1176470588rem;line-height:1.2105263158;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.content[data-v-2bfdf182]{margin-bottom:1.5rem}.right-column[data-v-2bfdf182]{margin-left:auto}@media only screen and (max-width:735px){.row[data-v-2bfdf182]{display:block}.col+.col[data-v-2bfdf182]{margin-top:40px}.call-to-action[data-v-426a965c]{margin-top:0}}.headline[data-v-d46a1474]{margin-bottom:var(--spacing-stacked-margin-large)}.heading[data-v-d46a1474]{font-size:2.8235294118rem;line-height:1.0833333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-header-text)}@media only screen and (max-width:1250px){.heading[data-v-d46a1474]{font-size:2.3529411765rem;line-height:1.1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.heading[data-v-d46a1474]{font-size:1.8823529412rem;line-height:1.125;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.dark .heading[data-v-d46a1474]{color:#fff}.eyebrow[data-v-d46a1474]{font-size:1.4117647059rem;line-height:1.1666666667;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);display:block;margin-bottom:var(--spacing-stacked-margin-small);color:var(--color-eyebrow)}@media only screen and (max-width:1250px){.eyebrow[data-v-d46a1474]{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.generic-modal[data-v-795f7b59]{position:fixed;top:0;left:0;right:0;bottom:0;margin:0;z-index:11000;display:flex;align-items:center;justify-content:center;flex-wrap:wrap;background:none;overflow:auto}.modal-fullscreen[data-v-795f7b59]{align-items:stretch}.modal-fullscreen .container[data-v-795f7b59]{margin:0;flex:1;width:100%;height:100%;padding-top:env(safe-area-inset-top);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom);padding-left:env(safe-area-inset-left)}.modal-standard[data-v-795f7b59]{padding:20px}.modal-standard .container[data-v-795f7b59]{padding:60px;border-radius:var(--border-radius,4px)}@media screen{[data-color-scheme=dark] .modal-standard .container[data-v-795f7b59]{background:#1d1d1f}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .modal-standard .container[data-v-795f7b59]{background:#1d1d1f}}@media only screen and (max-width:735px){.modal-standard[data-v-795f7b59]{padding:0;align-items:stretch}.modal-standard .container[data-v-795f7b59]{margin:20px 0 0;padding:50px 30px;flex:1;width:100%;border-bottom-left-radius:0;border-bottom-right-radius:0}}.backdrop[data-v-795f7b59]{overflow:auto;background:var(--backdrop-background,rgba(0,0,0,.4));-webkit-overflow-scrolling:touch;width:100%;height:100%;position:fixed}.container[data-v-795f7b59]{margin-left:auto;margin-right:auto;width:1536px;width:980px;background:var(--colors-generic-modal-background,var(--color-generic-modal-background));z-index:1;position:relative;overflow:auto;max-width:100%}@media only screen and (max-width:1250px){.container[data-v-795f7b59]{width:692px}}@media only screen and (max-width:735px){.container[data-v-795f7b59]{width:87.5%}}@media only screen and (max-width:320px){.container[data-v-795f7b59]{width:215px}}.close[data-v-795f7b59]{position:absolute;z-index:9999;top:22px;left:22px;width:17px;height:17px;color:#666;cursor:pointer;background:none;border:0;display:flex;align-items:center}.close .close-icon[data-v-795f7b59]{fill:currentColor;width:100%;height:100%}.theme-dark .container[data-v-795f7b59]{background:#000}.theme-dark .container .close[data-v-795f7b59]{color:#b0b0b0}.theme-code .container[data-v-795f7b59]{background-color:var(--code-background,var(--color-code-background))}.metadata[data-v-94ff76c0]{display:flex}.item[data-v-94ff76c0]{font-size:.7058823529rem;line-height:1.3333333333;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);display:flex;flex-direction:column;justify-content:flex-end;align-items:center;border-right:1px solid #fff;padding:0 27.5px}@media only screen and (max-width:735px){.item[data-v-94ff76c0]{font-size:.6470588235rem;line-height:1.6363636364;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);padding:0 8px}}.item[data-v-94ff76c0]:first-of-type{padding-left:0}.item[data-v-94ff76c0]:last-of-type{border:none}@media only screen and (max-width:735px){.item[data-v-94ff76c0]:last-of-type{padding-right:0}}.content[data-v-94ff76c0]{color:#fff}.icon[data-v-94ff76c0]{font-size:2.8235294118rem;line-height:1.0833333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){.icon[data-v-94ff76c0]{font-size:2.3529411765rem;line-height:1.1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.icon[data-v-94ff76c0]{font-size:1.8823529412rem;line-height:1.125;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.small-icon[data-v-94ff76c0]{width:1em;height:1em;margin-left:.2rem}.small-icon.xcode-icon[data-v-94ff76c0]{width:.8em;height:.8em}.content-link[data-v-94ff76c0]{display:flex;align-items:center}a[data-v-94ff76c0]{color:var(--colors-link,var(--color-tutorials-overview-link))}.duration[data-v-94ff76c0]{display:flex;align-items:baseline;font-size:2.3529411765rem;line-height:1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);line-height:1.8rem}@media only screen and (max-width:735px){.duration[data-v-94ff76c0]{font-size:1.6470588235rem;line-height:1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);line-height:1.3rem}}.minutes[data-v-94ff76c0]{display:inline-block;font-size:1.6470588235rem;line-height:1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);line-height:1.3rem}@media only screen and (max-width:735px){.minutes[data-v-94ff76c0]{font-size:1rem;line-height:1.2352941176;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);line-height:.8rem}}.item-large-icon[data-v-94ff76c0]{height:2.3rem;max-width:100%}@media only screen and (max-width:735px){.item-large-icon[data-v-94ff76c0]{height:1.5rem;max-width:100%}}.bottom[data-v-94ff76c0]{margin-top:13px}@media only screen and (max-width:735px){.bottom[data-v-94ff76c0]{margin-top:8px}}.hero[data-v-2a434750]{background-color:var(--color-tutorial-hero-background);color:var(--color-tutorial-hero-text);position:relative}@media screen{.hero.dark[data-v-2a434750]{--color-fill:#fff;--color-fill-secondary:#f7f7f7;--color-fill-tertiary:#f0f0f0;--color-fill-quaternary:#282828;--color-fill-blue:#00f;--color-fill-light-blue-secondary:#d1d1ff;--color-fill-gray:#ccc;--color-fill-gray-secondary:#f5f5f5;--color-fill-gray-tertiary:#f0f0f0;--color-fill-gray-quaternary:#f0f0f0;--color-fill-green-secondary:#f0fff0;--color-fill-orange-secondary:#fffaf6;--color-fill-red-secondary:#fff0f5;--color-figure-blue:#36f;--color-figure-gray:#000;--color-figure-gray-secondary:#666;--color-figure-gray-secondary-alt:#666;--color-figure-gray-tertiary:#666;--color-figure-green:green;--color-figure-light-gray:#666;--color-figure-orange:#c30;--color-figure-red:red;--color-tutorials-teal:#000;--color-article-background:var(--color-fill-tertiary);--color-article-body-background:var(--color-fill);--color-aside-deprecated:var(--color-figure-gray);--color-aside-deprecated-background:var(--color-fill-orange-secondary);--color-aside-deprecated-border:var(--color-figure-orange);--color-aside-experiment:var(--color-figure-gray);--color-aside-experiment-background:var(--color-fill-gray-secondary);--color-aside-experiment-border:var(--color-figure-light-gray);--color-aside-important:var(--color-figure-gray);--color-aside-important-background:var(--color-fill-gray-secondary);--color-aside-important-border:var(--color-figure-light-gray);--color-aside-note:var(--color-figure-gray);--color-aside-note-background:var(--color-fill-gray-secondary);--color-aside-note-border:var(--color-figure-light-gray);--color-aside-tip:var(--color-figure-gray);--color-aside-tip-background:var(--color-fill-gray-secondary);--color-aside-tip-border:var(--color-figure-light-gray);--color-aside-warning:var(--color-figure-gray);--color-aside-warning-background:var(--color-fill-red-secondary);--color-aside-warning-border:var(--color-figure-red);--color-badge-text:#fff;--color-badge-default:var(--color-figure-gray);--color-badge-beta:var(--color-figure-gray-tertiary);--color-badge-deprecated:var(--color-figure-orange);--color-badge-dark-default:#fff;--color-badge-dark-beta:#b0b0b0;--color-badge-dark-deprecated:#f60;--color-button-background:var(--color-fill-blue);--color-button-background-active:#36f;--color-button-background-hover:var(--color-figure-blue);--color-button-text:#fff;--color-call-to-action-background:var(--color-fill-secondary);--color-changes-added:var(--color-figure-light-gray);--color-changes-added-hover:var(--color-figure-light-gray);--color-changes-deprecated:var(--color-figure-light-gray);--color-changes-deprecated-hover:var(--color-figure-light-gray);--color-changes-modified:var(--color-figure-light-gray);--color-changes-modified-hover:var(--color-figure-light-gray);--color-changes-modified-previous-background:var(--color-fill);--color-code-background:var(--color-fill-secondary);--color-code-collapsible-background:var(--color-fill-tertiary);--color-code-collapsible-text:var(--color-figure-gray-secondary-alt);--color-code-line-highlight:rgba(51,102,255,.08);--color-code-line-highlight-border:var(--color-figure-blue);--color-code-plain:var(--color-figure-gray);--color-dropdown-background:hsla(0,0%,100%,.8);--color-dropdown-border:#ccc;--color-dropdown-option-text:#666;--color-dropdown-text:#000;--color-dropdown-dark-background:hsla(0,0%,100%,.1);--color-dropdown-dark-border:hsla(0,0%,94%,.2);--color-dropdown-dark-option-text:#ccc;--color-dropdown-dark-text:#fff;--color-eyebrow:var(--color-figure-gray-secondary);--color-focus-border-color:var(--color-fill-blue);--color-focus-color:rgba(0,125,250,.6);--color-form-error:var(--color-figure-red);--color-form-error-background:var(--color-fill-red-secondary);--color-form-valid:var(--color-figure-green);--color-form-valid-background:var(--color-fill-green-secondary);--color-generic-modal-background:var(--color-fill);--color-grid:var(--color-fill-gray);--color-header-text:var(--color-figure-gray);--color-hero-eyebrow:#ccc;--color-link:var(--color-figure-blue);--color-loading-placeholder-background:var(--color-fill);--color-nav-color:#000;--color-nav-current-link:#000;--color-nav-expanded:#fff;--color-nav-hierarchy-collapse-background:#f0f0f0;--color-nav-hierarchy-collapse-borders:#ccc;--color-nav-hierarchy-item-borders:#ccc;--color-nav-keyline:rgba(0,0,0,.2);--color-nav-link-color:#000;--color-nav-link-color-hover:#36f;--color-nav-outlines:#ccc;--color-nav-rule:hsla(0,0%,94%,.5);--color-nav-solid-background:#fff;--color-nav-sticking-expanded-keyline:rgba(0,0,0,.1);--color-nav-stuck:hsla(0,0%,100%,.9);--color-nav-uiblur-expanded:hsla(0,0%,100%,.9);--color-nav-uiblur-stuck:hsla(0,0%,100%,.7);--color-nav-root-subhead:var(--color-tutorials-teal);--color-nav-dark-border-top-color:hsla(0,0%,100%,.4);--color-nav-dark-color:#fff;--color-nav-dark-current-link:#fff;--color-nav-dark-expanded:#2a2a2a;--color-nav-dark-hierarchy-collapse-background:#424242;--color-nav-dark-hierarchy-collapse-borders:#666;--color-nav-dark-hierarchy-item-borders:#424242;--color-nav-dark-keyline:rgba(66,66,66,.95);--color-nav-dark-link-color:#fff;--color-nav-dark-link-color-hover:#09f;--color-nav-dark-outlines:#575757;--color-nav-dark-rule:#575757;--color-nav-dark-solid-background:#000;--color-nav-dark-sticking-expanded-keyline:rgba(66,66,66,.7);--color-nav-dark-stuck:rgba(42,42,42,.9);--color-nav-dark-uiblur-expanded:rgba(42,42,42,.9);--color-nav-dark-uiblur-stuck:rgba(42,42,42,.7);--color-nav-dark-root-subhead:#fff;--color-other-decl-button:var(--color-text-background);--color-overviewcard-border:var(--color-fill);--color-overviewcard-fill:var(--color-fill-secondary);--color-overviewcard-fill-secondary:var(--color-fill-tertiary);--color-runtime-preview-background:var(--color-fill-tertiary);--color-runtime-preview-disabled-text:hsla(0,0%,40%,.6);--color-runtime-preview-text:var(--color-figure-gray-secondary);--color-secondary-label:var(--color-figure-gray-secondary);--color-step-background:var(--color-fill-secondary);--color-step-caption:var(--color-figure-gray-secondary);--color-step-focused:var(--color-figure-light-gray);--color-step-text:var(--color-figure-gray-secondary);--color-svg-icon:#666;--color-syntax-addition:var(--color-figure-green);--color-syntax-attributes:#947100;--color-syntax-characters:#272ad8;--color-syntax-comments:#707f8c;--color-syntax-deletion:var(--color-figure-red);--color-syntax-documentation-markup:#506375;--color-syntax-documentation-markup-keywords:#506375;--color-syntax-heading:#ba2da2;--color-syntax-highlighted:rgba(0,113,227,.2);--color-syntax-keywords:#ad3da4;--color-syntax-marks:#000;--color-syntax-numbers:#272ad8;--color-syntax-other-class-names:#703daa;--color-syntax-other-constants:#4b21b0;--color-syntax-other-declarations:#047cb0;--color-syntax-other-function-and-method-names:#4b21b0;--color-syntax-other-instance-variables-and-globals:#703daa;--color-syntax-other-preprocessor-macros:#78492a;--color-syntax-other-type-names:#703daa;--color-syntax-param-internal-name:#404040;--color-syntax-plain-text:#000;--color-syntax-preprocessor-statements:#78492a;--color-syntax-project-class-names:#3e8087;--color-syntax-project-constants:#2d6469;--color-syntax-project-function-and-method-names:#2d6469;--color-syntax-project-instance-variables-and-globals:#3e8087;--color-syntax-project-preprocessor-macros:#78492a;--color-syntax-project-type-names:#3e8087;--color-syntax-strings:#d12f1b;--color-syntax-type-declarations:#03638c;--color-syntax-urls:#1337ff;--color-tabnav-item-border-color:var(--color-fill-gray);--color-text:var(--color-figure-gray);--color-text-background:var(--color-fill);--color-tutorial-assessments-background:var(--color-fill-secondary);--color-tutorial-background:var(--color-fill);--color-tutorial-navbar-dropdown-background:var(--color-fill);--color-tutorial-navbar-dropdown-border:var(--color-fill-gray);--color-tutorial-quiz-border-active:var(--color-figure-blue);--color-tutorials-overview-background:#161616;--color-tutorials-overview-content:#fff;--color-tutorials-overview-content-alt:#fff;--color-tutorials-overview-eyebrow:#ccc;--color-tutorials-overview-icon:#b0b0b0;--color-tutorials-overview-link:#09f;--color-tutorials-overview-navigation-link:#ccc;--color-tutorials-overview-navigation-link-active:#fff;--color-tutorials-overview-navigation-link-hover:#fff;--color-tutorial-hero-text:#fff;--color-tutorial-hero-background:#000;--color-navigator-item-hover:rgba(0,0,255,.05);--color-card-background:var(--color-fill);--color-card-content-text:var(--color-figure-gray);--color-card-eyebrow:var(--color-figure-gray-secondary-alt);--color-card-shadow:rgba(0,0,0,.04);--color-link-block-card-border:rgba(0,0,0,.04);--color-standard-red:#ffc2c2;--color-standard-orange:#fc9;--color-standard-yellow:#ffe0a3;--color-standard-blue:#9cf;--color-standard-green:#9cc;--color-standard-purple:#ccf;--color-standard-gray:#f0f0f0;--color-fill:#000;--color-fill-secondary:#161616;--color-fill-tertiary:#2a2a2a;--color-fill-blue:#06f;--color-fill-light-blue-secondary:#004ec4;--color-fill-gray:#575757;--color-fill-gray-secondary:#222;--color-fill-gray-tertiary:#424242;--color-fill-gray-quaternary:#424242;--color-fill-green-secondary:#030;--color-fill-orange-secondary:#472400;--color-fill-red-secondary:#300;--color-figure-blue:#09f;--color-figure-gray:#fff;--color-figure-gray-secondary:#ccc;--color-figure-gray-secondary-alt:#b0b0b0;--color-figure-gray-tertiary:#b0b0b0;--color-figure-green:#090;--color-figure-light-gray:#b0b0b0;--color-figure-orange:#f60;--color-figure-red:#f33;--color-tutorials-teal:#fff;--color-article-body-background:#111;--color-badge-text:#000;--color-badge-default:var(--color-badge-dark-default);--color-button-background-active:#06f;--color-code-line-highlight:rgba(0,153,255,.08);--color-inline-code-background:transparent;--color-dropdown-background:var(--color-dropdown-dark-background);--color-dropdown-border:var(--color-dropdown-dark-border);--color-dropdown-option-text:var(--color-dropdown-dark-option-text);--color-dropdown-text:var(--color-dropdown-dark-text);--color-nav-color:var(--color-nav-dark-color);--color-nav-current-link:var(--color-nav-dark-current-link);--color-nav-expanded:var(--color-nav-dark-expanded);--color-nav-hierarchy-collapse-background:var(--color-nav-dark-hierarchy-collapse-background);--color-nav-hierarchy-collapse-borders:var(--color-nav-dark-hierarchy-collapse-borders);--color-nav-hierarchy-item-borders:var(--color-nav-dark-hierarchy-item-borders);--color-nav-keyline:var(--color-nav-dark-keyline);--color-nav-link-color:var(--color-nav-dark-link-color);--color-nav-link-color-hover:var(--color-nav-dark-link-color-hover);--color-nav-outlines:var(--color-nav-dark-outlines);--color-nav-rule:var(--color-nav-dark-rule);--color-nav-solid-background:var(--color-nav-dark-solid-background);--color-nav-sticking-expanded-keyline:var(--color-nav-dark-sticking-expanded-keyline);--color-nav-stuck:var(--color-nav-dark-stuck);--color-nav-uiblur-expanded:var(--color-nav-dark-uiblur-expanded);--color-nav-uiblur-stuck:var(--color-nav-dark-uiblur-stuck);--color-runtime-preview-disabled-text:hsla(0,0%,80%,.6);--color-syntax-attributes:#cc9768;--color-syntax-characters:#d9c97c;--color-syntax-comments:#7f8c98;--color-syntax-documentation-markup:#7f8c98;--color-syntax-documentation-markup-keywords:#a3b1bf;--color-syntax-highlighted:rgba(0,113,227,.6);--color-syntax-keywords:#ff7ab2;--color-syntax-marks:#fff;--color-syntax-numbers:#d9c97c;--color-syntax-other-class-names:#dabaff;--color-syntax-other-constants:#a7ebdd;--color-syntax-other-declarations:#4eb0cc;--color-syntax-other-function-and-method-names:#b281eb;--color-syntax-other-instance-variables-and-globals:#b281eb;--color-syntax-other-preprocessor-macros:#ffa14f;--color-syntax-other-type-names:#dabaff;--color-syntax-param-internal-name:#bfbfbf;--color-syntax-plain-text:#fff;--color-syntax-preprocessor-statements:#ffa14f;--color-syntax-project-class-names:#acf2e4;--color-syntax-project-constants:#78c2b3;--color-syntax-project-function-and-method-names:#78c2b3;--color-syntax-project-instance-variables-and-globals:#78c2b3;--color-syntax-project-preprocessor-macros:#ffa14f;--color-syntax-project-type-names:#acf2e4;--color-syntax-strings:#ff8170;--color-syntax-type-declarations:#6bdfff;--color-syntax-urls:#69f;--color-tutorial-background:var(--color-fill-tertiary);--color-navigator-item-hover:rgba(0,102,255,.5);--color-card-shadow:hsla(0,0%,100%,.04);--color-link-block-card-border:hsla(0,0%,100%,.25);--color-standard-red:#8b0000;--color-standard-orange:#8b4000;--color-standard-yellow:#8f7200;--color-standard-blue:#002d75;--color-standard-green:#023b2d;--color-standard-purple:#512b55;--color-standard-gray:#2a2a2a}}.bg[data-v-2a434750]{background-color:var(--color-tutorial-hero-background);background-position:top;background-repeat:no-repeat;background-size:cover;content:"";height:100%;left:0;opacity:.3;position:absolute;top:0;width:100%}.row[data-v-2a434750]{margin-left:auto;margin-right:auto;width:1536px;width:980px;padding:80px 0}@media only screen and (max-width:1250px){.row[data-v-2a434750]{width:692px}}@media only screen and (max-width:735px){.row[data-v-2a434750]{width:87.5%}}@media only screen and (max-width:320px){.row[data-v-2a434750]{width:215px}}.col[data-v-2a434750]{z-index:1}[data-v-2a434750] .eyebrow{font-size:1.4117647059rem;line-height:1.1666666667;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-hero-eyebrow)}@media only screen and (max-width:1250px){[data-v-2a434750] .eyebrow{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.headline[data-v-2a434750]{font-size:2.8235294118rem;line-height:1.0833333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);margin-bottom:2rem}@media only screen and (max-width:1250px){.headline[data-v-2a434750]{font-size:2.3529411765rem;line-height:1.1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.headline[data-v-2a434750]{font-size:1.8823529412rem;line-height:1.125;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.intro[data-v-2a434750]{font-size:1.2352941176rem;line-height:1.380952381;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:735px){.intro[data-v-2a434750]{font-size:1.1176470588rem;line-height:1.4210526316;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.content+p[data-v-2a434750]{margin-top:var(--spacing-stacked-margin-large)}@media only screen and (max-width:735px){.content+p[data-v-2a434750]{margin-top:8px}}.call-to-action[data-v-2a434750]{display:flex;align-items:center}.call-to-action .cta-icon[data-v-2a434750]{margin-left:.4rem;width:1em;height:1em}.metadata[data-v-2a434750]{margin-top:2rem}.video-asset[data-v-2a434750]{display:grid;height:100vh;margin:0;place-items:center center}.video-asset[data-v-2a434750] video{max-width:1280px;min-width:320px;width:100%}@media only screen and (max-width:735px){.headline[data-v-2a434750]{margin-bottom:19px}}.tutorial-hero[data-v-35a9482f]{margin-bottom:80px}@media only screen and (max-width:735px){.tutorial-hero[data-v-35a9482f]{margin-bottom:0}}.title[data-v-28135d78]{font-size:.7058823529rem;line-height:1.3333333333;color:var(--colors-secondary-label,var(--color-secondary-label))}.title[data-v-28135d78],.title[data-v-61b03ec2]{font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.title[data-v-61b03ec2]{font-size:1.1176470588rem;line-height:1.2105263158;color:var(--colors-header-text,var(--color-header-text));margin:25px 0}.question-content[data-v-61b03ec2] code{font-size:.7647058824rem;line-height:1.8461538462;font-weight:400;font-family:var(--typography-html-font-mono,Menlo,monospace)}.choices[data-v-61b03ec2]{display:flex;flex-direction:column;padding:0;list-style:none;margin:25px 0}.choice[data-v-61b03ec2]{font-size:.8235294118rem;line-height:1.4285714286;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);flex:1;border-radius:var(--border-radius,4px);margin:8px 0;padding:1.5rem 40px;cursor:pointer;background:var(--colors-text-background,var(--color-text-background));display:flex;flex-direction:column;justify-content:center;border-width:1px;border-style:solid;border-color:var(--colors-grid,var(--color-grid));position:relative}.choice[data-v-61b03ec2] img{max-height:23.5294117647rem}.choice[data-v-61b03ec2]:first-of-type{margin-top:0}.choice[data-v-61b03ec2] code{font-size:.7647058824rem;line-height:1.8461538462;font-weight:400;font-family:var(--typography-html-font-mono,Menlo,monospace)}.controls[data-v-61b03ec2]{text-align:center;margin-bottom:40px}.controls .button-cta[data-v-61b03ec2]{margin:.5rem;margin-top:0;padding:.3rem 3rem;min-width:8rem}input[type=radio][data-v-61b03ec2]{position:absolute;width:100%;left:0;height:100%;opacity:0;z-index:-1}.active[data-v-61b03ec2]{border-color:var(--color-tutorial-quiz-border-active);box-shadow:0 0 0 4px var(--color-focus-color);outline:none}.active [data-v-61b03ec2]{color:var(--colors-text,var(--color-text))}.correct[data-v-61b03ec2]{background:var(--color-form-valid-background);border-color:var(--color-form-valid)}.correct .choice-icon[data-v-61b03ec2]{fill:var(--color-form-valid)}.incorrect[data-v-61b03ec2]{background:var(--color-form-error-background);border-color:var(--color-form-error)}.incorrect .choice-icon[data-v-61b03ec2]{fill:var(--color-form-error)}.correct[data-v-61b03ec2],.incorrect[data-v-61b03ec2]{position:relative}.correct .choice-icon[data-v-61b03ec2],.incorrect .choice-icon[data-v-61b03ec2]{position:absolute;top:11px;left:10px;font-size:20px;width:1.05em}.disabled[data-v-61b03ec2]{pointer-events:none}.answer[data-v-61b03ec2]{margin:.5rem 1.5rem .5rem 0;font-size:.7058823529rem;line-height:1.3333333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.answer[data-v-61b03ec2]:last-of-type{margin-bottom:0}[data-v-61b03ec2] .question>.code-listing{padding:unset;border-radius:0}[data-v-61b03ec2] pre{padding:0}[data-v-61b03ec2] img{display:block;margin-left:auto;margin-right:auto;max-width:100%}.title[data-v-65e3c02c]{font-size:1.8823529412rem;line-height:1.25;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--colors-header-text,var(--color-header-text))}@media only screen and (max-width:1250px){.title[data-v-65e3c02c]{font-size:1.6470588235rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.title[data-v-65e3c02c]{font-size:1.4117647059rem;line-height:1.3333333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.title p[data-v-65e3c02c]{color:var(--colors-text,var(--color-text))}.assessments[data-v-65e3c02c]{box-sizing:content-box;padding:0 1rem;background:var(--color-tutorial-assessments-background);margin-left:auto;margin-right:auto;width:1536px;width:980px;margin-bottom:80px}@media only screen and (max-width:1250px){.assessments[data-v-65e3c02c]{width:692px}}@media only screen and (max-width:735px){.assessments[data-v-65e3c02c]{width:87.5%}}@media only screen and (max-width:320px){.assessments[data-v-65e3c02c]{width:215px}}.banner[data-v-65e3c02c]{padding:40px 0;border-bottom:1px solid;margin-bottom:40px;border-color:var(--colors-grid,var(--color-grid));text-align:center}.success[data-v-65e3c02c]{text-align:center;padding-bottom:40px;font-size:1.8823529412rem;line-height:1.25;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--colors-text,var(--color-text))}@media only screen and (max-width:1250px){.success[data-v-65e3c02c]{font-size:1.6470588235rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.success[data-v-65e3c02c]{font-size:1.4117647059rem;line-height:1.3333333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.assessments-wrapper[data-v-65e3c02c]{padding-top:80px}.assessments-wrapper[data-v-6db06128]{padding-bottom:40px;padding-top:0}@media only screen and (max-width:735px){.assessments-wrapper[data-v-6db06128]{padding-top:80px}}.article[data-v-f98c4098]{background:var(--colors-article-background,var(--color-article-background))}@media only screen and (max-width:735px){.article[data-v-f98c4098]{background:var(--colors-text-background,var(--color-article-body-background))}}.intro-container[data-v-7dcf2d10]{margin-bottom:80px}.intro[data-v-7dcf2d10]{display:flex;align-items:center}@media only screen and (max-width:735px){.intro[data-v-7dcf2d10]{padding-bottom:0;flex-direction:column}}.intro.ide .media[data-v-7dcf2d10] img{background-color:var(--colors-text-background,var(--color-text-background))}.col.left[data-v-7dcf2d10]{padding-right:40px}@media only screen and (max-width:1250px){.col.left[data-v-7dcf2d10]{padding-right:28px}}@media only screen and (max-width:735px){.col.left[data-v-7dcf2d10]{margin-left:auto;margin-right:auto;width:1536px;width:980px;padding-right:0}}@media only screen and (max-width:735px)and (max-width:1250px){.col.left[data-v-7dcf2d10]{width:692px}}@media only screen and (max-width:735px)and (max-width:735px){.col.left[data-v-7dcf2d10]{width:87.5%}}@media only screen and (max-width:735px)and (max-width:320px){.col.left[data-v-7dcf2d10]{width:215px}}.col.right[data-v-7dcf2d10]{padding-left:40px}@media only screen and (max-width:1250px){.col.right[data-v-7dcf2d10]{padding-left:28px}}@media only screen and (max-width:735px){.col.right[data-v-7dcf2d10]{padding-left:0}}.content[data-v-7dcf2d10]{font-size:1rem;line-height:1.4705882353;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.media[data-v-7dcf2d10] img{width:auto;max-height:560px;min-height:18.8235294118rem;-o-object-fit:scale-down;object-fit:scale-down}@media only screen and (max-width:735px){.media[data-v-7dcf2d10]{margin:0;margin-top:40px}.media[data-v-7dcf2d10] image,.media[data-v-7dcf2d10] video{max-height:80vh}}.media[data-v-7dcf2d10] .asset{padding:0 20px}.headline[data-v-7dcf2d10]{color:var(--colors-header-text,var(--color-header-text))}[data-v-7dcf2d10] .eyebrow{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:735px){[data-v-7dcf2d10] .eyebrow{font-size:1.1176470588rem;line-height:1.2105263158;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}[data-v-7dcf2d10] .eyebrow a{color:inherit}[data-v-7dcf2d10] .heading{font-size:1.8823529412rem;line-height:1.25;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:1250px){[data-v-7dcf2d10] .heading{font-size:1.6470588235rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){[data-v-7dcf2d10] .heading{font-size:1.4117647059rem;line-height:1.3333333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.expanded-intro[data-v-7dcf2d10]{margin-left:auto;margin-right:auto;width:1536px;width:980px;margin-top:40px}@media only screen and (max-width:1250px){.expanded-intro[data-v-7dcf2d10]{width:692px}}@media only screen and (max-width:735px){.expanded-intro[data-v-7dcf2d10]{width:87.5%}}@media only screen and (max-width:320px){.expanded-intro[data-v-7dcf2d10]{width:215px}}[data-v-7dcf2d10] .cols-2{gap:20px 16.6666666667%}[data-v-7dcf2d10] .cols-3 .column{gap:20px 12.5%}.code-preview[data-v-395e30cd]{position:sticky;overflow-y:auto;-webkit-overflow-scrolling:touch;background-color:var(--background,var(--color-step-background));height:calc(100vh - 3.05882rem)}.code-preview.ide[data-v-395e30cd]{height:100vh}.code-preview[data-v-395e30cd] .code-listing{color:var(--text,var(--color-code-plain))}.code-preview[data-v-395e30cd] .code-listing .code-line-container{padding-right:14px}.code-preview[data-v-395e30cd] pre{font-size:.7058823529rem;line-height:1.8333333333;font-weight:400;font-family:var(--typography-html-font-mono,Menlo,monospace)}.header[data-v-395e30cd]{font-size:.7058823529rem;line-height:1.3333333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);position:relative;display:flex;justify-content:space-between;align-items:center;width:-webkit-fill-available;width:stretch;cursor:pointer;font-weight:600;padding:8px 12px;border-radius:var(--border-radius,4px) var(--border-radius,4px) 0 0;z-index:1;background:var(--color-runtime-preview-background);color:var(--colors-runtime-preview-text,var(--color-runtime-preview-text))}.header[data-v-395e30cd]:focus{outline-style:none}#app.fromkeyboard .header[data-v-395e30cd]:focus{box-shadow:0 0 0 4px var(--color-focus-color);outline:none;border-color:var(--color-focus-border-color)}.runtime-preview[data-v-395e30cd]{--color-runtime-preview-shadow:rgba(0,0,0,.4);position:absolute;top:0;right:0;background:var(--color-runtime-preview-background);border-radius:var(--border-radius,4px);margin:1rem;margin-left:0;transition:width .2s ease-in;box-shadow:0 0 3px 0 var(--color-runtime-preview-shadow)}@media screen{[data-color-scheme=dark] .runtime-preview[data-v-395e30cd]{--color-runtime-preview-shadow:hsla(0,0%,100%,.4)}}@media screen and (prefers-color-scheme:dark){[data-color-scheme=auto] .runtime-preview[data-v-395e30cd]{--color-runtime-preview-shadow:hsla(0,0%,100%,.4)}}@supports not ((width:-webkit-fill-available) or (width:stretch)){.runtime-preview[data-v-395e30cd]{display:flex;flex-direction:column}}.runtime-preview .runtimve-preview__container[data-v-395e30cd]{border-radius:var(--border-radius,4px);overflow:hidden}.runtime-preview-ide[data-v-395e30cd]{top:0}.runtime-preview-ide .runtime-preview-asset[data-v-395e30cd] img{background-color:var(--color-runtime-preview-background)}.runtime-preview.collapsed[data-v-395e30cd]{box-shadow:0 0 3px 0 var(--color-runtime-preview-shadow);width:102px}.runtime-preview.collapsed .header[data-v-395e30cd]{border-radius:var(--border-radius,4px)}.runtime-preview.disabled[data-v-395e30cd]{box-shadow:0 0 3px 0 transparent}.runtime-preview.disabled .header[data-v-395e30cd]{color:var(--color-runtime-preview-disabled-text);cursor:auto}.runtime-preview-asset[data-v-395e30cd]{border-radius:0 0 var(--border-radius,4px) var(--border-radius,4px)}.runtime-preview-asset[data-v-395e30cd] img{border-bottom-left-radius:var(--border-radius,4px);border-bottom-right-radius:var(--border-radius,4px)}.preview-icon[data-v-395e30cd]{height:.8em;width:.8em;-webkit-user-select:none;-moz-user-select:none;user-select:none}.preview-show[data-v-395e30cd]{transform:scale(-1)}[data-v-0bdf2f26] pre{padding:10px 0}.toggle-preview[data-v-78763c14]{color:var(--color-runtime-preview-disabled-text);display:flex;align-items:center}a[data-v-78763c14]{color:var(--url,var(--color-link))}.toggle-text[data-v-78763c14]{display:flex;align-items:center}svg.toggle-icon[data-v-78763c14]{width:1em;height:1em;margin-left:.5em}.mobile-code-preview[data-v-b1691954]{background-color:var(--background,var(--color-step-background));padding:14px 0}@media only screen and (max-width:735px){.mobile-code-preview[data-v-b1691954]{display:flex;flex-direction:column}}.runtime-preview-modal-content[data-v-b1691954]{padding:45px 60px 0 60px;min-width:200px}.runtime-preview-modal-content[data-v-b1691954] img:not(.file-icon){border-radius:var(--border-radius,4px);box-shadow:0 0 3px rgba(0,0,0,.4);max-height:80vh;width:auto;display:block;margin-bottom:1rem}.runtime-preview-modal-content .runtime-preview-label[data-v-b1691954]{font-size:.7058823529rem;line-height:1.3333333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-runtime-preview-text);display:block;text-align:center;padding:.5em}[data-v-b1691954] .code-listing{color:var(--text,var(--color-code-plain))}[data-v-b1691954] .full-code-listing{padding-top:60px;min-height:calc(100vh - 60px)}[data-v-b1691954] pre{font-size:.7058823529rem;line-height:1.8333333333;font-weight:400;font-family:var(--typography-html-font-mono,Menlo,monospace)}.preview-toggle-container[data-v-b1691954]{align-self:flex-end;margin-right:20px}.step-container[data-v-d0198556]{margin:0}.step-container[data-v-d0198556]:not(:last-child){margin-bottom:100px}@media only screen and (max-width:735px){.step-container[data-v-d0198556]:not(:last-child){margin-bottom:80px}}.step[data-v-d0198556]{position:relative;border-radius:var(--tutorial-step-border-radius,var(--border-radius,4px));padding:1rem 2rem;background-color:var(--color-step-background);overflow:hidden;filter:blur(0)}.step[data-v-d0198556]:before{content:"";position:absolute;top:0;left:0;border:1px solid var(--color-step-focused);background-color:var(--color-step-focused);height:calc(100% - 2px);width:4px;opacity:0;transition:opacity .15s ease-in}.step.focused[data-v-d0198556],.step[data-v-d0198556]:focus{outline:none}.step.focused[data-v-d0198556]:before,.step[data-v-d0198556]:focus:before{opacity:1}:root.no-js .step.focused[data-v-d0198556]:before,:root.no-js .step[data-v-d0198556]:focus:before{opacity:0}@media only screen and (max-width:735px){.step[data-v-d0198556]{padding-left:2rem}.step[data-v-d0198556]:before{opacity:1}}.step-label[data-v-d0198556]{font-size:.7058823529rem;line-height:1.3333333333;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--colors-text,var(--color-step-text));margin-bottom:var(--spacing-stacked-margin-small)}.caption[data-v-d0198556]{border-top:1px solid;border-color:var(--color-step-caption);padding:1rem 0 0 0;margin-top:1rem}.media-container[data-v-d0198556]{display:none}@media only screen and (max-width:735px){.step[data-v-d0198556]{margin:0 .5882352941rem 1.1764705882rem .5882352941rem}.step.focused[data-v-d0198556],.step[data-v-d0198556]:focus{outline:none}.media-container[data-v-d0198556]{display:block;position:relative}.media-container[data-v-d0198556] img,.media-container[data-v-d0198556] video{max-height:80vh}[data-v-d0198556] .asset{padding:0 20px}}.steps[data-v-e3061a7c]{position:relative;font-size:.8235294118rem;line-height:1.4285714286;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);display:flex;color:var(--colors-text,var(--color-text))}@media only screen and (max-width:735px){.steps[data-v-e3061a7c]{padding-top:80px}.steps[data-v-e3061a7c]:before{position:absolute;top:0;border-top:1px solid var(--color-fill-gray-tertiary);content:"";width:calc(100% - 2.35294rem);margin:0 1.1764705882rem}}.steps[data-v-e3061a7c] aside{background:unset;border:unset;box-shadow:unset;-moz-column-break-inside:unset;break-inside:unset;padding:unset}.steps[data-v-e3061a7c] aside .label{font-size:.7058823529rem;line-height:1.3333333333;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.steps[data-v-e3061a7c] aside+*{margin-top:var(--spacing-stacked-margin-large)}.content-container[data-v-e3061a7c]{flex:none;margin-right:4.1666666667%;width:37.5%;margin-top:140px;margin-bottom:94vh}@media only screen and (max-width:735px){.content-container[data-v-e3061a7c]{margin-top:0;margin-bottom:0;height:100%;margin-left:0;margin-right:0;position:relative;width:100%}}.asset-container[data-v-e3061a7c]{flex:none;height:calc(100vh - 3.05882rem);background-color:var(--background,var(--color-step-background));max-width:921px;width:calc(50vw + 8.33333%);position:sticky;top:3.0588235294rem;transition:margin .1s ease-in-out}@media only screen and (max-width:767px){.asset-container[data-v-e3061a7c]{top:2.8235294118rem;height:calc(100vh - 2.82353rem)}}.asset-container[data-v-e3061a7c]:not(.for-step-code){overflow-y:auto;-webkit-overflow-scrolling:touch}.asset-container.ide[data-v-e3061a7c]{height:100vh;top:0}@media only screen and (min-width:736px){.asset-container[data-v-e3061a7c]{display:grid}.asset-container>[data-v-e3061a7c]{grid-row:1;grid-column:1;height:calc(100vh - 3.05882rem)}.asset-container.ide>[data-v-e3061a7c]{height:100vh}}.asset-container .step-asset[data-v-e3061a7c]{box-sizing:border-box;padding:0;padding-left:40px;min-height:320px;height:100%}.asset-container .step-asset[data-v-e3061a7c],.asset-container .step-asset[data-v-e3061a7c] picture{height:100%;display:flex;align-items:center}.asset-container .step-asset[data-v-e3061a7c] .video-replay-container{height:100%;display:flex;flex-direction:column;justify-content:center}.asset-container .step-asset[data-v-e3061a7c] img,.asset-container .step-asset[data-v-e3061a7c] video{width:auto;max-height:calc(100vh - 3.05882rem - 80px);max-width:531.66667px;margin:0}@media only screen and (max-width:1250px){.asset-container .step-asset[data-v-e3061a7c] img,.asset-container .step-asset[data-v-e3061a7c] video{max-width:363.66667px}}.asset-container .step-asset[data-v-e3061a7c] .video-replay-container,.asset-container .step-asset[data-v-e3061a7c] img{min-height:320px}.asset-container .step-asset[data-v-e3061a7c] .video-replay-container video{min-height:280px}.asset-container .step-asset[data-v-e3061a7c] [data-orientation=landscape]{max-width:min(841px,50vw + 8.3333333333% - 80px)}@media only screen and (max-width:735px){.asset-container[data-v-e3061a7c]{display:none}}.asset-wrapper[data-v-e3061a7c]{width:63.2%;align-self:center;transition:transform .25s ease-out;will-change:transform}.asset-wrapper.ide .step-asset[data-v-e3061a7c] img{background-color:var(--background,var(--color-step-background))}.asset-wrapper[data-v-e3061a7c]:has([data-orientation=landscape]){width:unset}[data-v-e3061a7c] .runtime-preview-asset{display:grid}[data-v-e3061a7c] .runtime-preview-asset>*{grid-row:1;grid-column:1}.interstitial[data-v-e3061a7c]{padding:0 2rem}.interstitial[data-v-e3061a7c]:not(:first-child){margin-top:5.8823529412rem}.interstitial[data-v-e3061a7c]:not(:last-child){margin-bottom:30px}@media only screen and (max-width:735px){.interstitial[data-v-e3061a7c]{margin-left:auto;margin-right:auto;width:1536px;width:980px;padding:0}}@media only screen and (max-width:735px)and (max-width:1250px){.interstitial[data-v-e3061a7c]{width:692px}}@media only screen and (max-width:735px)and (max-width:735px){.interstitial[data-v-e3061a7c]{width:87.5%}}@media only screen and (max-width:735px)and (max-width:320px){.interstitial[data-v-e3061a7c]{width:215px}}@media only screen and (max-width:735px){.interstitial[data-v-e3061a7c]:not(:first-child){margin-top:0}}.fade-enter-active[data-v-e3061a7c],.fade-leave-active[data-v-e3061a7c]{transition:opacity .3s ease-in-out}.fade-enter[data-v-e3061a7c],.fade-leave-to[data-v-e3061a7c]{opacity:0}.section[data-v-6b3a0b3a]{padding-top:80px}.sections[data-v-79a75e9e]{margin-left:auto;margin-right:auto;width:1536px;width:980px}@media only screen and (max-width:1250px){.sections[data-v-79a75e9e]{width:692px}}@media only screen and (max-width:735px){.sections[data-v-79a75e9e]{width:87.5%}}@media only screen and (max-width:320px){.sections[data-v-79a75e9e]{width:215px}}@media only screen and (max-width:735px){.sections[data-v-79a75e9e]{margin:0;width:100%}}.tutorial[data-v-f9aca85c]{background-color:var(--colors-text-background,var(--color-tutorial-background))} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/css/tutorials-overview.bab9a2e5.css b/Containers/Supporting Files/Help.bundle/css/tutorials-overview.bab9a2e5.css new file mode 100644 index 0000000..2e86bfa --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/css/tutorials-overview.bab9a2e5.css @@ -0,0 +1,9 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */.tutorials-navigation-link[data-v-e9f9b59c]{color:var(--color-tutorials-overview-navigation-link);transition:color .3s linear}.tutorials-navigation-link[data-v-e9f9b59c]:hover{text-decoration:none;transition:none;color:var(--color-tutorials-overview-navigation-link-hover)}.tutorials-navigation-link.active[data-v-e9f9b59c]{color:var(--color-tutorials-overview-navigation-link-active)}.tutorials-navigation-list[data-v-4e0180fa]{list-style-type:none;margin:0}.tutorials-navigation-list li+li[data-v-4e0180fa]:not(.volume--named){margin-top:24px}.tutorials-navigation-list .volume--named+.volume--named[data-v-4e0180fa]{margin-top:12px}.expand-enter-active,.expand-leave-active{transition:height .3s ease-in-out;overflow:hidden}.expand-enter,.expand-leave-to{height:0}.toggle[data-v-489416f8]{color:#f0f0f0;line-height:21px;display:flex;align-items:center;width:100%;font-weight:600;padding:6px 6px 6px 0;border-bottom:1px solid #2a2a2a;text-decoration:none;box-sizing:border-box}@media only screen and (max-width:767px){.toggle[data-v-489416f8]{padding-right:6px;border-bottom-color:hsla(0,0%,100%,.1)}}.toggle .text[data-v-489416f8]{word-break:break-word}.toggle[data-v-489416f8]:hover{text-decoration:none}.toggle .toggle-icon[data-v-489416f8]{display:inline-block;transition:transform .2s ease-in;height:.4em;width:.4em;margin-left:auto;margin-right:.2em}.collapsed .toggle .toggle-icon[data-v-489416f8]{transform:rotate(45deg)}.collapsed .toggle[data-v-489416f8],.collapsed .toggle[data-v-489416f8]:hover{color:#b0b0b0}.tutorials-navigation-menu-content[data-v-489416f8]{opacity:1;transition:height .2s ease-in,opacity .2s ease-in}.collapsed .tutorials-navigation-menu-content[data-v-489416f8]{height:0;opacity:0}.tutorials-navigation-menu-content .tutorials-navigation-list[data-v-489416f8]{padding:24px 0 12px 0}.tutorials-navigation[data-v-79093ed6]{font-size:1rem;line-height:1.2352941176;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.nav-title-content[data-v-854b4dd6]{max-width:100%}.title[data-v-854b4dd6]{color:var(--color-nav-root-title,currentColor);text-overflow:ellipsis;white-space:nowrap;overflow:hidden;display:inline-block;vertical-align:top;max-width:296px}@media only screen and (max-width:1023px){.title[data-v-854b4dd6]{max-width:205px}}@media only screen and (max-width:767px){.title[data-v-854b4dd6]{flex-basis:fill;display:initial;vertical-align:initial;max-width:none}}.subhead[data-v-854b4dd6]{color:var(--color-nav-root-subhead)}.theme-dark .subhead[data-v-854b4dd6]{color:var(--color-nav-dark-root-subhead)}.nav[data-v-54bcce6d] .nav-menu{padding-top:0}.nav[data-v-54bcce6d] .nav-menu .nav-menu-items{margin-left:auto}@media only screen and (min-width:768px){.nav[data-v-54bcce6d] .nav-menu .nav-menu-items .in-page-navigation{display:none}}@media only screen and (min-width:320px)and (max-width:735px){.nav[data-v-54bcce6d] .nav-menu .nav-menu-items{padding:18px 0 40px}}.hero[data-v-400ffab5]{margin-left:auto;margin-right:auto;width:1536px;width:980px;padding-bottom:4.7058823529rem;padding-top:4.7058823529rem}@media only screen and (max-width:1250px){.hero[data-v-400ffab5]{width:692px}}@media only screen and (max-width:735px){.hero[data-v-400ffab5]{width:87.5%}}@media only screen and (max-width:320px){.hero[data-v-400ffab5]{width:215px}}@media screen{.hero[data-v-400ffab5]{--color-fill:#fff;--color-fill-secondary:#f7f7f7;--color-fill-tertiary:#f0f0f0;--color-fill-quaternary:#282828;--color-fill-blue:#00f;--color-fill-light-blue-secondary:#d1d1ff;--color-fill-gray:#ccc;--color-fill-gray-secondary:#f5f5f5;--color-fill-gray-tertiary:#f0f0f0;--color-fill-gray-quaternary:#f0f0f0;--color-fill-green-secondary:#f0fff0;--color-fill-orange-secondary:#fffaf6;--color-fill-red-secondary:#fff0f5;--color-figure-blue:#36f;--color-figure-gray:#000;--color-figure-gray-secondary:#666;--color-figure-gray-secondary-alt:#666;--color-figure-gray-tertiary:#666;--color-figure-green:green;--color-figure-light-gray:#666;--color-figure-orange:#c30;--color-figure-red:red;--color-tutorials-teal:#000;--color-article-background:var(--color-fill-tertiary);--color-article-body-background:var(--color-fill);--color-aside-deprecated:var(--color-figure-gray);--color-aside-deprecated-background:var(--color-fill-orange-secondary);--color-aside-deprecated-border:var(--color-figure-orange);--color-aside-experiment:var(--color-figure-gray);--color-aside-experiment-background:var(--color-fill-gray-secondary);--color-aside-experiment-border:var(--color-figure-light-gray);--color-aside-important:var(--color-figure-gray);--color-aside-important-background:var(--color-fill-gray-secondary);--color-aside-important-border:var(--color-figure-light-gray);--color-aside-note:var(--color-figure-gray);--color-aside-note-background:var(--color-fill-gray-secondary);--color-aside-note-border:var(--color-figure-light-gray);--color-aside-tip:var(--color-figure-gray);--color-aside-tip-background:var(--color-fill-gray-secondary);--color-aside-tip-border:var(--color-figure-light-gray);--color-aside-warning:var(--color-figure-gray);--color-aside-warning-background:var(--color-fill-red-secondary);--color-aside-warning-border:var(--color-figure-red);--color-badge-text:#fff;--color-badge-default:var(--color-figure-gray);--color-badge-beta:var(--color-figure-gray-tertiary);--color-badge-deprecated:var(--color-figure-orange);--color-badge-dark-default:#fff;--color-badge-dark-beta:#b0b0b0;--color-badge-dark-deprecated:#f60;--color-button-background:var(--color-fill-blue);--color-button-background-active:#36f;--color-button-background-hover:var(--color-figure-blue);--color-button-text:#fff;--color-call-to-action-background:var(--color-fill-secondary);--color-changes-added:var(--color-figure-light-gray);--color-changes-added-hover:var(--color-figure-light-gray);--color-changes-deprecated:var(--color-figure-light-gray);--color-changes-deprecated-hover:var(--color-figure-light-gray);--color-changes-modified:var(--color-figure-light-gray);--color-changes-modified-hover:var(--color-figure-light-gray);--color-changes-modified-previous-background:var(--color-fill);--color-code-background:var(--color-fill-secondary);--color-code-collapsible-background:var(--color-fill-tertiary);--color-code-collapsible-text:var(--color-figure-gray-secondary-alt);--color-code-line-highlight:rgba(51,102,255,.08);--color-code-line-highlight-border:var(--color-figure-blue);--color-code-plain:var(--color-figure-gray);--color-dropdown-background:hsla(0,0%,100%,.8);--color-dropdown-border:#ccc;--color-dropdown-option-text:#666;--color-dropdown-text:#000;--color-dropdown-dark-background:hsla(0,0%,100%,.1);--color-dropdown-dark-border:hsla(0,0%,94%,.2);--color-dropdown-dark-option-text:#ccc;--color-dropdown-dark-text:#fff;--color-eyebrow:var(--color-figure-gray-secondary);--color-focus-border-color:var(--color-fill-blue);--color-focus-color:rgba(0,125,250,.6);--color-form-error:var(--color-figure-red);--color-form-error-background:var(--color-fill-red-secondary);--color-form-valid:var(--color-figure-green);--color-form-valid-background:var(--color-fill-green-secondary);--color-generic-modal-background:var(--color-fill);--color-grid:var(--color-fill-gray);--color-header-text:var(--color-figure-gray);--color-hero-eyebrow:#ccc;--color-link:var(--color-figure-blue);--color-loading-placeholder-background:var(--color-fill);--color-nav-color:#000;--color-nav-current-link:#000;--color-nav-expanded:#fff;--color-nav-hierarchy-collapse-background:#f0f0f0;--color-nav-hierarchy-collapse-borders:#ccc;--color-nav-hierarchy-item-borders:#ccc;--color-nav-keyline:rgba(0,0,0,.2);--color-nav-link-color:#000;--color-nav-link-color-hover:#36f;--color-nav-outlines:#ccc;--color-nav-rule:hsla(0,0%,94%,.5);--color-nav-solid-background:#fff;--color-nav-sticking-expanded-keyline:rgba(0,0,0,.1);--color-nav-stuck:hsla(0,0%,100%,.9);--color-nav-uiblur-expanded:hsla(0,0%,100%,.9);--color-nav-uiblur-stuck:hsla(0,0%,100%,.7);--color-nav-root-subhead:var(--color-tutorials-teal);--color-nav-dark-border-top-color:hsla(0,0%,100%,.4);--color-nav-dark-color:#fff;--color-nav-dark-current-link:#fff;--color-nav-dark-expanded:#2a2a2a;--color-nav-dark-hierarchy-collapse-background:#424242;--color-nav-dark-hierarchy-collapse-borders:#666;--color-nav-dark-hierarchy-item-borders:#424242;--color-nav-dark-keyline:rgba(66,66,66,.95);--color-nav-dark-link-color:#fff;--color-nav-dark-link-color-hover:#09f;--color-nav-dark-outlines:#575757;--color-nav-dark-rule:#575757;--color-nav-dark-solid-background:#000;--color-nav-dark-sticking-expanded-keyline:rgba(66,66,66,.7);--color-nav-dark-stuck:rgba(42,42,42,.9);--color-nav-dark-uiblur-expanded:rgba(42,42,42,.9);--color-nav-dark-uiblur-stuck:rgba(42,42,42,.7);--color-nav-dark-root-subhead:#fff;--color-other-decl-button:var(--color-text-background);--color-overviewcard-border:var(--color-fill);--color-overviewcard-fill:var(--color-fill-secondary);--color-overviewcard-fill-secondary:var(--color-fill-tertiary);--color-runtime-preview-background:var(--color-fill-tertiary);--color-runtime-preview-disabled-text:hsla(0,0%,40%,.6);--color-runtime-preview-text:var(--color-figure-gray-secondary);--color-secondary-label:var(--color-figure-gray-secondary);--color-step-background:var(--color-fill-secondary);--color-step-caption:var(--color-figure-gray-secondary);--color-step-focused:var(--color-figure-light-gray);--color-step-text:var(--color-figure-gray-secondary);--color-svg-icon:#666;--color-syntax-addition:var(--color-figure-green);--color-syntax-attributes:#947100;--color-syntax-characters:#272ad8;--color-syntax-comments:#707f8c;--color-syntax-deletion:var(--color-figure-red);--color-syntax-documentation-markup:#506375;--color-syntax-documentation-markup-keywords:#506375;--color-syntax-heading:#ba2da2;--color-syntax-highlighted:rgba(0,113,227,.2);--color-syntax-keywords:#ad3da4;--color-syntax-marks:#000;--color-syntax-numbers:#272ad8;--color-syntax-other-class-names:#703daa;--color-syntax-other-constants:#4b21b0;--color-syntax-other-declarations:#047cb0;--color-syntax-other-function-and-method-names:#4b21b0;--color-syntax-other-instance-variables-and-globals:#703daa;--color-syntax-other-preprocessor-macros:#78492a;--color-syntax-other-type-names:#703daa;--color-syntax-param-internal-name:#404040;--color-syntax-plain-text:#000;--color-syntax-preprocessor-statements:#78492a;--color-syntax-project-class-names:#3e8087;--color-syntax-project-constants:#2d6469;--color-syntax-project-function-and-method-names:#2d6469;--color-syntax-project-instance-variables-and-globals:#3e8087;--color-syntax-project-preprocessor-macros:#78492a;--color-syntax-project-type-names:#3e8087;--color-syntax-strings:#d12f1b;--color-syntax-type-declarations:#03638c;--color-syntax-urls:#1337ff;--color-tabnav-item-border-color:var(--color-fill-gray);--color-text:var(--color-figure-gray);--color-text-background:var(--color-fill);--color-tutorial-assessments-background:var(--color-fill-secondary);--color-tutorial-background:var(--color-fill);--color-tutorial-navbar-dropdown-background:var(--color-fill);--color-tutorial-navbar-dropdown-border:var(--color-fill-gray);--color-tutorial-quiz-border-active:var(--color-figure-blue);--color-tutorials-overview-background:#161616;--color-tutorials-overview-content:#fff;--color-tutorials-overview-content-alt:#fff;--color-tutorials-overview-eyebrow:#ccc;--color-tutorials-overview-icon:#b0b0b0;--color-tutorials-overview-link:#09f;--color-tutorials-overview-navigation-link:#ccc;--color-tutorials-overview-navigation-link-active:#fff;--color-tutorials-overview-navigation-link-hover:#fff;--color-tutorial-hero-text:#fff;--color-tutorial-hero-background:#000;--color-navigator-item-hover:rgba(0,0,255,.05);--color-card-background:var(--color-fill);--color-card-content-text:var(--color-figure-gray);--color-card-eyebrow:var(--color-figure-gray-secondary-alt);--color-card-shadow:rgba(0,0,0,.04);--color-link-block-card-border:rgba(0,0,0,.04);--color-standard-red:#ffc2c2;--color-standard-orange:#fc9;--color-standard-yellow:#ffe0a3;--color-standard-blue:#9cf;--color-standard-green:#9cc;--color-standard-purple:#ccf;--color-standard-gray:#f0f0f0;--color-fill:#000;--color-fill-secondary:#161616;--color-fill-tertiary:#2a2a2a;--color-fill-blue:#06f;--color-fill-light-blue-secondary:#004ec4;--color-fill-gray:#575757;--color-fill-gray-secondary:#222;--color-fill-gray-tertiary:#424242;--color-fill-gray-quaternary:#424242;--color-fill-green-secondary:#030;--color-fill-orange-secondary:#472400;--color-fill-red-secondary:#300;--color-figure-blue:#09f;--color-figure-gray:#fff;--color-figure-gray-secondary:#ccc;--color-figure-gray-secondary-alt:#b0b0b0;--color-figure-gray-tertiary:#b0b0b0;--color-figure-green:#090;--color-figure-light-gray:#b0b0b0;--color-figure-orange:#f60;--color-figure-red:#f33;--color-tutorials-teal:#fff;--color-article-body-background:#111;--color-badge-text:#000;--color-badge-default:var(--color-badge-dark-default);--color-button-background-active:#06f;--color-code-line-highlight:rgba(0,153,255,.08);--color-inline-code-background:transparent;--color-dropdown-background:var(--color-dropdown-dark-background);--color-dropdown-border:var(--color-dropdown-dark-border);--color-dropdown-option-text:var(--color-dropdown-dark-option-text);--color-dropdown-text:var(--color-dropdown-dark-text);--color-nav-color:var(--color-nav-dark-color);--color-nav-current-link:var(--color-nav-dark-current-link);--color-nav-expanded:var(--color-nav-dark-expanded);--color-nav-hierarchy-collapse-background:var(--color-nav-dark-hierarchy-collapse-background);--color-nav-hierarchy-collapse-borders:var(--color-nav-dark-hierarchy-collapse-borders);--color-nav-hierarchy-item-borders:var(--color-nav-dark-hierarchy-item-borders);--color-nav-keyline:var(--color-nav-dark-keyline);--color-nav-link-color:var(--color-nav-dark-link-color);--color-nav-link-color-hover:var(--color-nav-dark-link-color-hover);--color-nav-outlines:var(--color-nav-dark-outlines);--color-nav-rule:var(--color-nav-dark-rule);--color-nav-solid-background:var(--color-nav-dark-solid-background);--color-nav-sticking-expanded-keyline:var(--color-nav-dark-sticking-expanded-keyline);--color-nav-stuck:var(--color-nav-dark-stuck);--color-nav-uiblur-expanded:var(--color-nav-dark-uiblur-expanded);--color-nav-uiblur-stuck:var(--color-nav-dark-uiblur-stuck);--color-runtime-preview-disabled-text:hsla(0,0%,80%,.6);--color-syntax-attributes:#cc9768;--color-syntax-characters:#d9c97c;--color-syntax-comments:#7f8c98;--color-syntax-documentation-markup:#7f8c98;--color-syntax-documentation-markup-keywords:#a3b1bf;--color-syntax-highlighted:rgba(0,113,227,.6);--color-syntax-keywords:#ff7ab2;--color-syntax-marks:#fff;--color-syntax-numbers:#d9c97c;--color-syntax-other-class-names:#dabaff;--color-syntax-other-constants:#a7ebdd;--color-syntax-other-declarations:#4eb0cc;--color-syntax-other-function-and-method-names:#b281eb;--color-syntax-other-instance-variables-and-globals:#b281eb;--color-syntax-other-preprocessor-macros:#ffa14f;--color-syntax-other-type-names:#dabaff;--color-syntax-param-internal-name:#bfbfbf;--color-syntax-plain-text:#fff;--color-syntax-preprocessor-statements:#ffa14f;--color-syntax-project-class-names:#acf2e4;--color-syntax-project-constants:#78c2b3;--color-syntax-project-function-and-method-names:#78c2b3;--color-syntax-project-instance-variables-and-globals:#78c2b3;--color-syntax-project-preprocessor-macros:#ffa14f;--color-syntax-project-type-names:#acf2e4;--color-syntax-strings:#ff8170;--color-syntax-type-declarations:#6bdfff;--color-syntax-urls:#69f;--color-tutorial-background:var(--color-fill-tertiary);--color-navigator-item-hover:rgba(0,102,255,.5);--color-card-shadow:hsla(0,0%,100%,.04);--color-link-block-card-border:hsla(0,0%,100%,.25);--color-standard-red:#8b0000;--color-standard-orange:#8b4000;--color-standard-yellow:#8f7200;--color-standard-blue:#002d75;--color-standard-green:#023b2d;--color-standard-purple:#512b55;--color-standard-gray:#2a2a2a}}.copy-container[data-v-400ffab5]{margin:0 auto;text-align:center;width:720px}.title[data-v-400ffab5]{font-size:2.8235294118rem;line-height:1.0833333333;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-tutorials-overview-content)}@media only screen and (max-width:1250px){.title[data-v-400ffab5]{font-size:2.3529411765rem;line-height:1.1;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.title[data-v-400ffab5]{font-size:1.8823529412rem;line-height:1.125;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.content[data-v-400ffab5]{font-size:1.2352941176rem;line-height:1.380952381;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-tutorials-overview-content)}@media only screen and (max-width:735px){.content[data-v-400ffab5]{font-size:1.1176470588rem;line-height:1.4210526316;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.meta[data-v-400ffab5]{color:var(--color-tutorials-overview-content-alt);align-items:center;display:flex;justify-content:center}.meta-content[data-v-400ffab5]{font-size:.8235294118rem;line-height:1.4285714286;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.meta .timer-icon[data-v-400ffab5]{margin-right:.3529411765rem;height:16px;width:16px;fill:var(--color-tutorials-overview-icon)}@media only screen and (max-width:735px){.meta .timer-icon[data-v-400ffab5]{margin-right:.2941176471rem;height:.8235294118rem;width:.8235294118rem}}.meta .time[data-v-400ffab5]{font-size:1.1176470588rem;line-height:1.2105263158;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}@media only screen and (max-width:735px){.meta .time[data-v-400ffab5]{font-size:1rem;line-height:1.1176470588;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.title+.content[data-v-400ffab5]{margin-top:1.4705882353rem}.content+.meta[data-v-400ffab5]{margin-top:1.1764705882rem}.button-cta[data-v-400ffab5]{margin-top:1.7647058824rem}*+.asset[data-v-400ffab5]{margin-top:4.1176470588rem}@media only screen and (max-width:1250px){.copy-container[data-v-400ffab5]{width:636px}}@media only screen and (max-width:735px){.hero[data-v-400ffab5]{padding-bottom:1.7647058824rem;padding-top:2.3529411765rem}.copy-container[data-v-400ffab5]{width:100%}.title+.content[data-v-400ffab5]{margin-top:.8823529412rem}.button-cta[data-v-400ffab5]{margin-top:1.4117647059rem}*+.asset[data-v-400ffab5]{margin-top:2.2352941176rem}}.image[data-v-569db166]{margin-bottom:10px}.name[data-v-569db166]{font-size:1.8823529412rem;line-height:1.125;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-tutorials-overview-header-text,#f0f0f0);word-break:break-word}@media only screen and (max-width:1250px){.name[data-v-569db166]{font-size:1.6470588235rem;line-height:1.1428571429;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.name[data-v-569db166]{font-size:1.4117647059rem;line-height:1.1666666667;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.content[data-v-569db166]{font-size:1rem;line-height:1.2352941176;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-tutorials-overview-content-alt);margin-top:10px}.volume-name[data-v-569db166]{padding:50px 60px;text-align:center;background:var(--color-tutorials-overview-fill-secondary,#161616);margin:2px 0}@media only screen and (max-width:735px){.volume-name[data-v-569db166]{padding:40px 20px}}.document-icon[data-v-3a80772b]{margin-left:-3px}.tile[data-v-74dbeb68]{background:var(--color-tutorials-overview-fill-secondary,#161616);padding:40px 30px;color:var(--color-tutorials-overview-content-alt)}.content[data-v-74dbeb68] a,a[data-v-74dbeb68]{color:var(--colors-link,var(--color-tutorials-overview-link))}.icon[data-v-74dbeb68]{display:block;height:1.4705882353rem;line-height:1.4705882353rem;margin-bottom:.5882352941rem;width:1.4705882353rem}.icon[data-v-74dbeb68] svg.svg-icon{width:100%;max-height:100%;fill:var(--color-tutorials-overview-icon)}.icon[data-v-74dbeb68] svg.svg-icon .svg-icon-stroke{stroke:var(--color-tutorials-overview-content-alt)}.title[data-v-74dbeb68]{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:600;margin-bottom:.8em}.content[data-v-74dbeb68],.link[data-v-74dbeb68],.title[data-v-74dbeb68]{font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.content[data-v-74dbeb68],.link[data-v-74dbeb68]{font-size:.8235294118rem;line-height:1.4285714286;font-weight:400}.content[data-v-74dbeb68]{color:var(--color-tutorials-overview-content-alt)}.link[data-v-74dbeb68]{display:block;margin-top:1.1764705882rem}.link .link-icon[data-v-74dbeb68]{margin-left:.2em;width:.6em;height:.6em}[data-v-74dbeb68] .inline-link{text-decoration:none}[data-v-74dbeb68] .content ul{list-style-type:none;margin-left:0;font-size:.8235294118rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}[data-v-74dbeb68] .content ul li:before{content:"​";position:absolute}[data-v-74dbeb68] .content li+li{margin-top:8px}@media only screen and (max-width:735px){.tile[data-v-74dbeb68]{padding:1.7647058824rem 1.1764705882rem}}.tile-group[data-v-4cacce0a]{display:grid;grid-column-gap:2px;grid-row-gap:2px}.tile-group.count-1[data-v-4cacce0a]{grid-template-columns:1fr;text-align:center}.tile-group.count-1[data-v-4cacce0a] .icon{margin-left:auto;margin-right:auto}.tile-group.count-2[data-v-4cacce0a]{grid-template-columns:repeat(2,1fr)}.tile-group.count-3[data-v-4cacce0a]{grid-template-columns:repeat(3,1fr)}.tile-group.count-4[data-v-4cacce0a]{grid-template-columns:repeat(2,1fr);grid-template-rows:repeat(2,auto)}.tile-group.count-5[data-v-4cacce0a]{grid-template-columns:repeat(6,1fr);grid-template-rows:repeat(2,auto)}.tile-group.count-5 .tile[data-v-4cacce0a]{grid-column-end:span 2}.tile-group.count-5 .tile[data-v-4cacce0a]:nth-of-type(-n+2){grid-column-end:span 3}.tile-group.count-6[data-v-4cacce0a]{grid-template-columns:repeat(2,1fr);grid-template-rows:repeat(3,auto)}@media only screen and (min-width:768px)and (max-width:1250px){.tile-group.tile-group[data-v-4cacce0a]{grid-template-columns:1fr;grid-template-rows:auto}}@media only screen and (max-width:735px){.tile-group.count-1[data-v-4cacce0a],.tile-group.count-2[data-v-4cacce0a],.tile-group.count-3[data-v-4cacce0a],.tile-group.count-4[data-v-4cacce0a],.tile-group.count-5[data-v-4cacce0a],.tile-group.count-6[data-v-4cacce0a]{grid-template-columns:1fr;grid-template-rows:auto}}.title[data-v-7f8022c1]{font-size:1.8823529412rem;line-height:1.125;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:#f0f0f0}@media only screen and (max-width:1250px){.title[data-v-7f8022c1]{font-size:1.6470588235rem;line-height:1.1428571429;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}@media only screen and (max-width:735px){.title[data-v-7f8022c1]{font-size:1.4117647059rem;line-height:1.1666666667;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.content[data-v-7f8022c1]{font-size:1rem;line-height:1.2352941176;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:#b0b0b0;margin-top:10px}.topic-list[data-v-0589dc3b]{list-style-type:none;margin:50px 0 0 0;position:relative}.topic-list li[data-v-0589dc3b]:before{content:"​";position:absolute}.topic-list[data-v-0589dc3b]:before{content:"";border-left:1px solid var(--color-fill-quaternary);display:block;height:calc(100% - .88235rem);left:.8823529412rem;position:absolute;top:50%;transform:translateY(-50%);width:0}.topic[data-v-0589dc3b]{font-size:1rem;line-height:1.4705882353;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);display:flex;align-items:flex-start}@media only screen and (max-width:735px){.topic[data-v-0589dc3b]{font-size:.8235294118rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}}.topic+.topic[data-v-0589dc3b]{margin-top:.5882352941rem}.topic .topic-icon[data-v-0589dc3b]{background-color:var(--color-fill-quaternary);border-radius:50%;flex-shrink:0;height:1.7647058824rem;width:1.7647058824rem;margin-right:1.1764705882rem;position:relative;text-align:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:.4705882353rem;box-sizing:border-box;display:flex;justify-content:center;align-items:center}.topic .topic-icon svg[data-v-0589dc3b]{fill:var(--color-tutorials-overview-icon);max-width:100%;max-height:100%;width:100%}.container[data-v-0589dc3b]{align-items:baseline;display:flex;justify-content:space-between;width:100%;padding-top:.1176470588rem}.container[data-v-0589dc3b]:hover{text-decoration:none}.container:hover .link[data-v-0589dc3b]{text-decoration:underline}.timer-icon[data-v-0589dc3b]{margin-right:.2941176471rem;height:.7058823529rem;width:.7058823529rem;fill:var(--color-tutorials-overview-icon)}.time[data-v-0589dc3b]{font-size:.8235294118rem;line-height:1.2857142857;font-weight:400;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-tutorials-overview-content-alt);align-items:center;display:inline-flex}.link[data-v-0589dc3b]{padding-right:.5882352941rem;color:var(--colors-link,var(--color-tutorials-overview-link))}@media only screen and (min-width:768px)and (max-width:1250px){.topic-list[data-v-0589dc3b]{margin-top:2.3529411765rem}}@media only screen and (max-width:735px){.topic-list[data-v-0589dc3b]{margin-top:1.7647058824rem}.topic[data-v-0589dc3b]{height:auto;align-items:flex-start}.topic.no-time-estimate[data-v-0589dc3b]{align-items:center}.topic.no-time-estimate .topic-icon[data-v-0589dc3b]{align-self:flex-start;top:0}.topic+.topic[data-v-0589dc3b]{margin-top:1.1764705882rem}.topic .topic-icon[data-v-0589dc3b]{top:.2941176471rem;margin-right:.7647058824rem}.container[data-v-0589dc3b]{flex-wrap:wrap;padding-top:0}.link[data-v-0589dc3b],.time[data-v-0589dc3b]{flex-basis:100%}.time[data-v-0589dc3b]{margin-top:.2941176471rem}}.chapter[data-v-7468bc5e]:focus{outline:none!important}.info[data-v-7468bc5e]{align-items:center;display:flex;flex-wrap:wrap;justify-content:space-between}.name[data-v-7468bc5e]{font-size:1.2352941176rem;line-height:1.1904761905;font-weight:600;font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif);color:var(--color-tutorials-overview-header-text,#f0f0f0)}.name-text[data-v-7468bc5e]{word-break:break-word}.eyebrow[data-v-7468bc5e]{font-size:1rem;line-height:1.2352941176;font-weight:400;color:var(--color-tutorials-overview-eyebrow);display:block;font-weight:600;margin-bottom:5px}.content[data-v-7468bc5e],.eyebrow[data-v-7468bc5e]{font-family:var(--typography-html-font,"Helvetica Neue","Helvetica","Arial",sans-serif)}.content[data-v-7468bc5e]{font-size:.8235294118rem;line-height:1.4285714286;font-weight:400;color:var(--color-tutorials-overview-content-alt)}.asset[data-v-7468bc5e]{flex:0 0 190px}.intro[data-v-7468bc5e]{flex:0 1 360px}@media only screen and (min-width:768px)and (max-width:1250px){.asset[data-v-7468bc5e]{flex:0 0 130px}.intro[data-v-7468bc5e]{flex:0 1 260px}}@media only screen and (max-width:767px){.intro[data-v-7468bc5e]{flex:0 1 340px}}@media only screen and (max-width:735px){.info[data-v-7468bc5e]{display:block;text-align:center}.asset[data-v-7468bc5e]{margin:0 45px}.eyebrow[data-v-7468bc5e]{margin-bottom:7px}.intro[data-v-7468bc5e]{margin-top:40px}}.tile[data-v-540dbf10]{background:var(--color-tutorials-overview-fill-secondary,#161616);margin:2px 0;padding:50px 60px}.asset[data-v-540dbf10]{margin-bottom:10px}@media only screen and (min-width:768px)and (max-width:1250px){.tile[data-v-540dbf10]{padding:40px 30px}}@media only screen and (max-width:735px){.volume[data-v-540dbf10]{border-radius:0}.tile[data-v-540dbf10]{padding:40px 20px}}.learning-path[data-v-69a72bbc]{background:var(--color-tutorials-overview-fill,#000);padding:4.7058823529rem 0}.main-container[data-v-69a72bbc]{margin-left:auto;margin-right:auto;width:1536px;width:980px;align-items:stretch;display:flex;justify-content:space-between}@media only screen and (max-width:1250px){.main-container[data-v-69a72bbc]{width:692px}}@media only screen and (max-width:735px){.main-container[data-v-69a72bbc]{width:87.5%}}@media only screen and (max-width:320px){.main-container[data-v-69a72bbc]{width:215px}}.ide .main-container[data-v-69a72bbc]{justify-content:center}.secondary-content-container[data-v-69a72bbc]{flex:0 0 200px;width:200px}.tutorials-navigation[data-v-69a72bbc]{position:sticky;top:7.7647058824rem}.primary-content-container[data-v-69a72bbc]{flex:0 1 720px;max-width:100%}.content-sections-container .content-section[data-v-69a72bbc]{border-radius:12px;overflow:hidden}.content-sections-container .content-section+.content-section[data-v-69a72bbc]{margin-top:1.1764705882rem}@media only screen and (min-width:768px)and (max-width:1250px){.learning-path[data-v-69a72bbc]{padding:2.3529411765rem 0}.primary-content-container[data-v-69a72bbc]{flex-basis:auto;margin-left:1.2941176471rem}.secondary-content-container[data-v-69a72bbc]{flex:0 0 180px;width:180px}}@media only screen and (max-width:767px){.secondary-content-container[data-v-69a72bbc]{display:none}}@media only screen and (max-width:735px){.content-sections-container .content-section[data-v-69a72bbc]{border-radius:0}.content-sections-container .content-section.volume[data-v-69a72bbc]{margin-top:1.1764705882rem}.learning-path[data-v-69a72bbc]{padding:0}.main-container[data-v-69a72bbc]{width:100%}}body:has(.tutorials-overview){--color-text-background:#000}.tutorials-overview[data-v-5a621b2e]{background:#000;flex:1;height:100%}.tutorials-overview .radial-gradient[data-v-5a621b2e]{margin-top:-3.0588235294rem;padding-top:3.0588235294rem;background:var(--color-tutorials-overview-fill-secondary,var(--color-tutorials-overview-background))}@media only screen and (max-width:735px){.tutorials-overview .radial-gradient[data-v-5a621b2e]{margin-top:-2.8235294118rem;padding-top:2.8235294118rem}}@-moz-document url-prefix(){.tutorials-overview .radial-gradient[data-v-5a621b2e]{background:#111!important}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers.json new file mode 100644 index 0000000..94af0e4 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers.json @@ -0,0 +1 @@ +{"kind":"article","schemaVersion":{"minor":3,"major":0,"patch":0},"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/app.containers.Containers\/documentation\/Containers"},"topicSections":[{"title":"Essentials","identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/GettingStarted","doc:\/\/app.containers.Containers\/documentation\/Containers\/ExploringTheDashboard","doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails"],"anchor":"Essentials"},{"title":"Images and containers","identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithImages","doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithContainers"],"anchor":"Images-and-containers"},{"title":"Storage","identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingVolumes","doc:\/\/app.containers.Containers\/documentation\/Containers\/ChoosingWhereContainersStoresData"],"anchor":"Storage"},{"title":"Networking","identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingNetworks","doc:\/\/app.containers.Containers\/documentation\/Containers\/ReachingHostServicesWithDNSDomains"],"anchor":"Networking"},{"title":"Troubleshooting","identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ReviewingReports"],"anchor":"Troubleshooting"},{"title":"Articles","identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/UnderstandingHowContainersWorks"],"anchor":"Articles"}],"sections":[],"abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"primaryContentSections":[{"content":[{"text":"Overview","anchor":"Overview","type":"heading","level":2},{"type":"paragraph","inlineContent":[{"type":"text","text":"Containers brings everything you need to work with Linux containers in one place. It pulls images from a registry, builds them from a Dockerfile or loads them from a tar archive, and runs containers from them. You manage everything from a single dashboard, or from the menu bar."}]},{"type":"paragraph","inlineContent":[{"metadata":{"deviceFrame":"macbook-pro"},"type":"image","identifier":"dashboard-on-desktop"}]},{"type":"paragraph","inlineContent":[{"type":"text","text":"Each container runs in its own lightweight virtual machine, started directly by the app with Apple’s Containerization package. There’s no daemon, helper process or command-line tool to install."}]},{"type":"paragraph","inlineContent":[{"type":"text","text":"Containers is free and open source. Its code is on "},{"isActive":true,"type":"reference","identifier":"https:\/\/github.com\/try-containers\/Containers"},{"type":"text","text":", where you can report issues and contribute to both the app and this documentation."}]}],"kind":"content"}],"metadata":{"title":"Containers","role":"collection","color":{"standardColorIdentifier":"gray"}},"hierarchy":{"paths":[[]]},"references":{"doc://app.containers.Containers/documentation/Containers/ExploringTheDashboard":{"kind":"article","title":"Exploring the dashboard","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ExploringTheDashboard","role":"article","abstract":[{"text":"Find your way around the Containers dashboard and menu bar item.","type":"text"}],"url":"\/documentation\/containers\/exploringthedashboard","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ChoosingWhereContainersStoresData":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ChoosingWhereContainersStoresData","title":"Choosing where Containers stores data","role":"article","abstract":[{"text":"Keep your containers, images and volumes on another disk.","type":"text"}],"url":"\/documentation\/containers\/choosingwherecontainersstoresdata","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ReviewingReports":{"title":"Reviewing reports","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReviewingReports","url":"\/documentation\/containers\/reviewingreports","role":"article","abstract":[{"text":"Find out why a task failed or finished with a warning, using the reports Containers records.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers/WorkingWithImages":{"title":"Images","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithImages","url":"\/documentation\/containers\/workingwithimages","role":"collectionGroup","abstract":[{"text":"Get the images you run containers from, by pulling them from a registry, building them or loading them from an archive.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers/ManagingNetworks":{"title":"Managing networks","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingNetworks","url":"\/documentation\/containers\/managingnetworks","role":"article","abstract":[{"text":"Review the network your containers join, and how they reach the internet.","type":"text"}],"kind":"article"},"https://github.com/try-containers/Containers":{"identifier":"https:\/\/github.com\/try-containers\/Containers","title":"GitHub","type":"link","url":"https:\/\/github.com\/try-containers\/Containers","titleInlineContent":[{"text":"GitHub","type":"text"}]},"doc://app.containers.Containers/documentation/Containers/ViewingDetails":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails","title":"Viewing details","role":"article","abstract":[{"text":"Open an item in its own window to review it, read its full configuration, and work with it.","type":"text"}],"url":"\/documentation\/containers\/viewingdetails","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ReachingHostServicesWithDNSDomains":{"title":"Reaching containers and host services by name","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReachingHostServicesWithDNSDomains","url":"\/documentation\/containers\/reachinghostserviceswithdnsdomains","role":"article","abstract":[{"text":"Use DNS domains to reach your containers, and services running on your Mac, by name.","type":"text"}],"kind":"article"},"dashboard-on-desktop":{"identifier":"dashboard-on-desktop","alt":"A screenshot of a MacBook Pro running Containers, with the dashboard listing three containers with their state, image, IP address and uptime.","variants":[{"url":"\/images\/app.containers.Containers\/dashboard-on-desktop@2x.png","traits":["2x","light"]},{"url":"\/images\/app.containers.Containers\/dashboard-on-desktop~dark@2x.png","traits":["2x","dark"]}],"type":"image"},"doc://app.containers.Containers/documentation/Containers/WorkingWithContainers":{"kind":"article","title":"Containers","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithContainers","role":"collectionGroup","abstract":[{"text":"Create containers from your images, run them, and review what they’re doing.","type":"text"}],"url":"\/documentation\/containers\/workingwithcontainers","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ManagingVolumes":{"kind":"article","title":"Managing volumes","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingVolumes","role":"article","abstract":[{"text":"Create volumes to store data that outlasts the containers using it.","type":"text"}],"url":"\/documentation\/containers\/managingvolumes","type":"topic"},"doc://app.containers.Containers/documentation/Containers/GettingStarted":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/GettingStarted","title":"Getting started with Containers","role":"article","abstract":[{"text":"Install Containers, set up the container system, and start working with images and containers.","type":"text"}],"url":"\/documentation\/containers\/gettingstarted","type":"topic"},"doc://app.containers.Containers/documentation/Containers/UnderstandingHowContainersWorks":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/UnderstandingHowContainersWorks","title":"Understanding how Containers works","role":"article","abstract":[{"text":"Learn how Containers runs each container in its own virtual machine, and what happens inside the app.","type":"text"}],"url":"\/documentation\/containers\/understandinghowcontainersworks","type":"topic"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/buildinganimagefromadockerfile.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/buildinganimagefromadockerfile.json new file mode 100644 index 0000000..973580c --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/buildinganimagefromadockerfile.json @@ -0,0 +1 @@ +{"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/BuildingAnImageFromADockerfile"},"seeAlsoSections":[{"title":"Related Documentation","identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/PullingAnImage","doc:\/\/app.containers.Containers\/documentation\/Containers\/LoadingAndSavingImages"],"anchor":"Related-Documentation"},{"generated":true,"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/PullingAnImage","doc:\/\/app.containers.Containers\/documentation\/Containers\/LoadingAndSavingImages"]}],"abstract":[{"text":"Create your own image from a Dockerfile and the files it uses.","type":"text"}],"metadata":{"title":"Building an image from a Dockerfile","roleHeading":"Article","role":"article"},"sections":[],"schemaVersion":{"minor":3,"major":0,"patch":0},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers","doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithImages"]]},"kind":"article","primaryContentSections":[{"content":[{"level":2,"text":"Overview","type":"heading","anchor":"Overview"},{"type":"paragraph","inlineContent":[{"text":"A Dockerfile is a text file that lists the steps to build an image, such as which image to start from, which files to copy in and which commands to run. Containers builds images with BuildKit, which runs in a builder container that Containers manages for you.","type":"text"}]},{"level":3,"text":"Build an image","type":"heading","anchor":"Build-an-image"},{"items":[{"content":[{"type":"paragraph","inlineContent":[{"text":"In the Images section of the dashboard, click the Add button in the toolbar.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Select Build from Dockerfile, then click Next.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Choose the Dockerfile to build.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Choose the build directory. This is the folder that the Dockerfile’s ","type":"text"},{"type":"codeVoice","code":"COPY"},{"text":" and ","type":"text"},{"type":"codeVoice","code":"ADD"},{"text":" instructions read files from. It’s usually the folder that contains the Dockerfile.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"In Image name, enter a name for the image, such as ","type":"text"},{"type":"codeVoice","code":"my-app"},{"text":" or ","type":"text"},{"type":"codeVoice","code":"my-app:dev"},{"text":".","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Optionally, enter a target stage to stop at a named stage of a multi-stage Dockerfile, such as ","type":"text"},{"type":"codeVoice","code":"production"},{"text":".","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Optionally, choose the platform to build for.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Click Create.","type":"text"}]}]}],"type":"orderedList"},{"type":"paragraph","inlineContent":[{"text":"The new image appears in the Images section, and its row shows the progress of each build step.","type":"text"}]},{"type":"paragraph","inlineContent":[{"type":"image","identifier":"build-image"}]},{"level":3,"text":"Fix a failed build","type":"heading","anchor":"Fix-a-failed-build"},{"type":"paragraph","inlineContent":[{"text":"If the build fails, Containers shows what went wrong. Click Show Details to see the full output of the build, then fix your Dockerfile and build again.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"Containers also records a report for every failed build. For more information, see ","type":"text"},{"type":"reference","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReviewingReports","isActive":true},{"text":".","type":"text"}]}],"kind":"content"}],"references":{"doc://app.containers.Containers/documentation/Containers/LoadingAndSavingImages":{"title":"Loading and saving images","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/LoadingAndSavingImages","url":"\/documentation\/containers\/loadingandsavingimages","role":"article","abstract":[{"text":"Move images between Macs, or share them without a registry, using tar archives.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers/ReviewingReports":{"title":"Reviewing reports","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReviewingReports","url":"\/documentation\/containers\/reviewingreports","role":"article","abstract":[{"text":"Find out why a task failed or finished with a warning, using the reports Containers records.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers/PullingAnImage":{"kind":"article","title":"Pulling an image","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/PullingAnImage","role":"article","abstract":[{"text":"Download an image from a registry and add it to your library.","type":"text"}],"url":"\/documentation\/containers\/pullinganimage","type":"topic"},"doc://app.containers.Containers/documentation/Containers/WorkingWithImages":{"title":"Images","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithImages","url":"\/documentation\/containers\/workingwithimages","role":"collectionGroup","abstract":[{"text":"Get the images you run containers from, by pulling them from a registry, building them or loading them from an archive.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"},"build-image":{"variants":[{"traits":["2x","light"],"url":"\/images\/app.containers.Containers\/build-image@2x.png"},{"traits":["2x","dark"],"url":"\/images\/app.containers.Containers\/build-image~dark@2x.png"}],"type":"image","identifier":"build-image","alt":"A screenshot of the options for building an image, showing the Dockerfile, the build directory, the image name my-app, the platform, and the target stage production."}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/choosingwherecontainersstoresdata.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/choosingwherecontainersstoresdata.json new file mode 100644 index 0000000..bd28128 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/choosingwherecontainersstoresdata.json @@ -0,0 +1 @@ +{"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ChoosingWhereContainersStoresData"},"seeAlsoSections":[{"title":"Related Documentation","identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingVolumes"],"anchor":"Related-Documentation"},{"title":"Storage","generated":true,"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingVolumes"],"anchor":"Storage"}],"abstract":[{"text":"Keep your containers, images and volumes on another disk.","type":"text"}],"metadata":{"title":"Choosing where Containers stores data","roleHeading":"Article","role":"article"},"sections":[],"schemaVersion":{"minor":3,"major":0,"patch":0},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers"]]},"kind":"article","primaryContentSections":[{"content":[{"level":2,"text":"Overview","type":"heading","anchor":"Overview"},{"type":"paragraph","inlineContent":[{"text":"Containers keeps all its data in one folder: containers, images, volumes, networks, the Linux kernel, and build data. By default, this folder is in your Library folder, on your startup disk.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"Images and volumes can take up a lot of space. To keep them on another disk, such as an external drive, change the storage location.","type":"text"}]},{"level":3,"text":"Change the storage location","type":"heading","anchor":"Change-the-storage-location"},{"items":[{"content":[{"type":"paragraph","inlineContent":[{"text":"Choose Containers > Settings, then click Container System.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Under Location, click Change.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Choose the folder where Containers stores its data, then click Choose.","type":"text"}]}]}],"type":"orderedList"},{"type":"paragraph","inlineContent":[{"text":"The change takes effect the next time the container system starts. To go back to the default folder, click Reset. You can change the storage location only while the container system is stopped: while it runs, the Container System pane asks you to stop it first.","type":"text"}]},{"type":"aside","name":"Important","style":"important","content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"Containers only finds the data in the current storage location. Data in the previous location isn’t moved or deleted."}]}]}],"kind":"content"}],"references":{"doc://app.containers.Containers/documentation/Containers/ManagingVolumes":{"kind":"article","title":"Managing volumes","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingVolumes","role":"article","abstract":[{"text":"Create volumes to store data that outlasts the containers using it.","type":"text"}],"url":"\/documentation\/containers\/managingvolumes","type":"topic"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/exploringthedashboard.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/exploringthedashboard.json new file mode 100644 index 0000000..72dcd61 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/exploringthedashboard.json @@ -0,0 +1 @@ +{"kind":"article","identifier":{"url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ExploringTheDashboard","interfaceLanguage":"swift"},"schemaVersion":{"minor":3,"major":0,"patch":0},"seeAlsoSections":[{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/GettingStarted","doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails"],"title":"Essentials","generated":true,"anchor":"Essentials"}],"sections":[],"abstract":[{"text":"Find your way around the Containers dashboard and menu bar item.","type":"text"}],"primaryContentSections":[{"kind":"content","content":[{"level":2,"text":"Overview","type":"heading","anchor":"Overview"},{"type":"paragraph","inlineContent":[{"text":"The dashboard is where you manage everything in Containers. A sidebar lists its sections, and each section shows its items in a table.","type":"text"}]},{"type":"paragraph","inlineContent":[{"type":"image","identifier":"dashboard"}]},{"level":3,"text":"Switch between sections","type":"heading","anchor":"Switch-between-sections"},{"type":"paragraph","inlineContent":[{"text":"The sidebar has these sections:","type":"text"}]},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Containers","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Your containers, with their state, image, IP address and uptime."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Images","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The images in your library, with their tag and digest."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Volumes","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Your volumes, with their size, type and whether a container uses them."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Reports","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Under Activity, records of tasks that failed or finished with a warning. For more information, see "},{"identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReviewingReports","type":"reference","isActive":true},{"type":"text","text":"."}],"type":"paragraph"}]}}]},{"type":"paragraph","inlineContent":[{"text":"Containers remembers the last section you opened, and returns to it the next time you open the dashboard.","type":"text"}]},{"level":3,"text":"Actions","type":"heading","anchor":"Actions"},{"type":"paragraph","inlineContent":[{"text":"Select one or more rows, then use the buttons in the toolbar to work with them. The buttons depend on the section:","type":"text"}]},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Containers","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Start, stop, show details for, or delete the selected containers."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Images","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Run a container from the selected image, show its details, or delete it."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Volumes and Reports","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Show details for, or delete, the selected items."}],"type":"paragraph"}]}}]},{"type":"paragraph","inlineContent":[{"text":"Double-click a row to open its details in a separate window.","type":"text"}]},{"level":3,"text":"Search and filter","type":"heading","anchor":"Search-and-filter"},{"type":"paragraph","inlineContent":[{"text":"Type in the search field in the toolbar to filter the current section. As you type, Containers suggests tokens that limit your search to a single column, such as a name or a state.","type":"text"}]},{"level":3,"text":"Follow tasks as they run","type":"heading","anchor":"Follow-tasks-as-they-run"},{"type":"paragraph","inlineContent":[{"text":"Tasks that take a while, such as pulling an image or starting a container, show their progress on the item’s row. You can keep working in the dashboard while they run.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"If a task fails, the row shows an error indicator. Containers records a report about it, and about tasks that finish with a warning. The number next to Reports in the sidebar shows how many reports you haven’t read.","type":"text"}]},{"level":3,"text":"Check resource usage","type":"heading","anchor":"Check-resource-usage"},{"type":"paragraph","inlineContent":[{"text":"The status bar at the bottom of the dashboard shows the resource usage of your running containers:","type":"text"}]},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"CPU","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The processor use of your containers, as a percentage."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Memory","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The memory your containers use. Hold the pointer over it to see how much they can use."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Network","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The data your containers receive and send."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Disk","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The data your containers read from and write to disk."}],"type":"paragraph"}]}}]},{"type":"paragraph","inlineContent":[{"text":"Hold the pointer over a reading to see its details. The readings update while the dashboard is visible.","type":"text"}]},{"level":3,"text":"Use the menu bar item","type":"heading","anchor":"Use-the-menu-bar-item"},{"type":"paragraph","inlineContent":[{"text":"Containers adds an item to the menu bar, so you can control it while you work in other apps. Click it to:","type":"text"}]},{"type":"unorderedList","items":[{"content":[{"type":"paragraph","inlineContent":[{"text":"See whether the container system is running.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Open the dashboard (Command-D) or Settings (Command-Comma).","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Start, stop or reload the container system.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Quit Containers (Command-Q).","type":"text"}]}]}]},{"type":"paragraph","inlineContent":[{"text":"The item’s icon is filled while the container system is running.","type":"text"}]},{"level":3,"text":"Choose where Containers appears","type":"heading","anchor":"Choose-where-Containers-appears"},{"type":"paragraph","inlineContent":[{"text":"Containers shows its icon in the Dock and its item in the menu bar. To show only one of them:","type":"text"}]},{"type":"orderedList","items":[{"content":[{"type":"paragraph","inlineContent":[{"text":"Choose Containers > Settings, then click General.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Next to “Show Containers in”, choose Dock and Menu Bar, Dock Only or Menu Bar Only.","type":"text"}]}]}]},{"type":"paragraph","inlineContent":[{"text":"If you remove the item from the menu bar another way, such as in System Settings, Containers keeps its icon in the Dock, so you can always get back to it.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"To have Containers open when you log in, turn on “Open at login” in the same pane.","type":"text"}]}]}],"metadata":{"title":"Exploring the dashboard","roleHeading":"Article","role":"article"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers"]]},"references":{"doc://app.containers.Containers/documentation/Containers/ReviewingReports":{"title":"Reviewing reports","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReviewingReports","url":"\/documentation\/containers\/reviewingreports","role":"article","abstract":[{"text":"Find out why a task failed or finished with a warning, using the reports Containers records.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers/GettingStarted":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/GettingStarted","title":"Getting started with Containers","role":"article","abstract":[{"text":"Install Containers, set up the container system, and start working with images and containers.","type":"text"}],"url":"\/documentation\/containers\/gettingstarted","type":"topic"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ViewingDetails":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails","title":"Viewing details","role":"article","abstract":[{"text":"Open an item in its own window to review it, read its full configuration, and work with it.","type":"text"}],"url":"\/documentation\/containers\/viewingdetails","type":"topic"},"dashboard":{"identifier":"dashboard","alt":"A screenshot of the Containers dashboard. The sidebar lists the Containers, Images, Volumes and Reports sections, and the Containers section shows three containers with their state, image, IP address and uptime.","variants":[{"url":"\/images\/app.containers.Containers\/dashboard@2x.png","traits":["2x","light"]},{"url":"\/images\/app.containers.Containers\/dashboard~dark@2x.png","traits":["2x","dark"]}],"type":"image"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/gettingstarted.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/gettingstarted.json new file mode 100644 index 0000000..61b9054 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/gettingstarted.json @@ -0,0 +1 @@ +{"kind":"article","schemaVersion":{"minor":3,"major":0,"patch":0},"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/GettingStarted"},"seeAlsoSections":[{"title":"Essentials","generated":true,"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ExploringTheDashboard","doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails"],"anchor":"Essentials"}],"sections":[],"abstract":[{"text":"Install Containers, set up the container system, and start working with images and containers.","type":"text"}],"primaryContentSections":[{"content":[{"level":2,"text":"Overview","type":"heading","anchor":"Overview"},{"type":"paragraph","inlineContent":[{"text":"Containers needs a Mac with Apple silicon running macOS 26 or later. Download it for free from the Mac App Store.","type":"text"}]},{"level":3,"text":"Set up the container system","type":"heading","anchor":"Set-up-the-container-system"},{"type":"paragraph","inlineContent":[{"text":"The first time you open Containers, it sets up the container system: it downloads the Linux kernel and the init image that every container’s virtual machine boots from, then opens the dashboard. Keep your Mac connected to the internet until setup finishes. If the folder it uses has no default kernel, Containers asks before it installs the recommended one: click Install.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"If setup fails, Containers shows what went wrong. Choose Try Again to restart it.","type":"text"}]},{"level":3,"text":"Start and stop the container system","type":"heading","anchor":"Start-and-stop-the-container-system"},{"type":"paragraph","inlineContent":[{"text":"The container system starts when you open Containers. To start it yourself instead, choose Containers > Settings, click General, then turn off “Start the container system when Containers opens”.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"While the container system is stopped, you can’t work with your containers, images or volumes. They appear in the dashboard while the container system is running.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"To start or stop the container system, do one of the following, then choose Start or Stop:","type":"text"}]},{"items":[{"content":[{"type":"paragraph","inlineContent":[{"text":"In the status bar at the bottom of the dashboard, click the system’s status, such as System running.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Click the Containers item in the menu bar.","type":"text"}]}]}],"type":"unorderedList"},{"type":"paragraph","inlineContent":[{"text":"Choose Reload to restart the container system.","type":"text"}]},{"type":"paragraph","inlineContent":[{"type":"image","identifier":"status-bar-menu"}]},{"type":"aside","name":"Note","style":"note","content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"Stopping the container system stops every container that’s running."}]}]},{"type":"paragraph","inlineContent":[{"text":"If the container system can’t start, the dashboard shows what went wrong. Click Try Again to start it again, or, when a setting needs to change first, click Open Settings.","type":"text"}]},{"level":3,"text":"Next steps","type":"heading","anchor":"Next-steps"},{"type":"paragraph","inlineContent":[{"text":"Add an image to your library, then run a container from it:","type":"text"}]},{"items":[{"content":[{"type":"paragraph","inlineContent":[{"isActive":true,"identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/PullingAnImage","type":"reference"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"isActive":true,"identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","type":"reference"}]}]}],"type":"unorderedList"}],"kind":"content"}],"metadata":{"title":"Getting started with Containers","roleHeading":"Article","role":"article"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers"]]},"references":{"status-bar-menu":{"variants":[{"traits":["2x","light"],"url":"\/images\/app.containers.Containers\/status-bar-menu@2x.png"},{"traits":["2x","dark"],"url":"\/images\/app.containers.Containers\/status-bar-menu~dark@2x.png"}],"type":"image","identifier":"status-bar-menu","alt":"A screenshot of the Containers dashboard, with the menu that opens from System running in the status bar, showing the Settings, Stop, Reload and Quit commands."},"doc://app.containers.Containers/documentation/Containers/ExploringTheDashboard":{"kind":"article","title":"Exploring the dashboard","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ExploringTheDashboard","role":"article","abstract":[{"text":"Find your way around the Containers dashboard and menu bar item.","type":"text"}],"url":"\/documentation\/containers\/exploringthedashboard","type":"topic"},"doc://app.containers.Containers/documentation/Containers/PullingAnImage":{"kind":"article","title":"Pulling an image","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/PullingAnImage","role":"article","abstract":[{"text":"Download an image from a registry and add it to your library.","type":"text"}],"url":"\/documentation\/containers\/pullinganimage","type":"topic"},"doc://app.containers.Containers/documentation/Containers/RunningAContainer":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","title":"Running a container","role":"article","abstract":[{"text":"Create a container from an image, configure it, and start it.","type":"text"}],"url":"\/documentation\/containers\/runningacontainer","type":"topic"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ViewingDetails":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails","title":"Viewing details","role":"article","abstract":[{"text":"Open an item in its own window to review it, read its full configuration, and work with it.","type":"text"}],"url":"\/documentation\/containers\/viewingdetails","type":"topic"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/loadingandsavingimages.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/loadingandsavingimages.json new file mode 100644 index 0000000..88e0ae9 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/loadingandsavingimages.json @@ -0,0 +1 @@ +{"kind":"article","schemaVersion":{"minor":3,"major":0,"patch":0},"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/LoadingAndSavingImages"},"seeAlsoSections":[{"title":"Related Documentation","identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/PullingAnImage","doc:\/\/app.containers.Containers\/documentation\/Containers\/BuildingAnImageFromADockerfile","doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails"],"anchor":"Related-Documentation"},{"generated":true,"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/PullingAnImage","doc:\/\/app.containers.Containers\/documentation\/Containers\/BuildingAnImageFromADockerfile"]}],"sections":[],"abstract":[{"text":"Move images between Macs, or share them without a registry, using tar archives.","type":"text"}],"primaryContentSections":[{"content":[{"text":"Overview","anchor":"Overview","type":"heading","level":2},{"type":"paragraph","inlineContent":[{"type":"text","text":"You can save any image in your library as an OCI tar archive, and load images from an archive into your library. This is useful for sharing an image with someone, or for keeping a copy of an image outside Containers."}]},{"text":"Load an image from a tar archive","anchor":"Load-an-image-from-a-tar-archive","type":"heading","level":3},{"type":"orderedList","items":[{"content":[{"inlineContent":[{"type":"text","text":"In the Images section of the dashboard, click the Add button in the toolbar."}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"Select Load from Tar, then click Next."}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"Choose the tar archive that contains the image."}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"Click Create."}],"type":"paragraph"}]}]},{"type":"paragraph","inlineContent":[{"type":"text","text":"If the archive contains paths that Containers rejects, the load fails. To load the images anyway, select Force load before you click Create."}]},{"text":"Save an image as a tar archive","anchor":"Save-an-image-as-a-tar-archive","type":"heading","level":3},{"type":"orderedList","items":[{"content":[{"inlineContent":[{"type":"text","text":"In the Images section of the dashboard, double-click the image to open its details."}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"Click Save in the toolbar."}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"If the image has variants for several platforms, choose the one to save."}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"Choose where to save the archive, then click Save."}],"type":"paragraph"}]}]}],"kind":"content"}],"metadata":{"title":"Loading and saving images","roleHeading":"Article","role":"article"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers","doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithImages"]]},"references":{"doc://app.containers.Containers/documentation/Containers/PullingAnImage":{"kind":"article","title":"Pulling an image","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/PullingAnImage","role":"article","abstract":[{"text":"Download an image from a registry and add it to your library.","type":"text"}],"url":"\/documentation\/containers\/pullinganimage","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ViewingDetails":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails","title":"Viewing details","role":"article","abstract":[{"text":"Open an item in its own window to review it, read its full configuration, and work with it.","type":"text"}],"url":"\/documentation\/containers\/viewingdetails","type":"topic"},"doc://app.containers.Containers/documentation/Containers/WorkingWithImages":{"title":"Images","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithImages","url":"\/documentation\/containers\/workingwithimages","role":"collectionGroup","abstract":[{"text":"Get the images you run containers from, by pulling them from a registry, building them or loading them from an archive.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers/BuildingAnImageFromADockerfile":{"title":"Building an image from a Dockerfile","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/BuildingAnImageFromADockerfile","url":"\/documentation\/containers\/buildinganimagefromadockerfile","role":"article","abstract":[{"text":"Create your own image from a Dockerfile and the files it uses.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/managingnetworks.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/managingnetworks.json new file mode 100644 index 0000000..08f4aa0 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/managingnetworks.json @@ -0,0 +1 @@ +{"kind":"article","identifier":{"url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingNetworks","interfaceLanguage":"swift"},"schemaVersion":{"minor":3,"major":0,"patch":0},"seeAlsoSections":[{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ReachingHostServicesWithDNSDomains","doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer"],"title":"Related Documentation","anchor":"Related-Documentation"},{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ReachingHostServicesWithDNSDomains"],"title":"Networking","generated":true,"anchor":"Networking"}],"sections":[],"abstract":[{"text":"Review the network your containers join, and how they reach the internet.","type":"text"}],"primaryContentSections":[{"kind":"content","content":[{"level":2,"text":"Overview","type":"heading","anchor":"Overview"},{"type":"paragraph","inlineContent":[{"text":"Each container joins a virtual network, where it gets its own IP address. Containers sets up a network named ","type":"text"},{"code":"default","type":"codeVoice"},{"text":" for you, and every container joins it. The ","type":"text"},{"code":"default","type":"codeVoice"},{"text":" network uses NAT, so its containers reach the internet through your Mac.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"Networks are kept in the storage folder.","type":"text"}]},{"level":3,"text":"Review your network","type":"heading","anchor":"Review-your-network"},{"type":"paragraph","inlineContent":[{"text":"Choose Containers > Settings, then click Network. Networks shows the ","type":"text"},{"code":"default","type":"codeVoice"},{"text":" network with its subnet, and an icon that shows its containers reach the internet.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"The container system needs to be running to show its networks.","type":"text"}]},{"level":3,"text":"Custom networks","type":"heading","anchor":"Custom-networks"},{"type":"paragraph","inlineContent":[{"text":"Containers doesn’t currently support custom networks, so you can’t create or delete networks. Custom networks need a special permission from Apple for apps on the Mac App Store, which Containers doesn’t have yet. We’re working on getting it in a future update.","type":"text"}]}]}],"metadata":{"title":"Managing networks","roleHeading":"Article","role":"article"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers"]]},"references":{"doc://app.containers.Containers/documentation/Containers/ReachingHostServicesWithDNSDomains":{"title":"Reaching containers and host services by name","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReachingHostServicesWithDNSDomains","url":"\/documentation\/containers\/reachinghostserviceswithdnsdomains","role":"article","abstract":[{"text":"Use DNS domains to reach your containers, and services running on your Mac, by name.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers/RunningAContainer":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","title":"Running a container","role":"article","abstract":[{"text":"Create a container from an image, configure it, and start it.","type":"text"}],"url":"\/documentation\/containers\/runningacontainer","type":"topic"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/managingvolumes.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/managingvolumes.json new file mode 100644 index 0000000..165faf2 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/managingvolumes.json @@ -0,0 +1 @@ +{"kind":"article","identifier":{"interfaceLanguage":"swift","url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingVolumes"},"schemaVersion":{"major":0,"minor":3,"patch":0},"seeAlsoSections":[{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer"],"title":"Related Documentation","anchor":"Related-Documentation"},{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ChoosingWhereContainersStoresData"],"title":"Storage","generated":true,"anchor":"Storage"}],"sections":[],"abstract":[{"text":"Create volumes to store data that outlasts the containers using it.","type":"text"}],"primaryContentSections":[{"kind":"content","content":[{"text":"Overview","anchor":"Overview","type":"heading","level":2},{"type":"paragraph","inlineContent":[{"text":"A volume is storage that Containers manages for you. Unlike a container’s own filesystem, a volume keeps its data when you delete the container, and you can attach it to another container later. Use volumes for data such as databases.","type":"text"}]},{"text":"Create a volume","anchor":"Create-a-volume","type":"heading","level":3},{"type":"orderedList","items":[{"content":[{"type":"paragraph","inlineContent":[{"text":"In the Volumes section of the dashboard, click the Add button in the toolbar.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Configure the volume in the General and Options tabs. Only the name is required.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Click Create.","type":"text"}]}]}]},{"type":"paragraph","inlineContent":[{"text":"To use the volume, attach it when you create a container. For more information, see ","type":"text"},{"type":"reference","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","isActive":true},{"text":".","type":"text"}]},{"type":"paragraph","inlineContent":[{"type":"image","identifier":"create-volume"}]},{"text":"Configure the volume","anchor":"Configure-the-volume","type":"heading","level":3},{"type":"paragraph","inlineContent":[{"text":"The options are grouped in two tabs, the same way the sheet shows them.","type":"text"}]},{"text":"General","anchor":"General","type":"heading","level":4},{"type":"termList","items":[{"definition":{"content":[{"inlineContent":[{"type":"text","text":"The volume’s name. Names start with a letter or number, and can contain only letters, numbers, underscores, periods and hyphens."}],"type":"paragraph"}]},"term":{"inlineContent":[{"text":"Name","type":"text"}]}},{"definition":{"content":[{"inlineContent":[{"type":"text","text":"The volume’s maximum size, in the unit you choose. Disk space is used as data is written, not reserved when you create the volume."}],"type":"paragraph"}]},"term":{"inlineContent":[{"text":"Size","type":"text"}]}}]},{"text":"Options","anchor":"Options","type":"heading","level":4},{"type":"termList","items":[{"definition":{"content":[{"inlineContent":[{"type":"text","text":"Keys and values that help you organize your volumes."}],"type":"paragraph"}]},"term":{"inlineContent":[{"text":"Labels","type":"text"}]}},{"definition":{"content":[{"inlineContent":[{"type":"text","text":"Keys and values passed to the volume’s driver."}],"type":"paragraph"}]},"term":{"inlineContent":[{"text":"Driver Options","type":"text"}]}}]},{"text":"Review a volume","anchor":"Review-a-volume","type":"heading","level":3},{"type":"paragraph","inlineContent":[{"text":"The Volumes section shows whether each volume is in use by a container. Double-click a volume to see its details. For more information, see ","type":"text"},{"type":"reference","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails","isActive":true},{"text":".","type":"text"}]},{"text":"Delete a volume","anchor":"Delete-a-volume","type":"heading","level":3},{"type":"paragraph","inlineContent":[{"text":"Select one or more volumes, then click Delete in the toolbar.","type":"text"}]},{"style":"important","type":"aside","content":[{"type":"paragraph","inlineContent":[{"type":"text","text":"Deleting a volume deletes all the data in it."}]}],"name":"Important"}]}],"metadata":{"roleHeading":"Article","role":"article","title":"Managing volumes"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers"]]},"references":{"doc://app.containers.Containers/documentation/Containers/ChoosingWhereContainersStoresData":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ChoosingWhereContainersStoresData","title":"Choosing where Containers stores data","role":"article","abstract":[{"text":"Keep your containers, images and volumes on another disk.","type":"text"}],"url":"\/documentation\/containers\/choosingwherecontainersstoresdata","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ViewingDetails":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails","title":"Viewing details","role":"article","abstract":[{"text":"Open an item in its own window to review it, read its full configuration, and work with it.","type":"text"}],"url":"\/documentation\/containers\/viewingdetails","type":"topic"},"doc://app.containers.Containers/documentation/Containers/RunningAContainer":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","title":"Running a container","role":"article","abstract":[{"text":"Create a container from an image, configure it, and start it.","type":"text"}],"url":"\/documentation\/containers\/runningacontainer","type":"topic"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"},"create-volume":{"type":"image","identifier":"create-volume","variants":[{"url":"\/images\/app.containers.Containers\/create-volume@2x.png","traits":["2x","light"]},{"url":"\/images\/app.containers.Containers\/create-volume~dark@2x.png","traits":["2x","dark"]}],"alt":"A screenshot of the sheet for creating a volume, with the name db-data and a maximum size of 20 GB."}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/pullinganimage.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/pullinganimage.json new file mode 100644 index 0000000..a9ea7b0 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/pullinganimage.json @@ -0,0 +1 @@ +{"identifier":{"url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/PullingAnImage","interfaceLanguage":"swift"},"seeAlsoSections":[{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/BuildingAnImageFromADockerfile","doc:\/\/app.containers.Containers\/documentation\/Containers\/LoadingAndSavingImages","doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer"],"title":"Related Documentation","anchor":"Related-Documentation"},{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/BuildingAnImageFromADockerfile","doc:\/\/app.containers.Containers\/documentation\/Containers\/LoadingAndSavingImages"],"generated":true}],"abstract":[{"text":"Download an image from a registry and add it to your library.","type":"text"}],"metadata":{"title":"Pulling an image","roleHeading":"Article","role":"article"},"sections":[],"kind":"article","hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers","doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithImages"]]},"schemaVersion":{"minor":3,"major":0,"patch":0},"primaryContentSections":[{"kind":"content","content":[{"text":"Overview","anchor":"Overview","type":"heading","level":2},{"type":"paragraph","inlineContent":[{"type":"text","text":"An image bundles an app with everything it needs to run, in a package that runs the same way on any machine. Containers works with images in the OCI format, which is the standard most registries use."}]},{"text":"Pull an image from a registry","anchor":"Pull-an-image-from-a-registry","type":"heading","level":3},{"type":"orderedList","items":[{"content":[{"inlineContent":[{"type":"text","text":"In the Images section of the dashboard, click the Add button in the toolbar."}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"Select Pull from Registry, then click Next."}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"Choose a registry."}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"In Image name, enter the name of the image, such as "},{"code":"nginx","type":"codeVoice"},{"type":"text","text":" or "},{"code":"redis","type":"codeVoice"},{"type":"text","text":". As you type, Containers suggests matching images. Before you type, it shows images that are popular on the registry."}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"Optionally, enter a tag, such as "},{"code":"latest","type":"codeVoice"},{"type":"text","text":" or "},{"code":"1.0","type":"codeVoice"},{"type":"text","text":". Containers suggests the tags the image has."}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"Optionally, choose a platform. Leave it set to Any to pull the variant for your Mac."}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"type":"text","text":"Click Create."}],"type":"paragraph"}]}]},{"type":"paragraph","inlineContent":[{"type":"text","text":"The image appears in the Images section, and its row shows the progress of the download."}]},{"type":"paragraph","inlineContent":[{"type":"image","identifier":"pull-image"}]},{"style":"tip","type":"aside","content":[{"type":"paragraph","inlineContent":[{"text":"If a registry limits how many requests you can make, Containers stops showing suggestions for a short while. You can still pull an image by typing its full name.","type":"text"}]}],"name":"Tip"},{"text":"Choose a platform","anchor":"Choose-a-platform","type":"heading","level":3},{"type":"paragraph","inlineContent":[{"type":"text","text":"Many images come in several variants, one for each processor architecture. Your Mac runs "},{"code":"arm64","type":"codeVoice"},{"type":"text","text":" images natively. It can also run "},{"code":"amd64","type":"codeVoice"},{"type":"text","text":" images by translating them with Rosetta, which is slower."}]}]}],"references":{"doc://app.containers.Containers/documentation/Containers/LoadingAndSavingImages":{"title":"Loading and saving images","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/LoadingAndSavingImages","url":"\/documentation\/containers\/loadingandsavingimages","role":"article","abstract":[{"text":"Move images between Macs, or share them without a registry, using tar archives.","type":"text"}],"kind":"article"},"pull-image":{"variants":[{"traits":["2x","light"],"url":"\/images\/app.containers.Containers\/pull-image@2x.png"},{"traits":["2x","dark"],"url":"\/images\/app.containers.Containers\/pull-image~dark@2x.png"}],"type":"image","identifier":"pull-image","alt":"A screenshot of the options for pulling an image from a registry, with images that are popular on Docker Hub, such as nginx, memcached and postgres, at the top, and the Registry, Image name, Tag and Platform options below them."},"doc://app.containers.Containers/documentation/Containers/RunningAContainer":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","title":"Running a container","role":"article","abstract":[{"text":"Create a container from an image, configure it, and start it.","type":"text"}],"url":"\/documentation\/containers\/runningacontainer","type":"topic"},"doc://app.containers.Containers/documentation/Containers/WorkingWithImages":{"title":"Images","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithImages","url":"\/documentation\/containers\/workingwithimages","role":"collectionGroup","abstract":[{"text":"Get the images you run containers from, by pulling them from a registry, building them or loading them from an archive.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers/BuildingAnImageFromADockerfile":{"title":"Building an image from a Dockerfile","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/BuildingAnImageFromADockerfile","url":"\/documentation\/containers\/buildinganimagefromadockerfile","role":"article","abstract":[{"text":"Create your own image from a Dockerfile and the files it uses.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/reachinghostserviceswithdnsdomains.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/reachinghostserviceswithdnsdomains.json new file mode 100644 index 0000000..128c985 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/reachinghostserviceswithdnsdomains.json @@ -0,0 +1 @@ +{"kind":"article","identifier":{"url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReachingHostServicesWithDNSDomains","interfaceLanguage":"swift"},"schemaVersion":{"minor":3,"major":0,"patch":0},"seeAlsoSections":[{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingNetworks"],"title":"Related Documentation","anchor":"Related-Documentation"},{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingNetworks"],"title":"Networking","generated":true,"anchor":"Networking"}],"sections":[],"abstract":[{"text":"Use DNS domains to reach your containers, and services running on your Mac, by name.","type":"text"}],"primaryContentSections":[{"kind":"content","content":[{"level":2,"text":"Overview","type":"heading","anchor":"Overview"},{"type":"paragraph","inlineContent":[{"text":"A DNS domain lets you use names instead of IP addresses. In a domain such as ","type":"text"},{"code":"test","type":"codeVoice"},{"text":", your Mac and your containers can reach a container named ","type":"text"},{"code":"web","type":"codeVoice"},{"text":" at ","type":"text"},{"code":"web.test","type":"codeVoice"},{"text":", and containers can reach a service on your Mac at a name such as ","type":"text"},{"code":"host.containers.internal:8000","type":"codeVoice"},{"text":".","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"macOS keeps DNS domains as resolver files, one per domain, in the ","type":"text"},{"code":"\/etc\/resolver","type":"codeVoice"},{"text":" folder. While the container system is running, Containers answers for the names in these domains.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"Containers doesn’t currently support managing DNS domains. It shows the domains configured on your Mac, but doesn’t create or change them.","type":"text"}]},{"level":3,"text":"Review your DNS domains","type":"heading","anchor":"Review-your-DNS-domains"},{"type":"orderedList","items":[{"content":[{"type":"paragraph","inlineContent":[{"text":"Choose Containers > Settings, then click Network.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"The first time, click Allow Access, then choose the ","type":"text"},{"type":"codeVoice","code":"\/etc\/resolver"},{"text":" folder, so Containers can read the files in it.","type":"text"}]}]}]},{"type":"paragraph","inlineContent":[{"text":"DNS Domains lists the domains configured on your Mac.","type":"text"}]},{"type":"paragraph","inlineContent":[{"type":"image","identifier":"settings-network"}]},{"level":3,"text":"Choose a default domain","type":"heading","anchor":"Choose-a-default-domain"},{"type":"paragraph","inlineContent":[{"text":"Containers names new containers in the default domain, so you can reach a container by its name in that domain.","type":"text"}]},{"type":"orderedList","items":[{"content":[{"type":"paragraph","inlineContent":[{"text":"Choose Containers > Settings, then click Network.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Under DNS Domains, select a domain, then click Use as Default.","type":"text"}]}]}]},{"type":"paragraph","inlineContent":[{"text":"To stop naming new containers in a domain, select the default domain, then click Don’t Use as Default.","type":"text"}]}]}],"metadata":{"title":"Reaching containers and host services by name","roleHeading":"Article","role":"article"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers"]]},"references":{"doc://app.containers.Containers/documentation/Containers/ManagingNetworks":{"title":"Managing networks","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingNetworks","url":"\/documentation\/containers\/managingnetworks","role":"article","abstract":[{"text":"Review the network your containers join, and how they reach the internet.","type":"text"}],"kind":"article"},"settings-network":{"identifier":"settings-network","alt":"A screenshot of the Network pane of Containers settings, with the default network under Networks, and the test domain under DNS Domains.","variants":[{"url":"\/images\/app.containers.Containers\/settings-network@2x.png","traits":["2x","light"]},{"url":"\/images\/app.containers.Containers\/settings-network~dark@2x.png","traits":["2x","dark"]}],"type":"image"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/readingacontainerslogs.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/readingacontainerslogs.json new file mode 100644 index 0000000..b1c96a9 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/readingacontainerslogs.json @@ -0,0 +1 @@ +{"kind":"article","schemaVersion":{"minor":3,"major":0,"patch":0},"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReadingAContainersLogs"},"seeAlsoSections":[{"title":"Related Documentation","identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails"],"anchor":"Related-Documentation"},{"generated":true,"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer"]}],"sections":[],"abstract":[{"text":"Follow what a container’s process prints, and find out why a container fails to start.","type":"text"}],"primaryContentSections":[{"content":[{"level":2,"text":"Overview","type":"heading","anchor":"Overview"},{"type":"paragraph","inlineContent":[{"text":"Double-click a container in the Containers section of the dashboard to open its details. The window opens on the Logs tab, which shows two logs:","type":"text"}]},{"items":[{"term":{"inlineContent":[{"text":"Output","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Everything the container’s process writes to its standard output and standard error."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Boot","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The log of the container’s virtual machine as it starts. Check it when a container fails to start."}],"type":"paragraph"}]}}],"type":"termList"},{"type":"paragraph","inlineContent":[{"text":"The logs update as the container writes to them, and stay at the end, so you always see the latest lines.","type":"text"}]},{"type":"paragraph","inlineContent":[{"type":"image","identifier":"container-logs"}]}],"kind":"content"}],"metadata":{"title":"Reading a container’s logs","roleHeading":"Article","role":"article"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers","doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithContainers"]]},"references":{"doc://app.containers.Containers/documentation/Containers/WorkingWithContainers":{"kind":"article","title":"Containers","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithContainers","role":"collectionGroup","abstract":[{"text":"Create containers from your images, run them, and review what they’re doing.","type":"text"}],"url":"\/documentation\/containers\/workingwithcontainers","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ViewingDetails":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails","title":"Viewing details","role":"article","abstract":[{"text":"Open an item in its own window to review it, read its full configuration, and work with it.","type":"text"}],"url":"\/documentation\/containers\/viewingdetails","type":"topic"},"doc://app.containers.Containers/documentation/Containers/RunningAContainer":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","title":"Running a container","role":"article","abstract":[{"text":"Create a container from an image, configure it, and start it.","type":"text"}],"url":"\/documentation\/containers\/runningacontainer","type":"topic"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"},"container-logs":{"variants":[{"traits":["2x","light"],"url":"\/images\/app.containers.Containers\/container-logs@2x.png"},{"traits":["2x","dark"],"url":"\/images\/app.containers.Containers\/container-logs~dark@2x.png"}],"type":"image","identifier":"container-logs","alt":"A screenshot of the details window of the reverse-proxy container, showing the Output log of the Logs tab with the lines nginx printed as it started."}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/reviewingreports.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/reviewingreports.json new file mode 100644 index 0000000..be7b3fd --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/reviewingreports.json @@ -0,0 +1 @@ +{"kind":"article","identifier":{"url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReviewingReports","interfaceLanguage":"swift"},"schemaVersion":{"minor":3,"major":0,"patch":0},"seeAlsoSections":[{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails"],"title":"Related Documentation","anchor":"Related-Documentation"}],"sections":[],"abstract":[{"text":"Find out why a task failed or finished with a warning, using the reports Containers records.","type":"text"}],"primaryContentSections":[{"kind":"content","content":[{"level":2,"text":"Overview","type":"heading","anchor":"Overview"},{"type":"paragraph","inlineContent":[{"text":"When a task such as pulling an image, building one, or starting a container fails or finishes with a warning, Containers records a report about it. A report keeps the error or warning and the full output of the task, so you can find out what happened after the fact.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"Each report has a level:","type":"text"}]},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Error","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The task failed."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Warning","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The task finished, but something needs your attention."}],"type":"paragraph"}]}}]},{"type":"paragraph","inlineContent":[{"text":"Reports are kept in the storage folder.","type":"text"}]},{"level":3,"text":"Browse reports","type":"heading","anchor":"Browse-reports"},{"type":"paragraph","inlineContent":[{"text":"The Reports section of the dashboard lists every report, with its level, the name of the item, its kind, the type of task, the message and the date. Double-click a report to open it in a separate window.","type":"text"}]},{"type":"paragraph","inlineContent":[{"type":"image","identifier":"reports"}]},{"type":"paragraph","inlineContent":[{"text":"To see only the reports for a single container, image or volume, open the item’s details and click the Reports button in the toolbar.","type":"text"}]},{"level":3,"text":"Filter reports","type":"heading","anchor":"Filter-reports"},{"type":"paragraph","inlineContent":[{"text":"Use the search bar of the Reports section to build a filter from one or more rules. Each rule compares a column, such as Name, Kind, Type, Message or Date, with a value, using a comparison such as Contains or Equals.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"To use a filter again later, save it as a search.","type":"text"}]},{"level":3,"text":"Share or remove reports","type":"heading","anchor":"Share-or-remove-reports"},{"type":"paragraph","inlineContent":[{"text":"To find a report’s files on your Mac, Control-click the report, then choose Reveal in Finder. You can attach them to a bug report when you ","type":"text"},{"type":"reference","identifier":"https:\/\/github.com\/try-containers\/Containers\/issues\/new\/choose","isActive":true},{"text":".","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"To remove reports you no longer need, select them, then click Delete in the toolbar.","type":"text"}]}]}],"metadata":{"title":"Reviewing reports","roleHeading":"Article","role":"article"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers"]]},"references":{"reports":{"identifier":"reports","alt":"A screenshot of the Reports section of the dashboard, listing an image that couldn’t be pulled, a container that couldn’t be started and an image that couldn’t be built.","variants":[{"url":"\/images\/app.containers.Containers\/reports@2x.png","traits":["2x","light"]},{"url":"\/images\/app.containers.Containers\/reports~dark@2x.png","traits":["2x","dark"]}],"type":"image"},"doc://app.containers.Containers/documentation/Containers/ViewingDetails":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails","title":"Viewing details","role":"article","abstract":[{"text":"Open an item in its own window to review it, read its full configuration, and work with it.","type":"text"}],"url":"\/documentation\/containers\/viewingdetails","type":"topic"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"},"https://github.com/try-containers/Containers/issues/new/choose":{"identifier":"https:\/\/github.com\/try-containers\/Containers\/issues\/new\/choose","title":"open an issue","type":"link","url":"https:\/\/github.com\/try-containers\/Containers\/issues\/new\/choose","titleInlineContent":[{"text":"open an issue","type":"text"}]}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/runningacontainer.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/runningacontainer.json new file mode 100644 index 0000000..fe2c0cf --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/runningacontainer.json @@ -0,0 +1 @@ +{"kind":"article","schemaVersion":{"minor":3,"major":0,"patch":0},"identifier":{"url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","interfaceLanguage":"swift"},"seeAlsoSections":[{"anchor":"Related-Documentation","title":"Related Documentation","identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ReadingAContainersLogs","doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingVolumes","doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingNetworks"]},{"generated":true,"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ReadingAContainersLogs"]}],"sections":[],"abstract":[{"text":"Create a container from an image, configure it, and start it.","type":"text"}],"primaryContentSections":[{"content":[{"text":"Overview","anchor":"Overview","type":"heading","level":2},{"type":"paragraph","inlineContent":[{"text":"A container is a running instance of an image. In Containers, each container runs in its own lightweight virtual machine, so it’s isolated from your Mac and from other containers.","type":"text"}]},{"text":"Run a container from an image","anchor":"Run-a-container-from-an-image","type":"heading","level":3},{"type":"orderedList","items":[{"content":[{"inlineContent":[{"text":"In the Images section of the dashboard, select an image, then click Run in the toolbar. You can also click Run in the image’s details window.","type":"text"}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"text":"Configure the container in the General, Process and Management tabs. Every option is optional.","type":"text"}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"text":"Click Run.","type":"text"}],"type":"paragraph"}]}]},{"type":"paragraph","inlineContent":[{"text":"Containers creates the container and starts it. The dashboard switches to the Containers section, where the container’s row shows its progress as it starts.","type":"text"}]},{"text":"Create a container without starting it","anchor":"Create-a-container-without-starting-it","type":"heading","level":3},{"type":"orderedList","items":[{"content":[{"inlineContent":[{"text":"In the Containers section of the dashboard, click the Add button in the toolbar.","type":"text"}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"text":"In the General tab, choose the image from the Image menu. To choose an image that isn’t in the menu, choose Other.","type":"text"}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"text":"Configure the rest of the container in the General, Process and Management tabs.","type":"text"}],"type":"paragraph"}]},{"content":[{"inlineContent":[{"text":"Click Create.","type":"text"}],"type":"paragraph"}]}]},{"type":"paragraph","inlineContent":[{"text":"The container appears in the Containers section, stopped. Start it when you’re ready.","type":"text"}]},{"type":"paragraph","inlineContent":[{"identifier":"run-container","type":"image"}]},{"text":"Configure the container","anchor":"Configure-the-container","type":"heading","level":3},{"type":"paragraph","inlineContent":[{"text":"The options are grouped in three tabs, the same way the sheet shows them.","type":"text"}]},{"text":"General","anchor":"General","type":"heading","level":4},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Image","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The image the container runs. When you run a container from an image, it’s the image you chose."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Name","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The container’s name. Leave it empty to have Containers generate a unique name. Names start with a letter or number, and can contain only letters, numbers, underscores, periods and hyphens."}],"type":"paragraph"}]}}]},{"text":"Process","anchor":"Process","type":"heading","level":4},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Entrypoint","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Replaces the command the image runs when the container starts."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Stop signal","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The signal sent to the container’s process to stop it. The default is "},{"type":"codeVoice","code":"SIGTERM"},{"type":"text","text":"."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Environment Variables","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"A key and a value for each environment variable the container needs, such as "},{"type":"codeVoice","code":"POSTGRES_PASSWORD"},{"type":"text","text":"."}],"type":"paragraph"}]}}]},{"text":"Management","anchor":"Management","type":"heading","level":4},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Platform","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"If the image has variants for several platforms, the one to run. "},{"type":"codeVoice","code":"amd64"},{"type":"text","text":" containers run on Apple silicon using Rosetta."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Shared memory","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The size of "},{"type":"codeVoice","code":"\/dev\/shm"},{"type":"text","text":", such as "},{"type":"codeVoice","code":"64M"},{"type":"text","text":" or "},{"type":"codeVoice","code":"1G"},{"type":"text","text":"."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Remove the container after it stops","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Deletes the container when it stops."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Mount the root filesystem as read-only","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Prevents the container from changing the image’s files."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Expose virtualization capabilities to the container","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Lets the container run virtual machines of its own. Requires a Mac with an M3 chip or later."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Forward SSH agent socket to container","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Shares your Mac’s SSH agent with the container, so it can use your SSH keys."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Volumes","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Attach a volume you created in the Volumes section, or an anonymous volume, so the container has data that outlasts it. For more information, see "},{"type":"reference","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingVolumes","isActive":true},{"type":"text","text":"."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Mounts","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Share a folder on your Mac with the container. Choose the folder, then enter the absolute path where it appears in the container, such as "},{"type":"codeVoice","code":"\/data"},{"type":"text","text":". Select Temporary mount to create an empty in-memory folder instead."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Port Mappings","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Reach a service in the container from your Mac. Enter the port on your Mac in Host, the port the service listens on in Container, and choose the protocol. For example, to open a web server that listens on port 80 at "},{"type":"codeVoice","code":"http:\/\/localhost:8080"},{"type":"text","text":", map host port "},{"type":"codeVoice","code":"8080"},{"type":"text","text":" to container port "},{"type":"codeVoice","code":"80"},{"type":"text","text":"."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Capabilities","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Linux capabilities to add to the container, such as "},{"type":"codeVoice","code":"CAP_NET_ADMIN"},{"type":"text","text":"."}],"type":"paragraph"}]}}]},{"text":"Start, stop and delete containers","anchor":"Start-stop-and-delete-containers","type":"heading","level":3},{"type":"paragraph","inlineContent":[{"text":"In the Containers section, select one or more containers, then click Start, Stop or Delete in the toolbar. You can also do this from a container’s details window.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"Every container joins the ","type":"text"},{"type":"codeVoice","code":"default"},{"text":" network. For more information, see ","type":"text"},{"isActive":true,"identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingNetworks","type":"reference"},{"text":".","type":"text"}]},{"style":"important","name":"Important","content":[{"inlineContent":[{"type":"text","text":"Deleting a container deletes any changes it made to its own filesystem. Data in mounts and named volumes is kept."}],"type":"paragraph"}],"type":"aside"},{"type":"paragraph","inlineContent":[{"text":"If you set a default DNS domain, you can reach the container by its name in that domain, such as ","type":"text"},{"type":"codeVoice","code":"web-app.test"},{"text":". For more information, see ","type":"text"},{"isActive":true,"identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReachingHostServicesWithDNSDomains","type":"reference"},{"text":".","type":"text"}]}],"kind":"content"}],"metadata":{"title":"Running a container","roleHeading":"Article","role":"article"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers","doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithContainers"]]},"references":{"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ReadingAContainersLogs":{"kind":"article","title":"Reading a container’s logs","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReadingAContainersLogs","role":"article","abstract":[{"text":"Follow what a container’s process prints, and find out why a container fails to start.","type":"text"}],"url":"\/documentation\/containers\/readingacontainerslogs","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ManagingVolumes":{"kind":"article","title":"Managing volumes","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingVolumes","role":"article","abstract":[{"text":"Create volumes to store data that outlasts the containers using it.","type":"text"}],"url":"\/documentation\/containers\/managingvolumes","type":"topic"},"doc://app.containers.Containers/documentation/Containers/WorkingWithContainers":{"kind":"article","title":"Containers","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithContainers","role":"collectionGroup","abstract":[{"text":"Create containers from your images, run them, and review what they’re doing.","type":"text"}],"url":"\/documentation\/containers\/workingwithcontainers","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ReachingHostServicesWithDNSDomains":{"title":"Reaching containers and host services by name","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReachingHostServicesWithDNSDomains","url":"\/documentation\/containers\/reachinghostserviceswithdnsdomains","role":"article","abstract":[{"text":"Use DNS domains to reach your containers, and services running on your Mac, by name.","type":"text"}],"kind":"article"},"run-container":{"identifier":"run-container","alt":"A screenshot of the sheet for running the nginx image, showing the General tab with the name web-app.","variants":[{"url":"\/images\/app.containers.Containers\/run-container@2x.png","traits":["2x","light"]},{"url":"\/images\/app.containers.Containers\/run-container~dark@2x.png","traits":["2x","dark"]}],"type":"image"},"doc://app.containers.Containers/documentation/Containers/ManagingNetworks":{"title":"Managing networks","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingNetworks","url":"\/documentation\/containers\/managingnetworks","role":"article","abstract":[{"text":"Review the network your containers join, and how they reach the internet.","type":"text"}],"kind":"article"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/understandinghowcontainersworks.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/understandinghowcontainersworks.json new file mode 100644 index 0000000..d0df198 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/understandinghowcontainersworks.json @@ -0,0 +1 @@ +{"kind":"article","identifier":{"url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/UnderstandingHowContainersWorks","interfaceLanguage":"swift"},"schemaVersion":{"minor":3,"major":0,"patch":0},"seeAlsoSections":[{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/GettingStarted","doc:\/\/app.containers.Containers\/documentation\/Containers\/ExploringTheDashboard"],"title":"Related Documentation","anchor":"Related-Documentation"}],"sections":[],"abstract":[{"text":"Learn how Containers runs each container in its own virtual machine, and what happens inside the app.","type":"text"}],"primaryContentSections":[{"kind":"content","content":[{"level":2,"text":"Overview","type":"heading","anchor":"Overview"},{"type":"paragraph","inlineContent":[{"text":"A container packages an app and everything it needs to run into a single unit. The same container image runs the same way on any computer, which makes containers a common way to develop, test and deploy server software. The Open Container Initiative (OCI) defines the standard formats for images and the registries that store them, so images you pull or build with Containers work with other container tools, too.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"Most container images are built for Linux, so a Mac needs a Linux virtual machine to run them. The typical approach is one shared virtual machine that hosts all your containers. Containers takes a different one: using Apple’s open source ","type":"text"},{"type":"reference","identifier":"https:\/\/github.com\/apple\/containerization","isActive":true},{"text":" package, it starts a lightweight virtual machine for each container. This approach has these benefits:","type":"text"}]},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Security","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Each container is isolated the way a full virtual machine is, and the virtual machine includes only what’s needed to run it."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Privacy","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Only the folders and volumes you mount in a container are shared with its virtual machine, not everything any container might need."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Performance","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"A lightweight virtual machine uses less memory than a full one, and starts in about as long as a container in a shared virtual machine."}],"type":"paragraph"}]}}]},{"type":"paragraph","inlineContent":[{"type":"image","identifier":"architecture"}]},{"level":3,"text":"The container system runs inside the app","type":"heading","anchor":"The-container-system-runs-inside-the-app"},{"type":"paragraph","inlineContent":[{"text":"Everything that manages your containers runs inside the Containers app. There’s no daemon, launch agent or command-line tool to install, and nothing keeps running after you quit. The app works entirely within the App Sandbox: outside its own data, it only reads the folders you give it access to.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"The part of the app that does the work is the container system. It starts when you open Containers, unless you turn that off in Settings. The rest of the app reaches it directly, to start and stop it, and through its managers, one for each kind of resource: containers, images, volumes, networks and reports.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"The container system runs services that keep the state of what you manage:","type":"text"}]},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Container service","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Creates containers, starts and stops their virtual machines, and runs their processes."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Image service","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Pulls images from registries, keeps their content, and unpacks them so containers can run from them."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Volume and network services","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Keep your volumes, and the networks containers join."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Kernel service","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Provides the Linux kernel that each virtual machine boots."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"DNS service","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Answers for the names of your containers, and of services on your Mac, in your DNS domains."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Report service","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Records the reports of tasks that fail or finish with a warning."}],"type":"paragraph"}]}}]},{"type":"paragraph","inlineContent":[{"text":"Two more parts support them:","type":"text"}]},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Port forwarding","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Connects the ports a container publishes to ports on your Mac."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Builder","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Builds images from a Dockerfile, using the builder container."}],"type":"paragraph"}]}}]},{"type":"paragraph","inlineContent":[{"text":"When you quit Containers, or stop the container system, every container that’s running stops.","type":"text"}]},{"level":3,"text":"Each container runs in a virtual machine","type":"heading","anchor":"Each-container-runs-in-a-virtual-machine"},{"type":"paragraph","inlineContent":[{"text":"When you start a container, Containers uses the Virtualization framework to start a virtual machine for it. The virtual machine boots a Linux kernel, then ","type":"text"},{"code":"vminitd","type":"codeVoice"},{"text":", a small init system from the Containerization package that sets up the container’s environment and runs its processes. The app talks to ","type":"text"},{"code":"vminitd","type":"codeVoice"},{"text":" to start processes, read their output and stop them.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"Containers downloads the Linux kernel and the init image that contains ","type":"text"},{"code":"vminitd","type":"codeVoice"},{"text":" the first time it sets up the container system. Every container shares them.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"Each container’s root file system is a copy of its image’s file system, so changes a container makes never affect the image or other containers. If an image is built for Intel-based Macs (","type":"text"},{"code":"amd64","type":"codeVoice"},{"text":"), Containers runs it with Rosetta on a Mac with Apple silicon.","type":"text"}]},{"level":3,"text":"Images come from registries, builds and archives","type":"heading","anchor":"Images-come-from-registries-builds-and-archives"},{"type":"paragraph","inlineContent":[{"text":"Containers keeps a content store of the image layers it pulls, builds or loads, and shares layers between images that use them. Each time it adds an image, it also unpacks the image’s layers into a file system that containers can start from.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"To build an image, Containers runs BuildKit in a builder container: a container like any other, which Containers creates for you the first time you build. The app sends the Dockerfile and the files in the build directory to BuildKit over a virtual socket, and stores the image BuildKit produces in its content store.","type":"text"}]},{"level":3,"text":"Containers connect through a virtual network","type":"heading","anchor":"Containers-connect-through-a-virtual-network"},{"type":"paragraph","inlineContent":[{"text":"Each container gets its own IP address on a virtual network that the Virtualization framework provides. Containers runs every container on the ","type":"text"},{"code":"default","type":"codeVoice"},{"text":" network, which uses NAT, so containers reach the internet through your Mac. Other networks need the ","type":"text"},{"code":"vmnet","type":"codeVoice"},{"text":" framework, which a sandboxed app can’t use, so Containers doesn’t currently support them. For more information, see ","type":"text"},{"type":"reference","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingNetworks","isActive":true},{"text":".","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"To make a service in a container available on your Mac, publish its port when you create the container. Containers listens on that port on your Mac and forwards connections to the container, so published ports only work while Containers is open.","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"Containers also answers for names in the DNS domains configured on your Mac, so your Mac and your containers can reach containers, and services running on your Mac, by name. For more information, see ","type":"text"},{"type":"reference","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReachingHostServicesWithDNSDomains","isActive":true},{"text":".","type":"text"}]},{"level":3,"text":"Your data stays in one folder","type":"heading","anchor":"Your-data-stays-in-one-folder"},{"type":"paragraph","inlineContent":[{"text":"Containers keeps everything it manages in its storage folder: containers, images, volumes, networks, the Linux kernel, and build data. Each container has its own folder there, with its configuration, its file system and its logs: the output of its processes, and the boot log of its virtual machine. For more information, see ","type":"text"},{"type":"reference","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ChoosingWhereContainersStoresData","isActive":true},{"text":".","type":"text"}]},{"type":"paragraph","inlineContent":[{"text":"When something fails, such as a pull, a build or a container that can’t start, Containers also records a report you can review later. For more information, see ","type":"text"},{"type":"reference","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReviewingReports","isActive":true},{"text":".","type":"text"}]},{"level":3,"text":"Containers uses macOS technologies","type":"heading","anchor":"Containers-uses-macOS-technologies"},{"type":"paragraph","inlineContent":[{"text":"Containers and the Containerization package rely on these macOS technologies:","type":"text"}]},{"type":"unorderedList","items":[{"content":[{"type":"paragraph","inlineContent":[{"text":"The Virtualization framework, to run the virtual machines and their virtual devices.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"The App Sandbox and security-scoped bookmarks, to access only the folders you choose.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"Keychain services, for the credentials of private registries.","type":"text"}]}]},{"content":[{"type":"paragraph","inlineContent":[{"text":"The unified logging system, for the app’s logs.","type":"text"}]}]}]},{"level":3,"text":"Known limitations","type":"heading","anchor":"Known-limitations"},{"type":"paragraph","inlineContent":[{"type":"strong","inlineContent":[{"type":"text","text":"Memory isn’t returned to macOS."}]},{"text":" The Virtualization framework only partly supports returning memory from a virtual machine to macOS. A container’s virtual machine uses only the memory its processes need, but memory they free inside the container isn’t given back to your Mac. If you run many memory-intensive containers, restart them from time to time to reduce their memory use.","type":"text"}]},{"type":"paragraph","inlineContent":[{"type":"strong","inlineContent":[{"type":"text","text":"Containers run only while the app is open."}]},{"text":" Because the container system runs inside the app, quitting Containers stops every container. To keep containers running, keep Containers open.","type":"text"}]}]}],"metadata":{"title":"Understanding how Containers works","roleHeading":"Article","role":"article"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers"]]},"references":{"doc://app.containers.Containers/documentation/Containers/ChoosingWhereContainersStoresData":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ChoosingWhereContainersStoresData","title":"Choosing where Containers stores data","role":"article","abstract":[{"text":"Keep your containers, images and volumes on another disk.","type":"text"}],"url":"\/documentation\/containers\/choosingwherecontainersstoresdata","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ManagingNetworks":{"title":"Managing networks","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ManagingNetworks","url":"\/documentation\/containers\/managingnetworks","role":"article","abstract":[{"text":"Review the network your containers join, and how they reach the internet.","type":"text"}],"kind":"article"},"https://github.com/apple/containerization":{"identifier":"https:\/\/github.com\/apple\/containerization","title":"Containerization","type":"link","url":"https:\/\/github.com\/apple\/containerization","titleInlineContent":[{"text":"Containerization","type":"text"}]},"architecture":{"identifier":"architecture","alt":"A diagram of how Containers works. Inside the Containers app, the dashboard, windows and menu bar call the container system, which keeps its status and lifecycle. The container system is made up of the managers, one each for containers, images, volumes, networks and reports, which call its container, image, volume, network, kernel, DNS and report services, along with port forwarding and the builder. The container service and the builder start a virtual machine through the Virtualization framework for each container and for the builder container, each with a Linux kernel and vminitd. Outside the app, the container system pulls from image registries, and keeps its data in the storage folder.","variants":[{"svgID":"architecture","url":"\/images\/app.containers.Containers\/architecture.svg","traits":["1x","light"]},{"svgID":"architecture","url":"\/images\/app.containers.Containers\/architecture~dark.svg","traits":["1x","dark"]}],"type":"image"},"doc://app.containers.Containers/documentation/Containers/GettingStarted":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/GettingStarted","title":"Getting started with Containers","role":"article","abstract":[{"text":"Install Containers, set up the container system, and start working with images and containers.","type":"text"}],"url":"\/documentation\/containers\/gettingstarted","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ReviewingReports":{"title":"Reviewing reports","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReviewingReports","url":"\/documentation\/containers\/reviewingreports","role":"article","abstract":[{"text":"Find out why a task failed or finished with a warning, using the reports Containers records.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers/ExploringTheDashboard":{"kind":"article","title":"Exploring the dashboard","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ExploringTheDashboard","role":"article","abstract":[{"text":"Find your way around the Containers dashboard and menu bar item.","type":"text"}],"url":"\/documentation\/containers\/exploringthedashboard","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ReachingHostServicesWithDNSDomains":{"title":"Reaching containers and host services by name","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReachingHostServicesWithDNSDomains","url":"\/documentation\/containers\/reachinghostserviceswithdnsdomains","role":"article","abstract":[{"text":"Use DNS domains to reach your containers, and services running on your Mac, by name.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/viewingdetails.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/viewingdetails.json new file mode 100644 index 0000000..d74df1f --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/viewingdetails.json @@ -0,0 +1 @@ +{"kind":"article","identifier":{"url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ViewingDetails","interfaceLanguage":"swift"},"schemaVersion":{"minor":3,"major":0,"patch":0},"seeAlsoSections":[{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/ExploringTheDashboard","doc:\/\/app.containers.Containers\/documentation\/Containers\/ReviewingReports"],"title":"Related Documentation","anchor":"Related-Documentation"},{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/GettingStarted","doc:\/\/app.containers.Containers\/documentation\/Containers\/ExploringTheDashboard"],"title":"Essentials","generated":true,"anchor":"Essentials"}],"sections":[],"abstract":[{"text":"Open an item in its own window to review it, read its full configuration, and work with it.","type":"text"}],"primaryContentSections":[{"kind":"content","content":[{"level":2,"text":"Overview","type":"heading","anchor":"Overview"},{"type":"paragraph","inlineContent":[{"text":"Double-click a container, image or volume in the dashboard to open its details in a separate window. A row of tabs at the top of the window switches between what you can see about the item, and the toolbar holds the actions you can take on it.","type":"text"}]},{"type":"paragraph","inlineContent":[{"type":"image","identifier":"image-details"}]},{"level":3,"text":"Switch between tabs","type":"heading","anchor":"Switch-between-tabs"},{"type":"paragraph","inlineContent":[{"text":"Every details window has these tabs:","type":"text"}]},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Info","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"A summary of the item."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Inspect","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"The item’s full configuration, as JSON."}],"type":"paragraph"}]}}]},{"type":"paragraph","inlineContent":[{"text":"Some items have a tab of their own, which the window opens on:","type":"text"}]},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Logs","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"For containers, the output of the container’s process and the log of its virtual machine as it starts. For more information, see "},{"identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReadingAContainersLogs","type":"reference","isActive":true},{"type":"text","text":"."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"History","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"For images, the layers that make up the image, and the step that created each one."}],"type":"paragraph"}]}}]},{"type":"paragraph","inlineContent":[{"text":"Volumes have no tab of their own, so their window opens on Inspect.","type":"text"}]},{"level":3,"text":"Review an item’s summary","type":"heading","anchor":"Review-an-items-summary"},{"type":"paragraph","inlineContent":[{"text":"The Info tab shows:","type":"text"}]},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Container","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Its ID, image, operating system and architecture, the command it runs, when it last started, the ports it publishes, whether its root filesystem is read-only, whether virtualization and SSH agent forwarding are turned on, and its labels."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Image","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Its tag, digest, size and creation date."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Volume","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Its name, type, state, size and creation date, its driver and format, and its labels and driver options."}],"type":"paragraph"}]}}]},{"level":3,"text":"Actions","type":"heading","anchor":"Actions"},{"type":"paragraph","inlineContent":[{"text":"The toolbar of the window depends on the item:","type":"text"}]},{"type":"termList","items":[{"term":{"inlineContent":[{"text":"Container","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Start or stop the container, or delete it."}],"type":"paragraph"}]}},{"term":{"inlineContent":[{"text":"Image","type":"text"}]},"definition":{"content":[{"inlineContent":[{"type":"text","text":"Run a container from the image, save it as a tar archive, or delete it. For more information, see "},{"identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","type":"reference","isActive":true},{"type":"text","text":" and "},{"identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/LoadingAndSavingImages","type":"reference","isActive":true},{"type":"text","text":"."}],"type":"paragraph"}]}}]},{"level":3,"text":"Find reports about the item","type":"heading","anchor":"Find-reports-about-the-item"},{"type":"paragraph","inlineContent":[{"text":"If Containers recorded reports about the item, such as a task that failed or finished with a warning, click Reports in the toolbar to see them. The button shows a badge when there are reports you haven’t read, and is dimmed when there’s nothing reported. For more information, see ","type":"text"},{"type":"reference","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReviewingReports","isActive":true},{"text":".","type":"text"}]}]}],"metadata":{"title":"Viewing details","roleHeading":"Article","role":"article"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers"]]},"references":{"doc://app.containers.Containers/documentation/Containers/LoadingAndSavingImages":{"title":"Loading and saving images","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/LoadingAndSavingImages","url":"\/documentation\/containers\/loadingandsavingimages","role":"article","abstract":[{"text":"Move images between Macs, or share them without a registry, using tar archives.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers/GettingStarted":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/GettingStarted","title":"Getting started with Containers","role":"article","abstract":[{"text":"Install Containers, set up the container system, and start working with images and containers.","type":"text"}],"url":"\/documentation\/containers\/gettingstarted","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ReviewingReports":{"title":"Reviewing reports","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReviewingReports","url":"\/documentation\/containers\/reviewingreports","role":"article","abstract":[{"text":"Find out why a task failed or finished with a warning, using the reports Containers records.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers/RunningAContainer":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","title":"Running a container","role":"article","abstract":[{"text":"Create a container from an image, configure it, and start it.","type":"text"}],"url":"\/documentation\/containers\/runningacontainer","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ReadingAContainersLogs":{"kind":"article","title":"Reading a container’s logs","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReadingAContainersLogs","role":"article","abstract":[{"text":"Follow what a container’s process prints, and find out why a container fails to start.","type":"text"}],"url":"\/documentation\/containers\/readingacontainerslogs","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ExploringTheDashboard":{"kind":"article","title":"Exploring the dashboard","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ExploringTheDashboard","role":"article","abstract":[{"text":"Find your way around the Containers dashboard and menu bar item.","type":"text"}],"url":"\/documentation\/containers\/exploringthedashboard","type":"topic"},"image-details":{"identifier":"image-details","alt":"A screenshot of the details window of the nginx image, showing the History tab. Each layer is listed with the step that created it and its size.","variants":[{"url":"\/images\/app.containers.Containers\/image-details@2x.png","traits":["2x","light"]},{"url":"\/images\/app.containers.Containers\/image-details~dark@2x.png","traits":["2x","dark"]}],"type":"image"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/workingwithcontainers.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/workingwithcontainers.json new file mode 100644 index 0000000..853ba96 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/workingwithcontainers.json @@ -0,0 +1 @@ +{"kind":"article","schemaVersion":{"minor":3,"major":0,"patch":0},"identifier":{"interfaceLanguage":"swift","url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithContainers"},"topicSections":[{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","doc:\/\/app.containers.Containers\/documentation\/Containers\/ReadingAContainersLogs"],"anchor":"Topics"}],"sections":[],"abstract":[{"text":"Create containers from your images, run them, and review what they’re doing.","type":"text"}],"seeAlsoSections":[{"title":"Images and containers","generated":true,"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithImages"],"anchor":"Images-and-containers"}],"metadata":{"title":"Containers","role":"collectionGroup"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers"]]},"references":{"doc://app.containers.Containers/documentation/Containers/RunningAContainer":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/RunningAContainer","title":"Running a container","role":"article","abstract":[{"text":"Create a container from an image, configure it, and start it.","type":"text"}],"url":"\/documentation\/containers\/runningacontainer","type":"topic"},"doc://app.containers.Containers/documentation/Containers/ReadingAContainersLogs":{"kind":"article","title":"Reading a container’s logs","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/ReadingAContainersLogs","role":"article","abstract":[{"text":"Follow what a container’s process prints, and find out why a container fails to start.","type":"text"}],"url":"\/documentation\/containers\/readingacontainerslogs","type":"topic"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"},"doc://app.containers.Containers/documentation/Containers/WorkingWithImages":{"title":"Images","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithImages","url":"\/documentation\/containers\/workingwithimages","role":"collectionGroup","abstract":[{"text":"Get the images you run containers from, by pulling them from a registry, building them or loading them from an archive.","type":"text"}],"kind":"article"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/data/documentation/containers/workingwithimages.json b/Containers/Supporting Files/Help.bundle/data/documentation/containers/workingwithimages.json new file mode 100644 index 0000000..c6473f0 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/data/documentation/containers/workingwithimages.json @@ -0,0 +1 @@ +{"kind":"article","identifier":{"url":"doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithImages","interfaceLanguage":"swift"},"schemaVersion":{"minor":3,"major":0,"patch":0},"topicSections":[{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/PullingAnImage","doc:\/\/app.containers.Containers\/documentation\/Containers\/BuildingAnImageFromADockerfile","doc:\/\/app.containers.Containers\/documentation\/Containers\/LoadingAndSavingImages"],"anchor":"Topics"}],"sections":[],"abstract":[{"text":"Get the images you run containers from, by pulling them from a registry, building them or loading them from an archive.","type":"text"}],"seeAlsoSections":[{"identifiers":["doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithContainers"],"title":"Images and containers","generated":true,"anchor":"Images-and-containers"}],"metadata":{"title":"Images","role":"collectionGroup"},"hierarchy":{"paths":[["doc:\/\/app.containers.Containers\/documentation\/Containers"]]},"references":{"doc://app.containers.Containers/documentation/Containers/WorkingWithContainers":{"kind":"article","title":"Containers","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/WorkingWithContainers","role":"collectionGroup","abstract":[{"text":"Create containers from your images, run them, and review what they’re doing.","type":"text"}],"url":"\/documentation\/containers\/workingwithcontainers","type":"topic"},"doc://app.containers.Containers/documentation/Containers/LoadingAndSavingImages":{"title":"Loading and saving images","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/LoadingAndSavingImages","url":"\/documentation\/containers\/loadingandsavingimages","role":"article","abstract":[{"text":"Move images between Macs, or share them without a registry, using tar archives.","type":"text"}],"kind":"article"},"doc://app.containers.Containers/documentation/Containers/PullingAnImage":{"kind":"article","title":"Pulling an image","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/PullingAnImage","role":"article","abstract":[{"text":"Download an image from a registry and add it to your library.","type":"text"}],"url":"\/documentation\/containers\/pullinganimage","type":"topic"},"doc://app.containers.Containers/documentation/Containers":{"kind":"article","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers","title":"Containers","role":"collection","abstract":[{"text":"Pull, build and run Linux containers, each in its own lightweight virtual machine.","type":"text"}],"url":"\/documentation\/containers","type":"topic"},"doc://app.containers.Containers/documentation/Containers/BuildingAnImageFromADockerfile":{"title":"Building an image from a Dockerfile","type":"topic","identifier":"doc:\/\/app.containers.Containers\/documentation\/Containers\/BuildingAnImageFromADockerfile","url":"\/documentation\/containers\/buildinganimagefromadockerfile","role":"article","abstract":[{"text":"Create your own image from a Dockerfile and the files it uses.","type":"text"}],"kind":"article"}}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/device-frames/macbook-pro-dark.svg b/Containers/Supporting Files/Help.bundle/device-frames/macbook-pro-dark.svg new file mode 100644 index 0000000..94e6456 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/device-frames/macbook-pro-dark.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Containers/Supporting Files/Help.bundle/device-frames/macbook-pro.svg b/Containers/Supporting Files/Help.bundle/device-frames/macbook-pro.svg new file mode 100644 index 0000000..72bf4d1 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/device-frames/macbook-pro.svg @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/buildinganimagefromadockerfile/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/buildinganimagefromadockerfile/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/buildinganimagefromadockerfile/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/choosingwherecontainersstoresdata/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/choosingwherecontainersstoresdata/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/choosingwherecontainersstoresdata/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/exploringthedashboard/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/exploringthedashboard/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/exploringthedashboard/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/gettingstarted/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/gettingstarted/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/gettingstarted/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/loadingandsavingimages/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/loadingandsavingimages/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/loadingandsavingimages/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/managingnetworks/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/managingnetworks/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/managingnetworks/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/managingvolumes/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/managingvolumes/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/managingvolumes/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/pullinganimage/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/pullinganimage/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/pullinganimage/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/reachinghostserviceswithdnsdomains/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/reachinghostserviceswithdnsdomains/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/reachinghostserviceswithdnsdomains/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/readingacontainerslogs/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/readingacontainerslogs/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/readingacontainerslogs/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/reviewingreports/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/reviewingreports/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/reviewingreports/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/runningacontainer/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/runningacontainer/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/runningacontainer/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/understandinghowcontainersworks/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/understandinghowcontainersworks/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/understandinghowcontainersworks/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/viewingdetails/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/viewingdetails/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/viewingdetails/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/workingwithcontainers/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/workingwithcontainers/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/workingwithcontainers/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/containers/workingwithimages/index.html b/Containers/Supporting Files/Help.bundle/documentation/containers/workingwithimages/index.html new file mode 100644 index 0000000..d098786 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/containers/workingwithimages/index.html @@ -0,0 +1,160 @@ +Documentation
\ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/documentation/index.html b/Containers/Supporting Files/Help.bundle/documentation/index.html new file mode 100644 index 0000000..b2d5487 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/documentation/index.html @@ -0,0 +1,15 @@ + + + + + + Redirecting to the Containers documentation + + + + +

If you aren't redirected, open the Containers documentation.

+ + diff --git a/Containers/Supporting Files/Help.bundle/favicon.ico b/Containers/Supporting Files/Help.bundle/favicon.ico new file mode 100644 index 0000000..4899027 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/favicon.ico differ diff --git a/Containers/Supporting Files/Help.bundle/favicon.svg b/Containers/Supporting Files/Help.bundle/favicon.svg new file mode 100644 index 0000000..50777f8 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/favicon.svg @@ -0,0 +1,10 @@ + + + + + diff --git a/Containers/Supporting Files/Help.bundle/icons/article.svg b/Containers/Supporting Files/Help.bundle/icons/article.svg new file mode 100644 index 0000000..3ba2422 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/icons/article.svg @@ -0,0 +1,10 @@ + + + + + + + + + diff --git a/Containers/Supporting Files/Help.bundle/icons/collection.svg b/Containers/Supporting Files/Help.bundle/icons/collection.svg new file mode 100644 index 0000000..13fc644 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/icons/collection.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/Containers/Supporting Files/Help.bundle/icons/sidenav.svg b/Containers/Supporting Files/Help.bundle/icons/sidenav.svg new file mode 100644 index 0000000..8aa75ad --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/icons/sidenav.svg @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/architecture.svg b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/architecture.svg new file mode 100644 index 0000000..55e19a1 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/architecture.svg @@ -0,0 +1,69 @@ + + + +Containers app + +Dashboard, windows and menu bar + + +Container system +Mode, status and lifecycle + +Managers + +Containers + +Images + +Volumes + +Networks + +Reports + + +Services + +Container + +Image + +Volume + +Network + +Kernel + +DNS + +Report + +Port forwarding + +Builder + +Virtualization framework + +Container +Your image's processes +Linux kernel and vminitd + +Container +Your image's processes +Linux kernel and vminitd + +Builder container +BuildKit +Linux kernel and vminitd + + + + +Image registries +Docker Hub and other OCI registries + + +Storage folder +Its own, or the container CLI's + + diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/architecture~dark.svg b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/architecture~dark.svg new file mode 100644 index 0000000..100364a --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/architecture~dark.svg @@ -0,0 +1,69 @@ + + + +Containers app + +Dashboard, windows and menu bar + + +Container system +Mode, status and lifecycle + +Managers + +Containers + +Images + +Volumes + +Networks + +Reports + + +Services + +Container + +Image + +Volume + +Network + +Kernel + +DNS + +Report + +Port forwarding + +Builder + +Virtualization framework + +Container +Your image's processes +Linux kernel and vminitd + +Container +Your image's processes +Linux kernel and vminitd + +Builder container +BuildKit +Linux kernel and vminitd + + + + +Image registries +Docker Hub and other OCI registries + + +Storage folder +Its own, or the container CLI's + + diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/build-image@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/build-image@2x.png new file mode 100644 index 0000000..da25257 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/build-image@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/build-image~dark@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/build-image~dark@2x.png new file mode 100644 index 0000000..6841e28 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/build-image~dark@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/container-logs@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/container-logs@2x.png new file mode 100644 index 0000000..a98fefd Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/container-logs@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/container-logs~dark@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/container-logs~dark@2x.png new file mode 100644 index 0000000..13b71c6 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/container-logs~dark@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/create-volume@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/create-volume@2x.png new file mode 100644 index 0000000..a146984 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/create-volume@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/create-volume~dark@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/create-volume~dark@2x.png new file mode 100644 index 0000000..71c4fbc Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/create-volume~dark@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/dashboard-on-desktop@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/dashboard-on-desktop@2x.png new file mode 100644 index 0000000..10d63b6 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/dashboard-on-desktop@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/dashboard-on-desktop~dark@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/dashboard-on-desktop~dark@2x.png new file mode 100644 index 0000000..1ee0ae9 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/dashboard-on-desktop~dark@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/dashboard@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/dashboard@2x.png new file mode 100644 index 0000000..d45d3ff Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/dashboard@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/dashboard~dark@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/dashboard~dark@2x.png new file mode 100644 index 0000000..cd76c89 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/dashboard~dark@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/image-details@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/image-details@2x.png new file mode 100644 index 0000000..0eed766 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/image-details@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/image-details~dark@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/image-details~dark@2x.png new file mode 100644 index 0000000..59270a2 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/image-details~dark@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/menu-bar@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/menu-bar@2x.png new file mode 100644 index 0000000..da72d48 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/menu-bar@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/menu-bar~dark@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/menu-bar~dark@2x.png new file mode 100644 index 0000000..c4a9213 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/menu-bar~dark@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/pull-image@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/pull-image@2x.png new file mode 100644 index 0000000..f34ac60 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/pull-image@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/pull-image~dark@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/pull-image~dark@2x.png new file mode 100644 index 0000000..a8c26da Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/pull-image~dark@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/reports@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/reports@2x.png new file mode 100644 index 0000000..f807d32 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/reports@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/reports~dark@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/reports~dark@2x.png new file mode 100644 index 0000000..e10a701 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/reports~dark@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/run-container@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/run-container@2x.png new file mode 100644 index 0000000..9433b7a Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/run-container@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/run-container~dark@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/run-container~dark@2x.png new file mode 100644 index 0000000..bbdd255 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/run-container~dark@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/settings-network@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/settings-network@2x.png new file mode 100644 index 0000000..3300a92 Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/settings-network@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/settings-network~dark@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/settings-network~dark@2x.png new file mode 100644 index 0000000..00d0dbf Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/settings-network~dark@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/status-bar-menu@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/status-bar-menu@2x.png new file mode 100644 index 0000000..25a4d6a Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/status-bar-menu@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/status-bar-menu~dark@2x.png b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/status-bar-menu~dark@2x.png new file mode 100644 index 0000000..30dbb4a Binary files /dev/null and b/Containers/Supporting Files/Help.bundle/images/app.containers.Containers/status-bar-menu~dark@2x.png differ diff --git a/Containers/Supporting Files/Help.bundle/img/added-icon.832a5d2c.svg b/Containers/Supporting Files/Help.bundle/img/added-icon.832a5d2c.svg new file mode 100644 index 0000000..6bb6d89 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/img/added-icon.832a5d2c.svg @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/img/deprecated-icon.7bf1740a.svg b/Containers/Supporting Files/Help.bundle/img/deprecated-icon.7bf1740a.svg new file mode 100644 index 0000000..a0f8008 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/img/deprecated-icon.7bf1740a.svg @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/img/modified-icon.efb2697d.svg b/Containers/Supporting Files/Help.bundle/img/modified-icon.efb2697d.svg new file mode 100644 index 0000000..3e0bd6f --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/img/modified-icon.efb2697d.svg @@ -0,0 +1,11 @@ + + + \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/index/index.json b/Containers/Supporting Files/Help.bundle/index/index.json new file mode 100644 index 0000000..74768db --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/index/index.json @@ -0,0 +1 @@ +{"includedArchiveIdentifiers":["app.containers.Containers"],"interfaceLanguages":{"swift":[{"children":[{"title":"Essentials","type":"groupMarker"},{"path":"\/documentation\/containers\/gettingstarted","title":"Getting started with Containers","type":"article"},{"path":"\/documentation\/containers\/exploringthedashboard","title":"Exploring the dashboard","type":"article"},{"path":"\/documentation\/containers\/viewingdetails","title":"Viewing details","type":"article"},{"title":"Images and containers","type":"groupMarker"},{"children":[{"path":"\/documentation\/containers\/pullinganimage","title":"Pulling an image","type":"article"},{"path":"\/documentation\/containers\/buildinganimagefromadockerfile","title":"Building an image from a Dockerfile","type":"article"},{"path":"\/documentation\/containers\/loadingandsavingimages","title":"Loading and saving images","type":"article"}],"path":"\/documentation\/containers\/workingwithimages","title":"Images","type":"collection"},{"children":[{"path":"\/documentation\/containers\/runningacontainer","title":"Running a container","type":"article"},{"path":"\/documentation\/containers\/readingacontainerslogs","title":"Reading a container’s logs","type":"article"}],"path":"\/documentation\/containers\/workingwithcontainers","title":"Containers","type":"collection"},{"title":"Storage","type":"groupMarker"},{"path":"\/documentation\/containers\/managingvolumes","title":"Managing volumes","type":"article"},{"path":"\/documentation\/containers\/choosingwherecontainersstoresdata","title":"Choosing where Containers stores data","type":"article"},{"title":"Networking","type":"groupMarker"},{"path":"\/documentation\/containers\/managingnetworks","title":"Managing networks","type":"article"},{"path":"\/documentation\/containers\/reachinghostserviceswithdnsdomains","title":"Reaching containers and host services by name","type":"article"},{"title":"Troubleshooting","type":"groupMarker"},{"path":"\/documentation\/containers\/reviewingreports","title":"Reviewing reports","type":"article"},{"title":"Articles","type":"groupMarker"},{"path":"\/documentation\/containers\/understandinghowcontainersworks","title":"Understanding how Containers works","type":"article"}],"path":"\/documentation\/containers","title":"Containers","type":"module"}]},"schemaVersion":{"major":0,"minor":1,"patch":2}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/127.978d0861.js b/Containers/Supporting Files/Help.bundle/js/127.978d0861.js new file mode 100644 index 0000000..795dfc8 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/127.978d0861.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[127],{5127:function(){(function(){"use strict";if("object"===typeof window)if("IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)"isIntersecting"in window.IntersectionObserverEntry.prototype||Object.defineProperty(window.IntersectionObserverEntry.prototype,"isIntersecting",{get:function(){return this.intersectionRatio>0}});else{var t=function(t){var e=t,n=i(e);while(n)e=n.ownerDocument,n=i(e);return e}(window.document),e=[],n=null,o=null;s.prototype.THROTTLE_TIMEOUT=100,s.prototype.POLL_INTERVAL=null,s.prototype.USE_MUTATION_OBSERVER=!0,s._setupCrossOriginUpdater=function(){return n||(n=function(t,n){o=t&&n?g(t,n):p(),e.forEach(function(t){t._checkForIntersections()})}),n},s._resetCrossOriginUpdater=function(){n=null,o=null},s.prototype.observe=function(t){var e=this._observationTargets.some(function(e){return e.element==t});if(!e){if(!t||1!=t.nodeType)throw new Error("target must be an Element");this._registerInstance(),this._observationTargets.push({element:t,entry:null}),this._monitorIntersections(t.ownerDocument),this._checkForIntersections()}},s.prototype.unobserve=function(t){this._observationTargets=this._observationTargets.filter(function(e){return e.element!=t}),this._unmonitorIntersections(t.ownerDocument),0==this._observationTargets.length&&this._unregisterInstance()},s.prototype.disconnect=function(){this._observationTargets=[],this._unmonitorAllIntersections(),this._unregisterInstance()},s.prototype.takeRecords=function(){var t=this._queuedEntries.slice();return this._queuedEntries=[],t},s.prototype._initThresholds=function(t){var e=t||[0];return Array.isArray(e)||(e=[e]),e.sort().filter(function(t,e,n){if("number"!=typeof t||isNaN(t)||t<0||t>1)throw new Error("threshold must be a number between 0 and 1 inclusively");return t!==n[e-1]})},s.prototype._parseRootMargin=function(t){var e=t||"0px",n=e.split(/\s+/).map(function(t){var e=/^(-?\d*\.?\d+)(px|%)$/.exec(t);if(!e)throw new Error("rootMargin must be specified in pixels or percent");return{value:parseFloat(e[1]),unit:e[2]}});return n[1]=n[1]||n[0],n[2]=n[2]||n[0],n[3]=n[3]||n[1],n},s.prototype._monitorIntersections=function(e){var n=e.defaultView;if(n&&-1==this._monitoringDocuments.indexOf(e)){var o=this._checkForIntersections,r=null,s=null;this.POLL_INTERVAL?r=n.setInterval(o,this.POLL_INTERVAL):(c(n,"resize",o,!0),c(e,"scroll",o,!0),this.USE_MUTATION_OBSERVER&&"MutationObserver"in n&&(s=new n.MutationObserver(o),s.observe(e,{attributes:!0,childList:!0,characterData:!0,subtree:!0}))),this._monitoringDocuments.push(e),this._monitoringUnsubscribes.push(function(){var t=e.defaultView;t&&(r&&t.clearInterval(r),a(t,"resize",o,!0)),a(e,"scroll",o,!0),s&&s.disconnect()});var h=this.root&&(this.root.ownerDocument||this.root)||t;if(e!=h){var u=i(e);u&&this._monitorIntersections(u.ownerDocument)}}},s.prototype._unmonitorIntersections=function(e){var n=this._monitoringDocuments.indexOf(e);if(-1!=n){var o=this.root&&(this.root.ownerDocument||this.root)||t,r=this._observationTargets.some(function(t){var n=t.element.ownerDocument;if(n==e)return!0;while(n&&n!=o){var r=i(n);if(n=r&&r.ownerDocument,n==e)return!0}return!1});if(!r){var s=this._monitoringUnsubscribes[n];if(this._monitoringDocuments.splice(n,1),this._monitoringUnsubscribes.splice(n,1),s(),e!=o){var h=i(e);h&&this._unmonitorIntersections(h.ownerDocument)}}}},s.prototype._unmonitorAllIntersections=function(){var t=this._monitoringUnsubscribes.slice(0);this._monitoringDocuments.length=0,this._monitoringUnsubscribes.length=0;for(var e=0;e=0&&h>=0&&{top:n,bottom:o,left:i,right:r,width:s,height:h}||null}function f(t){var e;try{e=t.getBoundingClientRect()}catch(n){}return e?(e.width&&e.height||(e={top:e.top,right:e.right,bottom:e.bottom,left:e.left,width:e.right-e.left,height:e.bottom-e.top}),e):p()}function p(){return{top:0,bottom:0,left:0,right:0,width:0,height:0}}function d(t){return!t||"x"in t?t:{top:t.top,y:t.top,bottom:t.bottom,left:t.left,x:t.left,right:t.right,width:t.width,height:t.height}}function g(t,e){var n=e.top-t.top,o=e.left-t.left;return{top:n,left:o,height:e.height,width:e.width,bottom:n+e.height,right:o+e.width}}function m(t,e){var n=e;while(n){if(n==t)return!0;n=_(n)}return!1}function _(e){var n=e.parentNode;return 9==e.nodeType&&e!=t?i(e):(n&&n.assignedSlot&&(n=n.assignedSlot.parentNode),n&&11==n.nodeType&&n.host?n.host:n)}function v(t){return t&&9===t.nodeType}})()}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/416.eb5e5474.js b/Containers/Supporting Files/Help.bundle/js/416.eb5e5474.js new file mode 100644 index 0000000..f3fc5a3 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/416.eb5e5474.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +"use strict";(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[416],{620:function(t,e,n){n.d(e,{A:function(){return u}});var r=function(){var t=this,e=t._self._c;return e("SVGIcon",{staticClass:"inline-chevron-down-icon",attrs:{viewBox:"0 0 14 14",themeId:"inline-chevron-down"}},[e("path",{attrs:{d:"M12.634 2.964l0.76 0.649-6.343 7.426-6.445-7.423 0.755-0.655 5.683 6.545 5.59-6.542z"}})])},s=[],o=n(6515),i={name:"InlineChevronDownIcon",components:{SVGIcon:o.A}},a=i,l=n(1656),c=(0,l.A)(a,r,s,!1,null,null,null),u=c.exports},822:function(t,e,n){n.d(e,{A:function(){return y}});var r=function(){var t=this,e=t._self._c;return e("div",{style:t.codeStyle},[t._t("default")],2)},s=[],o=n(6131);const i=0,a=255;function l(t){const e=t.match(/rgba\((\d+),\s*(\d+),\s*(\d+),\s*(\d+\.?\d*|\.\d+)\s*\)/);if(!e)throw new Error("invalid rgba() input");const n=10;return{r:parseInt(e[1],n),g:parseInt(e[2],n),b:parseInt(e[3],n),a:parseFloat(e[4])}}function c(t){const{r:e,g:n,b:r}=l(t);return.2126*e+.7152*n+.0722*r}function u(t,e){const n=Math.round(a*e),r=l(t),{a:s}=r,[o,c,u]=[r.r,r.g,r.b].map(t=>Math.max(i,Math.min(a,t+n)));return`rgba(${o}, ${c}, ${u}, ${s})`}function h(t,e){return u(t,e)}function d(t,e){return u(t,-1*e)}var f={name:"CodeTheme",data(){return{codeThemeState:o.A.state}},computed:{codeStyle(){const{codeColors:t}=this.codeThemeState;return t?{"--text":t.text,"--background":t.background,"--line-highlight":t.lineHighlight,"--url":t.commentURL,"--syntax-comment":t.comment,"--syntax-quote":t.comment,"--syntax-keyword":t.keyword,"--syntax-literal":t.keyword,"--syntax-selector-tag":t.keyword,"--syntax-string":t.stringLiteral,"--syntax-bullet":t.stringLiteral,"--syntax-meta":t.keyword,"--syntax-number":t.stringLiteral,"--syntax-symbol":t.stringLiteral,"--syntax-tag":t.stringLiteral,"--syntax-attr":t.typeAnnotation,"--syntax-built_in":t.typeAnnotation,"--syntax-builtin-name":t.typeAnnotation,"--syntax-class":t.typeAnnotation,"--syntax-params":t.typeAnnotation,"--syntax-section":t.typeAnnotation,"--syntax-title":t.typeAnnotation,"--syntax-type":t.typeAnnotation,"--syntax-attribute":t.keyword,"--syntax-identifier":t.text,"--syntax-subst":t.text,"--color-syntax-param-internal-name":this.internalParamNameColor}:null},internalParamNameColor(){const{background:t,text:e}=this.codeThemeState.codeColors;try{const n=c(t),r=n1&&void 0!==arguments[1]?arguments[1]:{};return t.reduce(function(t,n){var r=n.passengers[0],s="function"===typeof r?r(e):n.passengers;return t.concat(s)},[])}function f(t,e){return t.map(function(t,e){return[e,t]}).sort(function(t,n){return e(t[1],n[1])||t[0]-n[0]}).map(function(t){return t[1]})}function p(t,e){return e.reduce(function(e,n){return t.hasOwnProperty(n)&&(e[n]=t[n]),e},{})}var m={},g={},y={},b=s.extend({data:function(){return{transports:m,targets:g,sources:y,trackInstances:u}},methods:{open:function(t){if(u){var e=t.to,n=t.from,r=t.passengers,o=t.order,i=void 0===o?1/0:o;if(e&&n&&r){var a={to:e,from:n,passengers:h(r),order:i},l=Object.keys(this.transports);-1===l.indexOf(e)&&s.set(this.transports,e,[]);var c=this.$_getTransportIndex(a),d=this.transports[e].slice(0);-1===c?d.push(a):d[c]=a,this.transports[e]=f(d,function(t,e){return t.order-e.order})}}},close:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=t.to,r=t.from;if(n&&(r||!1!==e)&&this.transports[n])if(e)this.transports[n]=[];else{var s=this.$_getTransportIndex(t);if(s>=0){var o=this.transports[n].slice(0);o.splice(s,1),this.transports[n]=o}}},registerTarget:function(t,e,n){u&&(this.trackInstances&&!n&&this.targets[t]&&console.warn("[portal-vue]: Target ".concat(t," already exists")),this.$set(this.targets,t,Object.freeze([e])))},unregisterTarget:function(t){this.$delete(this.targets,t)},registerSource:function(t,e,n){u&&(this.trackInstances&&!n&&this.sources[t]&&console.warn("[portal-vue]: source ".concat(t," already exists")),this.$set(this.sources,t,Object.freeze([e])))},unregisterSource:function(t){this.$delete(this.sources,t)},hasTarget:function(t){return!(!this.targets[t]||!this.targets[t][0])},hasSource:function(t){return!(!this.sources[t]||!this.sources[t][0])},hasContentFor:function(t){return!!this.transports[t]&&!!this.transports[t].length},$_getTransportIndex:function(t){var e=t.to,n=t.from;for(var r in this.transports[e])if(this.transports[e][r].from===n)return+r;return-1}}}),v=new b(m),T=1,S=s.extend({name:"portal",props:{disabled:{type:Boolean},name:{type:String,default:function(){return String(T++)}},order:{type:Number,default:0},slim:{type:Boolean},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"DIV"},to:{type:String,default:function(){return String(Math.round(1e7*Math.random()))}}},created:function(){var t=this;this.$nextTick(function(){v.registerSource(t.name,t)})},mounted:function(){this.disabled||this.sendUpdate()},updated:function(){this.disabled?this.clear():this.sendUpdate()},beforeDestroy:function(){v.unregisterSource(this.name),this.clear()},watch:{to:function(t,e){e&&e!==t&&this.clear(e),this.sendUpdate()}},methods:{clear:function(t){var e={from:this.name,to:t||this.to};v.close(e)},normalizeSlots:function(){return this.$scopedSlots.default?[this.$scopedSlots.default]:this.$slots.default},normalizeOwnChildren:function(t){return"function"===typeof t?t(this.slotProps):t},sendUpdate:function(){var t=this.normalizeSlots();if(t){var e={from:this.name,to:this.to,passengers:i(t),order:this.order};v.open(e)}else this.clear()}},render:function(t){var e=this.$slots.default||this.$scopedSlots.default||[],n=this.tag;return e&&this.disabled?e.length<=1&&this.slim?this.normalizeOwnChildren(e)[0]:t(n,[this.normalizeOwnChildren(e)]):this.slim?t():t(n,{class:{"v-portal":!0},style:{display:"none"},key:"v-portal-placeholder"})}}),w=s.extend({name:"portalTarget",props:{multiple:{type:Boolean,default:!1},name:{type:String,required:!0},slim:{type:Boolean,default:!1},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"div"},transition:{type:[String,Object,Function]}},data:function(){return{transports:v.transports,firstRender:!0}},created:function(){var t=this;this.$nextTick(function(){v.registerTarget(t.name,t)})},watch:{ownTransports:function(){this.$emit("change",this.children().length>0)},name:function(t,e){v.unregisterTarget(e),v.registerTarget(t,this)}},mounted:function(){var t=this;this.transition&&this.$nextTick(function(){t.firstRender=!1})},beforeDestroy:function(){v.unregisterTarget(this.name)},computed:{ownTransports:function(){var t=this.transports[this.name]||[];return this.multiple?t:0===t.length?[]:[t[t.length-1]]},passengers:function(){return d(this.ownTransports,this.slotProps)}},methods:{children:function(){return 0!==this.passengers.length?this.passengers:this.$scopedSlots.default?this.$scopedSlots.default(this.slotProps):this.$slots.default||[]},noWrapper:function(){var t=this.slim&&!this.transition;return t&&this.children().length>1&&console.warn("[portal-vue]: PortalTarget with `slim` option received more than one child element."),t}},render:function(t){var e=this.noWrapper(),n=this.children(),r=this.transition||this.tag;return e?n[0]:this.slim&&!r?t():t(r,{props:{tag:this.transition&&this.tag?this.tag:void 0},class:{"vue-portal-target":!0}},n)}}),C=0,$=["disabled","name","order","slim","slotProps","tag","to"],k=["multiple","transition"],x=s.extend({name:"MountingPortal",inheritAttrs:!1,props:{append:{type:[Boolean,String]},bail:{type:Boolean},mountTo:{type:String,required:!0},disabled:{type:Boolean},name:{type:String,default:function(){return"mounted_"+String(C++)}},order:{type:Number,default:0},slim:{type:Boolean},slotProps:{type:Object,default:function(){return{}}},tag:{type:String,default:"DIV"},to:{type:String,default:function(){return String(Math.round(1e7*Math.random()))}},multiple:{type:Boolean,default:!1},targetSlim:{type:Boolean},targetSlotProps:{type:Object,default:function(){return{}}},targetTag:{type:String,default:"div"},transition:{type:[String,Object,Function]}},created:function(){if("undefined"!==typeof document){var t=document.querySelector(this.mountTo);if(t){var e=this.$props;if(v.targets[e.name])e.bail?console.warn("[portal-vue]: Target ".concat(e.name," is already mounted.\n Aborting because 'bail: true' is set")):this.portalTarget=v.targets[e.name];else{var n=e.append;if(n){var r="string"===typeof n?n:"DIV",s=document.createElement(r);t.appendChild(s),t=s}var o=p(this.$props,k);o.slim=this.targetSlim,o.tag=this.targetTag,o.slotProps=this.targetSlotProps,o.name=this.to,this.portalTarget=new w({el:t,parent:this.$parent||this,propsData:o})}}else console.error("[portal-vue]: Mount Point '".concat(this.mountTo,"' not found in document"))}},beforeDestroy:function(){var t=this.portalTarget;if(this.append){var e=t.$el;e.parentNode.removeChild(e)}t.$destroy()},render:function(t){if(!this.portalTarget)return console.warn("[portal-vue] Target wasn't mounted"),t();if(!this.$scopedSlots.manual){var e=p(this.$props,$);return t(S,{props:e,attrs:this.$attrs,on:this.$listeners,scopedSlots:this.$scopedSlots},this.$slots.default)}var n=this.$scopedSlots.manual({to:this.to});return Array.isArray(n)&&(n=n[0]),n||t()}});function A(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t.component(e.portalName||"Portal",S),t.component(e.portalTargetName||"PortalTarget",w),t.component(e.MountingPortalName||"MountingPortal",x)}var I={install:A};e.ZL=S,e.mf=w},5948:function(t,e,n){n.d(e,{A:function(){return u}});var r=function(){var t=this,e=t._self._c;return e("SVGIcon",{staticClass:"inline-plus-circle-icon",attrs:{viewBox:"0 0 14 14",themeId:"inline-plus-circle"}},[e("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5v0c0-3.59 2.91-6.5 6.5-6.5v0zM7 1.5c-3.038 0-5.5 2.462-5.5 5.5s2.462 5.5 5.5 5.5c3.038 0 5.5-2.462 5.5-5.5v0c0-3.038-2.462-5.5-5.5-5.5v0z"}}),e("path",{attrs:{d:"M4 6.52h6v1h-6v-1z"}}),e("path",{attrs:{d:"M6.5 4.010h1v6h-1v-6z"}})])},s=[],o=n(6515),i={name:"InlinePlusCircleIcon",components:{SVGIcon:o.A}},a=i,l=n(1656),c=(0,l.A)(a,r,s,!1,null,null,null),u=c.exports},6131:function(t,e,n){n(8111),n(8237);e.A={state:{codeColors:null},reset(){this.state.codeColors=null},updateCodeColors(t){const e=t=>t?`rgba(${t.red}, ${t.green}, ${t.blue}, ${t.alpha})`:null;this.state.codeColors=Object.entries(t).reduce((t,[n,r])=>({...t,[n]:e(r)}),{})}}},6262:function(t,e,n){n.d(e,{A:function(){return m}});var r=function(){var t=this,e=t._self._c;return e("PortalSource",{attrs:{to:"modal-destination",disabled:!t.isVisible}},[e("div",{directives:[{name:"show",rawName:"v-show",value:t.isVisible,expression:"isVisible"}],staticClass:"generic-modal",class:[t.stateClasses,t.themeClass],style:t.modalColors,attrs:{role:"dialog"}},[e("div",{staticClass:"backdrop",on:{click:t.onClickOutside}}),e("div",{ref:"container",staticClass:"container",style:{width:t.width}},[t.showClose?e("button",{ref:"close",staticClass:"close",attrs:{"aria-label":t.$t("verbs.close")},on:{click:function(e){return e.preventDefault(),t.closeModal.apply(null,arguments)}}},[e("CloseIcon")],1):t._e(),e("div",{ref:"content",staticClass:"modal-content"},[t._t("default")],2)])])])},s=[],o=n(4610),i=n(9723),a=n(8717),l=n(2197),c=n(8457);const u={light:"light",dark:"dark",dynamic:"dynamic",code:"code"};var h={name:"GenericModal",model:{prop:"visible",event:"update:visible"},components:{CloseIcon:c.A,PortalSource:l.ZL},props:{visible:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},theme:{type:String,validator:t=>Object.keys(u).includes(t),default:u.light},codeBackgroundColorOverride:{type:String,default:""},backdropBackgroundColorOverride:{type:String,default:""},width:{type:String,default:null},showClose:{type:Boolean,default:!0}},data(){return{lastFocusItem:null,prefersDarkStyle:!1,focusTrapInstance:null}},computed:{isVisible:{get:({visible:t})=>t,set(t){this.$emit("update:visible",t)}},modalColors(){return{"--code-background":this.codeBackgroundColorOverride,"--backdrop-background":this.backdropBackgroundColorOverride}},themeClass({theme:t,prefersDarkStyle:e,isThemeDynamic:n}){let r={};return n&&(r={"theme-light":!e,"theme-dark":e}),[`theme-${t}`,r]},stateClasses:({isFullscreen:t,isVisible:e,showClose:n})=>({"modal-fullscreen":t,"modal-standard":!t,"modal-open":e,"modal-with-close":n}),isThemeDynamic:({theme:t})=>t===u.dynamic||t===u.code},watch:{isVisible(t){t?this.onShow():this.onHide()}},mounted(){if(this.focusTrapInstance=new i.A,document.addEventListener("keydown",this.onKeydown),this.isThemeDynamic){const t=window.matchMedia("(prefers-color-scheme: dark)");t.addListener(this.onColorSchemePreferenceChange),this.$once("hook:beforeDestroy",()=>{t.removeListener(this.onColorSchemePreferenceChange)}),this.onColorSchemePreferenceChange(t)}},beforeDestroy(){this.isVisible&&o.A.unlockScroll(this.$refs.container),document.removeEventListener("keydown",this.onKeydown),this.focusTrapInstance.destroy()},methods:{async onShow(){await this.$nextTick(),o.A.lockScroll(this.$refs.container),await this.focusCloseButton(),this.focusTrapInstance.updateFocusContainer(this.$refs.container),this.focusTrapInstance.start(),a.A.hide(this.$refs.container)},onHide(){o.A.unlockScroll(this.$refs.container),this.focusTrapInstance.stop(),this.lastFocusItem&&(this.lastFocusItem.focus({preventScroll:!0}),this.lastFocusItem=null),this.$emit("close"),a.A.show(this.$refs.container)},closeModal(){this.isVisible=!1},selectContent(){window.getSelection().selectAllChildren(this.$refs.content)},onClickOutside(){this.closeModal()},onKeydown(t){const{metaKey:e=!1,ctrlKey:n=!1,key:r}=t;this.isVisible&&("a"===r&&(e||n)&&(t.preventDefault(),this.selectContent()),"Escape"===r&&(t.preventDefault(),this.closeModal()))},onColorSchemePreferenceChange({matches:t}){this.prefersDarkStyle=t},async focusCloseButton(){this.lastFocusItem=document.activeElement,await this.$nextTick(),this.$refs.close&&this.$refs.close.focus(),this.$emit("open")}}},d=h,f=n(1656),p=(0,f.A)(d,r,s,!1,null,"795f7b59",null),m=p.exports},9723:function(t,e,n){function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function s(t,e){if("object"!=r(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var s=n.call(t,e||"default");if("object"!=r(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}function o(t){var e=s(t,"string");return"symbol"==r(e)?e:e+""}function i(t,e,n){return(e=o(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}n.d(e,{A:function(){return l}});var a=n(3571);class l{constructor(t){i(this,"focusContainer",null),i(this,"tabTargets",[]),i(this,"firstTabTarget",null),i(this,"lastTabTarget",null),i(this,"lastFocusedElement",null),this.focusContainer=t,this.onFocus=this.onFocus.bind(this)}updateFocusContainer(t){this.focusContainer=t}start(){this.collectTabTargets(),this.firstTabTarget?this.focusContainer.contains(document.activeElement)&&a.Ay.isTabbableElement(document.activeElement)||this.firstTabTarget.focus():console.warn("There are no focusable elements. FocusTrap needs at least one."),this.lastFocusedElement=document.activeElement,document.addEventListener("focus",this.onFocus,!0)}stop(){document.removeEventListener("focus",this.onFocus,!0)}collectTabTargets(){this.tabTargets=a.Ay.getTabbableElements(this.focusContainer),this.firstTabTarget=this.tabTargets[0],this.lastTabTarget=this.tabTargets[this.tabTargets.length-1]}onFocus(t){if(this.focusContainer.contains(t.target))this.lastFocusedElement=t.target;else{if(t.preventDefault(),this.collectTabTargets(),this.lastFocusedElement===this.lastTabTarget||!this.lastFocusedElement||!document.contains(this.lastFocusedElement))return this.firstTabTarget.focus(),void(this.lastFocusedElement=this.firstTabTarget);this.lastFocusedElement===this.firstTabTarget&&(this.lastTabTarget.focus(),this.lastFocusedElement=this.lastTabTarget)}}destroy(){this.stop(),this.focusContainer=null,this.tabTargets=[],this.firstTabTarget=null,this.lastTabTarget=null,this.lastFocusedElement=null}}}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/671.3ef2a03c.js b/Containers/Supporting Files/Help.bundle/js/671.3ef2a03c.js new file mode 100644 index 0000000..316ee81 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/671.3ef2a03c.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[671],{9:function(e,t,n){"use strict";n.r(t),n.d(t,{BlockType:function(){return Mt},default:function(){return Ht}});n(8111),n(7588),n(1701),n(8237);var r=n(4783),i=n(2481),s=n(1097),a=n(3117),o=n(4828),l=function(){var e=this,t=e._self._c;return t("div",{staticClass:"DictionaryExample"},[e._t("default"),t("CollapsibleCodeListing",{attrs:{content:e.example.content,showLineNumbers:""}})],2)},c=[],u=function(){var e=this,t=e._self._c;return t("div",{staticClass:"collapsible-code-listing",class:{"single-line":1===e.content[0].code.length}},[t("pre",[t("CodeBlock",e._l(this.content,function(n,r){return t("div",{key:r,class:["container-general",{collapsible:!0===n.collapsible},{collapsed:!0===n.collapsible&&e.collapsed}]},e._l(n.code,function(n,r){return t("div",{key:r,staticClass:"code-line-container"},[e._v("\n "),t("div",{directives:[{name:"show",rawName:"v-show",value:e.showLineNumbers,expression:"showLineNumbers"}],staticClass:"code-number"}),e._v("\n "),t("div",{staticClass:"code-line"},[e._v(e._s(n))]),e._v("\n ")])}),0)}),0)],1)])},A=[],d=n(814),p={name:"CollapsibleCodeListing",components:{CodeBlock:d.A},props:{collapsed:{type:Boolean,required:!1},content:{type:Array,required:!0},showLineNumbers:{type:Boolean,default:()=>!0}}},h=p,g=n(1656),f=(0,g.A)(h,u,A,!1,null,"25a17a0e",null),m=f.exports,v={name:"DictionaryExample",components:{CollapsibleCodeListing:m},props:{example:{type:Object,required:!0}}},y=v,b=(0,g.A)(y,l,c,!1,null,null,null),C=b.exports,I=function(){var e=this,t=e._self._c;return t("Row",{staticClass:"endpoint-example"},[t("Column",{staticClass:"example-code"},[e._t("default"),t("Tabnav",{model:{value:e.currentTab,callback:function(t){e.currentTab=t},expression:"currentTab"}},[t("TabnavItem",{attrs:{value:e.Tab.request}},[e._v(e._s(e.$t("tab.request")))]),t("TabnavItem",{attrs:{value:e.Tab.response}},[e._v(e._s(e.$t("tab.response")))])],1),t("div",{staticClass:"output"},[e.isCurrent(e.Tab.request)?t("div",{staticClass:"code"},[t("CollapsibleCodeListing",e._b({attrs:{collapsed:e.isCollapsed,showLineNumbers:""}},"CollapsibleCodeListing",e.request,!1))],1):e._e(),e.isCurrent(e.Tab.response)?t("div",{staticClass:"code"},[t("CollapsibleCodeListing",e._b({attrs:{collapsed:e.isCollapsed,showLineNumbers:""}},"CollapsibleCodeListing",e.response,!1))],1):e._e()]),e.isCollapsible?t("div",{staticClass:"controls"},[e.isCollapsed?t("a",{staticClass:"toggle",attrs:{href:"#"},on:{click:function(t){return t.preventDefault(),e.showMore.apply(null,arguments)}}},[t("InlinePlusCircleSolidIcon",{staticClass:"control-icon icon-inline"}),e._v(" "+e._s(e.$t("more"))+" ")],1):t("a",{staticClass:"toggle",attrs:{href:"#"},on:{click:function(t){return t.preventDefault(),e.showLess.apply(null,arguments)}}},[t("InlineMinusCircleSolidIcon",{staticClass:"control-icon icon-inline"}),e._v(" "+e._s(e.$t("less"))+" ")],1)]):e._e()],2)],1)},w=[],E=(n(3579),n(6616)),B=n(2773),x=function(){var e=this,t=e._self._c;return t("nav",{staticClass:"tabnav",class:{[`tabnav--${e.position}`]:e.position,"tabnav--vertical":e.vertical}},[t("ul",{staticClass:"tabnav-items"},[e._t("default")],2)])},k=[];n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698);const S="tabnavData";var _={name:"Tabnav",constants:{ProvideKey:S},provide(){const e={selectTab:this.selectTab};return Object.defineProperty(e,"activeTab",{enumerable:!0,get:()=>this.value}),{[S]:e}},props:{position:{type:String,required:!1,validator:e=>new Set(["start","center","end"]).has(e)},vertical:{type:Boolean,default:!1},value:{type:[String,Number],required:!0}},methods:{selectTab(e){this.$emit("input",e)}}},T=_,L=(0,g.A)(T,x,k,!1,null,"5572fe1d",null),P=L.exports,Q=function(){var e=this,t=e._self._c;return t("li",{staticClass:"tabnav-item"},[t("a",{staticClass:"tabnav-link",class:{active:e.isActive},attrs:{href:"#","aria-current":e.isActive?"true":"false"},on:{click:function(t){return t.preventDefault(),e.tabnavData.selectTab(e.value)}}},[e._t("default")],2)])},M=[],D={name:"TabnavItem",inject:{tabnavData:{default:{activeTab:null,selectTab:()=>{}}}},props:{value:{type:[String,Number],default:null}},computed:{isActive({tabnavData:e,value:t}){return e.activeTab===t}}},O=D,R=(0,g.A)(O,Q,M,!1,null,"34546b25",null),N=R.exports,j=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"inline-plus-circle-solid-icon",attrs:{viewBox:"0 0 14 14",themeId:"inline-plus-circle-solid"}},[t("path",{attrs:{d:"M7.005 0.5h-0.008c-1.791 0.004-3.412 0.729-4.589 1.9l0-0c-1.179 1.177-1.908 2.803-1.908 4.6 0 3.59 2.91 6.5 6.5 6.5s6.5-2.91 6.5-6.5c0-3.587-2.906-6.496-6.492-6.5h-0zM4.005 7.52v-1h2.5v-2.51h1v2.51h2.5v1h-2.501v2.49h-1v-2.49z"}})])},V=[],G=n(6515),$={name:"InlinePlusCircleSolidIcon",components:{SVGIcon:G.A}},z=$,q=(0,g.A)(z,j,V,!1,null,null,null),H=q.exports,F=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"inline-minus-circle-solid-icon",attrs:{viewBox:"0 0 14 14",themeId:"inline-minus-circle-solid"}},[t("path",{attrs:{d:"m6.98999129.48999129c3.58985091 0 6.50000001 2.91014913 6.50000001 6.5 0 3.58985091-2.9101491 6.50000001-6.50000001 6.50000001-3.58985087 0-6.5-2.9101491-6.5-6.50000001 0-3.58985087 2.91014913-6.5 6.5-6.5zm3 6.02001742h-6v1h6z","fill-rule":"evenodd"}})])},W=[],U={name:"InlineMinusCircleSolidIcon",components:{SVGIcon:G.A}},Y=U,X=(0,g.A)(Y,F,W,!1,null,null,null),Z=X.exports;const K={request:"Request",response:"Response"};var J={name:"EndpointExample",components:{InlineMinusCircleSolidIcon:Z,InlinePlusCircleSolidIcon:H,TabnavItem:N,Tabnav:P,CollapsibleCodeListing:m,Row:E.A,Column:B.A},constants:{Tab:K},props:{request:{type:Object,required:!0},response:{type:Object,required:!0}},data(){return{isCollapsed:!0,currentTab:K.request}},computed:{Tab:()=>K,isCollapsible:({response:e,request:t,currentTab:n})=>{const r={[K.request]:t.content,[K.response]:e.content}[n]||[];return r.some(({collapsible:e})=>e)}},methods:{isCurrent(e){return this.currentTab===e},showMore(){this.isCollapsed=!1},showLess(){this.isCollapsed=!0}}},ee=J,te=(0,g.A)(ee,I,w,!1,null,"c84e62a6",null),ne=te.exports,re=function(){var e=this,t=e._self._c;return t("figure",{attrs:{id:e.anchor}},[e._t("default")],2)},ie=[],se={name:"Figure",props:{anchor:{type:String,required:!1}}},ae=se,oe=(0,g.A)(ae,re,ie,!1,null,null,null),le=oe.exports,ce=function(){var e=this,t=e._self._c;return t(e.tag,{tag:"component",staticClass:"caption",class:{trailing:e.trailing}},[e.title?[t("strong",[e._v(e._s(e.title))]),e._v(" "),e._t("default")]:[e._t("default")]],2)},ue=[];const Ae={caption:"caption",figcaption:"figcaption"},de={leading:"leading",trailing:"trailing"};var pe={name:"Caption",constants:{CaptionPosition:de,CaptionTag:Ae},props:{title:{type:String,required:!1},tag:{type:String,required:!0,validator:e=>Object.hasOwnProperty.call(Ae,e)},position:{type:String,default:()=>de.leading,validator:e=>Object.hasOwnProperty.call(de,e)}},computed:{trailing:({position:e})=>e===de.trailing}},he=pe,ge=(0,g.A)(he,ce,ue,!1,null,"869c6f6e",null),fe=ge.exports,me=function(){var e=this,t=e._self._c;return t("ImageAsset",{attrs:{alt:e.alt,variants:e.variants}})},ve=[],ye=n(9720),be={name:"InlineImage",components:{ImageAsset:ye.A},props:{alt:{type:String,default:""},variants:{type:Array,required:!0}}},Ce=be,Ie=(0,g.A)(Ce,me,ve,!1,null,"bf997940",null),we=Ie.exports,Ee=n(1754),Be=function(){var e=this,t=e._self._c;return t("div",{staticClass:"table-wrapper"},[t("table",{class:{spanned:e.spanned}},[e._t("default")],2)])},xe=[],ke={name:"Table",props:{spanned:{type:Boolean,default:!1}}},Se=ke,_e=(0,g.A)(Se,Be,xe,!1,null,"f3322390",null),Te=_e.exports,Le=function(){var e=this,t=e._self._c;return t("s",{attrs:{"data-before-text":e.$t("accessibility.strike.start"),"data-after-text":e.$t("accessibility.strike.end")}},[e._t("default")],2)},Pe=[],Qe={name:"StrikeThrough"},Me=Qe,De=(0,g.A)(Me,Le,Pe,!1,null,"7fc51673",null),Oe=De.exports,Re=function(){var e=this,t=e._self._c;return t("small",[e._t("default")],2)},Ne=[],je={name:"Small"},Ve=je,Ge=(0,g.A)(Ve,Re,Ne,!1,null,"77035f61",null),$e=Ge.exports,ze=function(){var e=this,t=e._self._c;return t("Asset",{attrs:{identifier:e.identifier,deviceFrame:e.deviceFrame}})},qe=[],He=n(8486),Fe={name:"BlockVideo",components:{Asset:He.A},props:{identifier:{type:String,required:!0},deviceFrame:{type:String,required:!1}}},We=Fe,Ue=(0,g.A)(We,ze,qe,!1,null,"4f18340d",null),Ye=Ue.exports,Xe=n(7505),Ze=n(8635),Ke=function(){var e=this,t=e._self._c;return t("div",{staticClass:"TabNavigator",class:[{"tabs--vertical":e.vertical}]},[t("Tabnav",e._b({model:{value:e.currentTitle,callback:function(t){e.currentTitle=t},expression:"currentTitle"}},"Tabnav",{position:e.position,vertical:e.vertical},!1),e._l(e.titles,function(n){return t("TabnavItem",{key:n,attrs:{value:n}},[e._v(" "+e._s(n)+" ")])}),1),t("div",{staticClass:"tabs-content"},[t("div",{staticClass:"tabs-content-container"},[t("transition-group",{attrs:{name:"fade"}},[e._l(e.titles,function(n){return[t("div",{directives:[{name:"show",rawName:"v-show",value:n===e.currentTitle,expression:"title === currentTitle"}],key:n,staticClass:"tab-container",class:{active:n===e.currentTitle}},[e._t(n)],2)]})],2)],1)])],1)},Je=[],et=(n(116),{name:"TabNavigator",components:{TabnavItem:N,Tabnav:P},props:{vertical:{type:Boolean,default:!1},position:{type:String,default:"start",validator:e=>new Set(["start","center","end"]).has(e)},titles:{type:Array,required:!0,default:()=>[]}},data(){return{currentTitle:this.titles[0]}},watch:{titles(e,t){if(e.length!t.includes(e));this.currentTitle=n||this.currentTitle}}}}),tt=et,nt=(0,g.A)(tt,Ke,Je,!1,null,"ae2b1b30",null),rt=nt.exports,it=function(){var e=this,t=e._self._c;return t("ul",{staticClass:"tasklist"},e._l(e.tasks,function(n,r){return t("li",{key:r},[e.showCheckbox(n)?t("input",{attrs:{type:"checkbox",disabled:""},domProps:{checked:n.checked}}):e._e(),e._t("task",null,{task:n})],2)}),0)},st=[];const at="checked",ot=e=>Object.hasOwnProperty.call(e,at);var lt={name:"TaskList",props:{tasks:{required:!0,type:Array,validator:e=>e.some(ot)}},methods:{showCheckbox:ot}},ct=lt,ut=(0,g.A)(ct,it,st,!1,null,"6a56a858",null),At=ut.exports,dt=function(){var e=this,t=e._self._c;return e.isListStyle?t("div",{staticClass:"links-block"},e._l(e.items,function(e){return t("TopicsLinkBlock",{key:e.identifier,staticClass:"topic-link-block",attrs:{topic:e}})}),1):t("TopicsLinkCardGrid",{staticClass:"links-block",attrs:{items:e.items,"topic-style":e.blockStyle}})},pt=[],ht=n(4885),gt=n(2853),ft={name:"LinksBlock",mixins:[r.A],components:{TopicsLinkBlock:()=>Promise.all([n.e(981),n.e(482)]).then(n.bind(n,3981)),TopicsLinkCardGrid:ht.A},props:{identifiers:{type:Array,required:!0},blockStyle:{type:String,default:gt.Z.compactGrid}},computed:{isListStyle:({blockStyle:e})=>e===gt.Z.list,items:({identifiers:e,references:t})=>e.reduce((e,n)=>t[n]?e.concat(t[n]):e,[])}},mt=ft,vt=(0,g.A)(mt,dt,pt,!1,null,"b1a75c1c",null),yt=vt.exports,bt=n(164),Ct=function(){var e=this,t=e._self._c;return t("hr",{staticClass:"thematic-break"})},It=[],wt={},Et=(0,g.A)(wt,Ct,It,!1,null,"62d2922a",null),Bt=Et.exports,xt=function(){var e=this,t=e._self._c;return t("article",{staticClass:"overviewcard"},[e.$slots.head?t("header",{staticClass:"overviewcard-head"},[e._t("head")],2):e._e(),t("div",{staticClass:"overviewcard-content"},[e._t("default")],2)])},kt=[],St={name:"OverviewCard"},_t=St,Tt=(0,g.A)(_t,xt,kt,!1,null,"73743ed9",null),Lt=Tt.exports;const{CaptionPosition:Pt,CaptionTag:Qt}=fe.constants,Mt={aside:"aside",codeListing:"codeListing",endpointExample:"endpointExample",heading:"heading",orderedList:"orderedList",paragraph:"paragraph",table:"table",termList:"termList",unorderedList:"unorderedList",dictionaryExample:"dictionaryExample",small:"small",video:"video",row:"row",tabNavigator:"tabNavigator",links:"links",thematicBreak:"thematicBreak",overviewCard:"overviewCard"},Dt={codeVoice:"codeVoice",emphasis:"emphasis",image:"image",inlineHead:"inlineHead",link:"link",newTerm:"newTerm",reference:"reference",strong:"strong",text:"text",superscript:"superscript",subscript:"subscript",strikethrough:"strikethrough"},Ot={both:"both",column:"column",none:"none",row:"row"},Rt={left:"left",right:"right",center:"center",unset:"unset"},Nt=7;function jt(e,t){const n=n=>n.map(jt(e,t)),r=t=>t.map(t=>e("li",{},n(t.content))),l=(t,r,i,s,a,o,l)=>{const{colspan:c,rowspan:u}=o[`${a}_${s}`]||{};if(0===c||0===u)return null;const A=l[s]||Rt.unset;let d=null;return A!==Rt.unset&&(d=`${A}-cell`),e(t,{attrs:{...r,colspan:c,rowspan:u},class:d},n(i))},c=(t,n=Ot.none,r={},i=[])=>{switch(n){case Ot.both:{const[n,...s]=t;return[e("thead",{},[e("tr",{},n.map((e,t)=>l("th",{scope:"col"},e,t,0,r,i)))]),e("tbody",{},s.map(([t,...n],s)=>e("tr",{},[l("th",{scope:"row"},t,0,s+1,r,i),...n.map((e,t)=>l("td",{},e,t+1,s+1,r,i))])))]}case Ot.column:return[e("tbody",{},t.map(([t,...n],s)=>e("tr",{},[l("th",{scope:"row"},t,0,s,r,i),...n.map((e,t)=>l("td",{},e,t+1,s,r,i))])))];case Ot.row:{const[n,...s]=t;return[e("thead",{},[e("tr",{},n.map((e,t)=>l("th",{scope:"col"},e,t,0,r,i)))]),e("tbody",{},s.map((t,n)=>e("tr",{},t.map((e,t)=>l("td",{},e,t,n+1,r,i)))))]}default:return[e("tbody",{},t.map((t,n)=>e("tr",{},t.map((e,t)=>l("td",{},e,t,n,r,i)))))]}},u=({metadata:{abstract:t=[],anchor:r,title:i,...s},...a})=>{const o={...a,metadata:s},l=[n([o])];if(i&&t.length||t.length){const r=i?Pt.leading:Pt.trailing,s=r===Pt.trailing?1:0,a=Qt.figcaption;l.splice(s,0,e(fe,{props:{title:i,position:r,tag:a}},n(t)))}return e(le,{props:{anchor:r}},l)},A=({metadata:{deviceFrame:t},...r})=>e(bt.A,{props:{device:t}},n([r]));return function(l){switch(l.type){case Mt.aside:{const t={kind:l.style,name:l.name};return e(i.A,{props:t},n(l.content))}case Mt.codeListing:{if(l.metadata&&l.metadata.anchor)return u(l);const t={syntax:l.syntax,fileType:l.fileType,content:l.code,showLineNumbers:l.showLineNumbers,copyToClipboard:l.copyToClipboard??!1,wrap:l.wrap??0,lineAnnotations:l.lineAnnotations??[]};return e(s.A,{props:t})}case Mt.endpointExample:{const t={request:l.request,response:l.response};return e(ne,{props:t},n(l.summary||[]))}case Mt.heading:{const t={anchor:l.anchor,level:l.level};return e(a.A,{props:t},l.text)}case Mt.orderedList:return e("ol",{attrs:{start:l.start}},r(l.items));case Mt.paragraph:{const t=1===l.inlineContent.length&&l.inlineContent[0].type===Dt.image,r=t?{class:["inline-image-container"]}:{};return e("p",r,n(l.inlineContent))}case Mt.table:{const t=c(l.rows,l.header,l.extendedData,l.alignments);if(l.metadata&&l.metadata.abstract){const{title:r}=l.metadata,i=r?Pt.leading:Pt.trailing,s=Qt.caption;t.unshift(e(fe,{props:{title:r,position:i,tag:s}},n(l.metadata.abstract)))}return e(Te,{attrs:{id:l.metadata&&l.metadata.anchor},props:{spanned:!!l.extendedData}},t)}case Mt.termList:return e("dl",{},l.items.map(({term:t,definition:r})=>[e("dt",{},n(t.inlineContent)),e("dd",{},n(r.content))]));case Mt.unorderedList:{const t=e=>At.props.tasks.validator(e.items);return t(l)?e(At,{props:{tasks:l.items},scopedSlots:{task:e=>n(e.task.content)}}):e("ul",{},r(l.items))}case Mt.dictionaryExample:{const t={example:l.example};return e(C,{props:t},n(l.summary||[]))}case Mt.small:return e("p",{},[e($e,{},n(l.inlineContent))]);case Mt.video:{if(l.metadata&&l.metadata.abstract)return u(l);if(!t[l.identifier])return null;const{deviceFrame:n}=l.metadata||{};return e(Ye,{props:{identifier:l.identifier,deviceFrame:n}})}case Mt.row:{const t=l.numberOfColumns?{large:l.numberOfColumns}:void 0;return e(Ze.A,{props:{columns:t}},l.columns.map(t=>e(Xe.A,{props:{span:t.size}},n(t.content))))}case Mt.tabNavigator:{const t=l.tabs.length>Nt,r=l.tabs.map(e=>e.title),i=l.tabs.reduce((e,t)=>({...e,[t.title]:()=>n(t.content)}),{});return e(rt,{props:{titles:r,vertical:t},scopedSlots:i})}case Mt.links:return e(yt,{props:{blockStyle:l.style,identifiers:l.items}});case Mt.thematicBreak:return e(Bt);case Mt.overviewCard:return e(Lt,{},[...n(l.head??[]).map(e=>({...e,data:{...e.data,slot:"head"}})),...n(l.content)]);case Dt.codeVoice:return e(o.A,{class:"inline-code"},l.code);case Dt.emphasis:case Dt.newTerm:return e("em",n(l.inlineContent));case Dt.image:{if(l.metadata&&(l.metadata.anchor||l.metadata.abstract))return u(l);const n=t[l.identifier];return n?l.metadata&&l.metadata.deviceFrame?A(l):e(we,{props:{alt:n.alt,variants:n.variants}}):null}case Dt.link:return e("a",{attrs:{href:l.destination},class:"inline-link"},l.title);case Dt.reference:{const r=t[l.identifier];if(!r)return null;const i=l.overridingTitleInlineContent||r.titleInlineContent,s=l.overridingTitle||r.title;return e(Ee.A,{props:{url:r.url,kind:r.kind,role:r.role,isActive:l.isActive,ideTitle:r.ideTitle,titleStyle:r.titleStyle,hasInlineFormatting:!!i},class:"inline-link"},i?n(i):s)}case Dt.strong:case Dt.inlineHead:return e("strong",n(l.inlineContent));case Dt.text:return"\n"===l.text?e("br"):l.text;case Dt.superscript:return e("sup",n(l.inlineContent));case Dt.subscript:return e("sub",n(l.inlineContent));case Dt.strikethrough:return e(Oe,n(l.inlineContent));default:return null}}}var Vt,Gt,$t={name:"ContentNode",constants:{TableHeaderStyle:Ot,TableColumnAlignments:Rt},mixins:[r.A],render:function(e){return e(this.tag,{class:"content"},this.content.map(jt(e,this.references),this))},props:{content:{type:Array,required:!0},tag:{type:String,default:()=>"div"}},methods:{map(e){function t(n=[]){return n.map(n=>{switch(n.type){case Mt.aside:return e({...n,content:t(n.content)});case Mt.dictionaryExample:return e({...n,summary:t(n.summary)});case Mt.paragraph:case Dt.emphasis:case Dt.strong:case Dt.inlineHead:case Dt.superscript:case Dt.subscript:case Dt.strikethrough:case Dt.newTerm:return e({...n,inlineContent:t(n.inlineContent)});case Mt.orderedList:case Mt.unorderedList:return e({...n,items:n.items.map(e=>({...e,content:t(e.content)}))});case Mt.table:return e({...n,rows:n.rows.map(e=>e.map(t))});case Mt.termList:return e({...n,items:n.items.map(e=>({...e,term:{inlineContent:t(e.term.inlineContent)},definition:{content:t(e.definition.content)}}))});default:return e(n)}})}return t(this.content)},forEach(e){function t(n=[]){n.forEach(n=>{switch(e(n),n.type){case Mt.aside:t(n.content);break;case Mt.paragraph:case Dt.emphasis:case Dt.strong:case Dt.inlineHead:case Dt.newTerm:case Dt.superscript:case Dt.subscript:case Dt.strikethrough:t(n.inlineContent);break;case Mt.orderedList:case Mt.unorderedList:n.items.forEach(e=>t(e.content));break;case Mt.dictionaryExample:t(n.summary);break;case Mt.table:n.rows.forEach(e=>{e.forEach(t)});break;case Mt.termList:n.items.forEach(e=>{t(e.term.inlineContent),t(e.definition.content)});break}})}return t(this.content)},reduce(e,t){let n=t;return this.forEach(t=>{n=e(n,t)}),n}},computed:{plaintext(){const{references:e={}}=this;return this.reduce((t,n)=>{if(n.type===Mt.paragraph)return`${t}\n`;if(n.type===Dt.codeVoice)return`${t}${n.code}`;if(n.type===Dt.text)return`${t}${n.text}`;if(n.type===Dt.reference){const r=e[n.identifier]?.title??"";return`${t}${r}`}return t},"").trim()}},BlockType:Mt,InlineType:Dt},zt=$t,qt=(0,g.A)(zt,Vt,Gt,!1,null,null,null),Ht=qt.exports},164:function(e,t,n){"use strict";n.d(t,{A:function(){return d}});var r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"device-frame",class:e.classes,style:e.styles,attrs:{"data-device":e.device}},[t("div",{staticClass:"device-screen",class:{"with-device":e.currentDeviceAttrs}},[e._t("default")],2),t("div",{staticClass:"device"})])},i=[],s={},a=n(2655);const o=e=>e&&e!==1/0;var l={name:"DeviceFrame",props:{device:{type:String,required:!0}},provide:{insideDeviceFrame:!0},computed:{currentDeviceAttrs:({device:e})=>(0,a.PL)(["theme","device-frames",e],s[e]),styles:({toPixel:e,toUrl:t,toPct:n,currentDeviceAttrs:r={},toVal:i})=>{const{screenTop:s,screenLeft:a,screenWidth:o,frameWidth:l,lightUrl:c,darkUrl:u,screenHeight:A,frameHeight:d}=r;return{"--screen-top":n(s/d),"--screen-left":n(a/l),"--screen-width":n(o/l),"--screen-height":n(A/d),"--screen-aspect":i(o/A),"--frame-width":e(l),"--frame-aspect":i(l/d),"--device-light-url":t(c),"--device-dark-url":t(u)}},classes:({currentDeviceAttrs:e})=>({"no-device":!e})},methods:{toPixel:e=>o(e)?`${e}px`:null,toUrl:e=>o(e)?`url(${e})`:null,toPct:e=>o(e)?100*e+"%":null,toVal:e=>o(e)?e:null}},c=l,u=n(1656),A=(0,u.A)(c,r,i,!1,null,"c2eac128",null),d=A.exports},814:function(e,t,n){"use strict";n.d(t,{A:function(){return c}});var r=function(){var e=this,t=e._self._c;return t("code",{attrs:{tabindex:"0","data-before-code":e.$t("accessibility.code.start"),"data-after-code":e.$t("accessibility.code.end")}},[e._t("default")],2)},i=[],s={name:"CodeBlock"},a=s,o=n(1656),l=(0,o.A)(a,r,i,!1,null,"c21375ec",null),c=l.exports},1097:function(e,t,n){"use strict";n.d(t,{A:function(){return ye}});var r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"code-listing",class:{"single-line":1===e.syntaxHighlightedLines.length,"is-wrapped":e.wrap>0},style:e.wrap>0?{"--wrap-ch":e.wrap}:null,attrs:{"data-syntax":e.syntaxNameNormalized}},[e.fileName?t("Filename",{attrs:{isActionable:e.isFileNameActionable,fileType:e.fileType},on:{click:function(t){return e.$emit("file-name-click")}}},[e._v(e._s(e.fileName)+" ")]):e._e(),t("div",{staticClass:"container-general"},[e.copyToClipboard?t("button",{staticClass:"copy-button",class:e.copyState,attrs:{"aria-label":e.$t("icons.copy"),title:e.$t("icons.copy")},on:{click:e.copyCodeToClipboard}},[e.copyState===e.CopyState.idle?t("CopyIcon",{staticClass:"copy-icon"}):e.copyState===e.CopyState.success?t("CheckmarkIcon",{staticClass:"checkmark-icon"}):e.copyState===e.CopyState.failure?t("CrossIcon",{staticClass:"cross-icon"}):e._e()],1):e._e(),t("pre",[t("CodeBlock",[e._l(e.syntaxHighlightedLines,function(n,r){return[t("span",{key:r,class:["code-line-container",{highlighted:e.isHighlighted(r)||e.isUserHighlighted(r),strikethrough:e.isUserStrikethrough(r)}]},[e.showLineNumbers?t("span",{staticClass:"code-number",attrs:{"data-line-number":e.lineNumberFor(r)}}):e._e(),t("span",{staticClass:"code-line",domProps:{innerHTML:e._s(n)}})]),e._v("\n")]})],2)],1)])],1)},i=[],s=(n(8111),n(7588),n(1701),n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698),n(6043)),a=n(1339),o=n(814),l=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"CopyIcon",attrs:{viewBox:"0 0 24 24",themeId:"copy"}},[t("title",[e._v(e._s(e.$t("icons.copy")))]),t("path",{attrs:{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2\n .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0\n 16H8V7h11v14z"}})])},c=[],u=n(6515),A={name:"CopyIcon",components:{SVGIcon:u.A}},d=A,p=n(1656),h=(0,p.A)(d,l,c,!1,null,"5308ccb8",null),g=h.exports,f=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"CheckmarkIcon",attrs:{viewBox:"0 0 24 24",themeId:"checkmark"}},[t("path",{attrs:{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"}})])},m=[],v={name:"CheckmarkIcon",components:{SVGIcon:u.A}},y=v,b=(0,p.A)(y,f,m,!1,null,"4c718f32",null),C=b.exports,I=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"CrossIcon",attrs:{viewBox:"0 0 24 24",themeId:"cross"}},[t("path",{attrs:{d:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41\n 10.59 12 5 17.59 6.41 19 12 13.41\n 17.59 19 19 17.59 13.41 12z"}})])},w=[],E={name:"CrossIcon",components:{SVGIcon:u.A}},B=E,x=(0,p.A)(B,I,w,!1,null,"27a90ea3",null),k=x.exports,S=(n(116),n(8237),n(8416)),_=S;const T={objectivec:["objective-c"]},L={bash:["sh","zsh"],c:["h"],cpp:["cc","c++","h++","hpp","hh","hxx","cxx"],css:[],diff:["patch"],http:["https"],java:["jsp"],javascript:["js","jsx","mjs","cjs"],json:[],llvm:[],markdown:["md","mkdown","mkd"],objectivec:["mm","objc","obj-c"].concat(T.objectivec),perl:["pl","pm"],php:[],pkl:[],python:["py","gyp","ipython"],ruby:["rb","gemspec","podspec","thor","irb"],scss:[],shell:["console","shellsession"],swift:[],typescript:["typescript","ts","tsx","mts","cts"],xml:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],yaml:["yml","yaml"],...{NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}.VUE_APP_HLJS_LANGUAGES?Object.fromEntries({NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}.VUE_APP_HLJS_LANGUAGES.split(",").map(e=>[e,[]])):void 0},P=new Set(["markdown","swift","pkl"]),Q=Object.entries(L),M=new Set(Object.keys(L)),D=new Map;async function O(e){const t=[e];try{return await t.reduce(async(e,t)=>{let r;await e,r=P.has(t)?await n(5366)(`./${t}`):await n(1648)(`./${t}.js`),_.registerLanguage(t,r.default)},Promise.resolve()),!0}catch(r){return console.error(`Could not load ${e} file`),!1}}function R(e){if(M.has(e))return e;const t=Q.find(([,t])=>t.includes(e));return t?t[0]:null}function N(e){if(D.has(e))return D.get(e);const t=R(e);return D.set(e,t),t}_.configure({classPrefix:"syntax-",languages:[...M]});const j=async e=>{const t=N(e);return!(!t||_.listLanguages().includes(t))&&O(t)},V=/\r\n|\r|\n/g,G=/syntax-/;function $(e){return 0===e.length?[]:e.split(V)}function z(e){return(e.trim().match(V)||[]).length}function q(e){const t=document.createElement("template");return t.innerHTML=e,t.content.childNodes}function H(e){const{className:t}=e;if(!G.test(t))return null;const n=$(e.innerHTML).reduce((e,n)=>`${e}${n}\n`,"");return q(n.trim())}function F(e){return Array.from(e.childNodes).forEach(e=>{if(z(e.textContent))try{const t=e.childNodes.length?F(e):H(e);t&&e.replaceWith(...t)}catch(t){console.error(t)}}),H(e)}function W(e,t){const n=R(t);if(!_.getLanguage(n))throw new Error(`Unsupported language for syntax highlighting: ${t}`);return _.highlight(e,{language:n,ignoreIllegals:!0}).value}function U(e,t){const n=e.join("\n"),r=W(n,t),i=document.createElement("code");return i.innerHTML=r,F(i),$(i.innerHTML)}var Y=function(){var e=this,t=e._self._c;return t("span",{staticClass:"filename"},[e.isActionable?t("a",{attrs:{href:"#"},on:{click:function(t){return t.preventDefault(),e.$emit("click")}}},[t("FileIcon",{attrs:{fileType:e.fileType}}),e._t("default")],2):t("span",[t("FileIcon",{attrs:{fileType:e.fileType}}),e._t("default")],2)])},X=[],Z=function(){var e=this,t=e._self._c;return"swift"===e.fileType?t("SwiftFileIcon",{staticClass:"file-icon"}):t("GenericFileIcon",{staticClass:"file-icon"})},K=[],J=n(5747),ee=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"generic-file-icon",attrs:{viewBox:"0 0 14 14",themeId:"generic-file"}},[t("path",{attrs:{d:"M8.033 1l3.967 4.015v7.985h-10v-12zM7.615 2h-4.615v10h8v-6.574z"}}),t("path",{attrs:{d:"M7 1h1v4h-1z"}}),t("path",{attrs:{d:"M7 5h5v1h-5z"}})])},te=[],ne={name:"GenericFileIcon",components:{SVGIcon:u.A}},re=ne,ie=(0,p.A)(re,ee,te,!1,null,null,null),se=ie.exports,ae={name:"CodeListingFileIcon",components:{SwiftFileIcon:J.A,GenericFileIcon:se},props:{fileType:String}},oe=ae,le=(0,p.A)(oe,Z,K,!1,null,"7c381064",null),ce=le.exports,ue={name:"CodeListingFilename",components:{FileIcon:ce},props:{isActionable:{type:Boolean,default:()=>!1},fileType:String}},Ae=ue,de=(0,p.A)(Ae,Y,X,!1,null,"c8c40662",null),pe=de.exports;const he={idle:"idle",success:"success",failure:"failure"},ge={highlight:"highlight",strikeout:"strikeout"};var fe={name:"CodeListing",components:{Filename:pe,CodeBlock:o.A,CopyIcon:g,CheckmarkIcon:C,CrossIcon:k},data(){return{syntaxHighlightedLines:[],copyState:he.idle,CopyState:he}},props:{fileName:String,isFileNameActionable:{type:Boolean,default:()=>!1},syntax:String,fileType:String,content:{type:Array,required:!0},copyToClipboard:{type:Boolean,default:()=>!1},wrap:{type:Number,default:()=>0},lineAnnotations:{type:Array,default:()=>[]},startLineNumber:{type:Number,default:()=>1},highlights:{type:Array,default:()=>[]},showLineNumbers:{type:Boolean,default:()=>!1}},computed:{escapedContent:({content:e})=>e.map(s.ZD),highlightedLineNumbers(){return new Set(this.highlights.map(({line:e})=>e))},syntaxNameNormalized(){const e={occ:a.A.objectiveC.key.url};return e[this.syntax]||this.syntax},copyableText(){return this.content.join("\n")},styleLineSets(){const e=Object.create(null);return(this.lineAnnotations||[]).forEach(t=>{if(!t||!t.style||!t.range||!t.range[0]||!t.range[1])return;const{style:n}=t,r=t.range[0].line,i=t.range[1].line;e[n]||(e[n]=new Set);for(let s=r;s<=i;s+=1)e[n].add(s)}),e}},watch:{content:{handler:"syntaxHighlightLines",immediate:!0}},methods:{isHighlighted(e){return this.highlightedLineNumbers.has(this.lineNumberFor(e))},isLineInStyle(e,t){const n=this.lineNumberFor(e);return this.styleLineSets[t]?.has(n)??!1},isUserHighlighted(e){return this.isLineInStyle(e,ge.highlight)},isUserStrikethrough(e){return this.isLineInStyle(e,ge.strikeout)},lineNumberFor(e){return this.startLineNumber+e},async syntaxHighlightLines(){let e;try{await j(this.syntaxNameNormalized),e=U(this.content,this.syntaxNameNormalized)}catch(t){e=this.escapedContent}this.syntaxHighlightedLines=e.map(e=>""===e?"\n":e)},copyCodeToClipboard(){navigator.clipboard.writeText(this.copyableText).then(()=>{this.copyState=he.success}).catch(e=>{console.error("Failed to copy text: ",e),this.copyState=he.failure}).finally(()=>{setTimeout(()=>{this.copyState=he.idle},1e3)})}}},me=fe,ve=(0,p.A)(me,r,i,!1,null,"28c1cdd6",null),ye=ve.exports},1098:function(e,t,n){"use strict";n.d(t,{Ay:function(){return A},Zy:function(){return a},hX:function(){return i}});const r={major:0,minor:3,patch:0};function i({major:e,minor:t,patch:n}){return[e,t,n].join(".")}function s(e){const[t=0,n=0,r=0]=e.split(".");return[Number(t),Number(n),Number(r)]}function a(e,t){const n=s(e),r=s(t);for(let i=0;ir[i])return 1;if(n[i]`[Swift-DocC-Render] The render node version for this page (${e}) has a different major version component than Swift-DocC-Render supports (${o}). Compatibility is not guaranteed.`;function u(e){const{major:t,minor:n}=e,{major:s,minor:a}=r;return t!==s?c(i(e)):n>a?l(i(e)):""}function A(e){if(!e)return;const t=u(e);t&&console.warn(t)}},1148:function(e,t,n){"use strict";var r=n(6518),i=n(9565),s=n(2652),a=n(9306),o=n(8551),l=n(1767),c=n(9539),u=n(4549),A=u("every",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:A},{every:function(e){o(this);try{a(e)}catch(r){c(this,"throw",r)}if(A)return i(A,this,e);var t=l(this),n=0;return!s(t,function(t,r){if(!e(t,n++))return r()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},1290:function(e,t,n){"use strict";n.d(t,{A:function(){return p}});var r=function(){var e=this,t=e._self._c;return e.action?t("DestinationDataProvider",{attrs:{destination:e.action},scopedSlots:e._u([{key:"default",fn:function({url:n,title:r}){return[t("ButtonLink",{attrs:{url:e.normalizeUrl(n),isDark:e.isDark,linksToAsset:e.linksToAsset}},[e._v(" "+e._s(r)+" ")])]}}],null,!1,2322572788)}):e._e()},i=[],s=n(5892),a=n(5411),o=n(1074),l=n(288),c={name:"CallToActionButton",components:{DestinationDataProvider:a.A,ButtonLink:s.A},methods:{normalizeUrl(e){return!this.linksToAsset||(0,o.vh)(e)?e:(0,l.Fd)((0,l.Vd)(e))}},props:{action:{type:Object,required:!0},isDark:{type:Boolean,default:!1},linksToAsset:{type:Boolean,default:!1}}},u=c,A=n(1656),d=(0,A.A)(u,r,i,!1,null,null,null),p=d.exports},1339:function(e,t){"use strict";t.A={objectiveC:{name:"Objective-C",key:{api:"occ",url:"objc"}},swift:{name:"Swift",key:{api:"swift",url:"swift"}}}},1648:function(e,t,n){var r={"./bash.js":[8641,274],"./c.js":[722,833],"./cpp.js":[6570,297],"./css.js":[8612,175],"./diff.js":[8596,703],"./http.js":[3383,532],"./java.js":[4895,444],"./javascript.js":[6035,531],"./json.js":[621,374],"./llvm.js":[6398,989],"./markdown.js":[602,945],"./objectivec.js":[943,172],"./perl.js":[946,185],"./php.js":[5492,892],"./python.js":[1117,758],"./ruby.js":[5015,476],"./scss.js":[1611,672],"./shell.js":[8813,638],"./swift.js":[1496,35],"./typescript.js":[8640,299],"./xml.js":[114,777],"./yaml.js":[5588,639]};function i(e){if(!n.o(r,e))return Promise.resolve().then(function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=r[e],i=t[0];return n.e(t[1]).then(function(){return n.t(i,23)})}i.keys=function(){return Object.keys(r)},i.id=1648,e.exports=i},1672:function(e,t,n){"use strict";n.d(t,{Bp:function(){return s},uh:function(){return i},wi:function(){return r}});const r={added:"added",modified:"modified",deprecated:"deprecated"},i=[r.modified,r.added,r.deprecated],s={[r.modified]:"change-type.modified",[r.added]:"change-type.added",[r.deprecated]:"change-type.deprecated"}},1754:function(e,t,n){"use strict";n.d(t,{A:function(){return R}});var r=function(){var e=this,t=e._self._c;return t(e.refComponent,{tag:"component",attrs:{url:e.urlWithParams,"is-active":e.isActiveComputed}},[e._t("default")],2)},i=[],s=n(1074),a=n(4468),o=n(4628),l=function(){var e=this,t=e._self._c;return t("ReferenceExternal",e._b({},"ReferenceExternal",e.$props,!1),[t("CodeVoice",[e._t("default")],2)],1)},c=[],u=function(){var e=this,t=e._self._c;return e.url&&e.isActive?t("a",{attrs:{href:e.url}},[e._t("default")],2):t("span",[e._t("default")],2)},A=[],d={name:"ReferenceExternal",props:{url:{type:String,required:!1},isActive:{type:Boolean,default:!0}}},p=d,h=n(1656),g=(0,h.A)(p,u,A,!1,null,null,null),f=g.exports,m=n(4828),v={name:"ReferenceExternalSymbol",props:f.props,components:{ReferenceExternal:f,CodeVoice:m.A}},y=v,b=(0,h.A)(y,l,c,!1,null,null,null),C=b.exports,I=function(){var e=this,t=e._self._c;return t("ReferenceInternal",e._b({},"ReferenceInternal",e.$props,!1),[t("CodeVoice",[e._t("default")],2)],1)},w=[],E=function(){var e=this,t=e._self._c;return e.url&&e.isActive?t("router-link",{attrs:{to:e.url}},[e._t("default")],2):t("span",[e._t("default")],2)},B=[],x={name:"ReferenceInternal",props:{url:{type:String,required:!1},isActive:{type:Boolean,default:!0}}},k=x,S=(0,h.A)(k,E,B,!1,null,null,null),_=S.exports,T={name:"ReferenceInternalSymbol",props:_.props,components:{ReferenceInternal:_,CodeVoice:m.A}},L=T,P=(0,h.A)(L,I,w,!1,null,null,null),Q=P.exports,M={name:"Reference",computed:{isInternal({url:e,linksToAsset:t}){if(!e)return!1;if(!e.startsWith("/")&&!e.startsWith("#"))return!1;if(t)return!1;const{resolved:{name:n}={}}=this.$router.resolve(e)||{};return!n.startsWith(o.Yl)},isSymbolReference(){return"symbol"===this.kind&&!this.hasInlineFormatting&&(this.role===a.y.symbol||this.role===a.y.dictionarySymbol)},isDisplaySymbol({isSymbolReference:e,titleStyle:t,ideTitle:n}){return n?e&&"symbol"===t:e},refComponent({isInternal:e,isDisplaySymbol:t}){return e?t?Q:_:t?C:f},urlWithParams({isInternal:e}){return e?(0,s.c$)(this.url,this.$route.query):this.url},isActiveComputed({url:e,isActive:t}){return!(!e||!t)}},props:{url:{type:String,required:!1},kind:{type:String,required:!1},role:{type:String,required:!1},isActive:{type:Boolean,required:!1,default:!0},ideTitle:{type:String,required:!1},titleStyle:{type:String,required:!1},hasInlineFormatting:{type:Boolean,default:!1},linksToAsset:{type:Boolean,default:!1}}},D=M,O=(0,h.A)(D,r,i,!1,null,null,null),R=O.exports},1789:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var r=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"article-icon",attrs:{viewBox:"0 0 14 14",themeId:"article"}},[t("path",{attrs:{d:"M8.033 1l3.967 4.015v7.985h-10v-12zM7.615 2h-4.615v10h8v-6.574z"}}),t("path",{attrs:{d:"M7 1h1v4h-1z"}}),t("path",{attrs:{d:"M7 5h5v1h-5z"}})])},i=[],s=n(6515),a={name:"ArticleIcon",components:{SVGIcon:s.A}},o=a,l=n(1656),c=(0,l.A)(o,r,i,!1,null,null,null),u=c.exports},1836:function(e,t,n){"use strict";n.d(t,{o8:function(){return f},Fd:function(){return u},cE:function(){return g},Dk:function(){return p},JR:function(){return h}});n(3110),n(8335),n(4603),n(7566),n(8721);var r=n(288),i=n(1074),s=n(1098),a=n(6266),o=n(8213);class l extends Error{constructor({location:e,response:t}){super("Request redirected"),this.location=e,this.response=t}}class c extends Error{constructor(e){super("Unable to fetch data"),this.route=e}}async function u(e,t={},n={}){function r(e){return("ide"!=={NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}.VUE_APP_TARGET||0!==e.status)&&!e.ok}const a=(0,i.Lo)(e),o=(0,i.vk)(t);o&&(a.search=o);const c=await fetch(a.href,n);if(r(c))throw c;if(c.redirected)throw new l({location:c.url,response:c});const u=await c.json();return(0,s.Ay)(u.schemaVersion),u}function A(e){const t=e.replace(/\/$/,"");return`${(0,r.Fd)(["/data",t])}.json`}function d(e){const{pathname:t,search:n}=new URL(e),r=/\/data(\/.*).json$/,i=r.exec(t);return i?i[1]+n:t+n}async function p(e,t,n){const r=A(e.path);let i;try{i=await u(r,e.query)}catch(s){if("ide"==={NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}.VUE_APP_TARGET)throw console.error(s),!1;if(s instanceof l)throw d(s.location);if(s.status&&404===s.status){const{locale:t,...r}=e.params??{};if(t&&t!==a.defaultLocale&&(0,o.$i)(t))return n({...e,params:r}),null;n({name:"not-found",params:[e.path]})}else n(new c(e))}return i}function h(e,t){return!(0,i.LG)(e,t)}async function g(e,t={}){const n=A(e);return u(n,{},t)}function f(e){return JSON.parse(JSON.stringify(e))}},1897:function(e,t,n){"use strict";var r=n(8552),i=n(6043),s=n(1074),a=n(9);t.A={methods:{extractFirstParagraphText(e=[]){const{references:t={}}=this,n=a["default"].computed.plaintext.bind({...a["default"].methods,content:e,references:t})();return(0,i.lE)(n)}},computed:{pagePath:({$route:{path:e="/"}={}})=>e,pageURL:({pagePath:e="/"})=>(0,s.FT)(e),disableMetadata:()=>!1},mounted(){this.disableMetadata||(0,r.$)({title:this.pageTitle,description:this.pageDescription,url:this.pageURL,currentLocale:this.$i18n.locale})}}},2187:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var r=function(){var e=this,t=e._self._c;return t("SVGIcon",{attrs:{viewBox:"0 0 14 14",themeId:"path"}},[t("path",{attrs:{d:"M0 0.948h2.8v2.8h-2.8z"}}),t("path",{attrs:{d:"M11.2 10.252h2.8v2.8h-2.8z"}}),t("path",{attrs:{d:"M6.533 1.852h0.933v10.267h-0.933z"}}),t("path",{attrs:{d:"M2.8 1.852h4.667v0.933h-4.667z"}}),t("path",{attrs:{d:"M6.533 11.186h4.667v0.933h-4.667z"}})])},i=[],s=n(6515),a={name:"PathIcon",components:{SVGIcon:s.A}},o=a,l=n(1656),c=(0,l.A)(o,r,i,!1,null,null,null),u=c.exports},2481:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var r=function(){var e=this,t=e._self._c;return t("aside",{class:e.kind,attrs:{"aria-label":e.kind}},[t("p",{staticClass:"label"},[e._v(e._s(e.name||e.$t(e.label)))]),e._t("default")],2)},i=[];const s={deprecated:"deprecated",experiment:"experiment",important:"important",note:"note",tip:"tip",warning:"warning"};var a={name:"Aside",props:{kind:{type:String,required:!0,validator:e=>Object.prototype.hasOwnProperty.call(s,e)},name:{type:String,required:!1}},computed:{label:({kind:e})=>`aside-kind.${e}`}},o=a,l=n(1656),c=(0,l.A)(o,r,i,!1,null,"50d24223",null),u=c.exports},2670:function(e,t,n){"use strict";n.d(t,{A:function(){return le}});var r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"TopicTypeIcon",style:e.styles},[e.imageOverride?t("OverridableAsset",{staticClass:"icon-inline",attrs:{imageOverride:e.imageOverride,shouldCalculateOptimalWidth:e.shouldCalculateOptimalWidth}}):t(e.icon,e._b({tag:"component",staticClass:"icon-inline"},"component",e.iconProps,!1))],1)},i=[],s=n(2187),a=n(9018),o=n(1789),l=n(3818),c=function(){var e=this,t=e._self._c;return t("SVGIcon",{attrs:{viewBox:"0 0 14 14",height:"14",themeId:"topic-func"}},[t("path",{attrs:{d:"M13 1v12h-12v-12zM12.077 1.923h-10.154v10.154h10.154z"}}),t("path",{attrs:{d:"M5.191 9.529c0.044 0.002 0.089 0.004 0.133 0.004 0.108 0 0.196-0.025 0.262-0.074s0.122-0.113 0.166-0.188c0.044-0.077 0.078-0.159 0.103-0.247s0.049-0.173 0.074-0.251l0.598-2.186h-0.709l0.207-0.702h0.702l0.288-1.086c0.083-0.384 0.256-0.667 0.517-0.849s0.591-0.273 0.99-0.273c0.108 0 0.212 0.007 0.314 0.022s0.203 0.027 0.306 0.037l-0.207 0.761c-0.054-0.006-0.106-0.011-0.155-0.018s-0.102-0.011-0.155-0.011c-0.108 0-0.196 0.016-0.262 0.048s-0.122 0.075-0.166 0.129-0.080 0.115-0.107 0.185c-0.028 0.068-0.055 0.14-0.085 0.214l-0.222 0.842h0.768l-0.192 0.702h-0.783l-0.628 2.319c-0.059 0.222-0.129 0.419-0.21 0.594s-0.182 0.322-0.303 0.443-0.269 0.214-0.443 0.281-0.385 0.1-0.631 0.1c-0.084 0-0.168-0.004-0.251-0.011s-0.168-0.014-0.251-0.018l0.207-0.768c0.040 0 0.081 0.001 0.126 0.004z"}})])},u=[],A=n(6515),d={name:"TopicFuncIcon",components:{SVGIcon:A.A}},p=d,h=n(1656),g=(0,h.A)(p,c,u,!1,null,null,null),f=g.exports,m=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"collection-icon",attrs:{viewBox:"0 0 14 14",themeId:"collection"}},[t("path",{attrs:{d:"m1 1v12h12v-12zm11 11h-10v-10h10z"}}),t("path",{attrs:{d:"m3 4h8v1h-8zm0 2.5h8v1h-8zm0 2.5h8v1h-8z"}}),t("path",{attrs:{d:"m3 4h8v1h-8z"}}),t("path",{attrs:{d:"m3 6.5h8v1h-8z"}}),t("path",{attrs:{d:"m3 9h8v1h-8z"}})])},v=[],y={name:"CollectionIcon",components:{SVGIcon:A.A}},b=y,C=(0,h.A)(b,m,v,!1,null,null,null),I=C.exports,w=function(){var e=this,t=e._self._c;return t("SVGIcon",{attrs:{viewBox:"0 0 14 14",height:"14",themeId:"topic-func-op"}},[t("path",{attrs:{d:"M13 13h-12v-12h12zM1.923 12.077h10.154v-10.154h-10.154z"}}),t("path",{attrs:{d:"M5.098 4.968v-1.477h-0.738v1.477h-1.477v0.738h1.477v1.477h0.738v-1.477h1.477v-0.738z"}}),t("path",{attrs:{d:"M8.030 4.807l-2.031 5.538h0.831l2.031-5.538z"}}),t("path",{attrs:{d:"M8.894 8.805v0.923h2.215v-0.923z"}})])},E=[],B={name:"TopicFuncOpIcon",components:{SVGIcon:A.A}},x=B,k=(0,h.A)(x,w,E,!1,null,null,null),S=k.exports,_=n(5060),T=function(){var e=this,t=e._self._c;return t("SVGIcon",{attrs:{viewBox:"0 0 14 14",height:"14",themeId:"topic-subscript"}},[t("path",{attrs:{d:"M13 13h-12v-12h12zM1.923 12.077h10.154v-10.154h-10.154z"}}),t("path",{attrs:{d:"M4.133 3.633v6.738h1.938v-0.831h-0.923v-5.077h0.923v-0.831z"}}),t("path",{attrs:{d:"M9.856 10.371v-6.738h-1.938v0.831h0.923v5.077h-0.923v0.831z"}})])},L=[],P={name:"TopicSubscriptIcon",components:{SVGIcon:A.A}},Q=P,M=(0,h.A)(Q,T,L,!1,null,null,null),D=M.exports,O=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"two-letter-icon",attrs:{width:"16px",height:"16px",viewBox:"0 0 16 16",themeId:"two-letter"}},[t("g",{attrs:{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"}},[t("g",{attrs:{transform:"translate(1.000000, 1.000000)"}},[t("rect",{attrs:{stroke:"currentColor",x:"0.5",y:"0.5",width:"13",height:"13"}}),t("text",{attrs:{"font-size":"8","font-weight":"bold",fill:"currentColor"}},[t("tspan",{attrs:{x:"8.2",y:"11"}},[e._v(e._s(e.second))])]),t("text",{attrs:{"font-size":"11","font-weight":"bold",fill:"currentColor"}},[t("tspan",{attrs:{x:"1.7",y:"11"}},[e._v(e._s(e.first))])])])])])},R=[],N={name:"TwoLetterSymbolIcon",components:{SVGIcon:A.A},props:{first:{type:String,required:!0},second:{type:String,required:!0}}},j=N,V=(0,h.A)(j,O,R,!1,null,"baad8018",null),G=V.exports,$=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"single-letter-icon",attrs:{width:"16px",height:"16px",viewBox:"0 0 16 16",themeId:"single-letter"}},[t("g",{attrs:{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"}},[t("rect",{attrs:{stroke:"currentColor",x:"1",y:"1",width:"14",height:"14"}}),t("text",{attrs:{"font-size":"11","font-weight":"bold",fill:"currentColor",x:"49%",y:"12","text-anchor":"middle"}},[t("tspan",[e._v(e._s(e.symbol))])])])])},z=[],q={name:"SingleLetterSymbolIcon",components:{SVGIcon:A.A},props:{symbol:{type:String,required:!0}}},H=q,F=(0,h.A)(H,$,z,!1,null,null,null),W=F.exports,U=n(5689),Y=n(7249),X=function(){var e=this,t=e._self._c;return e.shouldUseAsset?t("ImageAsset",e._b({},"ImageAsset",{variants:e.variants,loading:null,shouldCalculateOptimalWidth:e.shouldCalculateOptimalWidth,alt:e.alt},!1)):t("SVGIcon",{attrs:{"icon-url":e.iconUrl,themeId:e.themeId}})},Z=[],K=(n(4603),n(7566),n(8721),n(9720)),J={name:"OverridableAsset",components:{SVGIcon:A.A,ImageAsset:K.A},props:{imageOverride:{type:Object,default:null},shouldCalculateOptimalWidth:{type:Boolean,default:!0}},computed:{variants:({imageOverride:e})=>e?e.variants:[],alt:({imageOverride:e})=>e.alt,firstVariant:({variants:e})=>e[0],iconUrl:({firstVariant:e})=>e&&e.url,themeId:({firstVariant:e})=>e&&e.svgID,isSameOrigin:({iconUrl:e,sameOrigin:t})=>t(e),shouldUseAsset:({isSameOrigin:e,themeId:t})=>!e||!t},methods:{sameOrigin(e){if(!e)return!1;const t=new URL(e,window.location),n=new URL(window.location);return t.origin===n.origin}}},ee=J,te=(0,h.A)(ee,X,Z,!1,null,null,null),ne=te.exports;const re={[U.t.article]:o.A,[U.t.associatedtype]:I,[U.t.buildSetting]:I,[U.t.class]:W,[U.t.collection]:I,[U.t.dictionarySymbol]:W,[U.t.container]:I,[U.t.enum]:W,[U.t.extension]:G,[U.t.func]:f,[U.t.op]:S,[U.t.httpRequest]:W,[U.t.languageGroup]:I,[U.t.learn]:s.A,[U.t.method]:W,[U.t.macro]:W,[U.t.module]:a.A,[U.t.namespace]:W,[U.t.overview]:s.A,[U.t.protocol]:G,[U.t.property]:W,[U.t.propertyListKey]:W,[U.t.resources]:s.A,[U.t.sampleCode]:_.A,[U.t.struct]:W,[U.t.subscript]:D,[U.t.symbol]:I,[U.t.tutorial]:l.A,[U.t.typealias]:W,[U.t.union]:W,[U.t.var]:W},ie={[U.t.class]:{symbol:"C"},[U.t.dictionarySymbol]:{symbol:"O"},[U.t.enum]:{symbol:"E"},[U.t.extension]:{first:"E",second:"x"},[U.t.httpRequest]:{symbol:"E"},[U.t.method]:{symbol:"M"},[U.t.macro]:{symbol:"#"},[U.t.namespace]:{symbol:"N"},[U.t.protocol]:{first:"P",second:"r"},[U.t.property]:{symbol:"P"},[U.t.propertyListKey]:{symbol:"K"},[U.t.struct]:{symbol:"S"},[U.t.typealias]:{symbol:"T"},[U.t.union]:{symbol:"U"},[U.t.var]:{symbol:"V"}};var se={name:"TopicTypeIcon",components:{OverridableAsset:ne,SVGIcon:A.A,SingleLetterSymbolIcon:W},constants:{TopicTypeIcons:re,TopicTypeProps:ie},props:{type:{type:String,required:!0},withColors:{type:Boolean,default:!1},imageOverride:{type:Object,default:null},shouldCalculateOptimalWidth:{type:Boolean,default:!0}},computed:{normalisedType:({type:e})=>U.m[e]||e,icon:({normalisedType:e})=>re[e]||I,iconProps:({normalisedType:e})=>ie[e]||{},color:({normalisedType:e})=>Y.z[e],styles:({color:e,withColors:t})=>t&&e?{"--icon-color":`var(--color-type-icon-${e})`}:{}}},ae=se,oe=(0,h.A)(ae,r,i,!1,null,"3b1b4787",null),le=oe.exports},2773:function(e,t,n){"use strict";n.d(t,{A:function(){return g}});var r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"col",class:e.classes},[e._t("default")],2)},i=[];n(8111),n(1148),n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698);const s=0,a=12,o=new Set(["large","medium","small"]),l=e=>({type:Object,default:()=>({}),validator:t=>Object.keys(t).every(n=>o.has(n)&&e(t[n]))}),c=l(e=>"boolean"===typeof e),u=l(e=>"number"===typeof e&&e>=s&&e<=a);var A={name:"GridColumn",props:{isCentered:c,isUnCentered:c,span:{...u,default:()=>({large:a})}},computed:{classes:function(){return{[`large-${this.span.large}`]:void 0!==this.span.large,[`medium-${this.span.medium}`]:void 0!==this.span.medium,[`small-${this.span.small}`]:void 0!==this.span.small,"large-centered":!!this.isCentered.large,"medium-centered":!!this.isCentered.medium,"small-centered":!!this.isCentered.small,"large-uncentered":!!this.isUnCentered.large,"medium-uncentered":!!this.isUnCentered.medium,"small-uncentered":!!this.isUnCentered.small}}}},d=A,p=n(1656),h=(0,p.A)(d,r,i,!1,null,"2ee3ad8b",null),g=h.exports},2853:function(e,t,n){"use strict";n.d(t,{Z:function(){return r}});const r={list:"list",compactGrid:"compactGrid",detailedGrid:"detailedGrid",hidden:"hidden"}},3117:function(e,t,n){"use strict";n.d(t,{A:function(){return m}});var r=function(){var e=this,t=e._self._c;return t(`h${e.level}`,{tag:"component",attrs:{id:e.anchor}},[e.shouldLink?t("router-link",{staticClass:"header-anchor",attrs:{to:e.linkWithAnchor,"data-after-text":e.$t("accessibility.in-page-link")},on:{click:function(t){return e.handleFocusAndScroll(e.anchor)}}},[e._t("default"),t("LinkIcon",{staticClass:"icon",attrs:{"aria-hidden":"true"}})],2):[e._t("default")]],2)},i=[],s=n(9514),a=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"link-icon",attrs:{viewBox:"0 0 20 20"}},[t("path",{attrs:{d:"M19.34,4.88L15.12,.66c-.87-.87-2.3-.87-3.17,0l-3.55,3.56-1.38,1.38-1.4,1.4c-.47,.47-.68,1.09-.64,1.7,.02,.29,.09,.58,.21,.84,.11,.23,.24,.44,.43,.63l4.22,4.22h0l.53-.53,.53-.53h0l-4.22-4.22c-.29-.29-.29-.77,0-1.06l1.4-1.4,.91-.91,.58-.58,.55-.55,2.9-2.9c.29-.29,.77-.29,1.06,0l4.22,4.22c.29,.29,.29,.77,0,1.06l-2.9,2.9c.14,.24,.24,.49,.31,.75,.08,.32,.11,.64,.09,.96l3.55-3.55c.87-.87,.87-2.3,0-3.17Z"}}),t("path",{attrs:{d:"M14.41,9.82s0,0,0,0l-4.22-4.22h0l-.53,.53-.53,.53h0l4.22,4.22c.29,.29,.29,.77,0,1.06l-1.4,1.4-.91,.91-.58,.58-.55,.55h0l-2.9,2.9c-.29,.29-.77,.29-1.06,0L1.73,14.04c-.29-.29-.29-.77,0-1.06l2.9-2.9c-.14-.24-.24-.49-.31-.75-.08-.32-.11-.64-.09-.97L.68,11.93c-.87,.87-.87,2.3,0,3.17l4.22,4.22c.87,.87,2.3,.87,3.17,0l3.55-3.55,1.38-1.38,1.4-1.4c.47-.47,.68-1.09,.64-1.7-.02-.29-.09-.58-.21-.84-.11-.22-.24-.44-.43-.62Z"}})])},o=[],l=n(6515),c={name:"LinkIcon",components:{SVGIcon:l.A}},u=c,A=n(1656),d=(0,A.A)(u,a,o,!1,null,null,null),p=d.exports,h={name:"LinkableHeading",mixins:[s.A],components:{LinkIcon:p},props:{anchor:{type:String,required:!1},level:{type:Number,default:()=>2,validator:e=>e>=1&&e<=6}},inject:{enableMinimized:{default:()=>!1},isTargetIDE:{default:()=>!1}},computed:{shouldLink:({anchor:e,enableMinimized:t,isTargetIDE:n})=>!!e&&!t&&!n,linkWithAnchor:({anchor:e,$route:t})=>({hash:`#${e}`,query:t.query})}},g=h,f=(0,A.A)(g,r,i,!1,null,"e5954aca",null),m=f.exports},3571:function(e,t,n){"use strict";n(4114);const r=["input","select","textarea","button","optgroup","option","menuitem","fieldset","object","a[href]","*[tabindex]","*[contenteditable]"],i=r.join(",");t.Ay={getTabbableElements(e){const t=e.querySelectorAll(i),n=t.length;let r;const s=[];for(r=0;r=0},isFocusableElement(e){const t=e.nodeName.toLowerCase(),n=r.includes(t);return!("a"!==t||!e.getAttribute("href"))||(n?!e.disabled:"true"===e.getAttribute("contenteditable")||!Number.isNaN(parseFloat(e.getAttribute("tabindex"))))}}},3579:function(e,t,n){"use strict";var r=n(6518),i=n(9565),s=n(2652),a=n(9306),o=n(8551),l=n(1767),c=n(9539),u=n(4549),A=u("some",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:A},{some:function(e){o(this);try{a(e)}catch(r){c(this,"throw",r)}if(A)return i(A,this,e);var t=l(this),n=0;return s(t,function(t,r){if(e(t,n++))return r()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},3634:function(e,t,n){"use strict";n.d(t,{A:function(){return c}});n(4114),n(8111),n(2489),n(1701);var r,i,s={functional:!0,name:"WordBreak",render(e,{props:t,slots:n,data:r}){const i=n().default||[],s=i.filter(e=>e.text&&!e.tag);if(0===s.length||s.length!==i.length)return e(t.tag,r,i);const a=s.map(({text:e})=>e).join(),o=[];let l=null,c=0;while(null!==(l=t.safeBoundaryPattern.exec(a))){const t=l.index+1;o.push(a.slice(c,t)),o.push(e("wbr",{key:l.index})),c=t}return o.push(a.slice(c,a.length)),e(t.tag,r,o)},props:{safeBoundaryPattern:{type:RegExp,default:()=>/([a-z](?=[A-Z])|(:)\w|\w(?=[._]\w))/g},tag:{type:String,default:()=>"span"}}},a=s,o=n(1656),l=(0,o.A)(a,r,i,!1,null,null,null),c=l.exports},3818:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var r=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"tutorial-icon",attrs:{viewBox:"0 0 14 14",themeId:"tutorial"}},[t("path",{attrs:{d:"M0.933 6.067h3.733v1.867h-3.733v-1.867z"}}),t("path",{attrs:{d:"M0.933 1.867h3.733v1.867h-3.733v-1.867z"}}),t("path",{attrs:{d:"M13.067 1.867v10.267h-7.467v-10.267zM12.133 2.8h-5.6v8.4h5.6z"}}),t("path",{attrs:{d:"M0.933 10.267h3.733v1.867h-3.733v-1.867z"}})])},i=[],s=n(6515),a={name:"TutorialIcon",components:{SVGIcon:s.A}},o=a,l=n(1656),c=(0,l.A)(o,r,i,!1,null,null,null),u=c.exports},4468:function(e,t,n){"use strict";n.d(t,{y:function(){return r}});const r={article:"article",codeListing:"codeListing",collection:"collection",collectionGroup:"collectionGroup",containerSymbol:"containerSymbol",devLink:"devLink",dictionarySymbol:"dictionarySymbol",generic:"generic",link:"link",media:"media",pseudoCollection:"pseudoCollection",pseudoSymbol:"pseudoSymbol",restRequestSymbol:"restRequestSymbol",sampleCode:"sampleCode",symbol:"symbol",table:"table",learn:"learn",overview:"overview",project:"project",tutorial:"tutorial",resources:"resources"}},4602:function(e,t,n){"use strict";var r=n(8964),i=n(6195),s=n(9514);function a(e){return new Promise((t,n)=>{e.complete?t():(e.addEventListener("load",t,{once:!0}),e.addEventListener("error",n,{once:!0}))})}function o(){return Promise.allSettled([...document.getElementsByTagName("img")].map(a))}t.A={mixins:[s.A],mounted(){this.scrollToElementIfAnchorPresent()},updated(){this.scrollToElementIfAnchorPresent()},methods:{async scrollToElementIfAnchorPresent(){const{hash:e}=this.$route;if(!e)return;const{imageLoadingStrategy:t}=r.A.state;r.A.setImageLoadingStrategy(i.A.eager),await this.$nextTick(),await o(),this.scrollToElement(e),r.A.setImageLoadingStrategy(t)}}}},4605:function(e,t){"use strict";t.A={state:{flatChildren:null,references:{},apiChanges:null,apiChangesVersion:null,includedArchiveIdentifiers:[],errorFetching:!1,errorFetchingDiffs:!1,technologyProps:{}},reset(){this.state.flatChildren=null,this.state.references={},this.state.apiChanges=null,this.state.apiChangesVersion=null,this.state.includedArchiveIdentifiers=[],this.state.errorFetching=!1,this.state.errorFetchingDiffs=!1,this.state.technologyProps={}},setFlatChildren(e){this.state.flatChildren=e},setReferences(e){this.state.references=e},setApiChanges(e){this.state.apiChanges=e},setApiChangesVersion(e){this.state.apiChangesVersion=e},setIncludedArchiveIdentifiers(e){this.state.includedArchiveIdentifiers=e},setErrorFetching(e){this.state.errorFetching=e},setErrorFetchingDiffs(e){this.state.errorFetchingDiffs=e},setTechnologyProps(e){this.state.technologyProps=e}}},4610:function(e,t,n){"use strict";n.d(t,{f:function(){return a}});let r=!1,i=-1,s=0;const a="data-scroll-lock-disable",o=()=>window.navigator&&window.navigator.platform&&(/iP(ad|hone|od)/.test(window.navigator.platform)||"MacIntel"===window.navigator.platform&&window.navigator.maxTouchPoints>1);function l(e){e.touches.length>1||e.preventDefault()}const c=e=>!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight;function u(){s=document.body.getBoundingClientRect().top,document.body.style.overflow="hidden scroll",document.body.style.top=`${s}px`,document.body.style.position="fixed",document.body.style.width="100%"}function A(e){e&&(e.ontouchstart=null,e.ontouchmove=null),document.removeEventListener("touchmove",l)}function d(e,t){const n=e.targetTouches[0].clientY-i,r=e.target.closest(`[${a}]`)||t;return 0===r.scrollTop&&n>0||c(r)&&n<0?l(e):(e.stopPropagation(),!0)}function p(e){document.addEventListener("touchmove",l,{passive:!1}),e&&(e.ontouchstart=e=>{1===e.targetTouches.length&&(i=e.targetTouches[0].clientY)},e.ontouchmove=t=>{1===t.targetTouches.length&&d(t,e)})}t.A={lockScroll(e){r||(o()?p(e):u(),r=!0)},unlockScroll(e){r&&(o()?A(e):(document.body.style.removeProperty("overflow"),document.body.style.removeProperty("top"),document.body.style.removeProperty("position"),document.body.style.removeProperty("width"),window.scrollTo(0,Math.abs(s))),r=!1)}}},4654:function(e,t,n){"use strict";n.d(t,{A:function(){return c}});var r=function(){var e=this,t=e._self._c;return t("ul",{staticClass:"nav-menu-items"},[e._t("default")],2)},i=[],s={name:"NavMenuItems"},a=s,o=n(1656),l=(0,o.A)(a,r,i,!1,null,"a101abb4",null),c=l.exports},4769:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var r=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"play-icon",attrs:{viewBox:"0 0 14 14",themeId:"play"}},[t("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5v0c0-3.59 2.91-6.5 6.5-6.5v0zM7 1.5c-3.038 0-5.5 2.462-5.5 5.5s2.462 5.5 5.5 5.5c3.038 0 5.5-2.462 5.5-5.5v0c0-3.038-2.462-5.5-5.5-5.5v0z"}}),t("path",{attrs:{d:"M10.195 7.010l-5 3v-6l5 3z"}})])},i=[],s=n(6515),a={name:"PlayIcon",components:{SVGIcon:s.A}},o=a,l=n(1656),c=(0,l.A)(o,r,i,!1,null,null,null),u=c.exports},4783:function(e,t){"use strict";t.A={inject:{store:{default:()=>({state:{references:{}},setReferences(){},reset(){}})}},computed:{references:({store:e})=>e.state.references}}},4828:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var r=function(){var e=this,t=e._self._c;return t("WordBreak",{attrs:{tag:"code"}},[e._t("default")],2)},i=[],s=n(3634),a={name:"CodeVoice",components:{WordBreak:s.A}},o=a,l=n(1656),c=(0,l.A)(o,r,i,!1,null,"acd07e4e",null),u=c.exports},4885:function(e,t,n){"use strict";n.d(t,{A:function(){return de}});var r=function(){var e=this,t=e._self._c;return t("Pager",{class:["TopicsLinkCardGrid",e.topicStyle],attrs:{"aria-label":e.$t("links-grid.label"),pages:e.pages},scopedSlots:e._u([{key:"page",fn:function({page:n}){return[t("Row",{attrs:{columns:{large:e.compactCards?3:2,medium:e.compactCards?3:2}}},e._l(n,function(n){return t("Column",{key:n.title},[t("TopicsLinkCardGridItem",{attrs:{item:n,compact:e.compactCards}})],1)}),1)]}}])},[t("BreakpointEmitter",{on:{change:e.handleBreakpointChange}})],1)},i=[],s=n(7633),a=n(7505),o=function(){var e=this,t=e._self._c;return t("div",{class:["pager",{"with-compact-controls":e.shouldUseCompactControls}],attrs:{role:"region","aria-roledescription":e.$t("pager.roledescription")}},[1===e.pages.length?[e._t("page",null,{page:e.pages[0]})]:[t("div",{staticClass:"container"},[t("Gutter",{staticClass:"left"},[t("ControlPrevious",{attrs:{disabled:!e.hasPreviousPage},nativeOn:{click:function(t){return e.previous.apply(null,arguments)}}})],1),t("div",{ref:"viewport",staticClass:"viewport",attrs:{role:"group"}},e._l(e.keyedPages,function({page:n,key:r},i){return t("div",{key:r,ref:"pages",refInFor:!0,class:["page",e.pageStates(i)],attrs:{"aria-label":e.$t("pager.page.label",{index:i+1,count:e.keyedPages.length}),id:r}},[e._t("page",null,{page:n})],2)}),0),t("Gutter",{staticClass:"right"},[t("ControlNext",{attrs:{disabled:!e.hasNextPage},nativeOn:{click:function(t){return e.next.apply(null,arguments)}}})],1)],1),t("div",{staticClass:"compact-controls",attrs:{role:"group","aria-label":"Controls"}},[t("ControlPrevious",{attrs:{disabled:!e.hasPreviousPage},nativeOn:{click:function(t){return e.previous.apply(null,arguments)}}}),t("ControlNext",{attrs:{disabled:!e.hasNextPage},nativeOn:{click:function(t){return e.next.apply(null,arguments)}}})],1),t("div",{staticClass:"indicators"},e._l(e.keyedPages,function({key:n},r){return t("a",{key:n,class:["indicator",e.pageStates(r)],attrs:{"aria-current":e.isActivePage(r),href:`#${n}`},on:{click:function(t){return e.setActivePage(t,r)}}})}),0)],e._t("default")],2)},l=[],c=(n(8111),n(116),n(7588),n(1701),n(8237),function(){var e=this,t=e._self._c;return t("button",{class:["pager-control",e.action],attrs:{"aria-label":e.$t(`pager.control.navigate-${e.action}`)}},[t("ChevronRoundedIcon",{staticClass:"icon"})],1)}),u=[],A=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"chevron-rounded-icon",attrs:{viewBox:"0 0 14 25",themeId:"chevron-rounded"}},[t("path",{attrs:{d:"M1,24.4a.9.9,0,0,0,.7-.3L13.4,13a1,1,0,0,0,0-1.6L1.7.3A.9.9,0,0,0,1,0,.9.9,0,0,0,0,1a.9.9,0,0,0,.3.7l11,10.5L.3,22.7a.9.9,0,0,0-.3.7A.9.9,0,0,0,1,24.4Z"}})])},d=[],p=n(6515),h={name:"ChevronRoundedIcon",components:{SVGIcon:p.A}},g=h,f=n(1656),m=(0,f.A)(g,A,d,!1,null,null,null),v=m.exports;const y={previous:"previous",next:"next"};var b={name:"PagerControl",components:{ChevronRoundedIcon:v},props:{action:{type:String,required:!0,validator:e=>Object.hasOwnProperty.call(y,e)}},Action:y},C=b,I=(0,f.A)(C,c,u,!1,null,"58c8390a",null),w=I.exports,E=n(2361),B=n(9787);const x=174;function k(e){return e.scrollIntoView({behavior:"auto",block:"nearest",inline:"start"}),new Promise(t=>{const n=60,r=2;let i=null,s=0;function a(){const o=e.getBoundingClientRect().left;s>r&&(o===i||s>=n)?t():(i=o,s+=1,requestAnimationFrame(a))}requestAnimationFrame(a)})}var S={name:"Pager",components:{ControlNext:{render(e){return e(w,{props:{action:w.Action.next}})}},ControlPrevious:{render(e){return e(w,{props:{action:w.Action.previous}})}},Gutter:{render(e){return e("div",{class:"gutter"},this.$slots.default)}}},props:{pages:{type:Array,required:!0,validator:e=>e.length>0}},data:()=>({activePageIndex:0,appState:B.A.state}),computed:{indices:({keyedPages:e})=>e.reduce((e,t,n)=>({...e,[t.key]:n}),{}),keyedPages:({_uid:e,pages:t})=>t.map((t,n)=>({key:`pager-${e}-page-${n}`,page:t})),hasNextPage:({activePageIndex:e,pages:t})=>ee>0,contentWidth:({appState:e})=>e.contentWidth,shouldUseCompactControls:({contentWidth:e})=>window.innerWidth>E.fQ.default.large.minWidth?e=this.$refs.pages.length)return;const n=this.$refs.pages[t];this.pauseObservingPages(),await k(n),this.startObservingPages(),this.activePageIndex=t},next(e){this.setActivePage(e,this.activePageIndex+1)},previous(e){this.setActivePage(e,this.activePageIndex-1)},observePages(e){const t=e.find(e=>e.isIntersecting)?.target?.id;t&&(this.activePageIndex=this.indices[t])},setupObserver(){this.observer=new IntersectionObserver(this.observePages,{root:this.$refs.viewport,threshold:.5}),this.startObservingPages()},startObservingPages(){this.$refs.pages.forEach(e=>{this.observer?.observe(e)})},pauseObservingPages(){this.$refs.pages.forEach(e=>{this.observer?.unobserve(e)})}},mounted(){this.pages.length>1&&this.setupObserver()},beforeDestroy(){this.observer?.disconnect()}},_=S,T=(0,f.A)(_,o,l,!1,null,"1ed6aae0",null),L=T.exports,P=n(8635),Q=n(2853),M=n(7219),D=function(){var e=this,t=e._self._c;return t("Card",{staticClass:"reference-card-grid-item",attrs:{url:e.item.url,image:e.imageReferences.card,title:e.item.title,"floating-style":"",size:e.cardSize,"link-text":e.compact?"":e.$t(e.linkText)},scopedSlots:e._u([e.imageReferences.card?null:{key:"cover",fn:function({classes:n}){return[t("div",{staticClass:"reference-card-grid-item__image",class:n},[t("TopicTypeIcon",{staticClass:"reference-card-grid-item__icon",attrs:{type:e.item.role,"image-override":e.references[e.imageReferences.icon]}})],1)]}}],null,!0)},[e.compact?e._e():t("ContentNode",{attrs:{content:e.item.abstract}})],1)},O=[],R=function(){var e=this,t=e._self._c;return t("Reference",e._b({staticClass:"card",class:e.classes,attrs:{url:e.url}},"Reference",e.linkAriaTags,!1),[t("CardCover",{attrs:{variants:e.imageVariants,rounded:e.floatingStyle,alt:e.imageReference.alt,"aria-hidden":"true"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._t("cover",null,null,t)]}}],null,!0)}),t("div",{staticClass:"details",attrs:{"aria-hidden":"true"}},[e.eyebrow?t("div",{staticClass:"eyebrow",attrs:{id:e.eyebrowId,"aria-label":e.formatAriaLabel(`- ${e.eyebrow}`)}},[e._v(" "+e._s(e.eyebrow)+" ")]):e._e(),t("div",{staticClass:"title",attrs:{id:e.titleId}},[e._v(" "+e._s(e.title)+" ")]),e.$slots.default?t("div",{staticClass:"card-content",attrs:{id:e.contentId}},[e._t("default")],2):e._e(),e.linkText?t(e.hasButton?"ButtonLink":"div",{tag:"component",staticClass:"link"},[e._v(" "+e._s(e.linkText)+" "),e.showExternalLinks?t("DiagonalArrowIcon",{staticClass:"icon-inline link-icon"}):e.hasButton?e._e():t("InlineChevronRightIcon",{staticClass:"icon-inline link-icon"})],1):e._e()],1)],1)},N=[],j=n(5892),V=n(6e3),G=n(9540),$=n(1754),z={small:"small",large:"large"},q=n(4783),H=function(){var e=this,t=e._self._c;return t("div",{staticClass:"card-cover-wrap",class:{rounded:e.rounded}},[e._t("default",function(){return[t("ImageAsset",{staticClass:"card-cover",attrs:{variants:e.variants,alt:e.alt}})]},{classes:"card-cover"})],2)},F=[],W=n(9720),U={name:"CardCover",components:{ImageAsset:W.A},props:{variants:{type:Array,required:!0},rounded:{type:Boolean,default:!1},alt:{type:String,default:null}}},Y=U,X=(0,f.A)(Y,H,F,!1,null,"28b14a83",null),Z=X.exports,K={name:"Card",components:{Reference:$.A,DiagonalArrowIcon:G.A,InlineChevronRightIcon:V.A,CardCover:Z,ButtonLink:j.A},constants:{CardSize:z},mixins:[q.A],computed:{titleId:({_uid:e})=>`card_title_${e}`,contentId:({_uid:e})=>`card_content_${e}`,eyebrowId:({_uid:e})=>`card_eyebrow_${e}`,linkAriaTags:({titleId:e,eyebrowId:t,contentId:n,eyebrow:r,$slots:i})=>({"aria-labelledby":e.concat(r?` ${t}`:""),"aria-describedby":i.default?`${n}`:null}),classes:({size:e,floatingStyle:t})=>[e,{"floating-style":t}],imageReference:({image:e,references:t})=>t[e]||{},imageVariants:({imageReference:e})=>e.variants||[]},props:{linkText:{type:String,required:!1},url:{type:String,required:!1,default:""},eyebrow:{type:String,required:!1},image:{type:String,required:!1},size:{type:String,validator:e=>Object.prototype.hasOwnProperty.call(z,e)},title:{type:String,required:!0},hasButton:{type:Boolean,default:()=>!1},floatingStyle:{type:Boolean,default:!1},showExternalLinks:{type:Boolean,default:!1},formatAriaLabel:{type:Function,default:e=>e}}},J=K,ee=(0,f.A)(J,R,N,!1,null,"0f7a4f31",null),te=ee.exports,ne=n(2670),re=n(4468);const ie={[re.y.article]:"documentation.card.read-article",[re.y.overview]:"documentation.card.start-tutorial",[re.y.collection]:"documentation.card.view-api",[re.y.symbol]:"documentation.card.view-symbol",[re.y.sampleCode]:"documentation.card.view-sample-code"};var se={name:"TopicsLinkCardGridItem",components:{TopicTypeIcon:ne.A,Card:te,ContentNode:()=>Promise.resolve().then(n.bind(n,9))},mixins:[q.A],props:{item:{type:Object,required:!0},compact:{type:Boolean,default:!0}},computed:{imageReferences:({item:e})=>(e.images||[]).reduce((e,t)=>(e[t.type]=t.identifier,e),{icon:null,card:null}),linkText:({item:e})=>ie[e.role]||"documentation.card.learn-more",cardSize:({compact:e})=>e?void 0:z.large}},ae=se,oe=(0,f.A)(ae,D,O,!1,null,"87dd3302",null),le=oe.exports,ce={name:"TopicsLinkCardGrid",components:{BreakpointEmitter:s.A,Column:a.A,Pager:L,Row:P.A,TopicsLinkCardGridItem:le},data:()=>({breakpoint:E.FC.large}),props:{items:{type:Array,required:!0},pageSize:{type:Number,required:!1},topicStyle:{type:String,default:Q.Z.compactGrid,validator:e=>e===Q.Z.compactGrid||e===Q.Z.detailedGrid},usePager:{type:Boolean,default:!1}},computed:{compactCards:({topicStyle:e})=>e===Q.Z.compactGrid,defaultPageSize:({breakpoint:e,items:t,topicStyle:n,usePager:r})=>r?{[Q.Z.compactGrid]:{[E.FC.large]:6,[E.FC.medium]:6,[E.FC.small]:1},[Q.Z.detailedGrid]:{[E.FC.large]:4,[E.FC.medium]:2,[E.FC.small]:1}}[n][e]:t.length,pages:({items:e,defaultPageSize:t,pageSize:n})=>(0,M.MY)(e,n||t)},methods:{handleBreakpointChange(e){this.breakpoint=e}}},ue=ce,Ae=(0,f.A)(ue,r,i,!1,null,null,null),de=Ae.exports},5060:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var r=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"curly-brackets-icon",attrs:{viewBox:"0 0 14 14",themeId:"curly-brackets"}},[t("path",{attrs:{d:"M9.987 14h-0.814v-0.916h0.36c0.137 0 0.253-0.038 0.349-0.116 0.099-0.080 0.179-0.188 0.239-0.318 0.064-0.134 0.11-0.298 0.139-0.483 0.031-0.186 0.045-0.38 0.045-0.58v-2.115c0-0.417 0.046-0.781 0.139-1.083 0.092-0.3 0.2-0.554 0.322-0.754 0.127-0.203 0.246-0.353 0.366-0.458 0.087-0.076 0.155-0.131 0.207-0.169-0.052-0.037-0.12-0.093-0.207-0.167-0.12-0.105-0.239-0.255-0.366-0.459-0.122-0.2-0.23-0.453-0.322-0.754-0.093-0.3-0.139-0.665-0.139-1.082v-2.13c0-0.199-0.014-0.392-0.045-0.572-0.029-0.182-0.076-0.345-0.139-0.483-0.060-0.137-0.141-0.246-0.239-0.328-0.095-0.076-0.212-0.115-0.349-0.115h-0.36v-0.916h0.814c0.442 0 0.788 0.18 1.030 0.538 0.238 0.352 0.358 0.826 0.358 1.407v2.236c0 0.3 0.015 0.597 0.044 0.886 0.030 0.287 0.086 0.544 0.164 0.765 0.077 0.216 0.184 0.392 0.318 0.522 0.129 0.124 0.298 0.188 0.503 0.188h0.058v0.916h-0.058c-0.206 0-0.374 0.064-0.503 0.188-0.134 0.129-0.242 0.305-0.318 0.521-0.078 0.223-0.134 0.48-0.164 0.766-0.029 0.288-0.044 0.587-0.044 0.884v2.236c0 0.582-0.12 1.055-0.358 1.409-0.242 0.358-0.588 0.538-1.030 0.538z"}}),t("path",{attrs:{d:"M4.827 14h-0.814c-0.442 0-0.788-0.18-1.030-0.538-0.238-0.352-0.358-0.825-0.358-1.409v-2.221c0-0.301-0.015-0.599-0.045-0.886-0.029-0.287-0.085-0.544-0.163-0.764-0.077-0.216-0.184-0.393-0.318-0.522-0.131-0.127-0.296-0.188-0.503-0.188h-0.058v-0.916h0.058c0.208 0 0.373-0.063 0.503-0.188 0.135-0.129 0.242-0.304 0.318-0.522 0.078-0.22 0.134-0.477 0.163-0.765 0.030-0.286 0.045-0.585 0.045-0.886v-2.251c0-0.582 0.12-1.055 0.358-1.407 0.242-0.358 0.588-0.538 1.030-0.538h0.814v0.916h-0.36c-0.138 0-0.252 0.038-0.349 0.116-0.099 0.079-0.179 0.189-0.239 0.327-0.064 0.139-0.11 0.302-0.141 0.483-0.029 0.18-0.044 0.373-0.044 0.572v2.13c0 0.417-0.046 0.782-0.138 1.082-0.092 0.302-0.201 0.556-0.324 0.754-0.123 0.201-0.246 0.356-0.366 0.459-0.086 0.074-0.153 0.13-0.206 0.167 0.052 0.038 0.12 0.093 0.206 0.169 0.12 0.103 0.243 0.258 0.366 0.458s0.232 0.453 0.324 0.754c0.092 0.302 0.138 0.666 0.138 1.083v2.115c0 0.2 0.015 0.394 0.044 0.58 0.030 0.186 0.077 0.349 0.139 0.482 0.062 0.132 0.142 0.239 0.241 0.32 0.096 0.079 0.21 0.116 0.349 0.116h0.36z"}})])},i=[],s=n(6515),a={name:"CurlyBracketsIcon",components:{SVGIcon:s.A}},o=a,l=n(1656),c=(0,l.A)(o,r,i,!1,null,null,null),u=c.exports},5273:function(e,t,n){"use strict";n.d(t,{A:function(){return c}});var r=function(){var e=this,t=e._self._c;return t("li",{staticClass:"nav-menu-item",class:{"nav-menu-item--animated":e.animate}},[e._t("default")],2)},i=[],s={name:"NavMenuItemBase",props:{animate:{type:Boolean,default:!0}}},a=s,o=n(1656),l=(0,o.A)(a,r,i,!1,null,"6d4d011a",null),c=l.exports},5366:function(e,t,n){var r={"./markdown":[8384,157],"./markdown.js":[8384,157],"./pkl":[3509,507],"./pkl.js":[3509,507],"./swift":[7735,255],"./swift.js":[7735,255]};function i(e){if(!n.o(r,e))return Promise.resolve().then(function(){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t});var t=r[e],i=t[0];return n.e(t[1]).then(function(){return n(i)})}i.keys=function(){return Object.keys(r)},i.id=5366,e.exports=i},5411:function(e,t,n){"use strict";n.d(t,{A:function(){return A}});var r=n(4783);const i={link:"link",reference:"reference",text:"text"};var s,a,o={name:"DestinationDataProvider",mixins:[r.A],props:{destination:{type:Object,required:!0,default:()=>({})}},inject:{isTargetIDE:{default:()=>!1}},constants:{DestinationType:i},computed:{isExternal:({reference:e,destination:t})=>e.type===i.link||t.type===i.link,shouldAppendOpensInBrowser:({isExternal:e,isTargetIDE:t})=>e&&t,reference:({references:e,destination:t})=>e[t.identifier]||{},linkUrl:({destination:e,reference:t})=>({[i.link]:e.destination,[i.reference]:t.url,[i.text]:e.text}[e.type]),linkTitle:({reference:e,destination:t})=>({[i.link]:t.title,[i.reference]:t.overridingTitle||e.title,[i.text]:""}[t.type])},methods:{formatAriaLabel(e){return this.shouldAppendOpensInBrowser?`${e} (opens in browser)`:e}},render(){return this.$scopedSlots.default({url:this.linkUrl||"",title:this.linkTitle||"",formatAriaLabel:this.formatAriaLabel,isExternal:this.isExternal})}},l=o,c=n(1656),u=(0,c.A)(l,s,a,!1,null,null,null),A=u.exports},5689:function(e,t,n){"use strict";n.d(t,{m:function(){return i},t:function(){return r}});const r={article:"article",associatedtype:"associatedtype",buildSetting:"buildSetting",case:"case",collection:"collection",class:"class",container:"container",dictionarySymbol:"dictionarySymbol",enum:"enum",extension:"extension",func:"func",groupMarker:"groupMarker",httpRequest:"httpRequest",init:"init",languageGroup:"languageGroup",learn:"learn",macro:"macro",method:"method",module:"module",namespace:"namespace",op:"op",overview:"overview",project:"project",property:"property",propertyListKey:"propertyListKey",propertyListKeyReference:"propertyListKeyReference",protocol:"protocol",resources:"resources",root:"root",sampleCode:"sampleCode",section:"section",struct:"struct",subscript:"subscript",symbol:"symbol",tutorial:"tutorial",typealias:"typealias",union:"union",var:"var"},i={[r.init]:r.method,[r.case]:r.enum,[r.propertyListKeyReference]:r.propertyListKey,[r.project]:r.tutorial}},5747:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var r=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"swift-file-icon",attrs:{viewBox:"0 0 15 14",themeId:"swift-file"}},[t("path",{attrs:{d:"M14.93,13.56A2.15,2.15,0,0,0,15,13a5.37,5.37,0,0,0-1.27-3.24A6.08,6.08,0,0,0,14,7.91,9.32,9.32,0,0,0,9.21.31a8.51,8.51,0,0,1,1.78,5,6.4,6.4,0,0,1-.41,2.18A45.06,45.06,0,0,1,3.25,1.54,44.57,44.57,0,0,0,7.54,6.9,45.32,45.32,0,0,1,1.47,2.32,35.69,35.69,0,0,0,8.56,9.94a6.06,6.06,0,0,1-3.26.85A9.48,9.48,0,0,1,0,8.91a10,10,0,0,0,8.1,4.72c2.55,0,3.25-1.2,4.72-1.2a2.09,2.09,0,0,1,1.91,1.15C14.79,13.69,14.88,13.75,14.93,13.56Z"}})])},i=[],s=n(6515),a={name:"SwiftFileIcon",components:{SVGIcon:s.A}},o=a,l=n(1656),c=(0,l.A)(o,r,i,!1,null,"c01a6890",null),u=c.exports},5892:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var r=function(){var e=this,t=e._self._c;return t(e.resolvedComponent,e._b({tag:"component",staticClass:"button-cta",class:{"is-dark":e.isDark}},"component",e.componentProps,!1),[e._t("default")],2)},i=[],s=n(1754),a={name:"ButtonLink",components:{Reference:s.A},props:{url:{type:String,required:!1},isDark:{type:Boolean,default:!1},linksToAsset:{type:Boolean,default:!1}},computed:{resolvedComponent:({url:e})=>e?s.A:"button",componentProps:({url:e,linksToAsset:t})=>e?{url:e,linksToAsset:t}:{linksToAsset:t}}},o=a,l=n(1656),c=(0,l.A)(o,r,i,!1,null,"3d3ff4c8",null),u=c.exports},6616:function(e,t,n){"use strict";n.d(t,{A:function(){return c}});var r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"row"},[e._t("default")],2)},i=[],s={name:"GridRow"},a=s,o=n(1656),l=(0,o.A)(a,r,i,!1,null,"be73599c",null),c=l.exports},7219:function(e,t,n){"use strict";n.d(t,{HV:function(){return r},MY:function(){return a},n4:function(){return i}});n(3110);const r=e=>e[e.length-1],i=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function*s(e,t){for(let n=0;n({"--col-span":e})}},a=s,o=n(1656),l=(0,o.A)(a,r,i,!1,null,"0f654188",null),c=l.exports},7633:function(e,t,n){"use strict";n.d(t,{A:function(){return h}});n(8111),n(7588);var r=n(2361);const i=e=>e?`(max-width: ${e}px)`:"",s=e=>e?`(min-width: ${e}px)`:"";function a({minWidth:e,maxWidth:t}){return["only screen",s(e),i(t)].filter(Boolean).join(" and ")}function o({maxWidth:e,minWidth:t}){return window.matchMedia(a({minWidth:t,maxWidth:e}))}var l,c,u={name:"BreakpointEmitter",constants:{BreakpointAttributes:r.fQ,BreakpointName:r.FC,BreakpointScopes:r.fc},props:{scope:{type:String,default:()=>r.fc.default,validator:e=>e in r.fc}},render(){return this.$scopedSlots.default?this.$scopedSlots.default({matchingBreakpoint:this.matchingBreakpoint}):null},data:()=>({matchingBreakpoint:null}),methods:{initMediaQuery(e,t){const n=o(t),r=t=>this.handleMediaQueryChange(t,e);n.addListener(r),this.$once("hook:beforeDestroy",()=>{n.removeListener(r)}),r(n)},handleMediaQueryChange(e,t){e.matches&&(this.matchingBreakpoint=t,this.$emit("change",t))}},mounted(){const e=r.fQ[this.scope]||{};Object.entries(e).forEach(([e,t])=>{this.initMediaQuery(e,t)})}},A=u,d=n(1656),p=(0,d.A)(A,l,c,!1,null,null,null),h=p.exports},8284:function(e,t,n){"use strict";n(4114),n(8111),n(7588);const r={up:"up",down:"down"};t.A={constants:{IntersectionDirections:r},data(){return{intersectionObserver:null,intersectionPreviousScrollY:0,intersectionScrollDirection:r.down}},computed:{intersectionThreshold(){const e=[];for(let t=0;t<=1;t+=.01)e.push(t);return e},intersectionRoot(){return null},intersectionRootMargin(){return"0px 0px 0px 0px"},intersectionObserverOptions(){return{root:this.intersectionRoot,rootMargin:this.intersectionRootMargin,threshold:this.intersectionThreshold}}},async mounted(){await n.e(127).then(n.t.bind(n,5127,23)),this.intersectionObserver=new IntersectionObserver(e=>{this.detectIntersectionScrollDirection();const t=this.onIntersect;t?e.forEach(t):console.warn("onIntersect not implemented")},this.intersectionObserverOptions),this.getIntersectionTargets().forEach(e=>{this.intersectionObserver.observe(e)})},beforeDestroy(){this.intersectionObserver&&this.intersectionObserver.disconnect()},methods:{getIntersectionTargets(){return[this.$el]},detectIntersectionScrollDirection(){window.scrollYthis.intersectionPreviousScrollY&&(this.intersectionScrollDirection=r.up),this.intersectionPreviousScrollY=window.scrollY}}}},8416:function(e){function t(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(n=>{const r=e[n],i=typeof r;"object"!==i&&"function"!==i||Object.isFrozen(r)||t(r)}),e}class n{constructor(e){void 0===e.data&&(e.data={}),this.data=e.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function r(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function i(e,...t){const n=Object.create(null);for(const r in e)n[r]=e[r];return t.forEach(function(e){for(const t in e)n[t]=e[t]}),n}const s="",a=e=>!!e.scope,o=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){const n=e.split(".");return[`${t}${n.shift()}`,...n.map((e,t)=>`${e}${"_".repeat(t+1)}`)].join(" ")}return`${t}${e}`};class l{constructor(e,t){this.buffer="",this.classPrefix=t.classPrefix,e.walk(this)}addText(e){this.buffer+=r(e)}openNode(e){if(!a(e))return;const t=o(e.scope,{prefix:this.classPrefix});this.span(t)}closeNode(e){a(e)&&(this.buffer+=s)}value(){return this.buffer}span(e){this.buffer+=``}}const c=(e={})=>{const t={children:[]};return Object.assign(t,e),t};class u{constructor(){this.rootNode=c(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(e){this.top.children.push(e)}openNode(e){const t=c({scope:e});this.add(t),this.stack.push(t)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){while(this.closeNode());}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(e){return this.constructor._walk(e,this.rootNode)}static _walk(e,t){return"string"===typeof t?e.addText(t):t.children&&(e.openNode(t),t.children.forEach(t=>this._walk(e,t)),e.closeNode(t)),e}static _collapse(e){"string"!==typeof e&&e.children&&(e.children.every(e=>"string"===typeof e)?e.children=[e.children.join("")]:e.children.forEach(e=>{u._collapse(e)}))}}class A extends u{constructor(e){super(),this.options=e}addText(e){""!==e&&this.add(e)}startScope(e){this.openNode(e)}endScope(){this.closeNode()}__addSublanguage(e,t){const n=e.root;t&&(n.scope=`language:${t}`),this.add(n)}toHTML(){const e=new l(this,this.options);return e.value()}finalize(){return this.closeAllNodes(),!0}}function d(e){return e?"string"===typeof e?e:e.source:null}function p(e){return f("(?=",e,")")}function h(e){return f("(?:",e,")*")}function g(e){return f("(?:",e,")?")}function f(...e){const t=e.map(e=>d(e)).join("");return t}function m(e){const t=e[e.length-1];return"object"===typeof t&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function v(...e){const t=m(e),n="("+(t.capture?"":"?:")+e.map(e=>d(e)).join("|")+")";return n}function y(e){return new RegExp(e.toString()+"|").exec("").length-1}function b(e,t){const n=e&&e.exec(t);return n&&0===n.index}const C=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function I(e,{joinWith:t}){let n=0;return e.map(e=>{n+=1;const t=n;let r=d(e),i="";while(r.length>0){const e=C.exec(r);if(!e){i+=r;break}i+=r.substring(0,e.index),r=r.substring(e.index+e[0].length),"\\"===e[0][0]&&e[1]?i+="\\"+String(Number(e[1])+t):(i+=e[0],"("===e[0]&&n++)}return i}).map(e=>`(${e})`).join(t)}const w=/\b\B/,E="[a-zA-Z]\\w*",B="[a-zA-Z_]\\w*",x="\\b\\d+(\\.\\d+)?",k="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",S="\\b(0b[01]+)",_="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",T=(e={})=>{const t=/^#![ ]*\//;return e.binary&&(e.begin=f(t,/.*\b/,e.binary,/\b.*/)),i({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(e,t)=>{0!==e.index&&t.ignoreMatch()}},e)},L={begin:"\\\\[\\s\\S]",relevance:0},P={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[L]},Q={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[L]},M={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},D=function(e,t,n={}){const r=i({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const s=v("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:f(/[ ]+/,"(",s,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},O=D("//","$"),R=D("/\\*","\\*/"),N=D("#","$"),j={scope:"number",begin:x,relevance:0},V={scope:"number",begin:k,relevance:0},G={scope:"number",begin:S,relevance:0},$={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[L,{begin:/\[/,end:/\]/,relevance:0,contains:[L]}]},z={scope:"title",begin:E,relevance:0},q={scope:"title",begin:B,relevance:0},H={begin:"\\.\\s*"+B,relevance:0},F=function(e){return Object.assign(e,{"on:begin":(e,t)=>{t.data._beginMatch=e[1]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}})};var W=Object.freeze({__proto__:null,APOS_STRING_MODE:P,BACKSLASH_ESCAPE:L,BINARY_NUMBER_MODE:G,BINARY_NUMBER_RE:S,COMMENT:D,C_BLOCK_COMMENT_MODE:R,C_LINE_COMMENT_MODE:O,C_NUMBER_MODE:V,C_NUMBER_RE:k,END_SAME_AS_BEGIN:F,HASH_COMMENT_MODE:N,IDENT_RE:E,MATCH_NOTHING_RE:w,METHOD_GUARD:H,NUMBER_MODE:j,NUMBER_RE:x,PHRASAL_WORDS_MODE:M,QUOTE_STRING_MODE:Q,REGEXP_MODE:$,RE_STARTERS_RE:_,SHEBANG:T,TITLE_MODE:z,UNDERSCORE_IDENT_RE:B,UNDERSCORE_TITLE_MODE:q});function U(e,t){const n=e.input[e.index-1];"."===n&&t.ignoreMatch()}function Y(e,t){void 0!==e.className&&(e.scope=e.className,delete e.className)}function X(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=U,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,void 0===e.relevance&&(e.relevance=0))}function Z(e,t){Array.isArray(e.illegal)&&(e.illegal=v(...e.illegal))}function K(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function J(e,t){void 0===e.relevance&&(e.relevance=1)}const ee=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");const n=Object.assign({},e);Object.keys(e).forEach(t=>{delete e[t]}),e.keywords=n.keywords,e.begin=f(n.beforeMatch,p(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},te=["of","and","for","in","not","or","if","then","parent","list","value"],ne="keyword";function re(e,t,n=ne){const r=Object.create(null);return"string"===typeof e?i(n,e.split(" ")):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(n){Object.assign(r,re(e[n],t,n))}),r;function i(e,n){t&&(n=n.map(e=>e.toLowerCase())),n.forEach(function(t){const n=t.split("|");r[n[0]]=[e,ie(n[0],n[1])]})}}function ie(e,t){return t?Number(t):se(e)?0:1}function se(e){return te.includes(e.toLowerCase())}const ae={},oe=e=>{console.error(e)},le=(e,...t)=>{console.log(`WARN: ${e}`,...t)},ce=(e,t)=>{ae[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),ae[`${e}/${t}`]=!0)},ue=new Error;function Ae(e,t,{key:n}){let r=0;const i=e[n],s={},a={};for(let o=1;o<=t.length;o++)a[o+r]=i[o],s[o+r]=!0,r+=y(t[o-1]);e[n]=a,e[n]._emit=s,e[n]._multi=!0}function de(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw oe("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),ue;if("object"!==typeof e.beginScope||null===e.beginScope)throw oe("beginScope must be object"),ue;Ae(e,e.begin,{key:"beginScope"}),e.begin=I(e.begin,{joinWith:""})}}function pe(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw oe("skip, excludeEnd, returnEnd not compatible with endScope: {}"),ue;if("object"!==typeof e.endScope||null===e.endScope)throw oe("endScope must be object"),ue;Ae(e,e.end,{key:"endScope"}),e.end=I(e.end,{joinWith:""})}}function he(e){e.scope&&"object"===typeof e.scope&&null!==e.scope&&(e.beginScope=e.scope,delete e.scope)}function ge(e){he(e),"string"===typeof e.beginScope&&(e.beginScope={_wrap:e.beginScope}),"string"===typeof e.endScope&&(e.endScope={_wrap:e.endScope}),de(e),pe(e)}function fe(e){function t(t,n){return new RegExp(d(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(n?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(e,t){t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]),this.matchAt+=y(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null);const e=this.regexes.map(e=>e[1]);this.matcherRe=t(I(e,{joinWith:"|"}),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex;const t=this.matcherRe.exec(e);if(!t)return null;const n=t.findIndex((e,t)=>t>0&&void 0!==e),r=this.matchIndexes[n];return t.splice(0,n),Object.assign(t,r)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){if(this.multiRegexes[e])return this.multiRegexes[e];const t=new n;return this.rules.slice(e).forEach(([e,n])=>t.addRule(e,n)),t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex;let n=t.exec(e);if(this.resumingScanAtSamePosition())if(n&&n.index===this.lastIndex);else{const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,n=t.exec(e)}return n&&(this.regexIndex+=n.position+1,this.regexIndex===this.count&&this.considerAll()),n}}function s(e){const t=new r;return e.contains.forEach(e=>t.addRule(e.begin,{rule:e,type:"begin"})),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end"}),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t}function a(n,r){const i=n;if(n.isCompiled)return i;[Y,K,ge,ee].forEach(e=>e(n,r)),e.compilerExtensions.forEach(e=>e(n,r)),n.__beforeBegin=null,[X,Z,J].forEach(e=>e(n,r)),n.isCompiled=!0;let o=null;return"object"===typeof n.keywords&&n.keywords.$pattern&&(n.keywords=Object.assign({},n.keywords),o=n.keywords.$pattern,delete n.keywords.$pattern),o=o||/\w+/,n.keywords&&(n.keywords=re(n.keywords,e.case_insensitive)),i.keywordPatternRe=t(o,!0),r&&(n.begin||(n.begin=/\B|\b/),i.beginRe=t(i.begin),n.end||n.endsWithParent||(n.end=/\B|\b/),n.end&&(i.endRe=t(i.end)),i.terminatorEnd=d(i.end)||"",n.endsWithParent&&r.terminatorEnd&&(i.terminatorEnd+=(n.end?"|":"")+r.terminatorEnd)),n.illegal&&(i.illegalRe=t(n.illegal)),n.contains||(n.contains=[]),n.contains=[].concat(...n.contains.map(function(e){return ve("self"===e?n:e)})),n.contains.forEach(function(e){a(e,i)}),n.starts&&a(n.starts,r),i.matcher=s(i),i}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=i(e.classNameAliases||{}),a(e)}function me(e){return!!e&&(e.endsWithParent||me(e.starts))}function ve(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return i(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:me(e)?i(e,{starts:e.starts?i(e.starts):null}):Object.isFrozen(e)?i(e):e}var ye="11.11.1";class be extends Error{constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}}const Ce=r,Ie=i,we=Symbol("nomatch"),Ee=7,Be=function(e){const r=Object.create(null),i=Object.create(null),s=[];let a=!0;const o="Could not find the language '{}', did you forget to load/include a language module?",l={disableAutodetect:!0,name:"Plain text",contains:[]};let c={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:A};function u(e){return c.noHighlightRe.test(e)}function d(e){let t=e.className+" ";t+=e.parentNode?e.parentNode.className:"";const n=c.languageDetectRe.exec(t);if(n){const t=Q(n[1]);return t||(le(o.replace("{}",n[1])),le("Falling back to no-highlight mode for this block.",e)),t?n[1]:"no-highlight"}return t.split(/\s+/).find(e=>u(e)||Q(e))}function m(e,t,n){let r="",i="";"object"===typeof t?(r=e,n=t.ignoreIllegals,i=t.language):(ce("10.7.0","highlight(lang, code, ...args) has been deprecated."),ce("10.7.0","Please use highlight(code, options) instead.\nhttps://github.com/highlightjs/highlight.js/issues/2277"),i=e,r=t),void 0===n&&(n=!0);const s={code:r,language:i};j("before:highlight",s);const a=s.result?s.result:y(s.language,s.code,n);return a.code=s.code,j("after:highlight",a),a}function y(e,t,i,s){const l=Object.create(null);function u(e,t){return e.keywords[t]}function A(){if(!T.keywords)return void P.addText(M);let e=0;T.keywordPatternRe.lastIndex=0;let t=T.keywordPatternRe.exec(M),n="";while(t){n+=M.substring(e,t.index);const r=k.case_insensitive?t[0].toLowerCase():t[0],i=u(T,r);if(i){const[e,s]=i;if(P.addText(n),n="",l[r]=(l[r]||0)+1,l[r]<=Ee&&(D+=s),e.startsWith("_"))n+=t[0];else{const n=k.classNameAliases[e]||e;h(t[0],n)}}else n+=t[0];e=T.keywordPatternRe.lastIndex,t=T.keywordPatternRe.exec(M)}n+=M.substring(e),P.addText(n)}function d(){if(""===M)return;let e=null;if("string"===typeof T.subLanguage){if(!r[T.subLanguage])return void P.addText(M);e=y(T.subLanguage,M,!0,L[T.subLanguage]),L[T.subLanguage]=e._top}else e=I(M,T.subLanguage.length?T.subLanguage:null);T.relevance>0&&(D+=e.relevance),P.__addSublanguage(e._emitter,e.language)}function p(){null!=T.subLanguage?d():A(),M=""}function h(e,t){""!==e&&(P.startScope(t),P.addText(e),P.endScope())}function g(e,t){let n=1;const r=t.length-1;while(n<=r){if(!e._emit[n]){n++;continue}const r=k.classNameAliases[e[n]]||e[n],i=t[n];r?h(i,r):(M=i,A(),M=""),n++}}function f(e,t){return e.scope&&"string"===typeof e.scope&&P.openNode(k.classNameAliases[e.scope]||e.scope),e.beginScope&&(e.beginScope._wrap?(h(M,k.classNameAliases[e.beginScope._wrap]||e.beginScope._wrap),M=""):e.beginScope._multi&&(g(e.beginScope,t),M="")),T=Object.create(e,{parent:{value:T}}),T}function m(e,t,r){let i=b(e.endRe,r);if(i){if(e["on:end"]){const r=new n(e);e["on:end"](t,r),r.isMatchIgnored&&(i=!1)}if(i){while(e.endsParent&&e.parent)e=e.parent;return e}}if(e.endsWithParent)return m(e.parent,t,r)}function v(e){return 0===T.matcher.regexIndex?(M+=e[0],1):(N=!0,0)}function C(e){const t=e[0],r=e.rule,i=new n(r),s=[r.__beforeBegin,r["on:begin"]];for(const n of s)if(n&&(n(e,i),i.isMatchIgnored))return v(t);return r.skip?M+=t:(r.excludeBegin&&(M+=t),p(),r.returnBegin||r.excludeBegin||(M=t)),f(r,e),r.returnBegin?0:t.length}function w(e){const n=e[0],r=t.substring(e.index),i=m(T,e,r);if(!i)return we;const s=T;T.endScope&&T.endScope._wrap?(p(),h(n,T.endScope._wrap)):T.endScope&&T.endScope._multi?(p(),g(T.endScope,e)):s.skip?M+=n:(s.returnEnd||s.excludeEnd||(M+=n),p(),s.excludeEnd&&(M=n));do{T.scope&&P.closeNode(),T.skip||T.subLanguage||(D+=T.relevance),T=T.parent}while(T!==i.parent);return i.starts&&f(i.starts,e),s.returnEnd?0:n.length}function E(){const e=[];for(let t=T;t!==k;t=t.parent)t.scope&&e.unshift(t.scope);e.forEach(e=>P.openNode(e))}let B={};function x(n,r){const s=r&&r[0];if(M+=n,null==s)return p(),0;if("begin"===B.type&&"end"===r.type&&B.index===r.index&&""===s){if(M+=t.slice(r.index,r.index+1),!a){const t=new Error(`0 width match regex (${e})`);throw t.languageName=e,t.badRule=B.rule,t}return 1}if(B=r,"begin"===r.type)return C(r);if("illegal"===r.type&&!i){const e=new Error('Illegal lexeme "'+s+'" for mode "'+(T.scope||"")+'"');throw e.mode=T,e}if("end"===r.type){const e=w(r);if(e!==we)return e}if("illegal"===r.type&&""===s)return M+="\n",1;if(R>1e5&&R>3*r.index){const e=new Error("potential infinite loop, way more iterations than matches");throw e}return M+=s,s.length}const k=Q(e);if(!k)throw oe(o.replace("{}",e)),new Error('Unknown language: "'+e+'"');const S=fe(k);let _="",T=s||S;const L={},P=new c.__emitter(c);E();let M="",D=0,O=0,R=0,N=!1;try{if(k.__emitTokens)k.__emitTokens(t,P);else{for(T.matcher.considerAll();;){R++,N?N=!1:T.matcher.considerAll(),T.matcher.lastIndex=O;const e=T.matcher.exec(t);if(!e)break;const n=t.substring(O,e.index),r=x(n,e);O=e.index+r}x(t.substring(O))}return P.finalize(),_=P.toHTML(),{language:e,value:_,relevance:D,illegal:!1,_emitter:P,_top:T}}catch(j){if(j.message&&j.message.includes("Illegal"))return{language:e,value:Ce(t),illegal:!0,relevance:0,_illegalBy:{message:j.message,index:O,context:t.slice(O-100,O+100),mode:j.mode,resultSoFar:_},_emitter:P};if(a)return{language:e,value:Ce(t),illegal:!1,relevance:0,errorRaised:j,_emitter:P,_top:T};throw j}}function C(e){const t={value:Ce(e),illegal:!1,relevance:0,_top:l,_emitter:new c.__emitter(c)};return t._emitter.addText(e),t}function I(e,t){t=t||c.languages||Object.keys(r);const n=C(e),i=t.filter(Q).filter(D).map(t=>y(t,e,!1));i.unshift(n);const s=i.sort((e,t)=>{if(e.relevance!==t.relevance)return t.relevance-e.relevance;if(e.language&&t.language){if(Q(e.language).supersetOf===t.language)return 1;if(Q(t.language).supersetOf===e.language)return-1}return 0}),[a,o]=s,l=a;return l.secondBest=o,l}function w(e,t,n){const r=t&&i[t]||n;e.classList.add("hljs"),e.classList.add(`language-${r}`)}function E(e){let t=null;const n=d(e);if(u(n))return;if(j("before:highlightElement",{el:e,language:n}),e.dataset.highlighted)return void console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",e);if(e.children.length>0&&(c.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(e)),c.throwUnescapedHTML)){const t=new be("One of your code blocks includes unescaped HTML.",e.innerHTML);throw t}t=e;const r=t.textContent,i=n?m(r,{language:n,ignoreIllegals:!0}):I(r);e.innerHTML=i.value,e.dataset.highlighted="yes",w(e,n,i.language),e.result={language:i.language,re:i.relevance,relevance:i.relevance},i.secondBest&&(e.secondBest={language:i.secondBest.language,relevance:i.secondBest.relevance}),j("after:highlightElement",{el:e,result:i,text:r})}function B(e){c=Ie(c,e)}const x=()=>{_(),ce("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function k(){_(),ce("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let S=!1;function _(){function e(){_()}if("loading"===document.readyState)return S||window.addEventListener("DOMContentLoaded",e,!1),void(S=!0);const t=document.querySelectorAll(c.cssSelector);t.forEach(E)}function T(t,n){let i=null;try{i=n(e)}catch(s){if(oe("Language definition for '{}' could not be registered.".replace("{}",t)),!a)throw s;oe(s),i=l}i.name||(i.name=t),r[t]=i,i.rawDefinition=n.bind(null,e),i.aliases&&M(i.aliases,{languageName:t})}function L(e){delete r[e];for(const t of Object.keys(i))i[t]===e&&delete i[t]}function P(){return Object.keys(r)}function Q(e){return e=(e||"").toLowerCase(),r[e]||r[i[e]]}function M(e,{languageName:t}){"string"===typeof e&&(e=[e]),e.forEach(e=>{i[e.toLowerCase()]=t})}function D(e){const t=Q(e);return t&&!t.disableAutodetect}function O(e){e["before:highlightBlock"]&&!e["before:highlightElement"]&&(e["before:highlightElement"]=t=>{e["before:highlightBlock"](Object.assign({block:t.el},t))}),e["after:highlightBlock"]&&!e["after:highlightElement"]&&(e["after:highlightElement"]=t=>{e["after:highlightBlock"](Object.assign({block:t.el},t))})}function R(e){O(e),s.push(e)}function N(e){const t=s.indexOf(e);-1!==t&&s.splice(t,1)}function j(e,t){const n=e;s.forEach(function(e){e[n]&&e[n](t)})}function V(e){return ce("10.7.0","highlightBlock will be removed entirely in v12.0"),ce("10.7.0","Please use highlightElement now."),E(e)}Object.assign(e,{highlight:m,highlightAuto:I,highlightAll:_,highlightElement:E,highlightBlock:V,configure:B,initHighlighting:x,initHighlightingOnLoad:k,registerLanguage:T,unregisterLanguage:L,listLanguages:P,getLanguage:Q,registerAliases:M,autoDetection:D,inherit:Ie,addPlugin:R,removePlugin:N}),e.debugMode=function(){a=!1},e.safeMode=function(){a=!0},e.versionString=ye,e.regex={concat:f,lookahead:p,either:v,optional:g,anyNumberOfTimes:h};for(const n in W)"object"===typeof W[n]&&t(W[n]);return Object.assign(e,W),e},xe=Be({});xe.newInstance=()=>Be({}),e.exports=xe,xe.HighlightJS=xe,xe.default=xe},8486:function(e,t,n){"use strict";n.d(t,{A:function(){return U}});var r,i,s=function(){var e=this,t=e._self._c;return t("div",{staticClass:"asset"},[t(e.assetComponent,e._g(e._b({tag:"component"},"component",e.assetProps,!1),e.assetListeners))],1)},a=[],o=n(9720),l=function(){var e=this,t=e._self._c;return t("ConditionalWrapper",{ref:"wrapper",attrs:{tag:e.DeviceFrameComponent,"should-wrap":!!e.deviceFrame,device:e.deviceFrame}},[t("div",[t("video",{key:e.videoAttributes.url,ref:"video",attrs:{id:e.id,controls:e.showsDefaultControls,"data-orientation":e.orientation,autoplay:e.autoplays,poster:e.normalisedPosterPath,width:e.optimalWidth,"aria-roledescription":e.$t("video.title"),"aria-labelledby":e.showsDefaultControls&&e.alt?e.altTextId:null,playsinline:""},domProps:{muted:e.muted},on:{loadedmetadata:e.setOrientation,playing:function(t){return e.$emit("playing")},pause:function(t){return e.$emit("pause")},ended:function(t){return e.$emit("ended")}}},[t("source",{attrs:{src:e.normalizePath(e.videoAttributes.url)}})]),e.alt?t("span",{attrs:{id:e.altTextId,hidden:""}},[e._v(" "+e._s(e.$t("video.description",{alt:e.alt}))+" ")]):e._e()])])},c=[],u=n(288),A=n(8964),d=n(1537),p={functional:!0,name:"ConditionalWrapper",props:{tag:[Object,String],shouldWrap:Boolean},render(e,t){return t.props.shouldWrap?e(t.props.tag,t.data,t.children):t.children}},h=p,g=n(1656),f=(0,g.A)(h,r,i,!1,null,null,null),m=f.exports,v=n(164),y={name:"VideoAsset",components:{ConditionalWrapper:m},props:{variants:{type:Array,required:!0},showsDefaultControls:{type:Boolean,default:()=>!1},autoplays:{type:Boolean,default:()=>!1},posterVariants:{type:Array,required:!1,default:()=>[]},muted:{type:Boolean,default:!1},deviceFrame:{type:String,required:!1},alt:{type:String,required:!1},id:{type:String,required:!0}},data:()=>({appState:A.A.state,optimalWidth:null,orientation:null}),computed:{DeviceFrameComponent:()=>v.A,preferredColorScheme:({appState:e})=>e.preferredColorScheme,systemColorScheme:({appState:e})=>e.systemColorScheme,altTextId:({id:e})=>`${e}-alt`,userPrefersDark:({preferredColorScheme:e,systemColorScheme:t})=>e===d.A.dark||e===d.A.auto&&t===d.A.dark,shouldShowDarkVariant:({darkVideoVariantAttributes:e,userPrefersDark:t})=>e&&t,defaultVideoAttributes(){return this.videoVariantsGroupedByAppearance.light[0]||this.darkVideoVariantAttributes||{}},darkVideoVariantAttributes(){return this.videoVariantsGroupedByAppearance.dark[0]},videoVariantsGroupedByAppearance(){return(0,u.np)(this.variants)},posterVariantsGroupedByAppearance(){const{light:e,dark:t}=(0,u.np)(this.posterVariants);return{light:(0,u.qD)(e),dark:(0,u.qD)(t)}},defaultPosterAttributes:({posterVariantsGroupedByAppearance:e,userPrefersDark:t})=>t&&e.dark.length?e.dark[0]:e.light[0]||{},normalisedPosterPath:({defaultPosterAttributes:e})=>(0,u.Fd)(e.src),videoAttributes:({darkVideoVariantAttributes:e,defaultVideoAttributes:t,shouldShowDarkVariant:n})=>n?e:t},watch:{normalisedPosterPath:{immediate:!0,handler:"getPosterDimensions"}},methods:{normalizePath:u.Fd,async getPosterDimensions(e){if(!e)return void(this.optimalWidth=null);const{density:t}=this.defaultPosterAttributes,n=parseInt(t.match(/\d+/)[0],10),{width:r}=await(0,u.Hm)(e);this.optimalWidth=r/n},setOrientation(){const{videoWidth:e,videoHeight:t}=this.$refs.video;this.orientation=(0,u.vc)(e,t)}}},b=y,C=(0,g.A)(b,l,c,!1,null,null,null),I=C.exports,w=function(){var e=this,t=e._self._c;return t("div",{staticClass:"video-replay-container",attrs:{role:"group","aria-roledescription":e.$t("video.title"),"aria-labelledby":e.showsDefaultControls?null:e.ariaLabelledByContainer}},[t("span",{attrs:{id:`${e.id}-custom-controls`,hidden:""}},[e._v(" "+e._s(e.$t("video.custom-controls"))+" ")]),t("VideoAsset",{ref:"asset",attrs:{variants:e.variants,autoplays:e.autoplays,showsDefaultControls:e.showsDefaultControls,muted:e.muted,posterVariants:e.posterVariants,deviceFrame:e.deviceFrame,alt:e.alt,id:e.id},on:{pause:e.onPause,playing:e.onVideoPlaying,ended:e.onVideoEnd}}),e.showsDefaultControls?e._e():t("a",{staticClass:"control-button",attrs:{href:"#","aria-controls":e.id},on:{click:function(t){return t.preventDefault(),e.togglePlayStatus.apply(null,arguments)}}},[e._v(" "+e._s(e.text)+" "),e.videoEnded?t("InlineReplayIcon",{staticClass:"control-icon icon-inline"}):e.isPlaying?t("PauseIcon",{staticClass:"control-icon icon-inline"}):t("PlayIcon",{staticClass:"control-icon icon-inline"})],1)],1)},E=[],B=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"inline-replay-icon",attrs:{viewBox:"0 0 14 14",themeId:"inline-replay"}},[t("path",{attrs:{d:"M2.254 10.201c-1.633-2.613-0.838-6.056 1.775-7.689 2.551-1.594 5.892-0.875 7.569 1.592l0.12 0.184-0.848 0.53c-1.34-2.145-4.166-2.797-6.311-1.457s-2.797 4.166-1.457 6.311 4.166 2.797 6.311 1.457c1.006-0.629 1.71-1.603 2.003-2.723l0.056-0.242 0.98 0.201c-0.305 1.487-1.197 2.792-2.51 3.612-2.613 1.633-6.056 0.838-7.689-1.775z"}}),t("path",{attrs:{d:"M10.76 1.355l0.984-0.18 0.851 4.651-4.56-1.196 0.254-0.967 3.040 0.796z"}})])},x=[],k=n(6515),S={name:"InlineReplayIcon",components:{SVGIcon:k.A}},_=S,T=(0,g.A)(_,B,x,!1,null,null,null),L=T.exports,P=n(4769),Q=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"pause-icon",attrs:{viewBox:"0 0 14 14",themeId:"pause"}},[t("path",{attrs:{d:"M5 4h1v6h-1z"}}),t("path",{attrs:{d:"M8 4h1v6h-1z"}}),t("path",{attrs:{d:"M7 0.5c-3.6 0-6.5 2.9-6.5 6.5s2.9 6.5 6.5 6.5 6.5-2.9 6.5-6.5-2.9-6.5-6.5-6.5zM7 12.5c-3 0-5.5-2.5-5.5-5.5s2.5-5.5 5.5-5.5 5.5 2.5 5.5 5.5-2.5 5.5-5.5 5.5z"}})])},M=[],D={name:"PauseIcon",components:{SVGIcon:k.A}},O=D,R=(0,g.A)(O,Q,M,!1,null,null,null),N=R.exports,j={name:"ReplayableVideoAsset",components:{PauseIcon:N,PlayIcon:P.A,InlineReplayIcon:L,VideoAsset:I},props:{variants:{type:Array,required:!0},alt:{type:String,required:!1},id:{type:String,required:!0},showsDefaultControls:{type:Boolean,default:()=>!1},autoplays:{type:Boolean,default:()=>!1},muted:{type:Boolean,default:!1},posterVariants:{type:Array,default:()=>[]},deviceFrame:{type:String,required:!1}},computed:{text(){return this.videoEnded?this.$t("video.replay"):this.isPlaying?this.$t("video.pause"):this.$t("video.play")},ariaLabelledByContainer:({id:e,alt:t})=>t?`${e}-custom-controls ${e}-alt`:`${e}-custom-controls`},data(){return{isPlaying:!1,videoEnded:!1}},methods:{async togglePlayStatus(){const e=this.$refs.asset.$refs.video;e&&(this.isPlaying&&!this.videoEnded?await e.pause():await e.play())},onVideoEnd(){this.isPlaying=!1,this.videoEnded=!0},onVideoPlaying(){const{video:e}=this.$refs.asset.$refs;this.isPlaying=!e.paused,this.videoEnded=e.ended},onPause(){const{video:e}=this.$refs.asset.$refs;!this.showsDefaultControls&&this.isPlaying&&(this.isPlaying=!1),this.videoEnded=e.ended}}},V=j,G=(0,g.A)(V,w,E,!1,null,"3fb37a97",null),$=G.exports,z=n(4783);const q={video:"video",image:"image"};var H={name:"Asset",components:{ImageAsset:o.A,VideoAsset:I},constants:{AssetTypes:q},mixins:[z.A],props:{identifier:{type:String,required:!0},showsReplayButton:{type:Boolean,default:()=>!0},showsVideoControls:{type:Boolean,default:()=>!1},videoAutoplays:{type:Boolean,default:()=>!1},videoMuted:{type:Boolean,default:!1},deviceFrame:{type:String,required:!1}},computed:{rawAsset(){return this.references[this.identifier]||{}},isRawAssetVideo:({rawAsset:e})=>e.type===q.video,videoPoster(){return this.isRawAssetVideo&&this.references[this.rawAsset.poster]},asset(){return this.isRawAssetVideo&&this.prefersReducedMotion&&this.videoPoster||this.rawAsset},assetComponent(){switch(this.asset.type){case q.image:return o.A;case q.video:return this.showsReplayButton?$:I;default:return}},prefersReducedMotion(){return window.matchMedia("(prefers-reduced-motion)").matches},assetProps(){return{[q.image]:this.imageProps,[q.video]:this.videoProps}[this.asset.type]},imageProps(){return{alt:this.asset.alt,variants:this.asset.variants}},videoProps(){return{variants:this.asset.variants,showsDefaultControls:this.showsVideoControls,muted:this.videoMuted,autoplays:!this.prefersReducedMotion&&this.videoAutoplays,posterVariants:this.videoPoster?this.videoPoster.variants:[],deviceFrame:this.deviceFrame,alt:this.asset.alt,id:this.identifier}},assetListeners(){return{[q.image]:null,[q.video]:{ended:()=>this.$emit("videoEnded")}}[this.asset.type]}}},F=H,W=(0,g.A)(F,s,a,!1,null,"6ab0b718",null),U=W.exports},8635:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"row",class:{"with-columns":e.columns},style:e.style},[e._t("default")],2)},i=[],s=(n(8111),n(1148),n(2361)),a={name:"Row",props:{columns:{type:Object,required:!1,validator:e=>Object.entries(e).every(([e,t])=>s.FC[e]&&"number"===typeof t)},gap:{type:Number,required:!1}},computed:{style:({columns:e={},gap:t})=>({"--col-count-large":e.large,"--col-count-medium":e.medium,"--col-count-small":e.small||1,"--col-gap":t&&`${t}px`})}},o=a,l=n(1656),c=(0,l.A)(o,r,i,!1,null,"1bcb2d0f",null),u=c.exports},8717:function(e,t,n){"use strict";var r=n(3571);const i="data-original-",s="aria-hidden",a="tabindex";function o(e,t){const n=i+t;if(e.getAttribute(n))return;const r=e.getAttribute(t)||"";e.setAttribute(n,r)}function l(e,t){const n=i+t;if(!e.hasAttribute(n))return;const r=e.getAttribute(n);e.removeAttribute(n),r.length?e.setAttribute(t,r):e.removeAttribute(t)}function c(e,t){const n=document.body;let r=e,i=e;while(r=r.previousElementSibling)t(r);while(i=i.nextElementSibling)t(i);e.parentElement&&e.parentElement!==n&&c(e.parentElement,t)}const u=e=>{o(e,s),o(e,a),e.setAttribute(s,"true"),e.setAttribute(a,"-1");const t=r.Ay.getTabbableElements(e);let n=t.length-1;while(n>=0)o(t[n],a),t[n].setAttribute(a,"-1"),n-=1},A=e=>{l(e,s),l(e,a);const t=e.querySelectorAll(`[${i+a}]`);let n=t.length-1;while(n>=0)l(t[n],a),n-=1};t.A={hide(e){c(e,u)},show(e){c(e,A)}}},9018:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var r=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"technology-icon",attrs:{viewBox:"0 0 14 14",themeId:"technology"}},[t("path",{attrs:{d:"M3.39,9l3.16,1.84.47.28.47-.28L10.61,9l.45.26,1.08.63L7,12.91l-5.16-3,1.08-.64L3.39,9M7,0,0,4.1,2.47,5.55,0,7,2.47,8.44,0,9.9,7,14l7-4.1L11.53,8.45,14,7,11.53,5.56,14,4.1ZM7,7.12,5.87,6.45l-1.54-.9L3.39,5,1.85,4.1,7,1.08l5.17,3L10.6,5l-.93.55-1.54.91ZM7,10,3.39,7.9,1.85,7,3.4,6.09,4.94,7,7,8.2,9.06,7,10.6,6.1,12.15,7l-1.55.9Z"}})])},i=[],s=n(6515),a={name:"TechnologyIcon",components:{SVGIcon:s.A}},o=a,l=n(1656),c=(0,l.A)(o,r,i,!1,null,null,null),u=c.exports},9065:function(e,t,n){"use strict";n.d(t,{A:function(){return I}});var r=function(){var e=this,t=e._self._c;return t("nav",{ref:"nav",staticClass:"nav",class:e.rootClasses,attrs:{role:"navigation"}},[t("div",{ref:"wrapper",staticClass:"nav__wrapper"},[t("div",{staticClass:"nav__background"}),e.hasOverlay?t("div",{staticClass:"nav-overlay",on:{click:e.closeNav}}):e._e(),t("div",{staticClass:"nav-content"},[e._t("pre-title",null,{className:"pre-title"},{closeNav:e.closeNav,inBreakpoint:e.inBreakpoint,currentBreakpoint:e.currentBreakpoint,isOpen:e.isOpen}),e.$slots.default?t("div",{staticClass:"nav-title"},[e._t("default")],2):e._e(),e._t("after-title"),t("div",{staticClass:"nav-menu"},[t("a",{ref:"axToggle",staticClass:"nav-ax-toggle",attrs:{href:"#",role:"button"},on:{click:function(t){return t.preventDefault(),e.toggleNav.apply(null,arguments)}}},[t("span",{staticClass:"visuallyhidden"},[e.isOpen?[e._v(" "+e._s(e.$t("documentation.nav.close-menu"))+" ")]:[e._v(" "+e._s(e.$t("documentation.nav.open-menu"))+" ")]],2)]),t("div",{ref:"tray",staticClass:"nav-menu-tray",on:{transitionend:function(t){return t.target!==t.currentTarget?null:e.onTransitionEnd.apply(null,arguments)},click:e.handleTrayClick}},[e._t("tray",function(){return[t("NavMenuItems",[e._t("menu-items")],2)]},{closeNav:e.closeNav})],2)]),e.showActions?t("div",{staticClass:"nav-actions"},[t("a",{ref:"toggle",staticClass:"nav-menucta",attrs:{href:"#",tabindex:"-1","aria-hidden":"true"},on:{click:function(t){return t.preventDefault(),e.toggleNav.apply(null,arguments)}}},[t("span",{staticClass:"nav-menucta-chevron"})])]):e._e()],2),e._t("after-content")],2),t("BreakpointEmitter",{attrs:{scope:e.BreakpointScopes.nav},on:{change:e.onBreakpointChange}})],1)},i=[],s=n(8284),a=n(4654),o=n(7633),l=n(4610),c=n(9404),u=n(2361),A=n(8717),d=n(3029);const{noClose:p}=c.FK,{BreakpointName:h,BreakpointScopes:g}=o.A.constants,f=8,m={isDark:"theme-dark",isOpen:"nav--is-open",inBreakpoint:"nav--in-breakpoint-range",isTransitioning:"nav--is-transitioning",isSticking:"nav--is-sticking",hasSolidBackground:"nav--solid-background",hasNoBorder:"nav--noborder",hasFullWidthBorder:"nav--fullwidth-border",isWideFormat:"nav--is-wide-format",noBackgroundTransition:"nav--no-bg-transition"};var v={name:"NavBase",components:{NavMenuItems:a.A,BreakpointEmitter:o.A},constants:{NavStateClasses:m,NoBGTransitionFrames:f},props:{breakpoint:{type:String,default:h.small},hasOverlay:{type:Boolean,default:!0},hasSolidBackground:{type:Boolean,default:!1},hasNoBorder:{type:Boolean,default:!1},hasFullWidthBorder:{type:Boolean,default:!1},isDark:{type:Boolean,default:!1},isWideFormat:{type:Boolean,default:!1},showActions:{type:Boolean,default:!0}},mixins:[s.A],data(){return{isOpen:!1,isTransitioning:!1,isSticking:!1,noBackgroundTransition:!0,currentBreakpoint:h.large}},computed:{BreakpointScopes:()=>g,inBreakpoint:({currentBreakpoint:e,breakpoint:t})=>!(0,u.BZ)(e,t),rootClasses:({isOpen:e,inBreakpoint:t,isTransitioning:n,isSticking:r,hasSolidBackground:i,hasNoBorder:s,hasFullWidthBorder:a,isDark:o,isWideFormat:l,noBackgroundTransition:c})=>({[m.isDark]:o,[m.isOpen]:e,[m.inBreakpoint]:t,[m.isTransitioning]:n,[m.isSticking]:r,[m.hasSolidBackground]:i,[m.hasNoBorder]:s,[m.hasFullWidthBorder]:a,[m.isWideFormat]:l,[m.noBackgroundTransition]:c})},watch:{isOpen(e){this.$emit("change",e),e?this.onExpand():this.onClose()}},async mounted(){window.addEventListener("keydown",this.onEscape),window.addEventListener("popstate",this.closeNav),window.addEventListener("orientationchange",this.closeNav),document.addEventListener("click",this.handleClickOutside),this.handleFlashOnMount(),await this.$nextTick()},beforeDestroy(){window.removeEventListener("keydown",this.onEscape),window.removeEventListener("popstate",this.closeNav),window.removeEventListener("orientationchange",this.closeNav),document.removeEventListener("click",this.handleClickOutside),this.isOpen&&this.toggleScrollLock(!1)},methods:{getIntersectionTargets(){return[document.getElementById(c.G3)||this.$el]},toggleNav(){this.isOpen=!this.isOpen,this.isTransitioning=!0},closeNav(){const e=this.isOpen;return this.isOpen=!1,this.resolveOnceTransitionsEnd(e)},resolveOnceTransitionsEnd(e){return e&&this.inBreakpoint?(this.isTransitioning=!0,new Promise(e=>{const t=this.$watch("isTransitioning",()=>{e(),t()})})):Promise.resolve()},async onTransitionEnd({propertyName:e}){"max-height"===e&&(this.$emit("changed",this.isOpen),this.isTransitioning=!1,this.isOpen?(this.$emit("opened"),this.toggleScrollLock(!0)):this.$emit("closed"))},onBreakpointChange(e){this.currentBreakpoint=e,this.inBreakpoint||this.closeNav()},onIntersect({intersectionRatio:e}){window.scrollY<0||(this.isSticking=1!==e)},onEscape({key:e}){"Escape"===e&&this.isOpen&&(this.closeNav(),this.$refs.axToggle.focus())},handleTrayClick({target:e}){e.href&&!e.classList.contains(p)&&this.closeNav()},handleClickOutside({target:e}){this.$refs.nav.contains(e)||this.closeNav()},toggleScrollLock(e){e?l.A.lockScroll(this.$refs.tray):l.A.unlockScroll(this.$refs.tray)},onExpand(){this.$emit("open"),A.A.hide(this.$refs.wrapper),document.activeElement===this.$refs.toggle&&document.activeElement.blur()},onClose(){this.$emit("close"),this.toggleScrollLock(!1),A.A.show(this.$refs.wrapper)},async handleFlashOnMount(){await(0,d.u)(f),this.noBackgroundTransition=!1}}},y=v,b=n(1656),C=(0,b.A)(y,r,i,!1,null,"5ee249d6",null),I=C.exports},9514:function(e,t,n){"use strict";var r=n(3029);t.A={methods:{async scrollToElement(e){await(0,r.u)(8);const t=this.$router.resolve({hash:e}),{selector:n,offset:i}=await this.$router.options.scrollBehavior(t.route),s=document.querySelector(n);return s?(s.scrollIntoView(),window.scrollY+window.innerHeight`${(0,s.Fd)(e.src)} ${e.density}`).join(", "),n=e[0],r={srcSet:t,src:(0,s.Fd)(n.src)},{width:i}=n.size||{width:null};return i&&(r.width=i,r.height="auto"),r}var d={name:"ImageAsset",mixins:[a],inject:{imageLoadingStrategy:{default:null}},data:()=>({appState:o.A.state,fallbackImageSrcSet:null,optimalWidth:null,optimalHeight:null}),computed:{allVariants:({lightVariants:e=[],darkVariants:t=[]})=>e.concat(t),defaultAttributes:({lightVariantAttributes:e,darkVariantAttributes:t})=>e||t,darkVariantAttributes:({darkVariants:e})=>A(e),lightVariantAttributes:({lightVariants:e})=>A(e),loading:({appState:e,imageLoadingStrategy:t})=>t||e.imageLoadingStrategy,preferredColorScheme:({appState:e})=>e.preferredColorScheme,prefersAuto:({preferredColorScheme:e})=>e===l.A.auto,prefersDark:({preferredColorScheme:e})=>e===l.A.dark,orientation:({optimalWidth:e,optimalHeight:t})=>(0,s.vc)(e,t)},props:{alt:{type:String,default:""},variants:{type:Array,required:!0},shouldCalculateOptimalWidth:{type:Boolean,default:!0}},methods:{handleImageLoadError(){this.fallbackImageSrcSet=`${c} 2x`},async calculateOptimalDimensions(){const{$refs:{img:{currentSrc:e}},allVariants:t}=this,{density:n}=t.find(({src:t})=>e.endsWith(t)),r=parseInt(n.match(/\d+/)[0],u),i=await(0,s.Hm)(e),a=i.width/r,o=i.height/r;return{width:a,height:o}},async optimizeImageSize(){if(!this.defaultAttributes.width&&this.$refs.img)try{const e=await this.calculateOptimalDimensions();this.optimalWidth=e.width,this.optimalHeight=e.height}catch{console.error("Unable to calculate optimal image width")}}},mounted(){this.shouldCalculateOptimalWidth&&this.$refs.img.addEventListener("load",this.optimizeImageSize)}},p=d,h=n(1656),g=(0,h.A)(p,r,i,!1,null,null,null),f=g.exports},9787:function(e,t,n){"use strict";n.d(t,{A:function(){return m}});n(8111),n(8237),n(3579),n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698);var r=n(4605);const i=new Set(["section","topic"]);function s(e){const{includedArchiveIdentifiers:t}=r.A.state;return!t.length||t.some(t=>e?.startsWith(`doc://${t}/`))}function a(e={}){return Object.keys(e).reduce((t,n)=>{const r=e[n],{url:a,...o}=r;return i.has(r.type)?{...t,[n]:s(n)?r:o}:{...t,[n]:r}},{})}n(7588);var o=n(5471),l=n(1672);const c=()=>({[l.wi.modified]:0,[l.wi.added]:0,[l.wi.deprecated]:0});var u={state:{apiChanges:null,apiChangesCounts:c(),selectedAPIChangesVersion:null},setAPIChanges(e){this.state.apiChanges=e},setSelectedAPIChangesVersion(e){this.state.selectedAPIChangesVersion=e},resetApiChanges(){this.state.apiChanges=null,this.state.apiChangesCounts=c()},async updateApiChangesCounts(){await o["default"].nextTick(),Object.keys(this.state.apiChangesCounts).forEach(e=>{this.state.apiChangesCounts[e]=this.countChangeType(e)})},countChangeType(e){if(document&&document.querySelectorAll){const t=`.changed-${e}:not(.changed-total)`;return document.querySelectorAll(t).length}return 0}},A=(n(4114),{state:{onThisPageSections:[],currentPageAnchor:null},resetPageSections(){this.state.onThisPageSections=[],this.state.currentPageAnchor=null},addOnThisPageSection(e,{i18n:t=!0}={}){this.state.onThisPageSections.push({...e,i18n:t})},setCurrentPageSection(e){const t=this.state.onThisPageSections.findIndex(({anchor:t})=>t===e);-1!==t&&(this.state.currentPageAnchor=e)}}),d=n(8360);const{state:p,...h}=u,{state:g,...f}=A;var m={state:{preferredLanguage:d.A.preferredLanguage,contentWidth:0,...p,...g,references:{}},reset(){this.state.preferredLanguage=d.A.preferredLanguage,this.state.references={},this.resetApiChanges()},setPreferredLanguage(e){this.state.preferredLanguage=e,d.A.preferredLanguage=this.state.preferredLanguage},setContentWidth(e){this.state.contentWidth=e},setReferences(e){this.state.references=a(e)},updateReferences(){this.setReferences(this.state.references)},...h,...f}}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/981.21016981.js b/Containers/Supporting Files/Help.bundle/js/981.21016981.js new file mode 100644 index 0000000..3394fee --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/981.21016981.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +"use strict";(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[981],{1523:function(e,t,n){n.d(t,{A:function(){return $}});var r=function(){var e=this,t=e._self._c;return e.icon?t("div",{staticClass:"topic-icon-wrapper"},[t(e.icon,{tag:"component",staticClass:"topic-icon"})],1):e._e()},a=[],i=n(1789),s=n(5060),o=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"api-reference-icon",attrs:{viewBox:"0 0 14 14",themeId:"api-reference"}},[t("title",[e._v(e._s(e.$t("api-reference")))]),t("path",{attrs:{d:"m1 1v12h12v-12zm11 11h-10v-10h10z"}}),t("path",{attrs:{d:"m3 4h8v1h-8zm0 2.5h8v1h-8zm0 2.5h8v1h-8z"}}),t("path",{attrs:{d:"m3 4h8v1h-8z"}}),t("path",{attrs:{d:"m3 6.5h8v1h-8z"}}),t("path",{attrs:{d:"m3 9h8v1h-8z"}})])},l=[],c=n(6515),p={name:"APIReferenceIcon",components:{SVGIcon:c.A}},d=p,u=n(1656),f=(0,u.A)(d,o,l,!1,null,null,null),m=f.exports,h=function(){var e=this,t=e._self._c;return t("SVGIcon",{attrs:{viewBox:"0 0 14 14",themeId:"endpoint"}},[t("title",[e._v(e._s(e.$t("icons.web-service-endpoint")))]),t("path",{attrs:{d:"M4.052 8.737h-1.242l-1.878 5.263h1.15l0.364-1.081h1.939l0.339 1.081h1.193zM2.746 12.012l0.678-2.071 0.653 2.071z"}}),t("path",{attrs:{d:"M11.969 8.737h1.093v5.263h-1.093v-5.263z"}}),t("path",{attrs:{d:"M9.198 8.737h-2.295v5.263h1.095v-1.892h1.12c0.040 0.003 0.087 0.004 0.134 0.004 0.455 0 0.875-0.146 1.217-0.394l-0.006 0.004c0.296-0.293 0.48-0.699 0.48-1.148 0-0.060-0.003-0.118-0.010-0.176l0.001 0.007c0.003-0.039 0.005-0.085 0.005-0.131 0-0.442-0.183-0.842-0.476-1.128l-0-0c-0.317-0.256-0.724-0.41-1.168-0.41-0.034 0-0.069 0.001-0.102 0.003l0.005-0zM9.628 11.014c-0.15 0.118-0.341 0.188-0.548 0.188-0.020 0-0.040-0.001-0.060-0.002l0.003 0h-1.026v-1.549h1.026c0.017-0.001 0.037-0.002 0.058-0.002 0.206 0 0.396 0.066 0.551 0.178l-0.003-0.002c0.135 0.13 0.219 0.313 0.219 0.515 0 0.025-0.001 0.050-0.004 0.074l0-0.003c0.002 0.020 0.003 0.044 0.003 0.068 0 0.208-0.083 0.396-0.219 0.534l0-0z"}}),t("path",{attrs:{d:"M13.529 4.981c0-1.375-1.114-2.489-2.489-2.49h-0l-0.134 0.005c-0.526-1.466-1.903-2.496-3.522-2.496-0.892 0-1.711 0.313-2.353 0.835l0.007-0.005c-0.312-0.243-0.709-0.389-1.14-0.389-1.030 0-1.865 0.834-1.866 1.864v0c0 0.001 0 0.003 0 0.004 0 0.123 0.012 0.242 0.036 0.358l-0.002-0.012c-0.94 0.37-1.593 1.27-1.593 2.323 0 1.372 1.11 2.485 2.482 2.49h8.243c1.306-0.084 2.333-1.164 2.333-2.484 0-0.001 0-0.002 0-0.003v0zM11.139 6.535h-8.319c-0.799-0.072-1.421-0.739-1.421-1.551 0-0.659 0.41-1.223 0.988-1.45l0.011-0.004 0.734-0.28-0.148-0.776-0.012-0.082v-0.088c0-0 0-0.001 0-0.001 0-0.515 0.418-0.933 0.933-0.933 0.216 0 0.416 0.074 0.574 0.197l-0.002-0.002 0.584 0.453 0.575-0.467 0.169-0.127c0.442-0.306 0.991-0.489 1.581-0.489 1.211 0 2.243 0.769 2.633 1.846l0.006 0.019 0.226 0.642 0.814-0.023 0.131 0.006c0.805 0.067 1.432 0.736 1.432 1.552 0 0.836-0.659 1.518-1.486 1.556l-0.003 0z"}})])},y=[],g={name:"EndpointIcon",components:{SVGIcon:c.A}},k=g,v=(0,u.A)(k,h,y,!1,null,null,null),b=v.exports,_=n(2187),A=n(9018),C=n(3818),x=n(4468);const B={[x.y.article]:i.A,[x.y.collection]:A.A,[x.y.collectionGroup]:m,[x.y.learn]:_.A,[x.y.overview]:_.A,[x.y.project]:C.A,[x.y.tutorial]:C.A,[x.y.resources]:_.A,[x.y.sampleCode]:s.A,[x.y.restRequestSymbol]:b};var T={components:{SVGIcon:c.A},props:{role:{type:String,required:!0}},computed:{icon:({role:e})=>B[e]}},S=T,I=(0,u.A)(S,r,a,!1,null,"58794252",null),$=I.exports},1890:function(e,t,n){n.d(t,{W:function(){return r}});const r="displays-multiple-lines"},3962:function(e,t,n){function r(e){if(!e)return!1;const t=window.getComputedStyle(e.$el||e),n=(e.$el||e).offsetHeight,r=t.lineHeight?parseFloat(t.lineHeight):1,a=t.paddingTop?parseFloat(t.paddingTop):0,i=t.paddingBottom?parseFloat(t.paddingBottom):0,s=t.borderTopWidth?parseFloat(t.borderTopWidth):0,o=t.borderBottomWidth?parseFloat(t.borderBottomWidth):0,l=n-(a+i+s+o),c=l/r;return c>=2}n.d(t,{n:function(){return r}})},3981:function(e,t,n){n.r(t),n.d(t,{default:function(){return q}});var r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"link-block",class:e.linkBlockClasses},[t(e.linkComponent,e._b({ref:"apiChangesDiff",tag:"component",staticClass:"link",class:e.linkClasses},"component",e.linkProps,!1),[e.topic.role&&!e.change?t("TopicLinkBlockIcon",{attrs:{role:e.topic.role}}):e._e(),e.topic.fragments?t("DecoratedTopicTitle",{attrs:{tokens:e.topic.fragments}}):t("WordBreak",{attrs:{tag:e.titleTag}},[e._v(e._s(e.topic.title))]),e.change?t("span",{staticClass:"visuallyhidden"},[e._v("- "+e._s(e.$t(e.changeName)))]):e._e()],1),e.hasAbstractElements?t("div",{staticClass:"abstract"},[e.topic.abstract?t("ContentNode",{attrs:{content:e.topic.abstract}}):e._e(),e.topic.ideTitle?t("div",{staticClass:"topic-keyinfo"},[e.topic.titleStyle===e.titleStyles.title?[t("strong",[e._v("Key:")]),e._v(" "+e._s(e.topic.name)+" ")]:e.topic.titleStyle===e.titleStyles.symbol?[t("strong",[e._v("Name:")]),e._v(" "+e._s(e.topic.ideTitle)+" ")]:e._e()],2):e._e(),e.topic.required||e.topic.defaultImplementations?t("RequirementMetadata",{staticClass:"topic-required",attrs:{defaultImplementationsCount:e.topic.defaultImplementations}}):e._e()],1):e._e(),e.showDeprecatedBadge?t("Badge",{attrs:{variant:"deprecated"}}):e.showBetaBadge?t("Badge",{attrs:{variant:"beta"}}):e._e(),e._l(e.tags,function(n){return t("Badge",{key:`${n.type}-${n.text}`,attrs:{variant:n.type}},[e._v(" "+e._s(n.text)+" ")])})],2)},a=[],i=(n(8111),n(116),n(4468)),s=n(1074),o=n(4791),l=n(3634),c=n(6096),p=n(1523),d=function(){var e=this,t=e._self._c;return t("code",{staticClass:"decorated-title"},[e._l(e.tokens,function(n,r){return[t(e.componentFor(n),{key:r,tag:"component",class:[e.classFor(n),e.emptyTokenClass(n)]},[e._v(e._s(n.text))]),t("wbr",{key:`wbr-${r}`})]})],2)},u=[],f=n(6188);const{TokenKind:m}=f.A.constants,h={decorator:"decorator",identifier:"identifier",label:"label"};var y={name:"DecoratedTopicTitle",components:{WordBreak:l.A},props:{tokens:{type:Array,required:!0,default:()=>[]}},constants:{TokenKind:m},methods:{emptyTokenClass:({text:e})=>({"empty-token":" "===e}),classFor({kind:e}){switch(e){case m.externalParam:case m.identifier:return h.identifier;case m.label:return h.label;default:return h.decorator}},componentFor(e){return/^\s+$/.test(e.text)?"span":l.A}}},g=y,k=n(1656),v=(0,k.A)(g,d,u,!1,null,"2d744be4",null),b=v.exports,_=n(6392),A=n(8184),C=n(4783);const x={article:"article",symbol:"symbol"},B={title:"title",symbol:"symbol"},T={link:"link"};var S={name:"TopicsLinkBlock",components:{Badge:o.A,WordBreak:l.A,ContentNode:c.A,TopicLinkBlockIcon:p.A,DecoratedTopicTitle:b,RequirementMetadata:_.A},mixins:[A.o8,A.z_,C.A],constants:{ReferenceType:T,TopicKind:x,TitleStyles:B},props:{isSymbolBeta:Boolean,isSymbolDeprecated:Boolean,topic:{type:Object,required:!0,validator:e=>(!("abstract"in e)||Array.isArray(e.abstract))&&"string"===typeof e.identifier&&(e.type===T.link&&!e.kind||"string"===typeof e.kind)&&(e.type===T.link&&!e.role||"string"===typeof e.role)&&"string"===typeof e.title&&"string"===typeof e.url&&(!("defaultImplementations"in e)||"number"===typeof e.defaultImplementations)&&(!("required"in e)||"boolean"===typeof e.required)}},data(){return{state:this.store.state}},computed:{linkComponent:({topic:e})=>e.type===T.link?"a":"router-link",linkProps({topic:e}){const t=(0,s.c$)(e.url,this.$route.query);return e.type===T.link?{href:t}:{to:t}},linkBlockClasses:({changesClasses:e,hasAbstractElements:t,displaysMultipleLinesAfterAPIChanges:n,multipleLinesClass:r})=>({"has-inline-element":!t,[r]:n,...!t&&e}),linkClasses:({changesClasses:e,deprecated:t,hasAbstractElements:n})=>({deprecated:t,"has-adjacent-elements":n,...n&&e}),changesClasses:({getChangesClasses:e,change:t})=>e(t),titleTag({topic:e}){if(e.titleStyle===B.title)return e.ideTitle?"span":"code";if(e.role&&(e.role===i.y.collection||e.role===i.y.dictionarySymbol))return"span";switch(e.kind){case x.symbol:return"code";default:return"span"}},titleStyles:()=>B,deprecated:({showDeprecatedBadge:e,topic:t})=>e||t.deprecated,showBetaBadge:({topic:e,isSymbolBeta:t})=>Boolean(!t&&e.beta),showDeprecatedBadge:({topic:e,isSymbolDeprecated:t})=>Boolean(!t&&e.deprecated),change({topic:{identifier:e},state:{apiChanges:t}}){return this.changeFor(e,t)},changeName:({change:e,getChangeName:t})=>t(e),hasAbstractElements:({topic:{abstract:e,required:t,defaultImplementations:n}}={})=>e&&e.length>0||t||n,tags:({topic:e})=>(e.tags||[]).slice(0,1),iconOverride:({topic:{images:e=[]}})=>{const t=e.find(({type:e})=>"icon"===e);return t?t.identifier:null}}},I=S,$=(0,k.A)(I,r,a,!1,null,"e1f11a1a",null),q=$.exports},4791:function(e,t,n){n.d(t,{A:function(){return p}});var r=function(){var e=this,t=e._self._c;return t("span",{staticClass:"badge",class:{[`badge-${e.variant}`]:e.variant},attrs:{role:"presentation"}},[e._t("default",function(){return[e._v(e._s(e.text?e.$t(e.text):""))]})],2)},a=[];const i={beta:"aside-kind.beta",deprecated:"aside-kind.deprecated"};var s={name:"Badge",props:{variant:{type:String,default:()=>""}},computed:{text:({variant:e})=>i[e]}},o=s,l=n(1656),c=(0,l.A)(o,r,a,!1,null,"ffe39a30",null),p=c.exports},6096:function(e,t,n){n.d(t,{A:function(){return p}});var r=function(){var e=this,t=e._self._c;return t("BaseContentNode",e._b({},"BaseContentNode",e.$props,!1))},a=[],i=n(9),s={name:"ContentNode",components:{BaseContentNode:i["default"]},props:i["default"].props,methods:i["default"].methods,BlockType:i["default"].BlockType,InlineType:i["default"].InlineType},o=s,l=n(1656),c=(0,l.A)(o,r,a,!1,null,"3a32ffd0",null),p=c.exports},6188:function(e,t,n){n.d(t,{A:function(){return M}});var r,a,i,s,o,l,c=n(3634),p=(n(8111),n(1701),{name:"ChangedToken",render(e){const{kind:t,tokens:n}=this;return e("span",{class:[`token-${t}`,"token-changed"]},n.map(t=>e(M,{props:t})))},props:{kind:{type:String,required:!0},tokens:{type:Array,required:!0}}}),d=p,u=n(1656),f=(0,u.A)(d,r,a,!1,null,null,null),m=f.exports,h=n(1754),y=n(4783),g={name:"LinkableToken",mixins:[y.A],render(e){const t=this.references[this.identifier];return t&&t.url?e(h.A,{props:{url:t.url,kind:t.kind,role:t.role}},this.$slots.default):e("span",{},this.$slots.default)},props:{identifier:{type:String,required:!0,default:()=>""}}},k=g,v=(0,u.A)(k,i,s,!1,null,null,null),b=v.exports,_=function(){var e=this,t=e._self._c;return t("span",[e._v(e._s(e.text))])},A=[],C={name:"RawText",props:{text:{type:String,required:!0}}},x=C,B=(0,u.A)(x,_,A,!1,null,null,null),T=B.exports,S={name:"SyntaxToken",render(e){return e("span",{class:`token-${this.kind}`},this.text)},props:{kind:{type:String,required:!0},text:{type:String,required:!0}}},I=S,$=(0,u.A)(I,o,l,!1,null,null,null),q=$.exports;const w={attribute:"attribute",externalParam:"externalParam",genericParameter:"genericParameter",identifier:"identifier",internalParam:"internalParam",keyword:"keyword",label:"label",number:"number",string:"string",text:"text",typeIdentifier:"typeIdentifier",added:"added",removed:"removed"};var z,F,O={name:"DeclarationToken",render:function(e){const{kind:t,text:n,tokens:r}=this;switch(t){case w.text:{const t={text:n};return e(T,{props:t})}case w.typeIdentifier:{const t={identifier:this.identifier};return e(b,{class:"type-identifier-link",props:t},[e(c.A,n)])}case w.attribute:{const{identifier:r}=this;return r?e(b,{class:"attribute-link",props:{identifier:r}},[e(c.A,n)]):e(q,{props:{kind:t,text:n}})}case w.added:case w.removed:return e(m,{props:{tokens:r,kind:t}});default:{const r={kind:t,text:n};return e(q,{props:r})}}},constants:{TokenKind:w},props:{kind:{type:String,required:!0},identifier:{type:String,required:!1},text:{type:String,required:!1},tokens:{type:Array,required:!1,default:()=>[]}}},P=O,D=(0,u.A)(P,z,F,!1,null,"295ad0ff",null),M=D.exports},6392:function(e,t,n){n.d(t,{A:function(){return c}});var r=function(e,t){return e("p",{staticClass:"requirement-metadata",class:t.data.staticClass},[e("strong",[t._v(t._s(t.parent.$t("required")))]),t.props.defaultImplementationsCount?[t._v(" "+t._s(t.parent.$tc("metadata.default-implementation",t.props.defaultImplementationsCount))+" ")]:t._e()],2)},a=[],i={name:"RequirementMetadata",props:{defaultImplementationsCount:{type:Number,default:0}}},s=i,o=n(1656),l=(0,o.A)(s,r,a,!0,null,null,null),c=l.exports},8184:function(e,t,n){n.d(t,{o8:function(){return c},z_:function(){return l}});n(4114),n(8111),n(116),n(1701),n(8237),n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698);var r=n(1672),a=n(1890),i=n(3962);const s="latest_",o={xcode:{value:"xcode",label:"Xcode"},other:{value:"other",label:"Other"}},l={constants:{multipleLinesClass:a.W},data(){return{multipleLinesClass:a.W}},computed:{displaysMultipleLinesAfterAPIChanges:({change:e,changeType:t,$refs:n})=>!(!e&&!t)&&(0,i.n)(n.apiChangesDiff)}},c={methods:{toVersionRange({platform:e,versions:t}){return`${e} ${t[0]} – ${e} ${t[1]}`},toOptionValue:e=>`${s}${e}`,toScope:e=>e.slice(s.length,e.length),getOptionsForDiffAvailability(e={}){return this.getOptionsForDiffAvailabilities([e])},getOptionsForDiffAvailabilities(e=[]){const t=e.reduce((e,t={})=>Object.keys(t).reduce((e,n)=>({...e,[n]:(e[n]||[]).concat(t[n])}),e),{}),n=Object.keys(t),r=n.reduce((e,n)=>{const r=t[n];return{...e,[n]:r.find(e=>e.platform===o.xcode.label)||r[0]}},{}),a=e=>({label:this.toVersionRange(r[e]),value:this.toOptionValue(e),platform:r[e].platform}),{sdk:i,beta:s,minor:l,major:c,...p}=r,d=[].concat(i?a("sdk"):[]).concat(s?a("beta"):[]).concat(l?a("minor"):[]).concat(c?a("major"):[]).concat(Object.keys(p).map(a));return this.splitOptionsPerPlatform(d)},changesClassesFor(e,t){const n=this.changeFor(e,t);return this.getChangesClasses(n)},getChangesClasses:e=>({[`changed changed-${e}`]:!!e}),changeFor(e,t){const{change:n}=(t||{})[e]||{};return n},splitOptionsPerPlatform(e){return e.reduce((e,t)=>{const n=t.platform===o.xcode.label?o.xcode.value:o.other.value;return e[n].push(t),e},{[o.xcode.value]:[],[o.other.value]:[]})},getChangeName(e){return r.Bp[e]}},computed:{availableOptions({diffAvailability:e={},toOptionValue:t}){return new Set(Object.keys(e).map(t))}}}}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/chunk-vendors.88e02fc3.js b/Containers/Supporting Files/Help.bundle/js/chunk-vendors.88e02fc3.js new file mode 100644 index 0000000..e0c14b1 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/chunk-vendors.88e02fc3.js @@ -0,0 +1,21 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[504],{34:function(t,e,n){"use strict";var r=n(4901);t.exports=function(t){return"object"==typeof t?null!==t:r(t)}},81:function(t,e,n){"use strict";var r=n(9565),o=n(9306),i=n(8551),a=n(6823),s=n(851),u=TypeError;t.exports=function(t,e){var n=arguments.length<2?s(t):e;if(o(n))return i(r(n,t));throw new u(a(t)+" is not iterable")}},116:function(t,e,n){"use strict";var r=n(6518),o=n(9565),i=n(2652),a=n(9306),s=n(8551),u=n(1767),c=n(9539),f=n(4549),l=f("find",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:l},{find:function(t){s(this);try{a(t)}catch(r){c(this,"throw",r)}if(l)return o(l,this,t);var e=u(this),n=0;return i(e,function(e,r){if(t(e,n++))return r(e)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})},173:function(t,e,n){"use strict";function r(t,e){for(var n in e)t[n]=e[n];return t}n.d(e,{Ay:function(){return xe}});var o=/[!'()*]/g,i=function(t){return"%"+t.charCodeAt(0).toString(16)},a=/%2C/g,s=function(t){return encodeURIComponent(t).replace(o,i).replace(a,",")};function u(t){try{return decodeURIComponent(t)}catch(e){0}return t}function c(t,e,n){void 0===e&&(e={});var r,o=n||l;try{r=o(t||"")}catch(s){r={}}for(var i in e){var a=e[i];r[i]=Array.isArray(a)?a.map(f):f(a)}return r}var f=function(t){return null==t||"object"===typeof t?t:String(t)};function l(t){var e={};return t=t.trim().replace(/^(\?|#|&)/,""),t?(t.split("&").forEach(function(t){var n=t.replace(/\+/g," ").split("="),r=u(n.shift()),o=n.length>0?u(n.join("=")):null;void 0===e[r]?e[r]=o:Array.isArray(e[r])?e[r].push(o):e[r]=[e[r],o]}),e):e}function p(t){var e=t?Object.keys(t).map(function(e){var n=t[e];if(void 0===n)return"";if(null===n)return s(e);if(Array.isArray(n)){var r=[];return n.forEach(function(t){void 0!==t&&(null===t?r.push(s(e)):r.push(s(e)+"="+s(t)))}),r.join("&")}return s(e)+"="+s(n)}).filter(function(t){return t.length>0}).join("&"):null;return e?"?"+e:""}var h=/\/?$/;function d(t,e,n,r){var o=r&&r.options.stringifyQuery,i=e.query||{};try{i=v(i)}catch(s){}var a={name:e.name||t&&t.name,meta:t&&t.meta||{},path:e.path||"/",hash:e.hash||"",query:i,params:e.params||{},fullPath:g(e,o),matched:t?y(t):[]};return n&&(a.redirectedFrom=g(n,o)),Object.freeze(a)}function v(t){if(Array.isArray(t))return t.map(v);if(t&&"object"===typeof t){var e={};for(var n in t)e[n]=v(t[n]);return e}return t}var m=d(null,{path:"/"});function y(t){var e=[];while(t)e.unshift(t),t=t.parent;return e}function g(t,e){var n=t.path,r=t.query;void 0===r&&(r={});var o=t.hash;void 0===o&&(o="");var i=e||p;return(n||"/")+i(r)+o}function _(t,e,n){return e===m?t===e:!!e&&(t.path&&e.path?t.path.replace(h,"")===e.path.replace(h,"")&&(n||t.hash===e.hash&&b(t.query,e.query)):!(!t.name||!e.name)&&(t.name===e.name&&(n||t.hash===e.hash&&b(t.query,e.query)&&b(t.params,e.params))))}function b(t,e){if(void 0===t&&(t={}),void 0===e&&(e={}),!t||!e)return t===e;var n=Object.keys(t).sort(),r=Object.keys(e).sort();return n.length===r.length&&n.every(function(n,o){var i=t[n],a=r[o];if(a!==n)return!1;var s=e[n];return null==i||null==s?i===s:"object"===typeof i&&"object"===typeof s?b(i,s):String(i)===String(s)})}function w(t,e){return 0===t.path.replace(h,"/").indexOf(e.path.replace(h,"/"))&&(!e.hash||t.hash===e.hash)&&x(t.query,e.query)}function x(t,e){for(var n in e)if(!(n in t))return!1;return!0}function k(t){for(var e=0;e=0&&(e=t.slice(r),t=t.slice(0,r));var o=t.indexOf("?");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{path:t,query:n,hash:e}}function E(t){return t.replace(/\/(?:\s*\/)+/g,"/")}var j=Array.isArray||function(t){return"[object Array]"==Object.prototype.toString.call(t)},I=X,A=M,F=L,R=z,P=K,D=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function M(t,e){var n,r=[],o=0,i=0,a="",s=e&&e.delimiter||"/";while(null!=(n=D.exec(t))){var u=n[0],c=n[1],f=n.index;if(a+=t.slice(i,f),i=f+u.length,c)a+=c[1];else{var l=t[i],p=n[2],h=n[3],d=n[4],v=n[5],m=n[6],y=n[7];a&&(r.push(a),a="");var g=null!=p&&null!=l&&l!==p,_="+"===m||"*"===m,b="?"===m||"*"===m,w=n[2]||s,x=d||v;r.push({name:h||o++,prefix:p||"",delimiter:w,optional:b,repeat:_,partial:g,asterisk:!!y,pattern:x?V(x):y?".*":"[^"+B(w)+"]+?"})}}return i1||!C.length)return 0===C.length?t():t("span",{},C)}if("a"===this.tag)k.on=x,k.attrs={href:u,"aria-current":g};else{var O=at(this.$slots.default);if(O){O.isStatic=!1;var S=O.data=r({},O.data);for(var $ in S.on=S.on||{},S.on){var T=S.on[$];$ in x&&(S.on[$]=Array.isArray(T)?T:[T])}for(var E in x)E in S.on?S.on[E].push(x[E]):S.on[E]=b;var j=O.data.attrs=r({},O.data.attrs);j.href=u,j["aria-current"]=g}else k.on=x}return t(this.tag,k,this.$slots.default)}};function it(t){if(!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)&&!t.defaultPrevented&&(void 0===t.button||0===t.button)){if(t.currentTarget&&t.currentTarget.getAttribute){var e=t.currentTarget.getAttribute("target");if(/\b_blank\b/i.test(e))return}return t.preventDefault&&t.preventDefault(),!0}}function at(t){if(t)for(var e,n=0;n-1&&(s.params[l]=n.params[l]);return s.path=Z(c.path,s.params,'named route "'+u+'"'),p(c,s,a)}if(s.path){s.params={};for(var h=0;h-1}function qt(t,e){return Wt(t)&&t._isRouter&&(null==e||t.type===e)}function Gt(t,e,n){var r=function(o){o>=t.length?n():t[o]?e(t[o],function(){r(o+1)}):r(o+1)};r(0)}function Jt(t){return function(e,n,r){var o=!1,i=0,a=null;Kt(t,function(t,e,n,s){if("function"===typeof t&&void 0===t.cid){o=!0,i++;var u,c=Qt(function(e){Zt(e)&&(e=e.default),t.resolved="function"===typeof e?e:tt.extend(e),n.components[s]=e,i--,i<=0&&r()}),f=Qt(function(t){var e="Failed to resolve async component "+s+": "+t;a||(a=Wt(t)?t:new Error(e),r(a))});try{u=t(c,f)}catch(p){f(p)}if(u)if("function"===typeof u.then)u.then(c,f);else{var l=u.component;l&&"function"===typeof l.then&&l.then(c,f)}}}),o||r()}}function Kt(t,e){return Xt(t.map(function(t){return Object.keys(t.components).map(function(n){return e(t.components[n],t.instances[n],t,n)})}))}function Xt(t){return Array.prototype.concat.apply([],t)}var Yt="function"===typeof Symbol&&"symbol"===typeof Symbol.toStringTag;function Zt(t){return t.__esModule||Yt&&"Module"===t[Symbol.toStringTag]}function Qt(t){var e=!1;return function(){var n=[],r=arguments.length;while(r--)n[r]=arguments[r];if(!e)return e=!0,t.apply(this,n)}}var te=function(t,e){this.router=t,this.base=ee(e),this.current=m,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[],this.listeners=[]};function ee(t){if(!t)if(ut){var e=document.querySelector("base");t=e&&e.getAttribute("href")||"/",t=t.replace(/^https?:\/\/[^\/]+/,"")}else t="/";return"/"!==t.charAt(0)&&(t="/"+t),t.replace(/\/$/,"")}function ne(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n0)){var e=this.router,n=e.options.scrollBehavior,r=Rt&&n;r&&this.listeners.push(xt());var o=function(){var n=t.current,o=le(t.base);t.current===m&&o===t._startLocation||t.transitionTo(o,function(t){r&&kt(e,t,n,!0)})};window.addEventListener("popstate",o),this.listeners.push(function(){window.removeEventListener("popstate",o)})}},e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var r=this,o=this,i=o.current;this.transitionTo(t,function(t){Pt(E(r.base+t.fullPath)),kt(r.router,t,i,!1),e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this,o=this,i=o.current;this.transitionTo(t,function(t){Dt(E(r.base+t.fullPath)),kt(r.router,t,i,!1),e&&e(t)},n)},e.prototype.ensureURL=function(t){if(le(this.base)!==this.current.fullPath){var e=E(this.base+this.current.fullPath);t?Pt(e):Dt(e)}},e.prototype.getCurrentLocation=function(){return le(this.base)},e}(te);function le(t){var e=window.location.pathname,n=e.toLowerCase(),r=t.toLowerCase();return!t||n!==r&&0!==n.indexOf(E(r+"/"))||(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}var pe=function(t){function e(e,n,r){t.call(this,e,n),r&&he(this.base)||de()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;if(!(this.listeners.length>0)){var e=this.router,n=e.options.scrollBehavior,r=Rt&&n;r&&this.listeners.push(xt());var o=function(){var e=t.current;de()&&t.transitionTo(ve(),function(n){r&&kt(t.router,n,e,!0),Rt||ge(n.fullPath)})},i=Rt?"popstate":"hashchange";window.addEventListener(i,o),this.listeners.push(function(){window.removeEventListener(i,o)})}},e.prototype.push=function(t,e,n){var r=this,o=this,i=o.current;this.transitionTo(t,function(t){ye(t.fullPath),kt(r.router,t,i,!1),e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this,o=this,i=o.current;this.transitionTo(t,function(t){ge(t.fullPath),kt(r.router,t,i,!1),e&&e(t)},n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;ve()!==e&&(t?ye(e):ge(e))},e.prototype.getCurrentLocation=function(){return ve()},e}(te);function he(t){var e=le(t);if(!/^\/#/.test(e))return window.location.replace(E(t+"/#"+e)),!0}function de(){var t=ve();return"/"===t.charAt(0)||(ge("/"+t),!1)}function ve(){var t=window.location.href,e=t.indexOf("#");return e<0?"":(t=t.slice(e+1),t)}function me(t){var e=window.location.href,n=e.indexOf("#"),r=n>=0?e.slice(0,n):e;return r+"#"+t}function ye(t){Rt?Pt(me(t)):window.location.hash=t}function ge(t){Rt?Dt(me(t)):window.location.replace(me(t))}var _e=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index+1).concat(t),r.index++,e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index).concat(t),e&&e(t)},n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,function(){var t=e.current;e.index=n,e.updateRoute(r),e.router.afterHooks.forEach(function(e){e&&e(r,t)})},function(t){qt(t,Mt.duplicated)&&(e.index=n)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(te),be=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=ht(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!Rt&&!1!==t.fallback,this.fallback&&(e="hash"),ut||(e="abstract"),this.mode=e,e){case"history":this.history=new fe(this,t.base);break;case"hash":this.history=new pe(this,t.base,this.fallback);break;case"abstract":this.history=new _e(this,t.base);break;default:0}},we={currentRoute:{configurable:!0}};be.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},we.currentRoute.get=function(){return this.history&&this.history.current},be.prototype.init=function(t){var e=this;if(this.apps.push(t),t.$once("hook:destroyed",function(){var n=e.apps.indexOf(t);n>-1&&e.apps.splice(n,1),e.app===t&&(e.app=e.apps[0]||null),e.app||e.history.teardown()}),!this.app){this.app=t;var n=this.history;if(n instanceof fe||n instanceof pe){var r=function(t){var r=n.current,o=e.options.scrollBehavior,i=Rt&&o;i&&"fullPath"in t&&kt(e,t,r,!1)},o=function(t){n.setupListeners(),r(t)};n.transitionTo(n.getCurrentLocation(),o,o)}n.listen(function(t){e.apps.forEach(function(e){e._route=t})})}},be.prototype.beforeEach=function(t){return ke(this.beforeHooks,t)},be.prototype.beforeResolve=function(t){return ke(this.resolveHooks,t)},be.prototype.afterEach=function(t){return ke(this.afterHooks,t)},be.prototype.onReady=function(t,e){this.history.onReady(t,e)},be.prototype.onError=function(t){this.history.onError(t)},be.prototype.push=function(t,e,n){var r=this;if(!e&&!n&&"undefined"!==typeof Promise)return new Promise(function(e,n){r.history.push(t,e,n)});this.history.push(t,e,n)},be.prototype.replace=function(t,e,n){var r=this;if(!e&&!n&&"undefined"!==typeof Promise)return new Promise(function(e,n){r.history.replace(t,e,n)});this.history.replace(t,e,n)},be.prototype.go=function(t){this.history.go(t)},be.prototype.back=function(){this.go(-1)},be.prototype.forward=function(){this.go(1)},be.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},be.prototype.resolve=function(t,e,n){e=e||this.history.current;var r=Q(t,e,n,this),o=this.match(r,e),i=o.redirectedFrom||o.fullPath,a=this.history.base,s=Ce(a,i,this.mode);return{location:r,route:o,href:s,normalizedTo:r,resolved:o}},be.prototype.getRoutes=function(){return this.matcher.getRoutes()},be.prototype.addRoute=function(t,e){this.matcher.addRoute(t,e),this.history.current!==m&&this.history.transitionTo(this.history.getCurrentLocation())},be.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==m&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(be.prototype,we);var xe=be;function ke(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}function Ce(t,e,n){var r="hash"===n?"#"+e:e;return t?E(t+"/"+r):r}be.install=st,be.version="3.6.5",be.isNavigationFailure=qt,be.NavigationFailureType=Mt,be.START_LOCATION=m,ut&&window.Vue&&window.Vue.use(be)},283:function(t,e,n){"use strict";var r=n(9504),o=n(9039),i=n(4901),a=n(9297),s=n(3724),u=n(350).CONFIGURABLE,c=n(3706),f=n(1181),l=f.enforce,p=f.get,h=String,d=Object.defineProperty,v=r("".slice),m=r("".replace),y=r([].join),g=s&&!o(function(){return 8!==d(function(){},"length",{value:8}).length}),_=String(String).split("String"),b=t.exports=function(t,e,n){"Symbol("===v(h(e),0,7)&&(e="["+m(h(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!a(t,"name")||u&&t.name!==e)&&(s?d(t,"name",{value:e,configurable:!0}):t.name=e),g&&n&&a(n,"arity")&&t.length!==n.arity&&d(t,"length",{value:n.arity});try{n&&a(n,"constructor")&&n.constructor?s&&d(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(o){}var r=l(t);return a(r,"source")||(r.source=y(_,"string"==typeof e?e:"")),t};Function.prototype.toString=b(function(){return i(this)&&p(this).source||c(this)},"toString")},350:function(t,e,n){"use strict";var r=n(3724),o=n(9297),i=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,s=o(i,"name"),u=s&&"something"===function(){}.name,c=s&&(!r||r&&a(i,"name").configurable);t.exports={EXISTS:s,PROPER:u,CONFIGURABLE:c}},397:function(t,e,n){"use strict";var r=n(7751);t.exports=r("document","documentElement")},421:function(t){"use strict";t.exports={}},507:function(t,e,n){"use strict";var r=n(9565);t.exports=function(t,e,n){var o,i,a=n?t:t.iterator,s=t.next;while(!(o=r(s,a)).done)if(i=e(o.value),void 0!==i)return i}},616:function(t,e,n){"use strict";var r=n(9039);t.exports=!r(function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},655:function(t,e,n){"use strict";var r=n(6955),o=String;t.exports=function(t){if("Symbol"===r(t))throw new TypeError("Cannot convert a Symbol value to a string");return o(t)}},679:function(t,e,n){"use strict";var r=n(1625),o=TypeError;t.exports=function(t,e){if(r(e,t))return t;throw new o("Incorrect invocation")}},684:function(t){"use strict";t.exports=function(t,e){var n="function"==typeof Iterator&&Iterator.prototype[t];if(n)try{n.call({next:null},e).next()}catch(r){return!0}}},741:function(t){"use strict";var e=Math.ceil,n=Math.floor;t.exports=Math.trunc||function(t){var r=+t;return(r>0?n:e)(r)}},757:function(t,e,n){"use strict";var r=n(7751),o=n(4901),i=n(1625),a=n(7040),s=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return o(e)&&i(e.prototype,s(t))}},851:function(t,e,n){"use strict";var r=n(6955),o=n(5966),i=n(4117),a=n(6269),s=n(8227),u=s("iterator");t.exports=function(t){if(!i(t))return o(t,u)||o(t,"@@iterator")||a[r(t)]}},1072:function(t,e,n){"use strict";var r=n(1828),o=n(8727);t.exports=Object.keys||function(t){return r(t,o)}},1181:function(t,e,n){"use strict";var r,o,i,a=n(8622),s=n(4576),u=n(34),c=n(6699),f=n(9297),l=n(7629),p=n(6119),h=n(421),d="Object already initialized",v=s.TypeError,m=s.WeakMap,y=function(t){return i(t)?o(t):r(t,{})},g=function(t){return function(e){var n;if(!u(e)||(n=o(e)).type!==t)throw new v("Incompatible receiver, "+t+" required");return n}};if(a||l.state){var _=l.state||(l.state=new m);_.get=_.get,_.has=_.has,_.set=_.set,r=function(t,e){if(_.has(t))throw new v(d);return e.facade=t,_.set(t,e),e},o=function(t){return _.get(t)||{}},i=function(t){return _.has(t)}}else{var b=p("state");h[b]=!0,r=function(t,e){if(f(t,b))throw new v(d);return e.facade=t,c(t,b,e),e},o=function(t){return f(t,b)?t[b]:{}},i=function(t){return f(t,b)}}t.exports={set:r,get:o,has:i,enforce:y,getterFor:g}},1291:function(t,e,n){"use strict";var r=n(741);t.exports=function(t){var e=+t;return e!==e||0===e?0:r(e)}},1385:function(t,e,n){"use strict";var r=n(9539);t.exports=function(t,e,n){for(var o=t.length-1;o>=0;o--)if(void 0!==t[o])try{n=r(t[o].iterator,e,n)}catch(i){e="throw",n=i}if("throw"===e)throw n;return n}},1625:function(t,e,n){"use strict";var r=n(9504);t.exports=r({}.isPrototypeOf)},1656:function(t,e,n){"use strict";function r(t,e,n,r,o,i,a,s){var u,c="function"===typeof t?t.options:t;if(e&&(c.render=e,c.staticRenderFns=n,c._compiled=!0),r&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),a?(u=function(t){t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,t||"undefined"===typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),o&&o.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},c._ssrRegister=u):o&&(u=s?function(){o.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:o),u)if(c.functional){c._injectStyles=u;var f=c.render;c.render=function(t,e){return u.call(e),f(t,e)}}else{var l=c.beforeCreate;c.beforeCreate=l?[].concat(l,u):[u]}return{exports:t,options:c}}n.d(e,{A:function(){return r}})},1698:function(t,e,n){"use strict";var r=n(6518),o=n(4204),i=n(9835),a=n(4916),s=!a("union")||!i("union");r({target:"Set",proto:!0,real:!0,forced:s},{union:o})},1701:function(t,e,n){"use strict";var r=n(6518),o=n(9565),i=n(9306),a=n(8551),s=n(1767),u=n(9462),c=n(6319),f=n(9539),l=n(684),p=n(4549),h=n(6395),d=!h&&!l("map",function(){}),v=!h&&!d&&p("map",TypeError),m=h||d||v,y=u(function(){var t=this.iterator,e=a(o(this.next,t)),n=this.done=!!e.done;if(!n)return c(t,this.mapper,[e.value,this.counter++],!0)});r({target:"Iterator",proto:!0,real:!0,forced:m},{map:function(t){a(this);try{i(t)}catch(e){f(this,"throw",e)}return v?o(v,this,t):new y(s(this),{mapper:t})}})},1767:function(t){"use strict";t.exports=function(t){return{iterator:t,next:t.next,done:!1}}},1828:function(t,e,n){"use strict";var r=n(9504),o=n(9297),i=n(5397),a=n(9617).indexOf,s=n(421),u=r([].push);t.exports=function(t,e){var n,r=i(t),c=0,f=[];for(n in r)!o(s,n)&&o(r,n)&&u(f,n);while(e.length>c)o(r,n=e[c++])&&(~a(f,n)||u(f,n));return f}},2106:function(t,e,n){"use strict";var r=n(283),o=n(4913);t.exports=function(t,e,n){return n.get&&r(n.get,e,{getter:!0}),n.set&&r(n.set,e,{setter:!0}),o.f(t,e,n)}},2140:function(t,e,n){"use strict";var r=n(8227),o=r("toStringTag"),i={};i[o]="z",t.exports="[object z]"===String(i)},2195:function(t,e,n){"use strict";var r=n(9504),o=r({}.toString),i=r("".slice);t.exports=function(t){return i(o(t),8,-1)}},2205:function(t,e,n){(function(e,n){t.exports=n(e)})("undefined"!=typeof n.g?n.g:this,function(t){if(t.CSS&&t.CSS.escape)return t.CSS.escape;var e=function(t){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");var e,n=String(t),r=n.length,o=-1,i="",a=n.charCodeAt(0);while(++o=1&&e<=31||127==e||0==o&&e>=48&&e<=57||1==o&&e>=48&&e<=57&&45==a?"\\"+e.toString(16)+" ":(0!=o||1!=r||45!=e)&&(e>=128||45==e||95==e||e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122)?n.charAt(o):"\\"+n.charAt(o):"�";return i};return t.CSS||(t.CSS={}),t.CSS.escape=e,e})},2211:function(t,e,n){"use strict";var r=n(9039);t.exports=!r(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})},2360:function(t,e,n){"use strict";var r,o=n(8551),i=n(6801),a=n(8727),s=n(421),u=n(397),c=n(4055),f=n(6119),l=">",p="<",h="prototype",d="script",v=f("IE_PROTO"),m=function(){},y=function(t){return p+d+l+t+p+"/"+d+l},g=function(t){t.write(y("")),t.close();var e=t.parentWindow.Object;return t=null,e},_=function(){var t,e=c("iframe"),n="java"+d+":";return e.style.display="none",u.appendChild(e),e.src=String(n),t=e.contentWindow.document,t.open(),t.write(y("document.F=Object")),t.close(),t.F},b=function(){try{r=new ActiveXObject("htmlfile")}catch(e){}b="undefined"!=typeof document?document.domain&&r?g(r):_():g(r);var t=a.length;while(t--)delete b[h][a[t]];return b()};s[v]=!0,t.exports=Object.create||function(t,e){var n;return null!==t?(m[h]=o(t),n=new m,m[h]=null,n[v]=t):n=b(),void 0===e?n:i.f(n,e)}},2475:function(t,e,n){"use strict";var r=n(6518),o=n(8527),i=n(4916),a=!i("isSupersetOf",function(t){return!t});r({target:"Set",proto:!0,real:!0,forced:a},{isSupersetOf:o})},2489:function(t,e,n){"use strict";var r=n(6518),o=n(9565),i=n(9306),a=n(8551),s=n(1767),u=n(9462),c=n(6319),f=n(6395),l=n(9539),p=n(684),h=n(4549),d=!f&&!p("filter",function(){}),v=!f&&!d&&h("filter",TypeError),m=f||d||v,y=u(function(){var t,e,n,r=this.iterator,i=this.predicate,s=this.next;while(1){if(t=a(o(s,r)),e=this.done=!!t.done,e)return;if(n=t.value,c(r,i,[n,this.counter++],!0))return n}});r({target:"Iterator",proto:!0,real:!0,forced:m},{filter:function(t){a(this);try{i(t)}catch(e){l(this,"throw",e)}return v?o(v,this,t):new y(s(this),{predicate:t})}})},2529:function(t){"use strict";t.exports=function(t,e){return{value:t,done:e}}},2652:function(t,e,n){"use strict";var r=n(6080),o=n(9565),i=n(8551),a=n(6823),s=n(4209),u=n(6198),c=n(1625),f=n(81),l=n(851),p=n(9539),h=TypeError,d=function(t,e){this.stopped=t,this.result=e},v=d.prototype;t.exports=function(t,e,n){var m,y,g,_,b,w,x,k=n&&n.that,C=!(!n||!n.AS_ENTRIES),O=!(!n||!n.IS_RECORD),S=!(!n||!n.IS_ITERATOR),$=!(!n||!n.INTERRUPTED),T=r(e,k),E=function(t){return m&&p(m,"normal"),new d(!0,t)},j=function(t){return C?(i(t),$?T(t[0],t[1],E):T(t[0],t[1])):$?T(t,E):T(t)};if(O)m=t.iterator;else if(S)m=t;else{if(y=l(t),!y)throw new h(a(t)+" is not iterable");if(s(y)){for(g=0,_=u(t);_>g;g++)if(b=j(t[g]),b&&c(v,b))return b;return new d(!1)}m=f(t,y)}w=O?t.next:m.next;while(!(x=o(w,m)).done){try{b=j(x.value)}catch(I){p(m,"throw",I)}if("object"==typeof b&&b&&c(v,b))return b}return new d(!1)}},2777:function(t,e,n){"use strict";var r=n(9565),o=n(34),i=n(757),a=n(5966),s=n(4270),u=n(8227),c=TypeError,f=u("toPrimitive");t.exports=function(t,e){if(!o(t)||i(t))return t;var n,u=a(t,f);if(u){if(void 0===e&&(e="default"),n=r(u,t,e),!o(n)||i(n))return n;throw new c("Can't convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},2787:function(t,e,n){"use strict";var r=n(9297),o=n(4901),i=n(8981),a=n(6119),s=n(2211),u=a("IE_PROTO"),c=Object,f=c.prototype;t.exports=s?c.getPrototypeOf:function(t){var e=i(t);if(r(e,u))return e[u];var n=e.constructor;return o(n)&&e instanceof n?n.prototype:e instanceof c?f:null}},2796:function(t,e,n){"use strict";var r=n(9039),o=n(4901),i=/#|\.prototype\./,a=function(t,e){var n=u[s(t)];return n===f||n!==c&&(o(e)?r(e):!!e)},s=a.normalize=function(t){return String(t).replace(i,".").toLowerCase()},u=a.data={},c=a.NATIVE="N",f=a.POLYFILL="P";t.exports=a},2812:function(t){"use strict";var e=TypeError;t.exports=function(t,n){if(tn.size)&&!1!==i(e,function(t){if(!n.includes(t))return!1},!0)}},3853:function(t,e,n){"use strict";var r=n(6518),o=n(4449),i=n(4916),a=!i("isDisjointFrom",function(t){return!t});r({target:"Set",proto:!0,real:!0,forced:a},{isDisjointFrom:o})},4055:function(t,e,n){"use strict";var r=n(4576),o=n(34),i=r.document,a=o(i)&&o(i.createElement);t.exports=function(t){return a?i.createElement(t):{}}},4114:function(t,e,n){"use strict";var r=n(6518),o=n(8981),i=n(6198),a=n(4527),s=n(6837),u=n(9039),c=u(function(){return 4294967297!==[].push.call({length:4294967296},1)}),f=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}},l=c||!f();r({target:"Array",proto:!0,arity:1,forced:l},{push:function(t){var e=o(this),n=i(e),r=arguments.length;s(n+r);for(var u=0;u/g,">").replace(/"/g,""").replace(/'/g,"'")}function O(t){return null!=t&&Object.keys(t).forEach(function(e){"string"==typeof t[e]&&(t[e]=C(t[e]))}),t}function S(t){t.prototype.hasOwnProperty("$i18n")||Object.defineProperty(t.prototype,"$i18n",{get:function(){return this._i18n}}),t.prototype.$t=function(t){var e=[],n=arguments.length-1;while(n-- >0)e[n]=arguments[n+1];var r=this.$i18n;return r._t.apply(r,[t,r.locale,r._getMessages(),this].concat(e))},t.prototype.$tc=function(t,e){var n=[],r=arguments.length-2;while(r-- >0)n[r]=arguments[r+2];var o=this.$i18n;return o._tc.apply(o,[t,o.locale,o._getMessages(),this,e].concat(n))},t.prototype.$te=function(t,e){var n=this.$i18n;return n._te(t,n.locale,n._getMessages(),e)},t.prototype.$d=function(t){var e,n=[],r=arguments.length-1;while(r-- >0)n[r]=arguments[r+1];return(e=this.$i18n).d.apply(e,[t].concat(n))},t.prototype.$n=function(t){var e,n=[],r=arguments.length-1;while(r-- >0)n[r]=arguments[r+1];return(e=this.$i18n).n.apply(e,[t].concat(n))}}function $(t){function e(){this!==this.$root&&this.$options.__INTLIFY_META__&&this.$el&&this.$el.setAttribute("data-intlify",this.$options.__INTLIFY_META__)}return void 0===t&&(t=!1),t?{mounted:e}:{beforeCreate:function(){var t=this.$options;if(t.i18n=t.i18n||(t.__i18nBridge||t.__i18n?{}:null),t.i18n)if(t.i18n instanceof Ot){if(t.__i18nBridge||t.__i18n)try{var e=t.i18n&&t.i18n.messages?t.i18n.messages:{},n=t.__i18nBridge||t.__i18n;n.forEach(function(t){e=x(e,JSON.parse(t))}),Object.keys(e).forEach(function(n){t.i18n.mergeLocaleMessage(n,e[n])})}catch(u){0}this._i18n=t.i18n,this._i18nWatcher=this._i18n.watchI18nData()}else if(p(t.i18n)){var r=this.$root&&this.$root.$i18n&&this.$root.$i18n instanceof Ot?this.$root.$i18n:null;if(r&&(t.i18n.root=this.$root,t.i18n.formatter=r.formatter,t.i18n.fallbackLocale=r.fallbackLocale,t.i18n.formatFallbackMessages=r.formatFallbackMessages,t.i18n.silentTranslationWarn=r.silentTranslationWarn,t.i18n.silentFallbackWarn=r.silentFallbackWarn,t.i18n.pluralizationRules=r.pluralizationRules,t.i18n.preserveDirectiveContent=r.preserveDirectiveContent),t.__i18nBridge||t.__i18n)try{var o=t.i18n&&t.i18n.messages?t.i18n.messages:{},i=t.__i18nBridge||t.__i18n;i.forEach(function(t){o=x(o,JSON.parse(t))}),t.i18n.messages=o}catch(u){0}var a=t.i18n,s=a.sharedMessages;s&&p(s)&&(t.i18n.messages=x(t.i18n.messages,s)),this._i18n=new Ot(t.i18n),this._i18nWatcher=this._i18n.watchI18nData(),(void 0===t.i18n.sync||t.i18n.sync)&&(this._localeWatcher=this.$i18n.watchLocale()),r&&r.onComponentInstanceCreated(this._i18n)}else 0;else this.$root&&this.$root.$i18n&&this.$root.$i18n instanceof Ot?this._i18n=this.$root.$i18n:t.parent&&t.parent.$i18n&&t.parent.$i18n instanceof Ot&&(this._i18n=t.parent.$i18n)},beforeMount:function(){var t=this.$options;t.i18n=t.i18n||(t.__i18nBridge||t.__i18n?{}:null),t.i18n?(t.i18n instanceof Ot||p(t.i18n))&&(this._i18n.subscribeDataChanging(this),this._subscribing=!0):(this.$root&&this.$root.$i18n&&this.$root.$i18n instanceof Ot||t.parent&&t.parent.$i18n&&t.parent.$i18n instanceof Ot)&&(this._i18n.subscribeDataChanging(this),this._subscribing=!0)},mounted:e,beforeDestroy:function(){if(this._i18n){var t=this;this.$nextTick(function(){t._subscribing&&(t._i18n.unsubscribeDataChanging(t),delete t._subscribing),t._i18nWatcher&&(t._i18nWatcher(),t._i18n.destroyVM(),delete t._i18nWatcher),t._localeWatcher&&(t._localeWatcher(),delete t._localeWatcher)})}}}}var T={name:"i18n",functional:!0,props:{tag:{type:[String,Boolean,Object],default:"span"},path:{type:String,required:!0},locale:{type:String},places:{type:[Array,Object]}},render:function(t,e){var n=e.data,r=e.parent,o=e.props,i=e.slots,a=r.$i18n;if(a){var s=o.path,u=o.locale,c=o.places,f=i(),l=a.i(s,u,E(f)||c?j(f.default,c):f),p=o.tag&&!0!==o.tag||!1===o.tag?o.tag:"span";return p?t(p,n,l):l}}};function E(t){var e;for(e in t)if("default"!==e)return!1;return Boolean(e)}function j(t,e){var n=e?I(e):{};if(!t)return n;t=t.filter(function(t){return t.tag||""!==t.text.trim()});var r=t.every(R);return t.reduce(r?A:F,n)}function I(t){return Array.isArray(t)?t.reduce(F,{}):Object.assign({},t)}function A(t,e){return e.data&&e.data.attrs&&e.data.attrs.place&&(t[e.data.attrs.place]=e),t}function F(t,e,n){return t[n]=e,t}function R(t){return Boolean(t.data&&t.data.attrs&&t.data.attrs.place)}var P,D={name:"i18n-n",functional:!0,props:{tag:{type:[String,Boolean,Object],default:"span"},value:{type:Number,required:!0},format:{type:[String,Object]},locale:{type:String}},render:function(t,e){var r=e.props,o=e.parent,i=e.data,a=o.$i18n;if(!a)return null;var u=null,f=null;c(r.format)?u=r.format:s(r.format)&&(r.format.key&&(u=r.format.key),f=Object.keys(r.format).reduce(function(t,e){var o;return _(n,e)?Object.assign({},t,(o={},o[e]=r.format[e],o)):t},null));var l=r.locale||a.locale,p=a._ntp(r.value,l,u,f),h=p.map(function(t,e){var n,r=i.scopedSlots&&i.scopedSlots[t.type];return r?r((n={},n[t.type]=t.value,n.index=e,n.parts=p,n)):t.value}),d=r.tag&&!0!==r.tag||!1===r.tag?r.tag:"span";return d?t(d,{attrs:i.attrs,class:i["class"],staticClass:i.staticClass},h):h}};function M(t,e,n){U(t,n)&&B(t,e,n)}function L(t,e,n,r){if(U(t,n)){var o=n.context.$i18n;z(t,n)&&k(e.value,e.oldValue)&&k(t._localeMessage,o.getLocaleMessage(o.locale))||B(t,e,n)}}function N(t,e,n,r){var i=n.context;if(i){var a=n.context.$i18n||{};e.modifiers.preserve||a.preserveDirectiveContent||(t.textContent=""),t._vt=void 0,delete t["_vt"],t._locale=void 0,delete t["_locale"],t._localeMessage=void 0,delete t["_localeMessage"]}else o("Vue instance does not exists in VNode context")}function U(t,e){var n=e.context;return n?!!n.$i18n||(o("VueI18n instance does not exists in Vue instance"),!1):(o("Vue instance does not exists in VNode context"),!1)}function z(t,e){var n=e.context;return t._locale===n.$i18n.locale}function B(t,e,n){var r,i,a=e.value,s=V(a),u=s.path,c=s.locale,f=s.args,l=s.choice;if(u||c||f)if(u){var p=n.context;t._vt=t.textContent=null!=l?(r=p.$i18n).tc.apply(r,[u,l].concat(H(c,f))):(i=p.$i18n).t.apply(i,[u].concat(H(c,f))),t._locale=p.$i18n.locale,t._localeMessage=p.$i18n.getLocaleMessage(p.$i18n.locale)}else o("`path` is required in v-t directive");else o("value type not supported")}function V(t){var e,n,r,o;return c(t)?e=t:p(t)&&(e=t.path,n=t.locale,r=t.args,o=t.choice),{path:e,locale:n,args:r,choice:o}}function H(t,e){var n=[];return t&&n.push(t),e&&(Array.isArray(e)||p(e))&&n.push(e),n}function W(t,e){void 0===e&&(e={bridge:!1}),W.installed=!0,P=t;P.version&&Number(P.version.split(".")[0]);S(P),P.mixin($(e.bridge)),P.directive("t",{bind:M,update:L,unbind:N}),P.component(T.name,T),P.component(D.name,D);var n=P.config.optionMergeStrategies;n.i18n=function(t,e){return void 0===e?t:e}}var q=function(){this._caches=Object.create(null)};q.prototype.interpolate=function(t,e){if(!e)return[t];var n=this._caches[t];return n||(n=K(t),this._caches[t]=n),X(n,e)};var G=/^(?:\d)+/,J=/^(?:\w)+/;function K(t){var e=[],n=0,r="";while(n0)l--,f=it,p[Y]();else{if(l=0,void 0===n)return!1;if(n=vt(n),!1===n)return!1;p[Z]()}};while(null!==f)if(c++,e=t[c],"\\"!==e||!h()){if(o=dt(e),s=ft[f],i=s[o]||s["else"]||ct,i===ct)return;if(f=i[0],a=p[i[1]],a&&(r=i[2],r=void 0===r?e:r,!1===a()))return;if(f===ut)return u}}var yt=function(){this._cache=Object.create(null)};yt.prototype.parsePath=function(t){var e=this._cache[t];return e||(e=mt(t),e&&(this._cache[t]=e)),e||[]},yt.prototype.getPathValue=function(t,e){if(!s(t))return null;var n=this.parsePath(e);if(0===n.length)return null;var r=n.length,o=t,i=0;while(i/,bt=/(?:@(?:\.[a-zA-Z]+)?:(?:[\w\-_|./]+|\([\w\-_:|./]+\)))/g,wt=/^@(?:\.([a-zA-Z]+))?:/,xt=/[()]/g,kt={upper:function(t){return t.toLocaleUpperCase()},lower:function(t){return t.toLocaleLowerCase()},capitalize:function(t){return""+t.charAt(0).toLocaleUpperCase()+t.substr(1)}},Ct=new q,Ot=function(t){var e=this;void 0===t&&(t={}),!P&&"undefined"!==typeof window&&window.Vue&&W(window.Vue);var n=t.locale||"en-US",r=!1!==t.fallbackLocale&&(t.fallbackLocale||"en-US"),o=t.messages||{},i=t.dateTimeFormats||t.datetimeFormats||{},a=t.numberFormats||{};this._vm=null,this._formatter=t.formatter||Ct,this._modifiers=t.modifiers||{},this._missing=t.missing||null,this._root=t.root||null,this._sync=void 0===t.sync||!!t.sync,this._fallbackRoot=void 0===t.fallbackRoot||!!t.fallbackRoot,this._fallbackRootWithEmptyString=void 0===t.fallbackRootWithEmptyString||!!t.fallbackRootWithEmptyString,this._formatFallbackMessages=void 0!==t.formatFallbackMessages&&!!t.formatFallbackMessages,this._silentTranslationWarn=void 0!==t.silentTranslationWarn&&t.silentTranslationWarn,this._silentFallbackWarn=void 0!==t.silentFallbackWarn&&!!t.silentFallbackWarn,this._dateTimeFormatters={},this._numberFormatters={},this._path=new yt,this._dataListeners=new Set,this._componentInstanceCreatedListener=t.componentInstanceCreatedListener||null,this._preserveDirectiveContent=void 0!==t.preserveDirectiveContent&&!!t.preserveDirectiveContent,this.pluralizationRules=t.pluralizationRules||{},this._warnHtmlInMessage=t.warnHtmlInMessage||"off",this._postTranslation=t.postTranslation||null,this._escapeParameterHtml=t.escapeParameterHtml||!1,"__VUE_I18N_BRIDGE__"in t&&(this.__VUE_I18N_BRIDGE__=t.__VUE_I18N_BRIDGE__),this.getChoiceIndex=function(t,n){var r=Object.getPrototypeOf(e);if(r&&r.getChoiceIndex){var o=r.getChoiceIndex;return o.call(e,t,n)}var i=function(t,e){return t=Math.abs(t),2===e?t?t>1?1:0:1:t?Math.min(t,2):0};return e.locale in e.pluralizationRules?e.pluralizationRules[e.locale].apply(e,[t,n]):i(t,n)},this._exist=function(t,n){return!(!t||!n)&&(!h(e._path.getPathValue(t,n))||!!t[n])},"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||Object.keys(o).forEach(function(t){e._checkLocaleMessage(t,e._warnHtmlInMessage,o[t])}),this._initVM({locale:n,fallbackLocale:r,messages:o,dateTimeFormats:i,numberFormats:a})},St={vm:{configurable:!0},messages:{configurable:!0},dateTimeFormats:{configurable:!0},numberFormats:{configurable:!0},availableLocales:{configurable:!0},locale:{configurable:!0},fallbackLocale:{configurable:!0},formatFallbackMessages:{configurable:!0},missing:{configurable:!0},formatter:{configurable:!0},silentTranslationWarn:{configurable:!0},silentFallbackWarn:{configurable:!0},preserveDirectiveContent:{configurable:!0},warnHtmlInMessage:{configurable:!0},postTranslation:{configurable:!0},sync:{configurable:!0}};Ot.prototype._checkLocaleMessage=function(t,e,n){var r=[],s=function(t,e,n,r){if(p(n))Object.keys(n).forEach(function(o){var i=n[o];p(i)?(r.push(o),r.push("."),s(t,e,i,r),r.pop(),r.pop()):(r.push(o),s(t,e,i,r),r.pop())});else if(a(n))n.forEach(function(n,o){p(n)?(r.push("["+o+"]"),r.push("."),s(t,e,n,r),r.pop(),r.pop()):(r.push("["+o+"]"),s(t,e,n,r),r.pop())});else if(c(n)){var u=_t.test(n);if(u){var f="Detected HTML in message '"+n+"' of keypath '"+r.join("")+"' at '"+e+"'. Consider component interpolation with '' to avoid XSS. See https://bit.ly/2ZqJzkp";"warn"===t?o(f):"error"===t&&i(f)}}};s(e,t,n,r)},Ot.prototype._initVM=function(t){var e=P.config.silent;P.config.silent=!0,this._vm=new P({data:t,__VUE18N__INSTANCE__:!0}),P.config.silent=e},Ot.prototype.destroyVM=function(){this._vm.$destroy()},Ot.prototype.subscribeDataChanging=function(t){this._dataListeners.add(t)},Ot.prototype.unsubscribeDataChanging=function(t){y(this._dataListeners,t)},Ot.prototype.watchI18nData=function(){var t=this;return this._vm.$watch("$data",function(){var e=g(t._dataListeners),n=e.length;while(n--)P.nextTick(function(){e[n]&&e[n].$forceUpdate()})},{deep:!0})},Ot.prototype.watchLocale=function(t){if(t){if(!this.__VUE_I18N_BRIDGE__)return null;var e=this,n=this._vm;return this.vm.$watch("locale",function(r){n.$set(n,"locale",r),e.__VUE_I18N_BRIDGE__&&t&&(t.locale.value=r),n.$forceUpdate()},{immediate:!0})}if(!this._sync||!this._root)return null;var r=this._vm;return this._root.$i18n.vm.$watch("locale",function(t){r.$set(r,"locale",t),r.$forceUpdate()},{immediate:!0})},Ot.prototype.onComponentInstanceCreated=function(t){this._componentInstanceCreatedListener&&this._componentInstanceCreatedListener(t,this)},St.vm.get=function(){return this._vm},St.messages.get=function(){return m(this._getMessages())},St.dateTimeFormats.get=function(){return m(this._getDateTimeFormats())},St.numberFormats.get=function(){return m(this._getNumberFormats())},St.availableLocales.get=function(){return Object.keys(this.messages).sort()},St.locale.get=function(){return this._vm.locale},St.locale.set=function(t){this._vm.$set(this._vm,"locale",t)},St.fallbackLocale.get=function(){return this._vm.fallbackLocale},St.fallbackLocale.set=function(t){this._localeChainCache={},this._vm.$set(this._vm,"fallbackLocale",t)},St.formatFallbackMessages.get=function(){return this._formatFallbackMessages},St.formatFallbackMessages.set=function(t){this._formatFallbackMessages=t},St.missing.get=function(){return this._missing},St.missing.set=function(t){this._missing=t},St.formatter.get=function(){return this._formatter},St.formatter.set=function(t){this._formatter=t},St.silentTranslationWarn.get=function(){return this._silentTranslationWarn},St.silentTranslationWarn.set=function(t){this._silentTranslationWarn=t},St.silentFallbackWarn.get=function(){return this._silentFallbackWarn},St.silentFallbackWarn.set=function(t){this._silentFallbackWarn=t},St.preserveDirectiveContent.get=function(){return this._preserveDirectiveContent},St.preserveDirectiveContent.set=function(t){this._preserveDirectiveContent=t},St.warnHtmlInMessage.get=function(){return this._warnHtmlInMessage},St.warnHtmlInMessage.set=function(t){var e=this,n=this._warnHtmlInMessage;if(this._warnHtmlInMessage=t,n!==t&&("warn"===t||"error"===t)){var r=this._getMessages();Object.keys(r).forEach(function(t){e._checkLocaleMessage(t,e._warnHtmlInMessage,r[t])})}},St.postTranslation.get=function(){return this._postTranslation},St.postTranslation.set=function(t){this._postTranslation=t},St.sync.get=function(){return this._sync},St.sync.set=function(t){this._sync=t},Ot.prototype._getMessages=function(){return this._vm.messages},Ot.prototype._getDateTimeFormats=function(){return this._vm.dateTimeFormats},Ot.prototype._getNumberFormats=function(){return this._vm.numberFormats},Ot.prototype._warnDefault=function(t,e,n,r,o,i){if(!h(n))return n;if(this._missing){var a=this._missing.apply(null,[t,e,r,o]);if(c(a))return a}else 0;if(this._formatFallbackMessages){var s=v.apply(void 0,o);return this._render(e,i,s.params,e)}return e},Ot.prototype._isFallbackRoot=function(t){return(this._fallbackRootWithEmptyString?!t:h(t))&&!h(this._root)&&this._fallbackRoot},Ot.prototype._isSilentFallbackWarn=function(t){return this._silentFallbackWarn instanceof RegExp?this._silentFallbackWarn.test(t):this._silentFallbackWarn},Ot.prototype._isSilentFallback=function(t,e){return this._isSilentFallbackWarn(e)&&(this._isFallbackRoot()||t!==this.fallbackLocale)},Ot.prototype._isSilentTranslationWarn=function(t){return this._silentTranslationWarn instanceof RegExp?this._silentTranslationWarn.test(t):this._silentTranslationWarn},Ot.prototype._interpolate=function(t,e,n,r,o,i,s){if(!e)return null;var u,f=this._path.getPathValue(e,n);if(a(f)||p(f))return f;if(h(f)){if(!p(e))return null;if(u=e[n],!c(u)&&!d(u))return null}else{if(!c(f)&&!d(f))return null;u=f}return c(u)&&(u.indexOf("@:")>=0||u.indexOf("@.")>=0)&&(u=this._link(t,e,u,r,"raw",i,s)),this._render(u,o,i,n)},Ot.prototype._link=function(t,e,n,r,o,i,s){var u=n,c=u.match(bt);for(var f in c)if(c.hasOwnProperty(f)){var l=c[f],p=l.match(wt),h=p[0],d=p[1],v=l.replace(h,"").replace(xt,"");if(_(s,v))return u;s.push(v);var m=this._interpolate(t,e,v,r,"raw"===o?"string":o,"raw"===o?void 0:i,s);if(this._isFallbackRoot(m)){if(!this._root)throw Error("unexpected error");var y=this._root.$i18n;m=y._translate(y._getMessages(),y.locale,y.fallbackLocale,v,r,o,i)}m=this._warnDefault(t,v,m,r,a(i)?i:[i],o),this._modifiers.hasOwnProperty(d)?m=this._modifiers[d](m):kt.hasOwnProperty(d)&&(m=kt[d](m)),s.pop(),u=m?u.replace(l,m):u}return u},Ot.prototype._createMessageContext=function(t,e,n,r){var o=this,i=a(t)?t:[],u=s(t)?t:{},c=function(t){return i[t]},f=function(t){return u[t]},l=this._getMessages(),p=this.locale;return{list:c,named:f,values:t,formatter:e,path:n,messages:l,locale:p,linked:function(t){return o._interpolate(p,l[p]||{},t,null,r,void 0,[t])}}},Ot.prototype._render=function(t,e,n,r){if(d(t))return t(this._createMessageContext(n,this._formatter||Ct,r,e));var o=this._formatter.interpolate(t,n,r);return o||(o=Ct.interpolate(t,n,r)),"string"!==e||c(o)?o:o.join("")},Ot.prototype._appendItemToChain=function(t,e,n){var r=!1;return _(t,e)||(r=!0,e&&(r="!"!==e[e.length-1],e=e.replace(/!/g,""),t.push(e),n&&n[e]&&(r=n[e]))),r},Ot.prototype._appendLocaleToChain=function(t,e,n){var r,o=e.split("-");do{var i=o.join("-");r=this._appendItemToChain(t,i,n),o.splice(-1,1)}while(o.length&&!0===r);return r},Ot.prototype._appendBlockToChain=function(t,e,n){for(var r=!0,o=0;o0)i[a]=arguments[a+4];if(!t)return"";var s=v.apply(void 0,i);this._escapeParameterHtml&&(s.params=O(s.params));var u=s.locale||e,c=this._translate(n,u,this.fallbackLocale,t,r,"string",s.params);if(this._isFallbackRoot(c)){if(!this._root)throw Error("unexpected error");return(o=this._root).$t.apply(o,[t].concat(i))}return c=this._warnDefault(u,t,c,r,i,"string"),this._postTranslation&&null!==c&&void 0!==c&&(c=this._postTranslation(c,t)),c},Ot.prototype.t=function(t){var e,n=[],r=arguments.length-1;while(r-- >0)n[r]=arguments[r+1];return(e=this)._t.apply(e,[t,this.locale,this._getMessages(),null].concat(n))},Ot.prototype._i=function(t,e,n,r,o){var i=this._translate(n,e,this.fallbackLocale,t,r,"raw",o);if(this._isFallbackRoot(i)){if(!this._root)throw Error("unexpected error");return this._root.$i18n.i(t,e,o)}return this._warnDefault(e,t,i,r,[o],"raw")},Ot.prototype.i=function(t,e,n){return t?(c(e)||(e=this.locale),this._i(t,e,this._getMessages(),null,n)):""},Ot.prototype._tc=function(t,e,n,r,o){var i,a=[],s=arguments.length-5;while(s-- >0)a[s]=arguments[s+5];if(!t)return"";void 0===o&&(o=1);var u={count:o,n:o},c=v.apply(void 0,a);return c.params=Object.assign(u,c.params),a=null===c.locale?[c.params]:[c.locale,c.params],this.fetchChoice((i=this)._t.apply(i,[t,e,n,r].concat(a)),o)},Ot.prototype.fetchChoice=function(t,e){if(!t||!c(t))return null;var n=t.split("|");return e=this.getChoiceIndex(e,n.length),n[e]?n[e].trim():t},Ot.prototype.tc=function(t,e){var n,r=[],o=arguments.length-2;while(o-- >0)r[o]=arguments[o+2];return(n=this)._tc.apply(n,[t,this.locale,this._getMessages(),null,e].concat(r))},Ot.prototype._te=function(t,e,n){var r=[],o=arguments.length-3;while(o-- >0)r[o]=arguments[o+3];var i=v.apply(void 0,r).locale||e;return this._exist(n[i],t)},Ot.prototype.te=function(t,e){return this._te(t,this.locale,this._getMessages(),e)},Ot.prototype.getLocaleMessage=function(t){return m(this._vm.messages[t]||{})},Ot.prototype.setLocaleMessage=function(t,e){"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||this._checkLocaleMessage(t,this._warnHtmlInMessage,e),this._vm.$set(this._vm.messages,t,e)},Ot.prototype.mergeLocaleMessage=function(t,e){"warn"!==this._warnHtmlInMessage&&"error"!==this._warnHtmlInMessage||this._checkLocaleMessage(t,this._warnHtmlInMessage,e),this._vm.$set(this._vm.messages,t,x("undefined"!==typeof this._vm.messages[t]&&Object.keys(this._vm.messages[t]).length?Object.assign({},this._vm.messages[t]):{},e))},Ot.prototype.getDateTimeFormat=function(t){return m(this._vm.dateTimeFormats[t]||{})},Ot.prototype.setDateTimeFormat=function(t,e){this._vm.$set(this._vm.dateTimeFormats,t,e),this._clearDateTimeFormat(t,e)},Ot.prototype.mergeDateTimeFormat=function(t,e){this._vm.$set(this._vm.dateTimeFormats,t,x(this._vm.dateTimeFormats[t]||{},e)),this._clearDateTimeFormat(t,e)},Ot.prototype._clearDateTimeFormat=function(t,e){for(var n in e){var r=t+"__"+n;this._dateTimeFormatters.hasOwnProperty(r)&&delete this._dateTimeFormatters[r]}},Ot.prototype._localizeDateTime=function(t,e,n,r,o,i){for(var a=e,s=r[a],u=this._getLocaleChain(e,n),c=0;c0)e[n]=arguments[n+1];var o=this.locale,i=null,a=null;return 1===e.length?(c(e[0])?i=e[0]:s(e[0])&&(e[0].locale&&(o=e[0].locale),e[0].key&&(i=e[0].key)),a=Object.keys(e[0]).reduce(function(t,n){var o;return _(r,n)?Object.assign({},t,(o={},o[n]=e[0][n],o)):t},null)):2===e.length&&(c(e[0])&&(i=e[0]),c(e[1])&&(o=e[1])),this._d(t,o,i,a)},Ot.prototype.getNumberFormat=function(t){return m(this._vm.numberFormats[t]||{})},Ot.prototype.setNumberFormat=function(t,e){this._vm.$set(this._vm.numberFormats,t,e),this._clearNumberFormat(t,e)},Ot.prototype.mergeNumberFormat=function(t,e){this._vm.$set(this._vm.numberFormats,t,x(this._vm.numberFormats[t]||{},e)),this._clearNumberFormat(t,e)},Ot.prototype._clearNumberFormat=function(t,e){for(var n in e){var r=t+"__"+n;this._numberFormatters.hasOwnProperty(r)&&delete this._numberFormatters[r]}},Ot.prototype._getNumberFormatter=function(t,e,n,r,o,i){for(var a=e,s=r[a],u=this._getLocaleChain(e,n),c=0;c0)e[r]=arguments[r+1];var o=this.locale,i=null,a=null;return 1===e.length?c(e[0])?i=e[0]:s(e[0])&&(e[0].locale&&(o=e[0].locale),e[0].key&&(i=e[0].key),a=Object.keys(e[0]).reduce(function(t,r){var o;return _(n,r)?Object.assign({},t,(o={},o[r]=e[0][r],o)):t},null)):2===e.length&&(c(e[0])&&(i=e[0]),c(e[1])&&(o=e[1])),this._n(t,o,i,a)},Ot.prototype._ntp=function(t,e,n,r){if(!Ot.availabilities.numberFormat)return[];if(!n){var o=r?new Intl.NumberFormat(e,r):new Intl.NumberFormat(e);return o.formatToParts(t)}var i=this._getNumberFormatter(t,e,this.fallbackLocale,this._getNumberFormats(),n,r),a=i&&i.formatToParts(t);if(this._isFallbackRoot(a)){if(!this._root)throw Error("unexpected error");return this._root.$i18n._ntp(t,e,n,r)}return a||[]},Object.defineProperties(Ot.prototype,St),Object.defineProperty(Ot,"availabilities",{get:function(){if(!gt){var t="undefined"!==typeof Intl;gt={dateTimeFormat:t&&"undefined"!==typeof Intl.DateTimeFormat,numberFormat:t&&"undefined"!==typeof Intl.NumberFormat}}return gt}}),Ot.install=W,Ot.version="8.28.2",e.A=Ot},4901:function(t){"use strict";var e="object"==typeof document&&document.all;t.exports="undefined"==typeof e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}},4913:function(t,e,n){"use strict";var r=n(3724),o=n(5917),i=n(8686),a=n(8551),s=n(6969),u=TypeError,c=Object.defineProperty,f=Object.getOwnPropertyDescriptor,l="enumerable",p="configurable",h="writable";e.f=r?i?function(t,e,n){if(a(t),e=s(e),a(n),"function"===typeof t&&"prototype"===e&&"value"in n&&h in n&&!n[h]){var r=f(t,e);r&&r[h]&&(t[e]=n.value,n={configurable:p in n?n[p]:r[p],enumerable:l in n?n[l]:r[l],writable:!1})}return c(t,e,n)}:c:function(t,e,n){if(a(t),e=s(e),a(n),o)try{return c(t,e,n)}catch(r){}if("get"in n||"set"in n)throw new u("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},4916:function(t,e,n){"use strict";var r=n(7751),o=function(t){return{size:t,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},i=function(t){return{size:t,has:function(){return!0},keys:function(){throw new Error("e")}}};t.exports=function(t,e){var n=r("Set");try{(new n)[t](o(0));try{return(new n)[t](o(-1)),!1}catch(s){if(!e)return!0;try{return(new n)[t](i(-1/0)),!1}catch(u){var a=new n;return a.add(1),a.add(2),e(a[t](i(1/0)))}}}catch(u){return!1}}},5024:function(t,e,n){"use strict";var r=n(6518),o=n(3650),i=n(9835),a=n(4916),s=!a("symmetricDifference")||!i("symmetricDifference");r({target:"Set",proto:!0,real:!0,forced:s},{symmetricDifference:o})},5031:function(t,e,n){"use strict";var r=n(7751),o=n(9504),i=n(8480),a=n(3717),s=n(8551),u=o([].concat);t.exports=r("Reflect","ownKeys")||function(t){var e=i.f(s(t)),n=a.f;return n?u(e,n(t)):e}},5170:function(t,e,n){"use strict";var r=n(6706),o=n(4402);t.exports=r(o.proto,"size","get")||function(t){return t.size}},5397:function(t,e,n){"use strict";var r=n(7055),o=n(7750);t.exports=function(t){return r(o(t))}},5471:function(t,e,n){"use strict";n.r(e),n.d(e,{EffectScope:function(){return Ee},computed:function(){return ye},customRef:function(){return ue},default:function(){return ii},defineAsyncComponent:function(){return nr},defineComponent:function(){return _r},del:function(){return Bt},effectScope:function(){return je},getCurrentInstance:function(){return yt},getCurrentScope:function(){return Ae},h:function(){return Nn},inject:function(){return De},isProxy:function(){return Xt},isReactive:function(){return Gt},isReadonly:function(){return Kt},isRef:function(){return te},isShallow:function(){return Jt},markRaw:function(){return Zt},mergeDefaults:function(){return On},nextTick:function(){return Qn},onActivated:function(){return lr},onBeforeMount:function(){return ir},onBeforeUnmount:function(){return cr},onBeforeUpdate:function(){return sr},onDeactivated:function(){return pr},onErrorCaptured:function(){return yr},onMounted:function(){return ar},onRenderTracked:function(){return dr},onRenderTriggered:function(){return vr},onScopeDispose:function(){return Fe},onServerPrefetch:function(){return hr},onUnmounted:function(){return fr},onUpdated:function(){return ur},provide:function(){return Re},proxyRefs:function(){return ae},reactive:function(){return Ht},readonly:function(){return he},ref:function(){return ee},set:function(){return zt},shallowReactive:function(){return Wt},shallowReadonly:function(){return me},shallowRef:function(){return ne},toRaw:function(){return Yt},toRef:function(){return fe},toRefs:function(){return ce},triggerRef:function(){return oe},unref:function(){return ie},useAttrs:function(){return xn},useCssModule:function(){return tr},useCssVars:function(){return er},useListeners:function(){return kn},useSlots:function(){return wn},version:function(){return gr},watch:function(){return $e},watchEffect:function(){return xe},watchPostEffect:function(){return ke},watchSyncEffect:function(){return Ce}}); +/*! + * Vue.js v2.7.16 + * (c) 2014-2023 Evan You + * Released under the MIT License. + */ +var r=Object.freeze({}),o=Array.isArray;function i(t){return void 0===t||null===t}function a(t){return void 0!==t&&null!==t}function s(t){return!0===t}function u(t){return!1===t}function c(t){return"string"===typeof t||"number"===typeof t||"symbol"===typeof t||"boolean"===typeof t}function f(t){return"function"===typeof t}function l(t){return null!==t&&"object"===typeof t}var p=Object.prototype.toString;function h(t){return"[object Object]"===p.call(t)}function d(t){return"[object RegExp]"===p.call(t)}function v(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function m(t){return a(t)&&"function"===typeof t.then&&"function"===typeof t.catch}function y(t){return null==t?"":Array.isArray(t)||h(t)&&t.toString===p?JSON.stringify(t,g,2):String(t)}function g(t,e){return e&&e.__v_isRef?e.value:e}function _(t){var e=parseFloat(t);return isNaN(e)?t:e}function b(t,e){for(var n=Object.create(null),r=t.split(","),o=0;o-1)return t.splice(r,1)}}var k=Object.prototype.hasOwnProperty;function C(t,e){return k.call(t,e)}function O(t){var e=Object.create(null);return function(n){var r=e[n];return r||(e[n]=t(n))}}var S=/-(\w)/g,$=O(function(t){return t.replace(S,function(t,e){return e?e.toUpperCase():""})}),T=O(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}),E=/\B([A-Z])/g,j=O(function(t){return t.replace(E,"-$1").toLowerCase()});function I(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n}function A(t,e){return t.bind(e)}var F=Function.prototype.bind?A:I;function R(t,e){e=e||0;var n=t.length-e,r=new Array(n);while(n--)r[n]=t[n+e];return r}function P(t,e){for(var n in e)t[n]=e[n];return t}function D(t){for(var e={},n=0;n0,ot=et&&et.indexOf("edge/")>0;et&&et.indexOf("android");var it=et&&/iphone|ipad|ipod|ios/.test(et);et&&/chrome\/\d+/.test(et),et&&/phantomjs/.test(et);var at,st=et&&et.match(/firefox\/(\d+)/),ut={}.watch,ct=!1;if(tt)try{var ft={};Object.defineProperty(ft,"passive",{get:function(){ct=!0}}),window.addEventListener("test-passive",null,ft)}catch(iu){}var lt=function(){return void 0===at&&(at=!tt&&"undefined"!==typeof n.g&&(n.g["process"]&&"server"===n.g["process"].env.VUE_ENV)),at},pt=tt&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function ht(t){return"function"===typeof t&&/native code/.test(t.toString())}var dt,vt="undefined"!==typeof Symbol&&ht(Symbol)&&"undefined"!==typeof Reflect&&ht(Reflect.ownKeys);dt="undefined"!==typeof Set&&ht(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var mt=null;function yt(){return mt&&{proxy:mt}}function gt(t){void 0===t&&(t=null),t||mt&&mt._scope.off(),mt=t,t&&t._scope.on()}var _t=function(){function t(t,e,n,r,o,i,a,s){this.tag=t,this.data=e,this.children=n,this.text=r,this.elm=o,this.ns=void 0,this.context=i,this.fnContext=void 0,this.fnOptions=void 0,this.fnScopeId=void 0,this.key=e&&e.key,this.componentOptions=a,this.componentInstance=void 0,this.parent=void 0,this.raw=!1,this.isStatic=!1,this.isRootInsert=!0,this.isComment=!1,this.isCloned=!1,this.isOnce=!1,this.asyncFactory=s,this.asyncMeta=void 0,this.isAsyncPlaceholder=!1}return Object.defineProperty(t.prototype,"child",{get:function(){return this.componentInstance},enumerable:!1,configurable:!0}),t}(),bt=function(t){void 0===t&&(t="");var e=new _t;return e.text=t,e.isComment=!0,e};function wt(t){return new _t(void 0,void 0,void 0,String(t))}function xt(t){var e=new _t(t.tag,t.data,t.children&&t.children.slice(),t.text,t.elm,t.context,t.componentOptions,t.asyncFactory);return e.ns=t.ns,e.isStatic=t.isStatic,e.key=t.key,e.isComment=t.isComment,e.fnContext=t.fnContext,e.fnOptions=t.fnOptions,e.fnScopeId=t.fnScopeId,e.asyncMeta=t.asyncMeta,e.isCloned=!0,e}"function"===typeof SuppressedError&&SuppressedError;var kt=0,Ct=[],Ot=function(){for(var t=0;t1)return n&&f(e)?e.call(r):e}else 0}var Me=O(function(t){var e="&"===t.charAt(0);t=e?t.slice(1):t;var n="~"===t.charAt(0);t=n?t.slice(1):t;var r="!"===t.charAt(0);return t=r?t.slice(1):t,{name:t,once:n,capture:r,passive:e}});function Le(t,e){function n(){var t=n.fns;if(!o(t))return zn(t,null,arguments,e,"v-on handler");for(var r=t.slice(),i=0;i0&&(r=qe(r,"".concat(e||"","_").concat(n)),We(r[0])&&We(f)&&(l[u]=wt(f.text+r[0].text),r.shift()),l.push.apply(l,r)):c(r)?We(f)?l[u]=wt(f.text+r):""!==r&&l.push(wt(r)):We(r)&&We(f)?l[u]=wt(f.text+r.text):(s(t._isVList)&&a(r.tag)&&i(r.key)&&a(e)&&(r.key="__vlist".concat(e,"_").concat(n,"__")),l.push(r)));return l}function Ge(t,e){var n,r,i,s,u=null;if(o(t)||"string"===typeof t)for(u=new Array(t.length),n=0,r=t.length;n0,s=e?!!e.$stable:!a,u=e&&e.$key;if(e){if(e._normalized)return e._normalized;if(s&&o&&o!==r&&u===o.$key&&!a&&!o.$hasNormal)return o;for(var c in i={},e)e[c]&&"$"!==c[0]&&(i[c]=hn(t,n,c,e[c]))}else i={};for(var f in n)f in i||(i[f]=dn(n,f));return e&&Object.isExtensible(e)&&(e._normalized=i),X(i,"$stable",s),X(i,"$key",u),X(i,"$hasNormal",a),i}function hn(t,e,n,r){var i=function(){var e=mt;gt(t);var n=arguments.length?r.apply(null,arguments):r({});n=n&&"object"===typeof n&&!o(n)?[n]:He(n);var i=n&&n[0];return gt(e),n&&(!i||1===n.length&&i.isComment&&!ln(i))?void 0:n};return r.proxy&&Object.defineProperty(e,n,{get:i,enumerable:!0,configurable:!0}),i}function dn(t,e){return function(){return t[e]}}function vn(t){var e=t.$options,n=e.setup;if(n){var r=t._setupContext=mn(t);gt(t),Tt();var o=zn(n,null,[t._props||Wt({}),r],t,"setup");if(Et(),gt(),f(o))e.render=o;else if(l(o))if(t._setupState=o,o.__sfc){var i=t._setupProxy={};for(var a in o)"__sfc"!==a&&se(i,o,a)}else for(var a in o)K(a)||se(t,o,a);else 0}}function mn(t){return{get attrs(){if(!t._attrsProxy){var e=t._attrsProxy={};X(e,"_v_attr_proxy",!0),yn(e,t.$attrs,r,t,"$attrs")}return t._attrsProxy},get listeners(){if(!t._listenersProxy){var e=t._listenersProxy={};yn(e,t.$listeners,r,t,"$listeners")}return t._listenersProxy},get slots(){return _n(t)},emit:F(t.$emit,t),expose:function(e){e&&Object.keys(e).forEach(function(n){return se(t,e,n)})}}}function yn(t,e,n,r,o){var i=!1;for(var a in e)a in t?e[a]!==n[a]&&(i=!0):(i=!0,gn(t,a,r,o));for(var a in t)a in e||(i=!0,delete t[a]);return i}function gn(t,e,n,r){Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:function(){return n[r][e]}})}function _n(t){return t._slotsProxy||bn(t._slotsProxy={},t.$scopedSlots),t._slotsProxy}function bn(t,e){for(var n in e)t[n]=e[n];for(var n in t)n in e||delete t[n]}function wn(){return Cn().slots}function xn(){return Cn().attrs}function kn(){return Cn().listeners}function Cn(){var t=mt;return t._setupContext||(t._setupContext=mn(t))}function On(t,e){var n=o(t)?t.reduce(function(t,e){return t[e]={},t},{}):t;for(var r in e){var i=n[r];i?o(i)||f(i)?n[r]={type:i,default:e[r]}:i.default=e[r]:null===i&&(n[r]={default:e[r]})}return n}function Sn(t){t._vnode=null,t._staticTrees=null;var e=t.$options,n=t.$vnode=e._parentVnode,o=n&&n.context;t.$slots=cn(e._renderChildren,o),t.$scopedSlots=n?pn(t.$parent,n.data.scopedSlots,t.$slots):r,t._c=function(e,n,r,o){return Pn(t,e,n,r,o,!1)},t.$createElement=function(e,n,r,o){return Pn(t,e,n,r,o,!0)};var i=n&&n.data;Ut(t,"$attrs",i&&i.attrs||r,null,!0),Ut(t,"$listeners",e._parentListeners||r,null,!0)}var $n=null;function Tn(t){un(t.prototype),t.prototype.$nextTick=function(t){return Qn(t,this)},t.prototype._render=function(){var t=this,e=t.$options,n=e.render,r=e._parentVnode;r&&t._isMounted&&(t.$scopedSlots=pn(t.$parent,r.data.scopedSlots,t.$slots,t.$scopedSlots),t._slotsProxy&&bn(t._slotsProxy,t.$scopedSlots)),t.$vnode=r;var i,a=mt,s=$n;try{gt(t),$n=t,i=n.call(t._renderProxy,t.$createElement)}catch(iu){Un(iu,t,"render"),i=t._vnode}finally{$n=s,gt(a)}return o(i)&&1===i.length&&(i=i[0]),i instanceof _t||(i=bt()),i.parent=r,i}}function En(t,e){return(t.__esModule||vt&&"Module"===t[Symbol.toStringTag])&&(t=t.default),l(t)?e.extend(t):t}function jn(t,e,n,r,o){var i=bt();return i.asyncFactory=t,i.asyncMeta={data:e,context:n,children:r,tag:o},i}function In(t,e){if(s(t.error)&&a(t.errorComp))return t.errorComp;if(a(t.resolved))return t.resolved;var n=$n;if(n&&a(t.owners)&&-1===t.owners.indexOf(n)&&t.owners.push(n),s(t.loading)&&a(t.loadingComp))return t.loadingComp;if(n&&!a(t.owners)){var r=t.owners=[n],o=!0,u=null,c=null;n.$on("hook:destroyed",function(){return x(r,n)});var f=function(t){for(var e=0,n=r.length;e1?R(n):n;for(var r=R(arguments,1),o='event handler for "'.concat(t,'"'),i=0,a=n.length;idocument.createEvent("Event").timeStamp&&(Xr=function(){return Yr.now()})}var Zr=function(t,e){if(t.post){if(!e.post)return 1}else if(e.post)return-1;return t.id-e.id};function Qr(){var t,e;for(Kr=Xr(),qr=!0,Br.sort(Zr),Gr=0;GrGr&&Br[n].id>t.id)n--;Br.splice(n+1,0,t)}else Br.push(t);Wr||(Wr=!0,Qn(Qr))}}function oo(t){var e=t.$options.provide;if(e){var n=f(e)?e.call(t):e;if(!l(n))return;for(var r=Pe(t),o=vt?Reflect.ownKeys(n):Object.keys(n),i=0;i-1)if(i&&!C(o,"default"))a=!1;else if(""===a||a===j(t)){var u=Lo(String,o.type);(u<0||s-1)return this;var n=R(arguments,1);return n.unshift(this),f(t.install)?t.install.apply(t,n):f(t)&&t.apply(null,n),e.push(t),this}}function si(t){t.mixin=function(t){return this.options=Io(this.options,t),this}}function ui(t){t.cid=0;var e=1;t.extend=function(t){t=t||{};var n=this,r=n.cid,o=t._Ctor||(t._Ctor={});if(o[r])return o[r];var i=lo(t)||lo(n.options);var a=function(t){this._init(t)};return a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.cid=e++,a.options=Io(n.options,t),a["super"]=n,a.options.props&&ci(a),a.options.computed&&fi(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,W.forEach(function(t){a[t]=n[t]}),i&&(a.options.components[i]=a),a.superOptions=n.options,a.extendOptions=t,a.sealedOptions=P({},a.options),o[r]=a,a}}function ci(t){var e=t.options.props;for(var n in e)Uo(t.prototype,"_props",n)}function fi(t){var e=t.options.computed;for(var n in e)Go(t.prototype,n,e[n])}function li(t){W.forEach(function(e){t[e]=function(t,n){return n?("component"===e&&h(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&f(n)&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}})}function pi(t){return t&&(lo(t.Ctor.options)||t.tag)}function hi(t,e){return o(t)?t.indexOf(e)>-1:"string"===typeof t?t.split(",").indexOf(e)>-1:!!d(t)&&t.test(e)}function di(t,e){var n=t.cache,r=t.keys,o=t._vnode,i=t.$vnode;for(var a in n){var s=n[a];if(s){var u=s.name;u&&!e(u)&&vi(n,a,r,o)}}i.componentOptions.children=void 0}function vi(t,e,n,r){var o=t[e];!o||r&&o.tag===r.tag||o.componentInstance.$destroy(),t[e]=null,x(n,e)}ei(ii),Qo(ii),Ir(ii),Pr(ii),Tn(ii);var mi=[String,RegExp,Array],yi={name:"keep-alive",abstract:!0,props:{include:mi,exclude:mi,max:[String,Number]},methods:{cacheVNode:function(){var t=this,e=t.cache,n=t.keys,r=t.vnodeToCache,o=t.keyToCache;if(r){var i=r.tag,a=r.componentInstance,s=r.componentOptions;e[o]={name:pi(s),tag:i,componentInstance:a},n.push(o),this.max&&n.length>parseInt(this.max)&&vi(e,n[0],n,this._vnode),this.vnodeToCache=null}}},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var t in this.cache)vi(this.cache,t,this.keys)},mounted:function(){var t=this;this.cacheVNode(),this.$watch("include",function(e){di(t,function(t){return hi(e,t)})}),this.$watch("exclude",function(e){di(t,function(t){return!hi(e,t)})})},updated:function(){this.cacheVNode()},render:function(){var t=this.$slots.default,e=An(t),n=e&&e.componentOptions;if(n){var r=pi(n),o=this,i=o.include,a=o.exclude;if(i&&(!r||!hi(i,r))||a&&r&&hi(a,r))return e;var s=this,u=s.cache,c=s.keys,f=null==e.key?n.Ctor.cid+(n.tag?"::".concat(n.tag):""):e.key;u[f]?(e.componentInstance=u[f].componentInstance,x(c,f),c.push(f)):(this.vnodeToCache=e,this.keyToCache=f),e.data.keepAlive=!0}return e||t&&t[0]}},gi={KeepAlive:yi};function _i(t){var e={get:function(){return G}};Object.defineProperty(t,"config",e),t.util={warn:bo,extend:P,mergeOptions:Io,defineReactive:Ut},t.set=zt,t.delete=Bt,t.nextTick=Qn,t.observable=function(t){return Nt(t),t},t.options=Object.create(null),W.forEach(function(e){t.options[e+"s"]=Object.create(null)}),t.options._base=t,P(t.options.components,gi),ai(t),si(t),ui(t),li(t)}_i(ii),Object.defineProperty(ii.prototype,"$isServer",{get:lt}),Object.defineProperty(ii.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(ii,"FunctionalRenderContext",{value:so}),ii.version=gr;var bi=b("style,class"),wi=b("input,textarea,option,select,progress"),xi=function(t,e,n){return"value"===n&&wi(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t},ki=b("contenteditable,draggable,spellcheck"),Ci=b("events,caret,typing,plaintext-only"),Oi=function(t,e){return ji(e)||"false"===e?"false":"contenteditable"===t&&Ci(e)?e:"true"},Si=b("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible"),$i="http://www.w3.org/1999/xlink",Ti=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},Ei=function(t){return Ti(t)?t.slice(6,t.length):""},ji=function(t){return null==t||!1===t};function Ii(t){var e=t.data,n=t,r=t;while(a(r.componentInstance))r=r.componentInstance._vnode,r&&r.data&&(e=Ai(r.data,e));while(a(n=n.parent))n&&n.data&&(e=Ai(e,n.data));return Fi(e.staticClass,e.class)}function Ai(t,e){return{staticClass:Ri(t.staticClass,e.staticClass),class:a(t.class)?[t.class,e.class]:e.class}}function Fi(t,e){return a(t)||a(e)?Ri(t,Pi(e)):""}function Ri(t,e){return t?e?t+" "+e:t:e||""}function Pi(t){return Array.isArray(t)?Di(t):l(t)?Mi(t):"string"===typeof t?t:""}function Di(t){for(var e,n="",r=0,o=t.length;r-1?Vi[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Vi[t]=/HTMLUnknownElement/.test(e.toString())}var Wi=b("text,number,password,search,email,tel,url");function qi(t){if("string"===typeof t){var e=document.querySelector(t);return e||document.createElement("div")}return t}function Gi(t,e){var n=document.createElement(t);return"select"!==t||e.data&&e.data.attrs&&void 0!==e.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n}function Ji(t,e){return document.createElementNS(Li[t],e)}function Ki(t){return document.createTextNode(t)}function Xi(t){return document.createComment(t)}function Yi(t,e,n){t.insertBefore(e,n)}function Zi(t,e){t.removeChild(e)}function Qi(t,e){t.appendChild(e)}function ta(t){return t.parentNode}function ea(t){return t.nextSibling}function na(t){return t.tagName}function ra(t,e){t.textContent=e}function oa(t,e){t.setAttribute(e,"")}var ia=Object.freeze({__proto__:null,createElement:Gi,createElementNS:Ji,createTextNode:Ki,createComment:Xi,insertBefore:Yi,removeChild:Zi,appendChild:Qi,parentNode:ta,nextSibling:ea,tagName:na,setTextContent:ra,setStyleScope:oa}),aa={create:function(t,e){sa(e)},update:function(t,e){t.data.ref!==e.data.ref&&(sa(t,!0),sa(e))},destroy:function(t){sa(t,!0)}};function sa(t,e){var n=t.data.ref;if(a(n)){var r=t.context,i=t.componentInstance||t.elm,s=e?null:i,u=e?void 0:i;if(f(n))zn(n,r,[s],r,"template ref function");else{var c=t.data.refInFor,l="string"===typeof n||"number"===typeof n,p=te(n),h=r.$refs;if(l||p)if(c){var d=l?h[n]:n.value;e?o(d)&&x(d,i):o(d)?d.includes(i)||d.push(i):l?(h[n]=[i],ua(r,n,h[n])):n.value=[i]}else if(l){if(e&&h[n]!==i)return;h[n]=u,ua(r,n,s)}else if(p){if(e&&n.value!==i)return;n.value=s}else 0}}}function ua(t,e,n){var r=t._setupState;r&&C(r,e)&&(te(r[e])?r[e].value=n:r[e]=n)}var ca=new _t("",{},[]),fa=["create","activate","update","remove","destroy"];function la(t,e){return t.key===e.key&&t.asyncFactory===e.asyncFactory&&(t.tag===e.tag&&t.isComment===e.isComment&&a(t.data)===a(e.data)&&pa(t,e)||s(t.isAsyncPlaceholder)&&i(e.asyncFactory.error))}function pa(t,e){if("input"!==t.tag)return!0;var n,r=a(n=t.data)&&a(n=n.attrs)&&n.type,o=a(n=e.data)&&a(n=n.attrs)&&n.type;return r===o||Wi(r)&&Wi(o)}function ha(t,e,n){var r,o,i={};for(r=e;r<=n;++r)o=t[r].key,a(o)&&(i[o]=r);return i}function da(t){var e,n,r={},u=t.modules,f=t.nodeOps;for(e=0;ev?(l=i(n[g+1])?null:n[g+1].elm,C(t,l,n,h,g,r)):h>g&&S(e,p,v)}function E(t,e,n,r){for(var o=n;o-1?Oa(t,e,n):Si(e)?ji(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):ki(e)?t.setAttribute(e,Oi(e,n)):Ti(e)?ji(n)?t.removeAttributeNS($i,Ei(e)):t.setAttributeNS($i,e,n):Oa(t,e,n)}function Oa(t,e,n){if(ji(n))t.removeAttribute(e);else{if(nt&&!rt&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var r=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",r)};t.addEventListener("input",r),t.__ieph=!0}t.setAttribute(e,n)}}var Sa={create:ka,update:ka};function $a(t,e){var n=e.elm,r=e.data,o=t.data;if(!(i(r.staticClass)&&i(r.class)&&(i(o)||i(o.staticClass)&&i(o.class)))){var s=Ii(e),u=n._transitionClasses;a(u)&&(s=Ri(s,Pi(u))),s!==n._prevClass&&(n.setAttribute("class",s),n._prevClass=s)}}var Ta,Ea={create:$a,update:$a},ja="__r",Ia="__c";function Aa(t){if(a(t[ja])){var e=nt?"change":"input";t[e]=[].concat(t[ja],t[e]||[]),delete t[ja]}a(t[Ia])&&(t.change=[].concat(t[Ia],t.change||[]),delete t[Ia])}function Fa(t,e,n){var r=Ta;return function o(){var i=e.apply(null,arguments);null!==i&&Da(t,o,n,r)}}var Ra=Wn&&!(st&&Number(st[1])<=53);function Pa(t,e,n,r){if(Ra){var o=Kr,i=e;e=i._wrapper=function(t){if(t.target===t.currentTarget||t.timeStamp>=o||t.timeStamp<=0||t.target.ownerDocument!==document)return i.apply(this,arguments)}}Ta.addEventListener(t,e,ct?{capture:n,passive:r}:n)}function Da(t,e,n,r){(r||Ta).removeEventListener(t,e._wrapper||e,n)}function Ma(t,e){if(!i(t.data.on)||!i(e.data.on)){var n=e.data.on||{},r=t.data.on||{};Ta=e.elm||t.elm,Aa(n),Ne(n,r,Pa,Da,Fa,e.context),Ta=void 0}}var La,Na={create:Ma,update:Ma,destroy:function(t){return Ma(t,ca)}};function Ua(t,e){if(!i(t.data.domProps)||!i(e.data.domProps)){var n,r,o=e.elm,u=t.data.domProps||{},c=e.data.domProps||{};for(n in(a(c.__ob__)||s(c._v_attr_proxy))&&(c=e.data.domProps=P({},c)),u)n in c||(o[n]="");for(n in c){if(r=c[n],"textContent"===n||"innerHTML"===n){if(e.children&&(e.children.length=0),r===u[n])continue;1===o.childNodes.length&&o.removeChild(o.childNodes[0])}if("value"===n&&"PROGRESS"!==o.tagName){o._value=r;var f=i(r)?"":String(r);za(o,f)&&(o.value=f)}else if("innerHTML"===n&&Ui(o.tagName)&&i(o.innerHTML)){La=La||document.createElement("div"),La.innerHTML="".concat(r,"");var l=La.firstChild;while(o.firstChild)o.removeChild(o.firstChild);while(l.firstChild)o.appendChild(l.firstChild)}else if(r!==u[n])try{o[n]=r}catch(iu){}}}}function za(t,e){return!t.composing&&("OPTION"===t.tagName||Ba(t,e)||Va(t,e))}function Ba(t,e){var n=!0;try{n=document.activeElement!==t}catch(iu){}return n&&t.value!==e}function Va(t,e){var n=t.value,r=t._vModifiers;if(a(r)){if(r.number)return _(n)!==_(e);if(r.trim)return n.trim()!==e.trim()}return n!==e}var Ha={create:Ua,update:Ua},Wa=O(function(t){var e={},n=/;(?![^(]*\))/g,r=/:(.+)/;return t.split(n).forEach(function(t){if(t){var n=t.split(r);n.length>1&&(e[n[0].trim()]=n[1].trim())}}),e});function qa(t){var e=Ga(t.style);return t.staticStyle?P(t.staticStyle,e):e}function Ga(t){return Array.isArray(t)?D(t):"string"===typeof t?Wa(t):t}function Ja(t,e){var n,r={};if(e){var o=t;while(o.componentInstance)o=o.componentInstance._vnode,o&&o.data&&(n=qa(o.data))&&P(r,n)}(n=qa(t.data))&&P(r,n);var i=t;while(i=i.parent)i.data&&(n=qa(i.data))&&P(r,n);return r}var Ka,Xa=/^--/,Ya=/\s*!important$/,Za=function(t,e,n){if(Xa.test(e))t.style.setProperty(e,n);else if(Ya.test(n))t.style.setProperty(j(e),n.replace(Ya,""),"important");else{var r=ts(e);if(Array.isArray(n))for(var o=0,i=n.length;o-1?e.split(rs).forEach(function(e){return t.classList.add(e)}):t.classList.add(e);else{var n=" ".concat(t.getAttribute("class")||""," ");n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function is(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(rs).forEach(function(e){return t.classList.remove(e)}):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{var n=" ".concat(t.getAttribute("class")||""," "),r=" "+e+" ";while(n.indexOf(r)>=0)n=n.replace(r," ");n=n.trim(),n?t.setAttribute("class",n):t.removeAttribute("class")}}function as(t){if(t){if("object"===typeof t){var e={};return!1!==t.css&&P(e,ss(t.name||"v")),P(e,t),e}return"string"===typeof t?ss(t):void 0}}var ss=O(function(t){return{enterClass:"".concat(t,"-enter"),enterToClass:"".concat(t,"-enter-to"),enterActiveClass:"".concat(t,"-enter-active"),leaveClass:"".concat(t,"-leave"),leaveToClass:"".concat(t,"-leave-to"),leaveActiveClass:"".concat(t,"-leave-active")}}),us=tt&&!rt,cs="transition",fs="animation",ls="transition",ps="transitionend",hs="animation",ds="animationend";us&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(ls="WebkitTransition",ps="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(hs="WebkitAnimation",ds="webkitAnimationEnd"));var vs=tt?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function ms(t){vs(function(){vs(t)})}function ys(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),os(t,e))}function gs(t,e){t._transitionClasses&&x(t._transitionClasses,e),is(t,e)}function _s(t,e,n){var r=ws(t,e),o=r.type,i=r.timeout,a=r.propCount;if(!o)return n();var s=o===cs?ps:ds,u=0,c=function(){t.removeEventListener(s,f),n()},f=function(e){e.target===t&&++u>=a&&c()};setTimeout(function(){u0&&(n=cs,f=a,l=i.length):e===fs?c>0&&(n=fs,f=c,l=u.length):(f=Math.max(a,c),n=f>0?a>c?cs:fs:null,l=n?n===cs?i.length:u.length:0);var p=n===cs&&bs.test(r[ls+"Property"]);return{type:n,timeout:f,propCount:l,hasTransform:p}}function xs(t,e){while(t.length1}function Ts(t,e){!0!==e.data.show&&Cs(e)}var Es=tt?{create:Ts,activate:Ts,remove:function(t,e){!0!==t.data.show?Os(t,e):e()}}:{},js=[Sa,Ea,Na,Ha,ns,Es],Is=js.concat(xa),As=da({nodeOps:ia,modules:Is});rt&&document.addEventListener("selectionchange",function(){var t=document.activeElement;t&&t.vmodel&&Us(t,"input")});var Fs={inserted:function(t,e,n,r){"select"===n.tag?(r.elm&&!r.elm._vOptions?Ue(n,"postpatch",function(){Fs.componentUpdated(t,e,n)}):Rs(t,e,n.context),t._vOptions=[].map.call(t.options,Ms)):("textarea"===n.tag||Wi(t.type))&&(t._vModifiers=e.modifiers,e.modifiers.lazy||(t.addEventListener("compositionstart",Ls),t.addEventListener("compositionend",Ns),t.addEventListener("change",Ns),rt&&(t.vmodel=!0)))},componentUpdated:function(t,e,n){if("select"===n.tag){Rs(t,e,n.context);var r=t._vOptions,o=t._vOptions=[].map.call(t.options,Ms);if(o.some(function(t,e){return!U(t,r[e])})){var i=t.multiple?e.value.some(function(t){return Ds(t,o)}):e.value!==e.oldValue&&Ds(e.value,o);i&&Us(t,"change")}}}};function Rs(t,e,n){Ps(t,e,n),(nt||ot)&&setTimeout(function(){Ps(t,e,n)},0)}function Ps(t,e,n){var r=e.value,o=t.multiple;if(!o||Array.isArray(r)){for(var i,a,s=0,u=t.options.length;s-1,a.selected!==i&&(a.selected=i);else if(U(Ms(a),r))return void(t.selectedIndex!==s&&(t.selectedIndex=s));o||(t.selectedIndex=-1)}}function Ds(t,e){return e.every(function(e){return!U(e,t)})}function Ms(t){return"_value"in t?t._value:t.value}function Ls(t){t.target.composing=!0}function Ns(t){t.target.composing&&(t.target.composing=!1,Us(t.target,"input"))}function Us(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function zs(t){return!t.componentInstance||t.data&&t.data.transition?t:zs(t.componentInstance._vnode)}var Bs={bind:function(t,e,n){var r=e.value;n=zs(n);var o=n.data&&n.data.transition,i=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;r&&o?(n.data.show=!0,Cs(n,function(){t.style.display=i})):t.style.display=r?i:"none"},update:function(t,e,n){var r=e.value,o=e.oldValue;if(!r!==!o){n=zs(n);var i=n.data&&n.data.transition;i?(n.data.show=!0,r?Cs(n,function(){t.style.display=t.__vOriginalDisplay}):Os(n,function(){t.style.display="none"})):t.style.display=r?t.__vOriginalDisplay:"none"}},unbind:function(t,e,n,r,o){o||(t.style.display=t.__vOriginalDisplay)}},Vs={model:Fs,show:Bs},Hs={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function Ws(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?Ws(An(e.children)):t}function qs(t){var e={},n=t.$options;for(var r in n.propsData)e[r]=t[r];var o=n._parentListeners;for(var r in o)e[$(r)]=o[r];return e}function Gs(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}function Js(t){while(t=t.parent)if(t.data.transition)return!0}function Ks(t,e){return e.key===t.key&&e.tag===t.tag}var Xs=function(t){return t.tag||ln(t)},Ys=function(t){return"show"===t.name},Zs={name:"transition",props:Hs,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(Xs),n.length)){0;var r=this.mode;0;var o=n[0];if(Js(this.$vnode))return o;var i=Ws(o);if(!i)return o;if(this._leaving)return Gs(t,o);var a="__transition-".concat(this._uid,"-");i.key=null==i.key?i.isComment?a+"comment":a+i.tag:c(i.key)?0===String(i.key).indexOf(a)?i.key:a+i.key:i.key;var s=(i.data||(i.data={})).transition=qs(this),u=this._vnode,f=Ws(u);if(i.data.directives&&i.data.directives.some(Ys)&&(i.data.show=!0),f&&f.data&&!Ks(i,f)&&!ln(f)&&(!f.componentInstance||!f.componentInstance._vnode.isComment)){var l=f.data.transition=P({},s);if("out-in"===r)return this._leaving=!0,Ue(l,"afterLeave",function(){e._leaving=!1,e.$forceUpdate()}),Gs(t,o);if("in-out"===r){if(ln(i))return u;var p,h=function(){p()};Ue(s,"afterEnter",h),Ue(s,"enterCancelled",h),Ue(l,"delayLeave",function(t){p=t})}}return o}}},Qs=P({tag:String,moveClass:String},Hs);delete Qs.mode;var tu={props:Qs,beforeMount:function(){var t=this,e=this._update;this._update=function(n,r){var o=Fr(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,o(),e.call(t,n,r)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,o=this.$slots.default||[],i=this.children=[],a=qs(this),s=0;sf)i.f(t,n=o[f++],r[n]);return t}},6823:function(t){"use strict";var e=String;t.exports=function(t){try{return e(t)}catch(n){return"Object"}}},6837:function(t){"use strict";var e=TypeError,n=9007199254740991;t.exports=function(t){if(t>n)throw e("Maximum allowed index exceeded");return t}},6840:function(t,e,n){"use strict";var r=n(4901),o=n(4913),i=n(283),a=n(9433);t.exports=function(t,e,n,s){s||(s={});var u=s.enumerable,c=void 0!==s.name?s.name:e;if(r(n)&&i(n,c,s),s.global)u?t[e]=n:a(e,n);else{try{s.unsafe?t[e]&&(u=!0):delete t[e]}catch(f){}u?t[e]=n:o.f(t,e,{value:n,enumerable:!1,configurable:!s.nonConfigurable,writable:!s.nonWritable})}return t}},6933:function(t,e,n){"use strict";var r=n(9504),o=n(4376),i=n(4901),a=n(2195),s=n(655),u=r([].push);t.exports=function(t){if(i(t))return t;if(o(t)){for(var e=t.length,n=[],r=0;r1;return e.has(1)&&e.clear(),{done:n,value:2}}}}},e=new Set([1,2,3,4]);return 3!==e.difference(t).size});r({target:"Set",proto:!0,real:!0,forced:u},{difference:o})},7657:function(t,e,n){"use strict";var r,o,i,a=n(9039),s=n(4901),u=n(34),c=n(2360),f=n(2787),l=n(6840),p=n(8227),h=n(6395),d=p("iterator"),v=!1;[].keys&&(i=[].keys(),"next"in i?(o=f(f(i)),o!==Object.prototype&&(r=o)):v=!0);var m=!u(r)||a(function(){var t={};return r[d].call(t)!==t});m?r={}:h&&(r=c(r)),s(r[d])||l(r,d,function(){return this}),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:v}},7680:function(t,e,n){"use strict";var r=n(9504);t.exports=r([].slice)},7740:function(t,e,n){"use strict";var r=n(9297),o=n(5031),i=n(7347),a=n(4913);t.exports=function(t,e,n){for(var s=o(e),u=a.f,c=i.f,f=0;f0?o(e,9007199254740991):0}},8111:function(t,e,n){"use strict";var r=n(6518),o=n(4576),i=n(679),a=n(8551),s=n(4901),u=n(2787),c=n(2106),f=n(4659),l=n(9039),p=n(9297),h=n(8227),d=n(7657).IteratorPrototype,v=n(3724),m=n(6395),y="constructor",g="Iterator",_=h("toStringTag"),b=TypeError,w=o[g],x=m||!s(w)||w.prototype!==d||!l(function(){w({})}),k=function(){if(i(this,d),u(this)===d)throw new b("Abstract class Iterator not directly constructable")},C=function(t,e){v?c(d,t,{configurable:!0,get:function(){return e},set:function(e){if(a(this),this===d)throw new b("You can't redefine this property");p(this,t)?this[t]=e:f(this,t,e)}}):d[t]=e};p(d,_)||C(_,g),!x&&p(d,y)&&d[y]!==Object||C(y,k),k.prototype=d,r({global:!0,constructor:!0,forced:x},{Iterator:k})},8227:function(t,e,n){"use strict";var r=n(4576),o=n(5745),i=n(9297),a=n(3392),s=n(4495),u=n(7040),c=r.Symbol,f=o("wks"),l=u?c["for"]||c:c&&c.withoutSetter||a;t.exports=function(t){return i(f,t)||(f[t]=s&&i(c,t)?c[t]:l("Symbol."+t)),f[t]}},8235:function(t,e,n){"use strict";var r=n(9504),o=n(9297),i=SyntaxError,a=parseInt,s=String.fromCharCode,u=r("".charAt),c=r("".slice),f=r(/./.exec),l={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},p=/^[\da-f]{4}$/i,h=/^[\u0000-\u001F]$/;t.exports=function(t,e){var n=!0,r="";while(en.size?u(n.getIterator(),function(t){l(e,t)&&f(o,t)}):s(e,function(t){n.includes(t)&&f(o,t)}),o}},8773:function(t,e){"use strict";var n={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor,o=r&&!n.call({1:2},1);e.f=o?function(t){var e=r(this,t);return!!e&&e.enumerable}:n},8981:function(t,e,n){"use strict";var r=n(7750),o=Object;t.exports=function(t){return o(r(t))}},9039:function(t){"use strict";t.exports=function(t){try{return!!t()}catch(e){return!0}}},9286:function(t,e,n){"use strict";var r=n(4402),o=n(8469),i=r.Set,a=r.add;t.exports=function(t){var e=new i;return o(t,function(t){a(e,t)}),e}},9297:function(t,e,n){"use strict";var r=n(9504),o=n(8981),i=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return i(o(t),e)}},9306:function(t,e,n){"use strict";var r=n(4901),o=n(6823),i=TypeError;t.exports=function(t){if(r(t))return t;throw new i(o(t)+" is not a function")}},9433:function(t,e,n){"use strict";var r=n(4576),o=Object.defineProperty;t.exports=function(t,e){try{o(r,t,{value:e,configurable:!0,writable:!0})}catch(n){r[t]=e}return e}},9462:function(t,e,n){"use strict";var r=n(9565),o=n(2360),i=n(6699),a=n(6279),s=n(8227),u=n(1181),c=n(5966),f=n(7657).IteratorPrototype,l=n(2529),p=n(9539),h=n(1385),d=s("toStringTag"),v="IteratorHelper",m="WrapForValidIterator",y="normal",g="throw",_=u.set,b=function(t){var e=u.getterFor(t?m:v);return a(o(f),{next:function(){var n=e(this);if(t)return n.nextHandler();if(n.done)return l(void 0,!0);try{var r=n.nextHandler();return n.returnHandlerResult?r:l(r,n.done)}catch(o){throw n.done=!0,o}},return:function(){var n=e(this),o=n.iterator;if(n.done=!0,t){var i=c(o,"return");return i?r(i,o):l(void 0,!0)}if(n.inner)try{p(n.inner.iterator,y)}catch(a){return p(o,g,a)}if(n.openIters)try{h(n.openIters,y)}catch(a){return p(o,g,a)}return o&&p(o,y),l(void 0,!0)}})},w=b(!0),x=b(!1);i(x,d,"Iterator Helper"),t.exports=function(t,e,n){var r=function(r,o){o?(o.iterator=r.iterator,o.next=r.next):o=r,o.type=e?m:v,o.returnHandlerResult=!!n,o.nextHandler=t,o.counter=0,o.done=!1,_(this,o)};return r.prototype=e?w:x,r}},9504:function(t,e,n){"use strict";var r=n(616),o=Function.prototype,i=o.call,a=r&&o.bind.bind(i,i);t.exports=r?a:function(t){return function(){return i.apply(t,arguments)}}},9519:function(t,e,n){"use strict";var r,o,i=n(4576),a=n(2839),s=i.process,u=i.Deno,c=s&&s.versions||u&&u.version,f=c&&c.v8;f&&(r=f.split("."),o=r[0]>0&&r[0]<4?1:+(r[0]+r[1])),!o&&a&&(r=a.match(/Edge\/(\d+)/),(!r||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/),r&&(o=+r[1]))),t.exports=o},9539:function(t,e,n){"use strict";var r=n(9565),o=n(8551),i=n(5966);t.exports=function(t,e,n){var a,s;o(t);try{if(a=i(t,"return"),!a){if("throw"===e)throw n;return n}a=r(a,t)}catch(u){s=!0,a=u}if("throw"===e)throw n;if(s)throw a;return o(a),n}},9565:function(t,e,n){"use strict";var r=n(616),o=Function.prototype.call;t.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},9617:function(t,e,n){"use strict";var r=n(5397),o=n(5610),i=n(6198),a=function(t){return function(e,n,a){var s=r(e),u=i(s);if(0===u)return!t&&-1;var c,f=o(a,u);if(t&&n!==n){while(u>f)if(c=s[f++],c!==c)return!0}else for(;u>f;f++)if((t||f in s)&&s[f]===n)return t||f||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},9835:function(t){"use strict";t.exports=function(t){try{var e=new Set,n={size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return e.clear(),e.add(4),function(){return{done:!0}}}})}},r=e[t](n);return 1===r.size&&4===r.values().next().value}catch(o){return!1}}}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/documentation-topic.f9ed709f.js b/Containers/Supporting Files/Help.bundle/js/documentation-topic.f9ed709f.js new file mode 100644 index 0000000..10856c4 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/documentation-topic.f9ed709f.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[482,633],{531:function(e,t,n){"use strict";var i=n(6518),a=n(9565),s=n(9306),r=n(8551),o=n(1767),l=n(8646),c=n(9462),d=n(9539),u=n(6395),h=n(684),p=n(4549),g=!u&&!h("flatMap",function(){}),f=!u&&!g&&p("flatMap",TypeError),m=u||g||f,y=c(function(){var e,t,n=this.iterator,i=this.mapper;while(1){if(t=this.inner)try{if(e=r(a(t.next,t.iterator)),!e.done)return e.value;this.inner=null}catch(s){d(n,"throw",s)}if(e=r(a(this.next,n)),this.done=!!e.done)return;try{this.inner=l(i(e.value,this.counter++),!1)}catch(s){d(n,"throw",s)}}});i({target:"Iterator",proto:!0,real:!0,forced:m},{flatMap:function(e){r(this);try{s(e)}catch(t){d(this,"throw",t)}return f?a(f,this,e):new y(o(this),{mapper:e,inner:null})}})},2223:function(e,t,n){"use strict";n.d(t,{A:function(){return d}});var i=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"inline-close-icon",attrs:{viewBox:"0 0 14 14",themeId:"inline-close"}},[t("path",{attrs:{d:"M11.91 1l1.090 1.090-4.917 4.915 4.906 4.905-1.090 1.090-4.906-4.905-4.892 4.894-1.090-1.090 4.892-4.894-4.903-4.904 1.090-1.090 4.903 4.904z"}})])},a=[],s=n(6515),r={name:"InlineCloseIcon",components:{SVGIcon:s.A}},o=r,l=n(1656),c=(0,l.A)(o,i,a,!1,null,null,null),d=c.exports},6088:function(e,t,n){"use strict";n.d(t,{A:function(){return c}});var i,a,s={name:"TransitionExpand",functional:!0,render(e,t){const n={props:{name:"expand"},on:{afterEnter(e){e.style.height="auto"},enter(e){const{width:t}=getComputedStyle(e);e.style.width=t,e.style.position="absolute",e.style.visibility="hidden",e.style.height="auto";const{height:n}=getComputedStyle(e);e.style.width=null,e.style.position=null,e.style.visibility=null,e.style.height=0,getComputedStyle(e).height,requestAnimationFrame(()=>{e.style.height=n})},leave(e){const{height:t}=getComputedStyle(e);e.style.height=t,getComputedStyle(e).height,requestAnimationFrame(()=>{e.style.height=0})}}};return e("transition",n,t.children)}},r=s,o=n(1656),l=(0,o.A)(r,i,a,!1,null,null,null),c=l.exports},6302:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return Th}});var i=function(){var e=this,t=e._self._c;return t("CodeTheme",[e.topicData?t("DocumentationLayout",e._b({scopedSlots:e._u([{key:"nav-title",fn:function({className:n}){return[t(e.rootLink?"router-link":"h2",{tag:"component",class:n,attrs:{to:e.rootLink}},[e._v(" "+e._s(e.$t("documentation.title"))+" ")])]}},{key:"content",fn:function(){return[t("Topic",e._b({key:e.topicKey,attrs:{disableHeroBackground:e.disableHeroBackground,objcPath:e.objcPath,swiftPath:e.swiftPath,isSymbolDeprecated:e.isSymbolDeprecated,isSymbolBeta:e.isSymbolBeta,languagePaths:e.languagePaths,enableOnThisPageNav:e.enableOnThisPageNav,enableMinimized:e.enableMinimized,hierarchyItems:e.hierarchyItems}},"Topic",e.topicProps,!1))]},proxy:!0}],null,!1,402783128)},"DocumentationLayout",e.documentationLayoutProps,!1)):e._e()],1)},a=[];n(8111),n(1148),n(116),n(8237),n(3579);const s="/";function r(e){return e.replace(/~[0,1]/g,e=>({"~0":"~","~1":"/"}[e]||e))}function*o(e){const t=1;if(e.lengtht)throw new Error(`invalid array index ${e}`);return n}function*p(e,t,n={strict:!1}){let i=e;for(const a of o(t)){if(n.strict&&!Object.prototype.hasOwnProperty.call(i,a))throw new u(t);i=i[a],yield{node:i,token:a}}}function g(e,t){let n=e;for(const{node:i}of p(e,t,{strict:!0}))n=i;return n}function f(e,t,n){let i=null,a=e,s=null;for(const{node:o,token:l}of p(e,t))i=a,a=o,s=l;if(!i)throw new u(t);if(Array.isArray(i))try{const e=h(s,i);i.splice(e,0,n)}catch(r){throw new u(t)}else Object.assign(i,{[s]:n});return e}function m(e,t){let n=null,i=e,a=null;for(const{node:r,token:o}of p(e,t))n=i,i=r,a=o;if(!n)throw new u(t);if(Array.isArray(n))try{const e=h(a,n);n.splice(e,1)}catch(s){throw new u(t)}else{if(!i)throw new u(t);delete n[a]}return e}function y(e,t,n){return m(e,t),f(e,t,n),e}function v(e,t,n){const i=g(e,t);return m(e,t),f(e,n,i),e}function b(e,t,n){return f(e,n,g(e,t)),e}function T(e,t,n){function i(e,t){const n=typeof e,a=typeof t;if(n!==a)return!1;switch(n){case d:{const n=Object.keys(e),a=Object.keys(t);return n.length===a.length&&n.every((n,s)=>n===a[s]&&i(e[n],t[n]))}default:return e===t}}const a=g(e,t);if(!i(n,a))throw new Error("test failed");return e}const _={add:(e,{path:t,value:n})=>f(e,t,n),copy:(e,{from:t,path:n})=>b(e,t,n),move:(e,{from:t,path:n})=>v(e,t,n),remove:(e,{path:t})=>m(e,t),replace:(e,{path:t,value:n})=>y(e,t,n),test:(e,{path:t,value:n})=>T(e,t,n)};function S(e,{op:t,...n}){const i=_[t];if(!i)throw new Error("unknown operation");return i(e,n)}function k(e,t){return t.reduce(S,e)}var C=n(4468),w=n(2655),x=n(1836),A=function(){var e=this,t=e._self._c;return t("div",{staticClass:"doc-topic",class:{"with-on-this-page":e.enableOnThisPageNav&&e.isOnThisPageNavVisible}},[t(e.isTargetIDE?"div":"main",{tag:"component",staticClass:"main",attrs:{id:"app-main"}},[t("DocumentationHero",{attrs:{role:e.role,enhanceBackground:e.enhanceBackground,enableMinimized:e.enableMinimized,shortHero:e.shortHero,shouldShowLanguageSwitcher:e.shouldShowLanguageSwitcher,iconOverride:e.references[e.pageIcon],standardColorIdentifier:e.standardColorIdentifier},scopedSlots:e._u([{key:"above-content",fn:function(){return[e._t("above-hero-content")]},proxy:!0}],null,!0)},[e._t("above-title"),!e.parentTopics.length||e.enableMinimized||e.isTargetIDE?e._e():t("Hierarchy",{attrs:{currentTopicTitle:e.title,isSymbolDeprecated:e.isSymbolDeprecated,isSymbolBeta:e.isSymbolBeta,parentTopics:e.parentTopics,currentTopicTags:e.tags}}),e.shouldShowLanguageSwitcher?t("LanguageSwitcher",{attrs:{interfaceLanguage:e.interfaceLanguage,objcPath:e.objcPath,swiftPath:e.swiftPath}}):e._e(),t("Title",{class:{"minimized-title":e.enableMinimized},attrs:{eyebrow:e.enableMinimized?null:e.roleHeading},scopedSlots:e._u([e.isSymbolDeprecated||e.isSymbolBeta?{key:"after",fn:function(){return[t("small",{class:e.tagName,attrs:{"data-tag-name":e.tagName}})]},proxy:!0}:null],null,!0)},[t(e.titleBreakComponent,{tag:"component"},[e._v(e._s(e.title))])],1),e.abstract?t("Abstract",{class:{"minimized-abstract":e.enableMinimized},attrs:{content:e.abstract}}):e._e(),e.sampleCodeDownload?t("div",[t("DownloadButton",{staticClass:"sample-download",attrs:{action:e.sampleCodeDownload.action,linksToAsset:""}})],1):e._e(),e.shouldShowAvailability?t("Availability",{attrs:{platforms:e.platforms,technologies:e.technologies}}):e._e(),e.declarations.length?t("div",{staticClass:"declarations-container",class:{"minimized-container":e.enableMinimized}},e._l(e.declarations,function(n,i){return t("Declaration",{key:i,attrs:{conformance:e.conformance,declarations:n.declarations,source:e.remoteSource,declListExpanded:e.declListExpanded},on:{"update:declListExpanded":function(t){e.declListExpanded=t},"update:decl-list-expanded":function(t){e.declListExpanded=t}}})}),1):e._e()],2),t("div",{staticClass:"doc-content-wrapper"},[t("div",{staticClass:"doc-content",class:{"no-primary-content":!e.hasPrimaryContent&&e.enhanceBackground}},[e.hasPrimaryContent||e.showOtherDeclarations?t("div",{class:["container",{"minimized-container":e.enableMinimized}]},[e.declListExpanded?e._e():t("div",{staticClass:"description",class:{"after-enhanced-hero":e.enhanceBackground}},[e.isRequirement?t("RequirementMetadata",{attrs:{defaultImplementationsCount:e.defaultImplementationsCount}}):e._e(),e.deprecationSummary&&e.deprecationSummary.length?t("Aside",{attrs:{kind:"deprecated"}},[t("ContentNode",{attrs:{content:e.deprecationSummary}})],1):e._e(),e.downloadNotAvailableSummary&&e.downloadNotAvailableSummary.length?t("Aside",{attrs:{kind:"note"}},[t("ContentNode",{attrs:{content:e.downloadNotAvailableSummary}})],1):e._e()],1),e.showOtherDeclarations?t("div",{staticClass:"declaration-list-menu"},[t("button",{staticClass:"declaration-list-toggle",on:{click:e.toggleDeclList}},[e._v(" "+e._s(e.declListToggleText)+" "),t("div",{staticClass:"icon"},[t("InlinePlusCircleIcon",{class:{expand:e.declListExpanded}})],1)])]):e._e(),e.primaryContentSectionsSanitized&&e.primaryContentSectionsSanitized.length?t("PrimaryContent",{class:{"with-border":!e.enhanceBackground},attrs:{conformance:e.conformance,source:e.remoteSource,sections:e.primaryContentSectionsSanitized}}):e._e()],1):e._e(),e.shouldRenderTopicSection?t("Topics",{attrs:{sections:e.topicSections,isSymbolDeprecated:e.isSymbolDeprecated,isSymbolBeta:e.isSymbolBeta,topicStyle:e.topicSectionsStyle}}):e._e(),e.defaultImplementationsSections&&!e.enableMinimized?t("DefaultImplementations",{attrs:{sections:e.defaultImplementationsSections,isSymbolDeprecated:e.isSymbolDeprecated,isSymbolBeta:e.isSymbolBeta}}):e._e(),e.relationshipsSections?t("Relationships",{attrs:{sections:e.relationshipsSections,enableMinimized:e.enableMinimized}}):e._e(),e.seeAlsoSections&&!e.enableMinimized?t("SeeAlso",{attrs:{sections:e.seeAlsoSections}}):e._e(),e.shouldShowViewMoreLink?t("ViewMore",{staticClass:"minimized-container",attrs:{url:e.viewMoreLink}}):e._e()],1),e.enableOnThisPageNav?[t("OnThisPageStickyContainer",{directives:[{name:"show",rawName:"v-show",value:e.isOnThisPageNavVisible,expression:"isOnThisPageNavVisible"}]},[e.topicState.onThisPageSections.length>2?t("OnThisPageNav"):e._e()],1)]:e._e()],2),!e.isTargetIDE&&e.hasBetaContent?t("BetaLegalText"):e._e()],1),t("div",{staticClass:"visuallyhidden",attrs:{"aria-live":"polite"}},[e._v(" "+e._s(e.$t("documentation.current-page",{title:e.pageTitle}))+" ")])],1)},I=[],$=(n(4114),n(2489),n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698),n(1339)),D={class:"class",enum:"enum",protocol:"protocol",struct:"struct",uid:"uid",module:"module"},L=n(1897),P=n(1074),O=n(288),N=n(7219),R=n(8964),B=n(4605),E=n(2481),M=function(){var e=this,t=e._self._c;return t("div",{staticClass:"betainfo"},[t("div",{staticClass:"betainfo-container"},[t("GridRow",[t("GridColumn",{attrs:{span:{large:12}}},[t("p",{staticClass:"betainfo-label"},[e._v(e._s(e.$t("metadata.beta.software")))]),t("div",{staticClass:"betainfo-content"},[e._t("content",function(){return[t("p",[e._v(e._s(e.$t("metadata.beta.legal")))])]})],2),e._t("after")],2)],1)],1)])},z=[],K=n(6616),q=n(2773),j={name:"BetaLegalText",components:{GridColumn:q.A,GridRow:K.A}},F=j,V=n(1656),H=(0,V.A)(F,M,z,!1,null,"ba3b3cc0",null),W=H.exports,U=function(){var e=this,t=e._self._c;return t("Section",{staticClass:"language",attrs:{role:"complementary","aria-label":e.$t("language")}},[t("Title",[e._v(e._s(e.$t("formats.colon",{content:e.$t("language")})))]),t("div",{staticClass:"language-list"},[t("LanguageSwitcherLink",{staticClass:"language-option swift",class:{active:e.swift.active},attrs:{url:e.swift.active?null:e.swift.url},on:{click:function(t){return e.chooseLanguage(e.swift)}}},[e._v(" "+e._s(e.swift.name)+" ")]),t("LanguageSwitcherLink",{staticClass:"language-option objc",class:{active:e.objc.active},attrs:{url:e.objc.active?null:e.objc.url},on:{click:function(t){return e.chooseLanguage(e.objc)}}},[e._v(" "+e._s(e.objc.name)+" ")])],1)],1)},G=[],Q=function(){var e=this,t=e._self._c;return e.url?t("a",{attrs:{href:e.url},on:{click:function(t){return t.preventDefault(),e.$emit("click")}}},[e._t("default")],2):t("span",[e._t("default")],2)},X=[],Y={name:"LanguageSwitcherLink",props:{url:[String,Object]}},Z=Y,J=(0,V.A)(Z,Q,X,!1,null,"2ca5e993",null),ee=J.exports,te=function(){var e=this,t=e._self._c;return t("div",{staticClass:"summary-section"},[e._t("default")],2)},ne=[],ie={name:"Section"},ae=ie,se=(0,V.A)(ae,te,ne,!1,null,"3aa6f694",null),re=se.exports,oe=function(){var e=this,t=e._self._c;return t("p",{staticClass:"title"},[e._t("default")],2)},le=[],ce={name:"Title"},de=ce,ue=(0,V.A)(de,oe,le,!1,null,"246c819c",null),he=ue.exports,pe={name:"LanguageSwitcher",components:{LanguageSwitcherLink:ee,Section:re,Title:he},inject:{isTargetIDE:{default:()=>!1},store:{default(){return{setPreferredLanguage(){}}}}},props:{interfaceLanguage:{type:String,required:!0},objcPath:{type:String,required:!0},swiftPath:{type:String,required:!0}},computed:{objc:({interfaceLanguage:e,objcPath:t,$route:{query:n}})=>({...$.A.objectiveC,active:$.A.objectiveC.key.api===e,url:(0,P.c$)((0,O.Vd)(t),{...n,language:$.A.objectiveC.key.url})}),swift:({interfaceLanguage:e,swiftPath:t,$route:{query:n}})=>({...$.A.swift,active:$.A.swift.key.api===e,url:(0,P.c$)((0,O.Vd)(t),{...n,language:void 0})})},methods:{chooseLanguage(e){this.isTargetIDE||this.store.setPreferredLanguage(e.key.url),this.$router.push(e.url)}}},ge=pe,fe=(0,V.A)(ge,U,G,!1,null,"0e39c0ba",null),me=fe.exports,ye=function(){var e=this,t=e._self._c;return t("div",{staticClass:"view-more-link"},[t("router-link",{staticClass:"base-link",attrs:{to:e.url}},[e._t("default",function(){return[e._v(e._s(e.$t("documentation.view-more")))]})],2)],1)},ve=[],be={name:"ViewMore",props:{url:{type:String,required:!0}}},Te=be,_e=(0,V.A)(Te,ye,ve,!1,null,"3f54e653",null),Se=_e.exports,ke=function(){var e=this,t=e._self._c;return t("div",{class:["documentation-hero",{"documentation-hero--disabled":!e.enhanceBackground}],style:e.styles},[t("div",{staticClass:"icon"},[e.enhanceBackground?t("TopicTypeIcon",{key:"first",staticClass:"background-icon first-icon",attrs:{type:e.type,"image-override":e.iconOverride,"with-colors":""}}):e._e()],1),t("div",{staticClass:"documentation-hero__above-content"},[e._t("above-content")],2),t("div",{staticClass:"documentation-hero__content",class:{"short-hero":e.shortHero,"extra-bottom-padding":e.shouldShowLanguageSwitcher,"minimized-hero":e.enableMinimized}},[e._t("default")],2)])},Ce=[],we=n(2670),xe=n(5689),Ae=n(7249);const Ie={red:"red",orange:"orange",yellow:"yellow",blue:"blue",green:"green",purple:"purple",gray:"gray"};var $e={name:"DocumentationHero",components:{TopicTypeIcon:we.A},props:{role:{type:String,required:!0},enhanceBackground:{type:Boolean,required:!0},enableMinimized:{type:Boolean,default:!1},shortHero:{type:Boolean,required:!0},shouldShowLanguageSwitcher:{type:Boolean,required:!0},iconOverride:{type:Object,required:!1},standardColorIdentifier:{type:String,required:!1,validator:e=>Object.prototype.hasOwnProperty.call(Ie,e)}},computed:{color:({type:e})=>Ae.z[xe.m[e]||e]||Ae.d.teal,styles:({color:e,standardColorIdentifier:t})=>({"--accent-color":`var(--color-documentation-intro-accent, var(--color-type-icon-${e}))`,"--standard-accent-color":t&&`var(--color-standard-${t}-documentation-intro-fill, var(--color-standard-${t}))`}),type:({role:e})=>{switch(e){case C.y.collection:return xe.t.module;case C.y.collectionGroup:return xe.t.collection;default:return e}}}},De=$e,Le=(0,V.A)(De,ke,Ce,!1,null,"0958f035",null),Pe=Le.exports,Oe=n(3634),Ne=n(2853),Re=function(){var e=this,t=e._self._c;return t("div",{staticClass:"OnThisPageNav"},[t("ul",{staticClass:"items"},e._l(e.onThisPageSections,function(n){return t("li",{key:n.anchor,class:e.getItemClasses(n)},[t("router-link",{staticClass:"base-link",attrs:{to:n.url},nativeOn:{click:function(t){return e.handleFocusAndScroll(n.anchor)}}},[t(e.getWrapperComponent(n),{tag:"component"},[e._v(" "+e._s(e.getTextContent(n))+" ")])],1)],1)}),0)])},Be=[];n(1701);function Ee(e,t){let n,i;return function(...a){const s=this;if(!i)return e.apply(s,a),void(i=Date.now());clearTimeout(n),n=setTimeout(()=>{Date.now()-i>=t&&(e.apply(s,a),i=Date.now())},t-(Date.now()-i))}}var Me=n(3029),ze=n(9514),Ke={name:"OnThisPageNav",components:{WordBreak:Oe.A},mixins:[ze.A],inject:{store:{default(){return{state:{onThisPageSections:[],currentPageAnchor:null}}}}},computed:{onThisPageSections:({store:e,$route:t})=>e.state.onThisPageSections.map(e=>({...e,url:(0,P.c$)(`#${e.anchor}`,t.query)})),currentPageAnchor:({store:e})=>e.state.currentPageAnchor},async mounted(){window.addEventListener("scroll",this.onScroll,!1),this.$once("hook:beforeDestroy",()=>{window.removeEventListener("scroll",this.onScroll)})},watch:{onThisPageSections:{immediate:!0,async handler(){await(0,Me.u)(8),this.onScroll()}}},methods:{onScroll:Ee(function(){const e=this.onThisPageSections.length;if(!e)return;const{scrollY:t,innerHeight:n}=window,{scrollHeight:i}=document.body,a=t+n>=i,s=t<=0,r=.3*n+t;if(s||a){const t=s?0:e-1;return void this.store.setCurrentPageSection(this.onThisPageSections[t].anchor)}let o,l,c=null;for(o=0;ot.concat(n).concat(e),space:()=>({type:Qe.A.InlineType.text,text:" "})}},Ye=Xe,Ze=(0,V.A)(Ye,Ue,Ge,!1,null,"4c6f3ed1",null),Je=Ze.exports,et=function(){var e=this,t=e._self._c;return t("div",{staticClass:"declaration-list"},e._l(e.declarationTokens,function(n){return t("transition-expand",{key:n.identifier},[!e.hasOtherDeclarations||n.identifier===e.selectedIdentifier||e.isExpanded?t("div",{staticClass:"declaration-pill",class:{"declaration-pill--expanded":e.hasOtherDeclarations&&e.isExpanded,[e.changeClasses]:e.changeType&&n.identifier===e.selectedIdentifier,"selected-declaration":e.isSelectedDeclaration(n.identifier)}},[t(e.getWrapperComponent(n),{tag:"component",staticClass:"declaration-group-wrapper",on:{click:function(t){return e.selectDeclaration(n.identifier)}}},[t("DeclarationGroup",e._b({},"DeclarationGroup",e.getDeclProp(n),!1))],1)],1):e._e()])}),1)},tt=[],nt=function(){var e=this,t=e._self._c;return t("div",{ref:"apiChangesDiff",staticClass:"declaration-group",class:e.classes},[e.shouldCaption?t("p",{staticClass:"platforms"},[t("strong",[e._v(e._s(e.caption))])]):e._e(),t("Source",{attrs:{tokens:e.declaration.tokens,language:e.interfaceLanguage}})],1)},it=[],at=function(){var e=this,t=e._self._c;return t("pre",{ref:"declarationGroup",staticClass:"source",class:{[e.multipleLinesClass]:e.displaysMultipleLines,"has-multiple-lines":e.hasMultipleLines}},[t("CodeBlock",{ref:"code"},e._l(e.formattedTokens,function(n,i){return t("Token",e._b({key:i,class:e.extraClassesFor(n)},"Token",e.propsFor(n),!1))}),1)],1)},st=[];const rt={instance:"-",klass:"+"};function ot(e){const t=e.textContent??"";if(!t.startsWith(rt.instance)&&!t.startsWith(rt.klass))return;const n=e.getElementsByClassName("token-identifier");if(n.length<2)return;const i=e.textContent.indexOf(":")+1;for(let a=1;a(0,w.PL)(["theme","code","indentationWidth"],gt),formattedTokens:({language:e,formattedSwiftTokens:t,tokens:n})=>e===$.A.swift.key.api?t:n,formattedSwiftTokens:({indentationWidth:e,tokens:t})=>{const n=" ".repeat(e);let i=!1;const a=[];let s=0,r=null,o=null,l=null,c=null,d=0,u=null;while(se===pt.attribute||e===pt.externalParam;e.text&&e.text.endsWith(", ")&&g&&f(g)&&(h.text=`${e.text.trimEnd()}\n${n}`,i=!0),a.push(h),s+=1}if(i&&null!==r){const e=a[r].text;a[r].text=`${e}\n${n}`}if(i&&null!==l){const e=a[l].text,t=e.slice(0,c),n=e.slice(c),i=`${t}\n${n}`;a[l].text=i}return a},hasMultipleLines({formattedTokens:e}){return e.reduce((t,n,i)=>{let a=/\n/g;return i===e.length-1&&(a=/\n(?!$)/g),n.text?t+(n.text.match(a)||[]).length:t},1)>=2}},methods:{propsFor(e){return{kind:e.kind,identifier:e.identifier,text:e.text,tokens:e.tokens}},handleWindowResize(){this.displaysMultipleLines=(0,ct.n)(this.$refs.declarationGroup)},extraClassesFor(e){return{highlighted:e.highlight===ft.changed}}},async mounted(){window.addEventListener("resize",this.handleWindowResize),this.language===$.A.objectiveC.key.api&&(await this.$nextTick(),lt(this.$refs.code.$el,this.language)),this.handleWindowResize()},beforeDestroy(){window.removeEventListener("resize",this.handleWindowResize)}},yt=mt,vt=(0,V.A)(yt,at,st,!1,null,"dc9cfb3a",null),bt=vt.exports,Tt=n(8184),_t={name:"DeclarationGroup",components:{Source:bt},mixins:[Tt.z_],inject:{languages:{default:()=>new Set},interfaceLanguage:{default:()=>$.A.swift.key.api},symbolKind:{default:()=>{}}},props:{declaration:{type:Object,required:!0},shouldCaption:{type:Boolean,default:!1},changeType:{type:String,required:!1}},computed:{classes:({changeType:e,multipleLinesClass:t,displaysMultipleLinesAfterAPIChanges:n})=>({[`declaration-group--changed declaration-group--${e}`]:e,[t]:n}),caption(){return this.declaration.platforms.join(", ")}}},St=_t,kt=(0,V.A)(St,nt,it,!1,null,"f961f3da",null),Ct=kt.exports,wt=n(6088),xt={name:"DeclarationList",components:{DeclarationGroup:Ct,TransitionExpand:wt.A},data(){return{selectedIdentifier:this.identifier}},inject:{store:{default:()=>({state:{references:{}}})},identifier:{default:()=>{}}},props:{declaration:{type:Object,required:!0},shouldCaption:{type:Boolean,default:!1},changeType:{type:String,required:!1},declListExpanded:{type:Boolean,default:!1}},computed:{changeClasses:({changeType:e})=>`changed changed-${e}`,hasOtherDeclarations:({declaration:e})=>e.otherDeclarations||null,declarationTokens:({declaration:e,hasOtherDeclarations:t,identifier:n})=>{if(!t)return[{...e,identifier:n}];const{otherDeclarations:{declarations:i,displayIndex:a},tokens:s}=e;return[...i.slice(0,a),{tokens:s,identifier:n},...i.slice(a)]},references:({store:e})=>e.state.references,isExpanded:{get:({declListExpanded:e})=>e,set(e){this.$emit("update:declListExpanded",e)}}},methods:{async selectDeclaration(e){if(e===this.identifier||!this.isExpanded)return;this.selectedIdentifier=e,await this.$nextTick(),this.isExpanded=!1,await(0,Me.f)(500);const t=(0,P.c$)(this.references[e].url,this.$route.query);this.$router.push(t)},getWrapperComponent(e){return this.isExpanded&&e.identifier!==this.identifier?"button":"div"},getDeclProp(e){return this.hasOtherDeclarations&&e.identifier!==this.identifier?{declaration:e}:{declaration:e,shouldCaption:this.shouldCaption,changeType:this.changeType}},isSelectedDeclaration(e){return e===this.selectedIdentifier}}},At=xt,It=(0,V.A)(At,et,tt,!1,null,"18e7c20c",null),$t=It.exports,Dt=function(){var e=this,t=e._self._c;return t("div",{staticClass:"declaration-diff"},[t("div",{staticClass:"declaration-diff-current"},[t("div",{staticClass:"declaration-diff-version"},[e._v("Current")]),e._l(e.currentDeclarations,function(n,i){return t("DeclarationList",{key:i,attrs:{declaration:n,"should-caption":e.currentDeclarations.length>1}})})],2),t("div",{staticClass:"declaration-diff-previous"},[t("div",{staticClass:"declaration-diff-version"},[e._v("Previous")]),e._l(e.previousDeclarations,function(n,i){return t("DeclarationList",{key:i,attrs:{declaration:n,"should-caption":e.previousDeclarations.length>1}})})],2)])},Lt=[],Pt={name:"DeclarationDiff",components:{DeclarationList:$t},props:{changes:{type:Object,required:!0}},computed:{previousDeclarations:({changes:e})=>e.declaration.previous||[],currentDeclarations:({changes:e})=>e.declaration.new||[]}},Ot=Pt,Nt=(0,V.A)(Ot,Dt,Lt,!1,null,"0c2301a5",null),Rt=Nt.exports,Bt=function(){var e=this,t=e._self._c;return t("a",{staticClass:"declaration-source-link",attrs:{href:e.url,title:`Open source file for ${e.fileName}`,target:"_blank"}},[e.isSwiftFile?t("SwiftFileIcon",{staticClass:"declaration-icon"}):e._e(),t("WordBreak",[e._v(e._s(e.fileName))])],1)},Et=[],Mt=n(5747),zt={name:"DeclarationSourceLink",components:{WordBreak:Oe.A,SwiftFileIcon:Mt.A},props:{url:{type:String,required:!0},fileName:{type:String,required:!0}},computed:{isSwiftFile:({fileName:e})=>e.endsWith(".swift")}},Kt=zt,qt=(0,V.A)(Kt,Bt,Et,!1,null,"5863919c",null),jt=qt.exports,Ft=n(1672),Vt={name:"Declaration",components:{DeclarationDiff:Rt,DeclarationList:$t,DeclarationSourceLink:jt,ConditionalConstraints:Je},constants:{ChangeTypes:Ft.wi,multipleLinesClass:dt.W},inject:["identifier","store"],data:({store:{state:e}})=>({state:e,multipleLinesClass:dt.W}),props:{conformance:{type:Object,required:!1},source:{type:Object,required:!1},declarations:{type:Array,required:!0},declListExpanded:{type:Boolean,default:!1}},computed:{hasPlatformVariants:({declarations:e})=>!e.every(({platforms:t})=>(0,N.n4)(t,e[0].platforms)),hasModifiedChanges({declarationChanges:e}){if(!e||!e.declaration)return!1;const t=e.declaration;return!(!(t.new||[]).length||!(t.previous||[]).length)},declarationChanges:({state:{apiChanges:e},identifier:t})=>e&&e[t],changeType:({declarationChanges:e,hasModifiedChanges:t})=>{if(!e)return;const n=e.declaration;return n?t?Ft.wi.modified:e.change:e.change===Ft.wi.added?Ft.wi.added:void 0},changeClasses:({changeType:e})=>({[`changed changed-${e}`]:e}),isExpanded:{get:({declListExpanded:e})=>e,set(e){this.$emit("update:declListExpanded",e)}}}},Ht=Vt,Wt=(0,V.A)(Ht,He,We,!1,null,"722d45cf",null),Ut=Wt.exports,Gt=n(5948),Qt=function(){var e=this,t=e._self._c;return t("ContentNode",e._b({staticClass:"abstract"},"ContentNode",e.$props,!1))},Xt=[],Yt={name:"Abstract",components:{ContentNode:Qe.A},props:Qe.A.props},Zt=Yt,Jt=(0,V.A)(Zt,Qt,Xt,!1,null,"f3f57cbe",null),en=Jt.exports,tn=n(1290),nn=function(){var e=this,t=e._self._c;return t("TopicsTable",{attrs:{anchor:e.contentSectionData.anchor,title:e.$t(e.contentSectionData.title),isSymbolDeprecated:e.isSymbolDeprecated,isSymbolBeta:e.isSymbolBeta,sections:e.sections,wrapTitle:!0}})},an=[];const sn={topics:{title:"sections.topics",anchor:"topics",level:2},defaultImplementations:{title:"sections.default-implementations",anchor:"default-implementations",level:2},relationships:{title:"sections.relationships",anchor:"relationships",level:2},seeAlso:{title:"sections.see-also",anchor:"see-also",level:2}},rn={[Ve.attributes]:{title:"sections.attributes",anchor:"attributes",level:2},[Ve.details]:{title:"sections.details",anchor:"details",level:2},[Ve.parameters]:{title:"sections.parameters",anchor:"parameters",level:2},[Ve.possibleValues]:{title:"sections.possible-values",anchor:"possibleValues",level:2}};var on=function(){var e=this,t=e._self._c;return t("ContentTable",{attrs:{anchor:e.anchor,title:e.title}},e._l(e.sectionsWithTopics,function(n,i){return t("ContentTableSection",{key:`${n.title}_${i}`,class:{"no-title":!n.title},attrs:{title:n.title,anchor:n.anchor},scopedSlots:e._u([n.title&&e.wrapTitle?{key:"title",fn:function({className:i}){return[t("LinkableHeading",{class:i,attrs:{level:3,anchor:n.anchor}},[t("WordBreak",[e._v(e._s(n.title))])],1)]}}:null,n.abstract?{key:"abstract",fn:function(){return[t("ContentNode",{attrs:{content:n.abstract}})]},proxy:!0}:null,n.discussion?{key:"discussion",fn:function(){return[t("ContentNode",{attrs:{content:n.discussion.content}})]},proxy:!0}:null],null,!0)},[e.shouldRenderList?e._l(n.topics,function(n){return t("TopicsLinkBlock",{key:n.identifier,staticClass:"topic",attrs:{topic:n,isSymbolDeprecated:e.isSymbolDeprecated,isSymbolBeta:e.isSymbolBeta}})}):t("TopicsLinkCardGrid",{staticClass:"topic",attrs:{items:n.topics,topicStyle:e.topicStyle}})],2)}),1)},ln=[],cn=n(4885),dn=n(3117),un=n(4783),hn=function(){var e=this,t=e._self._c;return t("section",{staticClass:"contenttable alt-light"},[t("div",{class:["container",{"minimized-container":e.enableMinimized}]},[t("LinkableHeading",{staticClass:"title",attrs:{anchor:e.anchor}},[e._v(e._s(e.title))]),e._t("default")],2)])},pn=[],gn={name:"ContentTable",components:{LinkableHeading:dn.A},props:{anchor:{type:String,required:!0},title:{type:String,required:!0},enableMinimized:{type:Boolean,default:!1}}},fn=gn,mn=(0,V.A)(fn,hn,pn,!1,null,"0e6b292c",null),yn=mn.exports,vn=function(){var e=this,t=e._self._c;return t("div",{staticClass:"contenttable-section"},[t("div",{staticClass:"section-title"},[e._t("title",function(){return[e.title?t("LinkableHeading",{class:e.className,attrs:{level:3,anchor:e.anchorComputed}},[e._v(e._s(e.title))]):e._e()]},{className:e.className})],2),t("div",{staticClass:"section-content"},[e._t("abstract"),e._t("discussion"),e._t("default")],2)])},bn=[],Tn=n(6043);const _n="contenttable-title";var Sn={name:"ContentTableSection",components:{LinkableHeading:dn.A},props:{title:{type:String,required:!1},anchor:{type:String,default:null}},computed:{anchorComputed:({title:e,anchor:t})=>t||(0,Tn.ql)(e||""),className:()=>_n}},kn=Sn,Cn=(0,V.A)(kn,vn,bn,!1,null,"1b0546d9",null),wn=Cn.exports,xn=n(3981),An={name:"TopicsTable",mixins:[un.A],components:{TopicsLinkCardGrid:cn.A,WordBreak:Oe.A,ContentTable:yn,TopicsLinkBlock:xn["default"],ContentNode:Qe.A,ContentTableSection:wn,LinkableHeading:dn.A},props:{isSymbolDeprecated:Boolean,isSymbolBeta:Boolean,sections:{type:Array,required:!0},title:{type:String,required:!1,default(){return"Topics"}},anchor:{type:String,required:!1,default(){return"topics"}},wrapTitle:{type:Boolean,default:!1},topicStyle:{type:String,default:Ne.Z.list}},computed:{shouldRenderList:({topicStyle:e})=>e===Ne.Z.list,sectionsWithTopics(){return this.sections.map(e=>({...e,topics:e.identifiers.reduce((e,t)=>this.references[t]?e.concat(this.references[t]):e,[])}))}}},In=An,$n=(0,V.A)(In,on,ln,!1,null,"1c2724f5",null),Dn=$n.exports,Ln={name:"DefaultImplementations",components:{TopicsTable:Dn},computed:{contentSectionData:()=>sn.defaultImplementations},props:{isSymbolDeprecated:Boolean,isSymbolBeta:Boolean,sections:Dn.props.sections}},Pn=Ln,On=(0,V.A)(Pn,nn,an,!1,null,null,null),Nn=On.exports,Rn=function(){var e=this,t=e._self._c;return t("div",{staticClass:"primary-content"},e._l(e.sections,function(n,i){return t(e.componentFor(n),e._b({key:i,tag:"component"},"component",e.propsFor(n),!1))}),1)},Bn=[],En=function(){var e=this,t=e._self._c;return t("section",{staticClass:"attributes"},[t("LinkableHeading",{attrs:{anchor:e.section.anchor,level:e.section.level}},[e._v(" "+e._s(e.$t(e.section.title))+" ")]),t("ParameterAttributes",{attrs:{attributes:e.attributes}})],1)},Mn=[],zn=function(){var e=this,t=e._self._c;return t("div",{staticClass:"parameter-attributes"},[e.shouldRender(e.AttributeKind.default)?t("ParameterMetaAttribute",e._b({scopedSlots:e._u([{key:"default",fn:function({attribute:n}){return[e._v(" "+e._s(e.$t("formats.colon",{content:n.title||e.$t("parameters.default")}))),t("code",[e._v(e._s(n.value))])]}}],null,!1,2998238055)},"ParameterMetaAttribute",{kind:e.AttributeKind.default,attributes:e.attributesObject,changes:e.changes},!1)):e._e(),e.shouldRender(e.AttributeKind.minimum)?t("ParameterMetaAttribute",e._b({scopedSlots:e._u([{key:"default",fn:function({attribute:n}){return[e._v(" "+e._s(e.$t("formats.colon",{content:n.title||e.$t("parameters.minimum")}))),t("code",[e._v(e._s(n.value))])]}}],null,!1,859757818)},"ParameterMetaAttribute",{kind:e.AttributeKind.minimum,attributes:e.attributesObject,changes:e.changes},!1)):e._e(),e.shouldRender(e.AttributeKind.minimumExclusive)?t("ParameterMetaAttribute",e._b({scopedSlots:e._u([{key:"default",fn:function({attribute:n}){return[e._v(" "+e._s(e.$t("formats.colon",{content:n.title||e.$t("parameters.minimum")}))),t("code",[e._v("> "+e._s(n.value))])]}}],null,!1,770347247)},"ParameterMetaAttribute",{kind:e.AttributeKind.minimumExclusive,attributes:e.attributesObject,changes:e.changes},!1)):e._e(),e.shouldRender(e.AttributeKind.minimumLength)?t("ParameterMetaAttribute",e._b({scopedSlots:e._u([{key:"default",fn:function({attribute:n}){return[e._v(" "+e._s(e.$t("formats.colon",{content:n.title||e.$t("parameters.minimumLength")}))),t("code",[e._v(e._s(n.value))])]}}],null,!1,1723084358)},"ParameterMetaAttribute",{kind:e.AttributeKind.minimumLength,attributes:e.attributesObject,changes:e.changes},!1)):e._e(),e.shouldRender(e.AttributeKind.maximum)?t("ParameterMetaAttribute",e._b({scopedSlots:e._u([{key:"default",fn:function({attribute:n}){return[e._v(" "+e._s(e.$t("formats.colon",{content:n.title||e.$t("parameters.maximum")}))),t("code",[e._v(e._s(n.value))])]}}],null,!1,1190666532)},"ParameterMetaAttribute",{kind:e.AttributeKind.maximum,attributes:e.attributesObject,changes:e.changes},!1)):e._e(),e.shouldRender(e.AttributeKind.maximumExclusive)?t("ParameterMetaAttribute",e._b({scopedSlots:e._u([{key:"default",fn:function({attribute:n}){return[e._v(" "+e._s(e.$t("formats.colon",{content:n.title||e.$t("parameters.maximum")}))),t("code",[e._v("< "+e._s(n.value))])]}}],null,!1,1156490099)},"ParameterMetaAttribute",{kind:e.AttributeKind.maximumExclusive,attributes:e.attributesObject,changes:e.changes},!1)):e._e(),e.shouldRender(e.AttributeKind.maximumLength)?t("ParameterMetaAttribute",e._b({scopedSlots:e._u([{key:"default",fn:function({attribute:n}){return[e._v(" "+e._s(e.$t("formats.colon",{content:n.title||e.$t("parameters.maximumLength")}))),t("code",[e._v(e._s(n.value))])]}}],null,!1,449455512)},"ParameterMetaAttribute",{kind:e.AttributeKind.maximumLength,attributes:e.attributesObject,changes:e.changes},!1)):e._e(),e.shouldRender(e.AttributeKind.allowedTypes)?t("ParameterMetaAttribute",e._b({scopedSlots:e._u([{key:"default",fn:function({attribute:n}){return[e._v(" "+e._s(e.$t("formats.colon",{content:e.$tc("parameters.possible-types",e.fallbackToValues(n).length)}))),t("code",[e._l(e.fallbackToValues(n),function(i,a){return[e._l(i,function(i,s){return[t("DeclarationToken",e._b({key:`${a}-${s}`},"DeclarationToken",i,!1)),a+1({new:null,previous:null})},value:{type:[Object,Array,String,Boolean],default:null},wrapChanges:{type:Boolean,default:!0},renderSingleChange:{type:Boolean,default:!1}},render(e){const{value:t,changes:n={},wrapChanges:i,renderSingleChange:a}=this,{new:s,previous:r}=n,o=(t,n)=>{const a=this.$scopedSlots.default({value:t});return n&&i?e("div",{class:n},[a]):a?a[0]:null};if(s||r){const t=o(s,Fn.added),n=o(r,Fn.removed);return a?s&&!r?t:n:e("div",{class:"property-changegroup"},[s?t:"",r?n:""])}return o(t)}},Un=Wn,Gn=(0,V.A)(Un,Vn,Hn,!1,null,null,null),Qn=Gn.exports,Xn={name:"ParameterMetaAttribute",components:{RenderChanged:Qn},props:{kind:{type:String,required:!0},attributes:{type:Object,required:!0},changes:{type:Object,default:()=>({})}}},Yn=Xn,Zn=(0,V.A)(Yn,qn,jn,!1,null,"f911f232",null),Jn=Zn.exports;const ei={allowedTypes:"allowedTypes",allowedValues:"allowedValues",default:"default",maximum:"maximum",maximumExclusive:"maximumExclusive",maximumLength:"maximumLength",minimum:"minimum",minimumExclusive:"minimumExclusive",minimumLength:"minimumLength"};var ti={name:"ParameterAttributes",components:{ParameterMetaAttribute:Jn,DeclarationToken:ht.A},constants:{AttributeKind:ei},props:{attributes:{type:Array,default:()=>[]},changes:{type:Object,default:()=>({})}},computed:{AttributeKind:()=>ei,attributesObject:({attributes:e})=>e.reduce((e,t)=>({...e,[t.kind]:t}),{})},methods:{shouldRender(e){return Object.prototype.hasOwnProperty.call(this.attributesObject,e)},fallbackToValues:e=>{const t=e||[];return Array.isArray(t)?t:t.values}}},ni=ti,ii=(0,V.A)(ni,zn,Kn,!1,null,null,null),ai=ii.exports,si={name:"Attributes",components:{LinkableHeading:dn.A,ParameterAttributes:ai},props:{attributes:{type:Array,required:!0}},computed:{section:({sectionKind:e})=>rn[e],sectionKind:()=>Ve.attributes}},ri=si,oi=(0,V.A)(ri,En,Mn,!1,null,"c0edcb84",null),li=oi.exports,ci=function(){var e=this,t=e._self._c;return t("section",[t("LinkableHeading",{attrs:{anchor:e.contentSectionData.anchor}},[e._v(" "+e._s(e.$t(e.contentSectionData.title))+" ")]),t("dl",{staticClass:"datalist"},[e._l(e.values,function(n){return[t("dt",{key:`${n.name}:name`,staticClass:"param-name"},[t("WordBreak",{attrs:{tag:"code"}},[e._v(e._s(n.name))])],1),n.content?t("dd",{key:`${n.name}:content`,staticClass:"value-content"},[t("ContentNode",{attrs:{content:n.content}})],1):e._e()]})],2)],1)},di=[],ui=n(9),hi={name:"PossibleValues",components:{ContentNode:ui["default"],LinkableHeading:dn.A,WordBreak:Oe.A},props:{values:{type:Array,required:!0}},computed:{contentSectionData:()=>rn[Ve.possibleValues]}},pi=hi,gi=(0,V.A)(pi,ci,di,!1,null,null,null),fi=gi.exports,mi=function(){var e=this,t=e._self._c;return t("section",[t("LinkableHeading",{attrs:{anchor:e.anchor}},[e._v(e._s(e.title))]),t("DeclarationSource",{attrs:{tokens:e.tokens}})],1)},yi=[],vi={name:"RestEndpoint",components:{DeclarationSource:bt,LinkableHeading:dn.A},props:{title:{type:String,required:!0},tokens:{type:Array,required:!0}},computed:{anchor:({title:e})=>(0,Tn.ql)(e)}},bi=vi,Ti=(0,V.A)(bi,mi,yi,!1,null,null,null),_i=Ti.exports,Si=function(){var e=this,t=e._self._c;return t("section",{staticClass:"details"},[t("LinkableHeading",{attrs:{anchor:e.contentSectionData.anchor}},[e._v(" "+e._s(e.$t(e.contentSectionData.title))+" ")]),t("dl",[e.isSymbol?[t("dt",{key:`${e.details.name}:name`,staticClass:"detail-type"},[e._v(" "+e._s(e.$t("metadata.details.name"))+" ")]),t("dd",{key:`${e.details.ideTitle}:content`,staticClass:"detail-content"},[e._v(" "+e._s(e.details.ideTitle)+" ")])]:e._e(),e.isTitle?[t("dt",{key:`${e.details.name}:key`,staticClass:"detail-type"},[e._v(" "+e._s(e.$t("metadata.details.key"))+" ")]),t("dd",{key:`${e.details.ideTitle}:content`,staticClass:"detail-content"},[e._v(" "+e._s(e.details.name)+" ")])]:e._e(),t("dt",{key:`${e.details.name}:type`,staticClass:"detail-type"},[e._v(" "+e._s(e.$t("metadata.details.type"))+" ")]),t("dd",{staticClass:"detail-content"},[t("PropertyListKeyType",{attrs:{types:e.details.value}})],1)],2)],1)},ki=[],Ci=function(){var e=this,t=e._self._c;return t("div",{staticClass:"type"},[e._v(e._s(e.typeOutput))])},wi=[],xi={name:"PropertyListKeyType",props:{types:{type:Array,required:!0}},computed:{englishTypes(){return this.sanitizedTypes.map(({arrayMode:e,baseType:t="*"})=>e?`array of ${this.pluralizeKeyType(t)}`:t)},sanitizedTypes:({sanitizeType:e,types:t})=>t.map(e),typeOutput(){return this.englishTypes.length>2?[this.englishTypes.slice(0,this.englishTypes.length-1).join(", "),this.englishTypes[this.englishTypes.length-1]].join(", or "):this.englishTypes.join(" or ")}},methods:{pluralizeKeyType(e){switch(e){case"dictionary":return"dictionaries";case"array":case"number":case"string":return`${e}s`;default:return e}},sanitizeType(e){const{baseType:t}=e;return t?{...e,baseType:t.trim()}:e}}},Ai=xi,Ii=(0,V.A)(Ai,Ci,wi,!1,null,"380373e1",null),$i=Ii.exports,Di={name:"PropertyListKeyDetails",components:{PropertyListKeyType:$i,LinkableHeading:dn.A},props:{details:{type:Object,required:!0}},computed:{contentSectionData:()=>rn[Ve.details],isTitle(){return"title"===this.details.titleStyle&&this.details.ideTitle},isSymbol(){return"symbol"===this.details.titleStyle&&this.details.ideTitle}}},Li=Di,Pi=(0,V.A)(Li,Si,ki,!1,null,"d66cd00c",null),Oi=Pi.exports,Ni=function(){var e=this,t=e._self._c;return t("section",{staticClass:"parameters"},[t("LinkableHeading",{attrs:{anchor:e.contentSectionData.anchor}},[e._v(" "+e._s(e.$t(e.contentSectionData.title))+" ")]),t("dl",[e._l(e.parameters,function(n){return[t("dt",{key:`${n.name}:name`,staticClass:"param-name"},[t("code",[e._v(e._s(n.name))])]),t("dd",{key:`${n.name}:content`,staticClass:"param-content"},[t("ContentNode",{attrs:{content:n.content}})],1)]})],2)],1)},Ri=[],Bi={name:"Parameters",components:{ContentNode:Qe.A,LinkableHeading:dn.A},props:{parameters:{type:Array,required:!0}},computed:{contentSectionData:()=>rn[Ve.parameters]}},Ei=Bi,Mi=(0,V.A)(Ei,Ni,Ri,!1,null,"b258c830",null),zi=Mi.exports,Ki=function(){var e=this,t=e._self._c;return t("section",[t("LinkableHeading",{attrs:{anchor:e.anchor}},[e._v(e._s(e.title))]),t("ParametersTable",{staticClass:"property-table",attrs:{parameters:e.properties,changes:e.propertyChanges},scopedSlots:e._u([{key:"symbol",fn:function({name:n,type:i,content:a,changes:s,deprecated:r}){return[t("div",{staticClass:"property-name",class:{deprecated:r}},[t("WordBreak",{attrs:{tag:"code"}},[e._v(e._s(n))])],1),e.shouldShiftType({name:n,content:a})?e._e():t("PossiblyChangedType",{attrs:{type:i,changes:s.type}})]}},{key:"description",fn:function({name:n,type:i,attributes:a,content:s,required:r,changes:o,deprecated:l,readOnly:c}){return[e.shouldShiftType({name:n,content:s})?t("PossiblyChangedType",{attrs:{type:i,changes:o.type}}):e._e(),l?[t("Badge",{staticClass:"property-deprecated",attrs:{variant:"deprecated"}}),e._v("  ")]:e._e(),t("PossiblyChangedTextAttribute",{attrs:{changes:o.required,value:r}},[e._v(" "+e._s(e.$t("formats.parenthesis",{content:e.$t("required")}))+" ")]),t("PossiblyChangedTextAttribute",{attrs:{changes:o.readOnly,value:c}},[e._v(" "+e._s(e.$t("formats.parenthesis",{content:e.$t("read-only")}))+" ")]),s?t("ContentNode",{attrs:{content:s}}):e._e(),t("ParameterAttributes",{attrs:{attributes:a,changes:o.attributes}})]}}])})],1)},qi=[],ji={inject:["identifier","store"],data:({store:{state:e}})=>({state:e}),computed:{apiChanges:({state:{apiChanges:e},identifier:t})=>e&&e[t]}},Fi=n(4791),Vi=function(){var e=this,t=e._self._c;return t("div",{staticClass:"parameters-table"},e._l(e.parameters,function(n){return t("Row",{key:n[e.keyBy],staticClass:"param",class:e.changedClasses(n[e.keyBy])},[t("Column",{staticClass:"param-symbol",attrs:{span:{large:3,small:12}}},[e._t("symbol",null,null,e.getProps(n,e.changes[n[e.keyBy]]))],2),t("Column",{staticClass:"param-content",attrs:{span:{large:9,small:12}}},[e._t("description",null,null,e.getProps(n,e.changes[n[e.keyBy]]))],2)],1)}),1)},Hi=[],Wi={name:"ParametersTable",components:{Row:K.A,Column:q.A},props:{parameters:{type:Array,required:!0},changes:{type:Object,default:()=>({})},keyBy:{type:String,default:"name"}},methods:{getProps(e,t={}){return{...e,changes:t}},changedClasses(e){const{changes:t}=this,{change:n}=t[e]||{};return{[`changed changed-${n}`]:n}}}},Ui=Wi,Gi=(0,V.A)(Ui,Vi,Hi,!1,null,"eee7e94e",null),Qi=Gi.exports,Xi=function(){var e=this,t=e._self._c;return t("RenderChanged",{attrs:{renderSingleChange:"",value:e.value,changes:e.changes},scopedSlots:e._u([{key:"default",fn:function({value:n}){return[n?t("span",{staticClass:"property-text"},[e._t("default")],2):e._e()]}}],null,!0)})},Yi=[],Zi={name:"PossiblyChangedTextAttribute",components:{RenderChanged:Qn},props:{changes:{type:Object,required:!1},value:{type:Boolean,default:!1}}},Ji=Zi,ea=(0,V.A)(Ji,Xi,Yi,!1,null,null,null),ta=ea.exports,na=function(){var e=this,t=e._self._c;return t("RenderChanged",{attrs:{value:e.type,wrapChanges:!1,changes:e.changes},scopedSlots:e._u([{key:"default",fn:function({value:n}){return[t("DeclarationTokenGroup",{staticClass:"property-metadata property-type",attrs:{type:e.getValues(n)}})]}}])})},ia=[],aa=function(){var e=this,t=e._self._c;return e.type&&e.type.length?t("div",[t("code",e._l(e.type,function(n,i){return t("DeclarationToken",e._b({key:i},"DeclarationToken",n,!1))}),1)]):e._e()},sa=[],ra={name:"DeclarationTokenGroup",components:{DeclarationToken:ht.A},props:{type:{type:Array,default:()=>[],required:!1}}},oa=ra,la=(0,V.A)(oa,aa,sa,!1,null,null,null),ca=la.exports,da={name:"PossiblyChangedType",components:{DeclarationTokenGroup:ca,RenderChanged:Qn},props:{type:{type:Array,required:!0},changes:{type:Object,required:!1}},methods:{getValues(e){return Array.isArray(e)?e:e.values}}},ua=da,ha=(0,V.A)(ua,na,ia,!1,null,"549ed0a8",null),pa=ha.exports,ga={name:"PropertyTable",mixins:[ji],components:{Badge:Fi.A,WordBreak:Oe.A,PossiblyChangedTextAttribute:ta,PossiblyChangedType:pa,ParameterAttributes:ai,ContentNode:Qe.A,ParametersTable:Qi,LinkableHeading:dn.A},props:{title:{type:String,required:!0},properties:{type:Array,required:!0}},computed:{anchor:({title:e})=>(0,Tn.ql)(e),propertyChanges:({apiChanges:e})=>(e||{}).properties},methods:{shouldShiftType:({content:e=[],name:t})=>!e.length&&t}},fa=ga,ma=(0,V.A)(fa,Ki,qi,!1,null,"39899ccf",null),ya=ma.exports,va=function(){var e=this,t=e._self._c;return t("section",[t("LinkableHeading",{attrs:{anchor:e.anchor}},[e._v(e._s(e.title))]),t("ParametersTable",{attrs:{parameters:[e.bodyParam],changes:e.bodyChanges,keyBy:"key"},scopedSlots:e._u([{key:"symbol",fn:function({type:n,content:i,changes:a,name:s}){return[e.shouldShiftType({name:s,content:i})?e._e():t("PossiblyChangedType",{attrs:{type:n,changes:a.type}})]}},{key:"description",fn:function({name:n,content:i,mimeType:a,type:s,changes:r}){return[e.shouldShiftType({name:n,content:i})?t("PossiblyChangedType",{attrs:{type:s,changes:r.type}}):e._e(),i?t("ContentNode",{attrs:{content:i}}):e._e(),a?t("PossiblyChangedMimetype",{attrs:{mimetype:a,changes:r.mimetype,change:r.change}}):e._e()]}}])}),e.parts.length?[t("h3",[e._v(e._s(e.$t("sections.parts")))]),t("ParametersTable",{staticClass:"parts",attrs:{parameters:e.parts,changes:e.partsChanges},scopedSlots:e._u([{key:"symbol",fn:function({name:n,type:i,content:a,changes:s}){return[t("div",{staticClass:"part-name"},[t("WordBreak",{attrs:{tag:"code"}},[e._v(e._s(n))])],1),a?t("PossiblyChangedType",{attrs:{type:i,changes:s.type}}):e._e()]}},{key:"description",fn:function({content:n,mimeType:i,required:a,type:s,attributes:r,changes:o,readOnly:l}){return[t("div",[n?e._e():t("PossiblyChangedType",{attrs:{type:s,changes:o.type}}),t("PossiblyChangedTextAttribute",{attrs:{changes:o.required,value:a}},[e._v("(Required) ")]),t("PossiblyChangedTextAttribute",{attrs:{changes:o.readOnly,value:l}},[e._v("(Read only) ")]),n?t("ContentNode",{attrs:{content:n}}):e._e(),i?t("PossiblyChangedMimetype",{attrs:{mimetype:i,changes:o.mimetype,change:o.change}}):e._e(),t("ParameterAttributes",{attrs:{attributes:r,changes:o.attributes}})],1)]}}],null,!1,1779956822)})]:e._e()],2)},ba=[],Ta=function(){var e=this,t=e._self._c;return t("RenderChanged",{attrs:{changes:e.changeValues,value:e.mimetype},scopedSlots:e._u([{key:"default",fn:function({value:n}){return[t("div",{staticClass:"response-mimetype"},[e._v(" "+e._s(e.$t("content-type",{value:n}))+" ")])]}}])})},_a=[],Sa={name:"PossiblyChangedMimetype",components:{RenderChanged:Qn},props:{mimetype:{type:String,required:!0},changes:{type:[Object,String],required:!1},change:{type:String,required:!1}},computed:{changeValues({change:e,changes:t}){return e===Ft.wi.modified&&"string"!==typeof t?t:void 0}}},ka=Sa,Ca=(0,V.A)(ka,Ta,_a,!1,null,"18890a0f",null),wa=Ca.exports;const xa="restRequestBody";var Aa={name:"RestBody",mixins:[ji],components:{PossiblyChangedMimetype:wa,PossiblyChangedTextAttribute:ta,PossiblyChangedType:pa,WordBreak:Oe.A,ParameterAttributes:ai,ContentNode:Qe.A,ParametersTable:Qi,LinkableHeading:dn.A},constants:{ChangesKey:xa},props:{bodyContentType:{type:Array,required:!0},content:{type:Array},mimeType:{type:String,required:!0},parts:{type:Array,default:()=>[]},title:{type:String,required:!0}},computed:{anchor:({title:e})=>(0,Tn.ql)(e),bodyParam:({bodyContentType:e,content:t,mimeType:n})=>({key:xa,content:t,mimeType:n,type:e}),bodyChanges:({apiChanges:e})=>e||{},partsChanges:({bodyChanges:e})=>(e[xa]||{}).parts},methods:{shouldShiftType:({content:e=[],name:t})=>!e.length&&t}},Ia=Aa,$a=(0,V.A)(Ia,va,ba,!1,null,"68facc94",null),Da=$a.exports,La=function(){var e=this,t=e._self._c;return t("section",[t("LinkableHeading",{attrs:{anchor:e.anchor}},[e._v(e._s(e.title))]),t("ParametersTable",{attrs:{parameters:e.parameters,changes:e.parameterChanges},scopedSlots:e._u([{key:"symbol",fn:function({name:n,type:i,content:a,changes:s,deprecated:r}){return[t("div",{staticClass:"param-name",class:{deprecated:r}},[t("WordBreak",{attrs:{tag:"code"}},[e._v(e._s(n))])],1),e.shouldShiftType({content:a,name:n})?e._e():t("PossiblyChangedType",{attrs:{type:i,changes:s.type}})]}},{key:"description",fn:function({name:n,type:i,content:a,required:s,attributes:r,changes:o,deprecated:l,readOnly:c}){return[t("div",[e.shouldShiftType({content:a,name:n})?t("PossiblyChangedType",{attrs:{type:i,changes:o.type}}):e._e(),l?[t("Badge",{staticClass:"param-deprecated",attrs:{variant:"deprecated"}}),e._v("  ")]:e._e(),t("PossiblyChangedTextAttribute",{attrs:{changes:o.required,value:s}},[e._v(" "+e._s(e.$t("formats.parenthesis",{content:e.$t("required")}))+" ")]),t("PossiblyChangedTextAttribute",{attrs:{changes:o.readOnly,value:c}},[e._v(" "+e._s(e.$t("formats.parenthesis",{content:e.$t("read-only")}))+" ")]),a?t("ContentNode",{attrs:{content:a}}):e._e(),t("ParameterAttributes",{attrs:{attributes:r,changes:o}})],2)]}}])})],1)},Pa=[],Oa={name:"RestParameters",mixins:[ji],components:{Badge:Fi.A,PossiblyChangedType:pa,PossiblyChangedTextAttribute:ta,ParameterAttributes:ai,WordBreak:Oe.A,ContentNode:Qe.A,ParametersTable:Qi,LinkableHeading:dn.A},props:{title:{type:String,required:!0},parameters:{type:Array,required:!0}},computed:{anchor:({title:e})=>(0,Tn.ql)(e),parameterChanges:({apiChanges:e})=>(e||{}).restParameters},methods:{shouldShiftType:({content:e=[],name:t})=>!e.length&&t}},Na=Oa,Ra=(0,V.A)(Na,La,Pa,!1,null,"0d9b752e",null),Ba=Ra.exports,Ea=function(){var e=this,t=e._self._c;return t("section",[t("LinkableHeading",{attrs:{anchor:e.anchor}},[e._v(e._s(e.title))]),t("ParametersTable",{attrs:{parameters:e.sanitizedResponses,changes:e.propertyChanges,"key-by":"status"},scopedSlots:e._u([{key:"symbol",fn:function({status:n,type:i,reason:a,content:s,changes:r}){return[t("div",{staticClass:"response-name"},[t("code",[e._v(" "+e._s(n)+" "),t("span",{staticClass:"reason"},[e._v(e._s(a))])])]),e.shouldShiftType({content:s,reason:a,status:n})?e._e():t("PossiblyChangedType",{attrs:{type:i,changes:r.type}})]}},{key:"description",fn:function({content:n,mimeType:i,reason:a,type:s,status:r,changes:o}){return[e.shouldShiftType({content:n,reason:a,status:r})?t("PossiblyChangedType",{attrs:{type:s,changes:o.type}}):e._e(),t("div",{staticClass:"response-reason"},[t("code",[e._v(e._s(a))])]),n?t("ContentNode",{attrs:{content:n}}):e._e(),i?t("PossiblyChangedMimetype",{attrs:{mimetype:i,changes:o.mimetype,change:o.change}}):e._e()]}}])})],1)},Ma=[],za={name:"RestResponses",mixins:[ji],components:{PossiblyChangedMimetype:wa,PossiblyChangedType:pa,ContentNode:Qe.A,ParametersTable:Qi,LinkableHeading:dn.A},props:{title:{type:String,required:!0},responses:{type:Array,required:!0}},computed:{anchor:({title:e})=>(0,Tn.ql)(e),propertyChanges:({apiChanges:e})=>(e||{}).restResponses,sanitizedResponses:({responses:e,sanitizeResponse:t})=>e.map(t)},methods:{sanitizeResponse:({mimetype:e,...t})=>e?{...t,mimeType:e}:t,shouldShiftType:({content:e=[],reason:t,status:n})=>!(e.length||t)&&n}},Ka=za,qa=(0,V.A)(Ka,Ea,Ma,!1,null,"362f5b54",null),ja=qa.exports,Fa=function(){var e=this,t=e._self._c;return e.topics.length?t("section",{staticClass:"mentions"},[t("LinkableHeading",{attrs:{anchor:"mentions"}},[e._v(" "+e._s(e.$t("mentioned-in"))+" ")]),e._l(e.topics,function(e){return t("Mention",{key:e.identifier,attrs:{url:e.url,title:e.title,role:e.role,kind:e.kind}})})],2):e._e()},Va=[],Ha=(n(531),function(){var e=this,t=e._self._c;return t("div",{staticClass:"link-block"},[t("Reference",{staticClass:"link",attrs:{url:e.url,role:e.role,kind:e.kind}},[t("TopicLinkBlockIcon",{staticClass:"mention-icon",attrs:{role:e.role}}),e._v(" "+e._s(e.title)+" ")],1)],1)}),Wa=[],Ua=n(1754),Ga=n(1523),Qa={components:{Reference:Ua.A,TopicLinkBlockIcon:Ga.A},mixins:[un.A],props:{url:{type:String,required:!0},title:{type:String,required:!0},role:{type:String,required:!1,default:"article"},kind:{type:String,required:!1,default:"article"}}},Xa=Qa,Ya=(0,V.A)(Xa,Ha,Wa,!1,null,"0a954b0c",null),Za=Ya.exports,Ja={name:"MentionedIn",components:{LinkableHeading:dn.A,Mention:Za},mixins:[un.A],props:{mentions:{type:Array,required:!0}},computed:{topics(){return this.mentions&&this.mentions.length?this.mentions.slice(0,5).flatMap(e=>this.references[e]):[]}}},es=Ja,ts=(0,V.A)(es,Fa,Va,!1,null,null,null),ns=ts.exports,is={name:"PrimaryContent",components:{Attributes:li,ContentNode:Qe.A,Parameters:zi,PropertyListKeyDetails:Oi,PropertyTable:ya,RestBody:Da,RestEndpoint:_i,RestParameters:Ba,RestResponses:ja,PossibleValues:fi,Mentions:ns},constants:{SectionKind:Ve},props:{sections:{type:Array,required:!0,validator:e=>e.every(({kind:e})=>Object.prototype.hasOwnProperty.call(Ve,e))}},computed:{span(){return{large:9,medium:9,small:12}}},methods:{componentFor(e){return{[Ve.attributes]:li,[Ve.content]:Qe.A,[Ve.details]:Oi,[Ve.parameters]:zi,[Ve.properties]:ya,[Ve.restBody]:Da,[Ve.restParameters]:Ba,[Ve.restHeaders]:Ba,[Ve.restCookies]:Ba,[Ve.restEndpoint]:_i,[Ve.restResponses]:ja,[Ve.possibleValues]:fi,[Ve.mentions]:ns}[e.kind]},propsFor(e){const{attributes:t,bodyContentType:n,content:i,details:a,items:s,kind:r,mimeType:o,parameters:l,title:c,tokens:d,values:u,mentions:h}=e;return{[Ve.attributes]:{attributes:t},[Ve.content]:{content:i},[Ve.details]:{details:a},[Ve.parameters]:{parameters:l},[Ve.possibleValues]:{values:u},[Ve.properties]:{properties:s,title:c},[Ve.restBody]:{bodyContentType:n,content:i,mimeType:o,parts:l,title:c},[Ve.restCookies]:{parameters:s,title:c},[Ve.restEndpoint]:{tokens:d,title:c},[Ve.restHeaders]:{parameters:s,title:c},[Ve.restParameters]:{parameters:s,title:c},[Ve.restResponses]:{responses:s,title:c},[Ve.mentions]:{mentions:h}}[r]}}},as=is,ss=(0,V.A)(as,Rn,Bn,!1,null,"65c116be",null),rs=ss.exports,os=function(){var e=this,t=e._self._c;return t("ContentTable",{attrs:{anchor:e.contentSectionData.anchor,title:e.$t(e.contentSectionData.title),enableMinimized:e.enableMinimized}},e._l(e.sectionsWithSymbols,function(e){return t("Section",{key:e.type,attrs:{title:e.title,anchor:e.anchor}},[t("List",{attrs:{symbols:e.symbols,type:e.type}})],1)}),1)},ls=[],cs=function(){var e=this,t=e._self._c;return t("ul",{ref:"apiChangesDiff",staticClass:"relationships-list",class:e.classes},e._l(e.symbols,function(n){return t("li",{key:n.identifier,staticClass:"relationships-item"},[n.url?t("Reference",{staticClass:"link",attrs:{role:n.role,kind:n.kind,url:n.url}},[e._v(e._s(n.title))]):t("WordBreak",{attrs:{tag:"code"}},[e._v(e._s(n.title))]),n.conformance?t("ConditionalConstraints",{attrs:{constraints:n.conformance.constraints,prefix:n.conformance.conformancePrefix}}):e._e()],1)}),0)},ds=[];const us=3,hs={conformsTo:"conformance",inheritsFrom:"inheritance",inheritedBy:"inheritedBy"};var ps={name:"RelationshipsList",components:{ConditionalConstraints:Je,Reference:Ua.A,WordBreak:Oe.A},inject:["store","identifier"],mixins:[Tt.o8,Tt.z_],props:{symbols:{type:Array,required:!0},type:{type:String,required:!0}},data(){return{state:this.store.state}},computed:{classes({changeType:e,multipleLinesClass:t,displaysMultipleLinesAfterAPIChanges:n}){return[{inline:this.shouldDisplayInline,column:!this.shouldDisplayInline,[`changed changed-${e}`]:!!e,[t]:n}]},hasAvailabilityConstraints(){return this.symbols.some(e=>!!(e.conformance||{}).constraints)},changes({identifier:e,state:{apiChanges:t}}){return(t||{})[e]||{}},changeType({changes:e,type:t}){const n=hs[t];if(e.change!==Ft.wi.modified)return e.change;const i=e[n];if(!i)return;const a=(e,t)=>e.map((e,n)=>[e,t[n]]),s=a(i.previous,i.new).some(([e,t])=>e.content?0===e.content.length&&t.content.length>0:!!t.content);return s?Ft.wi.added:Ft.wi.modified},shouldDisplayInline(){const{hasAvailabilityConstraints:e,symbols:t}=this;return t.length<=us&&!e}}},gs=ps,fs=(0,V.A)(gs,cs,ds,!1,null,"58f192c5",null),ms=fs.exports,ys={name:"Relationships",mixins:[un.A],components:{ContentTable:yn,List:ms,Section:wn},props:{sections:{type:Array,required:!0},enableMinimized:{type:Boolean,default:!1}},computed:{contentSectionData:()=>sn.relationships,sectionsWithSymbols(){return this.sections.map(e=>({...e,symbols:e.identifiers.reduce((e,t)=>this.references[t]?e.concat(this.references[t]):e,[])}))}}},vs=ys,bs=(0,V.A)(vs,os,ls,!1,null,null,null),Ts=bs.exports,_s=n(6392),Ss=function(){var e=this,t=e._self._c;return t("Section",{staticClass:"availability",attrs:{role:"complementary","aria-label":e.$t("sections.availability")}},[e._l(e.technologies,function(n){return t("span",{key:n,staticClass:"technology"},[t("TechnologyIcon",{staticClass:"tech-icon"}),t("span",[e._v(e._s(n))])],1)}),e._l(e.platforms,function(n){return t("span",{key:n.name,staticClass:"platform",class:e.changesClassesFor(n.name)},[t("AvailabilityRange",{attrs:{deprecatedAt:n.deprecatedAt,introducedAt:n.introducedAt,platformName:n.name}}),n.deprecatedAt?t("Badge",{attrs:{variant:"deprecated"}}):n.beta?t("Badge",{attrs:{variant:"beta"}}):e._e()],1)})],2)},ks=[],Cs=n(9018),ws=function(){var e=this,t=e._self._c;return t("span",{attrs:{role:"text","aria-label":e.ariaLabel,title:e.description}},[e._v(e._s(e.text))])},xs=[],As={name:"AvailabilityRange",props:{deprecatedAt:{type:String,required:!1},introducedAt:{type:String,required:!1},platformName:{type:String,required:!0}},computed:{ariaLabel(){const{deprecatedAt:e,description:t,text:n}=this;return[n].concat(e?this.$t("change-type.deprecated"):[]).concat(t).join(", ")},description(){const{deprecatedAt:e,introducedAt:t,platformName:n}=this;return t&&e?this.$t("availability.introduced-and-deprecated",{name:n,introducedAt:t,deprecatedAt:e}):t?this.$t("availability.available-on-platform-version",{name:n,introducedAt:t}):this.$t("availability.available-on-platform",{name:n})},text(){const{deprecatedAt:e,introducedAt:t,platformName:n}=this;return t&&e?`${n} ${t}–${e}`:t?`${n} ${t}+`:n}}},Is=As,$s=(0,V.A)(Is,ws,xs,!1,null,null,null),Ds=$s.exports,Ls={name:"Availability",mixins:[Tt.o8],inject:["identifier","store"],components:{Badge:Fi.A,AvailabilityRange:Ds,Section:re,TechnologyIcon:Cs.A},props:{platforms:{type:Array,required:!0},technologies:{type:Array,required:!1}},data(){return{state:this.store.state}},methods:{changeFor(e){const{identifier:t,state:{apiChanges:n}}=this,{availability:i={}}=(n||{})[t]||{},a=i[e];if(a)return a.deprecated?Ft.wi.deprecated:a.introduced&&!a.introduced.previous?Ft.wi.added:Ft.wi.modified}}},Ps=Ls,Os=(0,V.A)(Ps,Ss,ks,!1,null,"2415d233",null),Ns=Os.exports,Rs=function(){var e=this,t=e._self._c;return t("TopicsTable",{attrs:{anchor:e.contentSectionData.anchor,title:e.$t(e.contentSectionData.title),isSymbolDeprecated:e.isSymbolDeprecated,isSymbolBeta:e.isSymbolBeta,sections:e.sections}})},Bs=[],Es={name:"SeeAlso",components:{TopicsTable:Dn},props:{isSymbolDeprecated:Boolean,isSymbolBeta:Boolean,sections:Dn.props.sections},computed:{contentSectionData:()=>sn.seeAlso}},Ms=Es,zs=(0,V.A)(Ms,Rs,Bs,!1,null,null,null),Ks=zs.exports,qs=function(){var e=this,t=e._self._c;return t("div",{staticClass:"topictitle"},[e.eyebrow?t("span",{staticClass:"eyebrow"},[e._v(e._s(e.eyebrow))]):e._e(),t("h1",{staticClass:"title"},[e._t("default"),e._t("after")],2)])},js=[],Fs={name:"Title",props:{eyebrow:{type:String,required:!1}}},Vs=Fs,Hs=(0,V.A)(Vs,qs,js,!1,null,"a7c0bc44",null),Ws=Hs.exports,Us=function(){var e=this,t=e._self._c;return t("TopicsTable",{attrs:{anchor:e.contentSectionData.anchor,title:e.$t(e.contentSectionData.title),isSymbolDeprecated:e.isSymbolDeprecated,isSymbolBeta:e.isSymbolBeta,sections:e.sections,topicStyle:e.topicStyle}})},Gs=[],Qs={name:"Topics",components:{TopicsTable:Dn},computed:{contentSectionData:()=>sn.topics},props:{isSymbolDeprecated:Boolean,isSymbolBeta:Boolean,sections:Dn.props.sections,topicStyle:{type:String,required:!0,validator:e=>Object.hasOwnProperty.call(Ne.Z,e)}}},Xs=Qs,Ys=(0,V.A)(Xs,Us,Gs,!1,null,null,null),Zs=Ys.exports,Js=function(){var e=this,t=e._self._c;return t("div",{staticClass:"OnThisPageStickyContainer"},[e._t("default")],2)},er=[],tr={name:"OnThisPageStickyContainer"},nr=tr,ir=(0,V.A)(nr,Js,er,!1,null,"51908d5a",null),ar=ir.exports,sr=function(){var e=this,t=e._self._c;return t("NavMenuItems",{staticClass:"hierarchy",class:{"has-badge":e.hasBadge},attrs:{"aria-label":e.$t("documentation.nav.breadcrumbs")}},[e.root?t("HierarchyItem",{key:e.root.title,staticClass:"root-hierarchy",attrs:{url:e.addQueryParamsToUrl(e.root.url)}},[e._v(" "+e._s(e.root.title)+" ")]):e._e(),e._l(e.collapsibleItems,function(n){return t("HierarchyItem",{key:n.title,attrs:{isCollapsed:"",url:e.addQueryParamsToUrl(n.url)}},[e._v(" "+e._s(n.title)+" ")])}),e.collapsibleItems.length?t("HierarchyCollapsedItems",{attrs:{topics:e.collapsibleItems}}):e._e(),e._l(e.nonCollapsibleItems,function(n){return t("HierarchyItem",{key:n.title,attrs:{url:e.addQueryParamsToUrl(n.url)}},[e._v(" "+e._s(n.title)+" ")])}),e.smallViewport?e._e():t("HierarchyItem",{scopedSlots:e._u([{key:"tags",fn:function(){return[e.isSymbolDeprecated?t("Badge",{attrs:{variant:"deprecated"}}):e.isSymbolBeta?t("Badge",{attrs:{variant:"beta"}}):e._e(),e._l(e.currentTopicTags,function(n){return t("Badge",{key:`${n.type}-${n.text}`,attrs:{variant:n.type}},[e._v(" "+e._s(n.text)+" ")])})]},proxy:!0}],null,!1,1132636639)},[e._v(" "+e._s(e.currentTopicTitle)+" ")])],2)},rr=[],or=n(4654),lr=n(2361),cr=function(){var e=this,t=e._self._c;return t("li",{staticClass:"hierarchy-collapsed-items"},[t("button",{ref:"btn",staticClass:"toggle",class:{focused:!e.collapsed},on:{click:e.toggleCollapsed}},[t("span",{staticClass:"indicator"},[t("EllipsisIcon",{staticClass:"icon-inline toggle-icon"})],1)]),t("ul",{ref:"dropdown",staticClass:"dropdown",class:{collapsed:e.collapsed}},e._l(e.formattedTopics,function(n){return t("li",{key:n.title,staticClass:"dropdown-item"},[t("NavMenuLink",{attrs:{url:n.url}},[e._v(" "+e._s(n.title)+" ")])],1)}),0)])},dr=[],ur=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"ellipsis-icon",attrs:{viewBox:"0 0 14 14",themeId:"ellipsis"}},[t("path",{attrs:{d:"m12.439 7.777v-1.554h-1.554v1.554zm-4.662 0v-1.554h-1.554v1.554zm-4.662 0v-1.554h-1.554v1.554z"}})])},hr=[],pr=n(6515),gr={name:"EllipsisIcon",components:{SVGIcon:pr.A}},fr=gr,mr=(0,V.A)(fr,ur,hr,!1,null,null,null),yr=mr.exports,vr=function(){var e=this,t=e._self._c;return e.isCurrent?t("span",{staticClass:"nav-menu-link current",attrs:{"aria-current":"page","aria-disabled":"true",role:"link"}},[e._t("default")],2):t("Reference",{staticClass:"nav-menu-link",attrs:{url:e.url,tabindex:"0"}},[e._t("default")],2)},br=[],Tr={name:"NavMenuLink",components:{Reference:Ua.A},computed:{isCurrent:({$route:e,url:t})=>"string"===typeof t?t===(0,P.c$)(e.path,e.query).replace(/\/$/,""):t.name===e.name},props:{url:{type:[Object,String],required:!0}}},_r=Tr,Sr=(0,V.A)(_r,vr,br,!1,null,"2ad31daf",null),kr=Sr.exports,Cr={name:"HierarchyCollapsedItems",components:{EllipsisIcon:yr,NavMenuLink:kr},data:()=>({collapsed:!0}),props:{topics:{type:Array,required:!0}},watch:{collapsed(e,t){t&&!e?document.addEventListener("click",this.handleDocumentClick,!1):!t&&e&&document.removeEventListener("click",this.handleDocumentClick,!1)}},beforeDestroy(){document.removeEventListener("click",this.handleDocumentClick,!1)},computed:{formattedTopics:({$route:e,topics:t})=>t.map(t=>({...t,url:(0,P.c$)(t.url,e.query)}))},methods:{handleDocumentClick(e){const{target:t}=e,{collapsed:n,$refs:{btn:i,dropdown:a}}=this,s=!i.contains(t)&&!a.contains(t);!n&&s&&(this.collapsed=!0)},toggleCollapsed(){this.collapsed=!this.collapsed}}},wr=Cr,xr=(0,V.A)(wr,cr,dr,!1,null,"a5015456",null),Ar=xr.exports,Ir=function(e,t){return e(t.$options.components.NavMenuItemBase,{tag:"component",staticClass:"hierarchy-item",class:[{collapsed:t.props.isCollapsed},t.data.staticClass]},[t.props.url?e("router-link",{staticClass:"parent item nav-menu-link",attrs:{to:t.props.url}},[t._t("default")],2):[e("span",{staticClass:"current item"},[t._t("default")],2),t._t("tags")]],2)},$r=[],Dr=n(5273),Lr=n(6e3),Pr={name:"HierarchyItem",components:{NavMenuItemBase:Dr.A,InlineChevronRightIcon:Lr.A},props:{isCollapsed:Boolean,url:{type:String,required:!1}}},Or=Pr,Nr=(0,V.A)(Or,Ir,$r,!0,null,"288a0b84",null),Rr=Nr.exports;const Br=3,Er=1;var Mr={name:"Hierarchy",components:{Badge:Fi.A,NavMenuItems:or.A,HierarchyCollapsedItems:Ar,HierarchyItem:Rr},constants:{MaxVisibleLinks:Br},inject:["store"],mixins:[un.A],props:{isSymbolDeprecated:Boolean,isSymbolBeta:Boolean,currentTopicTitle:{type:String,required:!0},parentTopics:{type:Array,default:()=>[]},currentTopicTags:{type:Array,default:()=>[]}},computed:{windowWidth:({store:e})=>e.state.contentWidth,root:({parentTopics:e})=>e[0],smallViewport:({windowWidth:e})=>e{const i=n?1:0;return e>1200?Br-i:e>1e3?Br-1-i:t?0:Br-2-i},collapsibleItems:({smallViewport:e,parentTopics:t,linksAfterCollapse:n,currentTopicTitle:i,$route:a})=>{const s=n?t.slice(Er,-n):t.slice(Er);return e&&s.push({title:i,url:a.path}),s},nonCollapsibleItems:({parentTopics:e,linksAfterCollapse:t})=>t?e.slice(Er).slice(-t):[],hasBadge:({isSymbolDeprecated:e,isSymbolBeta:t,currentTopicTags:n})=>e||t||n.length},methods:{addQueryParamsToUrl(e){return(0,P.c$)(e,this.$route.query)}}},zr=Mr,Kr=(0,V.A)(zr,sr,rr,!1,null,"d54f3438",null),qr=Kr.exports;const jr=1050;var Fr={name:"DocumentationTopic",mixins:[L.A],constants:{ON_THIS_PAGE_CONTAINER_BREAKPOINT:jr},inject:{isTargetIDE:{default(){return!1}},store:{default(){return{reset(){},state:{},setReferences(){},updateReferences(){}}}}},components:{Declaration:Ut,OnThisPageStickyContainer:ar,OnThisPageNav:Fe,DocumentationHero:Pe,Abstract:en,Aside:E.A,BetaLegalText:W,ContentNode:Qe.A,DefaultImplementations:Nn,DownloadButton:tn.A,LanguageSwitcher:me,PrimaryContent:rs,Relationships:Ts,RequirementMetadata:_s.A,Availability:Ns,SeeAlso:Ks,Title:Ws,Topics:Zs,ViewMore:Se,WordBreak:Oe.A,Hierarchy:qr,InlinePlusCircleIcon:Gt.A},props:{abstract:{type:Array,required:!1},conformance:{type:Object,required:!1},defaultImplementationsSections:{type:Array,required:!1},downloadNotAvailableSummary:{type:Array,required:!1},deprecationSummary:{type:Array,required:!1},diffAvailability:{type:Object,required:!1},modules:{type:Array,required:!1},hasNoExpandedDocumentation:{type:Boolean,required:!1},hierarchy:{type:Object,default:()=>({})},interfaceLanguage:{type:String,required:!0},identifier:{type:String,required:!0},isRequirement:{type:Boolean,default:()=>!1},platforms:{type:Array,required:!1},primaryContentSections:{type:Array,required:!1},references:{type:Object,required:!0},relationshipsSections:{type:Array,required:!1},roleHeading:{type:String,required:!1},title:{type:String,required:!0},topicSections:{type:Array,required:!1},topicSectionsStyle:{type:String,default:Ne.Z.list},sampleCodeDownload:{type:Object,required:!1},seeAlsoSections:{type:Array,required:!1},languagePaths:{type:Object,default:()=>({})},tags:{type:Array,required:!0},objcPath:{type:String,required:!1},swiftPath:{type:String,required:!1},isSymbolDeprecated:{type:Boolean,required:!1},isSymbolBeta:{type:Boolean,required:!1},symbolKind:{type:String,default:""},role:{type:String,default:""},remoteSource:{type:Object,required:!1},pageImages:{type:Array,required:!1},enableMinimized:{type:Boolean,default:!1},enableOnThisPageNav:{type:Boolean,default:!1},disableHeroBackground:{type:Boolean,default:!1},standardColorIdentifier:{type:String,required:!1,validator:e=>Object.prototype.hasOwnProperty.call(Ie,e)},availableLanguages:{type:Array,required:!1},availableLocales:{type:Array,required:!1},hierarchyItems:{type:Array,default:()=>[]}},provide(){return{identifier:this.identifier,languages:new Set(Object.keys(this.languagePaths)),interfaceLanguage:this.interfaceLanguage,symbolKind:this.symbolKind,enableMinimized:this.enableMinimized}},data(){return{indexState:B.A.state,topicState:this.store.state,declListExpanded:!1}},computed:{normalizedSwiftPath:({swiftPath:e})=>(0,O.Vd)(e),normalizedObjcPath:({objcPath:e,swiftPath:t})=>(0,O.Vd)(e&&t?(0,P.c$)(e,{language:$.A.objectiveC.key.url}):e),defaultImplementationsCount(){return(this.defaultImplementationsSections||[]).reduce((e,t)=>e+t.identifiers.length,0)},shouldShowAvailability:({platforms:e,technologies:t,enableMinimized:n})=>((e||[]).length||(t||[]).length)&&!n,hasBetaContent:({platforms:e})=>e&&e.length&&e.some(e=>e.beta),pageTitle:({title:e})=>e,pageDescription:({abstract:e,extractFirstParagraphText:t})=>e?t(e):null,parentTopics:({hierarchyItems:e,references:t,hasOtherDeclarations:n,pageTitle:i})=>{const a=e.reduce((e,n)=>{const i=t[n];if(i){const{title:t,url:n}=i;return e.concat({title:t,url:n})}return console.error(`Reference for "${n}" is missing`),e},[]),s=(0,N.HV)(a);return n&&s?.title===i&&a.pop(),a},shouldShowLanguageSwitcher:({objcPath:e,swiftPath:t,isTargetIDE:n,enableMinimized:i})=>!!(e&&t&&n)&&!i,enhanceBackground:({symbolKind:e,disableHeroBackground:t,enableMinimized:n})=>!t&&!n&&(!e||e===D.module),shortHero:({roleHeading:e,abstract:t,sampleCodeDownload:n,hasAvailability:i,shouldShowLanguageSwitcher:a,declarations:s})=>!!e+!!t+!!n+!!s.length+!!i+a<=1,technologies({modules:e=[]}){const t=e.reduce((e,t)=>(e.push(t.name),e.concat(t.relatedModules||[])),[]);return t.length>1?t:[]},titleBreakComponent:({enhanceBackground:e})=>e?"span":Oe.A,hasPrimaryContent:({isRequirement:e,deprecationSummary:t,downloadNotAvailableSummary:n,primaryContentSectionsSanitized:i,shouldShowViewMoreLink:a})=>e||t&&t.length||n&&n.length||i.length||a,viewMoreLink:({interfaceLanguage:e,normalizedObjcPath:t,normalizedSwiftPath:n})=>e===$.A.objectiveC.key.api?t:n,shouldShowViewMoreLink:({enableMinimized:e,hasNoExpandedDocumentation:t,viewMoreLink:n})=>e&&!t&&n,tagName(){return this.isSymbolDeprecated?this.$t("aside-kind.deprecated"):this.$t("aside-kind.beta")},pageIcon:({pageImages:e=[]})=>{const t=e.find(({type:e})=>"icon"===e);return t?t.identifier:null},shouldRenderTopicSection:({topicSectionsStyle:e,topicSections:t,enableMinimized:n})=>t&&e!==Ne.Z.hidden&&!n,isOnThisPageNavVisible:({topicState:e})=>e.contentWidth>jr,disableMetadata:({enableMinimized:e})=>e,primaryContentSectionsSanitized({primaryContentSections:e=[],symbolKind:t}){return e.filter(({kind:e})=>e===Ve.mentions?t!==D.module:e!==Ve.declarations)},declarations({primaryContentSections:e=[]}){return e.filter(({kind:e})=>e===Ve.declarations)},showOtherDeclarations({enableMinimized:e,hasOtherDeclarations:t}){return!e&&t},hasOtherDeclarations({declarations:e=[]}){return!!e.length&&e[0].declarations.some(e=>Object.prototype.hasOwnProperty.call(e,"otherDeclarations"))},declListToggleText({declListExpanded:e}){return e?this.$t("declarations.hide-other-declarations"):this.$t("declarations.show-all-declarations")}},methods:{extractProps(e){const{abstract:t,defaultImplementationsSections:n,deprecationSummary:i,downloadNotAvailableSummary:a,diffAvailability:s,hierarchy:r,identifier:{interfaceLanguage:o,url:l},metadata:{conformance:c,hasNoExpandedDocumentation:d,modules:u,availableLanguages:h,availableLocales:p,platforms:g,required:f=!1,roleHeading:m,title:y="",tags:v=[],role:b,symbolKind:T="",remoteSource:_,images:S=[],color:{standardColorIdentifier:k}={}}={},primaryContentSections:C,relationshipsSections:w,references:x={},sampleCodeDownload:A,topicSectionsStyle:I,topicSections:D,seeAlsoSections:L,variantOverrides:P,variants:O=[]}=e,N=O.reduce((e,t)=>t.traits.reduce((e,n)=>n.interfaceLanguage?{...e,[n.interfaceLanguage]:(e[n.interfaceLanguage]||[]).concat(t.paths)}:e,e),{}),{[$.A.objectiveC.key.api]:[R]=[],[$.A.swift.key.api]:[B]=[]}=N;return{abstract:t,conformance:c,defaultImplementationsSections:n,deprecationSummary:i,downloadNotAvailableSummary:a,diffAvailability:s,hasNoExpandedDocumentation:d,availableLanguages:h,availableLocales:p,hierarchy:r,role:b,identifier:l,interfaceLanguage:o,isRequirement:f,modules:u,platforms:g,primaryContentSections:C,relationshipsSections:w,references:x,roleHeading:m,sampleCodeDownload:A,title:y,topicSections:D,topicSectionsStyle:I,seeAlsoSections:L,variantOverrides:P,symbolKind:T,tags:v.slice(0,1),remoteSource:_,pageImages:S,objcPath:R,swiftPath:B,standardColorIdentifier:k}},toggleDeclList(){this.declListExpanded=!this.declListExpanded}},created(){if(this.topicState.preferredLanguage===$.A.objectiveC.key.url&&this.interfaceLanguage!==$.A.objectiveC.key.api&&this.objcPath&&this.$route.query.language!==$.A.objectiveC.key.url){const{query:e}=this.$route;this.$nextTick().then(()=>{this.$router.replace({path:(0,O.Vd)(this.objcPath),query:{...e,language:$.A.objectiveC.key.url}})})}R.A.setAvailableLocales(this.availableLanguages??this.availableLocales),this.store.reset(),this.store.setReferences(this.references)},watch:{"indexState.includedArchiveIdentifiers":function(){this.store.updateReferences()},references(e){this.store.setReferences(e)},availableLanguages(e){R.A.setAvailableLocales(e)},availableLocales(e){R.A.setAvailableLocales(this.availableLanguages??e)}}},Vr=Fr,Hr=(0,V.A)(Vr,A,I,!1,null,"6dcef09a",null),Wr=Hr.exports,Ur=function(){var e=this,t=e._self._c;return t("div",{staticClass:"documentation-layout"},[e.isTargetIDE?e._e():t("Nav",{attrs:{diffAvailability:e.diffAvailability,interfaceLanguage:e.interfaceLanguage,objcPath:e.objcPath,swiftPath:e.swiftPath,displaySidenav:e.enableNavigator},on:{"toggle-sidenav":e.handleToggleSidenav},scopedSlots:e._u([{key:"title",fn:function({className:t}){return[e._t("nav-title",null,{className:t})]}}],null,!0)}),t("AdjustableSidebarWidth",e._g(e._b({staticClass:"full-width-container topic-wrapper",scopedSlots:e._u([{key:"aside",fn:function({scrollLockID:n,breakpoint:i}){return[t("div",{staticClass:"documentation-layout-aside"},[e.enableQuickNavigation?t("QuickNavigationModal",{attrs:{children:e.quickNavNodes||e.indexNodes,showQuickNavigationModal:e.showQuickNavigationModal,technology:e.technology?e.technology.title:"",placeholder:e.quickNavPlaceholder,initialFilterText:e.quickNavigationInitialFilter},on:{"update:showQuickNavigationModal":function(t){e.showQuickNavigationModal=t},"update:show-quick-navigation-modal":function(t){e.showQuickNavigationModal=t}}}):e._e(),t("transition",{attrs:{name:"delay-hiding"}},[e._t("navigator",function(){return[t("Navigator",e._b({directives:[{name:"show",rawName:"v-show",value:e.sidenavVisibleOnMobile||i===e.BreakpointName.large,expression:"sidenavVisibleOnMobile || breakpoint === BreakpointName.large"}],key:"base-navigator",attrs:{"parent-topic-identifiers":e.parentTopicIdentifiers,references:e.references,scrollLockID:n,"render-filter-on-top":i!==e.BreakpointName.large},on:{close:function(t){return e.handleToggleSidenav(i)}},scopedSlots:e._u([e.enableQuickNavigation?{key:"filter",fn:function(){return[t("QuickNavigationButton",{nativeOn:{click:function(t){return e.openQuickNavigationModal.apply(null,arguments)}}})]},proxy:!0}:null,{key:"above-navigator-head",fn:function(){return[e._t("above-navigator-head")]},proxy:!0},{key:"navigator-head",fn:function({className:t}){return[e._t("nav-title",null,{className:t})]}}],null,!0)},"Navigator",{...e.navigatorProps,technologyProps:e.technologyProps},!1))]},null,{scrollLockID:n,breakpoint:i,sidenavVisibleOnMobile:e.sidenavVisibleOnMobile,handleToggleSidenav:e.handleToggleSidenav,enableQuickNavigation:e.enableQuickNavigation,openQuickNavigationModal:e.openQuickNavigationModal})],2)],1)]}}],null,!0)},"AdjustableSidebarWidth",e.sidebarProps,!1),e.sidebarListeners),[t("PortalTarget",{attrs:{name:"modal-destination",multiple:""}}),e._t("content")],2)],1)},Gr=[],Qr=n(2197),Xr=function(){var e=this,t=e._self._c;return t("button",{staticClass:"quick-navigation-open",attrs:{"aria-label":e.$t("quicknav.button.label"),title:e.$t("quicknav.button.title")}},[e._v(" / ")])},Yr=[],Zr={name:"QuickNavigationButton"},Jr=Zr,eo=(0,V.A)(Jr,Xr,Yr,!1,null,"96c35eb8",null),to=eo.exports,no=function(){var e=this,t=e._self._c;return t("GenericModal",{attrs:{isFullscreen:"",showClose:!1,visible:e.isVisible,backdropBackgroundColorOverride:"rgba(0, 0, 0, 0.7)"},on:{"update:visible":function(t){e.isVisible=t}}},[t("div",{staticClass:"quick-navigation"},[t("div",{staticClass:"quick-navigation__container",class:{focus:e.focusedInput}},[t("FilterInput",{staticClass:"quick-navigation__filter",attrs:{placeholder:e.placeholderText,focusInputWhenCreated:"",focusInputWhenEmpty:"",preventBorderStyle:"",selectInputOnFocus:""},on:{focus:function(t){e.focusedInput=!0},blur:function(t){e.focusedInput=!1}},nativeOn:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(t.preventDefault(),e.handleDownKeyInput.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.handleKeyEnter.apply(null,arguments)}]},scopedSlots:e._u([{key:"icon",fn:function(){return[t("div",{staticClass:"quick-navigation__magnifier-icon-container",class:{blue:e.userInput.length}},[t("MagnifierIcon")],1)]},proxy:!0}]),model:{value:e.userInput,callback:function(t){e.userInput=t},expression:"userInput"}}),t("div",{staticClass:"quick-navigation__match-list",class:{active:e.processedUserInput.length}},[e.noResultsWereFound?t("div",{staticClass:"no-results"},[t("p",[e._v(" "+e._s(e.$t("navigator.no-results"))+" ")])]):[t("div",e._b({staticClass:"quick-navigation__refs",on:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(t.preventDefault(),e.focusNext.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(t.preventDefault(),e.focusPrev.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.handleKeyEnter.apply(null,arguments)}]}},"div",{[e.SCROLL_LOCK_DISABLE_ATTR]:!0},!1),e._l(e.filteredSymbols,function(n,i){return t("Reference",{key:n.uid,ref:"match",refInFor:!0,staticClass:"quick-navigation__reference",attrs:{url:n.path,tabindex:e.focusedIndex===i?"0":"-1","data-index":i},nativeOn:{click:function(t){return e.closeQuickNavigationModal.apply(null,arguments)}}},[t("div",{staticClass:"quick-navigation__symbol-match",attrs:{role:"list"}},[t("div",{staticClass:"symbol-info"},[t("div",{staticClass:"symbol-name"},[t("TopicTypeIcon",{staticClass:"navigator-icon",attrs:{type:n.type}}),t("div",{staticClass:"symbol-title"},[t("span",{domProps:{textContent:e._s(e.formatSymbolTitle(n.title,0,n.start))}}),t("QuickNavigationHighlighter",{attrs:{text:n.substring,matcherText:e.processedUserInput}}),t("span",{domProps:{textContent:e._s(e.formatSymbolTitle(n.title,n.start+n.matchLength))}})],1)],1),t("div",{staticClass:"symbol-path"},e._l(n.parents,function(i,a){return t("div",{key:i.title},[t("span",{staticClass:"parent-path",domProps:{textContent:e._s(i.title)}}),a!==n.parents.length-1?t("span",{staticClass:"parent-path",domProps:{textContent:e._s("/")}}):e._e()])}),0)])])])}),1),e.previewState?t("Preview",e._b({staticClass:"quick-navigation__preview",attrs:{json:e.previewJSON,state:e.previewState}},"Preview",{[e.SCROLL_LOCK_DISABLE_ATTR]:!0},!1)):e._e()]],2)],1)])])},io=[],ao=function(){var e=this,t=e._self._c;return t("div",{staticClass:"filter",class:{focus:e.showSuggestedTags&&!e.preventBorderStyle},attrs:{role:"search",tabindex:"0","aria-labelledby":e.searchAriaLabelledBy},on:{"!blur":function(t){return e.handleBlur.apply(null,arguments)},"!focus":function(t){return e.handleFocus.apply(null,arguments)}}},[t("div",{class:["filter__wrapper",{"filter__wrapper--reversed":e.positionReversed,"filter__wrapper--no-border-style":e.preventBorderStyle}]},[t("div",{staticClass:"filter__top-wrapper"},[t("button",{staticClass:"filter__filter-button",class:{blue:e.inputIsNotEmpty},attrs:{"aria-hidden":"true",tabindex:"-1"},on:{click:e.focusInput,mousedown:function(e){e.preventDefault()}}},[e._t("icon",function(){return[t("FilterIcon")]})],2),t("div",{class:["filter__input-box-wrapper",{scrolling:e.isScrolling}],on:{scroll:e.handleScroll}},[e.hasSelectedTags?t("TagList",e._g(e._b({ref:"selectedTags",staticClass:"filter__selected-tags",attrs:{id:e.SelectedTagsId,input:e.input,tags:e.selectedTags,ariaLabel:e.$tc("filter.selected-tags",e.suggestedTags.length),activeTags:e.activeTags,translatableTags:e.translatableTags,areTagsRemovable:""},on:{"focus-prev":e.handleFocusPrevOnSelectedTags,"focus-next":e.focusInputFromTags,"reset-filters":e.resetFilters,"prevent-blur":function(t){return e.$emit("update:preventedBlur",!0)}}},"TagList",e.virtualKeyboardBind,!1),e.selectedTagsMultipleSelectionListeners)):e._e(),t("label",{staticClass:"filter__input-label",attrs:{id:"filter-label",for:e.FilterInputId,"data-value":e.modelValue,"aria-label":e.placeholder}},[t("input",e._g(e._b({directives:[{name:"model",rawName:"v-model",value:e.modelValue,expression:"modelValue"}],ref:"input",staticClass:"filter__input",attrs:{id:e.FilterInputId,placeholder:e.hasSelectedTags?"":e.placeholder,"aria-expanded":e.displaySuggestedTags?"true":"false",disabled:e.disabled,type:"text"},domProps:{value:e.modelValue},on:{focus:function(t){e.selectInputOnFocus&&e.selectInputAndTags()},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),e.downHandler.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),e.upHandler.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"left",37,t.key,["Left","ArrowLeft"])||"button"in t&&0!==t.button?null:e.leftKeyInputHandler.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"right",39,t.key,["Right","ArrowRight"])||"button"in t&&2!==t.button?null:e.rightKeyInputHandler.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:e.deleteHandler.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"a",void 0,t.key,void 0)?null:t.metaKey?(t.preventDefault(),t.stopPropagation(),e.selectInputAndTags.apply(null,arguments)):null},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"a",void 0,t.key,void 0)?null:t.ctrlKey?(t.preventDefault(),e.selectInputAndTags.apply(null,arguments)):null},function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.inputKeydownHandler.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.enterHandler.apply(null,arguments)},function(t){return t.shiftKey?t.ctrlKey||t.altKey||t.metaKey?null:e.inputKeydownHandler.apply(null,arguments):null},function(t){return t.shiftKey&&t.metaKey?t.ctrlKey||t.altKey?null:e.inputKeydownHandler.apply(null,arguments):null},function(t){return t.metaKey?t.ctrlKey||t.shiftKey||t.altKey?null:e.assignEventValues.apply(null,arguments):null},function(t){return t.ctrlKey?t.shiftKey||t.altKey||t.metaKey?null:e.assignEventValues.apply(null,arguments):null}],input:function(t){t.target.composing||(e.modelValue=t.target.value)}}},"input",e.AXinputProperties,!1),e.inputMultipleSelectionListeners))])],1),t("div",{staticClass:"filter__delete-button-wrapper"},[e.input.length||e.displaySuggestedTags||e.hasSelectedTags?t("button",{staticClass:"filter__delete-button",attrs:{"aria-label":e.$t("filter.reset-filter")},on:{click:function(t){return e.resetFilters(!0)},keydown:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(t.stopPropagation(),e.resetFilters(!0))},mousedown:function(e){e.preventDefault()}}},[t("ClearRoundedIcon")],1):e._e()])]),e.displaySuggestedTags?t("TagList",e._b({ref:"suggestedTags",staticClass:"filter__suggested-tags",attrs:{id:e.SuggestedTagsId,ariaLabel:e.$tc("filter.suggested-tags",e.suggestedTags.length),input:e.input,tags:e.suggestedTags,translatableTags:e.translatableTags},on:{"click-tags":function(t){return e.selectTag(t.tagName)},"prevent-blur":function(t){return e.$emit("update:preventedBlur",!0)},"focus-next":function(t){e.positionReversed?e.focusInput():e.$emit("focus-next")},"focus-prev":function(t){e.positionReversed?e.$emit("focus-prev"):e.focusInput()}}},"TagList",e.virtualKeyboardBind,!1)):e._e()],1)])},so=[],ro=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"clear-rounded-icon",attrs:{viewBox:"0 0 16 16",themeId:"clear-rounded"}},[t("title",[e._v(e._s(e.$t("icons.clear")))]),t("path",{attrs:{d:"M14.55,0l1.45,1.45-6.56,6.55,6.54,6.54-1.45,1.45-6.53-6.53L1.47,15.99,.01,14.53l6.52-6.53L0,1.47,1.45,.02l6.55,6.54L14.55,0Z","fill-rule":"evenodd"}})])},oo=[],lo={name:"ClearRoundedIcon",components:{SVGIcon:pr.A}},co=lo,uo=(0,V.A)(co,ro,oo,!1,null,null,null),ho=uo.exports;function po(){if(window.getSelection)try{const{activeElement:e}=document;return e&&e.value?e.value.substring(e.selectionStart,e.selectionEnd):window.getSelection().toString()}catch(e){return""}else if(document.selection&&"Control"!==document.selection.type)return document.selection.createRange().text;return""}function go(e){if("number"===typeof e.selectionStart)e.selectionStart=e.selectionEnd=e.value.length;else if("undefined"!==typeof e.createTextRange){e.focus();const t=e.createTextRange();t.collapse(!1),t.select()}}function fo(e){e.selectionStart=e.selectionEnd=0}function mo(e){return/^[\w\W\s]$/.test(e)}n(3110),n(8335);function yo(e){const t=e.match(/(.*)<\/data>/);try{return t?JSON.parse(t[1]):null}catch(n){return null}}function vo(e){return"string"!==typeof e&&(e=JSON.stringify(e)),`${e}`}function bo(e,t,n,i){let a,s;return function(...r){function o(){clearTimeout(a),a=null}function l(){o(),e.apply(s,r)}if(s=this,!a||!n&&!i){if(!n)return o(),void(a=setTimeout(l,t));a=setTimeout(o,t),e.apply(s,r)}}}const To=280,_o=100;var So={data(){return{keyboardIsVirtual:!1,activeTags:[],initTagIndex:null,focusedTagIndex:null,metaKey:!1,shiftKey:!1,tabbing:!1,debouncedHandleDeleteTag:null}},constants:{DebounceDelay:To,VirtualKeyboardThreshold:_o},computed:{virtualKeyboardBind:({keyboardIsVirtual:e})=>({keyboardIsVirtual:e}),allSelectedTagsAreActive:({selectedTags:e,activeTags:t})=>e.every(e=>t.includes(e))},methods:{selectRangeActiveTags(e=this.focusedTagIndex,t=this.selectedTags.length){this.activeTags=this.selectedTags.slice(e,t)},selectTag(e){this.updateSelectedTags([e]),this.setFilterInput("")},unselectActiveTags(){this.activeTags.length&&(this.deleteTags(this.activeTags),this.resetActiveTags())},async deleteHandler(e){this.activeTags.length>0&&this.setSelectedTags(this.selectedTags.filter(e=>!this.activeTags.includes(e))),this.inputIsSelected()&&this.allSelectedTagsAreActive?(e.preventDefault(),await this.resetFilters()):0===this.$refs.input.selectionEnd&&this.hasSelectedTags&&(e.preventDefault(),this.keyboardIsVirtual?this.setSelectedTags(this.selectedTags.slice(0,-1)):this.$refs.selectedTags.focusLast()),this.unselectActiveTags()},leftKeyInputHandler(e){if(this.assignEventValues(e),this.hasSelectedTags){if(this.activeTags.length&&!this.shiftKey)return e.preventDefault(),void this.$refs.selectedTags.focusTag(this.activeTags[0]);if(this.shiftKey&&0===this.$refs.input.selectionStart&&"forward"!==this.$refs.input.selectionDirection)return null===this.focusedTagIndex&&(this.focusedTagIndex=this.selectedTags.length),this.focusedTagIndex>0&&(this.focusedTagIndex-=1),this.initTagIndex=this.selectedTags.length,void this.selectTagsPressingShift();(0===this.$refs.input.selectionEnd||this.inputIsSelected())&&this.$refs.selectedTags.focusLast()}},rightKeyInputHandler(e){if(this.assignEventValues(e),this.activeTags.length&&this.shiftKey&&this.focusedTagIndex=_o&&(this.keyboardIsVirtual=!0)},To),setFilterInput(e){this.$emit("update:input",e)},setSelectedTags(e){this.$emit("update:selectedTags",e)},updateSelectedTags(e){this.setSelectedTags([...new Set([...this.selectedTags,...e])])},handleCopy(e){e.preventDefault();const t=[],n={tags:[],input:po()};if(this.activeTags.length){const e=this.activeTags;n.tags=e,t.push(e.join(" "))}return t.push(n.input),n.tags.length||n.input.length?(e.clipboardData.setData("text/html",vo(n)),e.clipboardData.setData("text/plain",t.join(" ")),n):n},handleCut(e){e.preventDefault();const{input:t,tags:n}=this.handleCopy(e);if(!t&&!n.length)return;const i=this.selectedTags.filter(e=>!n.includes(e)),a=this.input.replace(t,"");this.setSelectedTags(i),this.setFilterInput(a)},handlePaste(e){e.preventDefault();const{types:t}=e.clipboardData;let n=[],i=e.clipboardData.getData("text/plain");if(t.includes("text/html")){const t=e.clipboardData.getData("text/html"),a=yo(t);a&&({tags:n=[],input:i=""}=a)}const a=po();i=a.length?this.input.replace(a,i):(0,Tn.PT)(this.input,i,document.activeElement.selectionStart),this.setFilterInput(i.trim()),n.length&&(this.allSelectedTagsAreActive?this.setSelectedTags(n):this.updateSelectedTags(n)),this.resetActiveTags()},async handleDeleteTag({tagName:e,event:t={}}){const{key:n}=t;this.activeTags.length||this.deleteTags([e]),this.unselectActiveTags(),await this.$nextTick(),go(this.$refs.input),this.hasSelectedTags&&(await this.focusInput(),"Backspace"===n&&fo(this.$refs.input))}},mounted(){window.visualViewport&&(window.visualViewport.addEventListener("resize",this.updateKeyboardType),this.$once("hook:beforeDestroy",()=>{window.visualViewport.removeEventListener("resize",this.updateKeyboardType)}))}};const ko=1e3;var Co={constants:{ScrollingDebounceDelay:ko},data(){return{isScrolling:!1,scrollRemovedAt:0}},created(){this.deleteScroll=bo(this.deleteScroll,ko)},methods:{deleteScroll(){this.isScrolling=!1,this.scrollRemovedAt=Date.now()},handleScroll(e){const{target:t}=e;if(0!==t.scrollTop)return t.scrollTop=0,void e.preventDefault();const n=150,i=t.offsetWidth,a=i+n;if(t.scrollWidth0?this.focusIndex(this.focusedIndex-1):this.startingPointHook())},focusNext({metaKey:e,ctrlKey:t,shiftKey:n}){(e||t)&&n||(this.externalFocusChange=!1,this.focusedIndex0}},No=function(){var e=this,t=e._self._c;return t("li",{staticClass:"tag",attrs:{role:"presentation"}},[t("button",{ref:"button",class:{focus:e.isActiveTag},attrs:{role:"option","aria-selected":e.ariaSelected,"aria-roledescription":"tag"},on:{focus:function(t){return e.$emit("focus",{event:t,tagName:e.name})},click:function(t){return t.preventDefault(),e.$emit("click",{event:t,tagName:e.name})},dblclick:function(t){t.preventDefault(),!e.keyboardIsVirtual&&e.deleteTag()},keydown:[function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.$emit("keydown",{event:t,tagName:e.name})},function(t){return t.shiftKey?t.ctrlKey||t.altKey||t.metaKey?null:e.$emit("keydown",{event:t,tagName:e.name}):null},function(t){return t.shiftKey&&t.metaKey?t.ctrlKey||t.altKey?null:e.$emit("keydown",{event:t,tagName:e.name}):null},function(t){return t.metaKey?t.ctrlKey||t.shiftKey||t.altKey?null:e.$emit("keydown",{event:t,tagName:e.name}):null},function(t){return t.ctrlKey?t.shiftKey||t.altKey||t.metaKey?null:e.$emit("keydown",{event:t,tagName:e.name}):null},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"delete",[8,46],t.key,["Backspace","Delete","Del"])?null:(t.preventDefault(),e.deleteTag.apply(null,arguments))}],mousedown:function(t){return t.preventDefault(),e.focusButton.apply(null,arguments)},copy:e.handleCopy}},[e.isRemovableTag?e._e():t("span",{staticClass:"visuallyhidden"},[e._v(" "+e._s(e.$t("filter.add-tag"))+" - ")]),e.isTranslatableTag?[e._v(" "+e._s(e.$t(e.name))+" ")]:[e._v(" "+e._s(e.name)+" ")],e.isRemovableTag?t("span",{staticClass:"visuallyhidden"},[e._v(" – "+e._s(e.$t("filter.tag-select-remove"))+" ")]):e._e()],2)])},Ro=[],Bo={name:"Tag",props:{name:{type:String,required:!0},isFocused:{type:Boolean,default:()=>!1},isRemovableTag:{type:Boolean,default:!1},isTranslatableTag:{type:Boolean,default:!1},isActiveTag:{type:Boolean,default:!1},activeTags:{type:Array,required:!1},keyboardIsVirtual:{type:Boolean,default:!1}},watch:{isFocused(e){e&&this.focusButton()}},mounted(){document.addEventListener("copy",this.handleCopy),document.addEventListener("cut",this.handleCut),document.addEventListener("paste",this.handlePaste),this.$once("hook:beforeDestroy",()=>{document.removeEventListener("copy",this.handleCopy),document.removeEventListener("cut",this.handleCut),document.removeEventListener("paste",this.handlePaste)})},methods:{isCurrentlyActiveElement(){return document.activeElement===this.$refs.button},handleCopy(e){if(!this.isCurrentlyActiveElement())return;e.preventDefault();let t=[];t=this.activeTags.length>0?this.activeTags:[this.name],e.clipboardData.setData("text/html",vo({tags:t})),e.clipboardData.setData("text/plain",t.join(" "))},handleCut(e){this.isCurrentlyActiveElement()&&this.isRemovableTag&&(this.handleCopy(e),this.deleteTag(e))},handlePaste(e){this.isCurrentlyActiveElement()&&this.isRemovableTag&&(e.preventDefault(),this.deleteTag(e),this.$emit("paste-content",e))},deleteTag(e){this.$emit("delete-tag",{tagName:this.name,event:e}),this.$emit("prevent-blur")},focusButton(e={}){this.keyboardIsVirtual||this.$refs.button.focus(),0===e.buttons&&this.isFocused&&this.deleteTag(e)}},computed:{ariaSelected:({isActiveTag:e,isRemovableTag:t})=>t?e?"true":"false":null}},Eo=Bo,Mo=(0,V.A)(Eo,No,Ro,!1,null,"7e76f326",null),zo=Mo.exports,Ko={name:"Tags",mixins:[Co,Oo],props:{tags:{type:Array,default:()=>[]},activeTags:{type:Array,default:()=>[]},translatableTags:{type:Array,default:()=>[]},ariaLabel:{type:String,required:!1},id:{type:String,required:!1},input:{type:String,default:null},areTagsRemovable:{type:Boolean,default:!1},keyboardIsVirtual:{type:Boolean,default:!1}},components:{Tag:zo},methods:{focusTag(e){this.focusIndex(this.tags.indexOf(e))},startingPointHook(){this.$emit("focus-prev")},handleFocus(e,t){this.focusIndex(t),this.isScrolling=!1,this.$emit("focus",e)},endingPointHook(){this.$emit("focus-next")},resetScroll(){this.$refs["scroll-wrapper"].scrollLeft=0},handleKeydown(e){const{key:t}=e,n=this.tags[this.focusedIndex];mo(t)&&n&&this.$emit("delete-tag",{tagName:n.label||n,event:e})}},computed:{totalItemsToNavigate:({tags:e})=>e.length}},qo=Ko,jo=(0,V.A)(qo,Lo,Po,!1,null,"1f2bd813",null),Fo=jo.exports;const Vo=5,Ho="filter-input",Wo="selected-tags",Uo="suggested-tags",Go={autocorrect:"off",autocapitalize:"off",spellcheck:"false",role:"combobox","aria-haspopup":"true","aria-autocomplete":"none","aria-owns":"suggestedTags","aria-controls":"suggestedTags"};var Qo,Xo,Yo={name:"FilterInput",mixins:[Co,So],constants:{FilterInputId:Ho,SelectedTagsId:Wo,SuggestedTagsId:Uo,AXinputProperties:Go,TagLimit:Vo},components:{TagList:Fo,ClearRoundedIcon:ho,FilterIcon:Do},props:{positionReversed:{type:Boolean,default:()=>!1},tags:{type:Array,default:()=>[]},selectedTags:{type:Array,default:()=>[]},preventedBlur:{type:Boolean,default:()=>!1},placeholder:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},value:{type:String,default:()=>""},shouldTruncateTags:{type:Boolean,default:!1},focusInputWhenCreated:{type:Boolean,default:!1},focusInputWhenEmpty:{type:Boolean,default:!1},selectInputOnFocus:{type:Boolean,default:!1},preventBorderStyle:{type:Boolean,default:!1},translatableTags:{type:Array,default:()=>[]}},data(){return{resetedTagsViaDeleteButton:!1,FilterInputId:Ho,SelectedTagsId:Wo,SuggestedTagsId:Uo,AXinputProperties:Go,showSuggestedTags:!1}},computed:{hasSuggestedTags:({suggestedTags:e})=>e.length,hasSelectedTags:({selectedTags:e})=>e.length,inputIsNotEmpty:({input:e,hasSelectedTags:t})=>e.length||t,searchAriaLabelledBy:({hasSelectedTags:e})=>e?Ho.concat(" ",Wo):Ho,modelValue:{get:({value:e})=>e,set(e){this.$emit("input",e)}},input:({value:e})=>e,suggestedTags:({tags:e,selectedTags:t,shouldTruncateTags:n})=>{const i=e.filter(e=>!t.includes(e));return n?i.slice(0,Vo):i},displaySuggestedTags:({showSuggestedTags:e,suggestedTags:t})=>e&&t.length>0,inputMultipleSelectionListeners:({resetActiveTags:e,handleCopy:t,handleCut:n,handlePaste:i})=>({click:e,copy:t,cut:n,paste:i}),selectedTagsMultipleSelectionListeners:({handleSingleTagClick:e,selectInputAndTags:t,handleDeleteTag:n,selectedTagsKeydownHandler:i,focusTagHandler:a,handlePaste:s})=>({"click-tags":e,"select-all":t,"delete-tag":n,keydown:i,focus:a,"paste-tags":s})},watch:{async selectedTags(){this.resetedTagsViaDeleteButton?this.resetedTagsViaDeleteButton=!1:this.$el.contains(document.activeElement)&&await this.focusInput(),this.displaySuggestedTags&&this.hasSuggestedTags&&this.$refs.suggestedTags.resetScroll()},suggestedTags:{immediate:!0,handler(e){this.$emit("suggested-tags",e)}},showSuggestedTags(e){this.$emit("show-suggested-tags",e)}},methods:{async focusInput(){await this.$nextTick(),this.$refs.input.focus(),!this.input&&this.resetActiveTags&&this.resetActiveTags()},async resetFilters(e=!1){if(this.setFilterInput(""),this.setSelectedTags([]),!e)return this.$emit("update:preventedBlur",!0),this.resetActiveTags&&this.resetActiveTags(),void await this.focusInput();this.resetedTagsViaDeleteButton=!0,this.showSuggestedTags=!1,this.$refs.input.blur()},focusFirstTag(e=()=>{}){this.showSuggestedTags||(this.showSuggestedTags=!0),this.hasSuggestedTags&&this.$refs.suggestedTags?this.$refs.suggestedTags.focusFirst():e()},setFilterInput(e){this.$emit("input",e)},setSelectedTags(e){this.$emit("update:selectedTags",e)},deleteTags(e){this.setSelectedTags(this.selectedTags.filter(t=>!e.includes(t)))},async handleBlur(e){const t=e.relatedTarget;t&&t.matches&&t.matches("button, input, ul")&&this.$el.contains(t)||(await this.$nextTick(),this.resetActiveTags(),this.preventedBlur?this.$emit("update:preventedBlur",!1):(this.showSuggestedTags=!1,this.$emit("blur")))},downHandler(e){const t=()=>this.$emit("focus-next",e);this.positionReversed?t():this.focusFirstTag(t)},upHandler(e){const t=()=>this.$emit("focus-prev",e);this.positionReversed?this.focusFirstTag(t):t()},handleFocusPrevOnSelectedTags(){this.positionReversed?this.focusFirstTag(()=>this.$emit("focus-prev")):this.$emit("focus-prev")},handleFocus(){this.showSuggestedTags=!0,this.$emit("focus")}},created(){this.focusInputWhenCreated&&document.activeElement!==this.$refs.input&&(this.inputIsNotEmpty||this.focusInputWhenEmpty)&&this.focusInput()}},Zo=Yo,Jo=(0,V.A)(Zo,ao,so,!1,null,"152b2512",null),el=Jo.exports,tl=n(6262),nl={name:"QuickNavigationHighlighter",props:{text:{type:String,required:!0},matcherText:{type:String,default:""}},render(e){const{matcherText:t,text:n}=this,i=[];let a=0;return t?([...t].forEach(t=>{const s=n.toLowerCase().indexOf(t.toLowerCase(),a);a&&i.push(e("span",n.slice(a,s)));const r=s+1;i.push(e("span",{class:"match"},n.slice(s,r))),a=r}),e("p",{class:"highlight"},i)):e("span",{class:"highlight"},n)}},il=nl,al=(0,V.A)(il,Qo,Xo,!1,null,"4a2ce75d",null),sl=al.exports,rl=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"magnifier-icon",attrs:{viewBox:"0 0 14 14",themeId:"magnifier"}},[t("path",{attrs:{d:"M15.0013 14.0319L10.9437 9.97424C11.8165 8.88933 12.2925 7.53885 12.2929 6.14645C12.2929 2.75841 9.53449 0 6.14645 0C2.75841 0 0 2.75841 0 6.14645C0 9.53449 2.75841 12.2929 6.14645 12.2929C7.57562 12.2929 8.89486 11.7932 9.94425 10.9637L14.0019 15.0213L15.0013 14.0319ZM6.13645 11.0736C4.83315 11.071 3.58399 10.5521 2.66241 9.63048C1.74084 8.70891 1.22194 7.45974 1.2193 6.15644C1.2193 3.44801 3.41802 1.23928 6.13645 1.23928C8.85488 1.23928 11.0536 3.44801 11.0536 6.15644C11.0636 8.86488 8.85488 11.0736 6.13645 11.0736Z"}})])},ol=[],ll={name:"MagnifierIcon",components:{SVGIcon:pr.A}},cl=ll,dl=(0,V.A)(cl,rl,ol,!1,null,null,null),ul=dl.exports,hl=function(){var e=this,t=e._self._c;return t("div",{staticClass:"preview"},[e.state===e.STATE.success?t("DocumentationTopic",e._b({attrs:{enableMinimized:""}},"DocumentationTopic",e.topicProps,!1)):e.state===e.STATE.loadingSlowly?t("div",{staticClass:"loading"},e._l(e.LOADER_ROW_STYLES,function(e){return t("div",{key:e["--index"],staticClass:"loading-row",style:e})}),0):e.state===e.STATE.error?t("div",{staticClass:"unavailable"},[t("p",[e._v(e._s(e.$t("quicknav.preview-unavailable")))])]):e._e()],1)},pl=[],gl=n(9787);const{extractProps:fl}=Wr.methods,ml="hero",yl={error:"error",loading:"loading",loadingSlowly:"loadingSlowly",success:"success"},vl={...gl.A,state:(0,x.o8)(gl.A.state)};var bl={name:"QuickNavigationPreview",components:{DocumentationTopic:Wr},constants:{PreviewState:yl,PreviewStore:vl},data(){return{store:vl}},provide(){return{store:this.store}},props:{json:{type:Object,required:!1},state:{type:String,required:!0,validator:e=>Object.hasOwnProperty.call(yl,e)}},computed:{LOADER_ROW_STYLES:()=>[{"--index":0,width:"30%"},{"--index":1,width:"80%"},{"--index":2,width:"50%"}],STATE:()=>yl,topicProps:({json:e})=>{const t=fl(e),{sections:n=[]}=e;let{abstract:i}=t;const a=n.find(({kind:e})=>e===ml);return!i&&a&&(i=a.content),{...t,abstract:i}}}},Tl=bl,_l=(0,V.A)(Tl,hl,pl,!1,null,"779b8b01",null),Sl=_l.exports;class kl{constructor(e){this.map=new Map,this.maxSize=e}get size(){return this.map.size}get(e){if(!this.map.has(e))return;const t=this.map.get(e);return this.map.delete(e),this.map.set(e,t),t}has(e){return this.map.has(e)}set(e,t){if(this.map.has(e)&&this.map.delete(e),this.map.set(e,t),this.map.size>this.maxSize){const e=this.map.keys().next().value;this.map.delete(e)}}*[Symbol.iterator](){yield*this.map}}const Cl="",wl=32,xl="navigator-hide-button";function Al(e){return e.split("").reduce((e,t)=>(e<<5)-e+t.charCodeAt(0)|0,0)}function Il(e){const t={},n=e.length;for(let i=0;ie.parent===Cl);const i=t[e];return i?(i.childUIDs||[]).map(e=>t[e]):[]}function Pl(e,t){const n=[],i=[e];let a=null;while(i.length){a=i.pop();const e=t[a];if(!e)return[];n.unshift(e),e.parent&&e.parent!==Cl&&i.push(e.parent)}return n}function Ol(e,t,n){const i=t[e];return i?Ll(i.parent,t,n):[]}function Nl(e){return e.flatMap(e=>[e,...Nl((e.children||[]).filter(e=>"module"===e.type))])}function Rl(e){const t=Nl(e),n=/(\/documentation\/[^/]+)/,i=window.location.pathname.match(n)?.[1]??"";return 1===t.length?t[0]:t.find(e=>e.path.toLowerCase().endsWith(i.toLowerCase()))??t[0]}function Bl(e){return Object.entries(e).reduce((e,[t,n])=>{if(!n.length)return e;const i=Rl(n);return e[t]=$l(i.children||[],null,0,i.beta),e},{})}function El(e){return Object.entries(e).reduce((e,[t,n])=>{if(!n.length)return e;const i=Rl(n);return e[t]={technology:i.title,technologyPath:i.path||i.url,isTechnologyBeta:i.beta},e},{})}var Ml=n(4610);const{PreviewState:zl}=Sl.constants,Kl="AbortError",ql=20,jl=1e3;var Fl={name:"QuickNavigationModal",components:{FilterInput:el,GenericModal:tl.A,MagnifierIcon:ul,TopicTypeIcon:we.A,QuickNavigationHighlighter:sl,Reference:Ua.A,Preview:Sl},mixins:[Oo],created(){this.abortController=null,this.$cachedSymbolResults=new kl(ql),this.loadingTimeout=null},data(){return{debouncedInput:"",userInput:this.initialFilterText,focusedInput:!1,cachedSymbolResults:{},previewIsLoadingSlowly:!1,SCROLL_LOCK_DISABLE_ATTR:Ml.f}},props:{children:{type:Array,required:!0},showQuickNavigationModal:{type:Boolean,required:!0},technology:{type:String,required:!1},placeholder:{type:String,required:!1},initialFilterText:{type:String,default:""}},computed:{childrenMap({children:e}){return Il(e)},filteredSymbols:({constructFuzzyRegex:e,children:t,fuzzyMatch:n,processedUserInput:i,childrenMap:a,orderSymbolsByPriority:s})=>{const r=t.filter(e=>"groupMarker"!==e.type&&null!=e.title);if(!i)return[];const o=n({inputLength:i.length,symbols:r,processedInputRegex:new RegExp(e(i),"i"),childrenMap:a}),l=[...new Map(o.map(e=>[e.path,e])).values()];return s(l).slice(0,ql)},placeholderText(){return this.placeholder?this.placeholder:this.technology?this.$t("filter.search-symbols",{technology:this.technology}):this.$t("filter.search")},isVisible:{get:({showQuickNavigationModal:e})=>e,set(e){this.$emit("update:showQuickNavigationModal",e)}},noResultsWereFound:({processedUserInput:e,totalItemsToNavigate:t})=>e.length&&!t,processedUserInput:({debouncedInput:e})=>e.replace(/\s/g,""),totalItemsToNavigate:({filteredSymbols:e})=>e.length,selectedSymbol:({filteredSymbols:e,focusedIndex:t})=>null!==t?e[t]:null,nextSymbol:({filteredSymbols:e,focusedIndex:t})=>{if(null===t)return null;let n=t+1;return n>=e.length&&(n=0),e[n]},focusedMatchElement:({$refs:e,focusedIndex:t})=>e.match.find(({$el:e})=>parseInt(e.dataset.index,10)===t).$el,previewJSON:({cachedSymbolResults:e,selectedSymbol:t})=>t?(e[t.uid]||{}).json:null,previewState:({cachedSymbolResults:e,previewIsLoadingSlowly:t,selectedSymbol:n})=>n&&Object.hasOwnProperty.call(e,n.uid)?e[n.uid].success?zl.success:zl.error:t?zl.loadingSlowly:zl.loading},watch:{initialFilterText(e){e&&(this.userInput=e)},userInput:"debounceInput",focusedIndex(){this.focusedInput||(this.scrollIntoView(),this.focusReference())},selectedSymbol:"fetchSelectedSymbolData",$route:"closeQuickNavigationModal"},methods:{closeQuickNavigationModal(){this.$emit("update:showQuickNavigationModal",!1)},constructFuzzyRegex(e){return[...e].reduce((t,n,i)=>t.concat(`[${n}]`).concat(i{const a=n.exec(t.title);if(!a)return!1;const s=a[0].length;return!(s>3*e)&&{uid:t.uid,title:t.title,path:t.path,parents:Pl(t.parent,i),type:t.type,inputLengthDifference:t.title.length-e,matchLength:s,matchLengthDifference:s-e,start:a.index,substring:a[0]}}).filter(Boolean)},handleKeyEnter(){!this.noResultsWereFound&&this.userInput.length&&(this.$router.push(this.filteredSymbols[this.focusedIndex].path),this.closeQuickNavigationModal())},orderSymbolsByPriority(e){return e.sort((e,t)=>e.matchLengthDifference>t.matchLengthDifference?1:e.matchLengthDifferencet.start?1:e.startt.inputLengthDifference?1:e.inputLengthDifference{this.previewState===zl.loading&&(this.previewIsLoadingSlowly=!0)},jl),!this.selectedSymbol||this.$cachedSymbolResults.has(this.selectedSymbol.uid))return clearTimeout(this.loadingTimeout),void(this.previewIsLoadingSlowly=!1);const e=async e=>{if(e&&!this.$cachedSymbolResults.has(e.uid))try{const t=await(0,x.cE)(e.path,{signal:this.abortController.signal});this.$cachedSymbolResults.set(e.uid,{success:!0,json:t})}catch(t){t.name!==Kl&&this.$cachedSymbolResults.set(e.uid,{success:!1})}finally{this.cachedSymbolResults=Object.freeze(Object.fromEntries(this.$cachedSymbolResults))}};this.abortController&&this.abortController.abort(),this.abortController=new AbortController,await Promise.all([e(this.selectedSymbol).finally(()=>{clearTimeout(this.loadingTimeout),this.previewIsLoadingSlowly=!1}),e(this.nextSymbol)])}}},Vl=Fl,Hl=(0,V.A)(Vl,no,io,!1,null,"0081cd10",null),Wl=Hl.exports,Ul=function(){var e=this,t=e._self._c;return t("div",{staticClass:"adjustable-sidebar-width",class:{dragging:e.isDragging,"sidebar-hidden":!e.enableNavigator||e.hiddenOnLarge}},[e.enableNavigator?t("div",{ref:"sidebar",staticClass:"sidebar"},[t("div",{ref:"aside",staticClass:"aside",class:e.asideClasses,style:e.asideStyles,attrs:{"aria-hidden":e.hiddenOnLarge?"true":null},on:{transitionstart:function(t){return t.target!==t.currentTarget?null:e.trackTransitionStart.apply(null,arguments)},transitionend:function(t){return t.target!==t.currentTarget?null:e.trackTransitionEnd.apply(null,arguments)}}},[e._t("aside",null,{animationClass:"aside-animated-child",scrollLockID:e.scrollLockID,breakpoint:e.breakpoint})],2),e.fixedWidth?e._e():t("div",{staticClass:"resize-handle",on:{mousedown:function(t){return t.preventDefault(),e.startDrag.apply(null,arguments)},touchstart:function(t){return t.preventDefault(),e.startDrag.apply(null,arguments)}}})]):e._e(),t("div",{ref:"content",staticClass:"content"},[e._t("default")],2),e.enableNavigator?t("BreakpointEmitter",{attrs:{scope:e.BreakpointScopes.nav},on:{change:function(t){e.breakpoint=t}}}):e._e()],1)},Gl=[],Ql=n(1176),Xl=n(7633),Yl=n(9723),Zl=n(8717),Jl=n(9404);const ec="sidebar",tc=1521,nc=543,ic=400,ac={touch:{move:"touchmove",end:"touchend"},mouse:{move:"mousemove",end:"mouseup"}},sc=(e,t=window.innerWidth)=>{const n=Math.min(t,tc);return Math.floor(Math.min(n*(e/100),n))},rc={medium:30,large:30},oc={medium:50,large:40},lc="sidebar-scroll-lock";var cc={name:"AdjustableSidebarWidth",constants:{SCROLL_LOCK_ID:lc},components:{BreakpointEmitter:Xl.A},inject:["store"],props:{shownOnMobile:{type:Boolean,default:!1},enableNavigator:{type:Boolean,default:!0},hiddenOnLarge:{type:Boolean,default:!1},fixedWidth:{type:Number,default:null}},data(){const e=window.innerWidth,t=window.innerHeight,n=lr.FC.large,i=sc(rc[n]),a=sc(oc[n]),s=e>=tc?nc:ic,r=Ql.IG.get(ec,s);return{isDragging:!1,width:this.fixedWidth||Math.min(Math.max(r,i),a),isTouch:!1,windowWidth:e,windowHeight:t,breakpoint:n,noTransition:!1,isTransitioning:!1,isOpeningOnLarge:!1,focusTrapInstance:null,mobileTopOffset:0,topOffset:0,scrollLockContainer:null}},computed:{minWidthPercent:({breakpoint:e})=>rc[e]||0,maxWidthPercent:({breakpoint:e})=>oc[e]||100,maxWidth:({maxWidthPercent:e,windowWidth:t,fixedWidth:n})=>Math.max(n,sc(e,t)),minWidth:({minWidthPercent:e,windowWidth:t,fixedWidth:n})=>Math.min(n||t,sc(e,t)),widthInPx:({width:e})=>`${e}px`,hiddenOnLargeThreshold:({minWidth:e})=>e/2,events:({isTouch:e})=>e?ac.touch:ac.mouse,asideStyles:({widthInPx:e,mobileTopOffset:t,topOffset:n,windowHeight:i})=>({width:e,"--top-offset":n?`${n}px`:null,"--top-offset-mobile":`${t}px`,"--app-height":`${i}px`}),asideClasses:({isDragging:e,shownOnMobile:t,noTransition:n,isTransitioning:i,hiddenOnLarge:a,mobileTopOffset:s,isOpeningOnLarge:r})=>({dragging:e,"show-on-mobile":t,"hide-on-large":a,"is-opening-on-large":r,"no-transition":n,"sidebar-transitioning":i,"has-mobile-top-offset":s}),scrollLockID:()=>lc,BreakpointScopes:()=>lr.fc},async mounted(){window.addEventListener("keydown",this.onEscapeKeydown),window.addEventListener("resize",this.storeWindowSize,{passive:!0}),window.addEventListener("orientationchange",this.storeWindowSize,{passive:!0}),this.storeTopOffset(),0===this.topOffset&&0===window.scrollY||window.addEventListener("scroll",this.storeTopOffset,{passive:!0}),this.$once("hook:beforeDestroy",()=>{window.removeEventListener("keydown",this.onEscapeKeydown),window.removeEventListener("resize",this.storeWindowSize),window.removeEventListener("orientationchange",this.storeWindowSize),window.removeEventListener("scroll",this.storeTopOffset),this.shownOnMobile&&this.toggleScrollLock(!1),this.focusTrapInstance&&this.focusTrapInstance.destroy()}),await this.$nextTick(),this.focusTrapInstance=new Yl.A(this.$refs.aside)},watch:{$route:"closeMobileSidebar",width:{immediate:!0,handler:Ee(function(e){this.emitEventChange(e)},150)},windowWidth:"getWidthInCheck",async breakpoint(e){this.getWidthInCheck(),e===lr.FC.large&&this.closeMobileSidebar(),this.noTransition=!0,await(0,Me.u)(5),this.noTransition=!1},shownOnMobile:"handleExternalOpen",async isTransitioning(e){e?(await(0,Me.f)(1e3),this.isTransitioning=!1):this.updateContentWidthInStore()},hiddenOnLarge(){this.isTransitioning=!0}},methods:{getWidthInCheck:bo(function(){this.width>this.maxWidth?this.width=this.maxWidth:this.widththis.maxWidth&&(i=this.maxWidth),this.hiddenOnLarge&&i>=this.hiddenOnLargeThreshold&&(this.$emit("update:hiddenOnLarge",!1),this.isOpeningOnLarge=!0),this.width=Math.max(i,this.minWidth),i<=this.hiddenOnLargeThreshold&&this.$emit("update:hiddenOnLarge",!0)},stopDrag(e){e.preventDefault(),this.isDragging&&(this.isDragging=!1,Ql.IG.set(ec,this.width),document.removeEventListener(this.events.move,this.handleDrag),document.removeEventListener(this.events.end,this.stopDrag),this.emitEventChange(this.width))},emitEventChange(e){this.$emit("width-change",e),this.updateContentWidthInStore()},getTopOffset(){const e=document.getElementById(Jl.G3);if(!e)return 0;const{y:t}=e.getBoundingClientRect();return Math.max(t,0)},handleExternalOpen(e){e&&(this.mobileTopOffset=this.getTopOffset()),this.toggleScrollLock(e)},async updateContentWidthInStore(){await this.$nextTick(),this.store.setContentWidth(this.$refs.content.offsetWidth)},async toggleScrollLock(e){this.scrollLockContainer&&(Ml.A.unlockScroll(this.scrollLockContainer),this.focusTrapInstance.stop(),Zl.A.show(this.$refs.aside),this.scrollLockContainer=null),e&&(await this.$nextTick(),this.scrollLockContainer=document.getElementById(this.scrollLockID),this.scrollLockContainer&&(Ml.A.lockScroll(this.scrollLockContainer),this.focusTrapInstance.start(),Zl.A.hide(this.$refs.aside)))},storeTopOffset:Ee(function(){this.topOffset=this.getTopOffset()},60),async trackTransitionStart({propertyName:e}){"width"!==e&&"transform"!==e||(this.isTransitioning=!0)},trackTransitionEnd({propertyName:e}){"width"!==e&&"transform"!==e||(this.isTransitioning=!1,this.isOpeningOnLarge=!1)}}},dc=cc,uc=(0,V.A)(dc,Ul,Gl,!1,null,"55e81445",null),hc=uc.exports,pc=function(){var e=this,t=e._self._c;return t("nav",{staticClass:"navigator",attrs:{"aria-labelledby":e.INDEX_ROOT_KEY}},[e.isFetching?t("LoadingNavigatorCard",{on:{close:function(t){return e.$emit("close")}}}):t("NavigatorCard",e._b({attrs:{type:e.type,children:e.flatChildren,"active-path":e.activePath,scrollLockID:e.scrollLockID,"error-fetching":e.errorFetching,"render-filter-on-top":e.renderFilterOnTop,"api-changes":e.apiChanges,"navigator-references":e.navigatorReferences},on:{close:function(t){return e.$emit("close")}},scopedSlots:e._u([{key:"filter",fn:function(){return[e._t("filter")]},proxy:!0},{key:"above-navigator-head",fn:function(){return[e._t("above-navigator-head")]},proxy:!0},{key:"navigator-head",fn:function(){return[e._t("navigator-head",null,{className:"nav-title"})]},proxy:!0}],null,!0)},"NavigatorCard",e.technologyProps,!1)),t("div",{staticClass:"visuallyhidden",attrs:{"aria-live":"polite"}},[e._v(" "+e._s(e.$t("navigator.navigator-is",{state:e.isFetching?e.$t("navigator.state.loading"):e.$t("navigator.state.ready")}))+" ")])],1)},gc=[],fc=function(){var e=this,t=e._self._c;return t("BaseNavigatorCard",e._b({class:{"filter-on-top":e.renderFilterOnTop},on:{close:function(t){return e.$emit("close")}},scopedSlots:e._u([{key:"above-navigator-head",fn:function(){return[e._t("above-navigator-head")]},proxy:!0},{key:"navigator-head",fn:function(){return[e._t("navigator-head")]},proxy:!0},{key:"body",fn:function({className:n}){return[e._t("post-head"),t("div",{class:n,on:{"!keydown":[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:t.altKey?(t.preventDefault(),e.focusFirst.apply(null,arguments)):null},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:t.altKey?(t.preventDefault(),e.focusLast.apply(null,arguments)):null},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(t.preventDefault(),e.focusPrev.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(t.preventDefault(),e.focusNext.apply(null,arguments))}]}},[e.technology?t("Reference",{class:["technology-title",{"router-link-exact-active":e.isTechnologyRoute}],attrs:{id:e.INDEX_ROOT_KEY,url:e.technologyPath},nativeOn:{click:function(t){return t.altKey?(t.preventDefault(),e.toggleAllNodes.apply(null,arguments)):null}}},[t("h2",{staticClass:"card-link"},[e._v(" "+e._s(e.technology)+" ")]),e.isTechnologyBeta?t("Badge",{attrs:{variant:"beta"}}):e._e()],1):e._e(),t("DynamicScroller",{directives:[{name:"show",rawName:"v-show",value:e.hasNodes,expression:"hasNodes"}],ref:"scroller",staticClass:"scroller",attrs:{id:e.scrollLockID,"aria-label":e.$t("navigator.title"),items:e.navigatorItems,"min-item-size":e.itemSize,"emit-update":"","key-field":"uid"},on:{update:e.handleScrollerUpdate,"!keydown":[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:t.altKey?(t.preventDefault(),e.focusFirst.apply(null,arguments)):null},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:t.altKey?(t.preventDefault(),e.focusLast.apply(null,arguments)):null},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(t.preventDefault(),e.focusPrev.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(t.preventDefault(),e.focusNext.apply(null,arguments))}]},nativeOn:{focusin:function(t){return e.handleFocusIn.apply(null,arguments)},focusout:function(t){return e.handleFocusOut.apply(null,arguments)}},scopedSlots:e._u([{key:"default",fn:function({item:n,active:i,index:a}){return[t("DynamicScrollerItem",e._b({ref:`dynamicScroller_${n.uid}`},"DynamicScrollerItem",{active:i,item:n,dataIndex:a},!1),[t("NavigatorCardItem",{attrs:{item:n,isRendered:i,"filter-pattern":e.filterPattern,"filter-text":e.debouncedFilter,"is-active":n.uid===e.activeUID,"is-bold":e.activePathMap[n.uid],expanded:e.openNodes[n.uid],"api-change":e.apiChangesObject[n.path],isFocused:e.focusedIndex===a,enableFocus:!e.externalFocusChange,"navigator-references":e.navigatorReferences},on:{toggle:e.toggle,"toggle-full":e.toggleFullTree,"toggle-siblings":e.toggleSiblings,navigate:e.handleNavigationChange,"focus-parent":e.focusNodeParent}})],1)]}}],null,!0)}),t("div",{staticClass:"visuallyhidden",attrs:{"aria-live":"polite"}},[e._v(" "+e._s(e.politeAriaLive)+" ")]),t("div",{staticClass:"no-items-wrapper",attrs:{"aria-live":"assertive"}},[t("p",{staticClass:"no-items"},[e._v(e._s(e.$t(e.assertiveAriaLive)))])])],1),e.errorFetching?e._e():t("div",{staticClass:"filter-wrapper"},[t("div",{staticClass:"navigator-filter"},[t("div",{staticClass:"input-wrapper"},[t("FilterInput",{staticClass:"filter-component",attrs:{tags:e.suggestedTags,translatableTags:e.translatableTags,"selected-tags":e.selectedTags,placeholder:e.$t("filter.title"),"should-keep-open-on-blur":!1,shouldTruncateTags:e.shouldTruncateTags,"position-reversed":!e.renderFilterOnTop},on:{"update:selectedTags":function(t){e.selectedTags=t},"update:selected-tags":function(t){e.selectedTags=t},clear:e.clearFilters},model:{value:e.filter,callback:function(t){e.filter=t},expression:"filter"}})],1),e._t("filter")],2)])]}}],null,!0)},"BaseNavigatorCard",{isTechnologyBeta:e.isTechnologyBeta,technologyPath:e.technologyPath},!1))},mc=[];n(7588);function yc(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return parseInt(e.substring(t+5,e.indexOf(".",t)),10);var n=e.indexOf("Trident/");if(n>0){var i=e.indexOf("rv:");return parseInt(e.substring(i+3,e.indexOf(".",i)),10)}var a=e.indexOf("Edge/");return a>0?parseInt(e.substring(a+5,e.indexOf(".",a)),10):-1}var vc=void 0;function bc(){bc.init||(bc.init=!0,vc=-1!==yc())}var Tc={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"resize-observer",attrs:{tabindex:"-1"}})},staticRenderFns:[],_scopeId:"data-v-b329ee4c",name:"resize-observer",methods:{compareAndNotify:function(){this._w===this.$el.offsetWidth&&this._h===this.$el.offsetHeight||(this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.$emit("notify"))},addResizeHandlers:function(){this._resizeObject.contentDocument.defaultView.addEventListener("resize",this.compareAndNotify),this.compareAndNotify()},removeResizeHandlers:function(){this._resizeObject&&this._resizeObject.onload&&(!vc&&this._resizeObject.contentDocument&&this._resizeObject.contentDocument.defaultView.removeEventListener("resize",this.compareAndNotify),delete this._resizeObject.onload)}},mounted:function(){var e=this;bc(),this.$nextTick(function(){e._w=e.$el.offsetWidth,e._h=e.$el.offsetHeight});var t=document.createElement("object");this._resizeObject=t,t.setAttribute("aria-hidden","true"),t.setAttribute("tabindex",-1),t.onload=this.addResizeHandlers,t.type="text/html",vc&&this.$el.appendChild(t),t.data="about:blank",vc||this.$el.appendChild(t)},beforeDestroy:function(){this.removeResizeHandlers()}};function _c(e){e.component("resize-observer",Tc),e.component("ResizeObserver",Tc)}var Sc={version:"0.4.5",install:_c},kc=null;"undefined"!==typeof window?kc=window.Vue:"undefined"!==typeof n.g&&(kc=n.g.Vue),kc&&kc.use(Sc);function Cc(e){return Cc="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Cc(e)}function wc(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function xc(e,t){for(var n=0;n2&&void 0!==arguments[2]?arguments[2]:{},r=function(r){for(var o=arguments.length,l=new Array(o>1?o-1:0),c=1;c1){var i=e.find(function(e){return e.isIntersecting});i&&(t=i)}if(n.callback){var a=t.isIntersecting&&t.intersectionRatio>=n.threshold;if(a===n.oldResult)return;n.oldResult=a,n.callback(a,t)}},this.options.intersection),t.context.$nextTick(function(){n.observer&&n.observer.observe(n.el)})}}},{key:"destroyObserver",value:function(){this.observer&&(this.observer.disconnect(),this.observer=null),this.callback&&this.callback._clear&&(this.callback._clear(),this.callback=null)}},{key:"threshold",get:function(){return this.options.intersection&&this.options.intersection.threshold||0}}]),e}();function Bc(e,t,n){var i=t.value;if(i)if("undefined"===typeof IntersectionObserver)console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill");else{var a=new Rc(e,i,n);e._vue_visibilityState=a}}function Ec(e,t,n){var i=t.value,a=t.oldValue;if(!Nc(i,a)){var s=e._vue_visibilityState;i?s?s.createObserver(i,n):Bc(e,{value:i},n):Mc(e)}}function Mc(e){var t=e._vue_visibilityState;t&&(t.destroyObserver(),delete e._vue_visibilityState)}var zc={bind:Bc,update:Ec,unbind:Mc};function Kc(e){e.directive("observe-visibility",zc)}var qc={version:"0.4.6",install:Kc},jc=null;"undefined"!==typeof window?jc=window.Vue:"undefined"!==typeof n.g&&(jc=n.g.Vue),jc&&jc.use(qc);var Fc=n(7783),Vc=n.n(Fc),Hc=n(5471),Wc={itemsLimit:1e3};const Uc={items:{type:Array,required:!0},keyField:{type:String,default:"id"},direction:{type:String,default:"vertical",validator:e=>["vertical","horizontal"].includes(e)},listTag:{type:String,default:"div"},itemTag:{type:String,default:"div"}};function Gc(){return this.items.length&&"object"!==typeof this.items[0]}let Qc=!1;if("undefined"!==typeof window){Qc=!1;try{var Xc=Object.defineProperty({},"passive",{get(){Qc=!0}});window.addEventListener("test",null,Xc)}catch(_h){}}let Yc=0;var Zc={name:"RecycleScroller",components:{ResizeObserver:Tc},directives:{ObserveVisibility:zc},props:{...Uc,itemSize:{type:Number,default:null},gridItems:{type:Number,default:void 0},itemSecondarySize:{type:Number,default:void 0},minItemSize:{type:[Number,String],default:null},sizeField:{type:String,default:"size"},typeField:{type:String,default:"type"},buffer:{type:Number,default:200},pageMode:{type:Boolean,default:!1},prerender:{type:Number,default:0},emitUpdate:{type:Boolean,default:!1},skipHover:{type:Boolean,default:!1},listTag:{type:String,default:"div"},itemTag:{type:String,default:"div"},listClass:{type:[String,Object,Array],default:""},itemClass:{type:[String,Object,Array],default:""}},data(){return{pool:[],totalSize:0,ready:!1,hoverKey:null}},computed:{sizes(){if(null===this.itemSize){const e={"-1":{accumulator:0}},t=this.items,n=this.sizeField,i=this.minItemSize;let a,s=1e4,r=0;for(let o=0,l=t.length;o{this.$_prerender=!1,this.updateVisibleItems(!0),this.ready=!0})},activated(){const e=this.$_lastUpdateScrollPosition;"number"===typeof e&&this.$nextTick(()=>{this.scrollToPosition(e)})},beforeDestroy(){this.removeListeners()},methods:{addView(e,t,n,i,a){const s={item:n,position:0},r={id:Yc++,index:t,used:!0,key:i,type:a};return Object.defineProperty(s,"nr",{configurable:!1,value:r}),e.push(s),s},unuseView(e,t=!1){const n=this.$_unusedViews,i=e.nr.type;let a=n.get(i);a||(a=[],n.set(i,a)),a.push(e),t||(e.nr.used=!1,e.position=-9999,this.$_views.delete(e.nr.key))},handleResize(){this.$emit("resize"),this.ready&&this.updateVisibleItems(!1)},handleScroll(e){this.$_scrollDirty||(this.$_scrollDirty=!0,requestAnimationFrame(()=>{this.$_scrollDirty=!1;const{continuous:e}=this.updateVisibleItems(!1,!0);e||(clearTimeout(this.$_refreshTimout),this.$_refreshTimout=setTimeout(this.handleScroll,100))}))},handleVisibilityChange(e,t){this.ready&&(e||0!==t.boundingClientRect.width||0!==t.boundingClientRect.height?(this.$emit("visible"),requestAnimationFrame(()=>{this.updateVisibleItems(!1)})):this.$emit("hidden"))},updateVisibleItems(e,t=!1){const n=this.itemSize,i=this.gridItems||1,a=this.itemSecondarySize||n,s=this.$_computedMinItemSize,r=this.typeField,o=this.simpleArray?null:this.keyField,l=this.items,c=l.length,d=this.sizes,u=this.$_views,h=this.$_unusedViews,p=this.pool;let g,f,m,y,v,b;if(c)if(this.$_prerender)g=y=0,f=v=Math.min(this.prerender,l.length),m=null;else{const e=this.getScroll();if(t){let t=e.start-this.$_lastUpdateScrollPosition;if(t<0&&(t=-t),null===n&&te.start&&(a=s),s=~~((i+a)/2)}while(s!==n);for(s<0&&(s=0),g=s,m=d[c-1].accumulator,f=s;fc&&(f=c)),y=g;yc&&(f=c),y<0&&(y=0),v>c&&(v=c),m=Math.ceil(c/i)*n}}else g=f=y=v=m=0;f-g>Wc.itemsLimit&&this.itemsLimitError(),this.totalSize=m;const T=g<=this.$_endIndex&&f>=this.$_startIndex;if(this.$_continuous!==T){if(T){u.clear(),h.clear();for(let e=0,t=p.length;e=f)&&this.unuseView(b));const _=T?null:new Map;let S,k,C,w;for(let x=g;x=C.length)&&(b=this.addView(p,x,S,e,k),this.unuseView(b,!0),C=h.get(k)),b=C[w],b.item=S,b.nr.used=!0,b.nr.index=x,b.nr.key=e,b.nr.type=k,_.set(k,w+1),w++),u.set(e,b)),null===n?(b.position=d[x-1].accumulator,b.offset=0):(b.position=Math.floor(x/i)*n,b.offset=x%i*a)):b&&this.unuseView(b)}return this.$_startIndex=g,this.$_endIndex=f,this.emitUpdate&&this.$emit("update",g,f,y,v),clearTimeout(this.$_sortTimer),this.$_sortTimer=setTimeout(this.sortViews,300),{continuous:T}},getListenerTarget(){let e=Vc()(this.$el);return!window.document||e!==window.document.documentElement&&e!==window.document.body||(e=window),e},getScroll(){const{$el:e,direction:t}=this,n="vertical"===t;let i;if(this.pageMode){const t=e.getBoundingClientRect(),a=n?t.height:t.width;let s=-(n?t.top:t.left),r=n?window.innerHeight:window.innerWidth;s<0&&(r+=s,s=0),s+r>a&&(r=a-s),i={start:s,end:s+r}}else i=n?{start:e.scrollTop,end:e.scrollTop+e.clientHeight}:{start:e.scrollLeft,end:e.scrollLeft+e.clientWidth};return i},applyPageMode(){this.pageMode?this.addListeners():this.removeListeners()},addListeners(){this.listenerTarget=this.getListenerTarget(),this.listenerTarget.addEventListener("scroll",this.handleScroll,!!Qc&&{passive:!0}),this.listenerTarget.addEventListener("resize",this.handleResize)},removeListeners(){this.listenerTarget&&(this.listenerTarget.removeEventListener("scroll",this.handleScroll),this.listenerTarget.removeEventListener("resize",this.handleResize),this.listenerTarget=null)},scrollToItem(e){let t;t=null===this.itemSize?e>0?this.sizes[e-1].accumulator:0:Math.floor(e/this.gridItems)*this.itemSize,this.scrollToPosition(t)},scrollToPosition(e){const t="vertical"===this.direction?{scroll:"scrollTop",start:"top"}:{scroll:"scrollLeft",start:"left"};let n,i,a;if(this.pageMode){const s=Vc()(this.$el),r="HTML"===s.tagName?0:s[t.scroll],o=s.getBoundingClientRect(),l=this.$el.getBoundingClientRect(),c=l[t.start]-o[t.start];n=s,i=t.scroll,a=e+r+c}else n=this.$el,i=t.scroll,a=e;n[i]=a},itemsLimitError(){throw setTimeout(()=>{console.log("It seems the scroller element isn't scrolling, so it tries to render all the items at once.","Scroller:",this.$el),console.log("Make sure the scroller has a fixed height (or width) and 'overflow-y' (or 'overflow-x') set to 'auto' so it can scroll correctly and only render the items visible in the scroll viewport.")}),new Error("Rendered items limit reached")},sortViews(){this.pool.sort((e,t)=>e.nr.index-t.nr.index)}}};function Jc(e,t,n,i,a,s,r,o,l,c){"boolean"!==typeof r&&(l=o,o=r,r=!1);const d="function"===typeof n?n.options:n;let u;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,a&&(d.functional=!0)),i&&(d._scopeId=i),s?(u=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,l(e)),e&&e._registeredComponents&&e._registeredComponents.add(s)},d._ssrRegister=u):t&&(u=r?function(e){t.call(this,c(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,o(e))}),u)if(d.functional){const e=d.render;d.render=function(t,n){return u.call(n),e(t,n)}}else{const e=d.beforeCreate;d.beforeCreate=e?[].concat(e,u):[u]}return n}const ed=Zc;var td=function(){var e,t,n=this,i=n.$createElement,a=n._self._c||i;return a("div",{directives:[{name:"observe-visibility",rawName:"v-observe-visibility",value:n.handleVisibilityChange,expression:"handleVisibilityChange"}],staticClass:"vue-recycle-scroller",class:(e={ready:n.ready,"page-mode":n.pageMode},e["direction-"+n.direction]=!0,e),on:{"&scroll":function(e){return n.handleScroll.apply(null,arguments)}}},[n.$slots.before?a("div",{ref:"before",staticClass:"vue-recycle-scroller__slot"},[n._t("before")],2):n._e(),n._v(" "),a(n.listTag,{ref:"wrapper",tag:"component",staticClass:"vue-recycle-scroller__item-wrapper",class:n.listClass,style:(t={},t["vertical"===n.direction?"minHeight":"minWidth"]=n.totalSize+"px",t)},[n._l(n.pool,function(e){return a(n.itemTag,n._g({key:e.nr.id,tag:"component",staticClass:"vue-recycle-scroller__item-view",class:[n.itemClass,{hover:!n.skipHover&&n.hoverKey===e.nr.key}],style:n.ready?{transform:"translate"+("vertical"===n.direction?"Y":"X")+"("+e.position+"px) translate"+("vertical"===n.direction?"X":"Y")+"("+e.offset+"px)",width:n.gridItems?("vertical"===n.direction&&n.itemSecondarySize||n.itemSize)+"px":void 0,height:n.gridItems?("horizontal"===n.direction&&n.itemSecondarySize||n.itemSize)+"px":void 0}:null},n.skipHover?{}:{mouseenter:function(){n.hoverKey=e.nr.key},mouseleave:function(){n.hoverKey=null}}),[n._t("default",null,{item:e.item,index:e.nr.index,active:e.nr.used})],2)}),n._v(" "),n._t("empty")],2),n._v(" "),n.$slots.after?a("div",{ref:"after",staticClass:"vue-recycle-scroller__slot"},[n._t("after")],2):n._e(),n._v(" "),a("ResizeObserver",{on:{notify:n.handleResize}})],1)},nd=[];td._withStripped=!0;const id=void 0,ad=void 0,sd=void 0,rd=!1,od=Jc({render:td,staticRenderFns:nd},id,ed,ad,rd,sd,!1,void 0,void 0,void 0);var ld={name:"DynamicScroller",components:{RecycleScroller:od},provide(){return"undefined"!==typeof ResizeObserver&&(this.$_resizeObserver=new ResizeObserver(e=>{requestAnimationFrame(()=>{if(Array.isArray(e))for(const t of e)if(t.target){const e=new CustomEvent("resize",{detail:{contentRect:t.contentRect}});t.target.dispatchEvent(e)}})})),{vscrollData:this.vscrollData,vscrollParent:this,vscrollResizeObserver:this.$_resizeObserver}},inheritAttrs:!1,props:{...Uc,minItemSize:{type:[Number,String],required:!0}},data(){return{vscrollData:{active:!0,sizes:{},validSizes:{},keyField:this.keyField,simpleArray:!1}}},computed:{simpleArray:Gc,itemsWithSize(){const e=[],{items:t,keyField:n,simpleArray:i}=this,a=this.vscrollData.sizes,s=t.length;for(let r=0;r=n)break;i+=t[o].size||this.minItemSize,a+=e[o].size||this.minItemSize}const r=a-i;0!==r&&(this.$el.scrollTop+=r)}},beforeCreate(){this.$_updates=[],this.$_undefinedSizes=0,this.$_undefinedMap={}},activated(){this.vscrollData.active=!0},deactivated(){this.vscrollData.active=!1},methods:{onScrollerResize(){const e=this.$refs.scroller;e&&this.forceUpdate(),this.$emit("resize")},onScrollerVisible(){this.$emit("vscroll:update",{force:!1}),this.$emit("visible")},forceUpdate(e=!0){(e||this.simpleArray)&&(this.vscrollData.validSizes={}),this.$emit("vscroll:update",{force:!0})},scrollToItem(e){const t=this.$refs.scroller;t&&t.scrollToItem(e)},getItemSize(e,t=void 0){const n=this.simpleArray?null!=t?t:this.items.indexOf(e):e[this.keyField];return this.vscrollData.sizes[n]||0},scrollToBottom(){if(this.$_scrollingToBottom)return;this.$_scrollingToBottom=!0;const e=this.$el;this.$nextTick(()=>{e.scrollTop=e.scrollHeight+5e3;const t=()=>{e.scrollTop=e.scrollHeight+5e3,requestAnimationFrame(()=>{e.scrollTop=e.scrollHeight+5e3,0===this.$_undefinedSizes?this.$_scrollingToBottom=!1:requestAnimationFrame(t)})};requestAnimationFrame(t)})}}};const cd=ld;var dd=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("RecycleScroller",e._g(e._b({ref:"scroller",attrs:{items:e.itemsWithSize,"min-item-size":e.minItemSize,direction:e.direction,"key-field":"id","list-tag":e.listTag,"item-tag":e.itemTag},on:{resize:e.onScrollerResize,visible:e.onScrollerVisible},scopedSlots:e._u([{key:"default",fn:function(t){var n=t.item,i=t.index,a=t.active;return[e._t("default",null,null,{item:n.item,index:i,active:a,itemWithSize:n})]}}],null,!0)},"RecycleScroller",e.$attrs,!1),e.listeners),[e._v(" "),n("template",{slot:"before"},[e._t("before")],2),e._v(" "),n("template",{slot:"after"},[e._t("after")],2),e._v(" "),n("template",{slot:"empty"},[e._t("empty")],2)],2)},ud=[];dd._withStripped=!0;const hd=void 0,pd=void 0,gd=void 0,fd=!1,md=Jc({render:dd,staticRenderFns:ud},hd,cd,pd,fd,gd,!1,void 0,void 0,void 0);var yd={name:"DynamicScrollerItem",inject:["vscrollData","vscrollParent","vscrollResizeObserver"],props:{item:{required:!0},watchData:{type:Boolean,default:!1},active:{type:Boolean,required:!0},index:{type:Number,default:void 0},sizeDependencies:{type:[Array,Object],default:null},emitResize:{type:Boolean,default:!1},tag:{type:String,default:"div"}},computed:{id(){if(this.vscrollData.simpleArray)return this.index;if(this.item.hasOwnProperty(this.vscrollData.keyField))return this.item[this.vscrollData.keyField];throw new Error(`keyField '${this.vscrollData.keyField}' not found in your item. You should set a valid keyField prop on your Scroller`)},size(){return this.vscrollData.validSizes[this.id]&&this.vscrollData.sizes[this.id]||0},finalActive(){return this.active&&this.vscrollData.active}},watch:{watchData:"updateWatchData",id(){this.size||this.onDataUpdate()},finalActive(e){this.size||(e?this.vscrollParent.$_undefinedMap[this.id]||(this.vscrollParent.$_undefinedSizes++,this.vscrollParent.$_undefinedMap[this.id]=!0):this.vscrollParent.$_undefinedMap[this.id]&&(this.vscrollParent.$_undefinedSizes--,this.vscrollParent.$_undefinedMap[this.id]=!1)),this.vscrollResizeObserver?e?this.observeSize():this.unobserveSize():e&&this.$_pendingVScrollUpdate===this.id&&this.updateSize()}},created(){if(!this.$isServer&&(this.$_forceNextVScrollUpdate=null,this.updateWatchData(),!this.vscrollResizeObserver)){for(const e in this.sizeDependencies)this.$watch(()=>this.sizeDependencies[e],this.onDataUpdate);this.vscrollParent.$on("vscroll:update",this.onVscrollUpdate),this.vscrollParent.$on("vscroll:update-size",this.onVscrollUpdateSize)}},mounted(){this.vscrollData.active&&(this.updateSize(),this.observeSize())},beforeDestroy(){this.vscrollParent.$off("vscroll:update",this.onVscrollUpdate),this.vscrollParent.$off("vscroll:update-size",this.onVscrollUpdateSize),this.unobserveSize()},methods:{updateSize(){this.finalActive?this.$_pendingSizeUpdate!==this.id&&(this.$_pendingSizeUpdate=this.id,this.$_forceNextVScrollUpdate=null,this.$_pendingVScrollUpdate=null,this.computeSize(this.id)):this.$_forceNextVScrollUpdate=this.id},updateWatchData(){this.watchData&&!this.vscrollResizeObserver?this.$_watchData=this.$watch("item",()=>{this.onDataUpdate()},{deep:!0}):this.$_watchData&&(this.$_watchData(),this.$_watchData=null)},onVscrollUpdate({force:e}){!this.finalActive&&e&&(this.$_pendingVScrollUpdate=this.id),this.$_forceNextVScrollUpdate!==this.id&&!e&&this.size||this.updateSize()},onDataUpdate(){this.updateSize()},computeSize(e){this.$nextTick(()=>{if(this.id===e){const e=this.$el.offsetWidth,t=this.$el.offsetHeight;this.applySize(e,t)}this.$_pendingSizeUpdate=null})},applySize(e,t){const n=~~("vertical"===this.vscrollParent.direction?t:e);n&&this.size!==n&&(this.vscrollParent.$_undefinedMap[this.id]&&(this.vscrollParent.$_undefinedSizes--,this.vscrollParent.$_undefinedMap[this.id]=void 0),this.$set(this.vscrollData.sizes,this.id,n),this.$set(this.vscrollData.validSizes,this.id,!0),this.emitResize&&this.$emit("resize",this.id))},observeSize(){this.vscrollResizeObserver&&this.$el.parentNode&&(this.vscrollResizeObserver.observe(this.$el.parentNode),this.$el.parentNode.addEventListener("resize",this.onResize))},unobserveSize(){this.vscrollResizeObserver&&(this.vscrollResizeObserver.unobserve(this.$el.parentNode),this.$el.parentNode.removeEventListener("resize",this.onResize))},onResize(e){const{width:t,height:n}=e.detail.contentRect;this.applySize(t,n)}},render(e){return e(this.tag,this.$slots.default)}};const vd=yd,bd=void 0,Td=void 0,_d=void 0,Sd=void 0,kd=Jc({},bd,vd,Td,Sd,_d,!1,void 0,void 0,void 0);function Cd({idProp:e=e=>e.item.id}={}){const t={},n=new Hc["default"]({data(){return{store:t}}});return{data(){return{idState:null}},created(){this.$_id=null,this.$_getId="function"===typeof e?()=>e.call(this,this):()=>this[e],this.$watch(this.$_getId,{handler(e){this.$nextTick(()=>{this.$_id=e})},immediate:!0}),this.$_updateIdState()},beforeUpdate(){this.$_updateIdState()},methods:{$_idStateInit(e){const i=this.$options.idState;if("function"===typeof i){const a=i.call(this,this);return n.$set(t,e,a),this.$_id=e,a}throw new Error("[mixin IdState] Missing `idState` function on component definition.")},$_updateIdState(){const n=this.$_getId();null==n&&console.warn(`No id found for IdState with idProp: '${e}'.`),n!==this.$_id&&(t[n]||this.$_idStateInit(n),this.idState=t[n])}}}}function wd(e,t){e.component(`${t}recycle-scroller`,od),e.component(`${t}RecycleScroller`,od),e.component(`${t}dynamic-scroller`,md),e.component(`${t}DynamicScroller`,md),e.component(`${t}dynamic-scroller-item`,kd),e.component(`${t}DynamicScrollerItem`,kd)}const xd={version:"1.1.2",install(e,t){const n=Object.assign({},{installComponents:!0,componentsPrefix:""},t);for(const i in n)"undefined"!==typeof n[i]&&(Wc[i]=n[i]);n.installComponents&&wd(e,n.componentsPrefix)}};let Ad=null;function Id(e){const t=(0,Tn.LE)((0,Tn.Nt)(e));return new RegExp(t,"ig")}"undefined"!==typeof window?Ad=window.Vue:"undefined"!==typeof n.g&&(Ad=n.g.Vue),Ad&&Ad.use(xd);var $d,Dd,Ld=function(){var e=this,t=e._self._c;return t("BaseNavigatorCardItem",{class:{expanded:e.expanded,active:e.isActive,"is-group":e.isGroupMarker},style:{"--nesting-index":e.item.depth},attrs:{"data-nesting-index":e.item.depth,id:`container-${e.item.uid}`,"aria-hidden":e.isRendered?null:"true",hideNavigatorIcon:e.isGroupMarker},nativeOn:{keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"left",37,t.key,["Left","ArrowLeft"])||"button"in t&&0!==t.button?null:(t.preventDefault(),e.handleLeftKeydown.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"right",39,t.key,["Right","ArrowRight"])||"button"in t&&2!==t.button||t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(t.preventDefault(),e.handleRightKeydown.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.preventDefault(),e.clickReference.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"right",39,t.key,["Right","ArrowRight"])?null:t.altKey?"button"in t&&2!==t.button?null:(t.preventDefault(),e.toggleEntireTree.apply(null,arguments)):null}]},scopedSlots:e._u([{key:"depth-spacer",fn:function(){return[t("span",{attrs:{hidden:"",id:e.usageLabel}},[e._v(" "+e._s(e.$t("filter.navigate"))+" ")]),e.isParent?t("button",{staticClass:"tree-toggle",attrs:{tabindex:"-1","aria-labelledby":e.item.uid,"aria-expanded":e.expanded?"true":"false","aria-describedby":e.ariaDescribedBy},on:{click:[function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:(t.preventDefault(),e.toggleTree.apply(null,arguments))},function(t){return t.altKey?(t.preventDefault(),e.toggleEntireTree.apply(null,arguments)):null},function(t){return t.metaKey?(t.preventDefault(),e.toggleSiblings.apply(null,arguments)):null}]}},[t("InlineChevronRightIcon",{staticClass:"icon-inline chevron",class:{rotate:e.expanded,animating:e.idState.isOpening}})],1):e._e()]},proxy:!0},{key:"navigator-icon",fn:function({className:n}){return[e.apiChange?t("span",{class:[{[`changed changed-${e.apiChange}`]:e.apiChange},n]}):t("TopicTypeIcon",{key:e.item.uid,class:n,attrs:{type:e.item.type,"image-override":e.item.icon?e.navigatorReferences[e.item.icon]:null,shouldCalculateOptimalWidth:!1}})]}},{key:"title-container",fn:function(){return[e.isParent?t("span",{attrs:{hidden:"",id:e.parentLabel}},[e._v(e._s(e.$tc("filter.parent-label",e.item.childUIDs.length,{"number-siblings":e.item.index+1,"total-siblings":e.item.siblingsCount,"parent-siblings":e.item.parent,"number-parent":e.item.childUIDs.length})))]):e._e(),e.isParent?e._e():t("span",{attrs:{id:e.siblingsLabel,hidden:""}},[e._v(" "+e._s(e.$t("filter.siblings-label",{"number-siblings":e.item.index+1,"total-siblings":e.item.siblingsCount,"parent-siblings":e.item.parent}))+" ")]),t(e.refComponent,{ref:"reference",tag:"component",staticClass:"leaf-link",class:{bolded:e.isBold},attrs:{id:e.item.uid,url:e.isGroupMarker?null:e.item.path||"",tabindex:e.isFocused?"0":"-1","aria-describedby":`${e.ariaDescribedBy} ${e.usageLabel}`},nativeOn:{click:[function(t){return t.ctrlKey||t.shiftKey||t.altKey||t.metaKey?null:e.handleClick.apply(null,arguments)},function(t){return t.altKey?(t.preventDefault(),e.toggleEntireTree.apply(null,arguments)):null}]}},[t("HighlightMatches",{attrs:{text:e.item.title,matcher:e.filterPattern}})],1),e.isDeprecated?t("Badge",{attrs:{variant:"deprecated"}}):e.isBeta?t("Badge",{attrs:{variant:"beta"}}):e._e()]},proxy:!0},{key:"content-container",fn:function(){return[e._t("card-item-content")]},proxy:!0}],null,!0)})},Pd=[],Od=function(){var e=this,t=e._self._c;return t("div",{staticClass:"navigator-card-item"},[t("div",{staticClass:"head-wrapper"},[t("div",{staticClass:"depth-spacer"},[e._t("depth-spacer")],2),e.hideNavigatorIcon?e._e():t("div",{staticClass:"navigator-icon-wrapper"},[e._t("navigator-icon",null,{className:"navigator-icon"})],2),t("div",{staticClass:"title-container"},[e._t("title-container")],2),t("div",{staticClass:"content-container"},[e._t("content-container")],2)])])},Nd=[],Rd={name:"BaseNavigatorCardItem",props:{hideNavigatorIcon:{type:Boolean,default:()=>!1}}},Bd=Rd,Ed=(0,V.A)(Bd,Od,Nd,!1,null,"21117456",null),Md=Ed.exports,zd={name:"HighlightMatch",props:{text:{type:String,required:!0},matcher:{type:RegExp,default:void 0}},render(e){const{matcher:t,text:n}=this;if(!t)return e("p",{class:"highlight"},n);const i=[];let a=0,s=null;const r=new RegExp(t,"gi");while(null!==(s=r.exec(n))){const t=s[0].length,r=s.index+t,o=n.slice(a,s.index);o&&i.push(e("span",o));const l=n.slice(s.index,r);l&&i.push(e("span",{class:"match"},l)),a=r}const o=n.slice(a,n.length);return o&&i.push(e("span",o)),e("p",{class:"highlight"},i)}},Kd=zd,qd=(0,V.A)(Kd,$d,Dd,!1,null,"7b81ca08",null),jd=qd.exports,Fd={name:"NavigatorCardItem",mixins:[Cd({idProp:e=>e.item.uid})],components:{BaseNavigatorCardItem:Md,HighlightMatches:jd,TopicTypeIcon:we.A,InlineChevronRightIcon:Lr.A,Reference:Ua.A,Badge:Fi.A},props:{isRendered:{type:Boolean,default:!1},item:{type:Object,required:!0},expanded:{type:Boolean,default:!1},filterPattern:{type:RegExp,default:void 0},filterText:{type:String,default:null},isActive:{type:Boolean,default:!1},isBold:{type:Boolean,default:!1},apiChange:{type:String,default:null,validator:e=>Ft.uh.includes(e)},isFocused:{type:Boolean,default:()=>!1},enableFocus:{type:Boolean,default:!0},navigatorReferences:{type:Object,default:()=>({})}},idState(){return{isOpening:!1}},computed:{isGroupMarker:({item:{type:e}})=>e===xe.t.groupMarker,isParent:({item:e,isGroupMarker:t})=>!!e.childUIDs.length&&!t,parentLabel:({item:e})=>`label-parent-${e.uid}`,siblingsLabel:({item:e})=>`label-${e.uid}`,usageLabel:({item:e})=>`usage-${e.uid}`,ariaDescribedBy:({isParent:e,parentLabel:t,siblingsLabel:n})=>e?`${t}`:`${n}`,isBeta:({item:{beta:e}})=>!!e,isDeprecated:({item:{deprecated:e}})=>!!e,refComponent:({isGroupMarker:e})=>e?"h3":Ua.A},methods:{toggleTree(){this.idState.isOpening=!0,this.$emit("toggle",this.item)},toggleEntireTree(){this.idState.isOpening=!0,this.$emit("toggle-full",this.item)},toggleSiblings(){this.idState.isOpening=!0,this.$emit("toggle-siblings",this.item)},handleLeftKeydown(){this.expanded?this.toggleTree():this.$emit("focus-parent",this.item)},handleRightKeydown(){!this.expanded&&this.isParent&&this.toggleTree()},clickReference(){(this.$refs.reference.$el||this.$refs.reference).click()},focusReference(){(this.$refs.reference.$el||this.$refs.reference).focus()},handleClick(){this.isGroupMarker||this.$emit("navigate",this.item.uid)}},watch:{async isFocused(e){await(0,Me.u)(8),e&&this.isRendered&&this.enableFocus&&this.focusReference()},async expanded(){await(0,Me.u)(9),this.idState.isOpening=!1}}},Vd=Fd,Hd=(0,V.A)(Vd,Ld,Pd,!1,null,"aae93440",null),Wd=Hd.exports,Ud=function(){var e=this,t=e._self._c;return t("div",{staticClass:"navigator-card"},[t("div",{staticClass:"navigator-card-full-height"},[t("div",{staticClass:"navigator-card-inner"},[t("div",{staticClass:"head-wrapper"},[e._t("above-navigator-head"),t("div",{staticClass:"head-inner"},[e._t("navigator-head"),t("button",{staticClass:"close-card",attrs:{id:e.SIDEBAR_HIDE_BUTTON_ID,"aria-label":e.$t("navigator.close-navigator")},on:{click:e.handleHideClick}},[t("InlineCloseIcon",{staticClass:"icon-inline close-icon"})],1)],2)],2),e._t("body",null,{className:"card-body"})],2)])])},Gd=[],Qd=n(2223),Xd={name:"BaseNavigatorCard",components:{InlineCloseIcon:Qd.A},data(){return{SIDEBAR_HIDE_BUTTON_ID:xl}},methods:{async handleHideClick(){this.$emit("close"),await this.$nextTick();const e=document.getElementById(Jl.iV);e&&e.focus()}}},Yd=Xd,Zd=(0,V.A)(Yd,Ud,Gd,!1,null,"5b6607c4",null),Jd=Zd.exports;const eu={sampleCode:"filter.tags.sample-code",tutorials:"filter.tags.tutorials",articles:"filter.tags.articles",webServiceEndpoints:"filter.tags.web-service-endpoints"},tu=Ft.Bp,nu={...eu,...tu,hideDeprecated:"filter.tags.hide-deprecated"},iu={[xe.t.article]:nu.articles,[xe.t.learn]:nu.tutorials,[xe.t.overview]:nu.tutorials,[xe.t.resources]:nu.tutorials,[xe.t.sampleCode]:nu.sampleCode,[xe.t.section]:nu.tutorials,[xe.t.tutorial]:nu.tutorials,[xe.t.project]:nu.tutorials,[xe.t.httpRequest]:nu.webServiceEndpoints};var au={computed:{filteredChildren:({children:e,selectedTags:t,apiChanges:n,filterPattern:i,filterChildren:a})=>a(e,t,n,i),navigatorItems:({nodesToRender:e})=>e},methods:{filterChildren(e,t,n,i){const a=new Set(t);return e.filter(({title:e,path:t,type:s,deprecated:r,deprecatedChildrenCount:o,childUIDs:l})=>{const c=!i||i.test(e),d=r||o===l.length;let u=!0;if(a.size){if(u=a.has(iu[s]),n&&!u){const e=n[t];u=a.has(nu[e])}a.has(nu.hideDeprecated)&&(u=!d)}const h=!n||!!n[t];return c&&u&&h})}}},su={name:"TagsDataProvider",constants:{TOPIC_TYPE_TO_TAG:iu},props:{shouldTruncateTags:{type:Boolean,default:!1}},computed:{availableTags:({renderableChildNodesMap:e,apiChangesObject:t,extractTags:n})=>n(e,t),suggestedTags({availableTags:e,selectedTags:t,hideAvailableTags:n}){return n||t.length?[]:e},translatableTags:({availableTags:e})=>[nu.hideDeprecated,...e]},methods:{extractTags(e,t){const n=new Set(Object.values(eu)),i={type:[],changes:[],other:[]},a=new Set(Object.values(t));a.size?a.forEach(e=>{n.add(nu[e])}):n.add(nu.hideDeprecated);for(const s in e){if(!Object.hasOwnProperty.call(e,s))continue;if(!n.size)break;const{type:a,path:r,deprecated:o}=e[s],l=iu[a];l&&n.has(l)&&(i.type.push(l),n.delete(l));const c=t[r];c&&n.has(nu[c])&&(i.changes.push(nu[c]),n.delete(nu[c])),o&&n.has(nu.hideDeprecated)&&(i.other.push(nu.hideDeprecated),n.delete(nu.hideDeprecated))}return Object.values(i).flat()}}};const ru="navigator.state",ou="navigator.no-results",lu="navigator.no-children",cu="navigator.error-fetching",du="navigator.items-found";var uu={name:"NavigatorCard",constants:{STORAGE_KEY:ru,ERROR_FETCHING:cu,ITEMS_FOUND:du},components:{FilterInput:el,NavigatorCardItem:Wd,DynamicScroller:md,DynamicScrollerItem:kd,BaseNavigatorCard:Jd,Reference:Ua.A,Badge:Fi.A},props:{technologyPath:{type:String,default:""},children:{type:Array,required:!0},technology:{type:String,required:!1},activePath:{type:Array,required:!0},type:{type:String,required:!0},scrollLockID:{type:String,default:""},errorFetching:{type:Boolean,default:!1},apiChanges:{type:Object,default:null},isTechnologyBeta:{type:Boolean,default:!1},navigatorReferences:{type:Object,default:()=>{}},renderFilterOnTop:{type:Boolean,default:!1},hideAvailableTags:{type:Boolean,default:!1}},mixins:[Oo,au,su],data(){return{filter:"",debouncedFilter:"",selectedTags:[],openNodes:Object.freeze({}),nodesToRender:Object.freeze([]),activeUID:null,lastFocusTarget:null,allNodesToggled:!1,INDEX_ROOT_KEY:Cl}},computed:{isTechnologyRoute:({technologyPath:e,$route:t})=>e.toLowerCase()===t.path.toLowerCase(),politeAriaLive(){const{hasNodes:e,navigatorItems:t}=this;return e?this.$tc(du,t.length,{number:t.length}):""},assertiveAriaLive:({hasNodes:e,hasFilter:t,errorFetching:n})=>e?"":t?ou:n?cu:lu,filterPattern:({debouncedFilter:e})=>e?new RegExp(Id(e),"i"):null,itemSize:()=>wl,childrenMap({children:e}){return Il(e)},activePathChildren({activeUID:e,childrenMap:t}){return e&&t[e]?Pl(e,t):[]},activePathMap:({activePathChildren:e})=>Object.fromEntries(e.map(({uid:e})=>[e,!0])),activeIndex:({activeUID:e,navigatorItems:t})=>t.findIndex(t=>t.uid===e),renderableChildNodesMap({hasFilter:e,childrenMap:t,deprecatedHidden:n,filteredChildren:i,removeDeprecated:a}){if(!e)return t;const s=i.length-1,r=new Set([]);for(let o=s;o>=0;o-=1){const e=i[o],s=t[e.groupMarkerUID];if(s&&r.add(s),r.has(e))continue;if(r.has(t[e.parent])&&e.type!==xe.t.groupMarker){r.add(e);continue}let l=[];e.childUIDs.length&&(l=a(Dl(e.uid,t),n)),l.concat(Pl(e.uid,t)).forEach(e=>r.add(e))}return Il([...r])},nodeChangeDeps:({filteredChildren:e,activePathChildren:t,debouncedFilter:n,selectedTags:i})=>[e,t,n,i],hasFilter({debouncedFilter:e,selectedTags:t,apiChanges:n}){return Boolean(e.length||t.length||n)},deprecatedHidden:({selectedTags:e})=>e[0]===nu.hideDeprecated,apiChangesObject(){return this.apiChanges||{}},hasNodes:({navigatorItems:e})=>!!e.length,totalItemsToNavigate:({navigatorItems:e})=>e.length,lastActivePathItem:({activePath:e})=>(0,N.HV)(e)},created(){this.restorePersistedState()},watch:{filter:"debounceInput",nodeChangeDeps:"trackOpenNodes",activePath:"handleActivePathChange",apiChanges(e){e||(this.selectedTags=this.selectedTags.filter(e=>!Object.values(tu).includes(e)))},async activeUID(e,t){await this.$nextTick();const n=this.$refs[`dynamicScroller_${t}`];n&&n.updateSize&&n.updateSize()},technology(){this.clearFilters()}},methods:{setUnlessEqual(e,t){(0,N.n4)(t,this[e])||(this[e]=Object.freeze(t))},toggleAllNodes(){const e=this.children.filter(e=>e.parent===Cl&&e.type!==xe.t.groupMarker&&e.childUIDs.length);this.allNodesToggled=!this.allNodesToggled,this.allNodesToggled&&(this.openNodes={},this.generateNodesToRender()),e.forEach(e=>{this.toggleFullTree(e)})},clearFilters(){this.filter="",this.debouncedFilter="",this.selectedTags=[]},scrollToFocus(){this.$refs.scroller.scrollToItem(this.focusedIndex)},debounceInput:bo(function(e){this.debouncedFilter=e,this.lastFocusTarget=null},200),trackOpenNodes([e,t,n,i],[,a=[],s="",r=[]]=[]){if(n!==s&&!s&&this.getFromStorage("filter")||!(0,N.n4)(i,r)&&!r.length&&this.getFromStorage("selectedTags",[]).length)return;const o=!(0,N.n4)(a,t),{childrenMap:l}=this;let c=t;if(!(this.deprecatedHidden&&!this.debouncedFilter.length||o&&this.hasFilter)&&this.hasFilter){const t=new Set,n=e.length-1;for(let i=n;i>=0;i-=1){const n=e[i];t.has(l[n.parent])||t.has(n)||Pl(n.uid,l).slice(0,-1).forEach(e=>t.add(e))}c=[...t]}const d=o?{...this.openNodes}:{},u=c.reduce((e,t)=>(e[t.uid]=!0,e),d);this.setUnlessEqual("openNodes",u),this.generateNodesToRender(),this.updateFocusIndexExternally()},toggle(e){const t=this.openNodes[e.uid];let n=[],i=[];if(t){const t=(0,x.o8)(this.openNodes),n=Dl(e.uid,this.childrenMap);n.forEach(({uid:e})=>{delete t[e]}),this.setUnlessEqual("openNodes",t),i=n.slice(1)}else this.setUnlessEqual("openNodes",{...this.openNodes,[e.uid]:!0}),n=Ll(e.uid,this.childrenMap,this.children).filter(e=>this.renderableChildNodesMap[e.uid]);this.augmentRenderNodes({uid:e.uid,include:n,exclude:i})},toggleFullTree(e){const t=this.openNodes[e.uid],n=(0,x.o8)(this.openNodes),i=Dl(e.uid,this.childrenMap);let a=[],s=[];i.forEach(({uid:e})=>{t?delete n[e]:n[e]=!0}),t?a=i.slice(1):s=i.slice(1).filter(e=>this.renderableChildNodesMap[e.uid]),this.setUnlessEqual("openNodes",n),this.augmentRenderNodes({uid:e.uid,exclude:a,include:s})},toggleSiblings(e){const t=this.openNodes[e.uid],n=(0,x.o8)(this.openNodes),i=Ol(e.uid,this.childrenMap,this.children);i.forEach(({uid:e,childUIDs:i,type:a})=>{if(i.length&&a!==xe.t.groupMarker)if(t){const t=Dl(e,this.childrenMap);t.forEach(e=>{delete n[e.uid]}),delete n[e],this.augmentRenderNodes({uid:e,exclude:t.slice(1),include:[]})}else{n[e]=!0;const t=Ll(e,this.childrenMap,this.children).filter(e=>this.renderableChildNodesMap[e.uid]);this.augmentRenderNodes({uid:e,exclude:[],include:t})}}),this.setUnlessEqual("openNodes",n),this.persistState()},removeDeprecated(e,t){return t?e.filter(({deprecated:e})=>!e):e},generateNodesToRender(){const{children:e,openNodes:t,renderableChildNodesMap:n}=this;this.setUnlessEqual("nodesToRender",e.filter(e=>n[e.uid]&&(e.parent===Cl||t[e.parent]))),this.persistState(),this.scrollToElement()},augmentRenderNodes({uid:e,include:t=[],exclude:n=[]}){const i=this.nodesToRender.findIndex(t=>t.uid===e);if(t.length){const e=t.filter(e=>!this.nodesToRender.includes(e)),n=this.nodesToRender.slice(0);n.splice(i+1,0,...e),this.setUnlessEqual("nodesToRender",n)}else if(n.length){const e=new Set(n);this.setUnlessEqual("nodesToRender",this.nodesToRender.filter(t=>!e.has(t)))}this.persistState()},getFromStorage(e,t=null){const n=Ql.sZ.get(ru,{}),i=n[this.technologyPath];return i?e?i[e]||t:i:t},persistState(){const e={path:this.lastActivePathItem},{path:t}=this.activeUID&&this.childrenMap[this.activeUID]||e,n={technology:this.technology,path:t,hasApiChanges:!!this.apiChanges,openNodes:Object.keys(this.openNodes).map(Number),nodesToRender:this.nodesToRender.map(({uid:e})=>e),activeUID:this.activeUID,filter:this.filter,selectedTags:this.selectedTags},i={...Ql.sZ.get(ru,{}),[this.technologyPath]:n};Ql.sZ.set(ru,i)},clearPersistedState(){const e={...Ql.sZ.get(ru,{}),[this.technologyPath]:{}};Ql.sZ.set(ru,e)},restorePersistedState(){const e=this.getFromStorage();if(!e||e.path!==this.lastActivePathItem)return this.clearPersistedState(),void this.handleActivePathChange(this.activePath);const{technology:t,nodesToRender:n=[],filter:i="",hasAPIChanges:a=!1,activeUID:s=null,selectedTags:r=[],openNodes:o}=e;if(!n.length&&!i&&!r.length)return this.clearPersistedState(),void this.handleActivePathChange(this.activePath);const{childrenMap:l}=this,c=n.every(e=>l[e]),d=s?(this.childrenMap[s]||{}).path===this.lastActivePathItem:1===this.activePath.length;if(t!==this.technology||!c||a!==Boolean(this.apiChanges)||!d||s&&!i&&!r.length&&!n.includes(s))return this.clearPersistedState(),void this.handleActivePathChange(this.activePath);this.setUnlessEqual("openNodes",Object.fromEntries(o.map(e=>[e,!0]))),this.setUnlessEqual("nodesToRender",n.map(e=>l[e])),this.selectedTags=r,this.filter=i,this.debouncedFilter=this.filter,this.activeUID=s,this.scrollToElement()},async scrollToElement(){if(await(0,Me.u)(1),!this.$refs.scroller)return;const e=document.getElementById(this.activeUID);if(e&&0===this.getChildPositionInScroller(e))return;const t=this.nodesToRender.findIndex(e=>e.uid===this.activeUID);-1!==t?this.$refs.scroller.scrollToItem(t):this.hasFilter&&!this.deprecatedHidden&&this.$refs.scroller.scrollToItem(0)},getChildPositionInScroller(e){if(!e)return 0;const{paddingTop:t,paddingBottom:n}=getComputedStyle(this.$refs.scroller.$el),i={top:parseInt(t,10)||0,bottom:parseInt(n,10)||0},{y:a,height:s}=this.$refs.scroller.$el.getBoundingClientRect(),{y:r}=e.getBoundingClientRect();let o=0;e.offsetParent&&(o=e.offsetParent.offsetHeight);const l=r-a-i.top;return l<0?-1:l+o>=s-i.bottom?1:0},isInsideScroller(e){return!!this.$refs.scroller&&this.$refs.scroller.$el.contains(e)},handleFocusIn({target:e,relatedTarget:t}){if(this.lastFocusTarget=e,!t)return;const n=this.getChildPositionInScroller(e);if(0===n)return;const{offsetHeight:i}=e.offsetParent;this.$refs.scroller.$el.scrollBy({top:i*n,left:0})},handleFocusOut(e){e.relatedTarget&&(this.isInsideScroller(e.relatedTarget)||(this.lastFocusTarget=null))},handleScrollerUpdate:bo(async function(){await(0,Me.f)(300),this.lastFocusTarget&&this.isInsideScroller(this.lastFocusTarget)&&document.activeElement!==this.lastFocusTarget&&this.lastFocusTarget.focus({preventScroll:!0})},50),setActiveUID(e){this.activeUID=e},handleNavigationChange(e){const t=this.childrenMap[e].path;t.startsWith(this.technologyPath)&&(this.setActiveUID(e),this.$emit("navigate",t))},pathsToFlatChildren(e){const t=e.slice(0).reverse(),{childrenMap:n}=this;let i=this.children;const a=[];while(t.length){const e=t.pop(),s=i.find(t=>t.path===e);if(!s)break;a.push(s),t.length&&(i=s.childUIDs.map(e=>n[e]))}return a},handleActivePathChange(e){const t=this.childrenMap[this.activeUID],n=(0,N.HV)(e);if(t){if(n===t.path)return;const e=Ol(this.activeUID,this.childrenMap,this.children),i=Ll(this.activeUID,this.childrenMap,this.children),a=Pl(this.activeUID,this.childrenMap),s=[...i,...e,...a].find(e=>e.path===n);if(s)return void this.setActiveUID(s.uid)}const i=this.pathsToFlatChildren(e);i.length?this.setActiveUID(i[i.length-1].uid):this.activeUID?this.setActiveUID(null):this.trackOpenNodes(this.nodeChangeDeps)},updateFocusIndexExternally(){this.externalFocusChange=!0,this.activeIndex>0?this.focusIndex(this.activeIndex):this.focusIndex(0)},focusNodeParent(e){const t=this.childrenMap[e.parent];if(!t)return;const n=this.nodesToRender.findIndex(e=>e.uid===t.uid);-1!==n&&this.focusIndex(n)}}},hu=uu,pu=(0,V.A)(hu,fc,mc,!1,null,"abcea74e",null),gu=pu.exports,fu=function(){var e=this,t=e._self._c;return t("BaseNavigatorCard",e._b({on:{close:function(t){return e.$emit("close")}},scopedSlots:e._u([{key:"body",fn:function({className:n}){return[t("transition",{attrs:{name:"delay-visibility"}},[t("div",{staticClass:"loading-navigator",class:n,attrs:{"aria-hidden":"true"}},e._l(e.LOADER_ROWS,function(e,n){return t("LoadingNavigatorItem",{key:n,attrs:{index:n,width:e.width,hideNavigatorIcon:e.hideNavigatorIcon}})}),1)])]}}])},"BaseNavigatorCard",e.$props,!1))},mu=[],yu=function(){var e=this,t=e._self._c;return t("BaseNavigatorCardItem",{staticClass:"loading-navigator-item",style:`--index: ${e.index};`,attrs:{hideNavigatorIcon:e.hideNavigatorIcon},scopedSlots:e._u([{key:"navigator-icon",fn:function({className:e}){return[t("div",{class:e})]}},{key:"title-container",fn:function(){return[t("div",{staticClass:"loader",style:{width:e.width}})]},proxy:!0}])})},vu=[],bu={name:"LoadingNavigatorItem",components:{BaseNavigatorCardItem:Md},props:{...Md.props,index:{type:Number,default:0},width:{type:String,default:"50%"}}},Tu=bu,_u=(0,V.A)(Tu,yu,vu,!1,null,"0de29914",null),Su=_u.exports;const ku=[{width:"30%",hideNavigatorIcon:!0},{width:"80%"},{width:"50%"}];var Cu={name:"LoadingNavigatorCard",components:{BaseNavigatorCard:Jd,LoadingNavigatorItem:Su},data(){return{LOADER_ROWS:ku}}},wu=Cu,xu=(0,V.A)(wu,fu,mu,!1,null,"3b7cf3a4",null),Au=xu.exports,Iu={name:"Navigator",components:{NavigatorCard:gu,LoadingNavigatorCard:Au},data(){return{INDEX_ROOT_KEY:Cl}},props:{flatChildren:{type:Array,required:!0},parentTopicIdentifiers:{type:Array,required:!0},technologyProps:{type:Object,required:!1},isFetching:{type:Boolean,default:!1},references:{type:Object,default:()=>{}},navigatorReferences:{type:Object,default:()=>{}},scrollLockID:{type:String,default:""},errorFetching:{type:Boolean,default:!1},renderFilterOnTop:{type:Boolean,default:!1},apiChanges:{type:Object,default:null}},computed:{parentTopicReferences({references:e,parentTopicIdentifiers:t}){return t.reduce((t,n)=>{const i=e[n];return i?t.concat(i):(console.error(`Reference for "${n}" is missing`),t)},[])},activePath({parentTopicReferences:e,$route:{path:t}}){if(t=t.replace(/\/$/,"").toLowerCase(),!e.length)return[t];let n=1;return"technologies"===e[0].kind&&(n=2),e.slice(n).map(e=>e.url).concat(t)},type:()=>xe.t.module}},$u=Iu,Du=(0,V.A)($u,pc,gc,!1,null,"5611024b",null),Lu=Du.exports,Pu=n(4602),Ou=n(1328),Nu={computed:{indexNodes({indexState:{flatChildren:e},interfaceLanguage:t}){return e?e[t]??(e[$.A.swift.key.url]||[]):[]},apiChanges({indexState:{apiChanges:e,apiChangesVersion:t,errorFetchingDiffs:n},interfaceLanguage:i,selectedAPIChangesVersion:a}){if(e&&!n)return t===a?e[i]||e[$.A.swift.key.url]:void 0},technologyProps({indexState:{technologyProps:e},interfaceLanguage:t,technology:n}){return e[t]??e[$.A.swift.key.url]??(n?{technology:n.title,technologyPath:n.path||n.url,isTechnologyBeta:n.beta}:null)},navigatorProps:({indexNodes:e,indexState:{flatChildren:t,references:n,errorFetching:i},apiChanges:a})=>({flatChildren:e,navigatorReferences:n,apiChanges:a,isFetching:!t&&!i,errorFetching:i})},data(){return{indexState:B.A.state}}},Ru=function(){var e=this,t=e._self._c;return t("NavBase",{staticClass:"documentation-nav",attrs:{breakpoint:e.BreakpointName.medium,hasOverlay:!1,hasNoBorder:e.hasNoBorder,isDark:e.isDark,isWideFormat:"",hasFullWidthBorder:"","aria-label":e.$t("api-reference"),showActions:e.hasMenuItems},scopedSlots:e._u([e.displaySidenav?{key:"pre-title",fn:function({closeNav:n,isOpen:i,currentBreakpoint:a,className:s}){return[t("div",{class:s},[t("div",{staticClass:"sidenav-toggle-wrapper"},[t("button",{staticClass:"sidenav-toggle",attrs:{"aria-label":e.$t("navigator.open-navigator"),id:e.baseNavOpenSidenavButtonId,tabindex:i?-1:null},on:{click:function(t){return t.preventDefault(),e.handleSidenavToggle(n,a)}}},[t("span",{staticClass:"sidenav-icon-wrapper"},[t("SidenavIcon",{staticClass:"icon-inline sidenav-icon"})],1)])])])]}}:null,{key:"default",fn:function(){return[e._t("title",null,{className:"nav-title"})]},proxy:!0},{key:"tray",fn:function({closeNav:n}){return[e.hasMenuItems?t("NavMenuItems",{staticClass:"nav-menu-settings"},[e.hasLanguageToggle?t("LanguageToggle",{attrs:{interfaceLanguage:e.interfaceLanguage,objcPath:e.objcPath,swiftPath:e.swiftPath,closeNav:n}}):e._e(),e._t("menu-items")],2):e._e(),e._t("tray-after")]}},{key:"after-content",fn:function(){return[e._t("after-content")]},proxy:!0}],null,!0)})},Bu=[],Eu=n(9065),Mu=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"sidenav-icon",attrs:{viewBox:"0 0 14 14",height:"14",themeId:"sidenav"}},[t("path",{attrs:{d:"M6.533 1.867h-6.533v10.267h14v-10.267zM0.933 11.2v-8.4h4.667v8.4zM13.067 11.2h-6.533v-8.4h6.533z"}}),t("path",{attrs:{d:"M1.867 5.133h2.8v0.933h-2.8z"}}),t("path",{attrs:{d:"M1.867 7.933h2.8v0.933h-2.8z"}})])},zu=[],Ku={name:"SidenavIcon",components:{SVGIcon:pr.A}},qu=Ku,ju=(0,V.A)(qu,Mu,zu,!1,null,"11f8cb90",null),Fu=ju.exports,Vu=function(){var e=this,t=e._self._c;return t("NavMenuItemBase",{staticClass:"nav-menu-setting language-container"},[t("div",{class:{"language-toggle-container":e.hasLanguages}},[t("select",{ref:"language-sizer",staticClass:"language-dropdown language-sizer",attrs:{"aria-hidden":"true",tabindex:"-1"}},[t("option",{key:e.currentLanguage.name,attrs:{selected:""}},[e._v(e._s(e.currentLanguage.name))])]),t("label",{staticClass:"nav-menu-setting-label",attrs:{for:e.hasLanguages?"language-toggle":null}},[e._v(e._s(e.$t("formats.colon",{content:e.$t("language")})))]),e.hasLanguages?t("select",{directives:[{name:"model",rawName:"v-model",value:e.languageModel,expression:"languageModel"}],staticClass:"language-dropdown nav-menu-link",style:`width: ${e.adjustedWidth}px`,attrs:{id:"language-toggle"},on:{change:[function(t){var n=Array.prototype.filter.call(t.target.options,function(e){return e.selected}).map(function(e){var t="_value"in e?e._value:e.value;return t});e.languageModel=t.target.multiple?n:n[0]},function(t){return e.pushRoute(e.currentLanguage.route)}]}},e._l(e.languages,function(n){return t("option",{key:n.api,domProps:{value:n.api}},[e._v(" "+e._s(n.name)+" ")])}),0):t("span",{staticClass:"nav-menu-toggle-none current-language",attrs:{"aria-current":"page"}},[e._v(e._s(e.currentLanguage.name))]),e.hasLanguages?t("InlineChevronDownIcon",{staticClass:"toggle-icon icon-inline"}):e._e()],1),e.hasLanguages?t("div",{staticClass:"language-list-container"},[t("span",{staticClass:"nav-menu-setting-label"},[e._v(e._s(e.$t("formats.colon",{content:e.$t("language")})))]),t("ul",{staticClass:"language-list"},e._l(e.languages,function(n){return t("li",{key:n.api,staticClass:"language-list-item"},[n.api===e.languageModel?t("span",{staticClass:"current-language",attrs:{"data-language":n.api,"aria-current":"page"}},[e._v(" "+e._s(n.name)+" ")]):t("a",{staticClass:"nav-menu-link",attrs:{href:"#"},on:{click:function(t){return t.preventDefault(),e.pushRoute(n.route)}}},[e._v(" "+e._s(n.name)+" ")])])}),0)]):e._e()])},Hu=[],Wu=n(620),Uu={name:"LanguageToggle",components:{InlineChevronDownIcon:Wu.A,NavMenuItemBase:Dr.A},inject:{store:{default(){return{setPreferredLanguage(){}}}}},props:{interfaceLanguage:{type:String,required:!0},objcPath:{type:String,required:!1},swiftPath:{type:String,required:!1},closeNav:{type:Function,default:()=>{}}},data(){return{languageModel:null,adjustedWidth:0}},mounted(){const e=Ee(async()=>{await(0,Me.u)(3),this.calculateSelectWidth()},150);window.addEventListener("resize",e),window.addEventListener("orientationchange",e),this.$once("hook:beforeDestroy",()=>{window.removeEventListener("resize",e),window.removeEventListener("orientationchange",e)})},watch:{interfaceLanguage:{immediate:!0,handler(e){this.languageModel=e}},currentLanguage:{immediate:!0,handler:"calculateSelectWidth"}},methods:{getRoute(e){const t=e.query===$.A.swift.key.url?void 0:e.query;return{query:{...this.$route.query,language:t},path:this.isCurrentPath(e.path)?null:(0,O.Vd)(e.path)}},async pushRoute(e){await this.closeNav(),this.store.setPreferredLanguage(e.query),this.$router.push(this.getRoute(e))},isCurrentPath(e){return this.$route.path.replace(/^\//,"")===e},async calculateSelectWidth(){await this.$nextTick(),this.adjustedWidth=this.$refs["language-sizer"].clientWidth+8}},computed:{languages(){return[{name:$.A.swift.name,api:$.A.swift.key.api,route:{path:this.swiftPath,query:$.A.swift.key.url}},{name:$.A.objectiveC.name,api:$.A.objectiveC.key.api,route:{path:this.objcPath,query:$.A.objectiveC.key.url}}]},currentLanguage:({languages:e,languageModel:t})=>e.find(e=>e.api===t),hasLanguages:({objcPath:e,swiftPath:t})=>t&&e}},Gu=Uu,Qu=(0,V.A)(Gu,Vu,Hu,!1,null,"68a9881c",null),Xu=Qu.exports,Yu={name:"DocumentationNav",components:{SidenavIcon:Fu,NavBase:Eu.A,NavMenuItems:or.A,LanguageToggle:Xu},props:{isDark:{type:Boolean,default:!1},hasNoBorder:{type:Boolean,default:!1},interfaceLanguage:{type:String,required:!1},objcPath:{type:String,required:!1},swiftPath:{type:String,required:!1},displaySidenav:{type:Boolean,default:!1}},computed:{baseNavOpenSidenavButtonId:()=>Jl.iV,BreakpointName:()=>lr.FC,hasLanguageToggle:({interfaceLanguage:e,swiftPath:t,objcPath:n})=>!(!e||!t&&!n),hasMenuItems:({hasLanguageToggle:e,$slots:t})=>!(!e&&!t["menu-items"])},methods:{async handleSidenavToggle(e,t){await e(),this.$emit("toggle-sidenav",t),await this.$nextTick();const n=document.getElementById(xl);n&&n.focus()}}},Zu=Yu,Ju=(0,V.A)(Zu,Ru,Bu,!1,null,"0799dea4",null),eh=Ju.exports;const th="navigator-hidden-large";var nh={name:"DocumentationLayout",constants:{NAVIGATOR_HIDDEN_ON_LARGE_KEY:th},components:{Navigator:Lu,AdjustableSidebarWidth:hc,Nav:eh,QuickNavigationButton:to,QuickNavigationModal:Wl,PortalTarget:Qr.mf},mixins:[Pu.A,Nu],props:{enableNavigator:Boolean,diffAvailability:{type:Object,required:!1},interfaceLanguage:{type:String,required:!1},references:{type:Object,default:()=>{}},objcPath:{type:String,required:!1},swiftPath:{type:String,required:!1},selectedAPIChangesVersion:{type:String,required:!1},technology:{type:Object,required:!1},parentTopicIdentifiers:{type:Array,default:()=>[]},navigatorFixedWidth:{type:Number,default:null},quickNavNodes:{type:Array,default:null},quickNavPlaceholder:{type:String,default:null}},data(){return{sidenavVisibleOnMobile:!1,sidenavHiddenOnLarge:Ql.IG.get(th,!1),showQuickNavigationModal:!1,quickNavigationInitialFilter:"",BreakpointName:lr.FC}},computed:{enableQuickNavigation:({isTargetIDE:e})=>!e&&(0,w.PL)(["features","docs","quickNavigation","enable"],!0),sidebarProps:({sidenavVisibleOnMobile:e,enableNavigator:t,sidenavHiddenOnLarge:n,navigatorFixedWidth:i})=>t?{shownOnMobile:e,hiddenOnLarge:n,fixedWidth:i}:{enableNavigator:t},sidebarListeners(){return this.enableNavigator?{"update:shownOnMobile":this.toggleMobileSidenav,"update:hiddenOnLarge":this.toggleLargeSidenav}:{}}},methods:{handleToggleSidenav(e){e===lr.FC.large?this.toggleLargeSidenav():this.toggleMobileSidenav()},openQuickNavigationModal(){this.sidenavVisibleOnMobile||(this.showQuickNavigationModal=!0)},handleInitialQueryFilter(){const{[Ou.A.query]:e}=this.$route.query;if(!e||!this.enableQuickNavigation)return;this.quickNavigationInitialFilter=e,this.$nextTick(()=>{this.openQuickNavigationModal()});const{[Ou.A.query]:t,...n}=this.$route.query;this.$router.replace({...this.$route,query:n})},toggleLargeSidenav(e=!this.sidenavHiddenOnLarge){this.sidenavHiddenOnLarge=e,Ql.IG.set(th,e)},toggleMobileSidenav(e=!this.sidenavVisibleOnMobile){this.sidenavVisibleOnMobile=e},onQuickNavigationKeydown(e){("/"===e.key||"o"===e.key&&e.shiftKey&&e.metaKey)&&this.enableNavigator&&"input"!==e.target.tagName.toLowerCase()&&(this.openQuickNavigationModal(),e.preventDefault())}},mounted(){this.enableQuickNavigation&&window.addEventListener("keydown",this.onQuickNavigationKeydown),this.handleInitialQueryFilter()},beforeDestroy(){this.enableQuickNavigation&&window.removeEventListener("keydown",this.onQuickNavigationKeydown)},inject:{isTargetIDE:{default(){return!1}}}},ih=nh,ah=(0,V.A)(ih,Ur,Gr,!1,null,"376a4b96",null),sh=ah.exports,rh={computed:{indexDataPath(){const e=this.$route?.params?.locale||"";return(0,O.CN)(["/index/",e,"index.json"])}},methods:{async fetchIndexData(){try{B.A.reset();const{includedArchiveIdentifiers:e=[],interfaceLanguages:t,references:n={}}=await(0,x.Fd)(this.indexDataPath),i=Object.freeze(Bl(t));B.A.setFlatChildren(i),B.A.setTechnologyProps(El(t)),B.A.setReferences(n),B.A.setIncludedArchiveIdentifiers(e)}catch(_h){B.A.setErrorFetching(!0)}}},watch:{indexDataPath:{handler:"fetchIndexData",immediate:!0}}},oh=n(986);const lh="symbol";var ch={watch:{topicData:{immediate:!0,handler:"extractOnThisPageSections"}},methods:{shouldRegisterContentSection(e){return e.type===ui.BlockType.heading&&e.level<4},extractOnThisPageSections(e){if(!e)return;this.store.resetPageSections();const{metadata:{title:t},primaryContentSections:n,topicSections:i,defaultImplementationsSections:a,relationshipsSections:s,seeAlsoSections:r,kind:o}=e;this.store.addOnThisPageSection({title:t,anchor:oh.i,level:1,isSymbol:o===lh},{i18n:!1}),n&&n.forEach(e=>{switch(e.kind){case Ve.mentions:this.store.addOnThisPageSection({title:this.$t("mentioned-in"),anchor:(0,Tn.ql)("mentions"),level:2});break;case Ve.content:Qe.A.methods.forEach.call(e,e=>{this.shouldRegisterContentSection(e)&&this.store.addOnThisPageSection({title:e.text,anchor:e.anchor||(0,Tn.ql)(e.text),level:e.level},{i18n:!1})});break;case Ve.properties:case Ve.restBody:case Ve.restCookies:case Ve.restEndpoint:case Ve.restHeaders:case Ve.restParameters:case Ve.restResponses:this.store.addOnThisPageSection({title:e.title,anchor:(0,Tn.ql)(e.title),level:2});break;default:rn[e.kind]&&this.store.addOnThisPageSection(rn[e.kind])}}),i&&this.store.addOnThisPageSection(sn.topics),a&&this.store.addOnThisPageSection(sn.defaultImplementations),s&&this.store.addOnThisPageSection(sn.relationships),r&&this.store.addOnThisPageSection(sn.seeAlso)}}},dh=n(8213),uh=n(1098),hh=n(7470),ph=n(822),gh=n(6131);const{extractProps:fh}=Wr.methods,mh="0.3.0";var yh={name:"DocumentationTopicView",constants:{MIN_RENDER_JSON_VERSION_WITH_INDEX:mh},components:{CodeTheme:ph.A,Topic:Wr,DocumentationLayout:sh},mixins:[ch,hh.A,rh],props:{enableMinimized:{type:Boolean,default:!1}},data(){return{topicDataDefault:null,topicDataObjc:null,store:gl.A}},provide(){return{store:this.store}},computed:{disableHeroBackground:()=>!1,documentationLayoutProps:({topicProps:{diffAvailability:e,interfaceLanguage:t,references:n},enableNavigator:i,technology:a,parentTopicIdentifiers:s,objcPath:r,swiftPath:o,store:{state:{selectedAPIChangesVersion:l}}})=>({diffAvailability:e,interfaceLanguage:t,references:n,enableNavigator:i,technology:a,parentTopicIdentifiers:s,objcPath:r,swiftPath:o,selectedAPIChangesVersion:l}),objcOverrides:({topicData:e})=>{const{variantOverrides:t=[]}=e||{},n=({interfaceLanguage:e})=>e===$.A.objectiveC.key.api,i=({traits:e})=>e.some(n),a=t.find(i);return a?a.patch:null},topicData:{get(){return this.topicDataObjc?this.topicDataObjc:this.topicDataDefault},set(e){this.topicDataDefault=e}},topicKey:({$route:e,topicProps:t})=>[e.path,t.interfaceLanguage].join(),topicProps(){return fh(this.topicData)},parentTopicIdentifiers:({topicProps:{hierarchy:e,references:t},$route:n})=>{if(!e)return[];const{paths:i=[]}=e;return i.length?i.find(e=>{const i=e.find(e=>t[e]&&"technologies"!==t[e].kind),a=i&&t[i];return a&&n.path.toLowerCase().startsWith(a.url.toLowerCase())})||i[0]:[]},technology:({$route:e,topicProps:{identifier:t,references:n,role:i,title:a},parentTopicIdentifiers:s})=>{const r={title:a,url:e.path},o=n[t];if(!s.length)return o||r;const l=n[s[0]];return l&&"technologies"!==l.kind?l:(i!==C.y.collection||o)&&(l&&n[s[1]]||o)||r},languagePaths:({topicData:{variants:e=[]}})=>e.reduce((e,t)=>t.traits.reduce((e,n)=>n.interfaceLanguage?{...e,[n.interfaceLanguage]:(e[n.interfaceLanguage]||[]).concat(t.paths)}:e,e),{}),objcPath:({languagePaths:{[$.A.objectiveC.key.api]:[e]=[]}={}})=>e,swiftPath:({languagePaths:{[$.A.swift.key.api]:[e]=[]}={}})=>e,isSymbolBeta:({topicProps:{platforms:e}})=>!!(e&&e.length&&e.every(e=>e.beta)),isSymbolDeprecated:({topicProps:{platforms:e,deprecationSummary:t,identifier:n,references:i}})=>!!(i[n]&&i[n].deprecated||t&&t.length>0||e&&e.length&&e.every(e=>e.deprecatedAt)),enableOnThisPageNav:({isTargetIDE:e})=>!(0,w.PL)(["features","docs","onThisPageNavigator","disable"],!1)&&!e,enableNavigator:({isTargetIDE:e,topicDataDefault:t})=>!e&&(0,uh.Zy)((0,uh.hX)(t.schemaVersion),mh)>=0,rootHierarchyReference:({parentTopicIdentifiers:e,topicProps:{references:t}})=>t[e[0]]||{},isRootTechnologyLink:({rootHierarchyReference:{kind:e}})=>"technologies"===e,hierarchyItems:({parentTopicIdentifiers:e,isRootTechnologyLink:t})=>t?e.slice(1):e,rootLink:({isRootTechnologyLink:e,rootHierarchyReference:t,$route:n})=>e?{path:t.url,query:n.query}:null},methods:{handleCodeColorsChange(e){gh.A.updateCodeColors(e)},applyObjcOverrides(){this.topicDataObjc=k((0,x.o8)(this.topicData),this.objcOverrides)}},mounted(){this.$bridge.on("contentUpdate",this.handleContentUpdateFromBridge),this.$bridge.on("codeColors",this.handleCodeColorsChange),this.$bridge.send({type:"requestCodeColors"})},beforeDestroy(){this.$bridge.off("contentUpdate",this.handleContentUpdateFromBridge),this.$bridge.off("codeColors",this.handleCodeColorsChange)},inject:{isTargetIDE:{default(){return!1}}},beforeRouteEnter(e,t,n){e.meta.skipFetchingData?n(e=>e.newContentMounted()):(0,x.Dk)(e,t,n).then(t=>n(n=>{(0,dh.cu)(e.params.locale,n),n.topicData=t,e.query.language===$.A.objectiveC.key.url&&n.objcOverrides&&n.applyObjcOverrides()})).catch(n)},beforeRouteUpdate(e,t,n){e.path===t.path&&e.query.language===$.A.objectiveC.key.url&&t?.query?.language!==$.A.objectiveC.key.url&&this.objcOverrides?(this.applyObjcOverrides(),n()):(0,x.JR)(e,t)?(0,x.Dk)(e,t,n).then(t=>{this.topicDataObjc=null,this.topicData=t,e.query.language===$.A.objectiveC.key.url&&this.objcOverrides&&this.applyObjcOverrides(),(0,dh.cu)(e.params.locale,this),n()}).catch(n):n()},created(){this.store.reset()},watch:{topicData(){this.$nextTick(()=>{this.newContentMounted()})}}},vh=yh,bh=(0,V.A)(vh,i,a,!1,null,null,null),Th=bh.exports},7783:function(e,t){var n,i,a;(function(s,r){i=[],n=r,a="function"===typeof n?n.apply(t,i):n,void 0===a||(e.exports=a)})(0,function(){function e(e){var t=getComputedStyle(e,null).getPropertyValue("overflow");return t.indexOf("scroll")>-1||t.indexOf("auto")>-1}function t(t){if(t instanceof HTMLElement||t instanceof SVGElement){var n=t.parentNode;while(n.parentNode){if(e(n))return n;n=n.parentNode}return document.scrollingElement||document.documentElement}}return t})},8646:function(e,t,n){"use strict";var i=n(9565),a=n(8551),s=n(1767),r=n(851);e.exports=function(e,t){t&&"string"===typeof e||a(e);var n=r(e);return s(a(void 0!==n?i(n,e):e))}}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-bash-js.f42a1d3a.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-bash-js.f42a1d3a.js new file mode 100644 index 0000000..3c82660 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-bash-js.f42a1d3a.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[274],{8641:function(e){function s(e){const s=e.regex,t={},n={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{className:"variable",variants:[{begin:s.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});const a={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},c=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),i={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},o={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t,a]};a.contains.push(o);const r={match:/\\"/},l={className:"string",begin:/'/,end:/'/},m={match:/\\'/},p={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,t]},d=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],h=e.SHEBANG({binary:`(${d.join("|")})`,relevance:10}),u={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],f=["true","false"],g={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],k=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],y=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],z=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:f,built_in:[...w,...k,"set","shopt",...y,...z]},contains:[h,e.SHEBANG(),u,p,c,i,g,o,r,l,m,t]}}e.exports=s}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-c-js.6059ad3a.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-c-js.6059ad3a.js new file mode 100644 index 0000000..d143911 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-c-js.6059ad3a.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[833],{722:function(e){function n(e){const n=e.regex,t=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),a="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",i="<[^<>]+>",r="("+a+"|"+n.optional(s)+"[a-zA-Z_]\\w*"+n.optional(i)+")",l={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},o="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+o+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},d={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},_={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},t,e.C_BLOCK_COMMENT_MODE]},u={className:"title",begin:n.optional(s)+e.IDENT_RE,relevance:0},m=n.optional(s)+e.IDENT_RE+"\\s*\\(",p=["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],f=["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],g={keyword:p,type:f,literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},b=[_,l,t,e.C_BLOCK_COMMENT_MODE,d,c],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:b.concat([{begin:/\(/,end:/\)/,keywords:g,contains:b.concat(["self"]),relevance:0}]),relevance:0},h={begin:"("+r+"[\\*&\\s]+)+"+m,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:a,keywords:g,relevance:0},{begin:m,returnBegin:!0,contains:[e.inherit(u,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[t,e.C_BLOCK_COMMENT_MODE,c,d,l,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",t,e.C_BLOCK_COMMENT_MODE,c,d,l]}]},l,t,e.C_BLOCK_COMMENT_MODE,_]};return{name:"C",aliases:["h"],keywords:g,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:_,strings:c,keywords:g}}}e.exports=n}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-cpp-js.c4d63969.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-cpp-js.c4d63969.js new file mode 100644 index 0000000..80a7cd5 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-cpp-js.c4d63969.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[297],{6570:function(e){function t(e){const t=e.regex,a=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),n="decltype\\(auto\\)",r="[a-zA-Z_]\\w*::",i="<[^<>]+>",s="(?!struct)("+n+"|"+t.optional(r)+"[a-zA-Z_]\\w*"+t.optional(i)+")",c={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},o="\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)",l={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+o+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(l,{className:"string"}),{className:"string",begin:/<.*?>/},a,e.C_BLOCK_COMMENT_MODE]},_={className:"title",begin:t.optional(r)+e.IDENT_RE,relevance:0},p=t.optional(r)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],f=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],g=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],b=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],h=["NULL","false","nullopt","nullptr","true"],w=["_Pragma"],y={type:f,keyword:m,literal:h,built_in:w,_type_hints:g},v={className:"function.dispatch",relevance:0,keywords:{_hint:b},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},k=[v,d,c,a,e.C_BLOCK_COMMENT_MODE,u,l],x={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:y,contains:k.concat([{begin:/\(/,end:/\)/,keywords:y,contains:k.concat(["self"]),relevance:0}]),relevance:0},E={className:"function",begin:"("+s+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:y,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:n,keywords:y,relevance:0},{begin:p,returnBegin:!0,contains:[_],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[l,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:[a,e.C_BLOCK_COMMENT_MODE,l,u,c,{begin:/\(/,end:/\)/,keywords:y,relevance:0,contains:["self",a,e.C_BLOCK_COMMENT_MODE,l,u,c]}]},c,a,e.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:y,illegal:"",keywords:y,contains:["self",c]},{begin:e.IDENT_RE+"::",keywords:y},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}e.exports=t}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-css-js.6a1f0b6c.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-css-js.6a1f0b6c.js new file mode 100644 index 0000000..5b93695 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-css-js.6a1f0b6c.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[175],{8612:function(e){const i=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],o=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],r=[...t,...o],n=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),a=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),l=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),s=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function c(e){const t=e.regex,o=i(e),c={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},d="and or not only",m=/@-?\w[\w]*(-\w+)*/,b="[a-zA-Z-][a-zA-Z0-9_-]*",g=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[o.BLOCK_COMMENT,c,o.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+b,relevance:0},o.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+a.join("|")+")"},{begin:":(:)?("+l.join("|")+")"}]},o.CSS_VARIABLE,{className:"attribute",begin:"\\b("+s.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[o.BLOCK_COMMENT,o.HEXCOLOR,o.IMPORTANT,o.CSS_NUMBER_MODE,...g,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...g,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},o.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:m},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:d,attribute:n.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...g,o.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+r.join("|")+")\\b"}]}}e.exports=c}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-custom-markdown.5b745889.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-custom-markdown.5b745889.js new file mode 100644 index 0000000..504f667 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-custom-markdown.5b745889.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +"use strict";(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[157],{8384:function(e,n,a){a.r(n),a.d(n,{default:function(){return l}});a(8111),a(2489),a(116);function i(e){const n=e.regex,a={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},i={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},t={className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},c={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},d=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:n.concat(/\[.+?\]\(/,d,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},r={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},g={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},o=e.inherit(r,{contains:[]}),b=e.inherit(g,{contains:[]});r.contains.push(b),g.contains.push(o);let u=[a,l];[r,g,o,b].forEach(e=>{e.contains=e.contains.concat(u)}),u=u.concat(r,g);const m={className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:u},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:u}]}]},N={className:"quote",begin:"^>\\s+",contains:u,end:"$"},x={scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/};return{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[m,a,t,r,g,N,s,i,l,c,x]}}const s={begin:"",returnBegin:!0,contains:[{className:"link",begin:"doc:",end:">",excludeEnd:!0}]},t={className:"link",begin:/`{2}(?!`)/,end:/`{2}(?!`)/,excludeBegin:!0,excludeEnd:!0},c={begin:"^>\\s+[Note:|Tip:|Important:|Experiment:|Warning:]",end:"$",returnBegin:!0,contains:[{className:"quote",begin:"^>",end:"\\s+"},{className:"type",begin:"Note|Tip|Important|Experiment|Warning",end:":"},{className:"quote",begin:".*",end:"$",endsParent:!0}]},d={begin:"@",end:"[{\\)\\s]",returnBegin:!0,contains:[{className:"title",begin:"@",end:"[\\s+(]",excludeEnd:!0},{begin:":",end:"[,\\)\n\t]",excludeBegin:!0,keywords:{literal:"true false null undefined"},contains:[{className:"number",begin:"\\b([\\d_]+(\\.[\\deE_]+)?|0x[a-fA-F0-9_]+(\\.[a-fA-F0-9p_]+)?|0b[01_]+|0o[0-7_]+)\\b",endsWithParent:!0,excludeEnd:!0},{className:"string",variants:[{begin:/"""/,end:/"""/},{begin:/"/,end:/"/}],endsParent:!0},{className:"link",begin:"http|https",endsWithParent:!0,excludeEnd:!0}]}]};function l(e){const n=i(e),a=n.contains.find(({className:e})=>"code"===e);a.variants=a.variants.filter(({begin:e})=>!e.includes("( {4}|\\t)"));const l=[...n.contains.filter(({className:e})=>"code"!==e),a];return{...n,contains:[t,s,c,d,...l]}}}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-custom-pkl.9fcf661e.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-custom-pkl.9fcf661e.js new file mode 100644 index 0000000..477bdd3 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-custom-pkl.9fcf661e.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +"use strict";(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[507],{3509:function(e,n,a){function s(e){return e?"string"===typeof e?e:e.source:null}function t(...e){return e.map(e=>s(e)).join("")}function c(e){const n={keyword:["abstract","amends","as","case","class","const","delete","else","extends","external","fixed","for","function","hidden","if","import","import*","in","is","let","local","module","new","open","out","outer","override","protected","read","read*","read?","record","super","switch","this","throw","trace","typealias","unknown","vararg","when"],literal:["true","false","null","nothing"]},a="[a-zA-Z_][a-zA-Z0-9_]*",s=/`[^`]+`/,c={className:"title",begin:a},i={className:"title",begin:s},r={className:"title",variants:[c,i]},o="([0-9]_*)+",l="([0-9a-fA-F]_*)+",d={className:"number",relevance:0,variants:[{match:`\\b(${o})(\\.(${o}))?([eE][+-]?(${o}))?\\b`},{match:`\\b0x(${l})(\\.(${l}))?([pP][+-]?(${o}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},m=(e="")=>({className:"subst",variants:[{match:t(/\\/,e,/[0\\tnr"']/)},{match:t(/\\/,e,/u\{[0-9a-fA-F]{1,8}}/)}]}),b=(e="")=>({className:"subst",label:"interpol",begin:t(/\\/,e,/\(/),end:/\)/}),u=(e="")=>({begin:t(e,/"""/),end:t(/"""/,e),contains:[m(e),b(e)]}),p=(e="")=>({begin:t(e,/"/),end:t(/"/,e),contains:[m(e),b(e)]}),_=(e="")=>({begin:t(e,/"/),end:t(/"/,e),contains:[m(e)]}),N={className:"string",variants:[u(),u("#"),u("##"),u("###"),p(),p("#"),p("##"),p("###")]},g={className:"string",variants:[_(),_("#"),_("##"),_("##")]},f=e.COMMENT("///","$",{className:"doctag",relevance:10}),M={className:"meta",begin:/@[a-zA-Z_][a-zA-Z0-9_]*/,relevance:5},h={className:"function",beginKeywords:"function",end:/[={]/,excludeEnd:!0,contains:[r,{className:"params",begin:/\(/,end:/\)/,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,r]}]},y={className:"class",beginKeywords:"class",end:/[{]|$/,excludeEnd:!0,contains:[r,{beginKeywords:"extends"},{begin://,contains:["self"]}]},E={className:"type",beginKeywords:"typealias",end:/$/,contains:[r,{begin:/=\s*/,returnBegin:!0,contains:[]}]},w={className:"meta",variants:[{begin:/^\s*(module|amends|extends)\s+/,end:/$/,contains:[{className:"keyword",begin:/(module|amends|extends)/},g]}]},C={className:"meta",begin:/\b(import|import\*)\s+/,end:/$/,keywords:{keyword:["import","import*","as"]},contains:[g]},O={className:"type",begin:/:\s*/,end:/(?=[=,)\]}]|$)/,excludeBegin:!0,contains:[{className:"type",begin:a},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},v={variants:[{match:[/\.|\?\./,/\s*/,s],scope:{3:"property"}},{match:[/\.|\?\./,/\s*/,a],scope:{3:"property"}}]},k={variants:[{match:[s,/\s*/,/(?=[=:{])/],scope:{1:"property"}},{match:[a,/\s*/,/(?=[=:{])/],scope:{1:"property"}}]};return{name:"Pkl",aliases:["pkl"],keywords:n,contains:[f,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,w,C,M,y,h,E,v,O,k,N,d]}}a.r(n),a.d(n,{default:function(){return i}});var i=c}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-custom-swift.9b9584b0.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-custom-swift.9b9584b0.js new file mode 100644 index 0000000..04d61a8 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-custom-swift.9b9584b0.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +"use strict";(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[255],{7735:function(e,n,t){t.r(n),t.d(n,{default:function(){return S}});t(8111),t(1701);function a(e){return e?"string"===typeof e?e:e.source:null}function s(e){return i("(?=",e,")")}function i(...e){const n=e.map(e=>a(e)).join("");return n}function c(e){const n=e[e.length-1];return"object"===typeof n&&n.constructor===Object?(e.splice(e.length-1,1),n):{}}function o(...e){const n=c(e),t="("+(n.capture?"":"?:")+e.map(e=>a(e)).join("|")+")";return t}const r=e=>i(/\b/,e,/\w$/.test(e)?/\b/:/\B/),u=["Protocol","Type"].map(r),l=["init","self"].map(r),d=["Any","Self"],m=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],p=["false","nil","true"],b=["assignment","associativity","higherThan","left","lowerThan","none","right"],F=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],f=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],h=o(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),w=o(h,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),y=i(h,w,"*"),g=o(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),v=o(g,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),E=i(g,v,"*"),A=i(/[A-Z]/,v,"*"),k=["attached","autoclosure",i(/convention\(/,o("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",i(/objc\(/,E,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],C=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function N(e){const n={match:/\s+/,relevance:0},t=e.COMMENT("/\\*","\\*/",{contains:["self"]}),a=[e.C_LINE_COMMENT_MODE,t],c={match:[/\./,o(...u,...l)],className:{2:"keyword"}},h={match:i(/\./,o(...m)),relevance:0},g=m.filter(e=>"string"===typeof e).concat(["_|0"]),N=m.filter(e=>"string"!==typeof e).concat(d).map(r),S={variants:[{className:"keyword",match:o(...N,...l)}]},B={$pattern:o(/\b\w+/,/#\w+/),keyword:g.concat(F),literal:p},_=[c,h,S],D={match:i(/\./,o(...f)),relevance:0},x={className:"built_in",match:i(/\b/,o(...f),/(?=\()/)},M=[D,x],I={match:/->/,relevance:0},$={className:"operator",relevance:0,variants:[{match:y},{match:`\\.(\\.|${w})+`}]},L=[I,$],O="([0-9]_*)+",K="([0-9a-fA-F]_*)+",P={className:"number",relevance:0,variants:[{match:`\\b(${O})(\\.(${O}))?([eE][+-]?(${O}))?\\b`},{match:`\\b0x(${K})(\\.(${K}))?([pP][+-]?(${O}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},T=(e="")=>({className:"subst",variants:[{match:i(/\\/,e,/[0\\tnr"']/)},{match:i(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),j=(e="")=>({className:"subst",match:i(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),z=(e="")=>({className:"subst",label:"interpol",begin:i(/\\/,e,/\(/),end:/\)/}),q=(e="")=>({begin:i(e,/"""/),end:i(/"""/,e),contains:[T(e),j(e),z(e)]}),U=(e="")=>({begin:i(e,/"/),end:i(/"/,e),contains:[T(e),z(e)]}),W={className:"string",variants:[q(),q("#"),q("##"),q("###"),U(),U("#"),U("##"),U("###")]},Z=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],V={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:Z},G=e=>{const n=i(e,/\//),t=i(/\//,e);return{begin:n,end:t,contains:[...Z,{scope:"comment",begin:`#(?!.*${t})`,end:/$/}]}},H={scope:"regexp",variants:[G("###"),G("##"),G("#"),V]},R={match:i(/`/,E,/`/)},X={className:"variable",match:/\$\d+/},J={className:"variable",match:`\\$${v}+`},Q=[R,X,J],Y={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:C,contains:[...L,P,W]}]}},ee={scope:"keyword",match:i(/@/,o(...k),s(o(/\(/,/\s+/)))},ne={scope:"meta",match:i(/@/,E)},te=[Y,ee,ne],ae={match:s(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:i(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,v,"+")},{className:"type",match:A,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:i(/\s+&\s+/,s(A)),relevance:0}]},se={begin://,keywords:B,contains:[...a,..._,...te,I,ae]};ae.contains.push(se);const ie={match:i(E,/\s*:/),keywords:"_|0",relevance:0},ce={begin:/\(/,end:/\)/,relevance:0,keywords:B,contains:["self",ie,...a,H,..._,...M,...L,P,W,...Q,...te,ae]},oe={begin://,keywords:"repeat each",contains:[...a,ae]},re={begin:o(s(i(E,/\s*:/)),s(i(E,/\s+/,E,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:E}]},ue={begin:/\(/,end:/\)/,keywords:B,contains:[re,...a,..._,...L,P,W,...te,ae,ce],endsParent:!0,illegal:/["']/},le={match:[/(func|macro)/,/\s+/,o(R.match,E,y)],className:{1:"keyword",3:"title.function"},contains:[oe,ue,n],illegal:[/\[/,/%/]},de={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[oe,ue,n],illegal:/\[|%/},me={match:[/operator/,/\s+/,y],className:{1:"keyword",3:"title"}},pe={begin:[/precedencegroup/,/\s+/,A],className:{1:"keyword",3:"title"},contains:[ae],keywords:[...b,...p],end:/}/},be={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Fe={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},fe={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,E,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:B,contains:[oe,..._,{begin:/:/,end:/\{/,keywords:B,contains:[{scope:"title.class.inherited",match:A},..._],relevance:0}]};for(const s of W.variants){const e=s.contains.find(e=>"interpol"===e.label);e.keywords=B;const n=[..._,...M,...L,P,W,...Q];e.contains=[...n,{begin:/\(/,end:/\)/,contains:["self",...n]}]}return{name:"Swift",keywords:B,contains:[...a,le,de,be,Fe,fe,me,pe,{beginKeywords:"import",end:/$/,contains:[...a],relevance:0},H,..._,...M,...L,P,W,...Q,...te,ae,ce]}}function S(e){const n=N(e),t=({beginKeywords:e=""})=>e.split(" ").includes("class"),a=n.contains.findIndex(t);if(a>=0){const{beginKeywords:e,...t}=n.contains[a];n.contains[a]={...t,begin:/\b(struct|protocol|extension|enum|actor|class\b(?!.*\bfunc))\b/}}const s=e=>{const{className:n,match:t}=e;if("subst"!==n||!t)return!1;const a=t.toString();return a.startsWith("\\")&&a.endsWith("[\\t ]*(?:[\\r\\n]|\\r\\n)")},i=n.contains.findIndex(({className:e})=>"string"===e);return n.contains[i]={...n.contains[i],variants:n.contains[i].variants.map(e=>({...e,contains:e.contains.map(e=>s(e)?{className:"subst",begin:/\\#{0,3}/,end:/[\t ]*(?:[\r\n]|\r\n)/,excludeEnd:!0}:e)}))},n}}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-diff-js.caa6d9aa.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-diff-js.caa6d9aa.js new file mode 100644 index 0000000..1634151 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-diff-js.caa6d9aa.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[703],{8596:function(e){function n(e){const n=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:n.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:n.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}e.exports=n}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-http-js.af24475e.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-http-js.af24475e.js new file mode 100644 index 0000000..20eab3c --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-http-js.af24475e.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[532],{3383:function(e){function n(e){const n=e.regex,a="HTTP/([32]|1\\.[01])",s=/[A-Za-z][A-Za-z0-9-]*/,t={className:"attribute",begin:n.concat("^",s,"(?=\\:\\s)"),starts:{contains:[{className:"punctuation",begin:/: /,relevance:0,starts:{end:"$",relevance:0}}]}},i=[t,{begin:"\\n\\n",starts:{subLanguage:[],endsWithParent:!0}}];return{name:"HTTP",aliases:["https"],illegal:/\S/,contains:[{begin:"^(?="+a+" \\d{3})",end:/$/,contains:[{className:"meta",begin:a},{className:"number",begin:"\\b\\d{3}\\b"}],starts:{end:/\b\B/,illegal:/\S/,contains:i}},{begin:"(?=^[A-Z]+ (.*?) "+a+"$)",end:/$/,contains:[{className:"string",begin:" ",end:" ",excludeBegin:!0,excludeEnd:!0},{className:"meta",begin:a},{className:"keyword",begin:"[A-Z]+"}],starts:{end:/\b\B/,illegal:/\S/,contains:i}},e.inherit(t,{relevance:0})]}}e.exports=n}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-java-js.d0776d11.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-java-js.d0776d11.js new file mode 100644 index 0000000..5cdbf4f --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-java-js.d0776d11.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[444],{4895:function(e){var n="[0-9](_*[0-9])*",a=`\\.(${n})`,s="[0-9a-fA-F](_*[0-9a-fA-F])*",t={className:"number",variants:[{begin:`(\\b(${n})((${a})|\\.)?|(${a}))[eE][+-]?(${n})[fFdD]?\\b`},{begin:`\\b(${n})((${a})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${a})[fFdD]?\\b`},{begin:`\\b(${n})[fFdD]\\b`},{begin:`\\b0[xX]((${s})\\.?|(${s})?\\.(${s}))[pP][+-]?(${n})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${s})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function i(e,n,a){return-1===a?"":e.replace(n,s=>i(e,n,a-1))}function r(e){const n=e.regex,a="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",s=a+i("(?:<"+a+"~~~(?:\\s*,\\s*"+a+"~~~)*>)?",/~~~/g,2),r=["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],c=["super","this"],l=["false","true","null"],o=["char","boolean","long","float","int","byte","short","double"],b={keyword:r,literal:l,type:o,built_in:c},_={className:"meta",begin:"@"+a,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},d={className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:b,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,a],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[n.concat(/(?!else)/,a),/\s+/,a,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,a],className:{1:"keyword",3:"title.class"},contains:[d,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+s+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:b,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[_,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,t,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},t,_]}}e.exports=r}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-javascript-js.46389717.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-javascript-js.46389717.js new file mode 100644 index 0000000..53aceea --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-javascript-js.46389717.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[531],{6035:function(e){const n="[A-Za-z$_][0-9A-Za-z$_]*",a=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],t=["true","false","null","undefined","NaN","Infinity"],s=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],c=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],r=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],i=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],o=[].concat(r,s,c);function l(e){const l=e.regex,d=(e,{after:n})=>{const a="",end:""},u=/<[A-Za-z0-9\\._:-]+\s*\/>/,m={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{const a=e[0].length+e.index,t=e.input[a];if("<"===t||","===t)return void n.ignoreMatch();let s;">"===t&&(d(e,{after:a})||n.ignoreMatch());const c=e.input.substring(a);((s=c.match(/^\s*=/))||(s=c.match(/^\s+extends\s+/))&&0===s.index)&&n.ignoreMatch()}},E={$pattern:n,keyword:a,literal:t,built_in:o,"variable.language":i},A="[0-9](_?[0-9])*",y=`\\.(${A})`,_="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${_})((${y})|\\.)?|(${y}))[eE][+-]?(${A})\\b`},{begin:`\\b(${_})\\b((${y})\\b|\\.)?|(${y})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},h={className:"subst",begin:"\\$\\{",end:"\\}",keywords:E,contains:[]},N={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"xml"}},p={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"css"}},S={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,h],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,h]},w=e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:b+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),k={className:"comment",variants:[w,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},R=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,N,p,S,v,{match:/\$\d+/},f];h.contains=R.concat({begin:/\{/,end:/\}/,keywords:E,contains:["self"].concat(R)});const O=[].concat(k,h.contains),I=O.concat([{begin:/(\s*)\(/,end:/\)/,keywords:E,contains:["self"].concat(O)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:E,contains:I},C={variants:[{match:[/class/,/\s+/,b,/\s+/,/extends/,/\s+/,l.concat(b,"(",l.concat(/\./,b),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,b],scope:{1:"keyword",3:"title.class"}}]},T={relevance:0,match:l.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...s,...c]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},$={variants:[{match:[/function/,/\s+/,b,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},B={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Z(e){return l.concat("(?!",e.join("|"),")")}const z={match:l.concat(/\b/,Z([...r,"super","import"].map(e=>`${e}\\s*\\(`)),b,l.lookahead(/\s*\(/)),className:"title.function",relevance:0},D={begin:l.concat(/\./,l.lookahead(l.concat(b,/(?![0-9A-Za-z$_(])/))),end:b,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,b,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},L="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",P={match:[/const|var|let/,/\s+/,b,/\s*/,/=\s*/,/(async\s*)?/,l.lookahead(L)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:E,exports:{PARAMS_CONTAINS:I,CLASS_REFERENCE:T},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,N,p,S,v,k,{match:/\$\d+/},f,T,{scope:"attr",match:b+l.lookahead(":"),relevance:0},P,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,e.REGEXP_MODE,{className:"function",begin:L,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:E,contains:I}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:g.begin,end:g.end},{match:u},{begin:m.begin,"on:begin":m.isTrulyOpeningTag,end:m.end}],subLanguage:"xml",contains:[{begin:m.begin,end:m.end,skip:!0,contains:["self"]}]}]},$,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,e.inherit(e.TITLE_MODE,{begin:b,className:"title.function"})]},{match:/\.\.\./,relevance:0},D,{match:"\\$"+b,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},z,B,C,U,{match:/\$[(.]/}]}}e.exports=l}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-json-js.6f4facb9.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-json-js.6f4facb9.js new file mode 100644 index 0000000..8fe8b06 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-json-js.6f4facb9.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[374],{621:function(e){function n(e){const n={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},s={match:/[{}[\],:]/,className:"punctuation",relevance:0},a=["true","false","null"],c={scope:"literal",beginKeywords:a.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:a},contains:[n,s,e.QUOTE_STRING_MODE,c,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}e.exports=n}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-llvm-js.3d5e9220.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-llvm-js.3d5e9220.js new file mode 100644 index 0000000..c0ab2ff --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-llvm-js.3d5e9220.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[989],{6398:function(e){function a(e){const a=e.regex,n=/([-a-zA-Z$._][\w$.-]*)/,t={className:"type",begin:/\bi\d+(?=\s|\b)/},c={className:"operator",relevance:0,begin:/=/},i={className:"punctuation",relevance:0,begin:/,/},l={className:"number",variants:[{begin:/[su]?0[xX][KMLHR]?[a-fA-F0-9]+/},{begin:/[-+]?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?/}],relevance:0},r={className:"symbol",variants:[{begin:/^\s*[a-z]+:/}],relevance:0},s={className:"variable",variants:[{begin:a.concat(/%/,n)},{begin:/%\d+/},{begin:/#\d+/}]},o={className:"title",variants:[{begin:a.concat(/@/,n)},{begin:/@\d+/},{begin:a.concat(/!/,n)},{begin:a.concat(/!\d+/,n)},{begin:/!\d+/}]};return{name:"LLVM IR",keywords:{keyword:"begin end true false declare define global constant private linker_private internal available_externally linkonce linkonce_odr weak weak_odr appending dllimport dllexport common default hidden protected extern_weak external thread_local zeroinitializer undef null to tail target triple datalayout volatile nuw nsw nnan ninf nsz arcp fast exact inbounds align addrspace section alias module asm sideeffect gc dbg linker_private_weak attributes blockaddress initialexec localdynamic localexec prefix unnamed_addr ccc fastcc coldcc x86_stdcallcc x86_fastcallcc arm_apcscc arm_aapcscc arm_aapcs_vfpcc ptx_device ptx_kernel intel_ocl_bicc msp430_intrcc spir_func spir_kernel x86_64_sysvcc x86_64_win64cc x86_thiscallcc cc c signext zeroext inreg sret nounwind noreturn noalias nocapture byval nest readnone readonly inlinehint noinline alwaysinline optsize ssp sspreq noredzone noimplicitfloat naked builtin cold nobuiltin noduplicate nonlazybind optnone returns_twice sanitize_address sanitize_memory sanitize_thread sspstrong uwtable returned type opaque eq ne slt sgt sle sge ult ugt ule uge oeq one olt ogt ole oge ord uno ueq une x acq_rel acquire alignstack atomic catch cleanup filter inteldialect max min monotonic nand personality release seq_cst singlethread umax umin unordered xchg add fadd sub fsub mul fmul udiv sdiv fdiv urem srem frem shl lshr ashr and or xor icmp fcmp phi call trunc zext sext fptrunc fpext uitofp sitofp fptoui fptosi inttoptr ptrtoint bitcast addrspacecast select va_arg ret br switch invoke unwind unreachable indirectbr landingpad resume malloc alloca free load store getelementptr extractelement insertelement shufflevector getresult extractvalue insertvalue atomicrmw cmpxchg fence argmemonly",type:"void half bfloat float double fp128 x86_fp80 ppc_fp128 x86_amx x86_mmx ptr label token metadata opaque"},contains:[t,e.COMMENT(/;\s*$/,null,{relevance:0}),e.COMMENT(/;/,/$/),{className:"string",begin:/"/,end:/"/,contains:[{className:"char.escape",match:/\\\d\d/}]},o,i,c,s,r,l]}}e.exports=a}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-markdown-js.37b335d9.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-markdown-js.37b335d9.js new file mode 100644 index 0000000..05de164 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-markdown-js.37b335d9.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[945],{602:function(e){function n(e){const n=e.regex,a={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},i={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},c={className:"bullet",begin:"^[ \t]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},t={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},l=/[A-Za-z][A-Za-z0-9+.-]*/,d={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:n.concat(/\[.+?\]\(/,l,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},g={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},r={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},o=e.inherit(g,{contains:[]}),b=e.inherit(r,{contains:[]});g.contains.push(b),r.contains.push(o);let u=[a,d];[g,r,o,b].forEach(e=>{e.contains=e.contains.concat(u)}),u=u.concat(g,r);const m={className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:u},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:u}]}]},v={className:"quote",begin:"^>\\s+",contains:u,end:"$"},x={scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/};return{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[m,a,c,g,r,v,s,i,d,t,x]}}e.exports=n}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-objectivec-js.d1cd434f.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-objectivec-js.d1cd434f.js new file mode 100644 index 0000000..a7cc1f5 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-objectivec-js.d1cd434f.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[172],{943:function(e){function n(e){const n={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},_=/[a-zA-Z@][a-zA-Z0-9_]*/,i=["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"],t=["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],a=["false","true","FALSE","TRUE","nil","YES","NO","NULL"],r=["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],l={"variable.language":["this","super"],$pattern:_,keyword:t,literal:a,built_in:r,type:i},s={$pattern:_,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:l,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+s.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:s,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}e.exports=n}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-perl-js.52ae345c.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-perl-js.52ae345c.js new file mode 100644 index 0000000..bb05fdf --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-perl-js.52ae345c.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[185],{946:function(e){function n(e){const n=e.regex,t=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],s=/[dualxmsipngr]{0,12}/,r={$pattern:/[\w.]+/,keyword:t.join(" ")},a={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:r},i={begin:/->\{/,end:/\}/},c={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},o={scope:"variable",variants:[{begin:/\$\d/},{begin:n.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[c]},l={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},g=[e.BACKSLASH_ESCAPE,a,o],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],m=(e,t,r="\\1")=>{const a="\\1"===r?r:n.concat(r,t);return n.concat(n.concat("(?:",e,")"),t,/(?:\\.|[^\\\/])*?/,a,/(?:\\.|[^\\\/])*?/,r,s)},p=(e,t,r)=>n.concat(n.concat("(?:",e,")"),t,/(?:\\.|[^\\\/])*?/,r,s),b=[o,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),i,{className:"string",contains:g,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},l,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:m("s|tr|y",n.either(...d,{capture:!0}))},{begin:m("s|tr|y","\\(","\\)")},{begin:m("s|tr|y","\\[","\\]")},{begin:m("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",n.either(...d,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,c]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,c,l]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return a.contains=b,i.contains=b,{name:"Perl",aliases:["pl","pm"],keywords:r,contains:b}}e.exports=n}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-php-js.4c0a7090.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-php-js.4c0a7090.js new file mode 100644 index 0000000..1dfebdb --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-php-js.4c0a7090.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[892],{5492:function(e){function t(e){const t=e.regex,a=/(?![A-Za-z0-9])(?![$])/,n=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,a),r=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,a),o=t.concat(/[A-Z]+/,a),c={scope:"variable",match:"\\$+"+n},i={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},s={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},l=e.inherit(e.APOS_STRING_MODE,{illegal:null}),d=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(s)}),_={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(s),"on:begin":(e,t)=>{t.data._beginMatch=e[1]||e[2]},"on:end":(e,t)=>{t.data._beginMatch!==e[1]&&t.ignoreMatch()}},p=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),b="[ \t\n]",E={scope:"string",variants:[d,l,_,p]},u={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},g=["false","null","true"],h=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],f=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],m=e=>{const t=[];return e.forEach(e=>{t.push(e),e.toLowerCase()===e?t.push(e.toUpperCase()):t.push(e.toLowerCase())}),t},I={keyword:h,literal:m(g),built_in:f},O=e=>e.map(e=>e.replace(/\|\d+$/,"")),v={variants:[{match:[/new/,t.concat(b,"+"),t.concat("(?!",O(f).join("\\b|"),"\\b)"),r],scope:{1:"keyword",4:"title.class"}}]},w=t.concat(n,"\\b(?!\\()"),y={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),w],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[r,t.concat(/::/,t.lookahead(/(?!class\b)/)),w],scope:{1:"title.class",3:"variable.constant"}},{match:[r,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[r,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},x={scope:"attr",match:t.concat(n,t.lookahead(":"),t.lookahead(/(?!::)/))},C={relevance:0,begin:/\(/,end:/\)/,keywords:I,contains:[x,c,y,e.C_BLOCK_COMMENT_MODE,E,u,v]},M={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",O(h).join("\\b|"),"|",O(f).join("\\b|"),"\\b)"),n,t.concat(b,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[C]};C.contains.push(M);const S=[x,y,e.C_BLOCK_COMMENT_MODE,E,u,v],T={begin:t.concat(/#\[\s*\\?/,t.either(r,o)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:g,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:g,keyword:["new","array"]},contains:["self",...S]},...S,{scope:"meta",variants:[{match:r},{match:o}]}]};return{case_insensitive:!1,keywords:I,contains:[T,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},i,{scope:"variable.language",match:/\$this\b/},c,M,y,{match:[/const/,/\s/,n],scope:{1:"keyword",3:"variable.constant"}},v,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:I,contains:["self",T,c,y,e.C_BLOCK_COMMENT_MODE,E,u]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},E,u]}}e.exports=t}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-python-js.c050f618.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-python-js.c050f618.js new file mode 100644 index 0000000..cbf5c58 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-python-js.c050f618.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[758],{1117:function(e){function n(e){const n=e.regex,a=/[\p{XID_Start}_]\p{XID_Continue}*/u,s=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],i=["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],t=["__debug__","Ellipsis","False","None","NotImplemented","True"],r=["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"],l={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:s,built_in:i,literal:t,type:r},o={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:l,illegal:/#/},b={begin:/\{\{/,relevance:0},d={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,o],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,o],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,o,b,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,o,b,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,b,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,b,c]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},p="[0-9](_?[0-9])*",g=`(\\b(${p}))?\\.(${p})|\\b(${p})\\.`,_=`\\b|${s.join("|")}`,m={className:"number",relevance:0,variants:[{begin:`(\\b(${p})|(${g}))[eE][+-]?(${p})[jJ]?(?=${_})`},{begin:`(${g})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${_})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${_})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${_})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${_})`},{begin:`\\b(${p})[jJ](?=${_})`}]},f={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:l,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},u={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:l,contains:["self",o,m,d,e.HASH_COMMENT_MODE]}]};return c.contains=[d,m,o],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:l,illegal:/(<\/|\?)|=>/,contains:[o,m,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},d,f,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,a],scope:{1:"keyword",3:"title.function"},contains:[u]},{variants:[{match:[/\bclass/,/\s+/,a,/\s*/,/\(\s*/,a,/\s*\)/]},{match:[/\bclass/,/\s+/,a]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[m,u,d]}]}}e.exports=n}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-ruby-js.013bb247.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-ruby-js.013bb247.js new file mode 100644 index 0000000..c187f09 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-ruby-js.013bb247.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[476],{5015:function(e){function n(e){const n=e.regex,a="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",s=n.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=n.concat(s,/(::\w+)*/),c=["include","extend","prepend","public","private","protected","raise","throw"],t={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...c],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},r={className:"doctag",begin:"@[A-Za-z]+"},b={begin:"#<",end:">"},d=[e.COMMENT("#","$",{contains:[r]}),e.COMMENT("^=begin","^=end",{contains:[r],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],l={className:"subst",begin:/#\{/,end:/\}/,keywords:t},o={className:"string",contains:[e.BACKSLASH_ESCAPE,l],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:n.concat(/<<[-~]?'?/,n.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,l]})]}]},g="[1-9](_?[0-9])*|0",_="[0-9](_?[0-9])*",u={className:"number",relevance:0,variants:[{begin:`\\b(${g})(\\.(${_}))?([eE][+-]?(${_})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},w={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:t}]},m={match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:t},E={variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:t},N={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},p={match:[/def/,/\s+/,a],scope:{1:"keyword",3:"title.function"},contains:[w]},A={relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},x={relevance:0,match:s,scope:"title.class"},f=[o,E,m,A,N,x,p,{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[o,{begin:a}],relevance:0},u,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:t},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,l],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(b,d),relevance:0}].concat(b,d);l.contains=f,w.contains=f;const h="[>?]>",v="[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]",y="(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>",C=[{begin:/^\s*=>/,starts:{end:"$",contains:f}},{className:"meta.prompt",begin:"^("+h+"|"+v+"|"+y+")(?=[ ])",starts:{end:"$",keywords:t,contains:f}}];return d.unshift(b),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:t,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(C).concat(d).concat(f)}}e.exports=n}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-scss-js.6dc40f91.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-scss-js.6dc40f91.js new file mode 100644 index 0000000..914d022 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-scss-js.6dc40f91.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[672],{1611:function(e){const i=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),t=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],o=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],r=[...t,...o],n=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),a=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),l=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),s=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function d(e){const t=i(e),o=l,d=a,c="@[a-z-]+",p="and or not only",b="[a-zA-Z-][a-zA-Z0-9_-]*",m={className:"variable",begin:"(\\$"+b+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+r.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+d.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+o.join("|")+")"},m,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+s.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,m,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:c,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:p,attribute:n.join(" ")},contains:[{begin:c,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},m,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}e.exports=d}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-shell-js.e71539fa.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-shell-js.e71539fa.js new file mode 100644 index 0000000..4bafd92 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-shell-js.e71539fa.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[638],{8813:function(s){function e(s){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}s.exports=e}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-swift-js.9bc017b7.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-swift-js.9bc017b7.js new file mode 100644 index 0000000..4dd9ea4 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-swift-js.9bc017b7.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[35],{1496:function(e){function n(e){return e?"string"===typeof e?e:e.source:null}function t(e){return a("(?=",e,")")}function a(...e){const t=e.map(e=>n(e)).join("");return t}function s(e){const n=e[e.length-1];return"object"===typeof n&&n.constructor===Object?(e.splice(e.length-1,1),n):{}}function i(...e){const t=s(e),a="("+(t.capture?"":"?:")+e.map(e=>n(e)).join("|")+")";return a}const c=e=>a(/\b/,e,/\w$/.test(e)?/\b/:/\B/),o=["Protocol","Type"].map(c),u=["init","self"].map(c),r=["Any","Self"],l=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],p=["false","nil","true"],m=["assignment","associativity","higherThan","left","lowerThan","none","right"],d=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],b=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],F=i(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),h=i(F,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),f=a(F,h,"*"),w=i(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),y=i(w,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),g=a(w,y,"*"),v=a(/[A-Z]/,y,"*"),A=["attached","autoclosure",a(/convention\(/,i("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",a(/objc\(/,g,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],E=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function k(e){const n={match:/\s+/,relevance:0},s=e.COMMENT("/\\*","\\*/",{contains:["self"]}),F=[e.C_LINE_COMMENT_MODE,s],w={match:[/\./,i(...o,...u)],className:{2:"keyword"}},k={match:a(/\./,i(...l)),relevance:0},C=l.filter(e=>"string"===typeof e).concat(["_|0"]),N=l.filter(e=>"string"!==typeof e).concat(r).map(c),S={variants:[{className:"keyword",match:i(...N,...u)}]},B={$pattern:i(/\b\w+/,/#\w+/),keyword:C.concat(d),literal:p},_=[w,k,S],D={match:a(/\./,i(...b)),relevance:0},M={className:"built_in",match:a(/\b/,i(...b),/(?=\()/)},x=[D,M],$={match:/->/,relevance:0},L={className:"operator",relevance:0,variants:[{match:f},{match:`\\.(\\.|${h})+`}]},I=[$,L],O="([0-9]_*)+",P="([0-9a-fA-F]_*)+",K={className:"number",relevance:0,variants:[{match:`\\b(${O})(\\.(${O}))?([eE][+-]?(${O}))?\\b`},{match:`\\b0x(${P})(\\.(${P}))?([pP][+-]?(${O}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},T=(e="")=>({className:"subst",variants:[{match:a(/\\/,e,/[0\\tnr"']/)},{match:a(/\\/,e,/u\{[0-9a-fA-F]{1,8}\}/)}]}),j=(e="")=>({className:"subst",match:a(/\\/,e,/[\t ]*(?:[\r\n]|\r\n)/)}),z=(e="")=>({className:"subst",label:"interpol",begin:a(/\\/,e,/\(/),end:/\)/}),q=(e="")=>({begin:a(e,/"""/),end:a(/"""/,e),contains:[T(e),j(e),z(e)]}),U=(e="")=>({begin:a(e,/"/),end:a(/"/,e),contains:[T(e),z(e)]}),Z={className:"string",variants:[q(),q("#"),q("##"),q("###"),U(),U("#"),U("##"),U("###")]},V=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],W={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:V},G=e=>{const n=a(e,/\//),t=a(/\//,e);return{begin:n,end:t,contains:[...V,{scope:"comment",begin:`#(?!.*${t})`,end:/$/}]}},H={scope:"regexp",variants:[G("###"),G("##"),G("#"),W]},R={match:a(/`/,g,/`/)},X={className:"variable",match:/\$\d+/},J={className:"variable",match:`\\$${y}+`},Q=[R,X,J],Y={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:E,contains:[...I,K,Z]}]}},ee={scope:"keyword",match:a(/@/,i(...A),t(i(/\(/,/\s+/)))},ne={scope:"meta",match:a(/@/,g)},te=[Y,ee,ne],ae={match:t(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:a(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,y,"+")},{className:"type",match:v,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:a(/\s+&\s+/,t(v)),relevance:0}]},se={begin://,keywords:B,contains:[...F,..._,...te,$,ae]};ae.contains.push(se);const ie={match:a(g,/\s*:/),keywords:"_|0",relevance:0},ce={begin:/\(/,end:/\)/,relevance:0,keywords:B,contains:["self",ie,...F,H,..._,...x,...I,K,Z,...Q,...te,ae]},oe={begin://,keywords:"repeat each",contains:[...F,ae]},ue={begin:i(t(a(g,/\s*:/)),t(a(g,/\s+/,g,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:g}]},re={begin:/\(/,end:/\)/,keywords:B,contains:[ue,...F,..._,...I,K,Z,...te,ae,ce],endsParent:!0,illegal:/["']/},le={match:[/(func|macro)/,/\s+/,i(R.match,g,f)],className:{1:"keyword",3:"title.function"},contains:[oe,re,n],illegal:[/\[/,/%/]},pe={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[oe,re,n],illegal:/\[|%/},me={match:[/operator/,/\s+/,f],className:{1:"keyword",3:"title"}},de={begin:[/precedencegroup/,/\s+/,v],className:{1:"keyword",3:"title"},contains:[ae],keywords:[...m,...p],end:/}/},be={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Fe={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},he={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,g,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:B,contains:[oe,..._,{begin:/:/,end:/\{/,keywords:B,contains:[{scope:"title.class.inherited",match:v},..._],relevance:0}]};for(const t of Z.variants){const e=t.contains.find(e=>"interpol"===e.label);e.keywords=B;const n=[..._,...x,...I,K,Z,...Q];e.contains=[...n,{begin:/\(/,end:/\)/,contains:["self",...n]}]}return{name:"Swift",keywords:B,contains:[...F,le,pe,be,Fe,he,me,de,{beginKeywords:"import",end:/$/,contains:[...F],relevance:0},H,..._,...x,...I,K,Z,...Q,...te,ae,ce]}}e.exports=k}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-typescript-js.9b270b56.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-typescript-js.9b270b56.js new file mode 100644 index 0000000..a80eaff --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-typescript-js.9b270b56.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[299],{8640:function(e){const n="[A-Za-z$_][0-9A-Za-z$_]*",a=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],t=["true","false","null","undefined","NaN","Infinity"],s=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],c=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],r=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],i=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],o=[].concat(r,s,c);function l(e){const l=e.regex,d=(e,{after:n})=>{const a="",end:""},u=/<[A-Za-z0-9\\._:-]+\s*\/>/,m={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{const a=e[0].length+e.index,t=e.input[a];if("<"===t||","===t)return void n.ignoreMatch();let s;">"===t&&(d(e,{after:a})||n.ignoreMatch());const c=e.input.substring(a);((s=c.match(/^\s*=/))||(s=c.match(/^\s+extends\s+/))&&0===s.index)&&n.ignoreMatch()}},E={$pattern:n,keyword:a,literal:t,built_in:o,"variable.language":i},A="[0-9](_?[0-9])*",p=`\\.(${A})`,y="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${y})((${p})|\\.)?|(${p}))[eE][+-]?(${A})\\b`},{begin:`\\b(${y})\\b((${p})\\b|\\.)?|(${p})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},_={className:"subst",begin:"\\$\\{",end:"\\}",keywords:E,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,_],subLanguage:"xml"}},N={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,_],subLanguage:"css"}},S={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,_],subLanguage:"graphql"}},v={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,_]},w=e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:b+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),k={className:"comment",variants:[w,e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},R=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,N,S,v,{match:/\$\d+/},f];_.contains=R.concat({begin:/\{/,end:/\}/,keywords:E,contains:["self"].concat(R)});const x=[].concat(k,_.contains),O=x.concat([{begin:/(\s*)\(/,end:/\)/,keywords:E,contains:["self"].concat(x)}]),C={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:E,contains:O},I={variants:[{match:[/class/,/\s+/,b,/\s+/,/extends/,/\s+/,l.concat(b,"(",l.concat(/\./,b),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,b],scope:{1:"keyword",3:"title.class"}}]},T={relevance:0,match:l.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...s,...c]}},M={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},$={variants:[{match:[/function/,/\s+/,b,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[C],illegal:/%/},B={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Z(e){return l.concat("(?!",e.join("|"),")")}const D={match:l.concat(/\b/,Z([...r,"super","import"].map(e=>`${e}\\s*\\(`)),b,l.lookahead(/\s*\(/)),className:"title.function",relevance:0},z={begin:l.concat(/\./,l.lookahead(l.concat(b,/(?![0-9A-Za-z$_(])/))),end:b,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,b,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},C]},L="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",P={match:[/const|var|let/,/\s+/,b,/\s*/,/=\s*/,/(async\s*)?/,l.lookahead(L)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[C]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:E,exports:{PARAMS_CONTAINS:O,CLASS_REFERENCE:T},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),M,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,N,S,v,k,{match:/\$\d+/},f,T,{scope:"attr",match:b+l.lookahead(":"),relevance:0},P,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[k,e.REGEXP_MODE,{className:"function",begin:L,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:E,contains:O}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:g.begin,end:g.end},{match:u},{begin:m.begin,"on:begin":m.isTrulyOpeningTag,end:m.end}],subLanguage:"xml",contains:[{begin:m.begin,end:m.end,skip:!0,contains:["self"]}]}]},$,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[C,e.inherit(e.TITLE_MODE,{begin:b,className:"title.function"})]},{match:/\.\.\./,relevance:0},z,{match:"\\$"+b,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[C]},D,B,I,U,{match:/\$[(.]/}]}}function d(e){const s=e.regex,c=l(e),r=n,d=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],b={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},g={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:d},contains:[c.exports.CLASS_REFERENCE]},u={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},m=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],E={$pattern:n,keyword:a.concat(m),literal:t,built_in:o.concat(d),"variable.language":i},A={className:"meta",begin:"@"+r},p=(e,n,a)=>{const t=e.contains.findIndex(e=>e.label===n);if(-1===t)throw new Error("can not find mode to replace");e.contains.splice(t,1,a)};Object.assign(c.keywords,E),c.exports.PARAMS_CONTAINS.push(A);const y=c.contains.find(e=>"attr"===e.scope),f=Object.assign({},y,{match:s.concat(r,s.lookahead(/\s*\?:/))});c.exports.PARAMS_CONTAINS.push([c.exports.CLASS_REFERENCE,y,f]),c.contains=c.contains.concat([A,b,g,f]),p(c,"shebang",e.SHEBANG()),p(c,"use_strict",u);const _=c.contains.find(e=>"func.def"===e.label);return _.relevance=0,Object.assign(c,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),c}e.exports=d}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-xml-js.9d3ac47d.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-xml-js.9d3ac47d.js new file mode 100644 index 0000000..29cd68d --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-xml-js.9d3ac47d.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[777],{114:function(e){function n(e){const n=e.regex,a=n.concat(/[\p{L}_]/u,n.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s=/[\p{L}0-9._:-]+/u,t={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},c=e.inherit(i,{begin:/\(/,end:/\)/}),l=e.inherit(e.APOS_STRING_MODE,{className:"string"}),r=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),g={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[i,r,l,c,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[i,c,r,l]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},t,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[r]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[g],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[g],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:n.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:a,relevance:0,starts:g}]},{className:"tag",begin:n.concat(/<\//,n.lookahead(n.concat(a,/>/))),contains:[{className:"name",begin:a,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}e.exports=n}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/highlight-js-yaml-js.9c616705.js b/Containers/Supporting Files/Help.bundle/js/highlight-js-yaml-js.9c616705.js new file mode 100644 index 0000000..a36a44d --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/highlight-js-yaml-js.9c616705.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[639],{5588:function(e){function n(e){const n="true false yes no null",a="[\\w#;/?:@&=+$,.~*'()[\\]]+",s={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},c={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},l={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},t=e.inherit(l,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),b="[0-9]{4}(-[0-9][0-9]){0,2}",r="([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?",g="(\\.[0-9]*)?",m="([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?",d={className:"number",begin:"\\b"+b+r+g+m+"\\b"},N={end:",",endsWithParent:!0,excludeEnd:!0,keywords:n,relevance:0},o={begin:/\{/,end:/\}/,contains:[N],illegal:"\\n",relevance:0},u={begin:"\\[",end:"\\]",contains:[N],illegal:"\\n",relevance:0},v=[s,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+a},{className:"type",begin:"!<"+a+">"},{className:"type",begin:"!"+a},{className:"type",begin:"!!"+a},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:n,keywords:{literal:n}},d,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},o,u,c,l],E=[...v];return E.pop(),E.push(t),N.contains=E,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:v}}e.exports=n}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/index.f7bc5188.js b/Containers/Supporting Files/Help.bundle/js/index.f7bc5188.js new file mode 100644 index 0000000..a089246 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/index.f7bc5188.js @@ -0,0 +1,9 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */(function(){var e={288:function(e,t,n){"use strict";n.d(t,{CN:function(){return r},Fd:function(){return o},Hm:function(){return c},Vd:function(){return s},iw:function(){return l},np:function(){return i},qD:function(){return a},vc:function(){return d}});n(4114),n(8111),n(116),n(8237);function i(e){return e.reduce((e,t)=>(t.traits.includes("dark")?e.dark.push(t):e.light.push(t),e),{light:[],dark:[]})}function a(e){const t=["1x","2x","3x"];return t.reduce((t,n)=>{const i=e.find(e=>e.traits.includes(n));return i?t.concat({density:n,src:i.url,size:i.size}):t},[])}function r(e){const t="/",n=new RegExp(`${t}+`,"g");return e.join(t).replace(n,t)}function o(e){const{baseUrl:t}=window,n=Array.isArray(e)?r(e):e;return n&&"string"===typeof n&&!n.startsWith(t)&&n.startsWith("/")?r([t,n]):n}function s(e){return e?e.startsWith("/")?e:`/${e}`:e}function l(e){return e?`url('${o(e)}')`:void 0}function c(e){return new Promise((t,n)=>{const i=new Image;i.src=e,i.onerror=n,i.onload=()=>t({width:i.width,height:i.height})})}const u={landscape:"landscape",portrait:"portrait",square:"square"};function d(e,t){return e&&t?et?u.landscape:u.square:null}},986:function(e,t,n){"use strict";n.d(t,{i:function(){return i}});const i="app-top"},1074:function(e,t,n){"use strict";n.d(t,{LG:function(){return l},c$:function(){return s},Lo:function(){return c},vh:function(){return d},vk:function(){return o},FT:function(){return u}});n(8111),n(8237),n(3110),n(4603),n(7566),n(8721);var i=n(288),a={input:"input",tags:"tags"},r=n(1328);function o(e={}){return Object.entries(e).reduce((e,[t,n])=>n?e.concat(`${encodeURIComponent(t)}=${encodeURIComponent(n)}`):e,[]).join("&")}function s(e,{changes:t,language:n,context:i}={}){const[a,r]=e.split("#"),s=a.match(/\?.*/),l=o({changes:t,language:n,context:i}),c=s?"&":"?",u=r?a:e,d=l?`${c}${l}`:"",m=r?`#${r}`:"";return`${u}${d}${m}`}function l(e,t){const{query:{changes:n,[a.input]:i,[a.tags]:o,[r.A.query]:s,...l}={}}=e,{query:{changes:c,[a.input]:u,[a.tags]:d,[r.A.query]:m,...p}={}}=t;return e.name===t.name&&JSON.stringify({path:e.path,query:l})===JSON.stringify({path:t.path,query:p})}function c(e,t=window.location.href){return new URL((0,i.Fd)(e),t)}function u(e,t){return c(e,t).href}function d(e){try{return new URL(e),!0}catch(t){return!1}}},1176:function(e,t,n){"use strict";n.d(t,{IG:function(){return l},Ud:function(){return o},sZ:function(){return c}});n(3110),n(8335);const i="developer.setting.";function a(e=localStorage){return{getItem:t=>{try{return e.getItem(t)}catch(n){return null}},setItem:(t,n)=>{try{e.setItem(t,n)}catch(i){}},removeItem:t=>{try{e.removeItem(t)}catch(n){}}}}function r(e){return{get:(t,n)=>{const a=JSON.parse(e.getItem(i+t));return null!==a?a:n},set:(t,n)=>e.setItem(i+t,JSON.stringify(n)),remove:t=>e.removeItem(i+t)}}const o=a(window.localStorage),s=a(window.sessionStorage),l=r(o),c=r(s)},1328:function(e,t){"use strict";t.A={query:"q"}},1537:function(e,t){"use strict";t.A={auto:"auto",dark:"dark",light:"light"}},1570:function(e,t,n){"use strict";n(3958);var i=n(5471),a=n(4765),r=n(173),o=function(){var e=this,t=e._self._c;return t("div",{class:{fromkeyboard:e.fromKeyboard,hascustomheader:e.hasCustomHeader},attrs:{id:"app"}},[t("div",{attrs:{id:e.AppTopID}}),e.isTargetIDE?e._e():t("a",{attrs:{href:"#app-main",id:"skip-nav"}},[e._v(" "+e._s(e.$t("accessibility.skip-navigation"))+" ")]),e._t("header",function(){return[e.enablei18n?t("SuggestLang"):e._e(),e.hasCustomHeader?t("custom-header",{attrs:{"data-color-scheme":e.preferredColorScheme}}):e._e()]},{isTargetIDE:e.isTargetIDE}),t("div",{attrs:{id:e.baseNavStickyAnchorId}}),t("InitialLoadingPlaceholder"),e._t("default",function(){return[t("router-view",{staticClass:"router-content"}),e.hasCustomFooter?t("custom-footer",{attrs:{"data-color-scheme":e.preferredColorScheme}}):e.isTargetIDE?e._e():t("Footer",{scopedSlots:e._u([{key:"default",fn:function({className:n}){return[e.enablei18n?t("div",{class:n},[t("LocaleSelector")],1):e._e()]}}])})]},{isTargetIDE:e.isTargetIDE}),e._t("footer",null,{isTargetIDE:e.isTargetIDE})],2)},s=[],l=(n(4114),n(8111),n(2489),n(7588),n(8964)),c=n(1537),u=function(){var e=this,t=e._self._c;return t("footer",{staticClass:"footer"},[t("div",{staticClass:"row"},[t("ColorSchemeToggle")],1),e._t("default",null,{className:"row"})],2)},d=[],m=function(){var e=this,t=e._self._c;return t("fieldset",{staticClass:"color-scheme-toggle",attrs:{role:"radiogroup"}},[t("legend",{staticClass:"visuallyhidden"},[e._v(e._s(e.$t("color-scheme.select")))]),e._l(e.options,function(n){return t("label",{key:n},[t("input",{attrs:{type:"radio"},domProps:{checked:n==e.preferredColorScheme,value:n},on:{input:e.setPreferredColorScheme}}),t("div",{staticClass:"text"},[e._v(e._s(e.$t(`color-scheme.${n}`)))])])})],2)},p=[],g={name:"ColorSchemeToggle",data:()=>({appState:l.A.state}),computed:{options:({supportsAutoColorScheme:e})=>[c.A.light,c.A.dark,...e?[c.A.auto]:[]],preferredColorScheme:({appState:e})=>e.preferredColorScheme,supportsAutoColorScheme:({appState:e})=>e.supportsAutoColorScheme},methods:{setPreferredColorScheme:e=>{l.A.setPreferredColorScheme(e.target.value)}},watch:{preferredColorScheme:{immediate:!0,handler(e){document.body.dataset.colorScheme=e}}}},h=g,f=n(1656),b=(0,f.A)(h,m,p,!1,null,"0c0360ce",null),v=b.exports,w={name:"Footer",components:{ColorSchemeToggle:v}},y=w,A=(0,f.A)(y,u,d,!1,null,"f1d65b2a",null),S=A.exports,k=function(){var e=this,t=e._self._c;return e.loaded?e._e():t("div",{staticClass:"InitialLoadingPlaceholder",attrs:{id:"loading-placeholder"}})},E=[],C={name:"InitialLoadingPlaceholder",data(){return{loaded:!1}},created(){const e=()=>{this.loaded=!0};this.$router.onReady(e,e)}},P=C,T=(0,f.A)(P,k,E,!1,null,"35c356b6",null),L=T.exports,x=n(9404),_=n(2655);function I(e,t){return e&&"object"===typeof e&&Object.prototype.hasOwnProperty.call(e,t)&&"string"===typeof e[t]}function j(e,t,n,i){if(!t||"object"!==typeof t||i&&(I(t,"light")||I(t,"dark"))){let a=t;if(I(t,i)&&(a=t[i]),"object"===typeof a)return;n[e]=a}else Object.entries(t).forEach(([t,a])=>{const r=[e,t].join("-");j(r,a,n,i)})}function D(e,t="light"){const n={},i=e||{};return j("-",i,n,t),n}var q=n(986),N=function(){var e=this,t=e._self._c;return e.displaySuggestLang?t("div",{staticClass:"suggest-lang"},[t("div",{staticClass:"suggest-lang__wrapper"},[t("router-link",{staticClass:"suggest-lang__link",attrs:{to:e.getLocaleParam(e.preferredLocale),lang:e.getCodeForSlug(e.preferredLocale)},nativeOn:{click:function(t){return e.setPreferredLocale(e.preferredLocale)}}},[e._v(e._s(e.$i18n.messages[e.preferredLocale]["view-in"])),t("InlineChevronRightIcon",{staticClass:"icon-inline"})],1),t("div",{staticClass:"suggest-lang__close-icon-wrapper"},[t("button",{staticClass:"suggest-lang__close-icon-button",attrs:{"aria-label":e.$t("continue-viewing")},on:{click:function(t){return e.setPreferredLocale(e.$i18n.locale)}}},[t("CloseIcon",{staticClass:"icon-inline"})],1)])],1)]):e._e()},R=[],z=(n(116),n(6e3)),V=n(8457),O=n(3633),M=n(8213),F={name:"SuggestLang",components:{InlineChevronRightIcon:z.A,CloseIcon:V.A},computed:{preferredLocale:()=>{const e=l.A.state.preferredLocale;if(e)return e;const t=O.find(e=>{const t=e.code.split("-")[0],n=window.navigator.language.split("-")[0];return n===t});return t?t.slug:null},displaySuggestLang:({preferredLocale:e,$i18n:t})=>e&&t.locale!==e},methods:{setPreferredLocale:e=>{l.A.setPreferredLocale(e)},getCodeForSlug:M.UM,getLocaleParam:M.Cj}},B=F,$=(0,f.A)(B,N,R,!1,null,"c2dca0ae",null),U=$.exports,W=function(){var e=this,t=e._self._c;return t("div",{staticClass:"locale-selector"},[t("select",{attrs:{"aria-label":e.$t("select-language")},domProps:{value:e.$i18n.locale},on:{change:e.updateRouter}},e._l(e.locales,function({slug:n,name:i,code:a}){return t("option",{key:n,attrs:{lang:a},domProps:{value:n}},[e._v(" "+e._s(i)+" ")])}),0),t("ChevronThickIcon",{staticClass:"icon-inline"})],1)},G=[],H=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"chevron-thick-icon",attrs:{viewBox:"0 0 14 10.5",themeId:"chevron-thick"}},[t("path",{attrs:{d:"M12.43,0l1.57,1.22L7,10.5,0,1.23,1.58,0,7,7,12.43,0Z"}})])},K=[],J=n(6515),Z={name:"ChevronThickIcon",components:{SVGIcon:J.A}},Q=Z,Y=(0,f.A)(Q,H,K,!1,null,null,null),X=Y.exports,ee={name:"LocaleSelector",components:{ChevronThickIcon:X},methods:{updateRouter({target:{value:e}}){this.$router.push((0,M.Cj)(e)),l.A.setPreferredLocale(e),(0,M.cu)(e,this)}},computed:{availableLocales:()=>l.A.state.availableLocales,locales:({availableLocales:e})=>O.filter(({code:t})=>e.includes(t))}},te=ee,ne=(0,f.A)(te,W,G,!1,null,"d21858a2",null),ie=ne.exports,ae={name:"CoreApp",components:{Footer:S,InitialLoadingPlaceholder:L,SuggestLang:U,LocaleSelector:ie},provide(){return{isTargetIDE:this.isTargetIDE,performanceMetricsEnabled:"true"==={NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}.VUE_APP_PERFORMANCE_ENABLED}},data(){return{AppTopID:q.i,appState:l.A.state,fromKeyboard:!1,isTargetIDE:"ide"==={NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}.VUE_APP_TARGET,themeSettings:_.u2,baseNavStickyAnchorId:x.G3}},computed:{currentColorScheme:({appState:e})=>e.systemColorScheme,preferredColorScheme:({appState:e})=>e.preferredColorScheme,availableLocales:({appState:e})=>e.availableLocales,CSSCustomProperties:({currentColorScheme:e,preferredColorScheme:t,themeSettings:n})=>D(n.theme,t===c.A.auto?e:t),hasCustomHeader:()=>!!window.customElements.get("custom-header"),hasCustomFooter:()=>!!window.customElements.get("custom-footer"),enablei18n:({availableLocales:e})=>(0,_.PL)(["features","docs","i18n","enable"],!1)&&e.length>1},props:{enableThemeSettings:{type:Boolean,default:!0}},watch:{CSSCustomProperties:{immediate:!0,handler(e){this.detachStylesFromRoot(e),this.attachStylesToRoot(e)}}},async created(){window.addEventListener("keydown",this.onKeyDown),this.$bridge.on("navigation",this.handleNavigationRequest),this.enableThemeSettings&&Object.assign(this.themeSettings,await(0,_.nb)()),window.addEventListener("pageshow",this.syncPreferredColorScheme),this.$once("hook:beforeDestroy",()=>{window.removeEventListener("pageshow",this.syncPreferredColorScheme)})},mounted(){(document.querySelector(".footer-current-year")||{}).innerText=(new Date).getFullYear(),this.attachColorSchemeListeners()},beforeDestroy(){this.fromKeyboard?window.removeEventListener("mousedown",this.onMouseDown):window.removeEventListener("keydown",this.onKeyDown),this.$bridge.off("navigation",this.handleNavigationRequest),this.detachStylesFromRoot(this.CSSCustomProperties)},methods:{onKeyDown(){this.fromKeyboard=!0,window.addEventListener("mousedown",this.onMouseDown),window.removeEventListener("keydown",this.onKeyDown)},onMouseDown(){this.fromKeyboard=!1,window.addEventListener("keydown",this.onKeyDown),window.removeEventListener("mousedown",this.onMouseDown)},handleNavigationRequest(e){this.$router.push(e)},attachColorSchemeListeners(){if(!window.matchMedia)return;const e=window.matchMedia("(prefers-color-scheme: dark)");e.addListener(this.onColorSchemePreferenceChange),this.$once("hook:beforeDestroy",()=>{e.removeListener(this.onColorSchemePreferenceChange)}),this.onColorSchemePreferenceChange(e)},onColorSchemePreferenceChange({matches:e}){const t=e?c.A.dark:c.A.light;l.A.setSystemColorScheme(t)},attachStylesToRoot(e){const t=document.body;Object.entries(e).filter(([,e])=>Boolean(e)).forEach(([e,n])=>{t.style.setProperty(e,n)})},detachStylesFromRoot(e){const t=document.body;Object.entries(e).forEach(([e])=>{t.style.removeProperty(e)})},syncPreferredColorScheme(){l.A.syncPreferredColorScheme()}}},re=ae,oe=(0,f.A)(re,o,s,!1,null,"1fc6db09",null),se=oe.exports;n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698);class le{constructor(){this.$send=()=>{}}send(e){this.$send(e)}}class ce{constructor(){const{webkit:{messageHandlers:{bridge:e={}}={}}={}}=window;this.bridge=e;const{postMessage:t=()=>{}}=e;this.$send=t.bind(e)}send(e){this.$send(e)}}class ue{constructor(e=new le){this.backend=e,this.listeners={}}send(e){this.backend.send(e)}receive(e){this.emit(e.type,e.data)}emit(e,t){this.listeners[e]&&this.listeners[e].forEach(e=>e(t))}on(e,t){this.listeners[e]||(this.listeners[e]=new Set),this.listeners[e].add(t)}off(e,t){this.listeners[e]&&this.listeners[e].delete(t)}}var de={install(e,t){let n;n=t.performanceMetricsEnabled||"ide"===t.appTarget?new ce:new le,e.prototype.$bridge=new ue(n)}};function me(e){return`custom-${e}`}function pe(e){return class extends HTMLElement{constructor(){super();const t=this.attachShadow({mode:"open"}),n=e.content.cloneNode(!0);t.appendChild(n)}}}function ge(e){const t=me(e),n=document.getElementById(t);n&&window.customElements.define(t,pe(n))}function he(e,t={names:["header","footer"]}){const{names:n}=t;e.config.ignoredElements=/^custom-/,n.forEach(ge)}function fe(e,t){const{value:n=!1}=t;e.style.display=n?"none":""}var be={hide:fe};function ve(e,{performanceMetrics:t=!1}={}){e.config.productionTip=!1,e.use(he),e.directive("hide",be.hide),e.use(de,{appTarget:{NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}.VUE_APP_TARGET,performanceMetricsEnabled:t}),window.bridge=e.prototype.$bridge,e.config.performance=t}n(3110),n(8335);var we=n(4628),ye=n(2361),Ae=n(3029),Se=n(6043),ke=n(1074);const Ee=10;function Ce(e){const{name:t}=e,n=t.includes(we.Zf);return n?Ee:0}function Pe(){const{location:e}=window;return e.pathname+e.search+e.hash}function Te(){const e=Math.max(document.documentElement.clientWidth||0,window.innerWidth||0);return e{(0,M.cu)(e.params.locale,t)})},beforeRouteUpdate(e){(0,M.cu)(e.params.locale,this)}},Me=Oe,Fe=(0,f.A)(Me,Ie,je,!1,null,null,null),Be=Fe.exports,$e=function(){var e=this,t=e._self._c;return t("GenericError",{attrs:{message:e.$t("error.not-found")}},[e._t("default")],2)},Ue=[],We={name:"NotFound",components:{GenericError:Ve},created(){l.A.setAllLocalesAreAvailable()},beforeRouteEnter(e,t,n){n(t=>{(0,M.cu)(e.params.locale,t)})},beforeRouteUpdate(e){(0,M.cu)(e.params.locale,this)}},Ge=We,He=(0,f.A)(Ge,$e,Ue,!1,null,null,null),Ke=He.exports;const Je=[{path:"*",name:we.Yl,component:Ke},{path:"*",name:we._7,component:Be}],Ze=[{path:"/tutorials/:id",name:"tutorials-overview",component:()=>Promise.all([n.e(671),n.e(36)]).then(n.bind(n,3111))},{path:"/tutorials/:id/*",name:"topic",component:()=>Promise.all([n.e(671),n.e(416),n.e(52)]).then(n.bind(n,8730))},{path:"/documentation*",name:we.Zf,component:()=>Promise.all([n.e(671),n.e(981),n.e(416),n.e(633)]).then(n.bind(n,6302))}];var Qe=[...Ze,...Je],Ye=(n(1701),n(8237),n(288));const Xe=[{pathPrefix:"/:locale?",nameSuffix:"-locale"}];function et(e,t=[],n=Xe){return n.reduce((n,i)=>n.concat(e.filter(e=>!t.includes(e.name)).map(e=>({...e,path:(0,Ye.CN)([i.pathPrefix,e.path]),name:e.name+i.nameSuffix}))),[])}const tt=[...et(Qe),...Je];function nt(e={}){const t=new r.Ay({mode:"history",base:_.pc,scrollBehavior:Le,...e,routes:e.routes||tt});return t.onReady(()=>{"scrollRestoration"in window.history&&(window.history.scrollRestoration="manual"),xe()}),"ide"!=={NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}.VUE_APP_TARGET&&t.onError(e=>{const{route:n={path:"/"}}=e;t.replace({name:"server-error",params:[n.path]})}),window.addEventListener("unload",_e),t}var it=n(6266);function at(e=it){const{defaultLocale:t,messages:n,dateTimeFormats:i={}}=e,r=new a.A({dateTimeFormats:i,locale:t,fallbackLocale:t,messages:n});return r}i["default"].use(ve),i["default"].use(r.Ay),i["default"].use(a.A),document.documentElement.classList.remove("no-js"),new i["default"]({router:nt(),render:e=>e(se),i18n:at()}).$mount("#app")},2361:function(e,t,n){"use strict";n.d(t,{BZ:function(){return s},FC:function(){return i},fQ:function(){return r},fc:function(){return a}});const i={xlarge:"xlarge",large:"large",medium:"medium",small:"small"},a={default:"default",nav:"nav"},r={[a.default]:{[i.xlarge]:{minWidth:1920,contentWidth:1536},[i.large]:{minWidth:1251,contentWidth:980},[i.medium]:{minWidth:736,maxWidth:1068,contentWidth:692},[i.small]:{minWidth:320,maxWidth:735,contentWidth:280}},[a.nav]:{[i.large]:{minWidth:1024},[i.medium]:{minWidth:768,maxWidth:1023},[i.small]:{minWidth:320,maxWidth:767}}},o={[i.small]:0,[i.medium]:1,[i.large]:2};function s(e,t){return o[e]>o[t]}},2655:function(e,t,n){"use strict";function i(e,t,n){let i,a=e,r=t;for("string"===typeof r&&(r=[r]),i=0;ie.json()).catch(()=>({}))}const l=(e,t)=>i(r,e,t)},3029:function(e,t,n){"use strict";function i(e){let t=null,n=e-1;const i=new Promise(e=>{t=e});return requestAnimationFrame(function e(){n-=1,n<=0?t():requestAnimationFrame(e)}),i}function a(e){return new Promise(t=>{setTimeout(t,e)})}n.d(t,{f:function(){return a},u:function(){return i}})},3633:function(e){"use strict";e.exports=JSON.parse('[{"code":"ar","name":"Arabic","slug":"ar"},{"code":"en-US","name":"English","slug":"en-US","default":true},{"code":"zh-CN","name":"简体中文","slug":"zh-CN"},{"code":"ja-JP","name":"日本語","slug":"ja-JP"},{"code":"ko-KR","name":"한국어","slug":"ko-KR"},{"code":"es-419","name":"Español","slug":"es"},{"code":"de-DE","name":"Deutsch","slug":"de-DE"},{"code":"fr-FR","name":"Français","slug":"fr-FR"},{"code":"it-IT","name":"Italiano","slug":"it-IT"},{"code":"pt-BR","name":"Português (Brasil)","slug":"pt-BR"}]')},3958:function(e,t,n){n.p=window.baseUrl},4628:function(e,t,n){"use strict";n.d(t,{Yl:function(){return i},Zf:function(){return r},_7:function(){return a}});const i="not-found",a="server-error",r="documentation-topic"},6e3:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var i=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"inline-chevron-right-icon",attrs:{viewBox:"0 0 14 14",themeId:"inline-chevron-right"}},[t("path",{attrs:{d:"M2.964 1.366l0.649-0.76 7.426 6.343-7.423 6.445-0.655-0.755 6.545-5.683-6.542-5.59z"}})])},a=[],r=n(6515),o={name:"InlineChevronRightIcon",components:{SVGIcon:r.A}},s=o,l=n(1656),c=(0,l.A)(s,i,a,!1,null,"7413f2a0",null),u=c.exports},6043:function(e,t,n){"use strict";n.d(t,{$_:function(){return l},LE:function(){return u},Nt:function(){return c},PT:function(){return d},ZD:function(){return s},lE:function(){return m},ql:function(){return o}});n(4114),n(2205);const i=/(?:\s+|[`"<>])/g,a=/^-+/,r=/["'&<>]/g;function o(e){return e.trim().replace(i,"-").replace(a,"").toLowerCase()}function s(e){const t=e=>({'"':""","'":"'","&":"&","<":"<",">":">"}[e]||e);return e.replace(r,t)}function l(e){return e.replace(/#(.*)/,(e,t)=>`#${CSS.escape(t)}`)}function c(e){return e.replace(/[.*+\-?^${}()|[\]\\]/g,"\\$&")}function u(e){let t,n;const i="\\s*",a=" ",r=e.trim(),o=r.length;if(!o)return a;const s=[];for(t=0;te.default).slug,h={ar:i,"en-US":a,"zh-CN":r,"ja-JP":o,"ko-KR":s,"es-419":l,"de-DE":c,"fr-FR":u,"it-IT":d,"pt-BR":m}},6515:function(e,t,n){"use strict";n.d(t,{A:function(){return d}});var i=function(){var e=this,t=e._self._c;return t("svg",{staticClass:"svg-icon",attrs:{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"}},[e.themeOverrideURL?t("use",{attrs:{href:e.normalizePath(`${e.themeOverrideURL}#${e.themeId}`),width:"100%",height:"100%"}}):e._t("default")],2)},a=[],r=n(2655),o=n(288),s={name:"SVGIcon",props:{themeId:{type:String,required:!1},iconUrl:{type:String,default:null}},methods:{normalizePath:o.Fd},computed:{themeOverrideURL:({iconUrl:e,themeId:t})=>e||(0,r.PL)(["theme","icons",t],void 0)}},l=s,c=n(1656),u=(0,c.A)(l,i,a,!1,null,"06e5463e",null),d=u.exports},8213:function(e,t,n){"use strict";n.d(t,{$i:function(){return l},Cj:function(){return c},UM:function(){return s},cu:function(){return u}});n(8111),n(8237);var i=n(3633),a=n(6266),r=n(8552);const o=i.reduce((e,t)=>({...e,[t.slug]:t.code}),{});function s(e){return o[e]}function l(e){return!!o[e]}function c(e){return{params:{locale:e===a.defaultLocale?void 0:e}}}function u(e=a.defaultLocale,t={}){if(!l(e))return;t.$i18n.locale=e;const n=s(e);(0,r.I)(n)}},8360:function(e,t,n){"use strict";n(8111),n(8237);var i=n(1176);const a={preferredColorScheme:"developer.setting.preferredColorScheme",preferredLocale:"developer.setting.preferredLocale",preferredLanguage:"docs.setting.preferredLanguage"},r={preferredColorScheme:"docs.setting.preferredColorScheme"};t.A=Object.defineProperties({},Object.keys(a).reduce((e,t)=>({...e,[t]:{get:()=>{const e=r[t],n=i.Ud.getItem(a[t]);return e?n||i.Ud.getItem(e):n},set:e=>i.Ud.setItem(a[t],e)}}),{}))},8457:function(e,t,n){"use strict";n.d(t,{A:function(){return u}});var i=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"close-icon",attrs:{viewBox:"0 0 14 14",themeId:"close"}},[t("path",{attrs:{d:"M12.73,0l1.27,1.27-5.74,5.73,5.72,5.72-1.27,1.27-5.72-5.72L1.28,13.99,.01,12.72,5.72,7.01,0,1.28,1.27,.01,6.99,5.73,12.73,0Z"}})])},a=[],r=n(6515),o={name:"CloseIcon",components:{SVGIcon:r.A}},s=o,l=n(1656),c=(0,l.A)(s,i,a,!1,null,null,null),u=c.exports},8552:function(e,t,n){"use strict";n.d(t,{$:function(){return u},I:function(){return g}});n(8111),n(7588),n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698);var i=n(2655),a=n(1074);const r=(0,i.PL)(["meta","title"],"Documentation"),o=({title:e,description:t,url:n,currentLocale:i})=>[{name:"description",content:t},{property:"og:locale",content:i},{property:"og:site_name",content:r},{property:"og:type",content:"website"},{property:"og:title",content:e},{property:"og:description",content:t},{property:"og:url",content:n},{property:"og:image",content:(0,a.FT)("/developer-og.jpg")},{name:"twitter:image",content:(0,a.FT)("/developer-og-twitter.jpg")},{name:"twitter:card",content:"summary_large_image"},{name:"twitter:description",content:t},{name:"twitter:title",content:e},{name:"twitter:url",content:n}],s=e=>[e,r].filter(Boolean).join(" | "),l=e=>{const{content:t}=e,n=e.property?"property":"name",i=e[n],a=document.querySelector(`meta[${n}="${i}"]`);if(a&&t)a.setAttribute("content",t);else if(a&&!t)a.remove();else if(t){const t=document.createElement("meta");t.setAttribute(n,e[n]),t.setAttribute("content",e.content),document.getElementsByTagName("head")[0].appendChild(t)}},c=e=>{document.title=e};function u({title:e,description:t,url:n,currentLocale:i}){const a=s(e);c(a),o({title:a,description:t,url:n,currentLocale:i}).forEach(e=>l(e))}const d=new Set(["ar","he","ur"]),m={ltr:"ltf",rtl:"rtl"};function p(e){const t=new Intl.Locale(e);return"function"===typeof t.getTextInfo?t.getTextInfo()?.direction??m.ltr:d.has(e)?m.rtl:m.ltr}function g(e){const t=document.querySelector("html");t.setAttribute("lang",e),t.setAttribute("dir",p(e))}},8964:function(e,t,n){"use strict";n(8111),n(1701);var i=n(1537),a=n(6195),r=n(8360),o=n(3633);const s="undefined"!==typeof window.matchMedia&&[i.A.light,i.A.dark,"no-preference"].some(e=>window.matchMedia(`(prefers-color-scheme: ${e})`).matches),l=s?i.A.auto:i.A.light;t.A={state:{imageLoadingStrategy:"ide"==={NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}.VUE_APP_TARGET?a.A.eager:a.A.lazy,preferredColorScheme:r.A.preferredColorScheme||l,preferredLocale:r.A.preferredLocale,supportsAutoColorScheme:s,systemColorScheme:i.A.light,availableLocales:[]},reset(){this.state.imageLoadingStrategy="ide"==={NODE_ENV:"production",VUE_APP_TITLE:"Documentation",BASE_URL:"{{BASE_PATH}}/"}.VUE_APP_TARGET?a.A.eager:a.A.lazy,this.state.preferredColorScheme=r.A.preferredColorScheme||l,this.state.supportsAutoColorScheme=s,this.state.systemColorScheme=i.A.light},setImageLoadingStrategy(e){this.state.imageLoadingStrategy=e},setPreferredColorScheme(e){this.state.preferredColorScheme=e,r.A.preferredColorScheme=e},setAllLocalesAreAvailable(){const e=o.map(e=>e.code);this.state.availableLocales=e},setAvailableLocales(e=[]){this.state.availableLocales=e},setPreferredLocale(e){this.state.preferredLocale=e,r.A.preferredLocale=this.state.preferredLocale},setSystemColorScheme(e){this.state.systemColorScheme=e},syncPreferredColorScheme(){r.A.preferredColorScheme&&r.A.preferredColorScheme!==this.state.preferredColorScheme&&(this.state.preferredColorScheme=r.A.preferredColorScheme)}}},9404:function(e,t,n){"use strict";n.d(t,{FK:function(){return s},G3:function(){return r},Mq:function(){return a},iV:function(){return o},kg:function(){return i}});const i=52,a=48,r="nav-sticky-anchor",o="nav-open-navigator",s={noClose:"noclose"}}},t={};function n(i){var a=t[i];if(void 0!==a)return a.exports;var r=t[i]={exports:{}};return e[i].call(r.exports,r,r.exports,n),r.exports}n.m=e,function(){var e=[];n.O=function(t,i,a,r){if(!i){var o=1/0;for(u=0;u=r)&&Object.keys(n.O).every(function(e){return n.O[e](i[l])})?i.splice(l--,1):(s=!1,r0&&e[u-1][2]>r;u--)e[u]=e[u-1];e[u]=[i,a,r]}}(),function(){n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,{a:t}),t}}(),function(){var e,t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__};n.t=function(i,a){if(1&a&&(i=this(i)),8&a)return i;if("object"===typeof i&&i){if(4&a&&i.__esModule)return i;if(16&a&&"function"===typeof i.then)return i}var r=Object.create(null);n.r(r);var o={};e=e||[null,t({}),t([]),t(t)];for(var s=2&a&&i;("object"==typeof s||"function"==typeof s)&&!~e.indexOf(s);s=t(s))Object.getOwnPropertyNames(s).forEach(function(e){o[e]=function(){return i[e]}});return o["default"]=function(){return i},n.d(r,o),r}}(),function(){n.d=function(e,t){for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})}}(),function(){n.f={},n.e=function(e){return Promise.all(Object.keys(n.f).reduce(function(t,i){return n.f[i](e,t),t},[]))}}(),function(){n.u=function(e){return"js/"+({35:"highlight-js-swift-js",36:"tutorials-overview",52:"topic",157:"highlight-js-custom-markdown",172:"highlight-js-objectivec-js",175:"highlight-js-css-js",185:"highlight-js-perl-js",255:"highlight-js-custom-swift",274:"highlight-js-bash-js",297:"highlight-js-cpp-js",299:"highlight-js-typescript-js",374:"highlight-js-json-js",444:"highlight-js-java-js",476:"highlight-js-ruby-js",507:"highlight-js-custom-pkl",531:"highlight-js-javascript-js",532:"highlight-js-http-js",633:"documentation-topic",638:"highlight-js-shell-js",639:"highlight-js-yaml-js",672:"highlight-js-scss-js",703:"highlight-js-diff-js",758:"highlight-js-python-js",777:"highlight-js-xml-js",833:"highlight-js-c-js",892:"highlight-js-php-js",945:"highlight-js-markdown-js",989:"highlight-js-llvm-js"}[e]||e)+"."+{35:"9bc017b7",36:"d84819f0",52:"339f2658",127:"978d0861",157:"5b745889",172:"d1cd434f",175:"6a1f0b6c",185:"52ae345c",255:"9b9584b0",274:"f42a1d3a",297:"c4d63969",299:"9b270b56",374:"6f4facb9",416:"eb5e5474",444:"d0776d11",476:"013bb247",507:"9fcf661e",531:"46389717",532:"af24475e",633:"f9ed709f",638:"e71539fa",639:"9c616705",671:"3ef2a03c",672:"6dc40f91",703:"caa6d9aa",758:"c050f618",777:"9d3ac47d",833:"6059ad3a",892:"4c0a7090",945:"37b335d9",981:"21016981",989:"3d5e9220"}[e]+".js"}}(),function(){n.miniCssF=function(e){return"css/"+({36:"tutorials-overview",52:"topic",633:"documentation-topic"}[e]||e)+"."+{36:"bab9a2e5",52:"c7af1fb5",482:"01b3b97a",633:"2b6fdee5",671:"47827da6"}[e]+".css"}}(),function(){n.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"===typeof window)return window}}()}(),function(){n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}}(),function(){var e={},t="swift-docc-render:";n.l=function(i,a,r,o){if(e[i])e[i].push(a);else{var s,l;if(void 0!==r)for(var c=document.getElementsByTagName("script"),u=0;ue.anchor===t.anchor?{...t,visibility:e.visibility}:t)},updateBreakpoint(e){this.state.breakpoint=e},setReferences(e){this.state.references=e}},p=function(){var e=this,t=e._self._c;return t("div",{staticClass:"article"},[e.isTargetIDE?e._e():t("NavigationBar",{attrs:{chapters:e.hierarchy.modules,technology:e.metadata.category,topic:e.heroTitle||"",rootReference:e.hierarchy.reference,identifierUrl:e.identifierUrl}}),t("main",{attrs:{id:"app-main",tabindex:"0"}},[e._t("above-hero"),e._l(e.sections,function(n,s){return t(e.componentFor(n),e._b({key:s,tag:"component"},"component",e.propsFor(n),!1))})],2),t("PortalTarget",{attrs:{name:"modal-destination",multiple:""}})],1)},h=[],m=(n(1148),n(116),n(2197)),v=n(8964),f=function(){var e=this,t=e._self._c;return t("NavBase",{attrs:{id:"nav","aria-label":e.technology,hasSolidBackground:""},scopedSlots:e._u([{key:"default",fn:function(){return[t("ReferenceUrlProvider",{attrs:{reference:e.rootReference},scopedSlots:e._u([{key:"default",fn:function({urlWithParams:n}){return[t("NavTitleContainer",{attrs:{to:n},scopedSlots:e._u([{key:"default",fn:function(){return[e._v(e._s(e.technology))]},proxy:!0},{key:"subhead",fn:function(){return[e._v(e._s(e.$tc("tutorials.title",2)))]},proxy:!0}],null,!0)})]}}])})]},proxy:!0},{key:"after-title",fn:function(){return[t("div",{staticClass:"separator"})]},proxy:!0},{key:"tray",fn:function(){return[t("div",{staticClass:"mobile-dropdown-container"},[t("MobileDropdown",{attrs:{options:e.chapters,sections:e.optionsForSections,currentOption:e.currentSection?e.currentSection.title:""},on:{"select-section":e.onSelectSection}})],1),t("div",{staticClass:"dropdown-container"},[t("PrimaryDropdown",{staticClass:"primary-dropdown",attrs:{options:e.chapters,currentOption:e.topic}}),t("ChevronIcon",{staticClass:"icon-inline"}),e.currentSection?t("SecondaryDropdown",{staticClass:"secondary-dropdown",attrs:{options:e.optionsForSections,currentOption:e.currentSection.title,sectionTracker:e.sectionIndicatorText},on:{"select-section":e.onSelectSection}}):e._e()],1),e._t("tray",null,{siblings:e.chapters.length+e.optionsForSections.length})]},proxy:!0}],null,!0)})},g=[],y=(n(8237),function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"chevron-icon",attrs:{viewBox:"0 0 14 14",themeId:"chevron"}},[t("path",{attrs:{d:"M3.22 1.184l0.325-0.38 7.235 6.201-7.235 6.19-0.325-0.38 6.792-5.811-6.792-5.82z"}})])}),C=[],b=n(6515),_={name:"ChevronIcon",components:{SVGIcon:b.A}},w=_,A=n(1656),k=(0,A.A)(w,y,C,!1,null,null,null),S=k.exports,x=n(1074),T=n(4783),I={name:"ReferenceUrlProvider",mixins:[T.A],props:{reference:{type:String,required:!0}},computed:{resolvedReference:({references:e,reference:t})=>e[t]||{},url:({resolvedReference:e})=>e.url,title:({resolvedReference:e})=>e.title},render(){return this.$scopedSlots.default({url:this.url,urlWithParams:(0,x.c$)(this.url,this.$route.query),title:this.title,reference:this.resolvedReference})}},$=I,N=(0,A.A)($,c,u,!1,null,null,null),q=N.exports,P=n(9514),D=n(9065),R=n(734),L=function(){var e=this,t=e._self._c;return t("NavMenuItems",{staticClass:"mobile-dropdown"},e._l(e.options,function(n){return t("ReferenceUrlProvider",{key:n.reference,attrs:{reference:n.reference},scopedSlots:e._u([{key:"default",fn:function({title:s}){return[t("NavMenuItemBase",{staticClass:"chapter-list",attrs:{role:"group"}},[t("p",{staticClass:"chapter-name"},[e._v(e._s(s))]),t("ul",{staticClass:"tutorial-list"},e._l(n.projects,function(n){return t("ReferenceUrlProvider",{key:n.reference,attrs:{reference:n.reference},scopedSlots:e._u([{key:"default",fn:function({url:n,urlWithParams:s,title:i}){return[t("li",{staticClass:"tutorial-list-item"},[t("router-link",{staticClass:"option tutorial",attrs:{to:s,value:i}},[e._v(" "+e._s(i)+" ")]),n===e.$route.path?t("ul",{staticClass:"section-list",attrs:{role:"listbox"}},e._l(e.sections,function(n){return t("li",{key:n.title},[t("router-link",{class:e.classesFor(n),attrs:{to:{path:n.path,query:e.$route.query},value:n.title},nativeOn:{click:function(t){return e.onClick(n)}}},[e._v(" "+e._s(n.title)+" ")])],1)}),0):e._e()],1)]}}],null,!0)})}),1)])]}}],null,!0)})}),1)},O=[],B=n(5273),M=n(4654),F={name:"MobileDropdown",components:{NavMenuItems:M.A,NavMenuItemBase:B.A,ReferenceUrlProvider:q},props:{options:{type:Array,required:!0},currentOption:{type:String,required:!0},sections:{type:Array,required:!1,default:()=>[]}},methods:{classesFor(e){return["option","section",{active:this.currentOption===e.title},this.depthClass(e)]},depthClass(e){const{depth:t=0}=e;return`depth${t}`},onClick(e){this.$emit("select-section",e.path)}}},V=F,j=(0,A.A)(V,L,O,!1,null,"2c27d339",null),E=j.exports,U=function(){var e=this,t=e._self._c;return t("DropdownCustom",{staticClass:"tutorial-dropdown",attrs:{value:e.currentOption,"aria-label":e.$t("tutorials.nav.current",{thing:e.$t("sections.title")}),isSmall:""},scopedSlots:e._u([{key:"toggle-post-content",fn:function(){return[t("span",{staticClass:"section-tracker"},[e._v(e._s(e.sectionTracker))])]},proxy:!0},{key:"default",fn:function({closeAndFocusToggler:n,contentClasses:s,navigateOverOptions:i,OptionClass:r,ActiveOptionClass:o}){return[t("ul",{staticClass:"options",class:s,attrs:{role:"listbox",tabindex:"0"}},e._l(e.options,function(s){return t("router-link",{key:s.title,attrs:{to:{path:s.path,query:e.$route.query},custom:""},scopedSlots:e._u([{key:"default",fn:function({navigate:a}){return[t("li",{class:[r,{[o]:e.currentOption===s.title}],attrs:{value:s.title,"aria-selected":e.currentOption===s.title,"aria-current":e.ariaCurrent(s.title),tabindex:-1},on:{click:function(t){return e.setActive(s,a,n,t)},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.setActive(s,a,n,t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:n.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")?null:n.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),i(t,1))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),i(t,-1))}]}},[e._v(" "+e._s(s.title)+" ")])]}}],null,!0)})}),1)]}}])})},H=[],z=function(){var e=this,t=e._self._c;return t("BaseDropdown",{staticClass:"dropdown-custom",class:{[e.OpenedClass]:e.isOpen,"dropdown-small":e.isSmall},attrs:{value:e.value},scopedSlots:e._u([{key:"dropdown",fn:function({dropdownClasses:n}){return[t("span",{staticClass:"visuallyhidden",attrs:{id:`DropdownLabel_${e._uid}`}},[e._v(e._s(e.ariaLabel))]),t("button",{ref:"dropdownToggle",staticClass:"form-dropdown-toggle",class:n,attrs:{id:`DropdownToggle_${e._uid}`,"aria-labelledby":`DropdownLabel_${e._uid} DropdownToggle_${e._uid}`,"aria-expanded":e.isOpen?"true":"false","aria-haspopup":"true"},on:{click:e.toggleDropdown,keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:(t.preventDefault(),e.openDropdown.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:e.closeAndFocusToggler.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),e.openDropdown.apply(null,arguments))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),e.openDropdown.apply(null,arguments))}]}},[t("span",{staticClass:"form-dropdown-title"},[e._v(e._s(e.value))]),e._t("toggle-post-content")],2)]}},{key:"eyebrow",fn:function(){return[e._t("eyebrow")]},proxy:!0},{key:"after",fn:function(){return[e._t("default",null,null,{value:e.value,isOpen:e.isOpen,contentClasses:["form-dropdown-content",{"is-open":e.isOpen}],closeDropdown:e.closeDropdown,onChangeAction:e.onChangeAction,closeAndFocusToggler:e.closeAndFocusToggler,navigateOverOptions:e.navigateOverOptions,OptionClass:e.OptionClass,ActiveOptionClass:e.ActiveOptionClass})]},proxy:!0}],null,!0)})},G=[],W=function(){var e=this,t=e._self._c;return t("div",{staticClass:"form-element"},[e._t("dropdown",function(){return[t("select",e._b({directives:[{name:"model",rawName:"v-model",value:e.modelValue,expression:"modelValue"}],class:e.dropdownClasses,on:{change:function(t){var n=Array.prototype.filter.call(t.target.options,function(e){return e.selected}).map(function(e){var t="_value"in e?e._value:e.value;return t});e.modelValue=t.target.multiple?n:n[0]}}},"select",e.$attrs,!1),[e._t("default")],2)]},{dropdownClasses:e.dropdownClasses,value:e.value}),t("InlineChevronDownIcon",{staticClass:"form-icon",attrs:{"aria-hidden":"true"}}),e.$slots.eyebrow?t("span",{staticClass:"form-label",attrs:{"aria-hidden":"true"}},[e._t("eyebrow")],2):e._e(),e._t("after")],2)},Q=[],K=n(620),X={name:"BaseDropdown",inheritAttrs:!1,props:{value:{type:String,default:""}},components:{InlineChevronDownIcon:K.A},computed:{modelValue:{get:({value:e})=>e,set(e){this.$emit("input",e)}},dropdownClasses({value:e}){return["form-dropdown",{"form-dropdown-selectnone":""===e,"no-eyebrow":!this.$slots.eyebrow}]}}},J=X,Y=(0,A.A)(J,W,Q,!1,null,"f934959a",null),Z=Y.exports;const ee="is-open",te="option",ne="option-active";var se={name:"DropdownCustom",components:{BaseDropdown:Z},constants:{OpenedClass:ee,OptionClass:te,ActiveOptionClass:ne},props:{value:{type:String,default:""},ariaLabel:{type:String,default:""},isSmall:{type:Boolean,default:!1}},data(){return{isOpen:!1,OpenedClass:ee,OptionClass:te,ActiveOptionClass:ne}},mounted(){document.addEventListener("click",this.closeOnLoseFocus)},beforeDestroy(){document.removeEventListener("click",this.closeOnLoseFocus)},methods:{onChangeAction(e){this.$emit("input",e)},toggleDropdown(){this.isOpen?this.closeDropdown():this.openDropdown()},async closeAndFocusToggler(){this.closeDropdown(),await this.$nextTick(),this.$refs.dropdownToggle.focus({preventScroll:!0})},closeDropdown(){this.isOpen=!1,this.$emit("close")},openDropdown(){this.isOpen=!0,this.$emit("open"),this.focusActiveLink()},closeOnLoseFocus(e){!this.$el.contains(e.target)&&this.isOpen&&this.closeDropdown()},navigateOverOptions({target:e},t){const n=this.$el.querySelectorAll(`.${te}`),s=Array.from(n),i=s.indexOf(e),r=s[i+t];r&&r.focus({preventScroll:!0})},async focusActiveLink(){const e=this.$el.querySelector(`.${ne}`);e&&(await this.$nextTick(),e.focus({preventScroll:!0}))}}},ie=se,re=(0,A.A)(ie,z,G,!1,null,"6adda760",null),oe=re.exports,ae={name:"SecondaryDropdown",components:{DropdownCustom:oe},props:{options:{type:Array,required:!0},currentOption:{type:String,required:!0},sectionTracker:{type:String,required:!1}},methods:{ariaCurrent(e){return this.currentOption===e&&"section"},setActive(e,t,n,s){t(s),this.$emit("select-section",e.path),n()}}},le=ae,ce=(0,A.A)(le,U,H,!1,null,"618ff780",null),ue=ce.exports,de=function(){var e=this,t=e._self._c;return t("DropdownCustom",{staticClass:"tutorial-dropdown",attrs:{value:e.currentOption,"aria-label":e.$t("tutorials.nav.current",{thing:e.$tc("tutorials.title",1)}),isSmall:""},scopedSlots:e._u([{key:"default",fn:function({closeAndFocusToggler:n,contentClasses:s,closeDropdown:i,navigateOverOptions:r,OptionClass:o,ActiveOptionClass:a}){return[t("ul",{staticClass:"options",class:s,attrs:{tabindex:"0"}},e._l(e.options,function(s){return t("ReferenceUrlProvider",{key:s.reference,attrs:{reference:s.reference},scopedSlots:e._u([{key:"default",fn:function({title:l}){return[t("li",{staticClass:"chapter-list",attrs:{role:"group"}},[t("p",{staticClass:"chapter-name"},[e._v(e._s(l))]),t("ul",{attrs:{role:"listbox"}},e._l(s.projects,function(s){return t("ReferenceUrlProvider",{key:s.reference,attrs:{reference:s.reference},scopedSlots:e._u([{key:"default",fn:function({urlWithParams:s,title:l}){return[t("router-link",{attrs:{to:s,custom:""},scopedSlots:e._u([{key:"default",fn:function({navigate:s,isActive:c}){return[t("li",{class:{[o]:!0,[a]:c},attrs:{value:l,"aria-selected":c,"aria-current":!!c&&"tutorial",tabindex:-1},on:{click:function(t){return e.setActive(s,i,t)},keydown:[function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.setActive(s,i,t)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"esc",27,t.key,["Esc","Escape"])?null:n.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"tab",9,t.key,"Tab")?null:n.apply(null,arguments)},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"down",40,t.key,["Down","ArrowDown"])?null:(t.preventDefault(),r(t,1))},function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"up",38,t.key,["Up","ArrowUp"])?null:(t.preventDefault(),r(t,-1))}]}},[e._v(" "+e._s(l)+" ")])]}}],null,!0)})]}}],null,!0)})}),1)])]}}],null,!0)})}),1)]}}])})},pe=[],he={name:"PrimaryDropdown",components:{DropdownCustom:oe,ReferenceUrlProvider:q},props:{options:{type:Array,required:!0},currentOption:{type:String,required:!0}},methods:{setActive(e,t,n){e(n),t()}}},me=he,ve=(0,A.A)(me,de,pe,!1,null,"03cbd7f7",null),fe=ve.exports;const ge={title:"Introduction",url:"#introduction",reference:"introduction",sectionNumber:0,depth:0};var ye={name:"NavigationBar",components:{NavTitleContainer:R.A,NavBase:D.A,ReferenceUrlProvider:q,PrimaryDropdown:fe,SecondaryDropdown:ue,MobileDropdown:E,ChevronIcon:S},mixins:[P.A,T.A],props:{chapters:{type:Array,required:!0},technology:{type:String,required:!0},topic:{type:String,required:!0},rootReference:{type:String,required:!0},identifierUrl:{type:String,required:!0}},data(){return{currentSection:ge,tutorialState:this.store.state}},watch:{pageSectionWithHighestVisibility(e){e&&(this.currentSection=e)}},computed:{currentProject(){return this.chapters.reduce((e,{projects:t})=>e.concat(t),[]).find(e=>e.reference===this.identifierUrl)},pageSections(){if(!this.currentProject)return[];const e=[ge].concat(this.currentProject.sections);return this.tutorialState.linkableSections.map((t,n)=>{const s=e[n],i=this.references[s.reference],{url:r,title:o}=i||s;return{...t,title:o,path:r}})},optionsForSections(){return this.pageSections.map(({depth:e,path:t,title:n})=>({depth:e,path:t,title:n}))},pageSectionWithHighestVisibility(){return[...this.pageSections].sort((e,t)=>t.visibility-e.visibility).find(e=>e.visibility>0)},sectionIndicatorText(){const e=this.tutorialState.linkableSections.length-1,{sectionNumber:t}=this.currentSection||{};if(0!==t)return this.$t("tutorials.section-of",{number:t,total:e})}},methods:{onSelectSection(e){const t=e.split("#")[1];this.handleFocusAndScroll(t)}}},Ce=ye,be=(0,A.A)(Ce,f,g,!1,null,"367fa5fc",null),_e=be.exports,we=n(1897),Ae=function(){var e=this,t=e._self._c;return t("div",{staticClass:"body"},[t("BodyContent",{attrs:{content:e.content}})],1)},ke=[],Se=function(){var e=this,t=e._self._c;return t("article",{staticClass:"body-content"},e._l(e.content,function(n,s){return t(e.componentFor(n),e._b({key:s,tag:"component",staticClass:"layout"},"component",e.propsFor(n),!1))}),1)},xe=[],Te=function(){var e=this,t=e._self._c;return t("div",{staticClass:"columns",class:e.classes},[e._l(e.columns,function(n,s){return[t("Asset",{key:n.media,attrs:{identifier:n.media,videoAutoplays:!1}}),n.content?t("ContentNode",{key:s,attrs:{content:n.content}}):e._e()]})],2)},Ie=[],$e=n(8486),Ne=function(){var e=this,t=e._self._c;return t("BaseContentNode",{attrs:{content:e.articleContent}})},qe=[],Pe=n(9),De={name:"ContentNode",components:{BaseContentNode:Pe["default"]},props:Pe["default"].props,computed:{articleContent(){return this.map(e=>{switch(e.type){case Pe["default"].BlockType.codeListing:return{...e,showLineNumbers:!0};case Pe["default"].BlockType.heading:{const{anchor:t,...n}=e;return n}default:return e}})}},methods:Pe["default"].methods,BlockType:Pe["default"].BlockType,InlineType:Pe["default"].InlineType},Re=De,Le=(0,A.A)(Re,Ne,qe,!1,null,"0861b5be",null),Oe=Le.exports,Be={name:"Columns",components:{Asset:$e.A,ContentNode:Oe},props:{columns:{type:Array,required:!0}},computed:{classes(){return{"cols-2":2===this.columns.length,"cols-3":3===this.columns.length}}}},Me=Be,Fe=(0,A.A)(Me,Te,Ie,!1,null,"30edf911",null),Ve=Fe.exports,je=function(){var e=this,t=e._self._c;return t("div",{staticClass:"content-and-media",class:e.classes},[t("ContentNode",{attrs:{content:e.content}}),t("Asset",{attrs:{identifier:e.media}})],1)},Ee=[];const Ue={leading:"leading",trailing:"trailing"};var He={name:"ContentAndMedia",components:{Asset:$e.A,ContentNode:Oe},props:{content:Oe.props.content,media:$e.A.props.identifier,mediaPosition:{type:String,default:()=>Ue.trailing,validator:e=>Object.prototype.hasOwnProperty.call(Ue,e)}},computed:{classes(){return{"media-leading":this.mediaPosition===Ue.leading,"media-trailing":this.mediaPosition===Ue.trailing}}},MediaPosition:Ue},ze=He,Ge=(0,A.A)(ze,je,Ee,!1,null,"3fa44f9e",null),We=Ge.exports,Qe=function(){var e=this,t=e._self._c;return t("div",{staticClass:"full-width"},e._l(e.groups,function(n,s){return t(e.componentFor(n),e._b({key:s,tag:"component",staticClass:"group"},"component",e.propsFor(n),!1),[t("ContentNode",{attrs:{content:n.content}})],1)}),1)},Ke=[],Xe=function(){var e=this,t=e._self._c;return t(e.tag,{tag:"component",attrs:{id:e.anchor}},[e._t("default")],2)},Je=[],Ye=n(8284),Ze={name:"LinkableElement",mixins:[Ye.A],inject:{navigationBarHeight:{default(){}},store:{default(){return{addLinkableSection(){},updateLinkableSection(){}}}}},props:{anchor:{type:String,required:!0},depth:{type:Number,default:()=>0},tag:{type:String,default:()=>"div"},title:{type:String,required:!0}},computed:{intersectionRootMargin(){const e=this.navigationBarHeight?`-${this.navigationBarHeight}px`:"0%";return`${e} 0% -50% 0%`}},created(){this.store.addLinkableSection({anchor:this.anchor,depth:this.depth,title:this.title,visibility:0})},methods:{onIntersect(e){const t=Math.min(1,e.intersectionRatio);this.store.updateLinkableSection({anchor:this.anchor,depth:this.depth,title:this.title,visibility:t})}}},et=Ze,tt=(0,A.A)(et,Xe,Je,!1,null,null,null),nt=tt.exports;const{BlockType:st}=Oe;var it={name:"FullWidth",components:{ContentNode:Oe,LinkableElement:nt},props:Oe.props,computed:{groups:({content:e})=>e.reduce((e,t)=>0===e.length||t.type===st.heading?[...e,{heading:t.type===st.heading?t:null,content:[t]}]:[...e.slice(0,e.length-1),{heading:e[e.length-1].heading,content:e[e.length-1].content.concat(t)}],[])},methods:{componentFor(e){return e.heading?nt:"div"},depthFor(e){switch(e.level){case 1:case 2:return 0;default:return 1}},propsFor(e){return e.heading?{anchor:e.heading.anchor,depth:this.depthFor(e.heading),title:e.heading.text}:{}}}},rt=it,ot=(0,A.A)(rt,Qe,Ke,!1,null,"5b4a8b3c",null),at=ot.exports;const lt={columns:"columns",contentAndMedia:"contentAndMedia",fullWidth:"fullWidth"};var ct={name:"BodyContent",props:{content:{type:Array,required:!0,validator:e=>e.every(({kind:e})=>Object.prototype.hasOwnProperty.call(lt,e))}},methods:{componentFor(e){return{[lt.columns]:Ve,[lt.contentAndMedia]:We,[lt.fullWidth]:at}[e.kind]},propsFor(e){const{content:t,kind:n,media:s,mediaPosition:i}=e;return{[lt.columns]:{columns:t},[lt.contentAndMedia]:{content:t,media:s,mediaPosition:i},[lt.fullWidth]:{content:t}}[n]}},LayoutKind:lt},ut=ct,dt=(0,A.A)(ut,Se,xe,!1,null,"4d5a806e",null),pt=dt.exports,ht={name:"Body",components:{BodyContent:pt},props:pt.props},mt=ht,vt=(0,A.A)(mt,Ae,ke,!1,null,"20dca692",null),ft=vt.exports,gt=function(){var e=this,t=e._self._c;return t("TutorialCTA",e._b({},"TutorialCTA",e.$props,!1))},yt=[],Ct=function(){var e=this,t=e._self._c;return t("BaseCTA",e._b({attrs:{label:e.$t("tutorials.next")}},"BaseCTA",e.baseProps,!1))},bt=[],_t=function(){var e=this,t=e._self._c;return t("div",{staticClass:"call-to-action"},[t("Row",[t("LeftColumn",[t("span",{staticClass:"label"},[e._v(e._s(e.label))]),t("h2",[e._v(" "+e._s(e.title)+" ")]),e.abstract?t("ContentNode",{staticClass:"description",attrs:{content:[e.abstractParagraph]}}):e._e(),e.action?t("Button",{attrs:{action:e.action}}):e._e()],1),t("RightColumn",{staticClass:"right-column"},[e.media?t("Asset",{staticClass:"media",attrs:{identifier:e.media}}):e._e()],1)],1)],1)},wt=[],At=n(6616),kt=n(2773),St=n(1290),xt={name:"CallToAction",components:{Asset:$e.A,Button:St.A,ContentNode:Pe["default"],LeftColumn:{render(e){return e(kt.A,{props:{span:{large:5,small:12}}},this.$slots.default)}},RightColumn:{render(e){return e(kt.A,{props:{span:{large:6,small:12}}},this.$slots.default)}},Row:At.A},props:{title:{type:String,required:!0},label:{type:String,required:!0},abstract:{type:Array,required:!1},action:{type:Object,required:!1},media:{type:String,required:!1}},computed:{abstractParagraph(){return{type:"paragraph",inlineContent:this.abstract}}}},Tt=xt,It=(0,A.A)(Tt,_t,wt,!1,null,"2bfdf182",null),$t=It.exports,Nt={name:"CallToAction",components:{BaseCTA:$t},computed:{baseProps(){return{title:this.title,abstract:this.abstract,action:this.action,media:this.media}}},props:{title:{type:String,required:!0},abstract:{type:Array,required:!1},action:{type:Object,required:!1},media:{type:String,required:!1}}},qt=Nt,Pt=(0,A.A)(qt,Ct,bt,!1,null,null,null),Dt=Pt.exports,Rt={name:"CallToAction",components:{TutorialCTA:Dt},props:Dt.props},Lt=Rt,Ot=(0,A.A)(Lt,gt,yt,!1,null,"426a965c",null),Bt=Ot.exports,Mt=function(){var e=this,t=e._self._c;return t("TutorialHero",e._b({},"TutorialHero",e.$props,!1))},Ft=[],Vt=function(){var e=this,t=e._self._c;return t("LinkableSection",{staticClass:"tutorial-hero",attrs:{anchor:"introduction",title:e.sectionTitle}},[t("div",{staticClass:"hero dark"},[e.backgroundImageUrl?t("div",{staticClass:"bg",style:e.bgStyle}):e._e(),e._t("above-title"),t("Row",[t("Column",[t("Headline",{attrs:{level:1},scopedSlots:e._u([e.chapter?{key:"eyebrow",fn:function(){return[e._v(e._s(e.chapter))]},proxy:!0}:null],null,!0)},[e._v(" "+e._s(e.title)+" ")]),e.content||e.video?t("div",{staticClass:"intro"},[e.content?t("ContentNode",{attrs:{content:e.content}}):e._e(),e.video?[t("p",[t("a",{staticClass:"call-to-action",attrs:{href:"#"},on:{click:function(t){return t.preventDefault(),e.toggleCallToActionModal.apply(null,arguments)}}},[e._v(" Watch intro video "),t("PlayIcon",{staticClass:"cta-icon icon-inline"})],1)]),t("GenericModal",{attrs:{visible:e.callToActionModalVisible,isFullscreen:"",theme:"dark"},on:{"update:visible":function(t){e.callToActionModalVisible=t}}},[t("Asset",{directives:[{name:"show",rawName:"v-show",value:e.callToActionModalVisible,expression:"callToActionModalVisible"}],ref:"asset",staticClass:"video-asset",attrs:{identifier:e.video},on:{videoEnded:e.handleVideoEnd}})],1)]:e._e()],2):e._e(),t("Metadata",{staticClass:"metadata",attrs:{projectFilesUrl:e.projectFilesUrl,estimatedTimeInMinutes:e.estimatedTimeInMinutes,xcodeRequirement:e.xcodeRequirementData}})],1)],1)],2)])},jt=[],Et=function(){var e=this,t=e._self._c;return t("div",{staticClass:"headline"},[e.$slots.eyebrow?t("span",{staticClass:"eyebrow"},[e._t("eyebrow")],2):e._e(),t("Heading",{staticClass:"heading",attrs:{level:e.level}},[e._t("default")],2)],1)},Ut=[];const Ht=1,zt=6,Gt={type:Number,required:!0,validator:e=>e>=Ht&&e<=zt},Wt={name:"Heading",render:function(e){return e(`h${this.level}`,this.$slots.default)},props:{level:Gt}};var Qt={name:"Headline",components:{Heading:Wt},props:{level:Gt}},Kt=Qt,Xt=(0,A.A)(Kt,Et,Ut,!1,null,"d46a1474",null),Jt=Xt.exports,Yt=n(6262),Zt=n(4769),en=n(288),tn=function(){var e=this,t=e._self._c;return t("div",{staticClass:"metadata"},[e.estimatedTimeInMinutes?t("div",{staticClass:"item",attrs:{"aria-label":`\n ${e.$tc("tutorials.time.minutes.full",e.estimatedTimeInMinutes,{count:e.estimatedTimeInMinutes})}\n ${e.$t("tutorials.estimated-time")}\n `}},[t("div",{staticClass:"content",attrs:{"aria-hidden":"true"}},[t("i18n",{staticClass:"duration",attrs:{path:"tutorials.time.format",tag:"div"},scopedSlots:e._u([{key:"number",fn:function(){return[e._v(" "+e._s(e.estimatedTimeInMinutes)+" ")]},proxy:!0},{key:"minutes",fn:function(){return[t("div",{staticClass:"minutes"},[e._v(e._s(e.$tc("tutorials.time.minutes.short",e.estimatedTimeInMinutes))+" ")])]},proxy:!0}],null,!1,3313752798)})],1),t("div",{staticClass:"bottom",attrs:{"aria-hidden":"true"}},[e._v(e._s(e.$t("tutorials.estimated-time")))])]):e._e(),e.projectFilesUrl?t("div",{staticClass:"item"},[t("DownloadIcon",{staticClass:"item-large-icon icon-inline"}),t("div",{staticClass:"content bottom"},[t("a",{staticClass:"content-link project-download",attrs:{href:e.projectFilesUrl}},[e._v(" "+e._s(e.$t("tutorials.project-files"))+" "),t("InlineDownloadIcon",{staticClass:"small-icon icon-inline"})],1)])],1):e._e(),e.xcodeRequirement?t("div",{staticClass:"item"},[t("XcodeIcon",{staticClass:"item-large-icon icon-inline"}),t("div",{staticClass:"content bottom"},[e.isTargetIDE?t("span",[e._v(e._s(e.xcodeRequirement.title))]):t("a",{staticClass:"content-link",attrs:{href:e.xcodeRequirement.url}},[e._v(" "+e._s(e.xcodeRequirement.title)+" "),t("InlineChevronRightIcon",{staticClass:"icon-inline small-icon xcode-icon"})],1)])],1):e._e()])},nn=[],sn=n(1168),rn=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"xcode-icon",attrs:{viewBox:"0 0 14 14",themeId:"xcode"}},[t("path",{attrs:{d:"M2.668 4.452l-1.338-2.229 0.891-0.891 2.229 1.338 1.338 2.228 3.667 3.666 0.194-0.194 2.933 2.933c0.13 0.155 0.209 0.356 0.209 0.576 0 0.497-0.403 0.9-0.9 0.9-0.22 0-0.421-0.079-0.577-0.209l0.001 0.001-2.934-2.933 0.181-0.181-3.666-3.666z"}}),t("path",{attrs:{d:"M11.824 1.277l-0.908 0.908c-0.091 0.091-0.147 0.216-0.147 0.354 0 0.106 0.033 0.205 0.090 0.286l-0.001-0.002 0.058 0.069 0.185 0.185c0.090 0.090 0.215 0.146 0.353 0.146 0.107 0 0.205-0.033 0.286-0.090l-0.002 0.001 0.069-0.057 0.909-0.908c0.118 0.24 0.187 0.522 0.187 0.82 0 1.045-0.848 1.893-1.893 1.893-0.296 0-0.577-0.068-0.826-0.189l0.011 0.005-5.5 5.5c0.116 0.238 0.184 0.518 0.184 0.813 0 1.045-0.848 1.893-1.893 1.893-0.296 0-0.576-0.068-0.826-0.189l0.011 0.005 0.908-0.909c0.090-0.090 0.146-0.215 0.146-0.353 0-0.107-0.033-0.205-0.090-0.286l0.001 0.002-0.057-0.069-0.185-0.185c-0.091-0.091-0.216-0.147-0.354-0.147-0.106 0-0.205 0.033-0.286 0.090l0.002-0.001-0.069 0.058-0.908 0.908c-0.116-0.238-0.184-0.518-0.184-0.813 0-1.045 0.847-1.892 1.892-1.892 0.293 0 0.571 0.067 0.819 0.186l-0.011-0.005 5.5-5.5c-0.116-0.238-0.184-0.519-0.184-0.815 0-1.045 0.847-1.892 1.892-1.892 0.296 0 0.577 0.068 0.827 0.19l-0.011-0.005z"}})])},on=[],an={name:"XcodeIcon",components:{SVGIcon:b.A}},ln=an,cn=(0,A.A)(ln,rn,on,!1,null,null,null),un=cn.exports,dn=n(6e3),pn=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"inline-download-icon",attrs:{viewBox:"0 0 14 14",themeId:"inline-download"}},[t("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5s2.91-6.5 6.5-6.5zM7 1.5c-3.038 0-5.5 2.462-5.5 5.5s2.462 5.5 5.5 5.5c3.038 0 5.5-2.462 5.5-5.5s-2.462-5.5-5.5-5.5z"}}),t("path",{attrs:{d:"M7.51 2.964l-0.001 5.431 1.308-2.041 0.842 0.539-2.664 4.162-2.633-4.164 0.845-0.534 1.303 2.059 0.001-5.452z"}})])},hn=[],mn={name:"InlineDownloadIcon",components:{SVGIcon:b.A}},vn=mn,fn=(0,A.A)(vn,pn,hn,!1,null,null,null),gn=fn.exports,yn={name:"HeroMetadata",components:{InlineDownloadIcon:gn,InlineChevronRightIcon:dn.A,DownloadIcon:sn.A,XcodeIcon:un},inject:["isTargetIDE"],props:{projectFilesUrl:{type:String},estimatedTimeInMinutes:{type:Number},xcodeRequirement:{type:Object,required:!1}}},Cn=yn,bn=(0,A.A)(Cn,tn,nn,!1,null,"94ff76c0",null),_n=bn.exports,wn={name:"Hero",components:{PlayIcon:Zt.A,GenericModal:Yt.A,Column:{render(e){return e(kt.A,{props:{span:{large:7,medium:9,small:12}}},this.$slots.default)}},ContentNode:Pe["default"],Headline:Jt,Metadata:_n,Row:At.A,Asset:$e.A,LinkableSection:nt},mixins:[T.A],props:{title:{type:String,required:!0},chapter:{type:String},content:{type:Array},projectFiles:{type:String},estimatedTimeInMinutes:{type:Number},xcodeRequirement:{type:String,required:!1},video:{type:String},backgroundImage:{type:String}},computed:{backgroundImageUrl(){const e=this.references[this.backgroundImage]||{},{variants:t=[]}=e,n=t.find(e=>e.traits.includes("light"));return(0,en.Fd)((n||{}).url)},projectFilesUrl(){return this.projectFiles?(0,en.Fd)(this.references[this.projectFiles].url):null},bgStyle(){return{backgroundImage:(0,en.iw)(this.backgroundImageUrl)}},xcodeRequirementData(){return this.references[this.xcodeRequirement]},sectionTitle(){return"Introduction"}},data(){return{callToActionModalVisible:!1}},methods:{async toggleCallToActionModal(){this.callToActionModalVisible=!0,await this.$nextTick();const e=this.$refs.asset.$el.querySelector("video");if(e)try{await e.play(),e.muted=!1}catch(t){}},handleVideoEnd(){this.callToActionModalVisible=!1}}},An=wn,kn=(0,A.A)(An,Vt,jt,!1,null,"2a434750",null),Sn=kn.exports,xn={name:"Hero",components:{TutorialHero:Sn},props:Sn.props},Tn=xn,In=(0,A.A)(Tn,Mt,Ft,!1,null,"35a9482f",null),$n=In.exports,Nn=function(){var e=this,t=e._self._c;return t("TutorialAssessments",e._b({scopedSlots:e._u([{key:"success",fn:function(){return[t("p",[e._v("Great job, you've answered all the questions for this article.")])]},proxy:!0}])},"TutorialAssessments",e.$props,!1))},qn=[],Pn=function(){var e=this,t=e._self._c;return t("LinkableSection",{staticClass:"assessments-wrapper",attrs:{anchor:e.anchor,title:e.title}},[t("Row",{ref:"assessments",staticClass:"assessments"},[t("MainColumn",[t("Row",{staticClass:"banner"},[t("HeaderColumn",[t("h2",{staticClass:"title"},[e._v(e._s(e.title))])])],1),e.completed?t("div",{staticClass:"success"},[e._t("success",function(){return[t("p",[e._v(e._s(e.SuccessMessage))])]})],2):t("div",[t("Progress",e._b({ref:"progress"},"Progress",e.progress,!1)),t("Quiz",{key:e.activeIndex,attrs:{choices:e.activeAssessment.choices,content:e.activeAssessment.content,isLast:e.isLast,title:e.activeAssessment.title},on:{submit:e.onSubmit,advance:e.onAdvance,"see-results":e.onSeeResults}})],1),t("div",{staticClass:"visuallyhidden",attrs:{"aria-live":"assertive"}},[e.completed?e._t("success",function(){return[e._v(" "+e._s(e.SuccessMessage)+" ")]}):e._e()],2)],1)],1)],1)},Dn=[],Rn=function(){var e=this,t=e._self._c;return t("Row",[t("p",{staticClass:"title"},[e._v(e._s(e.$t("tutorials.question-of",{index:e.index,total:e.total})))])])},Ln=[],On={name:"AssessmentsProgress",components:{Row:At.A},props:{index:{type:Number,required:!0},total:{type:Number,required:!0}}},Bn=On,Mn=(0,A.A)(Bn,Rn,Ln,!1,null,"28135d78",null),Fn=Mn.exports,Vn=function(){var e=this,t=e._self._c;return t("div",{staticClass:"quiz"},[t("ContentNode",{staticClass:"title",attrs:{content:e.title}}),e.content?t("ContentNode",{staticClass:"question-content",attrs:{content:e.content}}):e._e(),t("fieldset",{staticClass:"choices"},[t("legend",{staticClass:"visuallyhidden"},[e._v(e._s(e.$t("tutorials.assessment.legend")))]),e._l(e.choices,function(n,s){return t("label",{key:s,class:e.choiceClasses[s]},[t(e.getIconComponent(s),{tag:"component",staticClass:"choice-icon"}),t("input",{directives:[{name:"model",rawName:"v-model",value:e.selectedIndex,expression:"selectedIndex"}],attrs:{type:"radio",name:"assessment"},domProps:{value:s,checked:e._q(e.selectedIndex,s)},on:{change:function(t){e.selectedIndex=s}}}),t("ContentNode",{staticClass:"question",attrs:{content:n.content}}),e.userChoices[s].checked?[t("ContentNode",{staticClass:"answer",attrs:{content:n.justification}}),n.reaction?t("p",{staticClass:"answer"},[e._v(e._s(n.reaction))]):e._e()]:e._e()],2)})],2),t("div",{staticClass:"visuallyhidden",attrs:{"aria-live":"assertive"}},[null!=e.checkedIndex?t("i18n",{attrs:{path:"tutorials.assessment.answer-result",tag:"span"},scopedSlots:e._u([{key:"answer",fn:function(){return[t("ContentNode",{staticClass:"question",attrs:{content:e.choices[e.checkedIndex].content}})]},proxy:!0},{key:"result",fn:function(){return[e._v(e._s(e.choices[e.checkedIndex].isCorrect?e.$t("tutorials.assessment.correct"):e.$t("tutorials.assessment.incorrect")))]},proxy:!0}],null,!1,511264553)}):e._e()],1),t("div",{staticClass:"controls"},[t("ButtonLink",{staticClass:"check",attrs:{disabled:null===e.selectedIndex||e.showNextQuestion},nativeOn:{click:function(t){return e.submit.apply(null,arguments)}}},[e._v(" "+e._s(e.$t("tutorials.submit"))+" ")]),e.isLast?t("ButtonLink",{staticClass:"results",attrs:{disabled:!e.showNextQuestion},nativeOn:{click:function(t){return e.seeResults.apply(null,arguments)}}},[e._v(" "+e._s(e.$t("tutorials.next"))+" ")]):t("ButtonLink",{staticClass:"next",attrs:{disabled:!e.showNextQuestion},nativeOn:{click:function(t){return e.advance.apply(null,arguments)}}},[e._v(" "+e._s(e.$t("tutorials.assessment.next-question"))+" ")])],1)],1)},jn=[],En=(n(7642),n(8004),n(3853),n(5876),n(2475),n(5024),n(1698),n(5892)),Un=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"reset-circle-icon",attrs:{viewBox:"0 0 14 14",themeId:"reset-circle"}},[t("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5v0c0-3.59 2.91-6.5 6.5-6.5v0zM7 1.5c-3.038 0-5.5 2.462-5.5 5.5s2.462 5.5 5.5 5.5c3.038 0 5.5-2.462 5.5-5.5v0c0-3.038-2.462-5.5-5.5-5.5v0z"}}),t("path",{attrs:{d:"M3.828 4.539l0.707-0.707 5.657 5.657-0.707 0.707-5.657-5.657z"}}),t("path",{attrs:{d:"M3.828 9.489l5.657-5.657 0.707 0.707-5.657 5.657-0.707-0.707z"}})])},Hn=[],zn={name:"ResetCircleIcon",components:{SVGIcon:b.A}},Gn=zn,Wn=(0,A.A)(Gn,Un,Hn,!1,null,null,null),Qn=Wn.exports,Kn=function(){var e=this,t=e._self._c;return t("SVGIcon",{staticClass:"check-circle-icon",attrs:{viewBox:"0 0 14 14",themeId:"check-circle"}},[t("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5v0c0-3.59 2.91-6.5 6.5-6.5v0zM7 1.5c-3.038 0-5.5 2.462-5.5 5.5s2.462 5.5 5.5 5.5c3.038 0 5.5-2.462 5.5-5.5v0c0-3.038-2.462-5.5-5.5-5.5v0z"}}),t("path",{attrs:{d:"M9.626 3.719l0.866 0.5-3.5 6.062-3.464-2 0.5-0.866 2.6 1.5z"}})])},Xn=[],Jn={name:"CheckCircleIcon",components:{SVGIcon:b.A}},Yn=Jn,Zn=(0,A.A)(Yn,Kn,Xn,!1,null,null,null),es=Zn.exports,ts={name:"Quiz",components:{CheckCircleIcon:es,ResetCircleIcon:Qn,ContentNode:Pe["default"],ButtonLink:En.A},props:{content:{type:Array,required:!1},choices:{type:Array,required:!0},isLast:{type:Boolean,default:!1},title:{type:Array,required:!0}},data(){return{userChoices:this.choices.map(()=>({checked:!1})),selectedIndex:null,checkedIndex:null}},computed:{correctChoices(){return this.choices.reduce((e,t,n)=>t.isCorrect?e.add(n):e,new Set)},choiceClasses(){return this.userChoices.map((e,t)=>({choice:!0,active:this.selectedIndex===t,disabled:e.checked||this.showNextQuestion,correct:e.checked&&this.choices[t].isCorrect,incorrect:e.checked&&!this.choices[t].isCorrect}))},showNextQuestion(){return Array.from(this.correctChoices).every(e=>this.userChoices[e].checked)}},methods:{getIconComponent(e){const t=this.userChoices[e];if(t&&t.checked)return this.choices[e].isCorrect?es:Qn},submit(){this.$set(this.userChoices,this.selectedIndex,{checked:!0}),this.checkedIndex=this.selectedIndex,this.$emit("submit")},advance(){this.$emit("advance")},seeResults(){this.$emit("see-results")}}},ns=ts,ss=(0,A.A)(ns,Vn,jn,!1,null,"61b03ec2",null),is=ss.exports;const rs=12,os="tutorials.assessment.success-message";var as={name:"Assessments",constants:{SuccessMessage:os},components:{LinkableSection:nt,Quiz:is,Progress:Fn,Row:At.A,HeaderColumn:{render(e){return e(kt.A,{props:{isCentered:{large:!0},span:{large:10}}},this.$slots.default)}},MainColumn:{render(e){return e(kt.A,{props:{isCentered:{large:!0},span:{large:10,medium:10,small:12}}},this.$slots.default)}}},props:{assessments:{type:Array,required:!0},anchor:{type:String,required:!0}},inject:["navigationBarHeight"],data(){return{activeIndex:0,completed:!1,SuccessMessage:this.$t(os)}},computed:{activeAssessment(){return this.assessments[this.activeIndex]},isLast(){return this.activeIndex===this.assessments.length-1},progress(){return{index:this.activeIndex+1,total:this.assessments.length}},title(){return this.$t("tutorials.assessment.check-your-understanding")}},methods:{scrollTo(e,t=0){e.scrollIntoView(!0),window.scrollBy(0,-this.navigationBarHeight-t)},onSubmit(){this.$nextTick(()=>{this.scrollTo(this.$refs.progress.$el,rs)})},onAdvance(){this.activeIndex+=1,this.$nextTick(()=>{this.scrollTo(this.$refs.progress.$el,rs)})},onSeeResults(){this.completed=!0,this.$nextTick(()=>{this.scrollTo(this.$refs.assessments.$el,rs)})}}},ls=as,cs=(0,A.A)(ls,Pn,Dn,!1,null,"65e3c02c",null),us=cs.exports,ds={name:"Assessments",components:{TutorialAssessments:us},props:us.props},ps=ds,hs=(0,A.A)(ps,Nn,qn,!1,null,"6db06128",null),ms=hs.exports;const vs={articleBody:"articleBody",callToAction:"callToAction",hero:"hero",assessments:"assessments"};var fs={name:"Article",components:{NavigationBar:_e,PortalTarget:m.mf},mixins:[we.A],inject:{isTargetIDE:{default:!1},store:{default(){return{reset(){},setReferences(){}}}}},props:{hierarchy:{type:Object,required:!0},metadata:{type:Object,required:!0},references:{type:Object,required:!0},sections:{type:Array,required:!0,validator:e=>e.every(({kind:e})=>Object.prototype.hasOwnProperty.call(vs,e))},identifierUrl:{type:String,required:!0}},computed:{heroSection(){return this.sections.find(this.isHero)},heroTitle(){return(this.heroSection||{}).title},pageTitle(){return this.heroTitle?`${this.heroTitle} — ${this.metadata.category} Tutorials`:void 0},pageDescription:({heroSection:e,extractFirstParagraphText:t})=>e?t(e.content):null},methods:{componentFor(e){const{kind:t}=e;return{[vs.articleBody]:ft,[vs.callToAction]:Bt,[vs.hero]:$n,[vs.assessments]:ms}[t]},isHero(e){return e.kind===vs.hero},propsFor(e){const{abstract:t,action:n,anchor:s,assessments:i,backgroundImage:r,chapter:o,content:a,estimatedTimeInMinutes:l,kind:c,media:u,projectFiles:d,title:p,video:h,xcodeRequirement:m}=e;return{[vs.articleBody]:{content:a},[vs.callToAction]:{abstract:t,action:n,media:u,title:p},[vs.hero]:{backgroundImage:r,chapter:o,content:a,estimatedTimeInMinutes:l,projectFiles:d,title:p,video:h,xcodeRequirement:m},[vs.assessments]:{anchor:s,assessments:i}}[c]}},created(){v.A.setAvailableLocales(this.metadata.availableLanguages??this.metadata.availableLocales),this.store.reset(),this.store.setReferences(this.references)},watch:{references(e){this.store.setReferences(e)},"metadata.availableLocales":function(e){v.A.setAvailableLocales(this.metadata?.availableLanguages??e)},"metadata.availableLanguages":function(e){v.A.setAvailableLocales(e)}},SectionKind:vs},gs=fs,ys=(0,A.A)(gs,p,h,!1,null,"f98c4098",null),Cs=ys.exports,bs=function(){var e=this,t=e._self._c;return t("div",{staticClass:"tutorial"},[e.isTargetIDE?e._e():t("NavigationBar",{attrs:{technology:e.metadata.category,chapters:e.hierarchy.modules,topic:e.tutorialTitle||"",rootReference:e.hierarchy.reference,identifierUrl:e.identifierUrl}}),t("main",{attrs:{id:"app-main",tabindex:"0"}},[e._l(e.sections,function(e,n){return t("Section",{key:n,attrs:{section:e}})}),t("BreakpointEmitter",{on:{change:e.handleBreakpointChange}})],2),t("PortalTarget",{attrs:{name:"modal-destination",multiple:""}})],1)},_s=[],ws=n(6131),As=function(){var e=this,t=e._self._c;return t("div",{staticClass:"sections"},e._l(e.tasks,function(n,s){return t("Section",e._b({key:s,attrs:{id:n.anchor,sectionNumber:s+1,isRuntimePreviewVisible:e.isRuntimePreviewVisible},on:{"runtime-preview-toggle":e.onRuntimePreviewToggle}},"Section",n,!1))}),1)},ks=[],Ss=function(){var e=this,t=e._self._c;return t("LinkableSection",{staticClass:"section",attrs:{anchor:e.anchor,title:e.introProps.title}},[t("Intro",e._b({},"Intro",e.introProps,!1)),e.stepsSection.length>0?t("Steps",{attrs:{content:e.stepsSection,isRuntimePreviewVisible:e.isRuntimePreviewVisible,sectionNumber:e.sectionNumber},on:{"runtime-preview-toggle":e.onRuntimePreviewToggle}}):e._e()],1)},xs=[],Ts=function(){var e=this,t=e._self._c;return t("div",{staticClass:"intro-container"},[t("Row",{class:["intro",`intro-${e.sectionNumber}`,{ide:e.isTargetIDE}]},[t("Column",{staticClass:"left"},[t("Headline",{attrs:{level:2},scopedSlots:e._u([{key:"eyebrow",fn:function(){return[t("router-link",{attrs:{to:e.sectionLink}},[e._v(" "+e._s(e.$t("sections.title",{number:e.sectionNumber}))+" ")])]},proxy:!0}])},[e._v(" "+e._s(e.title)+" ")]),t("ContentNode",{attrs:{content:e.content}})],1),t("Column",{staticClass:"right"},[t("div",{staticClass:"media"},[e.media?t("Asset",{attrs:{videoAutoplays:"",videoMuted:"",identifier:e.media}}):e._e()],1)])],1),e.expandedSections.length>0?t("ExpandedIntro",{staticClass:"expanded-intro",attrs:{content:e.expandedSections}}):e._e()],1)},Is=[],$s={name:"SectionIntro",inject:{isTargetIDE:{default:()=>!1}},components:{Asset:$e.A,ContentNode:Pe["default"],ExpandedIntro:pt,Headline:Jt,Row:At.A,Column:{render(e){return e(kt.A,{props:{span:{large:6,small:12}}},this.$slots.default)}}},props:{sectionAnchor:{type:String,required:!0},content:{type:Array,required:!0},media:{type:String,required:!0},title:{type:String,required:!0},sectionNumber:{type:Number,required:!0},expandedSections:{type:Array,default:()=>[]}},methods:{focus(){this.$emit("focus",this.media)}},computed:{sectionLink(){return{path:this.$route.path,hash:this.sectionAnchor,query:this.$route.query}}}},Ns=$s,qs=(0,A.A)(Ns,Ts,Is,!1,null,"7dcf2d10",null),Ps=qs.exports,Ds=function(){var e=this,t=e._self._c;return t("div",{staticClass:"steps"},[t("div",{staticClass:"content-container"},e._l(e.contentNodes,function(n,s){return t(n.component,e._b({key:s,ref:"contentNodes",refInFor:!0,tag:"component",class:e.contentClass(s),attrs:{currentIndex:e.activeStep}},"component",n.props,!1))}),1),e.isBreakpointSmall?e._e():t("BackgroundTheme",{staticClass:"asset-container",class:e.assetContainerClasses},[t("transition",{attrs:{name:"fade"}},[e.visibleAsset.media?t("div",{key:e.visibleAsset.media,class:["asset-wrapper",{ide:e.isTargetIDE}]},[t("Asset",{ref:"asset",staticClass:"step-asset",attrs:{videoAutoplays:"",videoMuted:"",identifier:e.visibleAsset.media}})],1):e._e(),e.visibleAsset.code?t("CodePreview",{attrs:{code:e.visibleAsset.code,preview:e.visibleAsset.runtimePreview,isRuntimePreviewVisible:e.isRuntimePreviewVisible},on:{"runtime-preview-toggle":e.onRuntimePreviewToggle}},[e.visibleAsset.runtimePreview?t("transition",{attrs:{name:"fade"}},[t("Asset",{key:e.visibleAsset.runtimePreview,attrs:{identifier:e.visibleAsset.runtimePreview}})],1):e._e()],1):e._e()],1)],1)],1)},Rs=[],Ls=(n(2489),n(7588),function(){var e=this,t=e._self._c;return t("div",{class:["code-preview",{ide:e.isTargetIDE}]},[t("CodeTheme",[e.code?t("CodeListing",e._b({attrs:{showLineNumbers:""}},"CodeListing",e.codeProps,!1)):e._e()],1),t("div",{staticClass:"runtime-preview",class:e.runtimePreviewClasses,style:e.previewStyles},[t("div",{staticClass:"runtimve-preview__container"},[t("button",{staticClass:"header",attrs:{disabled:!e.hasRuntimePreview,title:e.runtimePreviewTitle},on:{click:e.togglePreview}},[t("span",{staticClass:"runtime-preview-label",attrs:{"aria-label":e.textAriaLabel}},[e._v(e._s(e.togglePreviewText))]),t("DiagonalArrowIcon",{staticClass:"icon-inline preview-icon",class:[e.shouldDisplayHideLabel?"preview-hide":"preview-show"]})],1),t("transition",{on:{leave:e.handleLeave}},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.shouldDisplayHideLabel,expression:"shouldDisplayHideLabel"}],staticClass:"runtime-preview-asset"},[e._t("default")],2)])],1)])],1)}),Os=[],Bs=n(1097),Ms=n(9540),Fs=n(822);const{BreakpointName:Vs}=a.A.constants;function js({width:e,height:t},n=1){const s=400,i=e<=s?1.75:3;return{width:e/(i/n),height:t/(i/n)}}var Es={name:"CodePreview",inject:{isTargetIDE:{default:!1},store:{default(){return{state:{references:{}}}}}},components:{DiagonalArrowIcon:Ms.A,CodeListing:Bs.A,CodeTheme:Fs.A},props:{code:{type:String,required:!0},preview:{type:String,required:!1},isRuntimePreviewVisible:{type:Boolean,required:!0}},data(){return{tutorialState:this.store.state}},computed:{references:({tutorialState:e})=>e.references,currentBreakpoint(){return this.tutorialState.breakpoint},hasRuntimePreview(){return!!this.preview},previewAssetSize(){const e=this.hasRuntimePreview?this.references[this.preview]:{},t=(e.variants||[{}])[0]||{},n={width:900};let s=t.size||{};s.width||s.height||(s=n);const i=this.currentBreakpoint===Vs.medium?.8:1;return js(s,i)},previewSize(){const e={width:102};return this.shouldDisplayHideLabel&&this.previewAssetSize?{width:this.previewAssetSize.width}:e},previewStyles(){const{width:e}=this.previewSize;return{width:`${e}px`}},codeProps(){return this.references[this.code]},runtimePreviewClasses(){return{collapsed:!this.shouldDisplayHideLabel,disabled:!this.hasRuntimePreview,"runtime-preview-ide":this.isTargetIDE}},shouldDisplayHideLabel(){return this.hasRuntimePreview&&this.isRuntimePreviewVisible},runtimePreviewTitle(){return this.hasRuntimePreview?null:this.$t("tutorials.preview.no-preview-available-step")},togglePreviewText(){return this.$tc("tutorials.preview.title",this.hasRuntimePreview?1:0)},textAriaLabel(){return`${this.togglePreviewText}, ${this.shouldDisplayHideLabel?this.$t("verbs.hide"):this.$t("verbs.show")}`}},methods:{handleLeave(e,t){setTimeout(t,200)},togglePreview(){this.hasRuntimePreview&&this.$emit("runtime-preview-toggle",!this.isRuntimePreviewVisible)}}},Us=Es,Hs=(0,A.A)(Us,Ls,Os,!1,null,"395e30cd",null),zs=Hs.exports,Gs=n(3029),Ws=function(){var e=this,t=e._self._c;return t("div",{style:e.backgroundStyle},[e._t("default")],2)},Qs=[],Ks={name:"BackgroundTheme",data(){return{codeThemeState:ws.A.state}},computed:{backgroundStyle(){const{codeColors:e}=this.codeThemeState;return e?{"--background":e.background}:null}}},Xs=Ks,Js=(0,A.A)(Xs,Ws,Qs,!1,null,null,null),Ys=Js.exports,Zs=function(){var e=this,t=e._self._c;return t("div",{class:["step-container",`step-${e.stepNumber}`]},[t("div",{ref:"step",staticClass:"step",class:{focused:e.isActive},attrs:{"data-index":e.index}},[t("p",{staticClass:"step-label"},[e._v(e._s(e.$t("tutorials.step",{number:e.stepNumber})))]),t("ContentNode",{attrs:{content:e.content}}),e.caption&&e.caption.length>0?t("ContentNode",{staticClass:"caption",attrs:{content:e.caption}}):e._e()],1),e.isBreakpointSmall||!e.isTargetIDE?t("div",{staticClass:"media-container"},[e.media?t("Asset",{attrs:{identifier:e.media,videoAutoplays:"",videoMuted:""}}):e._e(),e.code?t("MobileCodePreview",{attrs:{code:e.code}},[e.runtimePreview?t("Asset",{staticClass:"preview",attrs:{identifier:e.runtimePreview}}):e._e()],1):e._e()],1):e._e()])},ei=[],ti=function(){var e=this,t=e._self._c;return t("BackgroundTheme",{staticClass:"mobile-code-preview"},[e.code?t("GenericModal",{staticClass:"full-code-listing-modal",attrs:{theme:e.isTargetIDE?"code":"light",codeBackgroundColorOverride:e.modalBackgroundColor,isFullscreen:"",visible:e.fullCodeIsVisible},on:{"update:visible":function(t){e.fullCodeIsVisible=t}}},[t("div",{staticClass:"full-code-listing-modal-content"},[t("CodeTheme",[t("CodeListing",e._b({staticClass:"full-code-listing",attrs:{showLineNumbers:""}},"CodeListing",e.codeProps,!1))],1)],1)]):e._e(),t("CodeTheme",[e.code?t("MobileCodeListing",e._b({attrs:{showLineNumbers:""},on:{"file-name-click":e.toggleFullCode}},"MobileCodeListing",e.codeProps,!1)):e._e()],1),t("CodeTheme",{staticClass:"preview-toggle-container"},[t("PreviewToggle",{attrs:{isActionable:!!e.$slots.default},on:{click:e.togglePreview}})],1),e.$slots.default?t("GenericModal",{staticClass:"runtime-preview-modal",attrs:{theme:e.isTargetIDE?"dynamic":"light",isFullscreen:"",visible:e.previewIsVisible},on:{"update:visible":function(t){e.previewIsVisible=t}}},[t("div",{staticClass:"runtime-preview-modal-content"},[t("span",{staticClass:"runtime-preview-label"},[e._v(e._s(e.$tc("tutorials.preview.title",1)))]),e._t("default")],2)]):e._e()],1)},ni=[],si=function(){var e=this,t=e._self._c;return t("div",{staticClass:"code-listing-preview",attrs:{"data-syntax":e.syntax}},[t("CodeListing",{attrs:{fileName:e.fileName,syntax:e.syntax,fileType:e.fileType,content:e.previewedLines,startLineNumber:e.displayedRange.start,highlights:e.highlights,showLineNumbers:"",isFileNameActionable:""},on:{"file-name-click":function(t){return e.$emit("file-name-click")}}})],1)},ii=[],ri={name:"MobileCodeListing",components:{CodeListing:Bs.A},props:{fileName:String,syntax:String,fileType:String,content:{type:Array,required:!0},highlights:{type:Array,default:()=>[]}},computed:{highlightedLineNumbers(){return new Set(this.highlights.map(({line:e})=>e))},firstHighlightRange(){if(0===this.highlightedLineNumbers.size)return{start:1,end:this.content.length};const e=Math.min(...this.highlightedLineNumbers.values());let t=e;while(this.highlightedLineNumbers.has(t+1))t+=1;return{start:e,end:t}},displayedRange(){const e=this.firstHighlightRange,t=e.start-2<1?1:e.start-2,n=e.end+3>=this.content.length+1?this.content.length+1:e.end+3;return{start:t,end:n}},previewedLines(){return this.content.slice(this.displayedRange.start-1,this.displayedRange.end-1)}}},oi=ri,ai=(0,A.A)(oi,si,ii,!1,null,"0bdf2f26",null),li=ai.exports,ci=function(){var e=this,t=e._self._c;return t("span",{staticClass:"toggle-preview"},[e.isActionable?t("a",{staticClass:"toggle-text",attrs:{href:"#"},on:{click:function(t){return t.preventDefault(),e.$emit("click")}}},[e._v(" "+e._s(e.$tc("tutorials.preview.title",1))+" "),t("InlinePlusCircleIcon",{staticClass:"toggle-icon icon-inline"})],1):t("span",{staticClass:"toggle-text"},[e._v(" "+e._s(e.$tc("tutorials.preview.title",0))+" ")])])},ui=[],di=n(5948),pi={name:"MobileCodePreviewToggle",components:{InlinePlusCircleIcon:di.A},props:{isActionable:{type:Boolean,required:!0}}},hi=pi,mi=(0,A.A)(hi,ci,ui,!1,null,"78763c14",null),vi=mi.exports,fi={name:"MobileCodePreview",inject:["isTargetIDE"],mixins:[T.A],components:{GenericModal:Yt.A,CodeListing:Bs.A,MobileCodeListing:li,PreviewToggle:vi,CodeTheme:Fs.A,BackgroundTheme:Ys},props:{code:{type:String,required:!0}},computed:{codeProps(){return this.references[this.code]},modalBackgroundColor(){const{codeColors:e}=this.store.state;return e?e.background:null}},data(){return{previewIsVisible:!1,fullCodeIsVisible:!1}},methods:{togglePreview(){this.previewIsVisible=!this.previewIsVisible},toggleFullCode(){this.fullCodeIsVisible=!this.fullCodeIsVisible}}},gi=fi,yi=(0,A.A)(gi,ti,ni,!1,null,"b1691954",null),Ci=yi.exports;const{BreakpointName:bi}=a.A.constants;var _i={name:"Step",components:{Asset:$e.A,MobileCodePreview:Ci,ContentNode:Pe["default"]},inject:["isTargetIDE","store"],props:{code:{type:String,required:!1},content:{type:Array,required:!0},caption:{type:Array,required:!1},media:{type:String,required:!1},runtimePreview:{type:String,required:!1},sectionNumber:{type:Number,required:!0},stepNumber:{type:Number,required:!0},numberOfSteps:{type:Number,required:!0},index:{type:Number,required:!0},currentIndex:{type:Number,required:!0}},data(){return{tutorialState:this.store.state}},computed:{isBreakpointSmall(){return this.tutorialState.breakpoint===bi.small},isActive:({index:e,currentIndex:t})=>e===t}},wi=_i,Ai=(0,A.A)(wi,Zs,ei,!1,null,"d0198556",null),ki=Ai.exports;const{BreakpointName:Si}=a.A.constants,{IntersectionDirections:xi}=Ye.A.constants,Ti="-35% 0% -65% 0%";var Ii={name:"SectionSteps",components:{ContentNode:Pe["default"],Step:ki,Asset:$e.A,CodePreview:zs,BackgroundTheme:Ys},mixins:[Ye.A],constants:{IntersectionMargins:Ti},inject:["isTargetIDE","store"],data(){const e=this.content.findIndex(this.isStepNode),{code:t,media:n,runtimePreview:s}=this.content[e]||{};return{tutorialState:this.store.state,visibleAsset:{media:n,code:t,runtimePreview:s},activeStep:e}},computed:{assetContainerClasses(){return{"for-step-code":!!this.visibleAsset.code,ide:this.isTargetIDE}},numberOfSteps(){return this.content.filter(this.isStepNode).length},contentNodes(){return this.content.reduce(({stepCounter:e,nodes:t},n,s)=>{const{type:i,...r}=n,o=this.isStepNode(n),a=o?e+1:e;return o?{stepCounter:e+1,nodes:t.concat({component:ki,type:i,props:{...r,stepNumber:a,index:s,numberOfSteps:this.numberOfSteps,sectionNumber:this.sectionNumber}})}:{stepCounter:e,nodes:t.concat({component:Pe["default"],type:i,props:{content:[n]}})}},{stepCounter:0,nodes:[]}).nodes},isBreakpointSmall(){return this.tutorialState.breakpoint===Si.small},stepNodes:({contentNodes:e,isStepNode:t})=>e.filter(t),intersectionRootMargin:()=>Ti},async mounted(){await(0,Gs.u)(8),this.findClosestStepNode()},methods:{isStepNode({type:e}){return"step"===e},contentClass(e){return{[`interstitial interstitial-${e+1}`]:!this.isStepNode(this.content[e])}},onReverseIntoLastStep(){const{asset:e}=this.$refs;if(e){const t=e.$el.querySelector("video");t&&(t.currentTime=0,t.play().catch(()=>{}))}},onFocus(e){const{code:t,media:n,runtimePreview:s}=this.content[e];this.activeStep=e,this.visibleAsset={code:t,media:n,runtimePreview:s}},onRuntimePreviewToggle(e){this.$emit("runtime-preview-toggle",e)},findClosestStepNode(){const e=.333*window.innerHeight;let t=null,n=0;this.stepNodes.forEach(s=>{const{index:i}=s.props,r=this.$refs.contentNodes[i].$refs.step;if(!r)return;const{top:o,bottom:a}=r.getBoundingClientRect(),l=o-e,c=a-e,u=Math.abs(l+c);(0===n||u<=n)&&(n=u,t=i)}),null!==t&&this.onFocus(t)},getIntersectionTargets(){const{stepNodes:e,$refs:t}=this;return e.map(({props:{index:e}})=>t.contentNodes[e].$refs.step)},onIntersect(e){const{target:t,isIntersecting:n}=e;if(!n)return;const s=parseFloat(t.getAttribute("data-index"));this.intersectionScrollDirection===xi.down&&s===this.stepNodes[this.stepNodes.length-1].props.index&&this.onReverseIntoLastStep(),this.onFocus(s)}},props:{content:{type:Array,required:!0},isRuntimePreviewVisible:{type:Boolean,require:!0},sectionNumber:{type:Number,required:!0}}},$i=Ii,Ni=(0,A.A)($i,Ds,Rs,!1,null,"e3061a7c",null),qi=Ni.exports,Pi={name:"Section",components:{Intro:Ps,LinkableSection:nt,Steps:qi},computed:{introProps(){const[{content:e,media:t},...n]=this.contentSection;return{content:e,expandedSections:n,media:t,sectionAnchor:this.anchor,sectionNumber:this.sectionNumber,title:this.title}}},props:{anchor:{type:String,required:!0},title:{type:String,required:!0},contentSection:{type:Array,required:!0},stepsSection:{type:Array,required:!0},sectionNumber:{type:Number,required:!0},isRuntimePreviewVisible:{type:Boolean,required:!0}},methods:{onRuntimePreviewToggle(e){this.$emit("runtime-preview-toggle",e)}}},Di=Pi,Ri=(0,A.A)(Di,Ss,xs,!1,null,"6b3a0b3a",null),Li=Ri.exports,Oi={name:"SectionList",components:{Section:Li},data(){return{isRuntimePreviewVisible:!0}},props:{tasks:{type:Array,required:!0}},methods:{onRuntimePreviewToggle(e){this.isRuntimePreviewVisible=e}}},Bi=Oi,Mi=(0,A.A)(Bi,As,ks,!1,null,"79a75e9e",null),Fi=Mi.exports;const Vi={assessments:us,hero:Sn,tasks:Fi,callToAction:Dt},ji=new Set(Object.keys(Vi)),Ei={name:"TutorialSection",render:function(e){const{kind:t,...n}=this.section,s=Vi[t];return s?e(s,{props:n}):null},props:{section:{type:Object,required:!0,validator:e=>ji.has(e.kind)}}};var Ui={name:"Tutorial",mixins:[we.A],components:{NavigationBar:_e,Section:Ei,PortalTarget:m.mf,BreakpointEmitter:a.A},inject:["isTargetIDE","store"],computed:{heroSection(){return this.sections.find(({kind:e})=>"hero"===e)},tutorialTitle(){return(this.heroSection||{}).title},pageTitle(){return this.tutorialTitle?`${this.tutorialTitle} — ${this.metadata.category} Tutorials`:void 0},pageDescription:({heroSection:e,extractFirstParagraphText:t})=>e?t(e.content):null},props:{sections:{type:Array,required:!0},references:{type:Object,required:!0},hierarchy:{type:Object,required:!0},metadata:{type:Object,required:!0},identifierUrl:{type:String,required:!0}},methods:{handleBreakpointChange(e){this.store.updateBreakpoint(e)},handleCodeColorsChange(e){ws.A.updateCodeColors(e)}},created(){v.A.setAvailableLocales(this.metadata.availableLanguages??this.metadata.availableLocales),this.store.reset(),this.store.setReferences(this.references)},watch:{references(e){this.store.setReferences(e)},"metadata.availableLocales":function(e){v.A.setAvailableLocales(this.metadata?.availableLanguages??e)},"metadata.availableLanguages":function(e){v.A.setAvailableLocales(e)}},mounted(){this.$bridge.on("codeColors",this.handleCodeColorsChange),this.$bridge.send({type:"requestCodeColors"})},beforeDestroy(){this.$bridge.off("codeColors",this.handleCodeColorsChange)}},Hi=Ui,zi=(0,A.A)(Hi,bs,_s,!1,null,"f9aca85c",null),Gi=zi.exports,Wi=n(7470),Qi=n(4602);const Ki={article:"article",tutorial:"project"};var Xi={name:"Topic",inject:{isTargetIDE:{default:!1}},mixins:[Wi.A,Qi.A],data(){return{topicData:null}},computed:{navigationBarHeight(){return this.isTargetIDE?0:52},store(){return d},hierarchy(){const{hierarchy:e={}}=this.topicData,{technologyNavigation:t=["overview","tutorials","resources"]}=e||{};return{...e,technologyNavigation:t}},topicKey:({$route:e,topicData:t})=>[e.path,t.identifier.interfaceLanguage].join()},beforeRouteEnter(e,t,n){e.meta.skipFetchingData?n(e=>e.newContentMounted()):(0,o.Dk)(e,t,n).then(t=>n(n=>{(0,r.cu)(e.params.locale,n),n.topicData=t})).catch(n)},beforeRouteUpdate(e,t,n){(0,o.JR)(e,t)?(0,o.Dk)(e,t,n).then(t=>{this.topicData=t,(0,r.cu)(e.params.locale,this),n()}).catch(n):n()},created(){this.store.reset()},mounted(){this.$bridge.on("contentUpdate",this.handleContentUpdateFromBridge)},beforeDestroy(){this.$bridge.off("contentUpdate",this.handleContentUpdateFromBridge)},methods:{componentFor(e){const{kind:t}=e;return{[Ki.article]:Cs,[Ki.tutorial]:Gi}[t]},propsFor(e){const{hierarchy:t,kind:n,metadata:s,references:i,sections:r,identifier:o}=e;return{[Ki.article]:{hierarchy:t,metadata:s,references:i,sections:r,identifierUrl:o.url},[Ki.tutorial]:{hierarchy:t,metadata:s,references:i,sections:r,identifierUrl:o.url}}[n]}},provide(){return{navigationBarHeight:this.navigationBarHeight,store:this.store}},watch:{topicData(){this.$nextTick(()=>{this.newContentMounted()})}}},Ji=Xi,Yi=(0,A.A)(Ji,s,i,!1,null,null,null),Zi=Yi.exports}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/js/tutorials-overview.d84819f0.js b/Containers/Supporting Files/Help.bundle/js/tutorials-overview.d84819f0.js new file mode 100644 index 0000000..248a7f3 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/js/tutorials-overview.d84819f0.js @@ -0,0 +1,10 @@ +/*! + * This source file is part of the Swift.org open source project + * + * Copyright (c) 2021 Apple Inc. and the Swift project authors + * Licensed under Apache License v2.0 with Runtime Library Exception + * + * See https://swift.org/LICENSE.txt for license information + * See https://swift.org/CONTRIBUTORS.txt for Swift project authors + */ +"use strict";(self["webpackChunkswift_docc_render"]=self["webpackChunkswift_docc_render"]||[]).push([[36],{734:function(t,e,n){n.d(e,{A:function(){return c}});var i=function(){var t=this,e=t._self._c;return e("router-link",{staticClass:"nav-title-content",attrs:{to:t.to}},[e("span",{staticClass:"title"},[t._t("default")],2),e("span",{staticClass:"subhead"},[t._v(" "),t._t("subhead")],2)])},s=[],o={name:"NavTitleContainer",props:{to:{type:[String,Object],required:!0}}},a=o,r=n(1656),l=(0,r.A)(a,i,s,!1,null,"854b4dd6",null),c=l.exports},1168:function(t,e,n){n.d(e,{A:function(){return u}});var i=function(){var t=this,e=t._self._c;return e("SVGIcon",{staticClass:"download-icon",attrs:{viewBox:"0 0 14 14",themeId:"download"}},[e("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5s2.91-6.5 6.5-6.5zM7 1.5c-3.038 0-5.5 2.462-5.5 5.5s2.462 5.5 5.5 5.5c3.038 0 5.5-2.462 5.5-5.5s-2.462-5.5-5.5-5.5z"}}),e("path",{attrs:{d:"M7.51 2.964l-0.001 5.431 1.308-2.041 0.842 0.539-2.664 4.162-2.633-4.164 0.845-0.534 1.303 2.059 0.001-5.452z"}})])},s=[],o=n(6515),a={name:"DownloadIcon",components:{SVGIcon:o.A}},r=a,l=n(1656),c=(0,l.A)(r,i,s,!1,null,null,null),u=c.exports},2223:function(t,e,n){n.d(e,{A:function(){return u}});var i=function(){var t=this,e=t._self._c;return e("SVGIcon",{staticClass:"inline-close-icon",attrs:{viewBox:"0 0 14 14",themeId:"inline-close"}},[e("path",{attrs:{d:"M11.91 1l1.090 1.090-4.917 4.915 4.906 4.905-1.090 1.090-4.906-4.905-4.892 4.894-1.090-1.090 4.892-4.894-4.903-4.904 1.090-1.090 4.903 4.904z"}})])},s=[],o=n(6515),a={name:"InlineCloseIcon",components:{SVGIcon:o.A}},r=a,l=n(1656),c=(0,l.A)(r,i,s,!1,null,null,null),u=c.exports},3111:function(t,e,n){n.r(e),n.d(e,{default:function(){return Ue}});var i=function(){var t=this,e=t._self._c;return t.topicData?e("Overview",t._b({key:t.topicKey},"Overview",t.overviewProps,!1)):t._e()},s=[],o=n(8213),a=n(1836),r=n(7470),l=function(){var t=this,e=t._self._c;return e("div",{staticClass:"tutorials-overview"},[t.isTargetIDE?t._e():e("Nav",{staticClass:"theme-dark",attrs:{sections:t.otherSections}},[t._v(" "+t._s(t.title)+" ")]),e("main",{staticClass:"main",attrs:{id:"app-main",tabindex:"0"}},[e("div",{staticClass:"radial-gradient"},[t._t("above-hero"),t.heroSection?e("Hero",{attrs:{action:t.heroSection.action,content:t.heroSection.content,estimatedTime:t.metadata.estimatedTime,image:t.heroSection.image,title:t.heroSection.title}}):t._e()],2),t.otherSections.length>0?e("LearningPath",{attrs:{sections:t.otherSections}}):t._e()],1)],1)},c=[],u=(n(8111),n(1148),n(8237),n(8964)),m={state:{activeTutorialLink:null,activeVolume:null,references:{}},reset(){this.state.activeTutorialLink=null,this.state.activeVolume=null,this.state.references={}},setActiveSidebarLink(t){this.state.activeTutorialLink=t},setActiveVolume(t){this.state.activeVolume=t},setReferences(t){this.state.references=t}},d=function(){var t=this,e=t._self._c;return e("NavBase",{scopedSlots:t._u([{key:"menu-items",fn:function(){return[e("NavMenuItemBase",{staticClass:"in-page-navigation"},[e("TutorialsNavigation",{attrs:{sections:t.sections}})],1),t._t("menu-items")]},proxy:!0}],null,!0)},[e("NavTitleContainer",{attrs:{to:t.buildUrl(t.$route.path,t.$route.query)},scopedSlots:t._u([{key:"default",fn:function(){return[t._t("default")]},proxy:!0},{key:"subhead",fn:function(){return[t._v(t._s(t.$tc("tutorials.title",2)))]},proxy:!0}],null,!0)})],1)},p=[],h=n(9065),v=function(){var t=this,e=t._self._c;return e("nav",{staticClass:"tutorials-navigation"},[e("TutorialsNavigationList",t._l(t.sections,function(n,i){return e("li",{key:`${n.name}_${i}`,class:t.sectionClasses(n)},[t.isVolume(n)?e(t.componentForVolume(n),t._b({tag:"component",on:{"select-menu":t.onSelectMenu,"deselect-menu":t.onDeselectMenu}},"component",t.propsForVolume(n),!1),t._l(n.chapters,function(n){return e("li",{key:n.name},[e("TutorialsNavigationLink",[t._v(" "+t._s(n.name)+" ")])],1)}),0):t.isResources(n)?e("TutorialsNavigationLink",[t._v(" "+t._s(t.$t("sections.resources"))+" ")]):t._e()],1)}),0)],1)},f=[],_=(n(116),function(){var t=this,e=t._self._c;return e("router-link",{staticClass:"tutorials-navigation-link",class:{active:t.active},attrs:{to:t.fragment},nativeOn:{click:function(e){return t.handleFocusAndScroll(t.fragment.hash)}}},[t._t("default")],2)}),g=[],C=n(6043),y=n(9514),A={name:"TutorialsNavigationLink",mixins:[y.A],inject:{store:{default:()=>({state:{}})}},data(){return{state:this.store.state}},computed:{active:({state:{activeTutorialLink:t},text:e})=>e===t,fragment:({text:t,$route:e})=>({hash:(0,C.ql)(t),query:e.query}),text:({$slots:{default:[{text:t}]}})=>t.trim()}},b=A,T=n(1656),S=(0,T.A)(b,_,g,!1,null,"e9f9b59c",null),k=S.exports,V=function(){var t=this,e=t._self._c;return e("ol",{staticClass:"tutorials-navigation-list"},[t._t("default")],2)},x=[],I={name:"TutorialsNavigationList"},N=I,w=(0,T.A)(N,V,x,!1,null,"4e0180fa",null),q=w.exports,L=function(){var t=this,e=t._self._c;return e("div",{staticClass:"tutorials-navigation-menu",class:{collapsed:t.collapsed}},[e("button",{staticClass:"toggle",attrs:{"aria-expanded":t.collapsed?"false":"true",type:"button"},on:{click:function(e){return e.stopPropagation(),t.onClick.apply(null,arguments)}}},[e("span",{staticClass:"text"},[t._v(t._s(t.title))]),e("InlineCloseIcon",{staticClass:"toggle-icon icon-inline"})],1),e("transition-expand",[t.collapsed?t._e():e("div",{staticClass:"tutorials-navigation-menu-content"},[e("TutorialsNavigationList",{attrs:{"aria-label":t.$t("tutorials.nav.chapters")}},[t._t("default")],2)],1)])],1)},$=[],D=n(2223),M=n(6088),F={name:"TutorialsNavigationMenu",components:{InlineCloseIcon:D.A,TransitionExpand:M.A,TutorialsNavigationList:q},props:{collapsed:{type:Boolean,default:!0},title:{type:String,required:!0}},methods:{onClick(){this.collapsed?this.$emit("select-menu",this.title):this.$emit("deselect-menu")}}},R=F,O=(0,T.A)(R,L,$,!1,null,"489416f8",null),j=O.exports;const B={resources:"resources",volume:"volume"};var G={name:"TutorialsNavigation",components:{TutorialsNavigationLink:k,TutorialsNavigationList:q,TutorialsNavigationMenu:j},constants:{SectionKind:B},inject:{store:{default:()=>({setActiveVolume(){}})}},data(){return{state:this.store.state}},props:{sections:{type:Array,required:!0}},computed:{activeVolume:({state:t})=>t.activeVolume},methods:{sectionClasses(t){return{volume:this.isVolume(t),"volume--named":this.isNamedVolume(t),resource:this.isResources(t)}},componentForVolume:({name:t})=>t?j:q,isResources:({kind:t})=>t===B.resources,isVolume:({kind:t})=>t===B.volume,activateFirstNamedVolume(){const{isNamedVolume:t,sections:e}=this,n=e.find(t);n&&this.store.setActiveVolume(n.name)},isNamedVolume(t){return this.isVolume(t)&&t.name},onDeselectMenu(){this.store.setActiveVolume(null)},onSelectMenu(t){this.store.setActiveVolume(t)},propsForVolume({name:t}){const{activeVolume:e}=this;return t?{collapsed:t!==e,title:t}:{"aria-label":"Chapters"}}},created(){this.activateFirstNamedVolume()}},z=G,P=(0,T.A)(z,v,f,!1,null,"79093ed6",null),H=P.exports,E=n(734),K=n(1074),U=n(5273);const Z={resources:"resources",volume:"volume"};var J={name:"Nav",constants:{SectionKind:Z},components:{NavMenuItemBase:U.A,NavTitleContainer:E.A,TutorialsNavigation:H,NavBase:h.A},props:{sections:{type:Array,require:!0}},methods:{buildUrl:K.c$}},Q=J,W=(0,T.A)(Q,d,p,!1,null,"54bcce6d",null),X=W.exports,Y=n(1897),tt=function(){var t=this,e=t._self._c;return e("section",{staticClass:"hero"},[e("div",{staticClass:"copy-container"},[e("h1",{staticClass:"title"},[t._v(t._s(t.title))]),t.content?e("ContentNode",{attrs:{content:t.content}}):t._e(),t.estimatedTime?e("p",{staticClass:"meta"},[e("TimerIcon"),e("span",{staticClass:"meta-content"},[e("strong",{staticClass:"time"},[t._v(t._s(t.estimatedTime))]),e("span",[t._v(" "+t._s(t.$t("tutorials.estimated-time")))])])],1):t._e(),t.action?e("CallToActionButton",{attrs:{action:t.action,"aria-label":t.$t("tutorials.overriding-title",{newTitle:t.action.overridingTitle,title:t.title}),isDark:""}}):t._e()],1),t.image?e("Asset",{attrs:{identifier:t.image}}):t._e()],1)},et=[],nt=n(8486),it=n(1290),st=n(9),ot=function(){var t=this,e=t._self._c;return e("SVGIcon",{staticClass:"timer-icon",attrs:{viewBox:"0 0 14 14",themeId:"timer"}},[e("path",{attrs:{d:"M7 0.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5c-3.59 0-6.5-2.91-6.5-6.5v0c0-3.59 2.91-6.5 6.5-6.5v0zM7 2c-2.761 0-5 2.239-5 5s2.239 5 5 5c2.761 0 5-2.239 5-5v0c0-2.761-2.239-5-5-5v0z"}}),e("path",{attrs:{d:"M6.51 3.51h1.5v3.5h-1.5v-3.5z"}}),e("path",{attrs:{d:"M6.51 7.010h4v1.5h-4v-1.5z"}})])},at=[],rt=n(6515),lt={name:"TimerIcon",components:{SVGIcon:rt.A}},ct=lt,ut=(0,T.A)(ct,ot,at,!1,null,null,null),mt=ut.exports,dt={name:"Hero",components:{Asset:nt.A,CallToActionButton:it.A,ContentNode:st["default"],TimerIcon:mt},props:{action:{type:Object,required:!1},content:{type:Array,required:!1},estimatedTime:{type:String,required:!1},image:{type:String,required:!1},title:{type:String,required:!0}}},pt=dt,ht=(0,T.A)(pt,tt,et,!1,null,"400ffab5",null),vt=ht.exports,ft=function(){var t=this,e=t._self._c;return e("div",{staticClass:"learning-path",class:t.classes},[e("div",{staticClass:"main-container"},[t.isTargetIDE?t._e():e("div",{staticClass:"secondary-content-container"},[e("TutorialsNavigation",{attrs:{sections:t.sections,"aria-label":t.$t("sections.on-this-page")}})],1),e("div",{staticClass:"primary-content-container"},[e("div",{staticClass:"content-sections-container"},[t._l(t.volumes,function(n,i){return e("Volume",t._b({key:`volume_${i}`,staticClass:"content-section"},"Volume",t.propsFor(n),!1))}),t._l(t.otherSections,function(n,i){return e(t.componentFor(n),t._b({key:`resource_${i}`,tag:"component",staticClass:"content-section"},"component",t.propsFor(n),!1))})],2)])])])},_t=[],gt=function(){var t=this,e=t._self._c;return e("section",{staticClass:"resources",attrs:{id:"resources",tabindex:"-1"}},[e("VolumeName",{attrs:{name:t.$t("sections.resources"),content:t.content}}),e("TileGroup",{attrs:{tiles:t.tiles}})],1)},Ct=[],yt=n(8284);const At={topOneThird:"-30% 0% -70% 0%",center:"-50% 0% -50% 0%"};var bt={mixins:[yt.A],computed:{intersectionRoot(){return null},intersectionRootMargin(){return At.center}},methods:{onIntersect(t){if(!t.isIntersecting)return;const e=this.onIntersectViewport;e?e():console.warn("onIntersectViewportCenter not implemented")}}},Tt=function(){var t=this,e=t._self._c;return e("div",{staticClass:"volume-name"},[t.image?e("Asset",{staticClass:"image",attrs:{identifier:t.image,"aria-hidden":"true"}}):t._e(),e("h2",{staticClass:"name"},[t._v(" "+t._s(t.name)+" ")]),t.content?e("ContentNode",{attrs:{content:t.content}}):t._e()],1)},St=[],kt={name:"VolumeName",components:{ContentNode:st["default"],Asset:nt.A},props:{image:{type:String,required:!1},content:{type:Array,required:!1},name:{type:String,required:!1}}},Vt=kt,xt=(0,T.A)(Vt,Tt,St,!1,null,"569db166",null),It=xt.exports,Nt=function(){var t=this,e=t._self._c;return e("div",{staticClass:"tile-group",class:t.countClass},t._l(t.tiles,function(n){return e("Tile",t._b({key:n.title},"Tile",t.propsFor(n),!1))}),1)},wt=[],qt=function(){var t=this,e=t._self._c;return e("div",{staticClass:"tile"},[t.identifier?e("div",{staticClass:"icon"},[e(t.iconComponent,{tag:"component"})],1):t._e(),e("div",{staticClass:"title"},[t._v(t._s(t.title))]),e("ContentNode",{attrs:{content:t.content}}),t.action?e("DestinationDataProvider",{attrs:{destination:t.action},scopedSlots:t._u([{key:"default",fn:function({url:n,title:i}){return[e("Reference",{staticClass:"link",attrs:{url:n}},[t._v(" "+t._s(i)+" "),e("InlineChevronRightIcon",{staticClass:"link-icon icon-inline"})],1)]}}],null,!1,2081312588)}):t._e()],1)},Lt=[],$t=n(5060),Dt=function(){var t=this,e=t._self._c;return e("SVGIcon",{staticClass:"document-icon",attrs:{viewBox:"0 0 14 14",themeId:"document"}},[e("path",{attrs:{d:"M11.2,5.3,8,2l-.1-.1H2.8V12.1h8.5V6.3l-.1-1ZM8,3.2l2,2.1H8Zm2.4,8H3.6V2.8H7V6.3h3.4Z"}})])},Mt=[],Ft={name:"DocumentIcon",components:{SVGIcon:rt.A}},Rt=Ft,Ot=(0,T.A)(Rt,Dt,Mt,!1,null,"3a80772b",null),jt=Ot.exports,Bt=n(1168),Gt=function(){var t=this,e=t._self._c;return e("SVGIcon",{staticClass:"forum-icon",attrs:{viewBox:"0 0 14 14",themeId:"forum"}},[e("path",{attrs:{d:"M13 1v9h-7l-1.5 3-1.5-3h-2v-9zM12 2h-10v7h1.616l0.884 1.763 0.88-1.763h6.62z"}}),e("path",{attrs:{d:"M3 4h8.001v1h-8.001v-1z"}}),e("path",{attrs:{d:"M3 6h8.001v1h-8.001v-1z"}})])},zt=[],Pt={name:"ForumIcon",components:{SVGIcon:rt.A}},Ht=Pt,Et=(0,T.A)(Ht,Gt,zt,!1,null,null,null),Kt=Et.exports,Ut=n(4769),Zt=n(1754),Jt=n(6e3),Qt=n(5411);const Wt={documentation:"documentation",downloads:"downloads",featured:"featured",forums:"forums",sampleCode:"sampleCode",videos:"videos"};var Xt={name:"Tile",constants:{Identifier:Wt},components:{DestinationDataProvider:Qt.A,InlineChevronRightIcon:Jt.A,ContentNode:st["default"],CurlyBracketsIcon:$t.A,DocumentIcon:jt,DownloadIcon:Bt.A,ForumIcon:Kt,PlayIcon:Ut.A,Reference:Zt.A},props:{action:{type:Object,required:!1},content:{type:Array,required:!0},identifier:{type:String,required:!1},title:{type:String,require:!0}},computed:{iconComponent:({identifier:t})=>({[Wt.documentation]:jt,[Wt.downloads]:Bt.A,[Wt.forums]:Kt,[Wt.sampleCode]:$t.A,[Wt.videos]:Ut.A}[t])}},Yt=Xt,te=(0,T.A)(Yt,qt,Lt,!1,null,"74dbeb68",null),ee=te.exports,ne={name:"TileGroup",components:{Tile:ee},props:{tiles:{type:Array,required:!0}},computed:{countClass:({tiles:t})=>`count-${t.length}`},methods:{propsFor:({action:t,content:e,identifier:n,title:i})=>({action:t,content:e,identifier:n,title:i})}},ie=ne,se=(0,T.A)(ie,Nt,wt,!1,null,"4cacce0a",null),oe=se.exports,ae={name:"Resources",mixins:[bt],inject:{store:{default:()=>({setActiveSidebarLink(){},setActiveVolume(){}})}},components:{VolumeName:It,TileGroup:oe},computed:{intersectionRootMargin:()=>At.topOneThird},props:{content:{type:Array,required:!1},tiles:{type:Array,required:!0}},methods:{onIntersectViewport(){this.store.setActiveSidebarLink("Resources"),this.store.setActiveVolume(null)}}},re=ae,le=(0,T.A)(re,gt,Ct,!1,null,"7f8022c1",null),ce=le.exports,ue=function(){var t=this,e=t._self._c;return e("section",{staticClass:"volume"},[t.name?e("VolumeName",t._b({},"VolumeName",{name:t.name,image:t.image,content:t.content},!1)):t._e(),t._l(t.chapters,function(n,i){return e("Chapter",{key:n.name,staticClass:"tile",attrs:{content:n.content,image:n.image,name:n.name,number:i+1,topics:t.lookupTopics(n.tutorials),volumeHasName:!!t.name}})})],2)},me=[],de=function(){var t=this,e=t._self._c;return e("section",{staticClass:"chapter",attrs:{id:t.anchor,tabindex:"-1"}},[e("div",{staticClass:"info"},[e("Asset",{attrs:{identifier:t.image,"aria-hidden":"true"}}),e("div",{staticClass:"intro"},[e(t.volumeHasName?"h3":"h2",{tag:"component",staticClass:"name",attrs:{"aria-label":`${t.name} - ${t.$tc("tutorials.sections.chapter",{number:t.number})}`}},[e("span",{staticClass:"eyebrow",attrs:{"aria-hidden":"true"}},[t._v(" "+t._s(t.$t("tutorials.sections.chapter",{number:t.number}))+" ")]),e("span",{staticClass:"name-text",attrs:{"aria-hidden":"true"}},[t._v(t._s(t.name))])]),t.content?e("ContentNode",{attrs:{content:t.content}}):t._e()],1)],1),e("TopicList",{attrs:{topics:t.topics}})],1)},pe=[],he=function(){var t=this,e=t._self._c;return e("ol",{staticClass:"topic-list"},t._l(t.topics,function(n){return e("li",{key:n.url,staticClass:"topic",class:[t.kindClassFor(n),{"no-time-estimate":!n.estimatedTime}]},[e("div",{staticClass:"topic-icon"},[e(t.iconComponent(n),{tag:"component"})],1),e("router-link",{staticClass:"container",attrs:{to:t.buildUrl(n.url,t.$route.query),"aria-label":t.ariaLabelFor(n)}},[e("div",{staticClass:"link"},[t._v(t._s(n.title))]),n.estimatedTime?e("div",{staticClass:"time"},[e("TimerIcon"),e("span",{staticClass:"time-label"},[t._v(t._s(n.estimatedTime))])],1):t._e()])],1)}),0)},ve=[],fe=(n(4114),n(1789)),_e=n(3818);const ge={article:"article",tutorial:"project"},Ce={article:"article",tutorial:"tutorial"},ye={[ge.article]:"Article",[ge.tutorial]:"Tutorial"};var Ae={name:"ChapterTopicList",components:{TimerIcon:mt},constants:{TopicKind:ge,TopicKindClass:Ce,TopicKindIconLabel:ye},props:{topics:{type:Array,required:!0}},methods:{buildUrl:K.c$,iconComponent:({kind:t})=>({[ge.article]:fe.A,[ge.tutorial]:_e.A}[t]),kindClassFor:({kind:t})=>({[ge.article]:Ce.article,[ge.tutorial]:Ce.tutorial}[t]),formatTime(t){return t.replace("min",` ${this.$t("tutorials.time.minutes.full")}`).replace("hrs",` ${this.$t("tutorials.time.hours.full")}`)},ariaLabelFor(t){const{title:e,estimatedTime:n,kind:i}=t,s=[e,ye[i]];return n&&s.push(`${this.formatTime(n)} ${this.$t("tutorials.estimated-time")}`),s.join(" - ")}}},be=Ae,Te=(0,T.A)(be,he,ve,!1,null,"0589dc3b",null),Se=Te.exports,ke={name:"Chapter",mixins:[bt],inject:{store:{default:()=>({setActiveSidebarLink(){},setActiveVolume(){}})}},components:{Asset:nt.A,ContentNode:st["default"],TopicList:Se},props:{content:{type:Array,required:!1},image:{type:String,required:!0},name:{type:String,required:!0},number:{type:Number,required:!0},topics:{type:Array,required:!0},volumeHasName:{type:Boolean,default:!1}},computed:{anchor:({name:t})=>(0,C.ql)(t),intersectionRootMargin:()=>At.topOneThird},methods:{onIntersectViewport(){this.store.setActiveSidebarLink(this.name),this.volumeHasName||this.store.setActiveVolume(null)}}},Ve=ke,xe=(0,T.A)(Ve,de,pe,!1,null,"7468bc5e",null),Ie=xe.exports,Ne={name:"Volume",mixins:[bt],components:{VolumeName:It,Chapter:Ie},computed:{references:({store:t})=>t.state.references,intersectionRootMargin:()=>At.topOneThird},inject:{store:{default:()=>({setActiveVolume(){},state:{references:{}}})}},props:{chapters:{type:Array,required:!0},content:{type:Array,required:!1},image:{type:String,required:!1},name:{type:String,required:!1}},methods:{lookupTopics(t){return t.reduce((t,e)=>t.concat(this.references[e]||[]),[])},onIntersectViewport(){this.name&&this.store.setActiveVolume(this.name)}}},we=Ne,qe=(0,T.A)(we,ue,me,!1,null,"540dbf10",null),Le=qe.exports;const $e={resources:"resources",volume:"volume"};var De={name:"LearningPath",components:{Resources:ce,TutorialsNavigation:H,Volume:Le},constants:{SectionKind:$e},inject:{isTargetIDE:{default:!1}},props:{sections:{type:Array,required:!0,validator:t=>t.every(t=>Object.prototype.hasOwnProperty.call($e,t.kind))}},computed:{classes:({isTargetIDE:t})=>({ide:t}),partitionedSections:({sections:t})=>t.reduce(([t,e],n)=>n.kind===$e.volume?[t.concat(n),e]:[t,e.concat(n)],[[],[]]),volumes:({partitionedSections:t})=>t[0],otherSections:({partitionedSections:t})=>t[1]},methods:{componentFor:({kind:t})=>({[$e.resources]:ce,[$e.volume]:Le}[t]),propsFor:({chapters:t,content:e,image:n,kind:i,name:s,tiles:o})=>({[$e.resources]:{content:e,tiles:o},[$e.volume]:{chapters:t,content:e,image:n,name:s}}[i])}},Me=De,Fe=(0,T.A)(Me,ft,_t,!1,null,"69a72bbc",null),Re=Fe.exports;const Oe={hero:"hero",resources:"resources",volume:"volume"};var je={name:"TutorialsOverview",components:{Hero:vt,LearningPath:Re,Nav:X},mixins:[Y.A],constants:{SectionKind:Oe},inject:{isTargetIDE:{default:!1}},props:{metadata:{type:Object,default:()=>({})},references:{type:Object,default:()=>({})},sections:{type:Array,default:()=>[],validator:t=>t.every(t=>Object.prototype.hasOwnProperty.call(Oe,t.kind))}},computed:{pageTitle:({title:t})=>[t,"Tutorials"].filter(Boolean).join(" "),pageDescription:({heroSection:t,extractFirstParagraphText:e})=>t?e(t.content):null,partitionedSections:({sections:t})=>t.reduce(([t,e],n)=>n.kind===Oe.hero?[t.concat(n),e]:[t,e.concat(n)],[[],[]]),heroSections:({partitionedSections:t})=>t[0],otherSections:({partitionedSections:t})=>t[1],heroSection:({heroSections:t})=>t[0],store:()=>m,title:({metadata:{category:t=""}})=>t},provide(){return{store:this.store}},created(){u.A.setAvailableLocales(this.metadata.availableLanguages??this.metadata.availableLocales),this.store.reset(),this.store.setReferences(this.references)},watch:{references(t){this.store.setReferences(t)},"metadata.availableLocales":function(t){u.A.setAvailableLocales(this.metadata?.availableLanguages??t)},"metadata.availableLanguages":function(t){u.A.setAvailableLocales(t)}}},Be=je,Ge=(0,T.A)(Be,l,c,!1,null,"5a621b2e",null),ze=Ge.exports,Pe=n(4602),He={name:"TutorialsOverview",components:{Overview:ze},mixins:[r.A,Pe.A],data(){return{topicData:null}},computed:{overviewProps:({topicData:{metadata:t,references:e,sections:n}})=>({metadata:t,references:e,sections:n}),topicKey:({$route:t,topicData:e})=>[t.path,e.identifier.interfaceLanguage].join()},beforeRouteEnter(t,e,n){t.meta.skipFetchingData?n(t=>t.newContentMounted()):(0,a.Dk)(t,e,n).then(e=>n(n=>{(0,o.cu)(t.params.locale,n),n.topicData=e})).catch(n)},beforeRouteUpdate(t,e,n){(0,a.JR)(t,e)?(0,a.Dk)(t,e,n).then(e=>{this.topicData=e,(0,o.cu)(t.params.locale,this),n()}).catch(n):n()},mounted(){this.$bridge.on("contentUpdate",this.handleContentUpdateFromBridge)},beforeDestroy(){this.$bridge.off("contentUpdate",this.handleContentUpdateFromBridge)},watch:{topicData(){this.$nextTick(()=>{this.newContentMounted()})}}},Ee=He,Ke=(0,T.A)(Ee,i,s,!1,null,null,null),Ue=Ke.exports},6088:function(t,e,n){n.d(e,{A:function(){return c}});var i,s,o={name:"TransitionExpand",functional:!0,render(t,e){const n={props:{name:"expand"},on:{afterEnter(t){t.style.height="auto"},enter(t){const{width:e}=getComputedStyle(t);t.style.width=e,t.style.position="absolute",t.style.visibility="hidden",t.style.height="auto";const{height:n}=getComputedStyle(t);t.style.width=null,t.style.position=null,t.style.visibility=null,t.style.height=0,getComputedStyle(t).height,requestAnimationFrame(()=>{t.style.height=n})},leave(t){const{height:e}=getComputedStyle(t);t.style.height=e,getComputedStyle(t).height,requestAnimationFrame(()=>{t.style.height=0})}}};return t("transition",n,e.children)}},a=o,r=n(1656),l=(0,r.A)(a,i,s,!1,null,null,null),c=l.exports}}]); \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/metadata.json b/Containers/Supporting Files/Help.bundle/metadata.json new file mode 100644 index 0000000..feed740 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/metadata.json @@ -0,0 +1 @@ +{"bundleID":"app.containers.Containers","bundleDisplayName":"Containers","schemaVersion":{"minor":1,"major":0,"patch":0}} \ No newline at end of file diff --git a/Containers/Supporting Files/Help.bundle/scripts/docs.js b/Containers/Supporting Files/Help.bundle/scripts/docs.js new file mode 100644 index 0000000..c9e39a0 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/scripts/docs.js @@ -0,0 +1,23 @@ +// Added to the DocC pages by scripts/build-website.sh. + +// The Containers app shows the documentation in its help window, and adds this to its web +// view's user agent. There, the website's footer is hidden, and the page follows the app's +// appearance instead of the one saved on the website. +const isInAppHelp = navigator.userAgent.includes("ContainersHelp"); + +if (isInAppHelp) { + document.documentElement.dataset.inAppHelp = ""; + document.body.dataset.colorScheme = "auto"; +} else { + // DocC applies the saved appearance to the body from its own footer, which the custom + // footer replaces, so this applies it instead. The custom footer's selector updates it + // after that. + try { + const scheme = localStorage.getItem("developer.setting.preferredColorScheme"); + if (scheme) { + document.body.dataset.colorScheme = scheme; + } + } catch { + // Private browsing can refuse storage; DocC's default, Auto, applies. + } +} diff --git a/Containers/Supporting Files/Help.bundle/styles/docs.css b/Containers/Supporting Files/Help.bundle/styles/docs.css new file mode 100644 index 0000000..3a87cb8 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/styles/docs.css @@ -0,0 +1,26 @@ +/* Added to the DocC pages by scripts/build-website.sh. DocC's theme settings + cover fonts and icons but not weights, so this gives titles and headings the same + semibold weight as the landing page. `#app` outranks DocC's scoped selectors. */ + +#app h1, +#app h2, +#app h3 { + font-weight: 600; +} + +#app h1 { + letter-spacing: -0.003em; +} + +/* In the app's help window, set by docs.js, the website's breadcrumbs, appearance + selector and legal links don't apply. */ +html[data-in-app-help] custom-footer { + display: none; +} + +/* The app's help window has its own sidebar, breadcrumbs and search, as Xcode's documentation + window does, so DocC's navigation bar and navigator give way to the article. */ +html[data-in-app-help] .documentation-nav, +html[data-in-app-help] .adjustable-sidebar-width > .sidebar { + display: none; +} diff --git a/Containers/Supporting Files/Help.bundle/theme-settings.json b/Containers/Supporting Files/Help.bundle/theme-settings.json new file mode 100644 index 0000000..21d3cf9 --- /dev/null +++ b/Containers/Supporting Files/Help.bundle/theme-settings.json @@ -0,0 +1,26 @@ +{ + "theme": { + "typography": { + "html-font": "-apple-system, BlinkMacSystemFont, \"SF Pro Text\", \"SF Pro Icons\", \"Helvetica Neue\", Helvetica, Arial, sans-serif", + "html-font-mono": "ui-monospace, \"SF Mono\", SFMono-Regular, Menlo, monospace" + }, + "icons": { + "article": "/icons/article.svg", + "collection": "/icons/collection.svg", + "technology": "/icons/collection.svg", + "sidenav": "/icons/sidenav.svg" + }, + "device-frames": { + "macbook-pro": { + "frameWidth": 690, + "frameHeight": 433, + "screenLeft": 71, + "screenTop": 20, + "screenWidth": 548, + "screenHeight": 360, + "lightUrl": "/device-frames/macbook-pro.svg", + "darkUrl": "/device-frames/macbook-pro-dark.svg" + } + } + } +} diff --git a/Containers/Utilities/ActivityCenter.swift b/Containers/Utilities/ActivityCenter.swift index 3e0aedf..a302db8 100644 --- a/Containers/Utilities/ActivityCenter.swift +++ b/Containers/Utilities/ActivityCenter.swift @@ -5,268 +5,342 @@ // Created by Axel Martinez on 12/09/2026. // -import ContainerSystem +import ContainersCore import Foundation import Observation +/// An action the user took anywhere in the app. It executes until its +/// work is done and the lists showing its resources have read the outcome. @Observable @MainActor -final class ActivityCenter { - enum Kind: Hashable { - case image - case container - case volume +final class ContainerSystemTask: Identifiable { + /// What a task works on, which identifies it, as two tasks never work on + /// the same thing at once: a resource, or the archive a load reads. + nonisolated enum Subject: Hashable, Sendable { + case resource(ResourceID) + /// A load, which learns the image it makes only once it has read the archive. + case archive(URL) } - /// An action the user took anywhere in the app. It executes until its - /// work is done and the lists showing its items have read the outcome. - @Observable - @MainActor - final class Activity: Identifiable { - /// Can change once the work reveals it, as loading an archive does. - fileprivate(set) var id: String - fileprivate(set) var title: String - fileprivate(set) var error: (any Error)? - fileprivate(set) var reportID: String? - fileprivate(set) var isStopped = false - fileprivate(set) var startedAt: Date? - /// A new one for every run, so a retry starts from nothing. - fileprivate(set) var progress: ProgressObserver? - - fileprivate var task: Task? - - /// A stopped run can take a moment to wind down, and must not speak - /// for a retry begun since. - @ObservationIgnored fileprivate var attempt = 0 - - fileprivate let work: (Progress) async throws -> String? - - let kind: Kind - let subtitle: String - let canRetry: Bool - let failureTitle: String - /// Off where the item's own state already shows the work under way. - let showsProgress: Bool - - /// One that succeeded is dropped, so only a failure or a stop ends it. - var isExecuting: Bool { - error == nil && !isStopped - } + nonisolated let id: Subject + /// What the work acts on or makes. Learned as the work goes where it + /// isn't known in advance, as loading an archive learns its image. + fileprivate(set) var target: ResourceID? + /// Every resource the work makes, which no other work can start on while it runs. Only work that + /// learns what it makes claims them, as a load that holds several images does. + @ObservationIgnored fileprivate var claims: Set = [] + fileprivate(set) var title: String + fileprivate(set) var error: (any Error)? + fileprivate(set) var reportID: String? + fileprivate(set) var isStopped = false + fileprivate(set) var startedAt: Date? + /// A new one for every run, so a retry starts from nothing. + fileprivate(set) var progress: ProgressObserver? + + fileprivate var execution: Task? + + /// A stopped run can take a moment to wind down, and must not speak + /// for a retry begun since. + @ObservationIgnored fileprivate var attempt = 0 + + fileprivate let work: (Progress) async throws -> ResourceID? + + /// The kind of resource the work acts on or makes, known even before its target is. + let kind: ResourceID.Kind + let subtitle: String + let canRetry: Bool + let failureTitle: String + /// Off where the resource's own state already shows the work under way. + let showsProgress: Bool + + /// One that succeeded is dropped, so only a failure or a stop ends it. + var isExecuting: Bool { + error == nil && !isStopped + } - fileprivate init( - id: String, - kind: Kind, - title: String, - subtitle: String, - failureTitle: String, - canRetry: Bool, - showsProgress: Bool, - work: @escaping (Progress) async throws -> String? - ) { - self.id = id - self.kind = kind - self.title = title - self.subtitle = subtitle - self.failureTitle = failureTitle - self.canRetry = canRetry - self.showsProgress = showsProgress - self.work = work - } + fileprivate init( + id: Subject, + kind: ResourceID.Kind, + target: ResourceID?, + title: String, + subtitle: String, + failureTitle: String, + canRetry: Bool, + showsProgress: Bool, + work: @escaping (Progress) async throws -> ResourceID? + ) { + self.id = id + self.kind = kind + self.target = target + self.title = title + self.subtitle = subtitle + self.failureTitle = failureTitle + self.canRetry = canRetry + self.showsProgress = showsProgress + self.work = work + } - fileprivate func reportKind(for error: any Error) -> Report.Kind { - if error is BuildFailure { return .build } + /// Whether the work acts on or makes `target`. + fileprivate func covers(_ target: ResourceID) -> Bool { + self.target == target || claims.contains(target) + } - switch kind { - case .image: return .image - case .container: return .container - case .volume: return .volume - } + fileprivate func reportKind(for error: any Error) -> Report.Kind { + if error is BuildFailure { return .build } + + switch kind { + case .image: return .image + case .container: return .container + case .volume: return .volume } } +} + +/// Work refused because other work on the same resource is under way. +struct WorkUnderWayError: LocalizedError { + let target: ResourceID + + var errorDescription: String? { + "“\(target.name)” is being changed by other work. Try again once it has finished." + } +} - private(set) var activities: [Activity] = [] +@Observable +@MainActor +final class ActivityCenter { + private(set) var tasks: [ContainerSystemTask] = [] - /// The lists on screen, so an activity can wait for them to read its + /// The lists on screen, so a task can wait for them to read its /// outcome before it stops executing. - @ObservationIgnored private var listReloaders: [Kind: [UUID: () async -> Void]] = [:] + @ObservationIgnored private var listReloaders: [ResourceID.Kind: [UUID: () async -> Void]] = [:] - private let reports: ReportManager + private let reportManager: ReportManager - init(reports: ReportManager) { - self.reports = reports + init(reportManager: ReportManager) { + self.reportManager = reportManager } - func activities(ofKind kind: Kind) -> [Activity] { - activities.filter { $0.kind == kind && !isSpent($0) } + func tasks(ofKind kind: ResourceID.Kind) -> [ContainerSystemTask] { + tasks.filter { $0.kind == kind && !isSpent($0) } } - /// Does nothing if the same work is already under way. `work` answers - /// with what it made, where that isn't known in advance. + /// Starts work on `target`, in place of work there that has ended. Does + /// nothing while other work on it executes, which its row already shows. func start( - id: String, - kind: Kind, - title: String, + on target: ResourceID, + title: String? = nil, subtitle: String = "", failureTitle: String, canRetry: Bool = true, showsProgress: Bool = true, - work: @escaping (Progress) async throws -> String? + work: @escaping (Progress) async throws -> Void ) { - guard !activities.contains(where: { $0.id == id && $0.kind == kind }) else { - return + if let earlier = task(on: target) { + guard !earlier.isExecuting else { return } + drop(earlier) } - let activity = Activity( - id: id, - kind: kind, - title: title, - subtitle: subtitle, - failureTitle: failureTitle, - canRetry: canRetry, - showsProgress: showsProgress, - work: work + add( + ContainerSystemTask( + id: .resource(target), + kind: target.kind, + target: target, + title: title ?? target.name, + subtitle: subtitle, + failureTitle: failureTitle, + canRetry: canRetry, + showsProgress: showsProgress + ) { progress in + try await work(progress) + return nil + } ) + } - activities.append(activity) - run(activity) + /// Starts work that makes a resource of `kind` from `archive`, which it + /// learns only as it goes and `work` answers with. Does nothing while + /// other work on the archive executes. + func start( + making kind: ResourceID.Kind, + from archive: URL, + title: String? = nil, + subtitle: String = "", + failureTitle: String, + canRetry: Bool = true, + showsProgress: Bool = true, + work: @escaping (Progress) async throws -> ResourceID? + ) { + if let earlier = task(.archive(archive)) { + guard !earlier.isExecuting else { return } + drop(earlier) + } + + add( + ContainerSystemTask( + id: .archive(archive), + kind: kind, + target: nil, + title: title ?? archive.lastPathComponent, + subtitle: subtitle, + failureTitle: failureTitle, + canRetry: canRetry, + showsProgress: showsProgress, + work: work + ) + ) } - func stop(_ id: String) { - guard let activity = activity(id), activity.isExecuting else { return } + func stop(_ id: ContainerSystemTask.ID) { + guard let task = task(id), task.isExecuting else { return } - activity.isStopped = true - activity.task?.cancel() + task.isStopped = true + task.execution?.cancel() } - func retry(_ id: String) { - guard let activity = activity(id), activity.canRetry, - !activity.isExecuting + func retry(_ id: ContainerSystemTask.ID) { + guard let task = task(id), task.canRetry, + !task.isExecuting else { return } - activity.error = nil - activity.reportID = nil - activity.isStopped = false + task.error = nil + task.reportID = nil + task.isStopped = false - run(activity) + run(task) } - func run( - on id: String, - kind: Kind, - subtitle: String = "", - failureTitle: String, - showsProgress: Bool = true, - work: @escaping () async throws -> Void - ) { - if let earlier = activity(id), !earlier.isExecuting { - drop(earlier) + func isWorking(on target: ResourceID) -> Bool { + task(on: target)?.isExecuting == true + } + + /// Claims `targets` for the work on `subject`, which learns what it will make before it makes it, as a + /// load does once it has read the archive. From then on, no other work starts on them, and the work's + /// row becomes the first one's. + /// + /// - Parameters: + /// - targets: What the work will make. + /// - subject: The work's subject. + /// - Throws: ``WorkUnderWayError`` if other work on any of them executes, which the work should fail with + /// before it makes anything. + func claim(_ targets: [ResourceID], forWorkOn subject: ContainerSystemTask.Subject) throws { + guard let task = task(subject), task.isExecuting else { return } + + let others = tasks.filter { other in other !== task && targets.contains(where: other.covers) } + + if let busy = others.first(where: \.isExecuting), let target = targets.first(where: busy.covers) { + throw WorkUnderWayError(target: target) } - start( - id: id, - kind: kind, - title: id, - subtitle: subtitle, - failureTitle: failureTitle, - showsProgress: showsProgress - ) { _ in - try await work() - return nil + // Work on them that has ended goes, as starting work on a resource replaces it. + for other in others { + drop(other) } - } - func isWorking(on id: String) -> Bool { - activities.contains { $0.id == id && $0.isExecuting } + task.claims = Set(targets) + + if task.target == nil { + task.target = targets.first + } } - /// Registers a list on screen that shows items of `kind`. Remove it + /// Registers a list on screen that shows resources of `kind`. Remove it /// with `removeListReloader(_:ofKind:)` once the list goes. - func addListReloader(_ id: UUID, ofKind kind: Kind, reload: @escaping () async -> Void) { + func addListReloader(_ id: UUID, ofKind kind: ResourceID.Kind, reload: @escaping () async -> Void) { listReloaders[kind, default: [:]][id] = reload } - func removeListReloader(_ id: UUID, ofKind kind: Kind) { + func removeListReloader(_ id: UUID, ofKind kind: ResourceID.Kind) { listReloaders[kind]?[id] = nil } - func remove(_ id: String) { - guard let activity = activity(id) else { return } + func remove(_ id: ContainerSystemTask.ID) { + guard let task = task(id) else { return } - activity.task?.cancel() - drop(activity) + task.execution?.cancel() + drop(task) } func forgetFailures(reportedAs reportIDs: Set) { - activities.removeAll { activity in - !activity.isExecuting && activity.reportID.map(reportIDs.contains) == true + tasks.removeAll { task in + !task.isExecuting && task.reportID.map(reportIDs.contains) == true } } /// A failure's mark leads to its report, so once that is read it goes. - private func isSpent(_ activity: Activity) -> Bool { - guard activity.error != nil, let reportID = activity.reportID else { + private func isSpent(_ task: ContainerSystemTask) -> Bool { + guard task.error != nil, let reportID = task.reportID else { return false } - return reports.isRead(reportID) + return reportManager.isRead(id: reportID) } - private func activity(_ id: String) -> Activity? { - activities.first { $0.id == id } + private func task(_ id: ContainerSystemTask.ID) -> ContainerSystemTask? { + tasks.first { $0.id == id } } - private func run(_ activity: Activity) { - activity.attempt += 1 - activity.startedAt = Date() + /// There is only ever one, as work doesn't start on a target while other work on it executes. + private func task(on target: ResourceID) -> ContainerSystemTask? { + tasks.first { $0.covers(target) } + } + + private func add(_ task: ContainerSystemTask) { + tasks.append(task) + run(task) + } - let attempt = activity.attempt - let reports = reports + private func run(_ task: ContainerSystemTask) { + task.attempt += 1 + task.startedAt = Date() + + let attempt = task.attempt + let reportManager = reportManager let progress = Progress.discreteProgress(totalUnitCount: 0) - activity.progress = ProgressObserver(progress) - activity.task = Task { [weak self] in + task.progress = ProgressObserver(progress) + task.execution = Task { [weak self] in do { - let made = try await activity.work(progress) + let made = try await task.work(progress) - guard activity.attempt == attempt else { return } + guard task.attempt == attempt else { return } - if let made, made != activity.id { - activity.id = made - activity.title = made + if let made, made != task.target { + task.target = made + task.title = made.name } - await self?.reloadLists(ofKind: activity.kind) + await self?.reloadLists(ofKind: task.kind) - self?.drop(activity) + self?.drop(task) } catch { - guard activity.attempt == attempt, !activity.isStopped else { return } + guard task.attempt == attempt, !task.isStopped else { return } - // A failed action can still have changed its item. - await self?.reloadLists(ofKind: activity.kind) + // A failed action can still have changed its resource. + await self?.reloadLists(ofKind: task.kind) - guard activity.attempt == attempt, !activity.isStopped else { return } + guard task.attempt == attempt, !task.isStopped else { return } - activity.error = error + task.error = error - let entry = await reports.record( - kind: activity.reportKind(for: error), - name: activity.title, - message: activity.failureTitle, + let entry = await reportManager.record( + kind: task.reportKind(for: error), + name: task.title, + message: task.failureTitle, error: error, - startedAt: activity.startedAt + startedAt: task.startedAt ) - activity.reportID = entry?.id + task.reportID = entry?.id } } } /// A list that isn't on screen reads everything again when it appears. - /// Unstructured, so stopping the activity can't cancel a list's load + /// Unstructured, so stopping the task can't cancel a list's load /// and have it report a failure. - private func reloadLists(ofKind kind: Kind) async { + private func reloadLists(ofKind kind: ResourceID.Kind) async { let reloaders = listReloaders[kind, default: [:]].values await Task { @@ -276,53 +350,51 @@ final class ActivityCenter { }.value } - private func drop(_ activity: Activity) { - activities.removeAll { $0 === activity } + private func drop(_ task: ContainerSystemTask) { + tasks.removeAll { $0 === task } } } -// MARK: - Rows +// MARK: - Entries extension ActivityCenter { - /// Attaches each row's work, or else an unread failure reported under the - /// name `reportName` gives it, where it gives one. + /// Entries for `resources`, each with the work under way on it, or else + /// the unread failure reported about it where `showsReport` allows. /// - /// Given `pendingRow`, work of `kind` with no row yet gets one, keyed by - /// the item it will make, so it becomes that item's row in place. - func marked( - _ rows: [Row], - ofKind kind: Kind, - reportName: (Row) -> String?, + /// With `includesPending`, work of `kind` with no entry yet gets one, keyed + /// by what it will make, so it becomes that resource's entry in place. + func entries( + for resources: [Resource], + ofKind kind: ResourceID.Kind, reportKinds: Set, - pendingRow: ((ActivitySnapshot) -> Row)? = nil - ) -> [Row] { - let working = activities(ofKind: kind) - - let marked = rows.map { row in - var row = row - - if let activity = working.first(where: { $0.id == row.id }) { - row.activity = ActivitySnapshot(activity) - } else if let name = reportName(row), - let report = reports.latestReport(named: name, ofKind: reportKinds), + showsReport: (Resource) -> Bool = { _ in true }, + isInUse: (Resource) -> Bool = { _ in false }, + includesPending: Bool = false + ) -> [ResourceEntry] { + let working = tasks(ofKind: kind) + let entries = resources.map { resource in + var entry = ResourceEntry(resource, isInUse: isInUse(resource)) + + if let task = working.first(where: { $0.target == resource.resourceID }) { + entry.task = ContainerSystemTask.Snapshot(task) + } else if showsReport(resource), + let report = reportManager.latestReport(named: resource.resourceID.name, ofKind: reportKinds), !report.isRead { - // Keyed by the row: an image is reported under the reference - // asked for, but its row is known by the resolved one. - row.activity = ActivitySnapshot(report: report, id: row.id) + entry.task = ContainerSystemTask.Snapshot(report: report) } - return row + return entry } - guard let pendingRow else { return marked } + guard includesPending else { return entries } - let markedIDs = Set(marked.map(\.id)) + let shownIDs = Set(entries.map(\.id)) let pending = working - .filter { !markedIDs.contains($0.id) } - .map { pendingRow(ActivitySnapshot($0)) } + .map { ResourceEntry(pending: $0) } + .filter { !shownIDs.contains($0.id) } - return pending + marked + return pending + entries } } diff --git a/Containers/Extensions/Foundation/Bundle+Version.swift b/Containers/Utilities/Bundle+Version.swift similarity index 100% rename from Containers/Extensions/Foundation/Bundle+Version.swift rename to Containers/Utilities/Bundle+Version.swift diff --git a/Containers/Extensions/Foundation/CGFloat+Layout.swift b/Containers/Utilities/CGFloat+Layout.swift similarity index 75% rename from Containers/Extensions/Foundation/CGFloat+Layout.swift rename to Containers/Utilities/CGFloat+Layout.swift index c648409..3f98e94 100644 --- a/Containers/Extensions/Foundation/CGFloat+Layout.swift +++ b/Containers/Utilities/CGFloat+Layout.swift @@ -13,6 +13,10 @@ extension CGFloat { static let fieldControlWidth: CGFloat = 260 + /// Shared by the sheets that create images, containers and volumes, so they match. + static let createSheetWidth: CGFloat = 660 + static let createSheetHeight: CGFloat = 480 + /// Between a sheet's progress or failure mark and the text below it. nonisolated static let sheetMarkSpacing: CGFloat = 12 diff --git a/Containers/Utilities/NSApplication+ActivationPolicy.swift b/Containers/Utilities/NSApplication+ActivationPolicy.swift new file mode 100644 index 0000000..dec3a60 --- /dev/null +++ b/Containers/Utilities/NSApplication+ActivationPolicy.swift @@ -0,0 +1,49 @@ +// +// NSApplication+ActivationPolicy.swift +// Containers +// +// Created by Axel Martinez on 2026/10/30. +// + +import AppKit + +extension NSApplication { + /// Keeps a menu bar only app in the Dock, with its menus in the menu bar, while one of its windows is open. + /// + /// An accessory app has neither, so the dashboard and Settings would lose ⌘-Tab, the app's menus and their shortcuts. + func beginUpdatingActivationPolicy() { + let center = NotificationCenter.default + + center.addObserver(forName: NSWindow.didBecomeKeyNotification, object: nil, queue: .main) { _ in + MainActor.assumeIsolated { NSApp.updateActivationPolicy() } + } + + center.addObserver(forName: NSWindow.willCloseNotification, object: nil, queue: .main) { notification in + // Still listed as open while it closes. + let closing = (notification.object as? NSWindow).map(ObjectIdentifier.init) + + MainActor.assumeIsolated { NSApp.updateActivationPolicy(closing: closing) } + } + + updateActivationPolicy() + } + + /// Makes the app regular while one of its windows is open, and an accessory otherwise when its icon is in the menu bar. + /// + /// - Parameter closingWindow: A window that's closing, and still listed as open. + func updateActivationPolicy(closing closingWindow: ObjectIdentifier? = nil) { + let hasOpenWindow = windows.contains { window in + ObjectIdentifier(window) != closingWindow && window.canBecomeMain && (window.isVisible || window.isMiniaturized) + } + let policy: ActivationPolicy = UserDefaults.appIconPlacement == .menuBar && !hasOpenWindow ? .accessory : .regular + + guard activationPolicy() != policy else { return } + + setActivationPolicy(policy) + + // A newly regular app shows its menus only once it's active. + if policy == .regular { + activate() + } + } +} diff --git a/Containers/Utilities/NSSavePanel+Sheet.swift b/Containers/Utilities/NSSavePanel+Sheet.swift new file mode 100644 index 0000000..044c483 --- /dev/null +++ b/Containers/Utilities/NSSavePanel+Sheet.swift @@ -0,0 +1,26 @@ +// +// NSSavePanel+Sheet.swift +// Containers +// +// Created by Axel Martinez on 30/10/2026. +// + +import AppKit + +extension NSSavePanel { + /// Attaches the panel to the key window, which is the sheet when one is open, or runs it on its own without one. + /// - Returns: The chosen URL, or `nil` if the user cancelled. + func presentAsSheet() async -> URL? { + let response: NSApplication.ModalResponse + + if let window = NSApp.keyWindow { + response = await beginSheetModal(for: window) + } else { + response = runModal() + } + + guard response == .OK else { return nil } + + return url + } +} diff --git a/Containers/Extensions/AppKit/NSToolbar+Shape.swift b/Containers/Utilities/NSToolbar+Shape.swift similarity index 100% rename from Containers/Extensions/AppKit/NSToolbar+Shape.swift rename to Containers/Utilities/NSToolbar+Shape.swift diff --git a/Containers/Extensions/SwiftUI/OpenWindowAction+Report.swift b/Containers/Utilities/OpenWindowAction+Report.swift similarity index 100% rename from Containers/Extensions/SwiftUI/OpenWindowAction+Report.swift rename to Containers/Utilities/OpenWindowAction+Report.swift diff --git a/Containers/Extensions/Foundation/URL+Properties.swift b/Containers/Utilities/URL+Properties.swift similarity index 100% rename from Containers/Extensions/Foundation/URL+Properties.swift rename to Containers/Utilities/URL+Properties.swift diff --git a/Containers/Extensions/Foundation/UserDefaults+Settings.swift b/Containers/Utilities/UserDefaults+Settings.swift similarity index 93% rename from Containers/Extensions/Foundation/UserDefaults+Settings.swift rename to Containers/Utilities/UserDefaults+Settings.swift index 2a55562..9d7f1b0 100644 --- a/Containers/Extensions/Foundation/UserDefaults+Settings.swift +++ b/Containers/Utilities/UserDefaults+Settings.swift @@ -5,6 +5,7 @@ // Created by Axel Martinez on 02/02/26. // +import ContainersCore import Foundation @propertyWrapper @@ -39,11 +40,22 @@ extension UserDefaults { @UserDefault(key: "shutdownSystemTimeoutSeconds", defaultValue: 20) static var shutdownSystemTimeoutSeconds: Int32 + static let appIconPlacementKey = "appIconPlacement" + + static var appIconPlacement: AppIconPlacement { + UserDefaults.standard.string(forKey: appIconPlacementKey).flatMap(AppIconPlacement.init(rawValue:)) ?? .dockAndMenuBar + } + + static let startsSystemOnOpenKey = "startsSystemOnOpen" + + @UserDefault(key: startsSystemOnOpenKey, defaultValue: true) + static var startsSystemOnOpen: Bool + private static let applicationDataRootKey = "applicationDataRoot" private static let applicationDataRootBookmarkKey = "applicationDataRootBookmark" private static let resolverDirectoryBookmarkKey = "resolverDirectoryBookmark" - /// Named for the bundle, as Apple's `container` names its root. + /// Named for the bundle static var defaultAppRoot: URL { applicationSupport.appendingPathComponent( Foundation.Bundle.main.bundleIdentifier ?? "app.containers.Containers" diff --git a/Containers/ViewModels/SystemActions.swift b/Containers/ViewModels/SystemActions.swift index 76ca556..02fb4ce 100644 --- a/Containers/ViewModels/SystemActions.swift +++ b/Containers/ViewModels/SystemActions.swift @@ -6,7 +6,7 @@ // import AppKit -import ContainerSystem +import ContainersCore import Foundation import Observation @@ -23,19 +23,26 @@ final class SystemActions { struct Failure: Error { let title: String let underlying: any Error + + @MainActor var alert: ErrorAlert { + ErrorAlert(title, error: underlying) + } } /// The action under way, if any. private(set) var working: Action? - private let manager: SystemManager + /// Whether a start the user asked for is waiting for them to agree to download the kernel. + private(set) var isAskingForKernel = false - init(manager: SystemManager) { - self.manager = manager + private let containerSystem: ContainerSystem + + init(containerSystem: ContainerSystem) { + self.containerSystem = containerSystem } - var isRunning: Bool { - manager.status == .running + private var isRunning: Bool { + containerSystem.status == .running } func title(for action: Action) -> String { @@ -55,9 +62,7 @@ final class SystemActions { } func isEnabled(_ action: Action) -> Bool { - let isSettled = - working == nil && manager.status != .starting - && manager.status != .stopping + let isSettled = working == nil && containerSystem.status != .starting && containerSystem.status != .stopping switch action { case .toggle: return isSettled @@ -75,15 +80,15 @@ final class SystemActions { do { switch action { case .toggle where isRunning: - try await manager.stop() + try await containerSystem.stop() case .toggle: - try await start() + try await startAskingForKernel() case .reload: - try await manager.stop() - try await start() + try await containerSystem.stop() + try await startAskingForKernel() case .quit: // Left running, the system would outlive the app. - try? await manager.stop() + try? await containerSystem.stop() NSApplication.shared.terminate(nil) } } catch { @@ -91,8 +96,19 @@ final class SystemActions { } } - private func start() async throws { - try await manager.start(appRoot: UserDefaults.applicationDataRoot) + /// Starts the system as the user asks, and asks about the kernel instead if it's missing. + func startAskingForKernel() async throws { + do { + try await containerSystem.start(appRoot: UserDefaults.applicationDataRoot) + } catch ContainerSystem.SetupError.kernelInstallNotConfirmed {} + + if containerSystem.needsKernelConfirmation { + isAskingForKernel = true + } + } + + func dismissKernelQuestion() { + isAskingForKernel = false } private func failureTitle(for action: Action) -> String { diff --git a/Containers/Views/Components/FileSelection.swift b/Containers/Views/Components/FileSelection.swift index 74b1eb4..d1f0c0e 100644 --- a/Containers/Views/Components/FileSelection.swift +++ b/Containers/Views/Components/FileSelection.swift @@ -9,18 +9,8 @@ import AppKit import SwiftUI import UniformTypeIdentifiers +/// A pop-up of places to choose among, ending in a command that opens the panel: the path is picked, never written. struct FileSelection: View { - /// How the choice is presented. - enum Style { - /// A pop-up of places to choose among, and nothing else: the path is - /// picked, never written. - case popUp - /// The path itself, editable, beside a button that opens the panel — - /// what suits a field whose answer can be written or made, not only - /// found. - case field - } - /// How the pop-up writes a location out. enum Label { /// The name Finder gives it, localised and without the path. @@ -59,7 +49,6 @@ struct FileSelection: View { let canCreateDirectories: Bool let defaultDirectory: URL? let locations: [URL] - let style: Style let label: Label let recents: Recents? let suggestedSaveFilename: String? @@ -77,7 +66,6 @@ struct FileSelection: View { canCreateDirectories: Bool = false, defaultDirectory: URL? = nil, locations: [URL] = [], - style: Style = .popUp, label: Label = .name, recents: Recents? = nil, suggestedSaveFilename: String? = nil, @@ -91,7 +79,6 @@ struct FileSelection: View { self.canCreateDirectories = canCreateDirectories self.defaultDirectory = defaultDirectory self.locations = locations - self.style = style self.label = label self.recents = recents self.suggestedSaveFilename = suggestedSaveFilename @@ -179,7 +166,7 @@ struct FileSelection: View { } private var actionTitle: String { - options.isEmpty ? "Choose..." : "Other..." + options.isEmpty ? "Choose…" : "Other…" } private var selection: Binding { @@ -214,7 +201,7 @@ struct FileSelection: View { } } - private var popUp: some View { + var body: some View { FormPicker( placeholder: placeholder, options: options, @@ -224,58 +211,17 @@ struct FileSelection: View { title: title(for:), icon: \.icon ) - } - - private var path: Binding { - Binding { - fileURL.wrappedValue?.path ?? "" - } set: { typed in - let typed = typed.trimmingCharacters(in: .whitespacesAndNewlines) - - fileURL.wrappedValue = - typed.isEmpty ? nil : URL(filePath: expanding(typed)) - onSelection?() - } - } - - /// A leading `~` means the person's home, which is not what - /// `expandingTildeInPath` resolves to from inside the sandbox. - private func expanding(_ path: String) -> String { - guard path == "~" || path.hasPrefix("~/") else { return path } - - return Self.userHomeDirectory.path + path.dropFirst() - } - - private var field: some View { - FormField( - placeholder: placeholder, - value: path, - actionIcon: "folder", - actionTitle: "Choose", - action: selectFile - ) - } - - var body: some View { - Group { - switch style { - case .popUp: - popUp - case .field: - field - } - } .onChange(of: isPresented?.wrappedValue ?? false) { _, isPresented in guard isPresented else { return } selectFile() self.isPresented?.wrappedValue = false } .task { - guard style == .popUp, let recents else { return } + guard let recents else { return } recentURLs = RecentLocations.urls(for: recents) } .task(id: options.first) { - guard style == .popUp, isEnabled, fileURL.wrappedValue == nil, + guard isEnabled, fileURL.wrappedValue == nil, let first = options.first?.url else { return } @@ -284,6 +230,18 @@ struct FileSelection: View { } private func selectFile() { + let panel = makePanel() + + Task { + guard let url = await panel.presentAsSheet() else { return } + + fileURL.wrappedValue = url + onSelection?() + remember(url) + } + } + + private func makePanel() -> NSSavePanel { if let suggestedSaveFilename { let panel = NSSavePanel() panel.canCreateDirectories = true @@ -298,14 +256,7 @@ struct FileSelection: View { panel.allowedContentTypes = allowedContentTypes } - guard panel.runModal() == .OK, let url = panel.url else { - return - } - - fileURL.wrappedValue = url - onSelection?() - remember(url) - return + return panel } let panel = NSOpenPanel() @@ -320,13 +271,7 @@ struct FileSelection: View { panel.allowedContentTypes = allowedContentTypes } - guard panel.runModal() == .OK, let url = panel.url else { - return - } - - fileURL.wrappedValue = url - onSelection?() - remember(url) + return panel } } diff --git a/Containers/Views/Components/Forms/FormSheet.swift b/Containers/Views/Components/Forms/FormSheet.swift index ac1f2ad..ebf0558 100644 --- a/Containers/Views/Components/Forms/FormSheet.swift +++ b/Containers/Views/Components/Forms/FormSheet.swift @@ -23,12 +23,11 @@ struct FormSheet: View { VStack(alignment: .leading, spacing: 20) { VStack(alignment: .leading, spacing: 4) { Text(title) - .font(.title2) - .fontWeight(.semibold) + .font(.headline) if let description { Text(description) - .font(.caption) + .font(.subheadline) .foregroundStyle(.secondary) } } @@ -51,7 +50,7 @@ struct FormSheet: View { .disabled(isPrimaryButtonDisabled) } } - .padding(24) + .padding(20) .frame(width: 420, alignment: .topLeading) .fixedSize(horizontal: false, vertical: true) } diff --git a/Containers/Views/Components/Image+Icon.swift b/Containers/Views/Components/Image+Icon.swift new file mode 100644 index 0000000..975a415 --- /dev/null +++ b/Containers/Views/Components/Image+Icon.swift @@ -0,0 +1,17 @@ +// +// Image+Icon.swift +// Containers +// +// Created by Axel Martinez on 2026/11/18. +// + +import SwiftUI + +extension Image { + init(_ icon: Icon) { + switch icon { + case .system(let name): self.init(systemName: name) + case .asset(let name): self.init(name) + } + } +} diff --git a/Containers/Views/Components/ItemPicker.swift b/Containers/Views/Components/ItemPicker.swift index 804db17..e18b132 100644 --- a/Containers/Views/Components/ItemPicker.swift +++ b/Containers/Views/Components/ItemPicker.swift @@ -36,14 +36,15 @@ struct ItemPicker: View { } var body: some View { - VStack(alignment: .leading, spacing: 10) { + VStack(alignment: .leading, spacing: 12) { Text(title) + .font(.headline) FilterField(text: $searchText) listArea footer } - .padding(14) + .padding(20) .frame(width: 440, height: 416) } @@ -84,26 +85,18 @@ struct ItemPicker: View { dismiss() } .buttonStyle(.bordered) + .keyboardShortcut(.cancelAction) actionButton } .controlSize(.regular) .frame(maxWidth: .infinity) - .padding(.top, 4) + .padding(.top, 8) } - // The prominent style keeps its tint when disabled, so with nothing picked - // the button falls back to the plain bordered face. - @ViewBuilder private var actionButton: some View { - if selectedID == nil { - Button(actionTitle) {} - .buttonStyle(.bordered) - .disabled(true) - } else { - Button(actionTitle, action: chooseSelectedItem) - .buttonStyle(.borderedProminent) - } + Button(actionTitle, action: chooseSelectedItem) + .defaultAction(enabled: selectedID != nil) } private func chooseSelectedItem() { diff --git a/Containers/Views/Components/PathControl.swift b/Containers/Views/Components/PathControl.swift new file mode 100644 index 0000000..80b037f --- /dev/null +++ b/Containers/Views/Components/PathControl.swift @@ -0,0 +1,152 @@ +// +// PathControl.swift +// Containers +// +// Created by Axel Martinez on 2026/11/16. +// + +import AppKit +import SwiftUI +import UniformTypeIdentifiers + +/// A file or folder shown as the folders that lead to it, in an `NSPathControl`. +/// +/// In the standard style it shows the path, and a click on a folder opens it in Finder. In the pop-up style its menu lists the folders that lead to it, and "Choose…" picks another in an open +/// panel. When it chooses a folder, one of the folders above can be picked too; the sandbox only grants access to what +/// the panel returns, so the panel confirms the pick unless the app can already read that folder. +struct PathControl: NSViewRepresentable { + @Binding var url: URL? + var style: NSPathControl.Style = .standard + var placeholder = "" + var allowedContentTypes: [UTType] = [] + var choosesDirectories = false + var defaultDirectory: URL? + var onSelection: (() -> Void)? + + func makeCoordinator() -> Coordinator { + Coordinator(parent: self) + } + + func makeNSView(context: Context) -> NSPathControl { + let pathControl = NSPathControl() + pathControl.pathStyle = style + pathControl.isEditable = style == .popUp + pathControl.focusRingType = .none + pathControl.delegate = context.coordinator + pathControl.target = context.coordinator + pathControl.action = #selector(Coordinator.pathChanged(_:)) + pathControl.setContentHuggingPriority(.defaultLow, for: .horizontal) + pathControl.setContentCompressionResistancePriority(.defaultLow, for: .horizontal) + return pathControl + } + + func updateNSView(_ pathControl: NSPathControl, context: Context) { + context.coordinator.parent = self + + if pathControl.url != url { + pathControl.url = url + } + + pathControl.placeholderAttributedString = NSAttributedString( + string: placeholder, + attributes: [.foregroundColor: NSColor.placeholderTextColor] + ) + pathControl.isEnabled = context.environment.isEnabled + } + + @MainActor + final class Coordinator: NSObject, NSPathControlDelegate { + var parent: PathControl + private var isChoosing = false + + init(parent: PathControl) { + self.parent = parent + } + + @objc func pathChanged(_ pathControl: NSPathControl) { + if pathControl.pathStyle == .standard, let clicked = pathControl.clickedPathItem?.url { + if !NSWorkspace.shared.open(clicked) { + NSWorkspace.shared.activateFileViewerSelecting([clicked]) + } + } + + guard isChoosing else { + let picked = pathControl.clickedPathItem?.url + pathControl.url = parent.url + + if pathControl.pathStyle == .popUp, parent.choosesDirectories, let picked, picked != parent.url { + choose(picked) + } + + return + } + + isChoosing = false + select(pathControl.url) + } + + func pathControl(_ pathControl: NSPathControl, willPopUp menu: NSMenu) { + isChoosing = false + menu.autoenablesItems = false + + // The folders carry icons; "Choose…" doesn't. A folder can be swapped for one above it, a file can't. + for item in menu.items where item.image != nil { + item.isEnabled = parent.choosesDirectories + } + } + + func pathControl(_ pathControl: NSPathControl, willDisplay openPanel: NSOpenPanel) { + isChoosing = true + configure(openPanel, startingAt: parent.url?.deletingLastPathComponent() ?? parent.defaultDirectory) + } + + /// A folder above the current one is used as it is when the app can already read it, and otherwise confirmed + /// in the open panel, which is what grants the sandbox access to it. + private func choose(_ folder: URL) { + if (try? FileManager.default.contentsOfDirectory(at: folder, includingPropertiesForKeys: nil)) != nil { + select(folder) + return + } + + let panel = NSOpenPanel() + configure(panel, startingAt: folder) + + Task { + guard let url = await panel.presentAsSheet() else { return } + + select(url) + } + } + + private func select(_ url: URL?) { + parent.url = url + parent.onSelection?() + } + + private func configure(_ openPanel: NSOpenPanel, startingAt directory: URL?) { + openPanel.allowsMultipleSelection = false + openPanel.canChooseFiles = !parent.choosesDirectories + openPanel.canChooseDirectories = parent.choosesDirectories + openPanel.canCreateDirectories = parent.choosesDirectories + openPanel.showsHiddenFiles = true + openPanel.directoryURL = directory + + if !parent.allowedContentTypes.isEmpty { + openPanel.allowedContentTypes = parent.allowedContentTypes + } + } + } +} + +#Preview { + @Previewable @State var dockerfile: URL? = FileSelection.userHomeDirectory.appending(path: "Documents/web/Dockerfile") + @Previewable @State var buildDirectory: URL? + + VStack(alignment: .leading, spacing: 12) { + PathControl(url: .constant(UserDefaults.defaultAppRoot)) + PathControl(url: $dockerfile, style: .popUp, placeholder: "None") + PathControl(url: $buildDirectory, style: .popUp, placeholder: "None", choosesDirectories: true) + } + .padding(24) + .frame(width: 520) +} diff --git a/Containers/Views/Components/RowProgressIndicator.swift b/Containers/Views/Components/RowProgressIndicator.swift index 0caa0f6..d69626e 100644 --- a/Containers/Views/Components/RowProgressIndicator.swift +++ b/Containers/Views/Components/RowProgressIndicator.swift @@ -5,18 +5,18 @@ // Created by Axel Martinez on 14/09/2026. // -import ContainerSystem +import ContainersCore import SwiftUI -/// A row's activity mark: a filling pie, a failure mark, or a retry button once stopped. +/// A row's task mark: a filling pie, a failure mark, or a retry button once stopped. struct RowProgressIndicator: View { /// Glyphs are sized to it, since a font size draws them larger than the pie. - private static let markSize: CGFloat = 16 + static let markSize: CGFloat = 16 /// Centres every mark alike, however wide its glyph draws. - private static let slot: CGFloat = 18 + static let slot: CGFloat = 18 - let activity: ActivitySnapshot + let task: ContainerSystemTask.Snapshot /// Passed in: AppKit can update a cell after its row is gone, with no environment left. let activityCenter: ActivityCenter let openReport: (String) -> Void @@ -28,9 +28,9 @@ struct RowProgressIndicator: View { var body: some View { Group { - if activity.isStopped, activity.canRetry { + if task.isStopped, task.canRetry { Button { - activityCenter.retry(activity.id) + task.taskID.map(activityCenter.retry) } label: { Image(systemName: "arrow.clockwise.circle") .resizable() @@ -54,10 +54,10 @@ struct RowProgressIndicator: View { .buttonStyle(.plain) .help(helpText) .popover(isPresented: $isShowingDetails, arrowEdge: .bottom) { - ActivityDetails( - activity: activity, - onStop: { activityCenter.stop(activity.id) }, - onRetry: { activityCenter.retry(activity.id) }, + TaskDetails( + task: task, + onStop: { task.taskID.map(activityCenter.stop) }, + onRetry: { task.taskID.map(activityCenter.retry) }, onOpenReport: { reportID in isShowingDetails = false openReport(reportID) @@ -68,20 +68,20 @@ struct RowProgressIndicator: View { } // Stopping swaps the mark for the retry button; the popover mustn't // reappear on its own when the work runs again. - .onChange(of: activity.isStopped) { _, _ in + .onChange(of: task.isStopped) { _, _ in isShowingDetails = false } } @ViewBuilder private var mark: some View { - if activity.failureMessage != nil { + if task.failureMessage != nil { Image(systemName: isHovering ? "info.circle" : Self.failureSymbol) .resizable() .scaledToFit() .frame(width: Self.markSize, height: Self.markSize) .foregroundStyle(.secondary) - } else if activity.isStopped { + } else if task.isStopped { Image(systemName: "stop.circle") .resizable() .scaledToFit() @@ -99,9 +99,9 @@ struct RowProgressIndicator: View { Circle() .strokeBorder(.foreground, lineWidth: 1) - PieSlice(fraction: activity.fraction ?? 0) + PieSlice(fraction: task.fraction ?? 0) .fill(.foreground) - .animation(.easeOut(duration: 0.25), value: activity.fraction) + .animation(.easeOut(duration: 0.25), value: task.fraction) } .frame(width: Self.markSize, height: Self.markSize) .rowTint(.blue) @@ -109,15 +109,59 @@ struct RowProgressIndicator: View { } private var helpText: String { - if activity.failureMessage != nil { return "Show Error" } - if activity.isStopped { return "Stopped" } - return "Show Progress" + if task.failureMessage != nil { return "Show error" } + if task.isStopped { return "Stopped" } + return "Show progress" + } +} + +/// A row's mark for why nothing can be done with it: the info glyph a task's mark shows, which opens the +/// explanation as the task's opens its details. It shows only while the pointer is over the row, as the row's +/// dimming already says something is off. +struct RowNoticeIndicator: View { + let notice: RowNotice + let isRowHovered: Bool + + @State private var isShowingDetails = false + + var body: some View { + Button { + isShowingDetails.toggle() + } label: { + Image(systemName: "info.circle") + .resizable() + .scaledToFit() + .frame(width: RowProgressIndicator.markSize, height: RowProgressIndicator.markSize) + .foregroundStyle(.secondary) + .frame(width: RowProgressIndicator.slot, height: RowProgressIndicator.slot) + .contentShape(Rectangle()) + } + .buttonStyle(.plain) + .opacity(isRowHovered || isShowingDetails ? 1 : 0) + .help(notice.help) + .popover(isPresented: $isShowingDetails, arrowEdge: .bottom) { + // Laid out as a task's details, which the popover inherits the cell's one-line limit from too. + VStack(alignment: .leading, spacing: 4) { + Text(notice.title) + .font(.subheadline) + .lineLimit(nil) + .fixedSize(horizontal: false, vertical: true) + + Text(notice.message) + .font(.caption) + .foregroundStyle(.secondary) + .lineLimit(nil) + .fixedSize(horizontal: false, vertical: true) + } + .padding(12) + .frame(width: 340, alignment: .leading) + } } } /// Stop, Retry and Delete for rows that stand for work. -struct ActivityMenuItems: View { - let work: [ActivitySnapshot] +struct TaskMenuItems: View { + let work: [ContainerSystemTask.Snapshot] /// Not read from the environment, for the same reason as the mark's. let activityCenter: ActivityCenter let reportManager: ReportManager @@ -131,13 +175,13 @@ struct ActivityMenuItems: View { if !running.isEmpty { Button("Stop", systemImage: "stop") { - for activity in running { activityCenter.stop(activity.id) } + for id in running.compactMap(\.taskID) { activityCenter.stop(id) } } } if !retryable.isEmpty { Button("Retry", systemImage: "arrow.clockwise") { - for activity in retryable { activityCenter.retry(activity.id) } + for id in retryable.compactMap(\.taskID) { activityCenter.retry(id) } } } @@ -151,7 +195,7 @@ struct ActivityMenuItems: View { systemImage: "trash", role: .destructive ) { - for activity in ended { activityCenter.remove(activity.id) } + for id in ended.compactMap(\.taskID) { activityCenter.remove(id) } Task { await reportManager.delete(ids: reported) } } @@ -159,8 +203,8 @@ struct ActivityMenuItems: View { } } -private struct ActivityDetails: View { - let activity: ActivitySnapshot +private struct TaskDetails: View { + let task: ContainerSystemTask.Snapshot let onStop: () -> Void let onRetry: () -> Void let onOpenReport: (String) -> Void @@ -181,21 +225,21 @@ private struct ActivityDetails: View { account .frame(maxWidth: .infinity, alignment: .leading) - if activity.isExecuting { + if task.isExecuting { button("xmark.circle.fill", "Stop the work", action: onStop) - } else if activity.canRetry { + } else if task.canRetry { button("arrow.clockwise.circle.fill", "Run it again", action: onRetry) } - if let reportID = activity.reportID { + if let reportID = task.reportID { button("arrow.up.forward.circle", "Show the report of what happened") { onOpenReport(reportID) } } } - if activity.isExecuting { - Text(hovered ?? activity.detail) + if task.isExecuting { + Text(hovered ?? task.detail) .font(.caption) .monospacedDigit() .foregroundStyle(.secondary) @@ -213,12 +257,12 @@ private struct ActivityDetails: View { @ViewBuilder private var account: some View { - if let failureMessage = activity.failureMessage { + if let failureMessage = task.failureMessage { Text(hovered ?? failureMessage) .font(.caption) .foregroundStyle(.secondary) .lineLimit(1) - } else if activity.isStopped { + } else if task.isStopped { Text(hovered ?? "Stopped") .font(.caption) .foregroundStyle(.secondary) @@ -226,7 +270,7 @@ private struct ActivityDetails: View { } else { // Linear for both, or unmeasured work draws a spinner. Group { - if let fraction = activity.fraction { + if let fraction = task.fraction { ProgressView(value: fraction) } else { ProgressView() @@ -258,15 +302,15 @@ private struct ActivityDetails: View { } private var heading: String { - if activity.failureMessage != nil { - return activity.failureTitle ?? "Something went wrong" + if task.failureMessage != nil { + return task.failureTitle ?? "Something went wrong" } - if activity.isStopped { + if task.isStopped { return "Stopped" } - return activity.step.isEmpty ? "Starting…" : activity.step + return task.step.isEmpty ? "Starting…" : task.step } } diff --git a/Containers/Extensions/SwiftUI/View+DefaultAction.swift b/Containers/Views/Components/View+DefaultAction.swift similarity index 64% rename from Containers/Extensions/SwiftUI/View+DefaultAction.swift rename to Containers/Views/Components/View+DefaultAction.swift index 7576a92..e184add 100644 --- a/Containers/Extensions/SwiftUI/View+DefaultAction.swift +++ b/Containers/Views/Components/View+DefaultAction.swift @@ -8,13 +8,15 @@ import SwiftUI extension View { - /// Disabled, it drops to a plain button, as AppKit's default button does. + /// Answers Return; disabled, it drops to a plain button, so it doesn't look like it would. @ViewBuilder func defaultAction(enabled: Bool) -> some View { if enabled { buttonStyle(.borderedProminent) + .keyboardShortcut(.defaultAction) } else { buttonStyle(.bordered).disabled(true) + .keyboardShortcut(.defaultAction) } } } diff --git a/Containers/Views/Components/View+Foreground.swift b/Containers/Views/Components/View+Foreground.swift new file mode 100644 index 0000000..1d42385 --- /dev/null +++ b/Containers/Views/Components/View+Foreground.swift @@ -0,0 +1,15 @@ +// +// View+Foreground.swift +// Containers +// +// Created by Axel Martinez on 12/10/2026. +// + +import SwiftUI + +extension View { + /// Shows a cell's content as secondary while nothing can be done with its entry, or while `isDimmed` holds. + func rowForeground(for entry: ResourceEntry, isDimmed: Bool = false) -> some View { + foregroundStyle(entry.isDisabled || isDimmed ? .secondary : .primary) + } +} diff --git a/Containers/Extensions/SwiftUI/View+RowTint.swift b/Containers/Views/Components/View+RowTint.swift similarity index 84% rename from Containers/Extensions/SwiftUI/View+RowTint.swift rename to Containers/Views/Components/View+RowTint.swift index 87ba13a..f6e2d5c 100644 --- a/Containers/Extensions/SwiftUI/View+RowTint.swift +++ b/Containers/Views/Components/View+RowTint.swift @@ -8,7 +8,7 @@ import SwiftUI extension View { - /// On a selected row, takes the row's foreground instead, as Finder's marks turn white. + /// On a selected row, takes the row's foreground instead, so it stays legible on the selection color. func rowTint(_ color: Color) -> some View { modifier(RowTint(color: color)) } diff --git a/Containers/Views/Components/View+WindowVisibility.swift b/Containers/Views/Components/View+WindowVisibility.swift new file mode 100644 index 0000000..690e577 --- /dev/null +++ b/Containers/Views/Components/View+WindowVisibility.swift @@ -0,0 +1,84 @@ +// +// View+WindowVisibility.swift +// Containers +// +// Created by Axel Martinez on 2026/11/22. +// + +import AppKit +import SwiftUI + +extension View { + /// Calls `action` with whether any part of the view's window is visible on screen, when the view + /// first appears in a window and whenever that changes. + /// + /// A window is hidden while it's minimized, its app is hidden, it's on another Space, or other + /// windows cover it entirely. + func onWindowVisibilityChange(_ action: @escaping (Bool) -> Void) -> some View { + background(WindowVisibilityReader(action: action)) + } +} + +private struct WindowVisibilityReader: NSViewRepresentable { + let action: (Bool) -> Void + + func makeNSView(context: Context) -> ReaderView { + ReaderView(action: action) + } + + func updateNSView(_ nsView: ReaderView, context: Context) { + nsView.action = action + } + + /// Follows the window on `viewDidMoveToWindow`, which runs once the view has a window, and again + /// without one when the view leaves it. + final class ReaderView: NSView { + var action: (Bool) -> Void + private var observer: (any NSObjectProtocol)? + + init(action: @escaping (Bool) -> Void) { + self.action = action + super.init(frame: .zero) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) unavailable") + } + + override func viewDidMoveToWindow() { + super.viewDidMoveToWindow() + + if let observer { + NotificationCenter.default.removeObserver(observer) + self.observer = nil + } + + guard let window else { + report(isVisible: false) + return + } + + observer = NotificationCenter.default.addObserver( + forName: NSWindow.didChangeOcclusionStateNotification, + object: window, + queue: .main + ) { [weak self] _ in + MainActor.assumeIsolated { + guard let self, let window = self.window else { return } + + self.report(isVisible: window.occlusionState.contains(.visible)) + } + } + + report(isVisible: window.occlusionState.contains(.visible)) + } + + /// Reported after the current update: the window can change while SwiftUI updates its views, + /// which mustn't change their state. + private func report(isVisible: Bool) { + DispatchQueue.main.async { [weak self] in + self?.action(isVisible) + } + } + } +} diff --git a/Containers/Views/Containers/ContainerDetailView.swift b/Containers/Views/Containers/ContainerDetailView.swift index 2ffb67b..4c1ad92 100644 --- a/Containers/Views/Containers/ContainerDetailView.swift +++ b/Containers/Views/Containers/ContainerDetailView.swift @@ -5,9 +5,9 @@ // Created by Axel Martinez on 2026/02/08. // -import ContainerSystem import Containerization import ContainerizationOCI +import ContainersCore import SwiftUI struct ContainerDetailWindow: View { @@ -15,17 +15,16 @@ struct ContainerDetailWindow: View { let id: String - @SwiftUI.State private var snapshot: ContainerSnapshot? + @SwiftUI.State private var container: ManagedContainer? @SwiftUI.State private var isLoading: Bool = true @SwiftUI.State private var loadError: Error? @SwiftUI.State private var toolbarController = DetailToolbarController() var body: some View { Group { - if let snapshot { + if let container { ContainerDetailView( - container: ContainerItem(snapshot), - initialSnapshot: snapshot, + container: container, toolbarController: toolbarController ) } else if isLoading { @@ -36,14 +35,15 @@ struct ContainerDetailWindow: View { height: DetailPlaceholder.container.height ) } else { - ContentUnavailableView( - "Container Not Found", - systemImage: "shippingbox", - description: Text( - loadError?.localizedDescription - ?? "The container '\(id)' no longer exists." - ) - ) + ContentUnavailableView { + Label { + Text("Container Not Found") + } icon: { + Image(Icon.container) + } + } description: { + Text(loadError?.localizedDescription ?? "The container '\(id)' no longer exists.") + } .frame(width: 550, height: 320) } } @@ -55,9 +55,7 @@ struct ContainerDetailWindow: View { ) ) .navigationTitle(id) - .task(id: id) { - await load() - } + .task(id: id, load) } private func load() async { @@ -66,10 +64,10 @@ struct ContainerDetailWindow: View { defer { isLoading = false } do { - snapshot = try await containerManager.get(id: id) + container = try await containerManager.container(withID: id) loadError = nil } catch { - snapshot = nil + container = nil loadError = error } } @@ -82,14 +80,11 @@ struct ContainerDetailView: View { @Environment(\.dismissWindow) private var dismissWindow @Environment(\.openURL) private var openURL - @SwiftUI.State private var container: ContainerItem - @SwiftUI.State private var snapshot: ContainerSnapshot? - @SwiftUI.State private var status: ContainerStatus + @SwiftUI.State private var container: ManagedContainer /// Opens on the logs, which is usually why the window was opened. @SwiftUI.State private var selectedCategory: DetailCategory = .logs @SwiftUI.State private var errorAlert: ErrorAlert? @SwiftUI.State private var showDeleteConfirmation = false - @SwiftUI.State private var isLoadingSnapshot = false @SwiftUI.State private var isOperationInProgress = false enum DetailCategory: String, CaseIterable, Hashable { @@ -101,18 +96,11 @@ struct ContainerDetailView: View { let toolbarController: DetailToolbarController init( - container: ContainerItem, - initialSnapshot: ContainerSnapshot? = nil, + container: ManagedContainer, toolbarController: DetailToolbarController = DetailToolbarController() ) { self.toolbarController = toolbarController - - let initialContainer = - initialSnapshot.map(ContainerItem.init) ?? container - - self._container = State(initialValue: initialContainer) - self._snapshot = State(initialValue: initialSnapshot) - self._status = State(initialValue: initialContainer.status) + self._container = State(initialValue: container) } var body: some View { @@ -140,25 +128,19 @@ struct ContainerDetailView: View { tabContent: { tab in switch tab { case .info: - snapshotContent { snapshot in - ContainerInfo(snapshot: snapshot) - } + ContainerInfo(container: container) + .contentReady(true) case .inspect: - snapshotContent { snapshot in - ContainerInspect(snapshot: snapshot) - } + InspectView(value: container) + .contentReady(true) case .logs: ContainerLogs(containerID: container.id) } } ) - .task(id: container.id) { - guard snapshot == nil else { return } - await refreshSnapshot() - } - .errorAlert($errorAlert) + .alert($errorAlert) .confirmationDialog( - "Delete Container", + "Are you sure you want to delete “\(container.id)”?", isPresented: $showDeleteConfirmation, titleVisibility: .visible ) { @@ -186,62 +168,36 @@ struct ContainerDetailView: View { Button("Cancel", role: .cancel) {} } message: { - Text( - "Are you sure you want to delete container '\(container.id)'? This action cannot be undone." - ) + Text("You can’t undo this action.") } .onChange(of: containerManager.lastContainerChange) { Task { - await refreshSnapshot() + await refresh() } } } - private func snapshotContent( - @ViewBuilder content: (ContainerSnapshot) -> Content - ) -> some View { - Group { - if let snapshot { - content(snapshot) - } else if isLoadingSnapshot { - // The window stays hidden until ready. - Color.clear - } else { - ContentUnavailableView( - "Container Details Unavailable", - systemImage: "shippingbox", - description: Text( - "The full container snapshot could not be loaded." - ) - ) - } - } - // Outermost, or the window can't read it. A failed load still counts - // as ready, so the window sizes to the error. - .contentReady(!isLoadingSnapshot || snapshot != nil) - } - /// Always the same items in the same order, since the toolbar is built before the - /// snapshot arrives and changing the set would rebuild it visibly. Only titles, + /// container arrives and changing the set would rebuild it visibly. Only titles, /// actions and enabled states change. private var toolbarItems: [DetailToolbarItem] { - let busy = isOperationInProgress || activityCenter.isWorking(on: container.id) - let isRunning = status == .running - let isStopped = status == .stopped + let busy = isOperationInProgress || activityCenter.isWorking(on: container.resourceID) + let isRunning = container.state == .running + let isStopped = container.state == .stopped return [ .reports( about: container.id, ofKind: [.container], - manager: reportManager, + from: reportManager, openURL: openURL ), DetailToolbarItem( id: "run", title: isRunning ? "Stop" : "Start", icon: isRunning ? "stop.fill" : "play.fill", - help: isRunning ? "Stop container" : "Start container", - isEnabled: !busy && (isRunning || isStopped) + help: runHelp(isRunning: isRunning), + isEnabled: !busy && (isRunning || (isStopped && container.isRunnable)) ) { if isRunning { stopContainer() @@ -261,6 +217,17 @@ struct ContainerDetailView: View { ] } + /// The Start or Stop tooltip, which says why the button is off where the container can't start. + private func runHelp(isRunning: Bool) -> String { + if isRunning { + "Stop container" + } else if container.isRunnable { + "Start container" + } else { + "Containers on custom networks can’t be started" + } + } + /// The same items, inert, so the toolbar can be built before the container loads. static var placeholderToolbarItems: [DetailToolbarItem] { [ @@ -294,21 +261,9 @@ struct ContainerDetailView: View { } } - private func refreshSnapshot() async { - isLoadingSnapshot = snapshot == nil - defer { - isLoadingSnapshot = false - } - + private func refresh() async { do { - let updatedSnapshot = try await containerManager.get( - id: container.id - ) - let updatedContainer = ContainerItem(updatedSnapshot) - - snapshot = updatedSnapshot - container = updatedContainer - status = updatedContainer.status + container = try await containerManager.container(withID: container.id) errorAlert = nil } catch { self.errorAlert = ErrorAlert( @@ -324,13 +279,12 @@ struct ContainerDetailView: View { let containerManager = containerManager let id = container.id - activityCenter.run( - on: id, - kind: .container, + activityCenter.start( + on: container.resourceID, subtitle: container.imageName, failureTitle: "The container couldn’t be started.", showsProgress: false - ) { + ) { _ in try await containerManager.run(id: id) } } @@ -340,51 +294,48 @@ struct ContainerDetailView: View { let id = container.id let timeout = UserDefaults.stopContainerTimeoutSeconds - activityCenter.run( - on: id, - kind: .container, + activityCenter.start( + on: container.resourceID, subtitle: container.imageName, failureTitle: "The container couldn’t be stopped.", showsProgress: false - ) { + ) { _ in try await containerManager.stop(ids: [id], timeoutSeconds: timeout) } } } +#if DEBUG #Preview { - let reportManager = ReportManager() + let reportManager = ReportManager.preview ContainerDetailView( - container: ContainerItem( - ContainerSnapshot( - configuration: ContainerConfiguration( - id: "preview-container", - image: ImageDescription( - reference: "nginx:latest", - descriptor: ContainerizationOCI.Descriptor( - mediaType: - "application/vnd.oci.image.manifest.v1+json", - digest: "sha256:1234567890abcdef", - size: 1024 - ) - ), - process: ProcessConfiguration( - executable: "/bin/sh", - arguments: [], - environment: [], - workingDirectory: "/", - terminal: false + container: ManagedContainer( + configuration: ContainerConfiguration( + id: "preview-container", + image: ImageDescription( + reference: "nginx:latest", + descriptor: ContainerizationOCI.Descriptor( + mediaType: + "application/vnd.oci.image.manifest.v1+json", + digest: "sha256:1234567890abcdef", + size: 1024 ) ), - status: .running, - networks: [], - startedDate: Date() - ) + process: ProcessConfiguration( + executable: "/bin/sh", + arguments: [], + environment: [], + workingDirectory: "/", + terminal: false + ) + ), + status: ContainerStatus(state: .running, networks: [], startedDate: Date()) ) ) .frame(width: 550) - .environment(ContainerManager()) - .environment(ActivityCenter(reports: reportManager)) + .environment(ContainerManager.preview) + .environment(ActivityCenter(reportManager: reportManager)) .environment(reportManager) } +#endif diff --git a/Containers/Views/Containers/ContainerInfo.swift b/Containers/Views/Containers/ContainerInfo.swift index 5fca60e..67298bf 100644 --- a/Containers/Views/Containers/ContainerInfo.swift +++ b/Containers/Views/Containers/ContainerInfo.swift @@ -5,26 +5,26 @@ // Created by Axel Martinez on 10/2/26. // -import ContainerSystem import Containerization import ContainerizationOCI +import ContainersCore import SwiftUI struct ContainerInfo: View { - let snapshot: ContainerSnapshot + let container: ManagedContainer var body: some View { VStack(alignment: .leading, spacing: 10) { InfoSection { - InfoRow(label: "ID", value: snapshot.id) + InfoRow(label: "ID", value: container.id) InfoRow( label: "Image", - value: snapshot.configuration.image.reference + value: container.configuration.image.reference ) InfoRow(label: "OS", value: osSummary) InfoRow( label: "Arch", - value: snapshot.configuration.platform.architecture + value: container.configuration.platform.architecture ) if let commandSummary { @@ -41,22 +41,22 @@ struct ContainerInfo: View { InfoRow( label: "Root Filesystem", - value: snapshot.configuration.readOnly + value: container.configuration.readOnly ? "Read-only" : "Read-write" ) InfoRow( label: "Virtualization", - value: snapshot.configuration.virtualization + value: container.configuration.virtualization ? "Enabled" : "Disabled" ) InfoRow( label: "SSH Agent", - value: snapshot.configuration.ssh + value: container.configuration.ssh ? "Forwarded" : "Not forwarded" ) } - if !snapshot.configuration.labels.isEmpty { + if !container.configuration.labels.isEmpty { InfoSection { ForEach(sortedLabels, id: \.key) { label in InfoRow(label: label.key, value: label.value) @@ -69,17 +69,17 @@ struct ContainerInfo: View { } private var sortedLabels: [(key: String, value: String)] { - snapshot.configuration.labels.sorted { + container.configuration.labels.sorted { $0.key.localizedStandardCompare($1.key) == .orderedAscending } } private var osSummary: String { - snapshot.configuration.platform.os.localizedCapitalized + container.configuration.platform.os.localizedCapitalized } private var commandSummary: String? { - let process = snapshot.configuration.initProcess + let process = container.configuration.initProcess let executable = process.executable.trimmingCharacters( in: .whitespacesAndNewlines ) @@ -94,8 +94,8 @@ struct ContainerInfo: View { } private var portsSummary: String? { - let ports = snapshot.configuration.publishedPorts.map(\.description) - let sockets = snapshot.configuration.publishedSockets.map { + let ports = container.configuration.publishedPorts.map(\.description) + let sockets = container.configuration.publishedSockets.map { "\($0.hostPath) -> \($0.containerPath)" } @@ -103,7 +103,7 @@ struct ContainerInfo: View { } private var startedAtSummary: String? { - guard let startedDate = snapshot.startedDate else { + guard let startedDate = container.status.startedDate else { return nil } diff --git a/Containers/Views/Containers/ContainerInspect.swift b/Containers/Views/Containers/ContainerInspect.swift deleted file mode 100644 index e856ba4..0000000 --- a/Containers/Views/Containers/ContainerInspect.swift +++ /dev/null @@ -1,86 +0,0 @@ -// -// ContainerInspect.swift -// Containers -// -// Created by Axel Martinez on 06/06/2026. -// - -import ContainerSystem -import Containerization -import ContainerizationOCI -import Foundation -import SwiftUI - -struct ContainerInspect: View { - let snapshot: ContainerSnapshot - - var body: some View { - InspectView(value: PrintableContainer(snapshot)) - } -} - -private struct PrintableContainer: Encodable { - let configuration: ContainerConfiguration - let status: PrintableContainerStatus - - var id: String { - configuration.id - } - - init(_ container: ContainerSnapshot) { - self.configuration = container.configuration - self.status = PrintableContainerStatus( - state: container.status, - networks: container.networks, - startedDate: container.startedDate - ) - } - - enum CodingKeys: String, CodingKey { - case id - case configuration - case status - } - - func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(id, forKey: .id) - try container.encode(configuration, forKey: .configuration) - try container.encode(status, forKey: .status) - } -} - -private struct PrintableContainerStatus: Encodable { - let state: ContainerStatus - let networks: [Attachment] - let startedDate: Date? -} - -#Preview { - ContainerInspect( - snapshot: ContainerSnapshot( - configuration: ContainerConfiguration( - id: "preview-container", - image: ImageDescription( - reference: "nginx:latest", - descriptor: ContainerizationOCI.Descriptor( - mediaType: "application/vnd.oci.image.manifest.v1+json", - digest: "sha256:1234567890abcdef", - size: 1024 - ) - ), - process: ProcessConfiguration( - executable: "/bin/sh", - arguments: [], - environment: ["PATH=/usr/bin"], - workingDirectory: "/", - terminal: false - ) - ), - status: .running, - networks: [], - startedDate: Date() - ) - ) - .frame(width: 550, height: 420) -} diff --git a/Containers/Views/Containers/ContainerLogs.swift b/Containers/Views/Containers/ContainerLogs.swift index 403ca84..bb25ccb 100644 --- a/Containers/Views/Containers/ContainerLogs.swift +++ b/Containers/Views/Containers/ContainerLogs.swift @@ -5,7 +5,7 @@ // Created by Axel Martinez on 10/2/26. // -import ContainerSystem +import ContainersCore import SwiftUI struct ContainerLogs: View { @@ -92,9 +92,7 @@ struct ContainerLogs: View { // Unmeasured, so switching, filtering or emptying the log never resizes the window. .contentUnbounded() .contentIdealSize(CGSize(width: Self.idealWidth, height: 0)) - .task(id: source) { - await streamLogs() - } + .task(id: source, streamLogs) } private var bar: some View { @@ -198,6 +196,7 @@ struct ContainerLogs: View { let logFile = containerDir.appendingPathComponent(source.filename) + // Made here so it can be followed from the start. if !FileManager.default.fileExists(atPath: logFile.path) { FileManager.default.createFile(atPath: logFile.path, contents: nil) } diff --git a/Containers/Views/Containers/ContainersView.swift b/Containers/Views/Containers/ContainersView.swift index c8034b0..4212de7 100644 --- a/Containers/Views/Containers/ContainersView.swift +++ b/Containers/Views/Containers/ContainersView.swift @@ -5,25 +5,27 @@ // Created by Axel Martinez on 2026/02/05. // -import ContainerSystem +import ContainersCore import SwiftUI struct ContainersView: View { + typealias Entry = ResourceEntry + @Environment(ContainerManager.self) private var containerManager - @Environment(SystemManager.self) private var system + @Environment(ContainerSystem.self) private var containerSystem @Environment(VolumeManager.self) private var volumeManager @Environment(ActivityCenter.self) private var activityCenter @Environment(\.openWindow) private var openWindow @Binding var searchText: String @Binding var runningContainersOnly: Bool - @Binding var selection: Set + @Binding var selection: Set @Binding var actions: SelectionActions @Binding var command: SelectionCommand? var refreshTrigger: Int - @State private var containers: [ContainerItem] = [] + @State private var containers: [ManagedContainer] = [] @State private var refreshTask: Task? @State private var needsRefresh = false @@ -34,25 +36,25 @@ struct ContainersView: View { /// A container still being made gets a row of its own whatever the filter /// says, keyed by the name it will have, so it becomes that row in place. private func withCreations( - _ containers: [ContainerItem] - ) -> [ContainerItem] { - activityCenter.marked( - containers, + _ containers: [ManagedContainer] + ) -> [Entry] { + activityCenter.entries( + for: containers, ofKind: .container, + reportKinds: [.container], // An unread failure from an earlier run, unless the container has // started since. - reportName: { $0.status == .running ? nil : $0.id }, - reportKinds: [.container], - pendingRow: ContainerItem.init(pending:) + showsReport: { $0.state != .running }, + includesPending: true ) - .sorted { $0.id < $1.id } + .sorted { $0.name < $1.name } } - private var filteredContainers: [ContainerItem] { + private var filteredContainers: [Entry] { if trimmedText.isEmpty { return withCreations( runningContainersOnly - ? containers.filter({ $0.status == .running }) : containers + ? containers.filter({ $0.state == .running }) : containers ) } @@ -65,26 +67,27 @@ struct ContainersView: View { return withCreations( runningContainersOnly - ? filtered.filter({ $0.status == .running }) : filtered + ? filtered.filter({ $0.state == .running }) : filtered ) } - private func startable( - _ containers: [ContainerItem] - ) -> [ContainerItem] { - containers.filter { !$0.isDisabled && $0.status == .stopped } + private func startable(_ rows: [Entry]) -> [ManagedContainer] { + rows.filter { !$0.isDisabled && $0.state == .stopped && $0.isRunnable }.compactMap(\.resource) } - private func stoppable( - _ containers: [ContainerItem] - ) -> [ContainerItem] { - containers.filter { !$0.isDisabled && $0.status == .running } + private func stoppable(_ rows: [Entry]) -> [ManagedContainer] { + rows.filter { !$0.isDisabled && $0.state == .running }.compactMap(\.resource) } - private var rowActions: TableRowActions { + /// Why the app can't start a container, which its row shows. + private func notice(for row: Entry) -> RowNotice? { + row.resource?.runNotice + } + + private var rowActions: TableRowActions { TableRowActions( noun: "Container", - name: \.id, + name: \.name, open: openDetails(for:), canDelete: { !$0.isExecuting }, delete: deleteContainers, @@ -132,10 +135,11 @@ struct ContainersView: View { .width(min: 36, ideal: 44, max: 60) TableColumn("Name", value: \.name) { container in - ActivityRowName( - row: container, + ResourceNameCell( + entry: container, activityCenter: activityCenter, - openReport: openWindow.report + openReport: openWindow.report, + notice: notice(for: container) ) } .width(min: 100, ideal: 150, max: 250) @@ -143,7 +147,7 @@ struct ContainersView: View { TableColumn("Image", value: \.imageName) { container in Text(container.imageName) .lineLimit(1) - .rowForeground(for: container) + .rowForeground(for: container, isDimmed: notice(for: container) != nil) } .width(min: 120, ideal: 180, max: 300) @@ -154,33 +158,32 @@ struct ContainersView: View { ) .lineLimit(1) .font(.system(.body, design: .monospaced)) - .rowForeground(for: container, isDimmed: !container.hasIPAddress) + .rowForeground(for: container, isDimmed: !container.hasIPAddress || notice(for: container) != nil) .textSelection(.enabled) } .width(min: 100, ideal: 120, max: 140) TableColumn("Uptime", value: \.startedSort) { container in TimelineView(.periodic(from: .now, by: 15)) { context in - Text( - !container.isPending - ? container.formattedUptime(at: context.date) : "—" - ) - .lineLimit(1) - .font(.system(.body, design: .monospaced)) - .rowForeground(for: container, isDimmed: container.status != .running) + Text(container.resource?.formattedUptime(at: context.date) ?? "—") + .lineLimit(1) + .font(.system(.body, design: .monospaced)) + .rowForeground(for: container, isDimmed: container.state != .running || notice(for: container) != nil) } } .width(min: 80, ideal: 100, max: 140) } .onChange(of: containerManager.lastContainerChange) { Task { - guard system.status == .running else { return } + guard containerSystem.isRunning else { return } try? await refreshContainers() } } } - private func openDetails(for container: ContainerItem) { + private func openDetails(for row: Entry) { + guard let container = row.resource else { return } + openWindow( id: ContainersApp.containerDetailWindowID, value: container.id @@ -189,79 +192,82 @@ struct ContainersView: View { /// Unknown gets its own mark: it shares the stopped colour, and a hollow /// ring would pass it off as stopped. - private func stateSymbol(for container: ContainerItem) -> String { - switch container.status { - case .starting, .running, .stopping: "circle.fill" + private func stateSymbol(for container: Entry) -> String { + switch container.state { + case .starting, .running, .stopping, .unknown: "circle.fill" case .stopped: "circle" - case .unknown: "questionmark.circle" } } - private func stateLabel(for container: ContainerItem) -> String { - container.status == .unknown - ? "Unknown" : container.status.rawValue.localizedCapitalized + private func stateLabel(for container: Entry) -> String { + container.state == .unknown + ? "Unknown" : container.state.rawValue.localizedCapitalized } - private func stateColor(for container: ContainerItem) -> Color { - switch container.status { + private func stateColor(for container: Entry) -> Color { + switch container.state { case .running: return .green case .starting, .stopping: return .orange case .stopped: return .secondary - case .unknown: return .secondary + // Black, or white in dark mode, where black wouldn't show. + case .unknown: return .primary } } /// Run as row work, so a failure shows in the row like a creation's. - private func startContainers(_ containers: [ContainerItem]) { + private func startContainers(_ containers: [ManagedContainer]) { let containerManager = containerManager for container in containers { - activityCenter.run( - on: container.id, - kind: .container, + let id = container.id + + activityCenter.start( + on: container.resourceID, subtitle: container.imageName, failureTitle: "The container couldn’t be started.", // The state dot shows it. showsProgress: false - ) { - try await containerManager.run(id: container.id) + ) { _ in + try await containerManager.run(id: id) } } } - private func stopContainers(_ containers: [ContainerItem]) { + private func stopContainers(_ containers: [ManagedContainer]) { let containerManager = containerManager let timeout = Int32(UserDefaults.stopContainerTimeoutSeconds) for container in containers { - activityCenter.run( - on: container.id, - kind: .container, + let id = container.id + + activityCenter.start( + on: container.resourceID, subtitle: container.imageName, failureTitle: "The container couldn’t be stopped.", // The state dot shows it. showsProgress: false - ) { + ) { _ in try await containerManager.stop( - ids: [container.id], + ids: [id], timeoutSeconds: timeout ) } } } - private func deleteContainers(_ containers: [ContainerItem]) { + private func deleteContainers(_ rows: [Entry]) { let containerManager = containerManager - for container in containers { - activityCenter.run( - on: container.id, - kind: .container, + for container in rows.compactMap(\.resource) { + let id = container.id + + activityCenter.start( + on: container.resourceID, subtitle: container.imageName, failureTitle: "The container couldn’t be deleted." - ) { + ) { _ in try await containerManager.delete( - ids: [container.id], + ids: [id], force: true ) } @@ -282,7 +288,7 @@ struct ContainersView: View { while needsRefresh { needsRefresh = false - containers = try await containerManager.list().map(ContainerItem.init) + containers = try await containerManager.list() } } @@ -291,8 +297,9 @@ struct ContainersView: View { } } +#if DEBUG #Preview { - let reportManager = ReportManager() + let reportManager = ReportManager.preview ContainersView( searchText: .constant(""), @@ -302,8 +309,10 @@ struct ContainersView: View { command: .constant(nil), refreshTrigger: 0 ) - .environment(ContainerManager()) - .environment(SystemManager()) - .environment(ActivityCenter(reports: reportManager)) + .environment(ContainerManager.preview) + .environment(ContainerSystem.preview) + .environment(SystemActions(containerSystem: .preview)) + .environment(ActivityCenter(reportManager: reportManager)) .environment(reportManager) } +#endif diff --git a/Containers/Views/Containers/Create/CreateContainerGeneral.swift b/Containers/Views/Containers/Create/CreateContainerGeneral.swift new file mode 100644 index 0000000..5164e36 --- /dev/null +++ b/Containers/Views/Containers/Create/CreateContainerGeneral.swift @@ -0,0 +1,69 @@ +// +// CreateContainerGeneralTab.swift +// Containers +// +// Created by Axel Martinez on 2026/11/22. +// + +import Containerization +import ContainersCore +import SwiftUI + +struct CreateContainerGeneral: View { + let mode: CreateContainerView.Mode + let localImages: [ImageDescription] + + @Binding var form: ContainerCreateForm + + @SwiftUI.State private var showsImagePicker = false + + var body: some View { + FormStack { + imageRow + + FormRow( + title: "Name", + description: + "Leave empty to generate a unique name automatically. Names start with a letter or number, and may contain only letters, numbers, underscores, periods, and hyphens." + ) { + FormField( + placeholder: "my-container", + value: $form.options.name, + filter: EntityName.valid(from:) + ) + } + } + .sheet(isPresented: $showsImagePicker) { + ItemPicker( + title: "Choose Image", + actionTitle: "Choose", + items: localImages.map { + Item(id: $0.digest, label: $0.reference) + }, + onSelect: { form.imageReference = $0.label } + ) + } + } + + @ViewBuilder + private var imageRow: some View { + if mode == .run { + FormRow(title: "Image") { + Text(form.imageReference) + .fontWeight(.semibold) + .lineLimit(1) + .truncationMode(.middle) + } + } else { + FormRow(title: "Image") { + FormPicker( + placeholder: "Select image…", + options: localImages.map(\.reference), + selection: $form.imageReference, + actionTitle: "Other…", + onAction: { showsImagePicker = true } + ) + } + } + } +} diff --git a/Containers/Views/Containers/Create/CreateContainerManagement.swift b/Containers/Views/Containers/Create/CreateContainerManagement.swift new file mode 100644 index 0000000..f40c6ec --- /dev/null +++ b/Containers/Views/Containers/Create/CreateContainerManagement.swift @@ -0,0 +1,236 @@ +// +// CreateContainerManagementTab.swift +// Containers +// +// Created by Axel Martinez on 2026/11/22. +// + +import ContainerizationOCI +import ContainersCore +import SwiftUI +import Virtualization + +struct CreateContainerManagement: View { + /// Which lists are open. The sheet keeps it, so that it survives switching tabs. + struct ExpandedLists { + var volumes = false + var mounts = false + var ports = false + var capabilities = false + } + + let networkNames: [String] + let availableVolumes: [VolumeResource] + + @Binding var form: ContainerCreateForm + @Binding var expandedLists: ExpandedLists + + /// Nested virtualization is refused outright by the Virtualization + /// framework on hardware that cannot do it, so the flag is not offered + /// where ticking it could only fail. + private static let supportsNestedVirtualization = + VZGenericPlatformConfiguration.isNestedVirtualizationSupported + + private static var platformOptions: [String] { + let current = Platform.current + var options = [current.description] + + if current.architecture == "arm64" { + options.append("linux/amd64") + } + + return options + } + + var body: some View { + VStack(alignment: .leading, spacing: 0) { + FormStack { + FormRow( + title: "Platform", + description: + "Choose the image variant to run. AMD64 containers use Rosetta on Apple Silicon." + ) { + FormPicker( + placeholder: "Platform", + options: Self.platformOptions, + selection: $form.platform + ) + } + + if NetworkManager.supportsCustomNetworks { + FormRow( + title: "Network", + description: "The network the container attaches to. Manage networks in Settings." + ) { + FormPicker( + placeholder: "Network", + options: networkNames, + selection: $form.network + ) + } + } + + FormRow( + title: "Shared memory", + description: "Size of /dev/shm (e.g. 64M, 1G)" + ) { + FormField( + placeholder: "64M", + value: $form.sharedMemorySize + ) + } + + FormRow(title: "Options") { + options + } + } + .padding(.horizontal, 20) + .padding(.top, 20) + .padding(.bottom, 12) + + Divider() + + Group { + volumesList + mountsList + portsList + capabilitiesList + } + .padding(.horizontal) + } + .frame(maxWidth: .infinity, alignment: .leading) + } + + private var options: some View { + VStack(alignment: .leading) { + Toggle( + "Remove the container after it stops", + isOn: $form.options.deleteOnTermination + ) + + Toggle( + "Mount the root filesystem as read-only", + isOn: $form.configuration.readOnly + ) + + Toggle(isOn: $form.configuration.virtualization) { + VStack(alignment: .leading, spacing: 2) { + Text("Expose virtualization capabilities to the container") + + Text( + Self.supportsNestedVirtualization + ? "Requires host and guest support." + : "Nested virtualization needs an Apple silicon M3 chip or later." + ) + .font(.caption) + .foregroundStyle(.secondary) + } + } + .disabled(!Self.supportsNestedVirtualization) + + Toggle( + "Forward SSH agent socket to container", + isOn: $form.configuration.ssh + ) + } + .toggleStyle(.checkbox) + .fieldProse() + } + + private var volumesList: some View { + FormList( + items: $form.volumes, + title: "Volumes", + isExpanded: $expandedLists.volumes, + editorDescription: + "Select an existing volume or create an anonymous volume. To create a new named volume, use the Volumes section.", + columnTitles: ["Source", "Target"], + addLabel: "Add Volume", + emptyMessage: "No Volumes", + hasContentBelow: true, + newItem: { + VolumeMount( + source: availableVolumes.isEmpty + ? .anonymousVolume : .volume, + volumeName: availableVolumes.first?.name ?? "" + ) + }, + rowSummary: \.summary, + rowValues: \.columns, + canSave: { + !$0.trimmedTarget.isEmpty + && ($0.source == .anonymousVolume || !$0.trimmedVolumeName.isEmpty) + }, + editorContent: { $volume in + VolumeEditor( + mount: $volume, + availableVolumes: availableVolumes + ) + } + ) + } + + private var mountsList: some View { + FormList( + items: $form.mounts, + title: "Mounts", + isExpanded: $expandedLists.mounts, + editorDescription: + "Share a host path with the container, or tick Temporary mount to create an in-memory mount instead.", + columnTitles: ["Source", "Target"], + addLabel: "Add Mount", + emptyMessage: "No Mounts", + hasContentBelow: true, + newItem: { Mount() }, + rowSummary: \.summary, + rowValues: \.columns, + canSave: { + !$0.trimmedTarget.isEmpty + && ($0.isTemporary || $0.hostURL != nil) + }, + editorContent: { $mount in + MountEditor(mount: $mount) + } + ) + } + + private var portsList: some View { + FormList( + items: $form.ports, + title: "Port Mappings", + isExpanded: $expandedLists.ports, + editorDescription: + "Publish a container port on the host, so it can be reached from outside the container.", + columnTitles: ["Host", "Container", "Protocol"], + addLabel: "Add Port Mapping", + emptyMessage: "No Port Mappings", + hasContentBelow: true, + newItem: { PortMapping() }, + rowSummary: \.summary, + rowValues: \.columns, + editorContent: { $port in + PortEditor(port: $port) + } + ) + } + + private var capabilitiesList: some View { + FormList( + items: $form.capabilities, + title: "Capabilities", + isExpanded: $expandedLists.capabilities, + columnTitles: ["Capability"], + addLabel: "Add Capability", + emptyMessage: "No Capabilities", + newItem: { Capability() }, + rowFields: { $capability in + [ + .init( + placeholder: "CAP_NET_ADMIN", + text: $capability.name + ) + ] + } + ) + } +} diff --git a/Containers/Views/Containers/Create/CreateContainerProcess.swift b/Containers/Views/Containers/Create/CreateContainerProcess.swift new file mode 100644 index 0000000..007d82f --- /dev/null +++ b/Containers/Views/Containers/Create/CreateContainerProcess.swift @@ -0,0 +1,83 @@ +// +// CreateContainerProcessTab.swift +// Containers +// +// Created by Axel Martinez on 2026/11/22. +// + +import ContainersCore +import SwiftUI + +struct CreateContainerProcess: View { + @Binding var form: ContainerCreateForm + + var body: some View { + VStack(alignment: .leading, spacing: 0) { + FormStack { + FormRow( + title: "Entrypoint", + description: "Override the entrypoint of the image." + ) { + FormField( + placeholder: "/bin/sh -c \"echo hello\"", + value: entryPoint + ) + } + + FormRow(title: "Stop signal") { + FormField( + placeholder: "SIGTERM", + value: stopSignal + ) + } + } + .padding(20) + + Divider() + + FormList( + items: $form.environments, + columnTitles: ["Environment Variables", "Value"], + addLabel: "Add Environment Variable", + emptyMessage: "No Environment Variables", + newItem: { KeyValue() }, + rowFields: { keyValue in + [ + .init( + placeholder: "Key", + text: keyValue.key, + isMonospaced: true + ), + .init( + placeholder: "Value", + text: keyValue.value, + isMonospaced: true + ), + ] + } + ) + } + .frame( + maxWidth: .infinity, + maxHeight: .infinity, + alignment: .topLeading + ) + } + + private var entryPoint: Binding { + Binding( + get: { form.options.entryPoint ?? "" }, + set: { form.options.entryPoint = $0.isEmpty ? nil : $0 } + ) + } + + private var stopSignal: Binding { + Binding( + get: { form.configuration.stopSignal ?? "" }, + set: { + let isBlank = $0.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty + form.configuration.stopSignal = isBlank ? nil : $0 + } + ) + } +} diff --git a/Containers/Views/Containers/Create/CreateContainerView+Mode.swift b/Containers/Views/Containers/Create/CreateContainerView+Mode.swift new file mode 100644 index 0000000..3f8796a --- /dev/null +++ b/Containers/Views/Containers/Create/CreateContainerView+Mode.swift @@ -0,0 +1,59 @@ +// +// CreateContainerView+Mode.swift +// Containers +// +// Created by Axel Martinez on 2026/11/22. +// + +import Foundation + +extension CreateContainerView { + enum Mode { + case create + case run + + var title: String { + switch self { + case .create: + "Choose options for you new container" + case .run: + "Choose how you want to run this image" + } + } + + var progressTitle: String { + switch self { + case .create: + "Creating container…" + case .run: + "Running container…" + } + } + + var buttonTitle: String { + switch self { + case .create: + "Create" + case .run: + "Run" + } + } + + var failureTitle: String { + switch self { + case .create: + "The container couldn’t be created." + case .run: + "The container couldn’t be started." + } + } + } + + enum Tab: String, CaseIterable, Identifiable { + case general = "General" + case process = "Process" + case management = "Management" + + var id: String { rawValue } + } +} diff --git a/Containers/Views/Containers/Create/CreateContainerView.swift b/Containers/Views/Containers/Create/CreateContainerView.swift new file mode 100644 index 0000000..a0e82ce --- /dev/null +++ b/Containers/Views/Containers/Create/CreateContainerView.swift @@ -0,0 +1,363 @@ +// +// CreateContainerView.swift +// Containers +// +// Created by Axel Martinez on 2026/02/05. +// + +import Containerization +import ContainerizationOCI +import ContainersCore +import Foundation +import SwiftUI + +struct CreateContainerView: View { + @Environment(ContainerManager.self) private var containerManager + @Environment(ImageManager.self) private var imageManager + @Environment(VolumeManager.self) private var volumeManager + @Environment(NetworkManager.self) private var networkManager + @Environment(ActivityCenter.self) private var activityCenter + @Environment(\.dismiss) private var dismiss + @Environment(\.openURL) private var openURL + + let mode: Mode + + @SwiftUI.State private var form: ContainerCreateForm + @SwiftUI.State private var networkNames: [String] = [NetworkConfiguration.defaultName] + @SwiftUI.State private var localImages: [ImageDescription] = [] + @SwiftUI.State private var availableVolumes: [VolumeResource] = [] + @SwiftUI.State private var errorAlert: ErrorAlert? + @SwiftUI.State private var showProgressView: Bool = false + @SwiftUI.State private var creationTask: Task? + @SwiftUI.State private var stepTransitionDirection: Int = 1 + @SwiftUI.State private var showStopConfirmation: Bool = false + @SwiftUI.State private var selectedTab: Tab = .general + @SwiftUI.State private var expandedLists = CreateContainerManagement.ExpandedLists() + + private static let stepAnimation: Animation = .easeOut(duration: 0.2) + + init(imageReference: String, mode: Mode = .create) { + self.mode = mode + self._form = SwiftUI.State(initialValue: ContainerCreateForm(imageReference: imageReference)) + } + + var body: some View { + CreateView( + title: mode.title, + errorAlert: $errorAlert, + isProcessing: showProgressView, + progressTitle: mode.progressTitle, + width: .createSheetWidth, + height: .createSheetHeight, + scrollsContent: selectedTab == .management, + contentPadding: selectedTab == .general ? 20 : 0, + contentID: showProgressView + ? AnyHashable("progress") : AnyHashable(selectedTab), + contentTransition: stepTransition, + tabBar: { + CreateViewTabBar(selection: $selectedTab) + }, + content: { + tabContent + }, + actions: { + Spacer() + Button { + confirmStop() + } label: { + Text("Cancel") + .frame(minWidth: .sheetButtonLabelWidth) + } + .buttonStyle(.bordered) + .keyboardShortcut(.cancelAction) + + Button { + createContainer() + } label: { + Text(mode.buttonTitle) + .frame(minWidth: .sheetButtonLabelWidth) + } + .defaultAction(enabled: !showProgressView && form.isComplete) + } + ) + .confirmationDialog( + mode == .run ? "Stop Running Container" : "Stop Creating Container", + isPresented: $showStopConfirmation, + titleVisibility: .visible + ) { + Button("Stop", role: .destructive) { + cancelCreation() + dismiss() + } + + Button("Continue", role: .cancel) {} + } message: { + Text( + "The container hasn’t finished being \(mode == .run ? "started" : "created"). Stopping now discards it." + ) + } + .task { + await preloadLocalImages() + await preloadVolumes() + + if NetworkManager.supportsCustomNetworks, let networks = try? await networkManager.networks() { + networkNames = networks.map(\.name) + } + } + .onDisappear { + self.showProgressView = false + } + } + + @ViewBuilder + private var tabContent: some View { + switch selectedTab { + case .general: + CreateContainerGeneral( + mode: mode, + localImages: localImages, + form: $form + ) + case .process: + CreateContainerProcess(form: $form) + case .management: + CreateContainerManagement( + networkNames: networkNames, + availableVolumes: availableVolumes, + form: $form, + expandedLists: $expandedLists + ) + } + } + + private var stepTransition: AnyTransition { + let distance = CGFloat.createSheetWidth / 3 + let shift = stepTransitionDirection > 0 ? distance : -distance + + return .asymmetric( + insertion: .opacity.combined(with: .offset(x: shift)), + removal: .identity + ) + } + + private func preloadLocalImages() async { + guard localImages.isEmpty else { return } + + localImages = (try? await imageManager.list().map(\.imageDescription)) ?? [] + + if form.imageReference.isEmpty, let first = localImages.first { + form.imageReference = first.reference + } + } + + private func preloadVolumes() async { + guard availableVolumes.isEmpty else { return } + availableVolumes = (try? await volumeManager.list()) ?? [] + } + + /// Work under way is only stopped on purpose, so the button asks first. + private func confirmStop() { + guard showProgressView else { + dismiss() + return + } + + showStopConfirmation = true + } + + /// Stops work still in flight, so that closing the sheet leaves nothing + /// running behind it. + private func cancelCreation() { + guard showProgressView else { return } + + creationTask?.cancel() + creationTask = nil + showProgressView = false + } + + private func createContainer() { + guard form.isComplete else { + self.errorAlert = ErrorAlert( + "The container needs an image.", + message: "Choose the image to create the container from." + ) + return + } + + let sharedMemoryInBytes: UInt64? + + do { + sharedMemoryInBytes = try form.sharedMemoryInBytes() + } catch { + self.errorAlert = ErrorAlert( + "The shared memory size isn’t valid.", + message: "Enter a size such as 64M or 1G." + ) + return + } + + let form = form + + stepTransitionDirection = 1 + + withAnimation(Self.stepAnimation) { + self.showProgressView = true + } + + creationTask = Task { + do { + let resolved = try ResolvedMounts( + mounts: form.mounts, + volumes: form.volumes + ) + + var process = form.process + var configuration = form.configuration + var options = form.options + + configuration.platform = try Platform(from: form.platform) + configuration.shmSize = sharedMemoryInBytes + // From the system's config.toml. + configuration.resources.cpus = DefaultsStore.getInt(key: .defaultContainerCPUs) ?? configuration.resources.cpus + configuration.resources.memoryInBytes = + DefaultsStore.getUInt64(key: .defaultContainerMemory) ?? configuration.resources.memoryInBytes + configuration.capAdd = form.capabilities.names + configuration.publishedPorts = form.ports.compactMap(\.publishedPort) + process.environments = form.environmentVariables + options.networks = form.networks + // Settled here rather than left to the manager, so that the + // row the work appears in can be titled with the name the + // container is going to have. + options.name = try ContainerManager.createContainerID( + name: options.name + ) + + startCreation( + imageReference: form.trimmedImageReference, + process: process, + configuration: configuration, + mounts: resolved, + options: options, + registryScheme: form.registryScheme + ) + + dismiss() + + // The start is followed on the container's dashboard row, which a detail window doesn't show. + if mode == .run { + openURL(AppLink.containers.url) + } + + return + } catch is CancellationError { + // The sheet was closed on purpose; there is nothing to report. + } catch { + self.errorAlert = ErrorAlert( + mode.failureTitle, + error: error, + showsDetails: false + ) + } + + self.stepTransitionDirection = -1 + + withAnimation(Self.stepAnimation) { + self.showProgressView = false + } + } + } + + /// Hands the work over to the row it will appear in, which is where it is watched and stopped from now on. + /// + /// The volumes are made as part of the work, so that a retry makes them again after a stop has deleted them. + private func startCreation( + imageReference: String, + process: ContainerProcess, + configuration: ContainerConfiguration, + mounts: ResolvedMounts, + options: ContainerManagementOptions, + registryScheme: String + ) { + let containerManager = containerManager + let volumeManager = volumeManager + let mode = mode + + activityCenter.start( + on: .container(options.name), + subtitle: imageReference, + failureTitle: mode.failureTitle + ) { progress in + // What the work made, which goes again if it's stopped, as no work is resumed. + var madeVolumes: [VolumeResource] = [] + var isCreated = false + + do { + let existingVolumes = try await volumeManager.list() + var volumes: [VolumeResource] = [] + + for request in mounts.volumes { + let volume = try await volumeManager.volume(named: request.name, among: existingVolumes) + + if !existingVolumes.contains(where: { $0.name == volume.name }) { + madeVolumes.append(volume) + } + + volumes.append(volume) + } + + var mounted = configuration + mounted.mounts = mounts.filesystems(with: volumes) + let configuration = mounted + + func create(progress: Progress) async throws -> String { + try await containerManager.create( + from: imageReference, + arguments: [], + process: process, + configuration: configuration, + options: options, + registryScheme: registryScheme, + progress: progress + ) + } + + guard mode == .run else { + _ = try await create(progress: progress) + return + } + + // Starting weighs as one of creating's six steps. + progress.totalUnitCount = 7 + + let containerID = try await progress.performStep( + pendingUnitCount: 6 + ) { step in + try await create(progress: step) + } + + isCreated = true + + try await progress.performStep { step in + _ = try await containerManager.run( + id: containerID, + progress: step + ) + } + } catch { + if Task.isCancelled { + // A creation stopped part way deletes its own container; one stopped while starting is + // deleted here. + if isCreated { + try? await containerManager.delete(ids: [options.name], force: true) + } + + if !madeVolumes.isEmpty { + try? await volumeManager.delete(volumes: madeVolumes) + } + } + + throw error + } + } + } +} diff --git a/Containers/Views/Containers/MountEditor.swift b/Containers/Views/Containers/Create/MountEditor.swift similarity index 100% rename from Containers/Views/Containers/MountEditor.swift rename to Containers/Views/Containers/Create/MountEditor.swift diff --git a/Containers/Views/Containers/PortEditor.swift b/Containers/Views/Containers/Create/PortEditor.swift similarity index 98% rename from Containers/Views/Containers/PortEditor.swift rename to Containers/Views/Containers/Create/PortEditor.swift index 5a550eb..43253cf 100644 --- a/Containers/Views/Containers/PortEditor.swift +++ b/Containers/Views/Containers/Create/PortEditor.swift @@ -5,7 +5,7 @@ // Created by Axel Martinez on 03/08/2026. // -import ContainerSystem +import ContainersCore import SwiftUI /// The editors the create sheet's lists open for one drafted item at a time. diff --git a/Containers/Views/Containers/VolumeEditor.swift b/Containers/Views/Containers/Create/VolumeEditor.swift similarity index 86% rename from Containers/Views/Containers/VolumeEditor.swift rename to Containers/Views/Containers/Create/VolumeEditor.swift index a0b3039..eeef03e 100644 --- a/Containers/Views/Containers/VolumeEditor.swift +++ b/Containers/Views/Containers/Create/VolumeEditor.swift @@ -5,12 +5,12 @@ // Created by Axel Martinez on 03/08/2026. // -import ContainerSystem +import ContainersCore import SwiftUI struct VolumeEditor: View { @Binding var mount: VolumeMount - let availableVolumes: [Volume] + let availableVolumes: [VolumeResource] var body: some View { VStack(alignment: .leading, spacing: 12) { @@ -20,7 +20,7 @@ struct VolumeEditor: View { if mount.source == .volume { field("Volume") { FormPicker( - placeholder: "Select a volume...", + placeholder: "Select a volume…", options: availableVolumes.map(\.name), selection: $mount.volumeName ) @@ -38,7 +38,7 @@ struct VolumeEditor: View { get: { mount.source == .anonymousVolume }, set: { anonymous in mount.source = anonymous ? .anonymousVolume : .volume - if anonymous { mount.volumeName = "" } + mount.volumeName = anonymous ? "" : availableVolumes.first?.name ?? "" } ) } diff --git a/Containers/Views/Containers/CreateContainerView.swift b/Containers/Views/Containers/CreateContainerView.swift deleted file mode 100644 index f969c54..0000000 --- a/Containers/Views/Containers/CreateContainerView.swift +++ /dev/null @@ -1,735 +0,0 @@ -// -// CreateContainerView.swift -// Containers -// -// Created by Axel Martinez on 2026/02/05. -// - -import ContainerSystem -import Containerization -import ContainerizationExtras -import ContainerizationOCI -import Foundation -import SwiftUI -import Virtualization - -struct CreateContainerView: View { - enum Mode { - case create - case run - - var title: String { - switch self { - case .create: - "Create New Container" - case .run: - "Run Container" - } - } - - var progressTitle: String { - switch self { - case .create: - "Creating container..." - case .run: - "Running container..." - } - } - - var buttonTitle: String { - switch self { - case .create: - "Create" - case .run: - "Run" - } - } - } - - enum Tab: String, CaseIterable, Identifiable { - case general = "General" - case process = "Process" - case management = "Management" - - var id: String { rawValue } - } - - @Environment(ContainerManager.self) private var containerManager - @Environment(ImageManager.self) private var imageManager - @Environment(VolumeManager.self) private var volumeManager - @Environment(ActivityCenter.self) private var activityCenter - @Environment(\.dismiss) private var dismiss - @Environment(\.openURL) private var openURL - - let mode: Mode - - @SwiftUI.State var imageReference: String - - @SwiftUI.State private var process: ContainerProcess = .init() - @SwiftUI.State private var options: ContainerManagementOptions = .init() - @SwiftUI.State private var configuration: ContainerConfiguration = .init() - @SwiftUI.State private var volumes: [VolumeMount] = [] - @SwiftUI.State private var mounts: [Mount] = [] - @SwiftUI.State private var ports: [PortMapping] = [] - @SwiftUI.State private var environments: [KeyValue] = [] - @SwiftUI.State private var registryScheme: String = RequestScheme.auto.rawValue - @SwiftUI.State private var platformString: String = Platform.current.description - @SwiftUI.State private var shmSize: String = "" - @SwiftUI.State private var capabilities: [Capability] = [] - @SwiftUI.State private var errorAlert: ErrorAlert? - @SwiftUI.State private var localImages: [ImageDescription] = [] - @SwiftUI.State private var availableVolumes: [Volume] = [] - @SwiftUI.State private var showProgressView: Bool = false - @SwiftUI.State private var creationTask: Task? - @SwiftUI.State private var stepTransitionDirection: Int = 1 - @SwiftUI.State private var showStopConfirmation: Bool = false - @SwiftUI.State private var showPickLocalImage: Bool = false - - // Tabs - @SwiftUI.State private var selectedTab: Tab = .general - @SwiftUI.State private var isVolumesExpanded = false - @SwiftUI.State private var isMountsExpanded = false - @SwiftUI.State private var isPortsExpanded = false - @SwiftUI.State private var isCapabilitiesExpanded = false - - init(imageReference: String, mode: Mode = .create) { - self.mode = mode - self._imageReference = State(initialValue: imageReference) - } - - var body: some View { - CreateView( - title: mode.title, - error: $errorAlert, - isProcessing: showProgressView, - progressTitle: mode.progressTitle, - width: Self.sheetWidth, - height: 460, - scrollsContent: selectedTab == .management, - contentPadding: selectedTab == .general ? 20 : 0, - contentID: showProgressView - ? AnyHashable("progress") : AnyHashable(selectedTab), - contentTransition: stepTransition, - tabBar: { - CreateViewTabBar(selection: $selectedTab) - }, - content: { - tabContent - }, - actions: { - Spacer() - Button { - confirmStop() - } label: { - Text("Cancel") - .frame(width: .sheetButtonLabelWidth) - } - .buttonStyle(.bordered) - - Button { - createContainer() - } label: { - Text(mode.buttonTitle) - .frame(width: .sheetButtonLabelWidth) - } - .defaultAction( - enabled: !showProgressView - && !imageReference.trimmingCharacters( - in: .whitespacesAndNewlines - ).isEmpty - ) - } - ) - .sheet( - isPresented: $showPickLocalImage, - content: { - ItemPicker( - title: "Choose Image", - actionTitle: "Choose", - items: self.localImages.map { - Item(id: $0.digest, label: $0.reference) - }, - onSelect: { self.imageReference = $0.label } - ) - } - ) - .confirmationDialog( - mode == .run ? "Stop Running Container" : "Stop Creating Container", - isPresented: $showStopConfirmation, - titleVisibility: .visible - ) { - Button("Stop", role: .destructive) { - cancelCreation() - dismiss() - } - - Button("Continue", role: .cancel) {} - } message: { - Text( - "The container hasn’t finished being \(mode == .run ? "started" : "created"). Stopping now discards it." - ) - } - .task { - await preloadLocalImages() - await preloadVolumes() - } - .onDisappear { - self.showProgressView = false - } - } - - /// Work under way is only stopped on purpose, so the button asks first. - private func confirmStop() { - guard showProgressView else { - dismiss() - return - } - - showStopConfirmation = true - } - - private static var platformOptions: [String] { - let current = Platform.current - var options = [current.description] - - if current.architecture == "arm64" { - options.append("linux/amd64") - } - - return options - } - - @ViewBuilder - private var imageSelectionField: some View { - if mode == .run { - FormRow(title: "Image") { - Text(imageReference) - .fontWeight(.semibold) - .lineLimit(1) - .truncationMode(.middle) - } - } else { - FormRow(title: "Image") { - FormPicker( - placeholder: "Select Image...", - options: localImages.map { $0.reference }, - selection: $imageReference, - actionTitle: "Other...", - onAction: { showPickLocalImage = true } - ) - } - } - } - - private func preloadLocalImages() async { - guard localImages.isEmpty else { return } - - localImages = (try? await imageManager.list().map(\.description)) ?? [] - - if imageReference.isEmpty, let first = localImages.first { - imageReference = first.reference - } - } - - private func showLocalImageSelection() { - guard localImages.isEmpty else { - showPickLocalImage = true - return - } - - Task { - do { - showProgressView = true - localImages = try await imageManager.list().map(\.description) - showProgressView = false - showPickLocalImage = true - } catch (let error) { - showProgressView = false - errorAlert = ErrorAlert( - "The images couldn’t be loaded.", - error: error - ) - } - } - } - - /// Nested virtualization is refused outright by the Virtualization - /// framework on hardware that cannot do it, so the flag is not offered - /// where ticking it could only fail. - private static let supportsNestedVirtualization = - VZGenericPlatformConfiguration.isNestedVirtualizationSupported - - @ViewBuilder - private var tabContent: some View { - switch selectedTab { - case .general: - generalTab - case .process: - processTab - case .management: - managementTab - } - } - - private var generalTab: some View { - FormStack { - imageSelectionField - - FormRow( - title: "Name", - description: - "Leave empty to generate a unique name automatically. Names start with a letter or number, and may contain only letters, numbers, underscores, periods, and hyphens." - ) { - FormField( - placeholder: "my-container", - value: $options.name, - filter: EntityName.valid(from:) - ) - } - } - } - - private var processTab: some View { - VStack(alignment: .leading, spacing: 0) { - FormStack { - FormRow( - title: "Entrypoint", - description: "Override the entrypoint of the image." - ) { - FormField( - placeholder: "/bin/sh -c \"echo hello\"", - value: Binding( - get: { options.entryPoint ?? "" }, - set: { - options.entryPoint = $0.isEmpty ? nil : $0 - } - ) - ) - } - - FormRow(title: "Stop Signal") { - FormField( - placeholder: "SIGTERM", - value: Binding( - get: { configuration.stopSignal ?? "" }, - set: { - configuration.stopSignal = - $0.trimmingCharacters( - in: .whitespacesAndNewlines - ).isEmpty ? nil : $0 - } - ) - ) - } - } - .padding(20) - - Divider() - - FormList( - items: $environments, - columnTitles: ["Environment Variables", "Value"], - addLabel: "Add Environment Variable", - emptyMessage: "No Environment Variables", - newItem: { KeyValue() }, - rowFields: { keyValue in - [ - .init( - placeholder: "Key", - text: keyValue.key, - isMonospaced: true - ), - .init( - placeholder: "Value", - text: keyValue.value, - isMonospaced: true - ), - ] - } - ) - } - .frame( - maxWidth: .infinity, - maxHeight: .infinity, - alignment: .topLeading - ) - } - - private var managementTab: some View { - VStack(alignment: .leading, spacing: 0) { - FormStack { - FormRow( - title: "Platform", - description: - "Choose the image variant to run. AMD64 containers use Rosetta on Apple Silicon." - ) { - FormPicker( - placeholder: "Platform", - options: Self.platformOptions, - selection: $platformString - ) - } - - FormRow( - title: "Shared Memory", - description: "Size of /dev/shm (e.g. 64M, 1G)" - ) { - FormField( - placeholder: "64M", - value: $shmSize - ) - } - - FormRow(title: "Options") { - VStack(alignment: .leading) { - Toggle( - "Remove the container after it stops", - isOn: $options.deleteOnTermination - ) - - Toggle( - "Mount the root filesystem as read-only", - isOn: $configuration.readOnly - ) - - Toggle(isOn: $configuration.virtualization) { - VStack(alignment: .leading, spacing: 2) { - Text( - "Expose virtualization capabilities to the container" - ) - - Text( - Self.supportsNestedVirtualization - ? "Requires host and guest support." - : "Nested virtualization needs an Apple silicon M3 chip or later." - ) - .font(.caption) - .foregroundStyle(.secondary) - } - } - .disabled(!Self.supportsNestedVirtualization) - - Toggle( - "Forward SSH agent socket to container", - isOn: $configuration.ssh - ) - } - .toggleStyle(.checkbox) - .fieldProse() - } - } - .padding(.horizontal, 20) - .padding(.top, 20) - .padding(.bottom, 12) - - Divider() - - FormList( - items: $volumes, - title: "Volumes", - isExpanded: $isVolumesExpanded, - editorDescription: - "Select an existing volume or create an anonymous volume. To create a new named volume, use the Volumes section.", - columnTitles: ["Source", "Target"], - addLabel: "Add Volume", - emptyMessage: "No Volumes", - hasContentBelow: true, - newItem: { - VolumeMount( - source: availableVolumes.isEmpty - ? .anonymousVolume : .volume, - volumeName: availableVolumes.last?.name ?? "" - ) - }, - rowSummary: \.summary, - rowValues: \.columns, - canSave: { !$0.trimmedTarget.isEmpty }, - editorContent: { $volume in - VolumeEditor( - mount: $volume, - availableVolumes: availableVolumes - ) - } - ) - .padding(.horizontal) - - FormList( - items: $mounts, - title: "Mounts", - isExpanded: $isMountsExpanded, - editorDescription: - "Share a host path with the container, or tick Temporary mount to create an in-memory mount instead.", - columnTitles: ["Source", "Target"], - addLabel: "Add Mount", - emptyMessage: "No Mounts", - hasContentBelow: true, - newItem: { Mount() }, - rowSummary: \.summary, - rowValues: \.columns, - canSave: { - !$0.trimmedTarget.isEmpty - && ($0.isTemporary || $0.hostURL != nil) - }, - editorContent: { $mount in - MountEditor(mount: $mount) - } - ) - .padding(.horizontal) - - FormList( - items: $ports, - title: "Port Mappings", - isExpanded: $isPortsExpanded, - editorDescription: - "Publish a container port on the host, so it can be reached from outside the container.", - columnTitles: ["Host", "Container", "Protocol"], - addLabel: "Add Port Mapping", - emptyMessage: "No Port Mappings", - hasContentBelow: true, - newItem: { PortMapping() }, - rowSummary: \.summary, - rowValues: \.columns, - editorContent: { $port in - PortEditor(port: $port) - } - ) - .padding(.horizontal) - - FormList( - items: $capabilities, - title: "Capabilities", - isExpanded: $isCapabilitiesExpanded, - columnTitles: ["Capability"], - addLabel: "Add Capability", - emptyMessage: "No Capabilities", - newItem: { Capability() }, - rowFields: { $capability in - [ - .init( - placeholder: "CAP_NET_ADMIN", - text: $capability.name - ) - ] - } - ) - .padding(.horizontal) - } - .frame(maxWidth: .infinity, alignment: .leading) - } - - private func preloadVolumes() async { - guard availableVolumes.isEmpty else { return } - availableVolumes = (try? await volumeManager.list()) ?? [] - } - - private static let sheetWidth: CGFloat = 660 - private static let stepAnimation: Animation = .easeOut(duration: 0.2) - - private var stepTransition: AnyTransition { - let distance = Self.sheetWidth / 3 - let shift = stepTransitionDirection > 0 ? distance : -distance - - return .asymmetric( - insertion: .opacity.combined(with: .offset(x: shift)), - removal: .identity - ) - } - - /// Stops work still in flight, so that closing the sheet leaves nothing - /// running behind it. - private func cancelCreation() { - guard showProgressView else { return } - - creationTask?.cancel() - creationTask = nil - showProgressView = false - } - - /// Hands the work over to the row it will appear in, which is where it is watched and stopped from now on. - private func startCreation( - imageReference: String, - process: ContainerProcess, - configuration: ContainerConfiguration, - options: ContainerManagementOptions, - registryScheme: String - ) { - let containerManager = containerManager - let mode = mode - let imagesDir = UserDefaults.applicationDataRoot - .appendingPathComponent("images") - - activityCenter.start( - id: options.name, - kind: .container, - title: options.name, - subtitle: imageReference, - failureTitle: mode == .run - ? "The container couldn’t be started." - : "The container couldn’t be created." - ) { progress in - func create(progress: Progress) async throws -> String { - try await containerManager.create( - imageReference: imageReference, - imagesDir: imagesDir, - arguments: [], - process: process, - configuration: configuration, - options: options, - registryScheme: registryScheme, - progress: progress - ) - } - - guard mode == .run else { - _ = try await create(progress: progress) - return nil - } - - // Starting weighs as one of creating's six steps. - progress.totalUnitCount = 7 - - let containerID = try await progress.performStep( - pendingUnitCount: 6 - ) { step in - try await create(progress: step) - } - - try await progress.performStep { step in - _ = try await containerManager.run( - id: containerID, - progress: step - ) - } - - return nil - } - } - - private func createContainer() { - let trimmedReference = imageReference.trimmingCharacters( - in: .whitespacesAndNewlines - ) - - guard !trimmedReference.isEmpty else { - self.errorAlert = ErrorAlert( - "The container needs an image.", - message: "Choose the image to create the container from." - ) - return - } - - let trimmedShmSize = shmSize.trimmingCharacters( - in: .whitespacesAndNewlines - ) - var shmSizeInBytes: UInt64? - - if !trimmedShmSize.isEmpty { - guard let bytes = try? Parser.memoryInBytes(from: trimmedShmSize) - else { - self.errorAlert = ErrorAlert( - "The shared memory size isn’t valid.", - message: "Enter a size such as 64M or 1G." - ) - return - } - - shmSizeInBytes = bytes - } - - stepTransitionDirection = 1 - - withAnimation(Self.stepAnimation) { - self.showProgressView = true - } - - creationTask = Task { - do { - let resolved = try ResolvedMounts( - mounts: self.mounts, - volumes: self.volumes - ) - - let existingVolumes = try await volumeManager.list() - var volumes: [Volume] = [] - - for request in resolved.volumes { - volumes.append( - try await volumeManager.volume( - named: request.name, - among: existingVolumes - ) - ) - } - - self.configuration.mounts = resolved.filesystems(with: volumes) - self.configuration.platform = try Platform( - from: self.platformString - ) - self.configuration.shmSize = shmSizeInBytes - self.configuration.capabilities = self.capabilities.names - - self.configuration.publishedPorts = self.ports.compactMap( - \.publishedPort - ) - - let validEnvironments = self.environments.filter({ - !$0.key.trimmingCharacters(in: .whitespacesAndNewlines) - .isEmpty - && !$0.value.trimmingCharacters( - in: .whitespacesAndNewlines - ) - .isEmpty - }) - - self.process.environments = validEnvironments.map { kv in - "\(kv.key)=\(kv.value)" - } - - // Make copies for actor boundary crossing - let process = self.process - let configuration = self.configuration - var options = self.options - let registryScheme = self.registryScheme - // Settled here rather than left to the manager, so that the - // row the work appears in can be titled with the name the - // container is going to have. - options.name = try ContainerManager.createContainerID( - name: options.name - ) - - startCreation( - imageReference: trimmedReference, - process: process, - configuration: configuration, - options: options, - registryScheme: registryScheme - ) - - dismiss() - - // The start is followed on the container's dashboard row, which a detail window doesn't show. - if mode == .run { - openURL(AppLink.containers.url) - } - - return - } catch is CancellationError { - // The sheet was closed on purpose; there is nothing to report. - } catch (let error) { - self.errorAlert = ErrorAlert( - mode == .run - ? "The container couldn’t be started." - : "The container couldn’t be created.", - error: error, - showsDetails: false - ) - } - - self.stepTransitionDirection = -1 - - withAnimation(Self.stepAnimation) { - self.showProgressView = false - } - } - } -} diff --git a/Containers/Views/Dashboard/DashboardSidebar.swift b/Containers/Views/Dashboard/DashboardSidebar.swift index c8ec01d..df8cef3 100644 --- a/Containers/Views/Dashboard/DashboardSidebar.swift +++ b/Containers/Views/Dashboard/DashboardSidebar.swift @@ -5,12 +5,13 @@ // Created by Axel Martinez on 2026/02/05. // -import ContainerSystem +import ContainersCore import SwiftUI struct DashboardSidebar: View { @Environment(ReportManager.self) private var reportManager @Environment(\.sidebarRowSize) private var sidebarRowSize + @Environment(\.isEnabled) private var isSidebarEnabled @Binding var selection: NavigationTab @@ -30,16 +31,44 @@ struct DashboardSidebar: View { } private func row(for tab: NavigationTab) -> some View { - Label { - Text(tab.displayTitle) + let isEnabled = isSidebarEnabled + + // A sidebar doesn't dim a disabled row, so it's greyed here. An enabled row is left to the + // sidebar's own styles. + return Label { + if isEnabled { + Text(tab.displayTitle) + } else { + Text(tab.displayTitle) + .foregroundStyle(.tertiary) + } } icon: { - // Console's icon size; `imageScale` is ignored in a sidebar. - Image(systemName: tab.icon) - .font(.system(size: iconSize)) + if #available(macOS 27, *), isEnabled, tab == .reports { + icon(for: tab) + .rowTint(.secondary) + } else if isEnabled { + icon(for: tab) + } else { + icon(for: tab) + .foregroundStyle(.tertiary) + } } - // Unread reports, counted as Mail counts unread mail. .badge(tab == .reports ? reportManager.unreadCount : 0) .tag(tab) + .selectionDisabled(!isEnabled) + .disabled(!isEnabled) + } + + /// macOS 27 sizes a sidebar's icons itself. + @ViewBuilder + private func icon(for tab: NavigationTab) -> some View { + if #available(macOS 27, *) { + Image(tab.icon) + } else { + // `imageScale` is ignored in a sidebar, so the size is set on the font. + Image(tab.icon) + .font(.system(size: iconSize)) + } } private var iconSize: CGFloat { diff --git a/Containers/Views/Dashboard/DashboardStatusBar.swift b/Containers/Views/Dashboard/DashboardStatusBar.swift index a4174d0..a0afdc5 100644 --- a/Containers/Views/Dashboard/DashboardStatusBar.swift +++ b/Containers/Views/Dashboard/DashboardStatusBar.swift @@ -5,28 +5,38 @@ // Created by Axel Martinez on 2026/02/05. // -import ContainerSystem +import AppKit +import ContainersCore import SwiftUI /// The foot of the dashboard: the system's status, and what the containers /// use between them. struct DashboardStatusBar: View { @Environment(ContainerManager.self) private var containerManager - @Environment(SystemManager.self) private var system + @Environment(ContainerSystem.self) private var containerSystem @Binding var errorAlert: ErrorAlert? - @SwiftUI.State private var usage = ResourceUsage.zero + @SwiftUI.State private var stats = ContainerStatsSummary.zero + @SwiftUI.State private var isWindowVisible = false - /// Each container's CPU time at the last reading, to measure the next by. + /// Each container's CPU time at the last reading, to measure the next by. Kept across restarts of the + /// sampling, which a container starting or stopping causes, so the others' CPU usage carries on. @SwiftUI.State private var cpuSamples: [String: CPUSample] = [:] - @SwiftUI.State private var lastDiskReading: Date = .distantPast private struct CPUSample { let usageMicroseconds: UInt64 let date: Date } + /// What the sampling depends on: it runs only while the readings can be seen, and starts over when a + /// container starts or stops. + private struct SamplingTrigger: Equatable { + let isWindowVisible: Bool + let systemStatus: ContainerSystem.Status + let lastContainerChange: Date + } + var body: some View { HStack(spacing: 16) { SystemStatusControl(errorAlert: $errorAlert) @@ -34,10 +44,19 @@ struct DashboardStatusBar: View { Divider() .frame(height: 16) + // TODO: Show the disk space the system uses, split into images, containers and volumes as + // `container system df` does. `ContainerSystem.diskUsage()` measures the total; follow the + // folder's changes with `FolderEvents` to update it rather than poll. + // In the order and units of `container stats`, one value each; the tooltips break them down. HStack(spacing: 12) { - reading("memorychip", String(format: "%.2f GB", usage.memoryUsage)) - reading("cpu", String(format: "%.0f%%", usage.cpuUsage)) - reading("internaldrive", String(format: "%.2f GB", usage.diskUsage)) + reading("cpu", stats.cpuText) + .help("CPU usage") + reading("memorychip", stats.memoryText) + .help(stats.memoryDetails) + reading("network", stats.networkText) + .help(stats.networkDetails) + reading("internaldrive", stats.diskText) + .help(stats.diskDetails) } .foregroundStyle(.secondary) @@ -49,13 +68,17 @@ struct DashboardStatusBar: View { .overlay(alignment: .top) { Divider() } - .task { - // TODO: Improve the 2-second polling. - while !Task.isCancelled { - await updateUsage() - - try? await Task.sleep(for: .seconds(2)) - } + .onWindowVisibilityChange { isVisible in + isWindowVisible = isVisible + } + .task( + id: SamplingTrigger( + isWindowVisible: isWindowVisible, + systemStatus: containerSystem.status, + lastContainerChange: containerManager.lastContainerChange + ) + ) { + await sampleUsage() } } @@ -67,17 +90,38 @@ struct DashboardStatusBar: View { .font(.subheadline) } - private func updateUsage() async { - guard system.status == .running else { - usage = .zero + /// Reads the containers' usage every 2 seconds while the window is visible and a container runs. The + /// statistics come from each container's VM, so there's nothing to ask while none runs, and nobody + /// to show them to while the window is hidden. + private func sampleUsage() async { + guard containerSystem.status == .running else { + stats = .zero cpuSamples = [:] - lastDiskReading = .distantPast + return + } + // CPU usage measured across the time the window was hidden would be an average, not what's happening. + guard isWindowVisible else { + cpuSamples = [:] return } + while !Task.isCancelled { + guard await containerManager.hasRunningContainers() else { + stats = .zero + cpuSamples = [:] + return + } + + await updateUsage() + + try? await Task.sleep(for: .seconds(2), tolerance: .seconds(1)) + } + } + + private func updateUsage() async { let now = Date() - let containers = await containerManager.resourceUsage() + let containers = await containerManager.stats() // Per container, so one stopping doesn't cancel out the rest; one that // restarted reads as zero for a reading. @@ -85,17 +129,12 @@ struct DashboardStatusBar: View { var samples: [String: CPUSample] = [:] for container in containers { - let sample = CPUSample( - usageMicroseconds: container.cpuUsageMicroseconds, - date: now - ) + let sample = CPUSample(usageMicroseconds: container.cpuUsageMicroseconds, date: now) if let previous = cpuSamples[container.id] { let elapsed = now.timeIntervalSince(previous.date) - if elapsed > 0, - sample.usageMicroseconds >= previous.usageMicroseconds - { + if elapsed > 0, sample.usageMicroseconds >= previous.usageMicroseconds { let spent = sample.usageMicroseconds - previous.usageMicroseconds cpuPercent += Double(spent) / 1_000_000 / elapsed * 100 @@ -107,22 +146,14 @@ struct DashboardStatusBar: View { cpuSamples = samples - // Heavier than asking the containers, so read every 30 seconds. - var diskUsage = usage.diskUsage - - if now.timeIntervalSince(lastDiskReading) >= 30, - let bytes = await system.diskUsage() - { - diskUsage = Double(bytes) / 1_000_000_000 - lastDiskReading = now - } - - let memoryBytes = containers.reduce(UInt64(0)) { $0 + $1.memoryBytes } - - usage = ResourceUsage( - memoryUsage: Double(memoryBytes) / 1_000_000_000, - cpuUsage: cpuPercent, - diskUsage: diskUsage + stats = ContainerStatsSummary( + memoryBytes: containers.reduce(0) { $0 + $1.memoryBytes }, + memoryLimitBytes: containers.reduce(0) { $0 + $1.memoryLimitBytes }, + cpuPercent: cpuPercent, + networkReceivedBytes: containers.reduce(0) { $0 + $1.networkReceivedBytes }, + networkSentBytes: containers.reduce(0) { $0 + $1.networkSentBytes }, + diskReadBytes: containers.reduce(0) { $0 + $1.diskReadBytes }, + diskWriteBytes: containers.reduce(0) { $0 + $1.diskWriteBytes } ) } } diff --git a/Containers/Views/Dashboard/DashboardView.swift b/Containers/Views/Dashboard/DashboardView.swift index 5e87fc9..fd475bd 100644 --- a/Containers/Views/Dashboard/DashboardView.swift +++ b/Containers/Views/Dashboard/DashboardView.swift @@ -6,12 +6,13 @@ // import AppKit -import ContainerSystem +import ContainersCore import SwiftUI import TipKit struct DashboardView: View { - @Environment(SystemManager.self) private var system + @Environment(ContainerSystem.self) private var containerSystem + @Environment(SystemActions.self) private var systemActions @Environment(ActivityCenter.self) private var activityCenter @Environment(ReportManager.self) private var reportManager @@ -19,7 +20,6 @@ struct DashboardView: View { NavigationTab(rawValue: UserDefaults.lastSelectedTab) ?? .images @SwiftUI.State private var errorAlert: ErrorAlert? - @SwiftUI.State private var isFirstLaunch: Bool = UserDefaults.isFirstLaunch @SwiftUI.State private var didCancelSetup: Bool = false @SwiftUI.State private var showWhatsNew: Bool = UserDefaults.shouldShowWhatsNew @@ -38,9 +38,9 @@ struct DashboardView: View { @SwiftUI.State private var refreshTrigger: Int = 0 @SwiftUI.State private var searchText: String = "" @SwiftUI.State private var runningContainersOnly: Bool = false - @SwiftUI.State private var containerSelection: Set = [] - @SwiftUI.State private var imageSelection: Set = [] - @SwiftUI.State private var volumeSelection: Set = [] + @SwiftUI.State private var containerSelection: Set.ID> = [] + @SwiftUI.State private var imageSelection: Set.ID> = [] + @SwiftUI.State private var volumeSelection: Set.ID> = [] @SwiftUI.State private var reportSelection: Set = [] @SwiftUI.State private var reportFilters: [ReportFilter] = [] @@ -54,15 +54,14 @@ struct DashboardView: View { private let addFirstImageTip = AddFirstImageTip() private let runContainerTip = RunContainerTip() - private var isSystemRunning: Bool { system.status == .running } - + private var isSystemRunning: Bool { containerSystem.isRunning } private var containersBeingMade: Int { - activityCenter.activities(ofKind: .container).count + activityCenter.tasks(ofKind: .container).count } /// Only a first start, which has a folder to prepare, reports its steps. private var isMakingFolderReady: Bool { - system.status == .starting && system.setupProgress != nil + containerSystem.status == .starting && containerSystem.setupProgress != nil } @ViewBuilder private var tabContent: some View { @@ -76,8 +75,6 @@ struct DashboardView: View { command: $selectionCommand, refreshTrigger: refreshTrigger ) - // Not padding: the table must run under the toolbar, or AppKit - // draws a line under it. .safeAreaPadding(.top) case .images: ImagesView( @@ -161,9 +158,7 @@ struct DashboardView: View { ) ) // A window opened onto a running system never sees it start. - .task { - await reportManager.refresh() - } + .task(reportManager.refresh) .task { // `.popoverTip` can't attach to an AppKit toolbar item. for await shouldDisplay in addFirstImageTip.shouldDisplayUpdates { @@ -194,15 +189,15 @@ struct DashboardView: View { } } .task { - guard !self.isSystemRunning, !self.isFirstLaunch else { + guard !self.isSystemRunning, !self.isFirstLaunch, UserDefaults.startsSystemOnOpen else { return } - try? await self.system.start( + try? await self.containerSystem.start( appRoot: UserDefaults.applicationDataRoot ) } - .errorAlert($errorAlert) + .alert($errorAlert) .onChange(of: selectedTab) { _, newTab in UserDefaults.lastSelectedTab = newTab.rawValue } @@ -227,16 +222,20 @@ struct DashboardView: View { selectedTab = .containers } + .onChange(of: systemActions.isAskingForKernel) { _, isAskingForKernel in + guard isAskingForKernel else { return } + + didCancelSetup = false + showSystemSetup = true + } .onChange(of: isMakingFolderReady) { _, _ in - guard isMakingFolderReady, !showWhatsNew, - !didCancelSetup - else { + guard isMakingFolderReady, !showWhatsNew, !didCancelSetup else { return } showSystemSetup = true } - .onChange(of: system.status) { _, status in + .onChange(of: containerSystem.status) { _, status in // A run that ended clears the cancel, so the next can // show the sheet. guard status != .starting else { return } @@ -293,19 +292,19 @@ struct DashboardView: View { let failures = selectionActions.failures // A failure that left no report cannot be read, so it is let go of. - for failure in failures where failure.reportID == nil { - activityCenter.remove(failure.id) + for id in failures.filter({ $0.reportID == nil }).compactMap(\.taskID) { + activityCenter.remove(id) } let ids = failures.compactMap(\.reportID) guard !ids.isEmpty else { return } - Task { await reportManager.markRead(ids) } + Task { await reportManager.markRead(ids: ids) } } private func handlePlusButton() { - guard system.status == .running else { return } + guard containerSystem.isRunning else { return } switch selectedTab { case .containers: diff --git a/Containers/Extensions/SwiftUI/View+PopoverTip.swift b/Containers/Views/Dashboard/View+PopoverTip.swift similarity index 100% rename from Containers/Extensions/SwiftUI/View+PopoverTip.swift rename to Containers/Views/Dashboard/View+PopoverTip.swift diff --git a/Containers/Views/Help/HelpSchemeHandler.swift b/Containers/Views/Help/HelpSchemeHandler.swift new file mode 100644 index 0000000..28433f4 --- /dev/null +++ b/Containers/Views/Help/HelpSchemeHandler.swift @@ -0,0 +1,62 @@ +// +// HelpSchemeHandler.swift +// Containers +// +// Created by Axel Martinez on 2026/11/29. +// + +import Foundation +import UniformTypeIdentifiers +import WebKit + +/// Serves the documentation the app bundles, a copy of the website's, under its own scheme, as a web server would: +/// a page's path is a folder holding its `index.html`. +nonisolated struct HelpSchemeHandler: URLSchemeHandler { + static let scheme = "containers-help" + + /// The documentation's folder in the app bundle. + let root: URL + + func reply(for request: URLRequest) -> AsyncThrowingStream { + AsyncThrowingStream { continuation in + guard let url = request.url else { + continuation.finish(throwing: URLError(.badURL)) + return + } + + // DocC's renderer treats a page's data as loaded only with a successful HTTP status, so the reply is an + // HTTP one, and a file that isn't there is a 404 it shows as a missing page. + let file = self.file(for: url) + let data = file.flatMap { try? Data(contentsOf: $0) } + let mimeType = file.flatMap { UTType(filenameExtension: $0.pathExtension)?.preferredMIMEType } ?? "text/plain" + let response = HTTPURLResponse( + url: url, + statusCode: data == nil ? 404 : 200, + httpVersion: "HTTP/1.1", + headerFields: ["Content-Type": mimeType, "Content-Length": "\(data?.count ?? 0)"] + ) + + if let response { + continuation.yield(.response(response)) + } + + continuation.yield(.data(data ?? Data())) + continuation.finish() + } + } + + /// The bundled file a URL names, or `nil` if there's none, or the path would leave the documentation's folder. + private func file(for url: URL) -> URL? { + let root = root.standardizedFileURL + var file = root.appending(path: url.path(percentEncoded: false)).standardizedFileURL + + guard file.path(percentEncoded: false).hasPrefix(root.path(percentEncoded: false)) else { return nil } + + var isDirectory: ObjCBool = false + if FileManager.default.fileExists(atPath: file.path(percentEncoded: false), isDirectory: &isDirectory), isDirectory.boolValue { + file.append(path: "index.html") + } + + return FileManager.default.fileExists(atPath: file.path(percentEncoded: false)) ? file : nil + } +} diff --git a/Containers/Views/Help/HelpSidebar.swift b/Containers/Views/Help/HelpSidebar.swift new file mode 100644 index 0000000..c783ccc --- /dev/null +++ b/Containers/Views/Help/HelpSidebar.swift @@ -0,0 +1,129 @@ +// +// HelpSidebar.swift +// Containers +// +// Created by Axel Martinez on 2026/11/29. +// + +import SwiftUI + +/// The documentation's pages under their headings, as Xcode's documentation window lists topics, or the pages that +/// match a search. +struct HelpSidebar: View { + let contents: HelpContents? + let query: String + + @Binding var selection: String? + + @State private var expanded: Set = [] + + var body: some View { + if let contents { + List(selection: $selection) { + if query.isEmpty { + ForEach(contents.sections) { section in + if !section.title.isEmpty { + HelpHeadingRow(title: section.title) + } + + ForEach(section.topics) { topic in + HelpTopicRows(topic: topic, expanded: $expanded) + } + } + } else { + ForEach(matches(in: contents)) { topic in + HelpTopicRow(topic: topic) + } + } + } + .listStyle(.sidebar) + .overlay { + if !query.isEmpty, matches(in: contents).isEmpty { + ContentUnavailableView.search(text: query) + } + } + // A page reached from a link, or Back and Forward, may be inside a collapsed group. + .onChange(of: selection, initial: true) { + if let selection { + expanded.formUnion(contents.ancestors(of: selection).map(\.id)) + } + } + } else { + ProgressView() + .controlSize(.small) + .frame(maxWidth: .infinity, maxHeight: .infinity) + } + } + + private func matches(in contents: HelpContents) -> [HelpTopic] { + contents.pages.filter { $0.title.localizedStandardContains(query) } + } +} + +/// A topic, and the pages under it in a group that opens to show them. +private struct HelpTopicRows: View { + let topic: HelpTopic + + @Binding var expanded: Set + + var body: some View { + if let subtopics = topic.subtopics { + DisclosureGroup(isExpanded: $expanded.contains(topic.id)) { + ForEach(subtopics) { subtopic in + HelpTopicRows(topic: subtopic, expanded: $expanded) + } + } label: { + HelpTopicRow(topic: topic) + } + } else { + HelpTopicRow(topic: topic) + } + } +} + +/// A page, its icon in the secondary colour as Xcode shows them, rather than the accent colour. +private struct HelpTopicRow: View { + let topic: HelpTopic + + var body: some View { + Label { + Text(topic.title) + } icon: { + Image(systemName: topic.symbol) + .foregroundStyle(.secondary) + } + .lineLimit(1) + .help(topic.title) + // A non-optional tag, which the optional selection matches; an optional one wouldn't. + .tag(topic.id) + } +} + +/// A heading among the pages, as Xcode shows a group of topics: in line with them, rather than as a section header. +private struct HelpHeadingRow: View { + let title: String + + var body: some View { + Text(title) + .fontWeight(.semibold) + .foregroundStyle(.secondary) + .lineLimit(1) + .selectionDisabled() + } +} + +extension Binding where Value == Set { + /// Whether the set holds `element`, as a toggle sets it. + fileprivate func contains(_ element: String) -> Binding { + Binding( + get: { wrappedValue.contains(element) }, + set: { isIncluded in + if isIncluded { + wrappedValue.insert(element) + } else { + wrappedValue.remove(element) + } + } + ) + } +} diff --git a/Containers/Views/Help/HelpView.swift b/Containers/Views/Help/HelpView.swift new file mode 100644 index 0000000..b762db3 --- /dev/null +++ b/Containers/Views/Help/HelpView.swift @@ -0,0 +1,177 @@ +// +// HelpView.swift +// Containers +// +// Created by Axel Martinez on 2026/11/29. +// + +import AppKit +import SwiftUI +import WebKit + +/// The documentation the app bundles, a copy of the website's, laid out as Xcode's documentation window: the topics +/// in a sidebar, and the selected article beside it. +struct HelpView: View { + @State private var page = HelpView.makePage() + @State private var contents: HelpContents? + @State private var selection: String? + @State private var query = "" + @State private var loadError: (any Error)? + + var body: some View { + NavigationSplitView { + HelpSidebar(contents: contents, query: query, selection: $selection) + .navigationSplitViewColumnWidth(min: 220, ideal: 260, max: 360) + } detail: { + detail + } + .searchable(text: $query, placement: .toolbarPrincipal, prompt: "Search documentation") + // Named for the Window menu and VoiceOver, but not shown, as in Xcode's documentation window. + .navigationTitle("Containers Help") + .toolbar(removing: .title) + .toolbar { + ToolbarItemGroup(placement: .navigation) { + Button("Back", systemImage: "chevron.left", action: goBack) + .help("Go back") + .disabled(page.backForwardList.backList.isEmpty) + + Button("Forward", systemImage: "chevron.right", action: goForward) + .help("Go forward") + .disabled(page.backForwardList.forwardList.isEmpty) + } + + ToolbarItem(placement: .primaryAction) { + // The page on the website, as the bundled copy's address means nothing outside the app. + if let url = page.url { + ShareLink(item: Self.websiteURL.appending(path: url.path(percentEncoded: false))) + .help("Share this page") + } + } + } + .frame(minWidth: 760, minHeight: 480) + .task { + if contents == nil { + load() + } + } + // Links in an article move the selection, so the sidebar follows the page. + .onChange(of: page.url) { + guard let url = page.url, contents?.contains(path: Self.topicPath(of: url)) == true else { return } + + selection = Self.topicPath(of: url) + } + .onChange(of: selection) { + guard let selection, selection != page.url.map(Self.topicPath(of:)) else { return } + + follow(page.load(Self.siteURL.appending(path: selection))) + } + } + + @ViewBuilder + private var detail: some View { + if loadError != nil { + ContentUnavailableView { + Label("Help Unavailable", systemImage: "questionmark.book") + } description: { + Text("Containers couldn’t open its documentation. Reinstall Containers, then try again.") + } + } else { + WebView(page) + .webViewBackForwardNavigationGestures(.enabled) + .webViewMagnificationGestures(.enabled) + } + } + + // MARK: Loading + + // Literal URLs, which always parse. + nonisolated static let siteURL = URL(string: "\(HelpSchemeHandler.scheme)://help") ?? URL(fileURLWithPath: "/") + nonisolated static let websiteURL = URL(string: "https://try-containers.github.io") ?? URL(fileURLWithPath: "/") + + /// The documentation's folder, which `scripts/update-help.sh` copies from the website. + private static let bundleURL = Bundle.main.url(forResource: "Help", withExtension: "bundle") + + /// The documentation hides its own navigation and footer, and follows the app's appearance rather than its own + /// setting, when the user agent names the app's help. + private static func makePage() -> WebPage { + var configuration = WebPage.Configuration() + configuration.applicationNameForUserAgent = "ContainersHelp" + + if let bundleURL, let scheme = URLScheme(HelpSchemeHandler.scheme) { + configuration.urlSchemeHandlers[scheme] = HelpSchemeHandler(root: bundleURL) + } + + return WebPage(configuration: configuration, navigationDecider: HelpNavigationDecider()) + } + + /// The table of contents first, then its overview page. + private func load() { + loadError = nil + + do { + guard let bundleURL = Self.bundleURL else { throw CocoaError(.fileNoSuchFile) } + + let contents = try HelpContents(indexData: Data(contentsOf: bundleURL.appending(path: "index/index.json"))) + + self.contents = contents + + // The selection follows once the page loads: set now, it would reach the sidebar before its rows do, + // and the sidebar would clear it. + if let path = contents.overview.path { + follow(page.load(Self.siteURL.appending(path: path))) + } + } catch { + loadError = error + } + } + + // DocC moves between articles in the page's own history, without loading, so the page steps through it, as a + // browser's Back and Forward buttons do. Loading a back-forward list item doesn't restore those entries. + private func goBack() { + Task { _ = try? await page.callJavaScript("history.back()") } + } + + private func goForward() { + Task { _ = try? await page.callJavaScript("history.forward()") } + } + + /// Waits for a navigation to finish, and shows that help is unavailable if it fails. + private func follow(_ navigation: some AsyncSequence) { + Task { + do { + for try await _ in navigation {} + } catch { + loadError = error + } + } + } + + /// The index's form of a page's path: lowercase, without a trailing slash or fragment. + private static func topicPath(of url: URL) -> String { + var path = url.path(percentEncoded: false).lowercased() + + while path.count > 1, path.hasSuffix("/") { + path.removeLast() + } + + return path + } +} + +/// Keeps the help window on the bundled documentation, and opens web links, such as to GitHub, in the default browser. +private struct HelpNavigationDecider: WebPage.NavigationDeciding { + func decidePolicy(for action: WebPage.NavigationAction, preferences: inout WebPage.NavigationPreferences) async -> WKNavigationActionPolicy { + // The documentation also loads `about:blank`, which no app opens, so only web pages leave the window. + guard let url = action.request.url, ["http", "https"].contains(url.scheme?.lowercased()) else { + return .allow + } + + NSWorkspace.shared.open(url) + return .cancel + } +} + +#Preview { + HelpView() + .frame(width: 1100, height: 760) +} diff --git a/Containers/Views/Images/Create/BuildDockerfileView.swift b/Containers/Views/Images/Create/BuildDockerfileView.swift index b13832c..76d05e1 100644 --- a/Containers/Views/Images/Create/BuildDockerfileView.swift +++ b/Containers/Views/Images/Create/BuildDockerfileView.swift @@ -5,15 +5,15 @@ // Created by Axel Martinez on 27/06/2026. // -import ContainerSystem import ContainerizationOCI +import ContainersCore import SwiftUI import UniformTypeIdentifiers struct BuildDockerfileView: View { let defaultFileDialogDirectory: URL? + let onSelection: () -> Void - @Binding var error: ErrorAlert? @Binding var contextDirectory: URL? @Binding var dockerFile: URL? @Binding var buildTag: String @@ -24,24 +24,31 @@ struct BuildDockerfileView: View { var body: some View { FormStack { FormRow(title: "Dockerfile") { - FileSelection( - placeholder: "No Dockerfile selected", - fileURL: $dockerFile, + PathControl( + url: $dockerFile, + style: .popUp, + placeholder: "None", allowedContentTypes: [.item], defaultDirectory: defaultFileDialogDirectory, - onSelection: { error = nil } + onSelection: onSelection ) } + .onChange(of: dockerFile) { oldDockerFile, _ in + // Replacing the Dockerfile clears the build directory, so it falls back to + // suggesting the new Dockerfile's folder. The first pick keeps it, since the + // Dockerfile may have been suggested from the build directory itself. + guard oldDockerFile != nil else { return } + contextDirectory = nil + } - FormRow(title: "Build Directory") { - FileSelection( - placeholder: FileSelection.userHomeDirectory.path(), - fileURL: $contextDirectory, - canChooseDirectories: true, - canCreateDirectories: true, - defaultDirectory: defaultFileDialogDirectory, - style: .field, - onSelection: { error = nil } + FormRow(title: "Build directory") { + PathControl( + url: $contextDirectory, + style: .popUp, + placeholder: "None", + choosesDirectories: true, + defaultDirectory: dockerFileDirectory ?? defaultFileDialogDirectory, + onSelection: onSelection ) } .onChange( @@ -60,7 +67,7 @@ struct BuildDockerfileView: View { ) FormRow( - title: "Image Name", + title: "Image name", description: "⭑ If empty, a generated UUID will be used" ) { FormField( @@ -77,12 +84,19 @@ struct BuildDockerfileView: View { ) } - FormRow(title: "Target Stage") { + FormRow(title: "Target stage") { FormField(placeholder: "Ex: production", value: $targetStage) } } } + /// The folder containing the selected Dockerfile, suggested as the build directory. It's only + /// a suggestion: the sandbox grants access to the Dockerfile alone, so the folder still has to + /// be chosen in the open panel before the build can read it. + private var dockerFileDirectory: URL? { + dockerFile?.deletingLastPathComponent() + } + private var platformOptions: [PlatformSelection] { var options: [PlatformSelection] = [.platform(.current)] diff --git a/Containers/Views/Images/Create/CreateImageConfiguration.swift b/Containers/Views/Images/Create/CreateImageConfiguration.swift index 07f1410..31bba08 100644 --- a/Containers/Views/Images/Create/CreateImageConfiguration.swift +++ b/Containers/Views/Images/Create/CreateImageConfiguration.swift @@ -5,8 +5,8 @@ // Created by Axel Martinez on 28/06/2026. // -import ContainerSystem import ContainerizationOCI +import ContainersCore import Foundation import SwiftUI import UniformTypeIdentifiers @@ -18,10 +18,12 @@ struct CreateImageConfiguration: View { let shouldLoadPullFeaturedImages: Bool let onFileSelection: () -> Void - @Binding var error: ErrorAlert? - @Binding var pull: ImagePullRequest - @Binding var build: ImageBuildRequest - @Binding var load: ImageLoadRequest + @Binding var pullImageName: String + @Binding var pullTag: String + @Binding var pullPlatform: PlatformSelection + @Binding var buildForm: ImageBuildForm + @Binding var tarFile: URL? + @Binding var forceLoad: Bool var body: some View { Group { @@ -29,25 +31,25 @@ struct CreateImageConfiguration: View { case .pull: PullImageView( shouldLoadFeaturedImages: shouldLoadPullFeaturedImages, - imageName: $pull.imageName, - tag: $pull.tag, - platform: $pull.platform + imageName: $pullImageName, + tag: $pullTag, + platform: $pullPlatform ) case .build: BuildDockerfileView( defaultFileDialogDirectory: defaultFileDialogDirectory, - error: $error, - contextDirectory: $build.contextDirectory, - dockerFile: $build.dockerFile, - buildTag: $build.tag, - buildPlatform: $build.platform, - buildArguments: $build.arguments, - targetStage: $build.targetStage + onSelection: onFileSelection, + contextDirectory: $buildForm.contextDirectory, + dockerFile: $buildForm.dockerFile, + buildTag: $buildForm.tag, + buildPlatform: $buildForm.platform, + buildArguments: $buildForm.arguments, + targetStage: $buildForm.targetStage ) case .load: LoadTarImageView( - tarFile: $load.tarFile, - force: $load.force, + tarFile: $tarFile, + force: $forceLoad, tarContentTypes: tarContentTypes, defaultDirectory: defaultFileDialogDirectory, onSelection: onFileSelection diff --git a/Containers/Views/Images/Create/CreateImageMethod.swift b/Containers/Views/Images/Create/CreateImageMethod.swift index 385f759..49b23d0 100644 --- a/Containers/Views/Images/Create/CreateImageMethod.swift +++ b/Containers/Views/Images/Create/CreateImageMethod.swift @@ -15,7 +15,7 @@ struct CreateImageMethod: View { var body: some View { VStack(spacing: 48) { VStack(spacing: 10) { - Image(systemName: "cube.transparent") + Image(Icon.image) .font(.system(size: 68, weight: .regular)) .symbolRenderingMode(.hierarchical) .foregroundStyle(Color(nsColor: .systemBlue)) diff --git a/Containers/Views/Images/Create/CreateImageView.swift b/Containers/Views/Images/Create/CreateImageView.swift index a8d7f35..570ce17 100644 --- a/Containers/Views/Images/Create/CreateImageView.swift +++ b/Containers/Views/Images/Create/CreateImageView.swift @@ -6,11 +6,11 @@ // import AppKit -import ContainerSystem import Containerization import ContainerizationError import ContainerizationOCI import ContainerizationOS +import ContainersCore import Foundation import SwiftUI import UniformTypeIdentifiers @@ -62,9 +62,12 @@ struct CreateImageView: View { @SwiftUI.State private var stepTransitionDirection: Int = 1 @SwiftUI.State private var selectedMethod: CreationMethod? @SwiftUI.State private var failure: ErrorAlert? - @SwiftUI.State private var pull = ImagePullRequest() - @SwiftUI.State private var build = ImageBuildRequest() - @SwiftUI.State private var load = ImageLoadRequest() + @SwiftUI.State private var pullImageName = "" + @SwiftUI.State private var pullTag = "latest" + @SwiftUI.State private var pullPlatform: PlatformSelection = .any + @SwiftUI.State private var buildForm = ImageBuildForm() + @SwiftUI.State private var tarFile: URL? + @SwiftUI.State private var forceLoad = false @SwiftUI.State private var shouldLoadPullFeaturedImages: Bool = false @SwiftUI.State private var paneTitle: String? @@ -72,8 +75,8 @@ struct CreateImageView: View { CreateView( title: "Create Image", isFailed: failure != nil, - width: Self.sheetWidth, - height: 480, + width: .createSheetWidth, + height: .createSheetHeight, showsHeader: false, contentAlignment: .center, showsFooterDivider: false, @@ -91,9 +94,10 @@ struct CreateImageView: View { dismiss() } label: { Text("Cancel") - .frame(width: .sheetButtonLabelWidth) + .frame(minWidth: .sheetButtonLabelWidth) } .buttonStyle(.bordered) + .keyboardShortcut(.cancelAction) Spacer() @@ -101,7 +105,7 @@ struct CreateImageView: View { action: previousStep, label: { Text("Previous") - .frame(width: .sheetButtonLabelWidth) + .frame(minWidth: .sheetButtonLabelWidth) } ) .buttonStyle(.bordered) @@ -113,7 +117,7 @@ struct CreateImageView: View { action: nextStep, label: { Text("Next") - .frame(width: .sheetButtonLabelWidth) + .frame(minWidth: .sheetButtonLabelWidth) } ) .defaultAction(enabled: canProceedToNextStep) @@ -122,7 +126,7 @@ struct CreateImageView: View { action: createImage, label: { Text("Create") - .frame(width: .sheetButtonLabelWidth) + .frame(minWidth: .sheetButtonLabelWidth) } ) .defaultAction( @@ -169,19 +173,20 @@ struct CreateImageView: View { tarContentTypes: tarContentTypes, shouldLoadPullFeaturedImages: shouldLoadPullFeaturedImages, onFileSelection: { failure = nil }, - error: $failure, - pull: $pull, - build: $build, - load: $load + pullImageName: $pullImageName, + pullTag: $pullTag, + pullPlatform: $pullPlatform, + buildForm: $buildForm, + tarFile: $tarFile, + forceLoad: $forceLoad ) } } - private static let sheetWidth: CGFloat = 600 private static let stepAnimation: Animation = .easeOut(duration: 0.2) private var stepTransition: AnyTransition { - let distance = Self.sheetWidth / 3 + let distance = CGFloat.createSheetWidth / 3 let shift = stepTransitionDirection > 0 ? distance : -distance return .asymmetric( @@ -207,9 +212,9 @@ struct CreateImageView: View { return selectedMethod != nil case .configuration: switch selectedMethod { - case .pull: return pull.isComplete - case .build: return build.isComplete - case .load: return load.isComplete + case .pull: return !pullImageName.isEmpty + case .build: return buildForm.isComplete + case .load: return tarFile != nil case .none: return false } } @@ -228,15 +233,15 @@ struct CreateImageView: View { panel.canChooseDirectories = false panel.canCreateDirectories = false panel.showsHiddenFiles = true - panel.directoryURL = load.tarFile?.parent ?? defaultFileDialogDirectory + panel.directoryURL = tarFile?.parent ?? defaultFileDialogDirectory panel.allowedContentTypes = tarContentTypes - guard panel.runModal() == .OK, let url = panel.url else { - return - } + Task { + guard let url = await panel.presentAsSheet() else { return } - load.tarFile = url - createImage() + tarFile = url + createImage() + } } private func prepareStepTransition() { @@ -330,31 +335,29 @@ struct CreateImageView: View { /// here rather than left to the manager, so the row can be titled with /// what the image is going to be called. private func startBuild() throws { - guard let contextDirectory = build.contextDirectory, let dockerFile = build.dockerFile else { + guard let contextDirectory = buildForm.contextDirectory, let dockerFile = buildForm.dockerFile else { throw ContainerizationError( .invalidArgument, message: "Choose a Dockerfile and the folder to build from." ) } - let tag = build.resolvedTag() - let platform = build.targetPlatform - let arguments = build.namedArguments - let targetStage = build.targetStage + let tag = buildForm.resolvedTag() + let platform = buildForm.targetPlatform + let arguments = buildForm.namedArguments + let targetStage = buildForm.targetStage let imageManager = imageManager - activityCenter.start( - id: ImageItem.identity(for: tag) ?? tag, - kind: .image, - title: tag, + // Named as the image will be, so the row and any report are the image's. + on: ResourceID(imageReference: tag), failureTitle: failureTitle(for: .build) ) { progress in try await imageManager.build( dockerFile: dockerFile, contextDirectory: contextDirectory, tag: tag, - cpus: 2, - memory: 1024.mib(), + cpus: Int64(DefaultsStore.getInt(key: .defaultBuildCPUs) ?? 2), + memory: DefaultsStore.getUInt64(key: .defaultBuildMemory) ?? 1024.mib(), vSockPort: 8088, outputs: [ BuildImageOutputConfiguration( @@ -371,8 +374,6 @@ struct CreateImageView: View { cacheOut: [], progress: progress ) - - return nil } } @@ -380,47 +381,49 @@ struct CreateImageView: View { /// is only known once it has been read, so the row is known by the file /// until then. private func startLoad() throws { - guard let tarFile = load.tarFile else { + guard let tarFile else { throw ContainerizationError( .invalidArgument, message: "Choose the archive to load the image from." ) } - let force = load.force + let force = forceLoad let imageManager = imageManager + let activityCenter = activityCenter activityCenter.start( - id: tarFile.path, - kind: .image, - title: tarFile.lastPathComponent, + making: .image, + from: tarFile, failureTitle: failureTitle(for: .load) ) { progress in let loaded = try await imageManager.load( tar: tarFile, force: force, progress: progress - ) + ) { references in + // The images are claimed before any is recorded, so no other work on them runs alongside. + try await activityCenter.claim( + references.map(ResourceID.init(imageReference:)), + forWorkOn: .archive(tarFile) + ) + } // The archive says what it holds only once it has been read, and // what it holds is what the row has been standing in for. - guard let reference = loaded.first?.reference else { return nil } - - return ImageItem.identity(for: reference) ?? reference + return loaded.first.map { ResourceID(imageReference: $0.reference) } } } /// Hands the pull over to the row it will land in, which is where it is /// watched and stopped from now on. private func startPull() { - let reference = pull.reference - let platform = pull.platform.platform + let reference = pullTag.isEmpty ? pullImageName : "\(pullImageName):\(pullTag)" + let platform = pullPlatform.platform let imageManager = imageManager - activityCenter.start( - id: ImageItem.identity(for: reference) ?? reference, - kind: .image, - title: reference, + // Named as the image will be, so the row and any report are the image's. + on: ResourceID(imageReference: reference), failureTitle: failureTitle(for: .pull) ) { progress in try await imageManager.pull( @@ -428,8 +431,6 @@ struct CreateImageView: View { platform: platform, progress: progress ) - - return nil } } diff --git a/Containers/Views/Images/Create/LoadTarImageView.swift b/Containers/Views/Images/Create/LoadTarImageView.swift index 9695f8f..5dc301d 100644 --- a/Containers/Views/Images/Create/LoadTarImageView.swift +++ b/Containers/Views/Images/Create/LoadTarImageView.swift @@ -21,7 +21,7 @@ struct LoadTarImageView: View { var body: some View { FormStack { FormRow( - title: "Tar Archive", + title: "Tar archive", description: "Select a tar archive containing the image" ) { FileSelection( diff --git a/Containers/Views/Images/Create/PullImageView.swift b/Containers/Views/Images/Create/PullImageView.swift index 23d55e2..fe587f8 100644 --- a/Containers/Views/Images/Create/PullImageView.swift +++ b/Containers/Views/Images/Create/PullImageView.swift @@ -194,20 +194,15 @@ struct PullImageView: View { } private var registryImageNameField: some View { - FormRow(title: "Image Name") { - TextField( + FormRow(title: "Image name") { + SuggestionTextField( text: $imageName, - prompt: Text("Ex: nginx, ubuntu, redis") - ) { - EmptyView() - } - .suggestions(for: imageName, isEnabled: isImageNameFieldFocused) { - [registryLookup, registry] text in + prompt: Text("Ex: nginx, ubuntu, redis"), + isFocused: $isImageNameFieldFocused + ) { [registryLookup, registry] text in try await registryLookup.images(matching: text, on: registry) } .textFieldStyle(.roundedBorder) - .labelsHidden() - .focused($isImageNameFieldFocused) .onChange(of: imageName) { oldValue, newValue in if oldValue != newValue, tag != "latest" { tag = "latest" @@ -226,14 +221,11 @@ struct PullImageView: View { @ViewBuilder private var registryTagField: some View { FormRow(title: "Tag") { - TextField( + SuggestionTextField( text: $tag, - prompt: Text("Ex: latest, 1.0, stable") - ) { - EmptyView() - } - .suggestions(for: tag, isEnabled: isTagFieldFocused) { - [registryLookup, registry, imageName] text in + prompt: Text("Ex: latest, 1.0, stable"), + isFocused: $isTagFieldFocused + ) { [registryLookup, registry, imageName] text in try await registryLookup.tags( for: imageName, matching: text, @@ -241,8 +233,6 @@ struct PullImageView: View { ) } .textFieldStyle(.roundedBorder) - .labelsHidden() - .focused($isTagFieldFocused) } } } diff --git a/Containers/Extensions/SwiftUI/TextField+Suggestions.swift b/Containers/Views/Images/Create/SuggestionTextField.swift similarity index 58% rename from Containers/Extensions/SwiftUI/TextField+Suggestions.swift rename to Containers/Views/Images/Create/SuggestionTextField.swift index 3b9f5d4..a00da35 100644 --- a/Containers/Extensions/SwiftUI/TextField+Suggestions.swift +++ b/Containers/Views/Images/Create/SuggestionTextField.swift @@ -1,5 +1,5 @@ // -// TextField+Suggestions.swift +// SuggestionTextField.swift // Containers // // Created by Axel Martinez on 01/08/2026. @@ -7,65 +7,71 @@ import SwiftUI -extension TextField { - /// Suggests completions for `text` once typing stops, while `isEnabled`, such as while the field has focus. - /// On `TextField`, so it must come first in the modifier chain. - func suggestions( - for text: String, - isEnabled: Bool, - fetch: @escaping @Sendable (String) async throws -> [String] - ) -> some View { - modifier(TextFieldSuggestions(text: text, isEnabled: isEnabled, fetch: fetch)) - } -} - -private struct TextFieldSuggestions: ViewModifier { +/// A text field that suggests completions for its text once typing stops, while it has focus. +struct SuggestionTextField: View { private static let debounce: Duration = .milliseconds(300) - let text: String - let isEnabled: Bool + @Binding var text: String + let prompt: Text + let isFocused: FocusState.Binding let fetch: @Sendable (String) async throws -> [String] - @SwiftUI.State private var suggestions: [String] = [] - @SwiftUI.State private var isLoading = false + @State private var suggestions: [String] = [] + @State private var isLoading = false /// Set when the last lookup failed, as opposed to matching nothing. - @SwiftUI.State private var failure: String? - - @SwiftUI.State private var cache = SuggestionCache() - - func body(content: Content) -> some View { - content - .overlay(alignment: .trailing) { - if isLoading { - ProgressView() - .controlSize(.small) - .padding(.trailing, 6) - } else if let failure { - // An empty menu otherwise reads as "nothing matched". - Image(systemName: "exclamationmark.triangle.fill") - .foregroundStyle(.orange) - .help(failure) - .padding(.trailing, 6) - .accessibilityLabel(failure) - } + @State private var failure: String? + + @State private var cache = SuggestionCache() + + var body: some View { + TextField(text: pickingBinding, prompt: prompt) { + EmptyView() + } + .labelsHidden() + .focused(isFocused) + .overlay(alignment: .trailing) { + if isLoading { + ProgressView() + .controlSize(.small) + .padding(.trailing, 6) + } else if let failure { + // An empty menu otherwise reads as "nothing matched". + Image(systemName: "exclamationmark.triangle.fill") + .foregroundStyle(.orange) + .help(failure) + .padding(.trailing, 6) + .accessibilityLabel(failure) } - .textInputSuggestions { - ForEach(suggestions, id: \.self) { suggestion in - Text(suggestion) - .textInputCompletion(suggestion) - } + } + .textInputSuggestions { + ForEach(suggestions, id: \.self) { suggestion in + Text(suggestion) + .textInputCompletion(suggestion) } - // A new text cancels the lookup for the previous one. - .task(id: text) { - await lookUp() + } + // A new text cancels the lookup for the previous one. + .task(id: text, lookUp) + } + + /// The text, noticing a pick of the suggestion it already holds: the field writes it back unchanged, which + /// neither `task(id:)` nor `onChange` sees, so the menu is closed here. + private var pickingBinding: Binding { + Binding { + text + } set: { newText in + if newText == text, suggestions.contains(newText) { + suggestions = [] } + + text = newText + } } private func lookUp() async { // Picking a suggestion sets the text to it, and looking that up would open the menu again. // Losing focus clears nothing, since the system hides the menu, and picking can move focus. - guard isEnabled, !text.isEmpty, !suggestions.contains(text) else { + guard isFocused.wrappedValue, !text.isEmpty, !suggestions.contains(text) else { suggestions = [] failure = nil isLoading = false diff --git a/Containers/Views/Images/ImageDetailView.swift b/Containers/Views/Images/ImageDetailView.swift index 6956678..9c7e524 100644 --- a/Containers/Views/Images/ImageDetailView.swift +++ b/Containers/Views/Images/ImageDetailView.swift @@ -5,16 +5,16 @@ // Created by Axel Martinez on 2026/02/14. // -import ContainerSystem import Containerization import ContainerizationOCI +import ContainersCore import SwiftUI struct ImageDetailWindow: View { @Environment(ImageManager.self) private var imageManager let imageReference: String - @SwiftUI.State private var image: ImageItem? + @SwiftUI.State private var image: ContainersCore.ImageResource? @SwiftUI.State private var isLoading: Bool = true @SwiftUI.State private var toolbarController = DetailToolbarController() @@ -33,13 +33,15 @@ struct ImageDetailWindow: View { height: DetailPlaceholder.image.height ) } else { - ContentUnavailableView( - "Image Not Found", - systemImage: "cube.transparent", - description: Text( - "The image '\(imageReference)' no longer exists." - ) - ) + ContentUnavailableView { + Label { + Text("Image Not Found") + } icon: { + Image(Icon.image) + } + } description: { + Text("The image '\(imageReference)' no longer exists.") + } .frame(width: 550, height: 320) } } @@ -53,9 +55,7 @@ struct ImageDetailWindow: View { .navigationTitle( image.map { Text($0.displayName) } ?? Text("") ) - .task(id: imageReference) { - await load() - } + .task(id: imageReference, load) } private func load() async { @@ -63,14 +63,7 @@ struct ImageDetailWindow: View { defer { isLoading = false } do { - let items = try await imageManager.list(platform: .current) - if let match = items.first(where: { - $0.description.reference == imageReference - }) { - image = ImageItem(match) - } else { - image = nil - } + image = try await imageManager.list(platform: .current).first { $0.name == imageReference } } catch { image = nil } @@ -83,7 +76,7 @@ struct ImageDetailView: View { @Environment(\.dismissWindow) private var dismissWindow @Environment(\.openURL) private var openURL - let image: ImageItem + let image: ContainersCore.ImageResource let toolbarController: DetailToolbarController @SwiftUI.State private var selectedCategory: DetailCategory = .history @@ -176,7 +169,7 @@ struct ImageDetailView: View { ) } .confirmationDialog( - "Delete Image?", + "Are you sure you want to delete “\(image.displayName)”?", isPresented: $showDeleteConfirmation, titleVisibility: .visible ) { @@ -186,21 +179,19 @@ struct ImageDetailView: View { Button("Cancel", role: .cancel) {} } message: { - Text( - "Delete \(image.displayName)? This cannot be undone." - ) + Text("You can’t undo this action.") } - .errorAlert($errorAlert) + .alert($errorAlert) } private var toolbarItems: [DetailToolbarItem] { [ - // A build and a fetch are both reported against the image they - // were making, which is the image this window is about. + // A build and a fetch are both reported under the identity of the + // image they were making, which is the image this window is about. .reports( - about: image.imageDescription.reference, + about: image.resourceID.name, ofKind: [.image, .build], - manager: reportManager, + from: reportManager, openURL: openURL ), DetailToolbarItem( diff --git a/Containers/Views/Images/ImageHistory.swift b/Containers/Views/Images/ImageHistory.swift index d3bdeb2..0f114df 100644 --- a/Containers/Views/Images/ImageHistory.swift +++ b/Containers/Views/Images/ImageHistory.swift @@ -5,9 +5,9 @@ // Created by Axel Martinez on 2026/02/12. // -import ContainerSystem import Containerization import ContainerizationOCI +import ContainersCore import SwiftUI struct ImageHistory: View { @@ -18,7 +18,6 @@ struct ImageHistory: View { @SwiftUI.State private var layers: [LayerInfo] = [] @SwiftUI.State private var isLoading = true - @SwiftUI.State private var errorAlert: ErrorAlert? struct LayerInfo: Identifiable { let id = UUID() @@ -41,13 +40,13 @@ struct ImageHistory: View { Group { if !isLoading, layers.isEmpty { VStack(spacing: 16) { - Image(systemName: "square.stack.3d.up.slash") + Image(systemName: "square.3.layers.3d.slash") .font(.system(size: 48)) .foregroundStyle(.tertiary) - Text("No layers found") + Text("No Layers Found") .font(.headline) .foregroundStyle(.primary) - Text("Unable to retrieve layer information for this image") + Text("Unable to retrieve layer information for this image.") .font(.subheadline) .foregroundStyle(.secondary) } @@ -80,10 +79,7 @@ struct ImageHistory: View { // them rather than padding the window out. .contentUnbounded() .contentReady(!isLoading) - .task { - await loadLayers() - } - .errorAlert($errorAlert) + .task(loadLayers) } private func layerRow(layer: LayerInfo, index: Int) -> some View { @@ -161,8 +157,8 @@ struct ImageHistory: View { defer { isLoading = false } do { - let layerInfo = try await imageManager.getImageLayers( - imageReference: imageReference, + let layerInfo = try await imageManager.layers( + of: imageReference, platform: platform ) @@ -178,10 +174,7 @@ struct ImageHistory: View { } } catch { - self.errorAlert = ErrorAlert( - "The image history couldn’t be loaded.", - error: error - ) + // The empty state already says the layers couldn’t be retrieved. self.layers = [] } } diff --git a/Containers/Views/Images/ImageInfo.swift b/Containers/Views/Images/ImageInfo.swift index 2e595c4..13ed16f 100644 --- a/Containers/Views/Images/ImageInfo.swift +++ b/Containers/Views/Images/ImageInfo.swift @@ -5,11 +5,11 @@ // Created by Axel Martinez on 2026/02/14. // -import ContainerSystem +import ContainersCore import SwiftUI struct ImageInfo: View { - let image: ImageItem + let image: ContainersCore.ImageResource var body: some View { VStack(alignment: .leading, spacing: 20) { diff --git a/Containers/Views/Images/ImageInspect.swift b/Containers/Views/Images/ImageInspect.swift index 19ecd1b..6938f92 100644 --- a/Containers/Views/Images/ImageInspect.swift +++ b/Containers/Views/Images/ImageInspect.swift @@ -5,15 +5,15 @@ // Created by Axel Martinez on 2026/06/06. // -import ContainerSystem +import ContainersCore import SwiftUI struct ImageInspect: View { - let image: ImageItem + let image: ContainersCore.ImageResource @Environment(ImageManager.self) private var imageManager - @State private var printable: ContainerSystem.ImageResource? + @State private var printable: ContainersCore.ImageResource? @State private var errorMessage: String? var body: some View { @@ -30,9 +30,7 @@ struct ImageInspect: View { } } .contentReady(isLoaded) - .task(id: image.id) { - await loadInspectDetail() - } + .task(id: image.id, loadInspectDetail) } /// An error is as much a result to be sized to as the detail itself. diff --git a/Containers/Views/Images/ImagesView.swift b/Containers/Views/Images/ImagesView.swift index 6cb8f0c..815e43e 100644 --- a/Containers/Views/Images/ImagesView.swift +++ b/Containers/Views/Images/ImagesView.swift @@ -5,19 +5,21 @@ // Created by Axel Martinez on 2026/02/05. // -import ContainerSystem import Containerization import ContainerizationOCI +import ContainersCore import SwiftUI import TipKit struct ImagesView: View { + typealias Entry = ResourceEntry + @Environment(ImageManager.self) private var imageManager @Environment(ActivityCenter.self) private var activityCenter @Environment(\.openWindow) private var openWindow @Binding var searchText: String - @Binding var selection: Set + @Binding var selection: Set @Binding var actions: SelectionActions @Binding var command: SelectionCommand? @@ -25,8 +27,9 @@ struct ImagesView: View { private let runContainerTip = RunContainerTip() - @SwiftUI.State private var images: [ImageItem] = [] - @SwiftUI.State private var imageToRun: ImageItem? = nil + @SwiftUI.State private var images: [ContainersCore.ImageResource] = [] + @SwiftUI.State private var digestsInUse: Set = [] + @SwiftUI.State private var imageToRun: ContainersCore.ImageResource? = nil private var trimmedText: String { self.searchText.trimmingCharacters(in: .whitespacesAndNewlines) @@ -34,18 +37,18 @@ struct ImagesView: View { /// An image still on its way gets a row of its own, keyed by the reference /// it will have, so it becomes that row in place when it lands. - private var allImages: [ImageItem] { - activityCenter.marked( - images, + private var allImages: [Entry] { + activityCenter.entries( + for: images, ofKind: .image, - // Builds and pulls are both reported against the image. - reportName: { $0.imageDescription.reference }, + // Builds, pulls and deletions are all reported under the image's identity. reportKinds: [.image, .build], - pendingRow: ImageItem.init(pending:) + isInUse: { digestsInUse.contains($0.indexDigest) }, + includesPending: true ) } - private var filteredImages: [ImageItem] { + private var filteredImages: [Entry] { let all = allImages if trimmedText.isEmpty { @@ -53,21 +56,21 @@ struct ImagesView: View { } let filtered = all.filter({ - $0.name.contains(trimmedText) || $0.tag.contains(trimmedText) + $0.repository.contains(trimmedText) || $0.tag.contains(trimmedText) }) return filtered } /// Running asks for a container's settings, so it is one image at a time. - private func runnable(_ images: [ImageItem]) -> ImageItem? { - guard images.count == 1, let image = images.first, !image.isDisabled + private func runnable(_ rows: [Entry]) -> ContainersCore.ImageResource? { + guard rows.count == 1, let row = rows.first, !row.isDisabled else { return nil } - return image + return row.resource } - private var rowActions: TableRowActions { + private var rowActions: TableRowActions { TableRowActions( noun: "Image", name: \.displayName, @@ -84,7 +87,7 @@ struct ImagesView: View { TableView( rows: filteredImages, selection: $selection, - sortOrder: [KeyPathComparator(\.name), KeyPathComparator(\.tag)], + sortOrder: [KeyPathComparator(\.repository), KeyPathComparator(\.tag)], actions: $actions, command: $command, rowActions: rowActions, @@ -99,9 +102,10 @@ struct ImagesView: View { .disabled(runnable(selected) == nil) } ) { - TableColumn("Name", value: \.name) { image in - ActivityRowName( - row: image, + TableColumn("Name", value: \.repository) { image in + ResourceNameCell( + entry: image, + title: image.repository, activityCenter: activityCenter, openReport: openWindow.report ) @@ -141,21 +145,23 @@ struct ImagesView: View { }, content: { image in CreateContainerView( - imageReference: image.imageDescription.reference, + imageReference: image.name, mode: .run ) } ) } - private func openDetails(for image: ImageItem) { + private func openDetails(for row: Entry) { + guard let image = row.resource else { return } + openWindow( id: ContainersApp.imageDetailWindowID, - value: image.imageDescription.reference + value: image.name ) } - private func run(_ image: ImageItem?) { + private func run(_ image: ContainersCore.ImageResource?) { guard let image else { return } runContainerTip.invalidate(reason: .actionPerformed) @@ -163,17 +169,16 @@ struct ImagesView: View { } /// Run as row work, so a failure shows in the row like a pull's. - private func deleteImages(_ images: [ImageItem]) { + private func deleteImages(_ rows: [Entry]) { let imageManager = imageManager - for image in images { + for image in rows.compactMap(\.resource) { let description = image.imageDescription - activityCenter.run( - on: image.id, - kind: .image, + activityCenter.start( + on: image.resourceID, failureTitle: "The image couldn’t be deleted." - ) { + ) { _ in try await imageManager.delete(images: [description]) } } @@ -181,12 +186,13 @@ struct ImagesView: View { func listImages() async throws { images = try await imageManager.list(platform: .current) - .map(ImageItem.init) + digestsInUse = try await imageManager.digestsInUse() } } +#if DEBUG #Preview { - let reportManager = ReportManager() + let reportManager = ReportManager.preview ImagesView( searchText: .constant(""), @@ -195,7 +201,11 @@ struct ImagesView: View { command: .constant(nil), refreshTrigger: 0 ) - .environment(ContainerManager()) - .environment(ActivityCenter(reports: reportManager)) + .environment(ContainerManager.preview) + .environment(NetworkManager.preview) + .environment(ContainerSystem.preview) + .environment(SystemActions(containerSystem: .preview)) + .environment(ActivityCenter(reportManager: reportManager)) .environment(reportManager) } +#endif diff --git a/Containers/Views/Images/SaveImageView.swift b/Containers/Views/Images/SaveImageView.swift index ca1142b..22c4a65 100644 --- a/Containers/Views/Images/SaveImageView.swift +++ b/Containers/Views/Images/SaveImageView.swift @@ -6,9 +6,9 @@ // import AppKit -import ContainerSystem import Containerization import ContainerizationOCI +import ContainersCore import SwiftUI import UniformTypeIdentifiers @@ -35,11 +35,10 @@ enum SaveImagePanel { accessory.frame = NSRect(x: 0, y: 0, width: 380, height: 44) panel.accessoryView = accessory - let response = panel.runModal() - guard response == .OK, let url = panel.url else { return } - let platform = selection.value.platform ?? .current - Task { @MainActor in + guard let url = await panel.presentAsSheet() else { return } + let platform = selection.value.platform ?? .current + do { try await imageManager.save( images: [image], diff --git a/Containers/Views/Reports/ReportDetailWindow.swift b/Containers/Views/Reports/ReportDetailWindow.swift index 78758ae..d80831b 100644 --- a/Containers/Views/Reports/ReportDetailWindow.swift +++ b/Containers/Views/Reports/ReportDetailWindow.swift @@ -5,7 +5,7 @@ // Created by Axel Martinez on 16/09/2026. // -import ContainerSystem +import ContainersCore import SwiftUI struct ReportDetailWindow: View { @@ -18,7 +18,7 @@ struct ReportDetailWindow: View { @State private var search = "" @State private var toolbar = ReportToolbarController() - /// The lines that mention what is searched for, which is how Console narrows a file down to its matches. + /// The lines that mention what is searched for, so a search narrows the file down to its matches. private var shown: String { let query = search.trimmingCharacters(in: .whitespacesAndNewlines) @@ -53,15 +53,13 @@ struct ReportDetailWindow: View { onSearch: { search = $0 } ) ) - .task { - await load() - } + .task(load) } private func load() async { - entry = await reportManager.get(id: id) + entry = await reportManager.report(withID: id) text = await reportManager.body(of: id) ?? "" - await reportManager.markRead([id]) + await reportManager.markRead(ids: [id]) } } diff --git a/Containers/Views/Reports/ReportsView.swift b/Containers/Views/Reports/ReportsView.swift index 38fc432..bf24eaf 100644 --- a/Containers/Views/Reports/ReportsView.swift +++ b/Containers/Views/Reports/ReportsView.swift @@ -5,7 +5,7 @@ // Created by Axel Martinez on 16/09/2026. // -import ContainerSystem +import ContainersCore import SwiftUI /// Reports of failed work, added automatically as work fails. @@ -26,7 +26,7 @@ struct ReportsView: View { @State private var reading: Task? - /// How long a report stays selected before it counts as read, as in Mail. + /// How long a report stays selected before it counts as read, so passing over one doesn't mark it. private static let readingTime: Duration = .seconds(2) private var trimmedText: String { @@ -49,7 +49,10 @@ struct ReportsView: View { noun: "Report", name: \.name, open: open, - delete: delete + delete: delete, + // A report is the outcome of work, not work under way or its failure mark. + pendingWork: { _ in nil }, + failure: { _ in nil } ) } @@ -61,7 +64,6 @@ struct ReportsView: View { TableView( rows: filteredReports, selection: $selection, - // Newest first, as Console opens on the most recent it keeps. sortOrder: [KeyPathComparator(\.date, order: .reverse)], actions: $actions, command: $command, @@ -144,7 +146,7 @@ struct ReportsView: View { guard !Task.isCancelled else { return } - await reportManager.markRead(selected) + await reportManager.markRead(ids: selected) } } diff --git a/Containers/Views/Reports/SaveSearchSheet.swift b/Containers/Views/Reports/SaveSearchSheet.swift index 281981a..95da57c 100644 --- a/Containers/Views/Reports/SaveSearchSheet.swift +++ b/Containers/Views/Reports/SaveSearchSheet.swift @@ -7,7 +7,7 @@ import SwiftUI -/// Asks what to call a search being saved, as Console asks: one field, and nothing to save until it has a name. +/// Asks what to call a search being saved: one field, and nothing to save until it has a name. struct SaveSearchSheet: View { let onSave: (String) -> Void diff --git a/Containers/Views/Reports/SearchBar.swift b/Containers/Views/Reports/SearchBar.swift index b6d98ca..8135c2e 100644 --- a/Containers/Views/Reports/SearchBar.swift +++ b/Containers/Views/Reports/SearchBar.swift @@ -5,11 +5,11 @@ // Created by Axel Martinez on 26/09/2026. // -import ContainerSystem +import ContainersCore import SwiftUI /// The reports' searches: all, each kind, and those saved. Sits in the -/// dashboard's titlebar, as Console's does, so it shares the toolbar's glass. +/// dashboard's titlebar, so it shares the toolbar's glass. struct SearchBar: View { /// What the reports are narrowed by, which the dashboard holds. @Binding var filters: [ReportFilter] @@ -33,9 +33,8 @@ struct SearchBar: View { + savedSearches.map(\.filters) } - /// What is being shown, the way Console says which of its messages are: - /// the whole of them, one kind at a time, or a search saved by name. A - /// search that is none of these can be saved as one. + /// What is being shown: all the reports, one kind at a time, or a search + /// saved by name. A search that is none of these can be saved as one. var body: some View { ScopeBar(drawsBackground: false) { HStack(spacing: 2) { @@ -72,9 +71,8 @@ struct SearchBar: View { } } -/// A button in the bar that acts on what is shown, drawn as Console draws its -/// Save: outlined and quiet, so that it does not read as another of the -/// choices beside it. +/// A button in the bar that acts on what is shown, drawn outlined and quiet, +/// so that it does not read as another of the choices beside it. private struct OutlinedBarButtonStyle: ButtonStyle { private static let cornerRadius: CGFloat = 4 diff --git a/Containers/Views/Settings/CreateNetworkView.swift b/Containers/Views/Settings/CreateNetworkView.swift new file mode 100644 index 0000000..57126cd --- /dev/null +++ b/Containers/Views/Settings/CreateNetworkView.swift @@ -0,0 +1,126 @@ +// +// CreateNetworkView.swift +// Containers +// +// Created by Axel Martinez on 2026/10/31. +// + +import ContainerizationExtras +import ContainersCore +import SwiftUI + +struct CreateNetworkView: View { + @Environment(NetworkManager.self) private var networkManager + @Environment(\.dismiss) private var dismiss + + /// Called once the network is made. + var onCreate: () -> Void = {} + + @SwiftUI.State private var name = "" + @SwiftUI.State private var mode: NetworkMode = .nat + @SwiftUI.State private var subnet = "" + @SwiftUI.State private var errorAlert: ErrorAlert? + @SwiftUI.State private var isCreating = false + + private var trimmedName: String { + name.trimmingCharacters(in: .whitespacesAndNewlines) + } + + private var trimmedSubnet: String { + subnet.trimmingCharacters(in: .whitespacesAndNewlines) + } + + /// Parsed the way the network is created with; empty asks for one picked automatically. + private var isValidSubnet: Bool { + trimmedSubnet.isEmpty || (try? CIDRv4(trimmedSubnet)) != nil + } + + var body: some View { + CreateView( + title: "Create New Network", + errorAlert: $errorAlert, + isProcessing: isCreating, + progressTitle: "Creating network…", + width: 550, + height: 330, + content: { + FormStack { + FormRow( + title: "Name", + description: + "Names use lowercase letters, numbers, periods, underscores, and hyphens, and start and end with a letter or number." + ) { + FormField(placeholder: "Ex: backend", value: $name, filter: { $0.lowercased() }) + } + + FormRow( + title: "Mode", + description: mode == .nat + ? "Containers reach other networks and the internet through your Mac." + : "Containers reach only each other and your Mac." + ) { + FormPicker( + placeholder: "Mode", + options: NetworkMode.allCases, + selection: $mode, + title: { $0 == .nat ? "NAT" : "Host Only" } + ) + } + + FormRow( + title: "Subnet", + description: "Leave empty for one picked automatically." + ) { + FormField(placeholder: "Ex: 192.168.100.0/24", value: $subnet) + } + } + }, + actions: { + Spacer() + + Button { + dismiss() + } label: { + Text("Cancel") + .frame(minWidth: .sheetButtonLabelWidth) + } + .buttonStyle(.bordered) + .keyboardShortcut(.cancelAction) + + Button { + create() + } label: { + Text("Create") + .frame(minWidth: .sheetButtonLabelWidth) + } + .defaultAction(enabled: !isCreating && NetworkConfiguration.isValidName(trimmedName) && isValidSubnet) + } + ) + } + + private func create() { + isCreating = true + + Task { + do { + try await networkManager.createNetwork( + name: trimmedName, + mode: mode, + subnet: trimmedSubnet.isEmpty ? nil : trimmedSubnet + ) + onCreate() + dismiss() + } catch { + errorAlert = ErrorAlert("The network couldn’t be created.", error: error, showsDetails: false) + } + + isCreating = false + } + } +} + +extension NetworkMode: @retroactive CustomStringConvertible { + public var description: String { + rawValue + } +} diff --git a/Containers/Views/Settings/GeneralSettingsView.swift b/Containers/Views/Settings/GeneralSettingsView.swift new file mode 100644 index 0000000..a68acf8 --- /dev/null +++ b/Containers/Views/Settings/GeneralSettingsView.swift @@ -0,0 +1,109 @@ +// +// GeneralSettingsView.swift +// Containers +// +// Created by Axel Martinez on 2026/11/10. +// + +import AppKit +import ServiceManagement +import SwiftUI + +struct GeneralSettingsView: View { + @AppStorage(UserDefaults.appIconPlacementKey) private var appIconPlacement: AppIconPlacement = .dockAndMenuBar + @AppStorage(UserDefaults.startsSystemOnOpenKey) private var startsSystemOnOpen = true + + @State private var errorAlert: ErrorAlert? + @State private var loginItemStatus = SMAppService.mainApp.status + + var body: some View { + generalSection + .task(refreshSettings) + .alert($errorAlert) + } + + private var generalSection: some View { + SettingsSection { + settingRow("Open at login") { + Toggle("Open at login", isOn: opensAtLogin) + } + + if loginItemStatus == .requiresApproval { + SettingsWarning( + "Containers needs your approval in System Settings to open at login.", + actionTitle: "Open Login Items…", + action: SMAppService.openSystemSettingsLoginItems + ) + } + + settingRow("Show Containers in") { + Picker("Show Containers in", selection: iconPlacement) { + ForEach(AppIconPlacement.allCases) { placement in + Text(placement.title) + } + } + .pickerStyle(.menu) + .buttonStyle(.borderless) + .fixedSize() + .hoverHighlight() + } + + settingRow("Start the container system when Containers opens") { + Toggle("Start the container system when Containers opens", isOn: $startsSystemOnOpen) + } + } + } + + private var opensAtLogin: Binding { + Binding( + get: { loginItemStatus == .enabled || loginItemStatus == .requiresApproval }, + set: { isOn in + do { + if isOn { + try SMAppService.mainApp.register() + } else { + try SMAppService.mainApp.unregister() + } + } catch { + errorAlert = ErrorAlert("The login item couldn’t be changed.", error: error) + } + + loginItemStatus = SMAppService.mainApp.status + } + ) + } + + private var iconPlacement: Binding { + Binding( + get: { appIconPlacement }, + set: { placement in + appIconPlacement = placement + NSApp.updateActivationPolicy() + } + ) + } + + /// A title with its control on the trailing side. + private func settingRow(_ title: String, @ViewBuilder control: () -> Control) -> some View { + HStack { + Text(title) + + Spacer(minLength: 12) + + control() + .toggleStyle(.switch) + .controlSize(.small) + .labelsHidden() + } + } + + private func refreshSettings() { + loginItemStatus = SMAppService.mainApp.status + } +} + +#Preview { + GeneralSettingsView() + .padding(24) + .frame(width: 560) +} diff --git a/Containers/Views/Settings/NetworkSettingsView.swift b/Containers/Views/Settings/NetworkSettingsView.swift new file mode 100644 index 0000000..1096509 --- /dev/null +++ b/Containers/Views/Settings/NetworkSettingsView.swift @@ -0,0 +1,205 @@ +// +// NetworkSettingsView.swift +// Containers +// +// Created by Axel Martinez on 2026/11/10. +// + +import AppKit +import ContainersCore +import SwiftUI + +struct NetworkSettingsView: View { + @Environment(NetworkManager.self) private var networkManager + @Environment(ContainerSystem.self) private var containerSystem + + @State private var errorAlert: ErrorAlert? + @State private var dnsDomains: [DNSDomainSetting] = [] + @State private var defaultDomain: String? + @State private var resolverDirectory: URL? = UserDefaults.resolverDirectory + + var body: some View { + VStack(alignment: .leading, spacing: 22) { + NetworksSection() + dnsDomainsSection + } + .task(refreshSettings) + .alert($errorAlert) + } + + private var dnsDomainsSection: some View { + SettingsSection(title: "DNS Domains", description: dnsDomainsDescription) { + if resolverDirectory == nil { + SettingsWarning( + "Containers needs your permission to read the resolver files in /etc/resolver before it can show the domains kept there.", + actionTitle: "Allow Access…", + action: grantResolverAccess + ) + } else if domainChoices.isEmpty { + Text("No DNS domains") + .foregroundStyle(.secondary) + } else { + ForEach(domainChoices) { domain in + DNSDomainRow( + name: domain.name, + isDefault: domain.name == defaultDomain + ) { isDefault in + setDefaultDomain(isDefault ? domain.name : nil) + } + } + } + } + .task { + defaultDomain = await containerSystem.configuration(in: UserDefaults.applicationDataRoot).dnsDomain + } + } + + private var dnsDomainsDescription: String { + """ + Reach containers by name, such as web.test, and host services, such as host.containers.internal:8000. \ + Managing DNS domains isn’t currently supported in Containers: domains created outside the app appear here. \ + New containers are named in the default domain. + """ + } + + /// The resolver domains, and the default even without its resolver file, so it can still be unset. + private var domainChoices: [DNSDomainSetting] { + let names = dnsDomains.map(\.name) + + guard let defaultDomain, !names.contains(defaultDomain) else { return dnsDomains } + + return dnsDomains + [DNSDomainSetting(name: defaultDomain)] + } + + private func setDefaultDomain(_ domain: String?) { + Task { + do { + try await containerSystem.updateConfiguration(in: UserDefaults.applicationDataRoot) { $0.dnsDomain = domain } + defaultDomain = domain + } catch { + errorAlert = ErrorAlert("The default domain couldn’t be changed.", error: error) + } + } + } + + /// The folder is the user's to give, and an open panel is how they give + /// it: what comes back is kept as a bookmark, which is what the app reads + /// through on every later launch. + private func grantResolverAccess() { + let directory = NetworkManager.resolverDirectory + let panel = NSOpenPanel() + panel.canChooseFiles = false + panel.canChooseDirectories = true + panel.allowsMultipleSelection = false + panel.canCreateDirectories = false + panel.showsHiddenFiles = true + panel.directoryURL = directory + panel.prompt = "Allow" + panel.message = + "Choose the /etc/resolver folder, so Containers can read the DNS domains kept in it." + + Task { + guard let url = await panel.presentAsSheet() else { return } + + keepResolverDirectory(url) + } + } + + private func keepResolverDirectory(_ url: URL) { + guard url.isResolverDirectory else { + errorAlert = ErrorAlert( + "That isn’t the resolver folder.", + message: + "Containers reads its DNS domains from /etc/resolver. Choose that folder to show them here." + ) + + return + } + + do { + let bookmarkData = try url.bookmarkData( + options: [.withSecurityScope], + includingResourceValuesForKeys: nil, + relativeTo: nil + ) + + UserDefaults.setResolverDirectory(bookmarkData: bookmarkData) + containerSystem.resolverDirectory = UserDefaults.resolverDirectory + refreshSettings() + } catch { + errorAlert = ErrorAlert( + "The resolver folder couldn’t be read.", + error: error + ) + } + } + + private func refreshSettings() { + resolverDirectory = UserDefaults.resolverDirectory + dnsDomains = + resolverDirectory + .map(networkManager.domains(in:))? + .map(DNSDomainSetting.init(name:)) ?? [] + } +} + +private struct DNSDomainSetting: Identifiable { + var id: String { name } + var name: String +} + +/// A domain laid out as Printers & Scanners lists printers, with the action to make it the default, or stop it +/// being one, shown while the pointer is over it. +private struct DNSDomainRow: View { + let name: String + let isDefault: Bool + let onSetDefault: (Bool) -> Void + + @State private var isHovering = false + + var body: some View { + HStack(spacing: 10) { + Image(systemName: "network") + .foregroundStyle(.secondary) + .frame(width: 20) + + Text(name) + + Spacer(minLength: 12) + + if isHovering { + Button(isDefault ? "Don’t Use as Default" : "Use as Default") { + onSetDefault(!isDefault) + } + .controlSize(.small) + .help(isDefault ? "Stop naming new containers in this domain" : "Name new containers in this domain") + } else if isDefault { + Text("Default") + .foregroundStyle(.secondary) + } + } + // Tall enough for the button, so the row doesn't grow when it appears. + .frame(minHeight: 20) + .contentShape(Rectangle()) + .onHover { isHovering = $0 } + } +} + +extension URL { + /// Whether this is the folder the resolver files are kept in, whichever + /// way it was reached: `/etc` is a link to `/private/etc`, and an open + /// panel answers with the latter. + fileprivate var isResolverDirectory: Bool { + isSameFolder(as: NetworkManager.resolverDirectory) + } +} + +#if DEBUG +#Preview { + NetworkSettingsView() + .environment(NetworkManager.preview) + .environment(ContainerSystem.preview) + .padding(24) + .frame(width: 560) +} +#endif diff --git a/Containers/Views/Settings/NetworksSection.swift b/Containers/Views/Settings/NetworksSection.swift new file mode 100644 index 0000000..23efd57 --- /dev/null +++ b/Containers/Views/Settings/NetworksSection.swift @@ -0,0 +1,169 @@ +// +// NetworksSection.swift +// Containers +// +// Created by Axel Martinez on 2026/10/31. +// + +import ContainerizationExtras +import ContainersCore +import SwiftUI + +/// The networks containers attach to, kept in the system's folder. +struct NetworksSection: View { + @Environment(NetworkManager.self) private var networkManager + @Environment(ContainerSystem.self) private var containerSystem + + @State private var networks: [NetworkResource] = [] + @State private var isCreating = false + @State private var errorAlert: ErrorAlert? + + private var canChange: Bool { + containerSystem.isRunning + } + + var body: some View { + SettingsSection { + NetworksHeader { + if NetworkManager.supportsCustomNetworks { + Button("Create Network…") { + isCreating = true + } + .disabled(!canChange) + } + } + + if !containerSystem.isRunning { + Text("Start the container system to see its networks.") + .foregroundStyle(.secondary) + } else { + ForEach(networks) { network in + NetworkRow(network: network, canDelete: canChange) { + delete(network) + } + } + } + } + .task(id: containerSystem.status, reload) + .sheet(isPresented: $isCreating) { + CreateNetworkView { + Task { await reload() } + } + } + .alert($errorAlert) + } + + private func reload() async { + guard containerSystem.isRunning else { + networks = [] + return + } + + networks = (try? await networkManager.networks()) ?? [] + } + + private func delete(_ network: NetworkResource) { + Task { + do { + try await networkManager.deleteNetwork(named: network.name) + await reload() + } catch { + errorAlert = ErrorAlert("The network couldn’t be deleted.", error: error) + } + } + } +} + +private struct NetworksHeader: View { + @ViewBuilder var accessory: Accessory + + var body: some View { + HStack(spacing: 12) { + VStack(alignment: .leading, spacing: 3) { + Text("Networks") + + Group { + if NetworkManager.supportsCustomNetworks { + Text("New containers join the checked network unless you choose another.") + } else { + Text("New containers run on the default network. Custom networks aren’t currently supported in Containers.") + } + } + .font(.caption) + .foregroundStyle(.secondary) + } + + Spacer(minLength: 12) + + accessory + } + } +} + +/// A network: a check beside the one in use, the name, its details and a menu of what can be done with it. +private struct NetworkRow: View { + let network: NetworkResource + let canDelete: Bool + let onDelete: () -> Void + + var body: some View { + HStack(spacing: 10) { + Image(systemName: "checkmark") + .fontWeight(.semibold) + .opacity(network.name == NetworkConfiguration.defaultName ? 1 : 0) + .accessibilityHidden(network.name != NetworkConfiguration.defaultName) + + Text(network.name) + + Spacer(minLength: 12) + + Text(network.configuration.ipv4Subnet?.description ?? "Automatic") + .foregroundStyle(.secondary) + .monospacedDigit() + + Image(systemName: network.configuration.mode == .nat ? "globe" : "desktopcomputer") + .foregroundStyle(.secondary) + .frame(width: 20) + .help(network.configuration.mode == .nat ? "Reaches the internet through your Mac" : "Reaches only your Mac and its containers") + + // Deleting is its only option, and networks are made and deleted outside the app until custom networks + // are supported. + if NetworkManager.supportsCustomNetworks { + Menu { + Button("Delete Network", role: .destructive, action: onDelete) + .disabled(network.isBuiltin || !canDelete) + } label: { + Image(systemName: "ellipsis.circle") + .font(.title3) + } + .menuStyle(.button) + .buttonStyle(.borderless) + .menuIndicator(.hidden) + .fixedSize() + .help("Network options") + } + } + } +} + +#Preview { + let networks = [ + try? NetworkConfiguration(name: "default"), + try? NetworkConfiguration(name: "backend", ipv4Subnet: try? CIDRv4("192.168.100.0/24")), + try? NetworkConfiguration(name: "isolated", mode: .hostOnly), + ] + .compactMap { $0 } + .map(NetworkResource.init) + + SettingsSection { + NetworksHeader { + Button("Create Network…") {} + } + + ForEach(networks) { network in + NetworkRow(network: network, canDelete: true) {} + } + } + .padding(24) + .frame(width: 560) +} diff --git a/Containers/Views/Settings/SettingsView.swift b/Containers/Views/Settings/SettingsView.swift index 64f831e..d08c01f 100644 --- a/Containers/Views/Settings/SettingsView.swift +++ b/Containers/Views/Settings/SettingsView.swift @@ -5,18 +5,10 @@ // Created by Axel Martinez on 2026/02/08. // -import AppKit -import ContainerSystem +import ContainersCore import SwiftUI struct SettingsView: View { - @Environment(NetworkManager.self) private var networkManager - @Environment(SystemManager.self) private var system - - @State private var errorAlert: ErrorAlert? - @State private var storageLocation = UserDefaults.applicationDataRoot - @State private var dnsDomains: [DNSDomainSetting] = [] - @State private var resolverDirectory: URL? = UserDefaults.resolverDirectory @State private var selectedSection: SettingsPane? = .general @State private var sectionHistory: [SettingsPane] = [.general] @State private var sectionHistoryIndex = 0 @@ -35,14 +27,14 @@ struct SettingsView: View { var body: some View { NavigationSplitView { - List(SettingsPane.allCases, selection: $selectedSection) { - section in + List(SettingsPane.allCases, selection: $selectedSection) { section in NavigationLink(value: section) { SidebarRow(section: section) } } .listStyle(.sidebar) - .navigationSplitViewColumnWidth(min: 230, ideal: 230, max: 230) + .navigationSplitViewColumnWidth(196) + .fixedSidebarWidth(196) .toolbar(removing: .sidebarToggle) } detail: { content @@ -65,12 +57,8 @@ struct SettingsView: View { .disabled(!canNavigateForward) } } - .frame(width: 760, height: 540) + .frame(minWidth: 760, minHeight: 540) .background(Color(nsColor: .windowBackgroundColor)) - .task { - refreshSettings() - } - .errorAlert($errorAlert) .onChange(of: selectedSection) { oldValue, newValue in guard let newValue, newValue != oldValue else { return @@ -80,163 +68,27 @@ struct SettingsView: View { } } - @ViewBuilder private var content: some View { - switch activeSection { - case .general: - generalSettingsContent - case .network: - networkSettingsContent - } - } - - private var generalSettingsContent: some View { ScrollView { - VStack(alignment: .leading, spacing: 22) { - storageLocationSection - } - .frame(maxWidth: 520, alignment: .topLeading) - .padding(24) - } - .frame(maxWidth: .infinity, maxHeight: .infinity) - .background(Color(nsColor: .windowBackgroundColor)) - } - - private var networkSettingsContent: some View { - ScrollView { - VStack(alignment: .leading, spacing: 22) { - dnsDomainsSection + Group { + switch activeSection { + case .general: + GeneralSettingsView() + case .network: + NetworkSettingsView() + case .system: + SystemSettingsView() + } } .frame(maxWidth: 520, alignment: .topLeading) .padding(24) + // The toolbar's scroll edge spans the scroll view's content, so the content spans the whole pane. + .frame(maxWidth: .infinity) } .frame(maxWidth: .infinity, maxHeight: .infinity) .background(Color(nsColor: .windowBackgroundColor)) } - private var storageLocationPath: Binding { - Binding( - get: { storageLocation.path }, - set: { _ in } - ) - } - - private var storageLocationSection: some View { - SettingsSection(title: "Storage") { - SettingsRow( - description: """ - Containers, images, volumes, kernels, and build data are stored in this folder. - Changes take effect the next time the container system starts. - """ - ) { - FormField( - placeholder: "Storage location", - value: storageLocationPath, - isEditable: false, - actionIcon: "folder", - actionTitle: "Choose", - action: chooseStorageLocation - ) - .disabled(system.status == .running) - } - - HStack { - Spacer() - - Button("Use Default", action: resetStorageLocation) - .disabled(system.status == .running || UserDefaults.usesDefaultApplicationDataRoot) - } - } - } - - private var dnsDomainsSection: some View { - SettingsSection(title: "DNS Domains") { - SettingsRow( - description: - "DNS domains let containers access host services, such as host.containers.internal:8000. Manage domains by creating resolver files in /etc/resolver/." - ) { - VStack(alignment: .leading, spacing: 8) { - // Without the folder to read, there is no saying whether - // there are domains: the warning below asks for it rather - // than this claiming there are none. - if resolverDirectory == nil { - Text("Domains unavailable") - .foregroundStyle(.secondary) - } else if dnsDomains.isEmpty { - Text("No domains configured") - .foregroundStyle(.secondary) - } else { - ForEach(dnsDomains) { domain in - Text(domain.name) - .frame(maxWidth: .infinity, alignment: .leading) - .padding(.horizontal, 8) - .padding(.vertical, 5) - .background( - Color(nsColor: .controlBackgroundColor), - in: RoundedRectangle(cornerRadius: 6) - ) - } - } - } - } - - if resolverDirectory == nil { - SettingsWarning( - "Containers needs your permission to read the resolver files in /etc/resolver before it can show the domains kept there.", - actionTitle: "Allow Access…", - action: grantResolverAccess - ) - } - } - } - - /// The folder is the user's to give, and an open panel is how they give - /// it: what comes back is kept as a bookmark, which is what the app reads - /// through on every later launch. - private func grantResolverAccess() { - let directory = NetworkManager.resolverDirectory - let panel = NSOpenPanel() - panel.canChooseFiles = false - panel.canChooseDirectories = true - panel.allowsMultipleSelection = false - panel.canCreateDirectories = false - panel.showsHiddenFiles = true - panel.directoryURL = directory - panel.prompt = "Allow" - panel.message = - "Choose the /etc/resolver folder, so Containers can read the DNS domains the container CLI keeps in it." - - guard panel.runModal() == .OK, let url = panel.url else { - return - } - - guard url.isResolverDirectory else { - errorAlert = ErrorAlert( - "That isn’t the resolver folder.", - message: - "Containers reads its DNS domains from /etc/resolver. Choose that folder to show them here." - ) - - return - } - - do { - let bookmarkData = try url.bookmarkData( - options: [.withSecurityScope], - includingResourceValuesForKeys: nil, - relativeTo: nil - ) - - UserDefaults.setResolverDirectory(bookmarkData: bookmarkData) - refreshSettings() - } catch { - errorAlert = ErrorAlert( - "The resolver folder couldn’t be read.", - error: error - ) - } - } - private func navigateBack() { guard canNavigateBack else { return @@ -271,63 +123,6 @@ struct SettingsView: View { sectionHistory.append(section) sectionHistoryIndex = sectionHistory.count - 1 } - - private func refreshSettings() { - storageLocation = UserDefaults.applicationDataRoot - resolverDirectory = UserDefaults.resolverDirectory - dnsDomains = - resolverDirectory - .map(networkManager.listDomains(in:))? - .map(DNSDomainSetting.init(name:)) ?? [] - } - - private func chooseStorageLocation() { - let panel = NSOpenPanel() - panel.canChooseFiles = false - panel.canChooseDirectories = true - panel.allowsMultipleSelection = false - panel.canCreateDirectories = true - panel.directoryURL = storageLocation - panel.prompt = "Choose" - panel.message = - "Choose where Containers stores containers, images, volumes, kernels, and build data." - - guard panel.runModal() == .OK, let url = panel.url else { - return - } - - do { - let bookmarkData = try url.bookmarkData( - options: [.withSecurityScope], - includingResourceValuesForKeys: nil, - relativeTo: nil - ) - - let didAccess = url.startAccessingSecurityScopedResource() - defer { - if didAccess { - url.stopAccessingSecurityScopedResource() - } - } - - try FileManager.default.createDirectory( - at: url, - withIntermediateDirectories: true - ) - UserDefaults.setApplicationDataRoot(url, bookmarkData: bookmarkData) - storageLocation = UserDefaults.applicationDataRoot - } catch { - errorAlert = ErrorAlert( - "The storage location couldn’t be changed.", - error: error - ) - } - } - - private func resetStorageLocation() { - UserDefaults.resetApplicationDataRoot() - storageLocation = UserDefaults.applicationDataRoot - } } private struct SidebarRow: View { @@ -351,6 +146,7 @@ private struct SidebarRow: View { private enum SettingsPane: String, CaseIterable, Identifiable { case general case network + case system var id: Self { self } @@ -358,6 +154,7 @@ private enum SettingsPane: String, CaseIterable, Identifiable { switch self { case .general: "General" case .network: "Network" + case .system: "Container System" } } @@ -365,64 +162,15 @@ private enum SettingsPane: String, CaseIterable, Identifiable { switch self { case .general: "gearshape.fill" case .network: "network" + case .system: "gauge.range.33to100.dotted.with.needle" } } } -private struct DNSDomainSetting: Identifiable { - let id = UUID() - var name: String -} - -private struct SettingsWarning: View { - let message: String - let actionTitle: String? - let action: (() -> Void)? - - init( - _ message: String, - actionTitle: String? = nil, - action: (() -> Void)? = nil - ) { - self.message = message - self.actionTitle = actionTitle - self.action = action - } - - var body: some View { - HStack(spacing: 8) { - Image(systemName: "exclamationmark.triangle") - .foregroundStyle(.orange) - - Text(message) - .font(.caption) - .foregroundStyle(.secondary) - .fixedSize(horizontal: false, vertical: true) - - if let actionTitle, let action { - Spacer(minLength: 8) - - Button(actionTitle, action: action) - .controlSize(.small) - .fixedSize() - } - } - } -} - -extension URL { - /// Whether this is the folder the resolver files are kept in, whichever - /// way it was reached: `/etc` is a link to `/private/etc`, and an open - /// panel answers with the latter. - fileprivate var isResolverDirectory: Bool { - resolvingSymlinksInPath().standardizedFileURL - == NetworkManager.resolverDirectory - .resolvingSymlinksInPath().standardizedFileURL - } -} - +#if DEBUG #Preview { SettingsView() - .environment(NetworkManager()) - .environment(SystemManager()) + .environment(NetworkManager.preview) + .environment(ContainerSystem.preview) } +#endif diff --git a/Containers/Views/Settings/SettingsWarning.swift b/Containers/Views/Settings/SettingsWarning.swift new file mode 100644 index 0000000..7f10d42 --- /dev/null +++ b/Containers/Views/Settings/SettingsWarning.swift @@ -0,0 +1,44 @@ +// +// SettingsWarning.swift +// Containers +// +// Created by Axel Martinez on 2026/11/10. +// + +import SwiftUI + +struct SettingsWarning: View { + let message: String + let actionTitle: String? + let action: (() -> Void)? + + init( + _ message: String, + actionTitle: String? = nil, + action: (() -> Void)? = nil + ) { + self.message = message + self.actionTitle = actionTitle + self.action = action + } + + var body: some View { + HStack(spacing: 8) { + Image(systemName: "exclamationmark.triangle") + .foregroundStyle(.orange) + + Text(message) + .font(.caption) + .foregroundStyle(.secondary) + .fixedSize(horizontal: false, vertical: true) + + if let actionTitle, let action { + Spacer(minLength: 8) + + Button(actionTitle, action: action) + .controlSize(.small) + .fixedSize() + } + } + } +} diff --git a/Containers/Views/Settings/SystemSettingsView.swift b/Containers/Views/Settings/SystemSettingsView.swift new file mode 100644 index 0000000..142fbe2 --- /dev/null +++ b/Containers/Views/Settings/SystemSettingsView.swift @@ -0,0 +1,154 @@ +// +// SystemSettingsView.swift +// Containers +// +// Created by Axel Martinez on 2026/11/15. +// + +import AppKit +import ContainersCore +import SwiftUI + +struct SystemSettingsView: View { + @Environment(ContainerSystem.self) private var containerSystem + + @State private var errorAlert: ErrorAlert? + @State private var storageLocation = UserDefaults.applicationDataRoot + + var body: some View { + VStack(alignment: .leading, spacing: 22) { + if !canChangeSystem { + SettingsSection { + HStack(spacing: 8) { + Image(systemName: "exclamationmark.triangle") + .foregroundStyle(.orange) + + Text("Stop the container system to change these settings.") + } + .frame(maxWidth: .infinity, alignment: .leading) + } + } + + storageLocationSection + } + .task { storageLocation = UserDefaults.applicationDataRoot } + .alert($errorAlert) + } + + private var canChangeSystem: Bool { + switch containerSystem.status { + case .notStarted, .failed: true + case .starting, .running, .stopping: false + } + } + + private var storageLocationSection: some View { + SettingsSection(title: "Storage") { + SettingsRow( + description: """ + Containers, images, volumes, and other container system data are stored in this folder. + Changes take effect the next time the container system starts. + """ + ) { + VStack(alignment: .leading, spacing: 10) { + PathControl(url: .constant(storageLocation)) + + HStack { + Button("Change…", action: chooseStorageLocation) + + Button("Reset", action: resetStorageLocation) + .disabled(UserDefaults.usesDefaultApplicationDataRoot) + } + } + .disabled(!canChangeSystem) + } + } + } + + private func chooseStorageLocation() { + let panel = NSOpenPanel() + panel.canChooseFiles = false + panel.canChooseDirectories = true + panel.allowsMultipleSelection = false + panel.canCreateDirectories = true + panel.directoryURL = storageLocation + panel.prompt = "Choose" + panel.message = + "Choose where Containers stores containers, images, volumes, kernels, and build data." + + Task { + guard let url = await panel.presentAsSheet() else { return } + + keepStorageLocation(url) + } + } + + private func keepStorageLocation(_ url: URL) { + // The container CLI would change the folder under the system. + guard ContainerSystem.canStoreData(in: url) else { + errorAlert = ErrorAlert( + "That folder belongs to the container CLI.", + message: "Choose a folder outside the container CLI’s, so that the two don’t change each other’s data." + ) + + return + } + + setStorageLocation(url) + } + + private func setStorageLocation(_ url: URL) { + do { + let bookmarkData = try url.bookmarkData( + options: [.withSecurityScope], + includingResourceValuesForKeys: nil, + relativeTo: nil + ) + + let didAccess = url.startAccessingSecurityScopedResource() + defer { + if didAccess { + url.stopAccessingSecurityScopedResource() + } + } + + try FileManager.default.createDirectory( + at: url, + withIntermediateDirectories: true + ) + UserDefaults.setApplicationDataRoot(url, bookmarkData: bookmarkData) + storageLocation = UserDefaults.applicationDataRoot + restartIfRefused() + } catch { + errorAlert = ErrorAlert( + "The storage location couldn’t be changed.", + error: error + ) + } + } + + private func resetStorageLocation() { + UserDefaults.resetApplicationDataRoot() + storageLocation = UserDefaults.applicationDataRoot + restartIfRefused() + } + + /// A start refused for its folder, which the dashboard sends the user here to change, is tried again in the new one. + private func restartIfRefused() { + guard containerSystem.startupError is ContainerSystem.AppRootError else { return } + + Task { + // Failures show on the dashboard. + try? await containerSystem.start(appRoot: UserDefaults.applicationDataRoot) + } + } +} + +#if DEBUG +#Preview { + SystemSettingsView() + .environment(ContainerSystem.preview) + .padding(24) + .frame(width: 560) +} +#endif diff --git a/Containers/Views/Settings/View+FixedSidebarWidth.swift b/Containers/Views/Settings/View+FixedSidebarWidth.swift new file mode 100644 index 0000000..fdcc484 --- /dev/null +++ b/Containers/Views/Settings/View+FixedSidebarWidth.swift @@ -0,0 +1,105 @@ +// +// View+FixedSidebarWidth.swift +// Containers +// +// Created by Axel Martinez on 2026/11/15. +// + +import AppKit +import SwiftUI + +extension View { + /// Keeps the sidebar of a `NavigationSplitView` at a fixed width, which SwiftUI otherwise lets the user drag, or drag closed. + func fixedSidebarWidth(_ width: CGFloat) -> some View { + background(FixedSidebarWidth(width: width)) + } +} + +private struct FixedSidebarWidth: NSViewRepresentable { + let width: CGFloat + + func makeNSView(context: Context) -> SidebarWidthView { + SidebarWidthView(width: width) + } + + func updateNSView(_ nsView: SidebarWidthView, context: Context) {} + + final class SidebarWidthView: NSView { + private let width: CGFloat + private var observations: [NSKeyValueObservation] = [] + + init(width: CGFloat) { + self.width = width + super.init(frame: .zero) + } + + @available(*, unavailable) + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func viewDidMoveToWindow() { + super.viewDidMoveToWindow() + + observations = [] + + guard window != nil else { return } + + // SwiftUI adds the split view after this view joins the window. + Task { @MainActor [weak self] in + self?.observeSidebar() + } + } + + /// SwiftUI only takes an ideal width for the sidebar, and clears its limits whenever it updates the split view, + /// so they're set again the moment it does. + private func observeSidebar() { + guard let sidebar = enclosingSidebarItem else { return } + + applyFixedWidth() + + // SwiftUI changes the limits on the main thread. + let reapply: @Sendable () -> Void = { [weak self] in + MainActor.assumeIsolated { + self?.applyFixedWidth() + } + } + + observations = [ + sidebar.observe(\.minimumThickness) { _, _ in reapply() }, + sidebar.observe(\.maximumThickness) { _, _ in reapply() }, + sidebar.observe(\.canCollapse) { _, _ in reapply() }, + ] + } + + private func applyFixedWidth() { + guard let sidebar = enclosingSidebarItem else { return } + + if sidebar.canCollapse { + sidebar.canCollapse = false + } + + if sidebar.minimumThickness != width { + sidebar.minimumThickness = width + } + + if sidebar.maximumThickness != width { + sidebar.maximumThickness = width + } + } + + private var enclosingSidebarItem: NSSplitViewItem? { + var ancestor = superview + + while let current = ancestor { + if let splitView = current as? NSSplitView, let controller = splitView.delegate as? NSSplitViewController { + return controller.splitViewItems.first + } + + ancestor = current.superview + } + + return nil + } + } +} diff --git a/Containers/Views/Settings/View+HoverHighlight.swift b/Containers/Views/Settings/View+HoverHighlight.swift new file mode 100644 index 0000000..3d267cb --- /dev/null +++ b/Containers/Views/Settings/View+HoverHighlight.swift @@ -0,0 +1,34 @@ +// +// View+HoverHighlight.swift +// Containers +// +// Created by Axel Martinez on 2026/10/30. +// + +import SwiftUI + +extension View { + /// Fills the view's background while the pointer is over it, so a borderless control shows it can be clicked. + func hoverHighlight() -> some View { + modifier(HoverHighlight()) + } +} + +private struct HoverHighlight: ViewModifier { + @Environment(\.isEnabled) private var isEnabled + + @State private var isHovered = false + + func body(content: Content) -> some View { + content + .padding(.horizontal, 6) + .padding(.vertical, 3) + .background { + RoundedRectangle(cornerRadius: 6, style: .continuous) + .fill(.quaternary) + .opacity(isHovered && isEnabled ? 1 : 0) + } + .onHover { isHovered = $0 } + .animation(.easeOut(duration: 0.12), value: isHovered) + } +} diff --git a/Containers/Views/Shared/Detail/DetailToolbarItem.swift b/Containers/Views/Shared/Detail/DetailToolbarItem.swift index cc431b6..4a1b726 100644 --- a/Containers/Views/Shared/Detail/DetailToolbarItem.swift +++ b/Containers/Views/Shared/Detail/DetailToolbarItem.swift @@ -5,7 +5,7 @@ // Created by Axel Martinez on 03/10/2026. // -import ContainerSystem +import ContainersCore import Foundation import TipKit @@ -58,10 +58,10 @@ extension DetailToolbarItem { static func reports( about name: String, ofKind kinds: Set, - manager: ReportManager, + from reportManager: ReportManager, openURL: OpenURLAction ) -> DetailToolbarItem { - let reports = manager.reports(named: name, ofKind: kinds) + let reports = reportManager.reports(named: name, ofKind: kinds) let hasUnread = reports.contains { !$0.isRead } // Disabled rather than hidden when there's nothing to show: an item diff --git a/Containers/Extensions/SwiftUI/View+Content.swift b/Containers/Views/Shared/Detail/View+Content.swift similarity index 100% rename from Containers/Extensions/SwiftUI/View+Content.swift rename to Containers/Views/Shared/Detail/View+Content.swift diff --git a/Containers/Views/Shared/ErrorAlert.swift b/Containers/Views/Shared/ErrorAlert.swift index db08daf..c5e8278 100644 --- a/Containers/Views/Shared/ErrorAlert.swift +++ b/Containers/Views/Shared/ErrorAlert.swift @@ -7,8 +7,12 @@ import AppKit import ContainerizationError +import ContainersCore import SwiftUI +// TODO: Once an alert has to show something no error causes, such as an update being available, add a general +// alert type and make this one of the ways to build it. Every alert today starts from an error, so this name fits. + /// What went wrong, put the way an alert is meant to put it: a title naming /// the problem, a sentence that can be acted on, and the raw error kept out of /// the way until it is asked for. @@ -27,12 +31,15 @@ struct ErrorAlert: Identifiable, Equatable { /// The title says what failed; the error says why, in the only part of it /// written for a person to read. /// - /// - Parameters showsDetails: Whether the raw error is kept behind a - /// disclosure. Turn it off where the message is the whole account and - /// there is nothing worth unfolding. + /// - Parameters: + /// - title: What failed. + /// - error: Why it failed, which becomes the message. + /// - showsDetails: Whether the raw error is kept behind a disclosure. + /// Turn it off where the message is the whole account and there is + /// nothing worth unfolding. init(_ title: String, error: Error, showsDetails: Bool = true) { let raw = String(describing: error) - let message = Self.message(for: error) + let message = error.alertMessage self.init( title, @@ -44,19 +51,23 @@ struct ErrorAlert: Identifiable, Equatable { static func == (lhs: ErrorAlert, rhs: ErrorAlert) -> Bool { lhs.id == rhs.id } +} +extension Error { + /// The part of the error written for a person to read, as an alert's message puts it. + /// /// A `ContainerizationError` describes itself as `code: "message"`, of /// which only the message was written to be read. - private static func message(for error: Error) -> String { - guard let error = error as? ContainerizationError else { - return error.localizedDescription + var alertMessage: String { + guard let error = self as? ContainerizationError else { + return localizedDescription } let message = error.message.trimmingCharacters( in: .whitespacesAndNewlines ) - return message.isEmpty ? error.localizedDescription : message + return message.isEmpty ? localizedDescription : message } } @@ -64,7 +75,7 @@ extension View { /// Presents errors as the alert AppKit builds: the app icon, centred text, /// and an accent-filled default button, none of which SwiftUI's own alert /// draws on macOS. - func errorAlert(_ alert: Binding) -> some View { + func alert(_ alert: Binding) -> some View { modifier(ErrorAlertModifier(alert: alert)) } } @@ -86,27 +97,38 @@ private struct ErrorAlertModifier: ViewModifier { } private func present(_ alert: ErrorAlert) { - let nsAlert = NSAlert() - nsAlert.alertStyle = .warning - nsAlert.messageText = alert.title - nsAlert.informativeText = alert.message - nsAlert.addButton(withTitle: "OK") - - if let details = alert.details { - nsAlert.accessoryView = ErrorDetailsView( - details: details, - alert: nsAlert - ) + alert.present(for: window) { + self.alert = nil } + } +} - let dismiss: (NSApplication.ModalResponse) -> Void = { _ in - self.alert = nil +extension ErrorAlert { + /// Presents the alert as a sheet on `window`, or on its own where there's no window to hang it off, as from + /// the menu bar, whose menu has closed by the time an action fails. + /// + /// - Parameters: + /// - window: The window the alert came from, if it's still on screen. + /// - onDismiss: Called once the alert is dismissed. + func present(for window: NSWindow? = nil, onDismiss: @escaping () -> Void = {}) { + let alert = NSAlert() + alert.alertStyle = .warning + alert.messageText = title + alert.informativeText = message + alert.addButton(withTitle: "OK") + + if let details { + alert.accessoryView = ErrorDetailsView( + details: details, + alert: alert + ) } if let window, window.isVisible { - nsAlert.beginSheetModal(for: window, completionHandler: dismiss) + alert.beginSheetModal(for: window) { _ in onDismiss() } } else { - dismiss(nsAlert.runModal()) + alert.runModal() + onDismiss() } } } diff --git a/Containers/Views/Shared/Sheets/ContainersUsingSheet.swift b/Containers/Views/Shared/Sheets/ContainersUsingView.swift similarity index 80% rename from Containers/Views/Shared/Sheets/ContainersUsingSheet.swift rename to Containers/Views/Shared/Sheets/ContainersUsingView.swift index d3edf60..3d55477 100644 --- a/Containers/Views/Shared/Sheets/ContainersUsingSheet.swift +++ b/Containers/Views/Shared/Sheets/ContainersUsingView.swift @@ -5,29 +5,28 @@ // Created by Axel Martinez on 16/09/2026. // -import ContainerSystem +import ContainersCore import SwiftUI -/// The containers an image or a volume is used by, each opening into its own -/// window. -struct ContainersUsingSheet: View { +/// The containers an image or a volume is used by, each opening into its own window. +struct ContainersUsingView: View { let title: String let subject: String - let includes: (ContainerSnapshot) -> Bool + let includes: (ManagedContainer) -> Bool @Environment(ContainerManager.self) private var containerManager @Environment(\.openWindow) private var openWindow @Environment(\.dismiss) private var dismiss - @SwiftUI.State private var containers: [ContainerItem] = [] - @SwiftUI.State private var selection: Set = [] + @SwiftUI.State private var containers: [ManagedContainer] = [] + @SwiftUI.State private var selection: Set = [] @SwiftUI.State private var isLoading = true @SwiftUI.State private var errorAlert: ErrorAlert? var body: some View { CreateView( title: title, - error: $errorAlert, + errorAlert: $errorAlert, width: 460, height: 340, contentPadding: 0, @@ -43,14 +42,12 @@ struct ContainersUsingSheet: View { dismiss() } label: { Text("Done") - .frame(width: .sheetButtonLabelWidth) + .frame(minWidth: .sheetButtonLabelWidth) } .defaultAction(enabled: true) } ) - .task { - await loadContainers() - } + .task(loadContainers) } @ViewBuilder @@ -72,7 +69,7 @@ struct ContainersUsingSheet: View { } TableColumn("Status") { container in - let isRunning = container.status == .running + let isRunning = container.state == .running Text(isRunning ? "Running" : "Stopped") .rowTint(isRunning ? .green : .secondary) @@ -81,7 +78,7 @@ struct ContainersUsingSheet: View { .width(min: 72, ideal: 96, max: 120) } .tableStyle(.inset) - .contextMenu(forSelectionType: ContainerItem.ID.self) { _ in + .contextMenu(forSelectionType: ManagedContainer.ID.self) { _ in } primaryAction: { ids in // A detail is opened for one container at a time. if ids.count == 1, let id = ids.first { @@ -91,7 +88,7 @@ struct ContainersUsingSheet: View { } } - private func open(_ id: ContainerItem.ID) { + private func open(_ id: ManagedContainer.ID) { dismiss() openWindow(id: ContainersApp.containerDetailWindowID, value: id) } @@ -102,7 +99,6 @@ struct ContainersUsingSheet: View { do { containers = try await containerManager.list() .filter(includes) - .map(ContainerItem.init) } catch { errorAlert = ErrorAlert( "The containers couldn’t be loaded.", diff --git a/Containers/Views/Shared/Sheets/CreateView.swift b/Containers/Views/Shared/Sheets/CreateView.swift index aef9857..e2600af 100644 --- a/Containers/Views/Shared/Sheets/CreateView.swift +++ b/Containers/Views/Shared/Sheets/CreateView.swift @@ -11,7 +11,7 @@ struct CreateView< Content: View, Actions: View, TabBar: View, Failure: View >: View { let title: String - let error: Binding + let errorAlert: Binding let isProcessing: Bool let isFailed: Bool let progressTitle: String? @@ -33,7 +33,7 @@ struct CreateView< init( title: String, - error: Binding = .constant(nil), + errorAlert: Binding = .constant(nil), isProcessing: Bool = false, isFailed: Bool = false, progressTitle: String? = nil, @@ -54,7 +54,7 @@ struct CreateView< @ViewBuilder failure: () -> Failure = { EmptyView() } ) { self.title = title - self.error = error + self.errorAlert = errorAlert self.isProcessing = isProcessing self.isFailed = isFailed self.progressTitle = progressTitle @@ -77,11 +77,8 @@ struct CreateView< var body: some View { VStack(spacing: 0) { - // Working, the sheet is only its progress and the buttons that - // answer it: the title and the steps it names are gone. if showsHeader && !isProcessing { Text(title) - .font(.headline) .padding(.horizontal, 20) .padding(.vertical, 14) .frame(maxWidth: .infinity, alignment: .leading) @@ -124,7 +121,7 @@ struct CreateView< } .frame(width: width, height: height) .interactiveDismissDisabled(isProcessing) - .errorAlert(error) + .alert(errorAlert) } private var contentArea: some View { diff --git a/Containers/Views/Shared/Table/ActivityRow.swift b/Containers/Views/Shared/Table/ActivityRow.swift deleted file mode 100644 index 84cd21f..0000000 --- a/Containers/Views/Shared/Table/ActivityRow.swift +++ /dev/null @@ -1,63 +0,0 @@ -// -// ActivityRow.swift -// Containers -// -// Created by Axel Martinez on 08/10/2026. -// - -import SwiftUI - -/// A table row that work can be under way on. -nonisolated protocol ActivityRow: Identifiable where ID == String { - var name: String { get } - var activity: ActivitySnapshot? { get set } - /// Whether the row only stands in for work, rather than for something that exists. - var isPending: Bool { get } -} - -extension ActivityRow { - var isPending: Bool { false } - /// Whether an action is under way on the row. - var isExecuting: Bool { activity?.isExecuting == true } - var isDisabled: Bool { isPending || isExecuting } - /// The work the row only stands in for, whose own menu it gets instead. - var pendingWork: ActivitySnapshot? { isPending ? activity : nil } - - /// The failure marked on the row, reported or not. - var failure: ActivitySnapshot? { - guard let activity, case .failed = activity.phase else { return nil } - return activity - } -} - -/// A row's name, followed by the mark of the work under way on it. -struct ActivityRowName: View { - let row: Row - /// Passed in, as the mark's is: AppKit can update a cell after its row is gone, with no environment left. - let activityCenter: ActivityCenter - let openReport: (String) -> Void - - var body: some View { - HStack(spacing: 4) { - Text(row.name) - .lineLimit(1) - .rowForeground(for: row) - - if let activity = row.activity, activity.showsProgress { - Spacer(minLength: 0) - - RowProgressIndicator( - activity: activity, - activityCenter: activityCenter, - openReport: openReport - ) - } - } - } -} - -extension ContainerItem: ActivityRow {} - -extension ImageItem: ActivityRow {} - -extension VolumeItem: ActivityRow {} diff --git a/Containers/Extensions/AppKit/NSView+ContentTable.swift b/Containers/Views/Shared/Table/NSView+ContentTable.swift similarity index 100% rename from Containers/Extensions/AppKit/NSView+ContentTable.swift rename to Containers/Views/Shared/Table/NSView+ContentTable.swift diff --git a/Containers/Views/Shared/Table/ResourceNameCell.swift b/Containers/Views/Shared/Table/ResourceNameCell.swift new file mode 100644 index 0000000..4df42d3 --- /dev/null +++ b/Containers/Views/Shared/Table/ResourceNameCell.swift @@ -0,0 +1,53 @@ +// +// ResourceNameCell.swift +// Containers +// +// Created by Axel Martinez on 22/11/2026. +// + +import SwiftUI + +/// The cell for an entry's name, followed by the mark of the work under way on it, or of why nothing can be +/// done with it. +struct ResourceNameCell: View { + let entry: ResourceEntry + /// What the entry is shown as, where that isn't its name. + var title: String? + /// Passed in, as the mark's is: AppKit can update a cell after its row is gone, with no environment left. + let activityCenter: ActivityCenter + let openReport: (String) -> Void + /// Why nothing can be done with the entry, which dims its row. + var notice: RowNotice? + + @State private var isHovering = false + + var body: some View { + HStack(spacing: 4) { + Text(title ?? entry.name) + .lineLimit(1) + .rowForeground(for: entry, isDimmed: notice != nil) + + if let task = entry.task, task.showsProgress { + Spacer(minLength: 0) + + RowProgressIndicator( + task: task, + activityCenter: activityCenter, + openReport: openReport + ) + } else if let notice { + Spacer(minLength: 0) + + RowNoticeIndicator(notice: notice, isRowHovered: isHovering) + } + } + .contentShape(Rectangle()) + .onContinuousHover { phase in + switch phase { + case .active: isHovering = true + case .ended: isHovering = false + } + } + .onDisappear { isHovering = false } + } +} diff --git a/Containers/Views/Shared/Table/TableView.swift b/Containers/Views/Shared/Table/TableView.swift index da4523f..30f93b0 100644 --- a/Containers/Views/Shared/Table/TableView.swift +++ b/Containers/Views/Shared/Table/TableView.swift @@ -5,7 +5,7 @@ // Created by Axel Martinez on 30/05/2026. // -import ContainerSystem +import ContainersCore import SwiftUI enum TableStyle { @@ -16,40 +16,44 @@ enum TableStyle { /// What a table does with its rows. Each table says only this; showing /// details, confirming deletes, the toolbar and the context menu are the /// table's own. -struct TableRowActions { +struct TableRowActions { /// What one row is, e.g. "Container". var noun: String /// What a row is called when asking to delete it. - var name: (Row) -> String - var open: (Row) -> Void - var canDelete: (Row) -> Bool = { _ in true } - var delete: ([Row]) -> Void - var canStart: ([Row]) -> Bool = { _ in false } - var start: ([Row]) -> Void = { _ in } - var canStop: ([Row]) -> Bool = { _ in false } - var stop: ([Row]) -> Void = { _ in } + var name: (RowValue) -> String + var open: (RowValue) -> Void + var canDelete: (RowValue) -> Bool = { _ in true } + var delete: ([RowValue]) -> Void + var canStart: ([RowValue]) -> Bool = { _ in false } + var start: ([RowValue]) -> Void = { _ in } + var canStop: ([RowValue]) -> Bool = { _ in false } + var stop: ([RowValue]) -> Void = { _ in } /// The work a row only stands in for, whose own menu it gets instead. /// Such a row has nothing to show details of, and deleting it removes /// the work without asking, as there is nothing behind it to lose. - var pendingWork: (Row) -> ActivitySnapshot? = { _ in nil } + /// + /// No default, here or for `failure`: a table of `ResourceEntry`s gets both from + /// its rows through the initializer below, which the memberwise one would + /// otherwise be chosen over. + var pendingWork: (RowValue) -> ContainerSystemTask.Snapshot? /// The failure marked on a row, which the toolbar can clear. - var failure: (Row) -> ActivitySnapshot? = { _ in nil } + var failure: (RowValue) -> ContainerSystemTask.Snapshot? } -extension TableRowActions where Row: ActivityRow { +extension TableRowActions { /// Rows that work can be under way on say for themselves what work they /// stand in for and what failure is marked on them. - init( + init( noun: String, - name: @escaping (Row) -> String, - open: @escaping (Row) -> Void, - canDelete: @escaping (Row) -> Bool = { _ in true }, - delete: @escaping ([Row]) -> Void, - canStart: @escaping ([Row]) -> Bool = { _ in false }, - start: @escaping ([Row]) -> Void = { _ in }, - canStop: @escaping ([Row]) -> Bool = { _ in false }, - stop: @escaping ([Row]) -> Void = { _ in } - ) { + name: @escaping (RowValue) -> String, + open: @escaping (RowValue) -> Void, + canDelete: @escaping (RowValue) -> Bool = { _ in true }, + delete: @escaping ([RowValue]) -> Void, + canStart: @escaping ([RowValue]) -> Bool = { _ in false }, + start: @escaping ([RowValue]) -> Void = { _ in }, + canStop: @escaping ([RowValue]) -> Bool = { _ in false }, + stop: @escaping ([RowValue]) -> Void = { _ in } + ) where RowValue == ResourceEntry { self.noun = noun self.name = name self.open = open @@ -64,53 +68,53 @@ extension TableRowActions where Row: ActivityRow { } } -struct TableView: View +struct TableView: View where - Row: Identifiable, - Columns: TableColumnContent>, + RowValue: Identifiable, + Columns: TableColumnContent>, Menu: View { - @Environment(SystemManager.self) private var system + @Environment(ContainerSystem.self) private var containerSystem @Environment(ActivityCenter.self) private var activityCenter @Environment(ReportManager.self) private var reportManager - @Binding var selection: Set + @Binding var selection: Set @Binding var actions: SelectionActions @Binding var command: SelectionCommand? - let rows: [Row] - let rowActions: TableRowActions + let rows: [RowValue] + let rowActions: TableRowActions let refreshTrigger: Int let tableStyle: TableStyle - let scrollTo: Row.ID? - let activityKind: ActivityCenter.Kind? + let scrollTo: RowValue.ID? + let activityKind: ResourceID.Kind? let onClear: () -> Void let onRefresh: () async throws -> Void - let menu: ([Row]) -> Menu + let menu: ([RowValue]) -> Menu let columns: Columns - @State private var sortOrder: [KeyPathComparator] + @State private var sortOrder: [KeyPathComparator] @State private var lastUpdated: Date? - @State private var loadError: ErrorAlert? - @State private var rowsToDelete: [Row] = [] + @State private var errorAlert: ErrorAlert? + @State private var rowsToDelete: [RowValue] = [] @State private var isConfirmingDelete = false @State private var reloaderID = UUID() init( - rows: [Row], - selection: Binding>, - sortOrder: [KeyPathComparator], + rows: [RowValue], + selection: Binding>, + sortOrder: [KeyPathComparator], actions: Binding, command: Binding, - rowActions: TableRowActions, + rowActions: TableRowActions, refreshTrigger: Int, tableStyle: TableStyle = .inset, - scrollTo: Row.ID? = nil, - activityKind: ActivityCenter.Kind? = nil, + scrollTo: RowValue.ID? = nil, + activityKind: ResourceID.Kind? = nil, onClear: @escaping () -> Void, onRefresh: @escaping () async throws -> Void, - @ViewBuilder menu: @escaping ([Row]) -> Menu, - @TableColumnBuilder> + @ViewBuilder menu: @escaping ([RowValue]) -> Menu, + @TableColumnBuilder> columns: () -> Columns ) { self.rows = rows @@ -131,14 +135,14 @@ where var body: some View { VStack(alignment: .leading, spacing: 0) { - if system.status == .running { + if containerSystem.isRunning { styledTable } else { SystemStatusView() } } - .onChange(of: system.status, initial: true) { - guard system.status == .running else { + .onChange(of: containerSystem.status, initial: true) { + guard containerSystem.isRunning else { onClear() lastUpdated = nil return @@ -156,13 +160,13 @@ where if let activityKind { // An action on these rows executes until they show its outcome. activityCenter.addListReloader(reloaderID, ofKind: activityKind) { - guard system.status == .running else { return } + guard containerSystem.isRunning else { return } await refresh() } } Task { - guard system.status == .running else { return } + guard containerSystem.isRunning else { return } await refresh() } } @@ -183,11 +187,9 @@ where .onDeleteCommand { perform(.delete, on: selection) } - .errorAlert($loadError) + .alert($errorAlert) .confirmationDialog( - rowsToDelete.count > 1 - ? "Delete \(rowsToDelete.count) \(pluralNoun)?" - : "Delete \(rowActions.noun)?", + deleteConfirmationTitle, isPresented: $isConfirmingDelete, titleVisibility: .visible ) { @@ -200,16 +202,18 @@ where rowsToDelete = [] } } message: { - if rowsToDelete.count > 1 { - Text( - "Delete \(rowsToDelete.count) \(pluralNoun.lowercased())? This cannot be undone." - ) - } else if let row = rowsToDelete.first { - Text("Delete \(rowActions.name(row))? This cannot be undone.") - } + Text("You can’t undo this action.") } } + private var deleteConfirmationTitle: String { + if rowsToDelete.count == 1, let row = rowsToDelete.first { + return "Are you sure you want to delete “\(rowActions.name(row))”?" + } + + return "Are you sure you want to delete \(rowsToDelete.count) \(pluralNoun.lowercased())?" + } + // MARK: - Table @ViewBuilder @@ -230,13 +234,13 @@ where private var table: some View { Table( - of: Row.self, + of: RowValue.self, selection: $selection, sortOrder: $sortOrder, columns: { columns }, rows: { ForEach(sortedRows) } ) - .contextMenu(forSelectionType: Row.ID.self) { ids in + .contextMenu(forSelectionType: RowValue.ID.self) { ids in contextMenu(for: ids) } primaryAction: { ids in perform(.showDetails, on: ids) @@ -244,18 +248,18 @@ where } @ViewBuilder - private func contextMenu(for ids: Set) -> some View { + private func contextMenu(for ids: Set) -> some View { let selected = rows(for: ids) let pendingWork = selected.compactMap(rowActions.pendingWork) if !selected.isEmpty, pendingWork.count == selected.count { - ActivityMenuItems( + TaskMenuItems( work: pendingWork, activityCenter: activityCenter, reportManager: reportManager ) } else if !selected.isEmpty { - Button("Show Details", systemImage: "info.circle") { + Button("Show Details", systemImage: "list.bullet.below.rectangle") { perform(.showDetails, on: ids) } .disabled(detailsTarget(in: ids) == nil) @@ -279,7 +283,7 @@ where // MARK: - Rows - private var sortedRows: [Row] { + private var sortedRows: [RowValue] { rows.sorted(using: sortOrder) } @@ -294,12 +298,12 @@ where return sortedRows.firstIndex { $0.id == scrollTo } } - private func rows(for ids: Set) -> [Row] { + private func rows(for ids: Set) -> [RowValue] { rows.filter { ids.contains($0.id) } } /// Details are shown for one row at a time. - private func detailsTarget(in ids: Set) -> Row? { + private func detailsTarget(in ids: Set) -> RowValue? { let selected = rows(for: ids) guard selected.count == 1, let row = selected.first, @@ -310,7 +314,7 @@ where } /// All of the rows, or none where any of them can't be deleted. - private func deletableRows(in ids: Set) -> [Row] { + private func deletableRows(in ids: Set) -> [RowValue] { let selected = rows(for: ids) guard selected.allSatisfy(rowActions.canDelete) else { return [] } @@ -333,7 +337,7 @@ where ) } - private func perform(_ command: SelectionCommand, on ids: Set) { + private func perform(_ command: SelectionCommand, on ids: Set) { let selected = rows(for: ids) switch command { @@ -350,12 +354,12 @@ where } } - private func requestDelete(_ rows: [Row]) { + private func requestDelete(_ rows: [RowValue]) { let pending = rows.filter { rowActions.pendingWork($0) != nil } if !pending.isEmpty { - for work in pending.compactMap(rowActions.pendingWork) { - activityCenter.remove(work.id) + for id in pending.compactMap(rowActions.pendingWork).compactMap(\.taskID) { + activityCenter.remove(id) } selection.subtract(pending.map(\.id)) @@ -374,7 +378,7 @@ where try await onRefresh() lastUpdated = Date() } catch { - loadError = ErrorAlert( + errorAlert = ErrorAlert( "The \(pluralNoun.lowercased()) couldn’t be loaded.", error: error ) @@ -386,19 +390,19 @@ extension TableView where Menu == EmptyView { /// A table with nothing of its own in the context menu, beyond showing /// details and deleting. init( - rows: [Row], - selection: Binding>, - sortOrder: [KeyPathComparator], + rows: [RowValue], + selection: Binding>, + sortOrder: [KeyPathComparator], actions: Binding, command: Binding, - rowActions: TableRowActions, + rowActions: TableRowActions, refreshTrigger: Int, tableStyle: TableStyle = .inset, - scrollTo: Row.ID? = nil, - activityKind: ActivityCenter.Kind? = nil, + scrollTo: RowValue.ID? = nil, + activityKind: ResourceID.Kind? = nil, onClear: @escaping () -> Void, onRefresh: @escaping () async throws -> Void, - @TableColumnBuilder> + @TableColumnBuilder> columns: () -> Columns ) { self.init( @@ -427,7 +431,7 @@ struct SelectionActions: Equatable { var canStop = false var canDelete = false /// The failures marked on the rows the table shows, for the toolbar to clear. - var failures: [ActivitySnapshot] = [] + var failures: [ContainerSystemTask.Snapshot] = [] } /// A toolbar button pressed, for the view that has the rows to act on. diff --git a/Containers/Views/System/MenuBarItem.swift b/Containers/Views/System/MenuBarItem.swift index 729a513..26eef24 100644 --- a/Containers/Views/System/MenuBarItem.swift +++ b/Containers/Views/System/MenuBarItem.swift @@ -6,45 +6,49 @@ // import AppKit -import ContainerSystem +import ContainersCore import SwiftUI struct MenuBarItem: View { - @Environment(SystemManager.self) var system + @Environment(ContainerSystem.self) var containerSystem @Environment(SystemActions.self) private var systemActions @Environment(\.openWindow) private var openWindow var body: some View { - StatusButton(status: system.status) - - Divider() - - MenuButton( - title: "Dashboard", - icon: "square.grid.2x2", - keyEquivalent: "d" - ) { - NSApplication.shared.activate(ignoringOtherApps: true) - openWindow(id: ContainersApp.dashboardWindowID) - } + Group { + StatusButton(status: containerSystem.status) + + Divider() + + MenuButton( + title: "Dashboard", + icon: "square.grid.2x2", + keyEquivalent: "d" + ) { + NSApplication.shared.activate(ignoringOtherApps: true) + openWindow(id: ContainersApp.dashboardWindowID) + } - MenuButton( - title: "Settings", - icon: "gearshape", - keyEquivalent: "," - ) { - NSApplication.shared.activate(ignoringOtherApps: true) - openWindow(id: ContainersApp.settingsWindowID) - } + MenuButton( + title: "Settings", + icon: "gearshape", + keyEquivalent: "," + ) { + NSApplication.shared.activate(ignoringOtherApps: true) + openWindow(id: ContainersApp.settingsWindowID) + } - Divider() + Divider() - button(for: .toggle) - button(for: .reload) + button(for: .toggle) + button(for: .reload) - Divider() + Divider() - button(for: .quit, keyEquivalent: "q") + button(for: .quit, keyEquivalent: "q") + } + // A menu shows a label's icon only when asked to; macOS 27 hides it otherwise. + .labelStyle(.titleAndIcon) } private func button( @@ -55,12 +59,16 @@ struct MenuBarItem: View { title: systemActions.title(for: action), icon: systemActions.symbol(for: action), keyEquivalent: keyEquivalent, - isLoading: systemActions.working == action && action != .quit, isDisabled: !systemActions.isEnabled(action) ) { Task { - do { + do throws(SystemActions.Failure) { try await systemActions.perform(action) + + // The kernel is asked about in the dashboard's setup sheet. + if systemActions.isAskingForKernel { + openWindow(id: ContainersApp.dashboardWindowID) + } } catch { // Shown in the dashboard, where the system can be looked at. openWindow(id: ContainersApp.dashboardWindowID) @@ -73,7 +81,7 @@ struct MenuBarItem: View { // MARK: - Status Button Component private struct StatusButton: View { - let status: SystemManager.Status + let status: ContainerSystem.Status /// A `Label`, since AppKit lays out a menu item's image and title itself. Only the /// symbol is coloured; AppKit fades a disabled item's text far more than its image. @@ -119,58 +127,19 @@ private struct StatusButton: View { // MARK: - Menu Button Component +/// A native menu item: its icon from the label, its shortcut drawn by AppKit. private struct MenuButton: View { let title: String let icon: String var keyEquivalent: String? = nil - var isLoading: Bool = false var isDisabled: Bool = false let action: () -> Void - @State private var isHovered: Bool = false - var body: some View { Button(action: action) { - HStack(spacing: 8) { - Image(systemName: icon) - .font(.system(size: 12)) - .frame(width: 14) - .foregroundStyle(isDisabled ? .tertiary : .secondary) - - Text(title) - .font(.system(size: 13)) - .foregroundStyle( - isHovered && !isDisabled ? .white : .primary - ) - - Spacer() - - if isLoading { - ProgressView() - .controlSize(.small) - } else if let keyEquivalent { - Text("⌘\(keyEquivalent)") - .font(.system(size: 11)) - .foregroundStyle(.tertiary) - } - } - .contentShape(Rectangle()) - .padding(.horizontal, 8) - .padding(.vertical, 4) - .background( - RoundedRectangle(cornerRadius: 4) - .fill( - isHovered && !isDisabled - ? Color.accentColor.opacity(0.15) : .clear - ) - ) - .padding(.horizontal, 6) - .padding(.vertical, 2) + Label(title, systemImage: icon) } - .buttonStyle(.plain) + .keyboardShortcut(keyEquivalent.flatMap(\.first).map { KeyboardShortcut(KeyEquivalent($0)) }) .disabled(isDisabled) - .onHover { hovering in - isHovered = hovering - } } } diff --git a/Containers/Views/System/SystemSetupView.swift b/Containers/Views/System/SystemSetupView.swift index 46eecd2..f2894fb 100644 --- a/Containers/Views/System/SystemSetupView.swift +++ b/Containers/Views/System/SystemSetupView.swift @@ -5,7 +5,7 @@ // Created by Axel Martinez on 12/09/2026. // -import ContainerSystem +import ContainersCore import SwiftUI /// First-run setup (fetching the init image, downloading the kernel) on its own sheet. @@ -14,13 +14,63 @@ struct SystemSetupView: View { /// Lets the presenter keep the sheet from reopening while the cancel unwinds. var onCancel: () -> Void = {} - @Environment(SystemManager.self) private var system + @Environment(ContainerSystem.self) private var containerSystem + @Environment(SystemActions.self) private var systemActions @Environment(\.dismiss) private var dismiss @SwiftUI.State private var failure: ErrorAlert? @SwiftUI.State private var progress: ProgressObserver? + @SwiftUI.State private var isConfirmingKernel = false var body: some View { + Group { + if isConfirmingKernel { + kernelSheet + } else { + setupSheet + } + } + // Escape can't dismiss work in progress. + .interactiveDismissDisabled(failure == nil) + .onChange(of: containerSystem.setupProgress, initial: true) { _, setupProgress in + progress = setupProgress.map(ProgressObserver.init) + } + .task { + switch containerSystem.status { + case .running: + dismiss() + // Already starting: just watch it. + case .starting: + break + default: + if containerSystem.needsKernelConfirmation { + isConfirmingKernel = true + } else { + setup() + } + } + } + .onChange(of: containerSystem.status) { _, status in + switch status { + // A cancelled start ends stopped; the dashboard shows that. + case .notStarted where containerSystem.needsKernelConfirmation: + isConfirmingKernel = true + case .running, .notStarted: + dismiss() + case .failed: + failure = containerSystem.startupError.map { + ErrorAlert("Containers Couldn’t Be Set Up", error: $0) + } + default: + break + } + } + } + + private static let failureMarkBand: CGFloat = 96 + + /// The progress and the failure are drawn over the content, so the sheet keeps a size of its own for them. + private var setupSheet: some View { CreateView( title: "Set Up Containers", isFailed: failure != nil, @@ -31,9 +81,7 @@ struct SystemSetupView: View { contentAlignment: .center, showsFooterDivider: false, contentPadding: 24, - content: { - setUpProgress - }, + content: { setupProgress }, actions: { Spacer() @@ -42,23 +90,25 @@ struct SystemSetupView: View { cancelSetup() } label: { Text("Cancel") - .frame(width: .sheetButtonLabelWidth) + .frame(minWidth: .sheetButtonLabelWidth) } .buttonStyle(.bordered) + .keyboardShortcut(.cancelAction) } else { Button { dismiss() } label: { Text("Close") - .frame(width: .sheetButtonLabelWidth) + .frame(minWidth: .sheetButtonLabelWidth) } .buttonStyle(.bordered) + .keyboardShortcut(.cancelAction) Button { - setUp() + setup() } label: { Text("Try Again") - .frame(width: .sheetButtonLabelWidth) + .frame(minWidth: .sheetButtonLabelWidth) } .defaultAction(enabled: true) } @@ -73,40 +123,39 @@ struct SystemSetupView: View { } } ) - // Escape can't dismiss work in progress. - .interactiveDismissDisabled(failure == nil) - .onChange(of: system.setupProgress, initial: true) { _, setupProgress in - progress = setupProgress.map(ProgressObserver.init) - } - .task { - switch system.status { - case .running: - dismiss() - // Already starting: just watch it. - case .starting: - break - default: - setUp() - } - } - .onChange(of: system.status) { _, status in - switch status { - // A cancelled start ends stopped; the dashboard shows that. - case .running, .notStarted: - dismiss() - case .failed: - failure = system.startupError.map { - ErrorAlert("Containers Couldn’t Be Set Up", error: $0) + } + + /// Sized to its text, as a question. + private var kernelSheet: some View { + VStack(alignment: .leading, spacing: 20) { + kernelConfirmation + + HStack(spacing: 8) { + Spacer() + + Button { + cancelSetup() + } label: { + Text("Cancel") + .frame(minWidth: .sheetButtonLabelWidth) } - default: - break + .buttonStyle(.bordered) + .keyboardShortcut(.cancelAction) + + Button { + setup(installingKernel: true) + } label: { + Text("Install") + .frame(minWidth: .sheetButtonLabelWidth) + } + .defaultAction(enabled: true) } } + .padding(20) + .frame(width: 520) } - private static let failureMarkBand: CGFloat = 96 - - private var setUpProgress: some View { + private var setupProgress: some View { VStack(alignment: .leading, spacing: 20) { Image(systemName: "folder.badge.gearshape") .font(.system(size: 44)) @@ -145,17 +194,43 @@ struct SystemSetupView: View { return step + "…" } - private func setUp() { + private var kernelConfirmation: some View { + VStack(alignment: .leading, spacing: 20) { + VStack(alignment: .leading, spacing: 8) { + Text("Install the Recommended Default Kernel?") + .font(.headline) + + Text("No default kernel is configured. Containers installs the recommended default kernel from:") + .foregroundStyle(.secondary) + .fixedSize(horizontal: false, vertical: true) + + if let url = ContainerSystem.defaultKernelURL { + Text(url.absoluteString) + .font(.caption) + .foregroundStyle(.secondary) + .textSelection(.enabled) + .fixedSize(horizontal: false, vertical: true) + } + } + .frame(maxWidth: .infinity, alignment: .leading) + } + .frame(maxWidth: .infinity, alignment: .leading) + } + + private func setup(installingKernel: Bool = false) { failure = nil + isConfirmingKernel = false + systemActions.dismissKernelQuestion() Task { // Failures arrive as a `.failed` status, which the sheet already watches. - try? await system.start(appRoot: UserDefaults.applicationDataRoot) + try? await containerSystem.start(appRoot: UserDefaults.applicationDataRoot, installingKernel: installingKernel) } } /// Cancels the system's start, whether or not this sheet began it. private func cancelSetup() { - system.cancelStart() + containerSystem.cancelStart() + systemActions.dismissKernelQuestion() onCancel() dismiss() } diff --git a/Containers/Views/System/SystemStatusControl.swift b/Containers/Views/System/SystemStatusControl.swift index e925157..4079b07 100644 --- a/Containers/Views/System/SystemStatusControl.swift +++ b/Containers/Views/System/SystemStatusControl.swift @@ -6,12 +6,12 @@ // import AppKit -import ContainerSystem +import ContainersCore import SwiftUI /// The system's status; clicking it opens the same actions as the menu bar item. struct SystemStatusControl: View { - @Environment(SystemManager.self) private var system + @Environment(ContainerSystem.self) private var containerSystem @Environment(SystemActions.self) private var systemActions @Environment(\.openWindow) private var openWindow @@ -24,12 +24,13 @@ struct SystemStatusControl: View { var body: some View { Button(action: showMenu) { HStack(spacing: 4) { - Image(systemName: system.status.symbol) - .foregroundStyle(system.status.color) - .frame(width: 13) + StatusGauge(level: containerSystem.status.gaugeLevel) + .foregroundStyle(containerSystem.status.color) + .animation(.default, value: containerSystem.status) + .frame(width: 19) - Text(system.status.message) - .foregroundStyle(system.status.color) + Text(containerSystem.status.message) + .foregroundStyle(containerSystem.status.color) } .overlay(alignment: .trailing) { Image(systemName: "chevron.down") @@ -102,6 +103,10 @@ struct SystemStatusControl: View { ) -> NSMenuItem { let item = NSMenuItem(title: title, action: action, keyEquivalent: "") item.image = NSImage(systemSymbolName: symbol, accessibilityDescription: title) + // macOS 27 hides menu item images unless an item asks to show them. + if #available(macOS 27, *) { + item.preferredImageVisibility = .visible + } item.isEnabled = isEnabled item.target = target return item @@ -112,8 +117,35 @@ struct SystemStatusControl: View { do throws(SystemActions.Failure) { try await systemActions.perform(action) } catch { - errorAlert = ErrorAlert(error.title, error: error.underlying) + errorAlert = error.alert + } + } + } + + /// The gauge symbol in parts, so its needle can turn to a level instead of being replaced. + private struct StatusGauge: View { + let level: Double + + var body: some View { + let angle = Angle.degrees(270 * level) + + ZStack { + // The dot under the needle is cut out, as in the gauge symbols. + Image("gauge.dial") + .mask { + ZStack { + Rectangle() + Image("gauge.needle.clearance") + .rotationEffect(angle) + .blendMode(.destinationOut) + } + .compositingGroup() + } + + Image("gauge.needle") + .rotationEffect(angle) } + .animation(.spring(duration: 0.6, bounce: 0.3), value: level) } } diff --git a/Containers/Views/System/SystemStatusView.swift b/Containers/Views/System/SystemStatusView.swift index 587f97e..cb63284 100644 --- a/Containers/Views/System/SystemStatusView.swift +++ b/Containers/Views/System/SystemStatusView.swift @@ -5,17 +5,17 @@ // Created by Axel Martinez on 2026/02/08. // -import ContainerSystem +import ContainersCore import SwiftUI struct SystemStatusView: View { - @Environment(SystemManager.self) private var system + @Environment(ContainerSystem.self) private var containerSystem + @Environment(SystemActions.self) private var systemActions + @Environment(\.openWindow) private var openWindow var body: some View { - switch system.status { + switch containerSystem.status { case .starting: - // What a first run has to install is reported on its own sheet, - // so what is left to say here is that the system is starting. progress("Starting the container system…") case .stopping: progress("Stopping the container system…") @@ -45,27 +45,36 @@ struct SystemStatusView: View { private var failedView: some View { ContentUnavailableView { - Label( - "The Container System Couldn’t Start", - systemImage: "exclamationmark.triangle.fill" - ) + Label("Container System Failed to Start", systemImage: "exclamationmark.triangle.fill") + .lineLimit(1) + .fixedSize() } description: { - if let error = system.startupError { - Text(error.localizedDescription) + if let error = containerSystem.startupError { + Text(isFixedInSettings ? "\(error.localizedDescription) Choose another storage location in Settings." : error.localizedDescription) } } actions: { - Button("Try Again", action: start) + if isFixedInSettings { + Button("Open Settings") { + openWindow(id: ContainersApp.settingsWindowID) + } + } else { + Button("Try Again", action: start) + } } } + private var isFixedInSettings: Bool { + containerSystem.startupError is ContainerSystem.AppRootError + } + private var stoppedView: some View { ContentUnavailableView { Label( "Container System Stopped", - systemImage: SystemManager.Status.notStarted.symbol + systemImage: ContainerSystem.Status.notStarted.symbol ) } description: { - Text("Start it to work with your containers, images and volumes.") + Text("Your containers, images, and volumes appear here while the container system is running.") } actions: { Button("Start", systemImage: "play.fill", action: start) .labelStyle(.titleAndIcon) @@ -75,8 +84,8 @@ struct SystemStatusView: View { private func start() { Task { // A failure puts the view into its own failed state, by way of - // `system.startupError`. - try? await system.start(appRoot: UserDefaults.applicationDataRoot) + // `containerSystem.startupError`. + try? await systemActions.startAskingForKernel() } } } diff --git a/Containers/Views/System/WhatsNewView.swift b/Containers/Views/System/WhatsNewView.swift index 1c6f222..b2af906 100644 --- a/Containers/Views/System/WhatsNewView.swift +++ b/Containers/Views/System/WhatsNewView.swift @@ -43,10 +43,9 @@ struct WhatsNewView: View { onContinue() } label: { Text("Continue") - .foregroundStyle(Color(nsColor: .windowBackgroundColor)) + .frame(minWidth: .sheetButtonLabelWidth) } .buttonStyle(.borderedProminent) - .tint(.primary) .controlSize(.large) .keyboardShortcut(.defaultAction) .frame(maxWidth: .infinity) @@ -59,7 +58,7 @@ struct WhatsNewView: View { private func featureRow(_ feature: AppInfo.Feature) -> some View { HStack(alignment: .top, spacing: 16) { - Image(systemName: feature.icon) + Image(feature.icon) .font(.system(size: 28)) .foregroundStyle(foregroundColor) .frame(width: 36) diff --git a/Containers/Views/Volumes/CreateVolumeView.swift b/Containers/Views/Volumes/CreateVolumeView.swift index d8e1203..51313c1 100644 --- a/Containers/Views/Volumes/CreateVolumeView.swift +++ b/Containers/Views/Volumes/CreateVolumeView.swift @@ -5,8 +5,8 @@ // Created by Axel Martinez on 2025/11/03. // -import ContainerSystem import ContainerizationOCI +import ContainersCore import SwiftUI struct CreateVolumeView: View { @@ -20,11 +20,7 @@ struct CreateVolumeView: View { @Environment(VolumeManager.self) private var volumeManager @Environment(\.dismiss) private var dismiss - @SwiftUI.State private var name: String = "" - @SwiftUI.State private var options: [KeyValue] = [] - @SwiftUI.State private var labels: [KeyValue] = [] - @SwiftUI.State private var sizeValue: Double = 512 - @SwiftUI.State private var sizeUnit: UnitInformationStorage = .gigabytes + @SwiftUI.State private var form = VolumeCreateForm() @SwiftUI.State private var errorAlert: ErrorAlert? @SwiftUI.State private var showProgressView: Bool = false @@ -35,12 +31,12 @@ struct CreateVolumeView: View { var body: some View { CreateView( - title: "Create New Volume", - error: $errorAlert, + title: "Choose options for your new volume", + errorAlert: $errorAlert, isProcessing: showProgressView, - progressTitle: "Creating volume...", - width: 550, - height: 450, + progressTitle: "Creating volume…", + width: .createSheetWidth, + height: .createSheetHeight, scrollsContent: true, contentPadding: selectedTab == .general ? 20 : 0, tabBar: { @@ -55,22 +51,18 @@ struct CreateVolumeView: View { dismiss() } label: { Text("Cancel") - .frame(width: .sheetButtonLabelWidth) + .frame(minWidth: .sheetButtonLabelWidth) } .buttonStyle(.bordered) + .keyboardShortcut(.cancelAction) Button { createVolume() } label: { Text("Create") - .frame(width: .sheetButtonLabelWidth) + .frame(minWidth: .sheetButtonLabelWidth) } - .defaultAction( - enabled: !showProgressView - && !name.trimmingCharacters( - in: .whitespacesAndNewlines - ).isEmpty - ) + .defaultAction(enabled: !showProgressView && form.isComplete) } ) .onDisappear { @@ -97,7 +89,7 @@ struct CreateVolumeView: View { ) { FormField( placeholder: "Ex: volume-1", - value: $name, + value: $form.name, filter: EntityName.valid(from:) ) } @@ -109,7 +101,7 @@ struct CreateVolumeView: View { ) { HStack { TextField( - value: $sizeValue, + value: $form.size, format: .number, prompt: Text("Size") ) { @@ -121,7 +113,7 @@ struct CreateVolumeView: View { FormPicker( placeholder: "Unit", options: [.megabytes, .gigabytes, .terabytes], - selection: $sizeUnit, + selection: $form.sizeUnit, fillsAvailableWidth: false ) } @@ -132,7 +124,7 @@ struct CreateVolumeView: View { private var optionsTab: some View { VStack(alignment: .leading, spacing: 0) { FormList( - items: $labels, + items: $form.labels, title: "Labels", isExpanded: $isLabelsExpanded, columnTitles: ["Key", "Value"], @@ -158,7 +150,7 @@ struct CreateVolumeView: View { .padding(.horizontal) FormList( - items: $options, + items: $form.options, title: "Driver Options", isExpanded: $isOptionsExpanded, columnTitles: ["Key", "Value"], @@ -186,11 +178,7 @@ struct CreateVolumeView: View { } private func createVolume() { - let trimmedName = self.name.trimmingCharacters( - in: .whitespacesAndNewlines - ) - - guard !trimmedName.isEmpty else { + guard form.isComplete else { self.errorAlert = ErrorAlert( "The volume needs a name.", message: "Enter a name for the volume." @@ -198,43 +186,18 @@ struct CreateVolumeView: View { return } + let form = form + Task { self.showProgressView = true self.errorAlert = nil do { - let validLabels = self.labels.filter({ - !$0.key.trimmingCharacters(in: .whitespacesAndNewlines) - .isEmpty - && !$0.value.trimmingCharacters( - in: .whitespacesAndNewlines - ) - .isEmpty - }) - let validOptions = self.options.filter({ - !$0.key.trimmingCharacters(in: .whitespacesAndNewlines) - .isEmpty - && !$0.value.trimmingCharacters( - in: .whitespacesAndNewlines - ) - .isEmpty - }) - - // Convert to bytes for API - let sizeInBytes: UInt64? = - sizeValue > 0 - ? UInt64( - Measurement( - value: sizeValue, - unit: sizeUnit - ).converted(to: .bytes).value - ) : nil - try await volumeManager.create( - name: trimmedName, - labels: validLabels, - options: validOptions, - sizeInBytes: sizeInBytes + name: form.trimmedName, + labels: form.completeLabels, + options: form.completeOptions, + sizeInBytes: form.sizeInBytes ) dismiss() diff --git a/Containers/Views/Volumes/VolumeDetailView.swift b/Containers/Views/Volumes/VolumeDetailView.swift index 1198594..e835299 100644 --- a/Containers/Views/Volumes/VolumeDetailView.swift +++ b/Containers/Views/Volumes/VolumeDetailView.swift @@ -5,14 +5,15 @@ // Created by Axel Martinez on 2026/06/07. // -import ContainerSystem +import ContainersCore import SwiftUI struct VolumeDetailView: View { @Environment(ReportManager.self) private var reportManager @Environment(\.openURL) private var openURL - let volume: VolumeItem + let volume: VolumeResource + let isInUse: Bool let toolbarController: DetailToolbarController /// Opens on what the volume is, which is what a window is opened to @@ -48,7 +49,7 @@ struct VolumeDetailView: View { .reports( about: volume.id, ofKind: [.volume], - manager: reportManager, + from: reportManager, openURL: openURL ) ] @@ -78,9 +79,9 @@ struct VolumeDetailView: View { tabContent: { category in switch category { case .info: - VolumeInfo(volume: volume) + VolumeInfo(volume: volume, isInUse: isInUse) case .inspect: - VolumeInspect(volume: volume) + InspectView(value: volume) } } ) diff --git a/Containers/Views/Volumes/VolumeDetailWindow.swift b/Containers/Views/Volumes/VolumeDetailWindow.swift index 0cc62ee..240ad7d 100644 --- a/Containers/Views/Volumes/VolumeDetailWindow.swift +++ b/Containers/Views/Volumes/VolumeDetailWindow.swift @@ -5,7 +5,7 @@ // Created by Axel Martinez on 03/10/2026. // -import ContainerSystem +import ContainersCore import SwiftUI struct VolumeDetailWindow: View { @@ -13,7 +13,8 @@ struct VolumeDetailWindow: View { let id: String - @SwiftUI.State private var volume: VolumeItem? + @SwiftUI.State private var volume: VolumeResource? + @SwiftUI.State private var isInUse = false @SwiftUI.State private var isLoading: Bool = true @SwiftUI.State private var toolbarController = DetailToolbarController() @@ -22,6 +23,7 @@ struct VolumeDetailWindow: View { if let volume { VolumeDetailView( volume: volume, + isInUse: isInUse, toolbarController: toolbarController ) } else if isLoading { @@ -32,13 +34,15 @@ struct VolumeDetailWindow: View { height: DetailPlaceholder.volume.height ) } else { - ContentUnavailableView( - "Volume Not Found", - systemImage: "externaldrive", - description: Text( - "The volume '\(id)' no longer exists." - ) - ) + ContentUnavailableView { + Label { + Text("Volume Not Found") + } icon: { + Image(Icon.volume) + } + } description: { + Text("The volume '\(id)' no longer exists.") + } .frame(width: 550, height: 320) } } @@ -59,12 +63,8 @@ struct VolumeDetailWindow: View { defer { isLoading = false } do { - let summaries = try await volumeManager.summaries() - if let match = summaries.first(where: { $0.volume.id == id }) { - self.volume = VolumeItem(match) - } else { - self.volume = nil - } + self.volume = try await volumeManager.list().first { $0.id == id } + self.isInUse = try await volumeManager.namesInUse().contains(id) } catch { self.volume = nil } diff --git a/Containers/Views/Volumes/VolumeInfo.swift b/Containers/Views/Volumes/VolumeInfo.swift index ed0d75f..0aa76af 100644 --- a/Containers/Views/Volumes/VolumeInfo.swift +++ b/Containers/Views/Volumes/VolumeInfo.swift @@ -5,11 +5,12 @@ // Created by Axel Martinez on 2026/06/07. // -import ContainerSystem +import ContainersCore import SwiftUI struct VolumeInfo: View { - let volume: VolumeItem + let volume: VolumeResource + let isInUse: Bool var body: some View { VStack(alignment: .leading, spacing: 20) { @@ -18,7 +19,7 @@ struct VolumeInfo: View { InfoRow(label: "Type", value: volume.volumeType.rawValue) InfoRow( label: "State", - value: volume.isInUse ? "In use" : "Unused" + value: isInUse ? "In use" : "Unused" ) if let formattedSize = volume.formattedSize { @@ -26,21 +27,21 @@ struct VolumeInfo: View { } InfoRow(label: "Created", value: volume.formattedCreated) - InfoRow(label: "Driver", value: volume.driver) - InfoRow(label: "Format", value: volume.format) + InfoRow(label: "Driver", value: volume.configuration.driver) + InfoRow(label: "Format", value: volume.configuration.format) } - if !volume.labels.isEmpty { + if !volume.userLabels.isEmpty { InfoSection { - ForEach(sorted(volume.labels), id: \.key) { label in + ForEach(sorted(volume.userLabels), id: \.key) { label in InfoRow(label: label.key, value: label.value) } } } - if !volume.options.isEmpty { + if !volume.userOptions.isEmpty { InfoSection { - ForEach(sorted(volume.options), id: \.key) { option in + ForEach(sorted(volume.userOptions), id: \.key) { option in InfoRow(label: option.key, value: option.value) } } diff --git a/Containers/Views/Volumes/VolumeInspect.swift b/Containers/Views/Volumes/VolumeInspect.swift deleted file mode 100644 index 2f74eda..0000000 --- a/Containers/Views/Volumes/VolumeInspect.swift +++ /dev/null @@ -1,73 +0,0 @@ -// -// VolumeInspect.swift -// Containers -// -// Created by Axel Martinez on 2026/06/07. -// - -import ContainerSystem -import SwiftUI - -struct VolumeInspect: View { - let volume: VolumeItem - - var body: some View { - InspectView(value: PrintableVolume(volume.volume)) - } -} - -private struct PrintableVolume: Encodable { - let configuration: PrintableVolumeConfiguration - - var id: String { - configuration.name - } - - init(_ volume: Volume) { - self.configuration = PrintableVolumeConfiguration(volume) - } - - enum CodingKeys: String, CodingKey { - case id - case configuration - } - - func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(id, forKey: .id) - try container.encode(configuration, forKey: .configuration) - } -} - -private struct PrintableVolumeConfiguration: Encodable { - let name: String - let driver: String - let format: String - let source: String - let creationDate: Date - let labels: [String: String] - let options: [String: String] - let sizeInBytes: UInt64? - - init(_ volume: Volume) { - self.name = volume.name - self.driver = volume.driver - self.format = volume.format - self.source = volume.source - self.creationDate = volume.createdAt - self.labels = volume.labels - self.options = volume.options - self.sizeInBytes = volume.sizeInBytes - } - - enum CodingKeys: String, CodingKey { - case name - case driver - case format - case source - case creationDate - case labels - case options - case sizeInBytes - } -} diff --git a/Containers/Views/Volumes/VolumesView.swift b/Containers/Views/Volumes/VolumesView.swift index 6cdf7c7..c8731ce 100644 --- a/Containers/Views/Volumes/VolumesView.swift +++ b/Containers/Views/Volumes/VolumesView.swift @@ -5,28 +5,31 @@ // Created by Axel Martinez on 2026/02/05. // -import ContainerSystem +import ContainersCore import SwiftUI struct VolumesView: View { + typealias Entry = ResourceEntry + @Environment(VolumeManager.self) private var volumeManager @Environment(ActivityCenter.self) private var activityCenter @Environment(\.openWindow) private var openWindow @Binding var searchText: String - @Binding var selection: Set + @Binding var selection: Set @Binding var actions: SelectionActions @Binding var command: SelectionCommand? var refreshTrigger: Int - @State private var volumes: [VolumeItem] = [] + @State private var volumes: [VolumeResource] = [] + @State private var namesInUse: Set = [] private var trimmedText: String { self.searchText.trimmingCharacters(in: .whitespacesAndNewlines) } - private var filteredVolumes: [VolumeItem] { + private var filteredVolumes: [Entry] { if trimmedText.isEmpty { return marked(volumes) } @@ -37,17 +40,17 @@ struct VolumesView: View { return marked(filtered) } - /// Attaches each volume's work, or an unread failure from an earlier run. - private func marked(_ volumes: [VolumeItem]) -> [VolumeItem] { - activityCenter.marked( - volumes, + /// Each volume's row, with its work, or an unread failure from an earlier run. + private func marked(_ volumes: [VolumeResource]) -> [Entry] { + activityCenter.entries( + for: volumes, ofKind: .volume, - reportName: { $0.id }, - reportKinds: [.volume] + reportKinds: [.volume], + isInUse: { namesInUse.contains($0.name) } ) } - private var rowActions: TableRowActions { + private var rowActions: TableRowActions { TableRowActions( noun: "Volume", name: \.name, @@ -72,8 +75,8 @@ struct VolumesView: View { onRefresh: listVolumes ) { TableColumn("Name", value: \.name) { volume in - ActivityRowName( - row: volume, + ResourceNameCell( + entry: volume, activityCenter: activityCenter, openReport: openWindow.report ) @@ -81,7 +84,7 @@ struct VolumesView: View { .width(min: 40, ideal: 40) TableColumn("Type", value: \.typeText) { volume in - Text(volume.volumeType.rawValue) + Text(volume.typeText) .rowForeground(for: volume) } .width(80) @@ -99,7 +102,7 @@ struct VolumesView: View { .width(64) TableColumn("Size", value: \.sizeSort) { volume in - if let size = volume.formattedSize { + if let size = volume.resource?.formattedSize { Text(size) .rowForeground(for: volume) } else { @@ -110,7 +113,7 @@ struct VolumesView: View { .width(min: 80, ideal: 80, max: 120) TableColumn("Created", value: \.createdAt) { volume in - Text(volume.formattedCreated) + Text(volume.resource?.formattedCreated ?? "") .rowForeground(for: volume) } .width(min: 140, ideal: 180, max: 220) @@ -121,28 +124,27 @@ struct VolumesView: View { volumes = [] } - private func openDetails(for volume: VolumeItem) { + private func openDetails(for row: Entry) { + guard let volume = row.resource else { return } + openWindow(id: ContainersApp.volumeDetailWindowID, value: volume.id) } - private func deleteVolumes(_ volumes: [VolumeItem]) { + private func deleteVolumes(_ rows: [Entry]) { let volumeManager = volumeManager - for volume in volumes { - let item = volume.volume - - activityCenter.run( - on: volume.id, - kind: .volume, + for volume in rows.compactMap(\.resource) { + activityCenter.start( + on: volume.resourceID, failureTitle: "The volume couldn’t be deleted." - ) { - try await volumeManager.delete(volumes: [item]) + ) { _ in + try await volumeManager.delete(volumes: [volume]) } } } func listVolumes() async throws { - volumes = try await volumeManager.summaries() - .map(VolumeItem.init) + volumes = try await volumeManager.list() + namesInUse = try await volumeManager.namesInUse() } } diff --git a/ContainerSystem/Build/BuildPipeline/BuildPipeline+ContentStore.swift b/ContainersCore/Build/BuildPipeline/BuildPipeline+ContentStore.swift similarity index 100% rename from ContainerSystem/Build/BuildPipeline/BuildPipeline+ContentStore.swift rename to ContainersCore/Build/BuildPipeline/BuildPipeline+ContentStore.swift diff --git a/ContainerSystem/Build/BuildPipeline/BuildPipeline+Export.swift b/ContainersCore/Build/BuildPipeline/BuildPipeline+Export.swift similarity index 100% rename from ContainerSystem/Build/BuildPipeline/BuildPipeline+Export.swift rename to ContainersCore/Build/BuildPipeline/BuildPipeline+Export.swift diff --git a/ContainerSystem/Build/BuildPipeline/BuildPipeline+FSSync.swift b/ContainersCore/Build/BuildPipeline/BuildPipeline+FSSync.swift similarity index 100% rename from ContainerSystem/Build/BuildPipeline/BuildPipeline+FSSync.swift rename to ContainersCore/Build/BuildPipeline/BuildPipeline+FSSync.swift diff --git a/ContainerSystem/Build/BuildPipeline/BuildPipeline+ImageResolver.swift b/ContainersCore/Build/BuildPipeline/BuildPipeline+ImageResolver.swift similarity index 94% rename from ContainerSystem/Build/BuildPipeline/BuildPipeline+ImageResolver.swift rename to ContainersCore/Build/BuildPipeline/BuildPipeline+ImageResolver.swift index 7566d1c..dae8bb5 100644 --- a/ContainerSystem/Build/BuildPipeline/BuildPipeline+ImageResolver.swift +++ b/ContainersCore/Build/BuildPipeline/BuildPipeline+ImageResolver.swift @@ -100,7 +100,7 @@ extension BuildPipeline { let normalizedRef = try Reference.normalized(reference).description // Check if image already exists - let existingImages = try await imagesService.list() + let existingImages = try await imageService.list() if let existing = existingImages.first(where: { $0.reference == normalizedRef || $0.reference == reference @@ -112,7 +112,7 @@ extension BuildPipeline { // Pull the image logger.info("Pulling \(normalizedRef)...") - let imageDescription = try await imagesService.pull( + let imageDescription = try await imageService.pull( reference: normalizedRef, platform: platform, insecure: false, @@ -121,7 +121,7 @@ extension BuildPipeline { } ) - try await imagesService.unpack(description: imageDescription, platform: platform, progressUpdate: nil) + try await imageService.unpack(description: imageDescription, platform: platform, progressUpdate: nil) logger.info("Pulled \(normalizedRef)") diff --git a/ContainerSystem/Build/BuildPipeline/BuildPipeline+Stdio.swift b/ContainersCore/Build/BuildPipeline/BuildPipeline+Stdio.swift similarity index 100% rename from ContainerSystem/Build/BuildPipeline/BuildPipeline+Stdio.swift rename to ContainersCore/Build/BuildPipeline/BuildPipeline+Stdio.swift diff --git a/ContainerSystem/Build/BuildPipeline/BuildPipeline.swift b/ContainersCore/Build/BuildPipeline/BuildPipeline.swift similarity index 90% rename from ContainerSystem/Build/BuildPipeline/BuildPipeline.swift rename to ContainersCore/Build/BuildPipeline/BuildPipeline.swift index de45814..1d17dd8 100644 --- a/ContainerSystem/Build/BuildPipeline/BuildPipeline.swift +++ b/ContainersCore/Build/BuildPipeline/BuildPipeline.swift @@ -10,17 +10,18 @@ import ContainerizationOCI import Foundation import Logging -/// Custom build pipeline that uses ImagesService for image resolution instead of XPC +/// Custom build pipeline that uses ImageService for image resolution instead of XPC actor BuildPipeline { let config: Builder.BuildConfig - let imagesService: ImagesService - let contentStore: ContentStore + let imageService: ImageService let logger: Logger - init(config: Builder.BuildConfig, imagesService: ImagesService, contentStore: ContentStore) { + /// The content the image service's images are made of, which BuildKit reads and writes through the pipeline. + var contentStore: ContentStore { imageService.contentStore } + + init(config: Builder.BuildConfig, imageService: ImageService) { self.config = config - self.imagesService = imagesService - self.contentStore = contentStore + self.imageService = imageService var logger = Logger(label: "app.containers.sandboxed-pipeline") logger.logLevel = .debug self.logger = logger diff --git a/ContainerSystem/Build/BuildTransfer+Metadata.swift b/ContainersCore/Build/BuildTransfer+Metadata.swift similarity index 100% rename from ContainerSystem/Build/BuildTransfer+Metadata.swift rename to ContainersCore/Build/BuildTransfer+Metadata.swift diff --git a/ContainerSystem/Build/Builder/Builder+Configuration.swift b/ContainersCore/Build/Builder/Builder+Configuration.swift similarity index 96% rename from ContainerSystem/Build/Builder/Builder+Configuration.swift rename to ContainersCore/Build/Builder/Builder+Configuration.swift index 73af4f5..b8ea3a6 100644 --- a/ContainerSystem/Build/Builder/Builder+Configuration.swift +++ b/ContainersCore/Build/Builder/Builder+Configuration.swift @@ -16,7 +16,6 @@ extension Builder { /// Configuration for a build operation. public struct BuildConfig: Sendable { public let id: String - public let contentStore: ContentStore public let args: [String] public let contextDir: String public let dockerfile: Data @@ -34,7 +33,6 @@ extension Builder { public init( id: String, - contentStore: ContentStore, args: [String] = [], contextDir: String, dockerfile: Data, @@ -51,7 +49,6 @@ extension Builder { statusUpdate: (@Sendable (String) async -> Void)? = nil ) { self.id = id - self.contentStore = contentStore self.args = args self.contextDir = contextDir self.dockerfile = dockerfile diff --git a/ContainerSystem/Build/Builder/Builder.grpc.swift b/ContainersCore/Build/Builder/Builder.grpc.swift similarity index 100% rename from ContainerSystem/Build/Builder/Builder.grpc.swift rename to ContainersCore/Build/Builder/Builder.grpc.swift diff --git a/ContainerSystem/Build/Builder/Builder.pb.swift b/ContainersCore/Build/Builder/Builder.pb.swift similarity index 100% rename from ContainerSystem/Build/Builder/Builder.pb.swift rename to ContainersCore/Build/Builder/Builder.pb.swift diff --git a/ContainerSystem/Build/Builder/Builder.swift b/ContainersCore/Build/Builder/Builder.swift similarity index 80% rename from ContainerSystem/Build/Builder/Builder.swift rename to ContainersCore/Build/Builder/Builder.swift index fcb8913..da90465 100644 --- a/ContainerSystem/Build/Builder/Builder.swift +++ b/ContainersCore/Build/Builder/Builder.swift @@ -23,7 +23,7 @@ import NIOHPACK import NIOHTTP2 import NIOPosix -/// Builder that uses ImagesService instead of XPC-based ClientImage +/// Builder that uses ImageService instead of XPC-based ClientImage public struct Builder: Sendable { public static let builderContainerId = "buildkit" @@ -32,41 +32,46 @@ public struct Builder: Sendable { HTTP2ClientTransport.WrappedChannel > let grpcClient: GRPCClient - let group: EventLoopGroup let builderShimSocket: FileHandle let clientTask: Task - let imagesService: ImagesService - let contentStore: ContentStore + let imageService: ImageService private let logger: Logger init( socket: FileHandle, group: EventLoopGroup, - imagesService: ImagesService, - contentStore: ContentStore - ) throws { + imageService: ImageService + ) async throws { try socket.setSendBufSize(4 << 20) try socket.setRecvBufSize(2 << 20) - let channel = try ClientBootstrap(group: group) - .channelInitializer { channel in - channel.eventLoop.makeCompletedFuture(withResultOf: { - try channel.pipeline.syncOperations.addHandler(HTTP2ConnectBufferingHandler()) - }) + // An already-connected socket gives grpc-swift no address to derive an `:authority` from, and newer + // gRPC-Go shims reject requests without one (grpc-go #9365). The shim doesn't route on it, so any + // host name does. + var config = HTTP2ClientTransport.WrappedChannel.Config.defaults + config.http2.authority = Self.builderContainerId + + let transport = try await HTTP2ClientTransport.WrappedChannel.wrapping(config: config) { configure in + try await withCheckedThrowingContinuation { continuation in + ClientBootstrap(group: group) + .channelInitializer { channel in + configure(channel).map { configured in + continuation.resume(returning: configured) + } + } + .withConnectedSocket(socket.fileDescriptor) + .whenFailure { error in + continuation.resume(throwing: error) + } } - .withConnectedSocket(socket.fileDescriptor) - .wait() - - let transport = HTTP2ClientTransport.WrappedChannel.wrapping(channel: channel) + } let grpcClient = GRPCClient(transport: transport) self.grpcClient = grpcClient self.client = Com_Apple_Container_Build_V1_Builder.Client(wrapping: grpcClient) - self.group = group self.builderShimSocket = socket - self.imagesService = imagesService - self.contentStore = contentStore + self.imageService = imageService var logger = Logger(label: "app.containers.sandboxed-builder") logger.logLevel = .info @@ -86,6 +91,12 @@ public struct Builder: Sendable { } } + /// Ends the connection to BuildKit. The event loop group it runs on is the caller's to shut down. + public func close() { + grpcClient.beginGracefulShutdown() + clientTask.cancel() + } + public func info() async throws -> InfoResponse { var options = CallOptions.defaults options.timeout = .seconds(30) @@ -124,8 +135,7 @@ public struct Builder: Sendable { logger.info("Initializing sandboxed build pipeline") let pipeline = BuildPipeline( config: config, - imagesService: self.imagesService, - contentStore: self.contentStore + imageService: self.imageService ) logger.info("Starting pipeline execution") @@ -152,26 +162,20 @@ public struct Builder: Sendable { } ) progressTask.cancel() - grpcClient.beginGracefulShutdown() - clientTask.cancel() - try await group.shutdownGracefully() + close() logger.info("Build completed successfully") } catch { progressTask.cancel() // Check if this is the normal build complete signal if let builderError = error as? BuilderError, builderError == .buildComplete { - grpcClient.beginGracefulShutdown() - clientTask.cancel() - try await group.shutdownGracefully() + close() logger.info("Build completed successfully") return } logger.error("Pipeline execution failed: \(error)") - grpcClient.beginGracefulShutdown() - clientTask.cancel() - try await group.shutdownGracefully() + close() throw error } } diff --git a/ContainerSystem/Build/Builder/BuilderController.swift b/ContainersCore/Build/Builder/BuilderController.swift similarity index 71% rename from ContainerSystem/Build/Builder/BuilderController.swift rename to ContainersCore/Build/Builder/BuilderController.swift index 72048a0..85ada26 100644 --- a/ContainerSystem/Build/Builder/BuilderController.swift +++ b/ContainersCore/Build/Builder/BuilderController.swift @@ -16,22 +16,22 @@ import Logging /// Coordinates the BuildKit builder container lifecycle. @MainActor final class BuilderController { - private let runtime: ContainerRuntime + private let containerSystem: ContainerSystem private let logger: Logger static let builderContainerId = Builder.builderContainerId init() { - self.runtime = ContainerRuntime.shared + self.containerSystem = ContainerSystem.shared var logger = Logger(label: "app.containers.builder.controller") logger.logLevel = .info self.logger = logger } #if DEBUG - /// Internal initializer for testing - allows injection of test runtime - init(testRuntime: ContainerRuntime) { - self.runtime = testRuntime + /// Internal initializer for testing - allows injection of a test container system + init(testSystem: ContainerSystem) { + self.containerSystem = testSystem var logger = Logger(label: "app.containers.builder.controller.test") logger.logLevel = .debug self.logger = logger @@ -45,13 +45,16 @@ final class BuilderController { func start(cpus: Int64 = 2, memory: UInt64 = 1024.mib(), progress: Progress? = nil) async throws { logger.info("Starting builder with cpus=\(cpus), memory=\(memory)") - let containersService = try await runtime.getContainersService() - let imagesService = try await runtime.getImagesService() - let kernelService = try await runtime.getKernelService() - let appRoot = try runtime.getAppRoot() + let containerService = try containerSystem.containerService + let imageService = try containerSystem.imageService + let kernelService = try containerSystem.kernelService + + guard let appRoot = containerSystem.appRoot else { + throw ContainerSystem.notRunningError + } let builderImage: String = DefaultsStore.get(key: .defaultBuilderImage) - let exportsMount: String = appRoot.appendingPathComponent(".build").path + let exportsMount: String = appRoot.appendingPathComponent("builder").path if !FileManager.default.fileExists(atPath: exportsMount) { try FileManager.default.createDirectory( @@ -61,37 +64,10 @@ final class BuilderController { ) } - // Content store path needs to be accessible by builder for image operations - let imagesPath = appRoot.appendingPathComponent("images").path - - // BuildKit data directory - needs to be persistent and support mmap for BoltDB - let buildkitDataPath = appRoot.appendingPathComponent("buildkit-data") - .path - - // Check if BoltDB database exists and might be corrupted - // If BuildKit previously crashed, the database can be in a bad state - let workerDbPath = (buildkitDataPath as NSString) - .appendingPathComponent("worker.db") - if FileManager.default.fileExists(atPath: workerDbPath) { - logger.info("Found existing BuildKit database, checking if it needs cleanup") - // For now, always delete and recreate to avoid corruption issues - // In the future, we could try to validate the database first - try? FileManager.default.removeItem(atPath: buildkitDataPath) - logger.info("Cleaned up BuildKit data directory") - } - - if !FileManager.default.fileExists(atPath: buildkitDataPath) { - try FileManager.default.createDirectory( - atPath: buildkitDataPath, - withIntermediateDirectories: true, - attributes: nil - ) - } - let builderPlatform = ContainerizationOCI.Platform(arch: "arm64", os: "linux", variant: "v8") // Check if builder container already exists - let containerList = await containersService.list() + let containerList = await containerService.list() let existingContainer = containerList.first(where: { $0.configuration.id == Self.builderContainerId }) @@ -100,31 +76,24 @@ final class BuilderController { logger.info("Found existing builder container, cleaning it up to ensure fresh start") if existingContainer.status == .running { do { - try await containersService.stop(id: Self.builderContainerId, options: .default) + try await containerService.stop(id: Self.builderContainerId, options: .default) } catch { logger.warning("Failed to stop existing builder, proceeding with delete: \(error)") } } do { - try await containersService.delete(id: Self.builderContainerId) + try await containerService.delete(id: Self.builderContainerId) } catch { logger.warning("Failed to delete existing builder, continuing anyway: \(error)") } } - let shimArguments: [String] = ["--debug", "--vsock"] + let useRosetta = DefaultsStore.getBool(key: .buildRosetta) ?? true + // Without Rosetta, the shim builds other architectures with QEMU. + let shimArguments = ["--debug", "--vsock"] + (useRosetta ? [] : ["--enable-qemu"]) try validEntityName(Self.builderContainerId) - let processConfig = ProcessConfiguration( - executable: "/usr/local/bin/container-builder-shim", - arguments: shimArguments, - environment: [], - workingDirectory: "/", - terminal: false, - user: .id(uid: 0, gid: 0) - ) - var resources = ContainerConfiguration.Resources() resources.cpus = Int(cpus) resources.memoryInBytes = memory @@ -135,7 +104,7 @@ final class BuilderController { progress.totalUnitCount = 3 let imageDescription = try await progress.performStep("Fetching builder image") { step in - try await imagesService.pull( + try await imageService.pull( reference: builderImage, platform: builderPlatform, insecure: false, @@ -146,20 +115,33 @@ final class BuilderController { logger.info("Unpacking builder image") try await progress.performStep("Unpacking builder image") { step in - try await imagesService.unpack( + try await imageService.unpack( description: imageDescription, platform: builderPlatform, progressUpdate: step.updateHandler() ) } + let processConfig = ProcessConfiguration( + executable: "/usr/local/bin/container-builder-shim", + arguments: shimArguments, + environment: try await imageService.environment(of: imageDescription, platform: builderPlatform), + workingDirectory: "/", + terminal: false, + user: .id(uid: 0, gid: 0) + ) + var config = ContainerConfiguration( id: Self.builderContainerId, image: imageDescription, process: processConfig ) config.resources = resources - config.capabilities = ["ALL"] + config.labels = [ + "com.apple.container.plugin": "builder", + "com.apple.container.resource.role": "builder", + ] + config.capAdd = ["ALL"] config.mounts = [ .init(type: .tmpfs, source: "", destination: "/run", options: []), .init( @@ -168,15 +150,8 @@ final class BuilderController { destination: "/var/lib/container-builder-shim/exports", options: [] ), - .init(type: .virtiofs, source: imagesPath, destination: imagesPath, options: []), - // Use tmpfs for BuildKit data directory because virtiofs doesn't support mmap - // which BoltDB requires. This means BuildKit state is ephemeral (lost on restart) - // but that's acceptable for a build cache. - // However, we need BuildKit to be able to access our content store for images - .init(type: .tmpfs, source: "", destination: "/var/lib/buildkit", options: []), ] - // Enable Rosetta only if the user didn't ask to disable it - config.rosetta = DefaultsStore.getBool(key: .buildRosetta) ?? true + config.rosetta = useRosetta // Attach to default network (sandboxed mode uses built-in NAT networking with automatic DNS) let defaultNetworkName = "default" @@ -186,7 +161,8 @@ final class BuilderController { options: AttachmentOptions(hostname: Self.builderContainerId) ) ] - config.dns = ContainerConfiguration.DNSConfiguration() + // No nameservers, so the network's gateway answers. + config.dns = ContainerConfiguration.DNSConfiguration(nameservers: []) try await progress.performStep("Starting BuildKit") { _ in logger.info("Getting kernel") @@ -194,9 +170,9 @@ final class BuilderController { logger.info("Creating BuildKit container") let options = ContainerCreateOptions(autoRemove: false) - try await containersService.create(configuration: config, kernel: kernel, options: options) + try await containerService.create(configuration: config, kernel: kernel, options: options) - try await startBuildKitProcess(service: containersService) + try await startBuildKitProcess(service: containerService) } logger.info("Builder started successfully") @@ -208,10 +184,10 @@ final class BuilderController { func restart(cpus: Int64 = 2, memory: UInt64 = 1024.mib(), progress: Progress? = nil) async throws { logger.info("Restarting builder to pick up fresh mounts") - let containersService = try await runtime.getContainersService() + let containerService = try containerSystem.containerService // Stop the existing builder - let containerList = await containersService.list() + let containerList = await containerService.list() let existingContainer = containerList.first(where: { $0.configuration.id == Self.builderContainerId }) @@ -220,7 +196,7 @@ final class BuilderController { if existingContainer.status == .running { logger.info("Stopping existing builder") do { - try await containersService.stop(id: Self.builderContainerId, options: .default) + try await containerService.stop(id: Self.builderContainerId, options: .default) } catch { logger.warning("Failed to cleanly stop existing builder, proceeding with delete: \(error)") } @@ -229,7 +205,7 @@ final class BuilderController { } do { - try await containersService.delete(id: Self.builderContainerId) + try await containerService.delete(id: Self.builderContainerId) } catch { logger.warning("Failed to delete existing builder cleanly, continuing anyway: \(error)") } @@ -265,7 +241,7 @@ final class BuilderController { return true } - private func startBuildKitProcess(service: ContainersService) async throws { + private func startBuildKitProcess(service: ContainerService) async throws { do { logger.info("Bootstrapping BuildKit container") diff --git a/ContainerSystem/Build/Builder/BuilderError.swift b/ContainersCore/Build/Builder/BuilderError.swift similarity index 100% rename from ContainerSystem/Build/Builder/BuilderError.swift rename to ContainersCore/Build/Builder/BuilderError.swift diff --git a/ContainerSystem/Build/Builder/BuilderMessages.swift b/ContainersCore/Build/Builder/BuilderMessages.swift similarity index 100% rename from ContainerSystem/Build/Builder/BuilderMessages.swift rename to ContainersCore/Build/Builder/BuilderMessages.swift diff --git a/ContainerSystem/Build/FileHandle+SocketOptions.swift b/ContainersCore/Build/FileHandle+SocketOptions.swift similarity index 100% rename from ContainerSystem/Build/FileHandle+SocketOptions.swift rename to ContainersCore/Build/FileHandle+SocketOptions.swift diff --git a/ContainerSystem/Build/ImageTransfer+Metadata.swift b/ContainersCore/Build/ImageTransfer+Metadata.swift similarity index 100% rename from ContainerSystem/Build/ImageTransfer+Metadata.swift rename to ContainersCore/Build/ImageTransfer+Metadata.swift diff --git a/ContainerSystem/Build/ServerStream+Packets.swift b/ContainersCore/Build/ServerStream+Packets.swift similarity index 100% rename from ContainerSystem/Build/ServerStream+Packets.swift rename to ContainersCore/Build/ServerStream+Packets.swift diff --git a/ContainerSystem/Build/TerminalCommand.swift b/ContainersCore/Build/TerminalCommand.swift similarity index 100% rename from ContainerSystem/Build/TerminalCommand.swift rename to ContainersCore/Build/TerminalCommand.swift diff --git a/ContainersCore/Common/ByteSize.swift b/ContainersCore/Common/ByteSize.swift new file mode 100644 index 0000000..9566f1d --- /dev/null +++ b/ContainersCore/Common/ByteSize.swift @@ -0,0 +1,33 @@ +// +// ByteSize.swift +// Containers +// +// Created by Axel Martinez on 2026/10/30. +// + +import Foundation + +/// Sizes written with binary units. +enum ByteSize { + /// Reads a number with an optional binary unit, such as `512m`, `2048MB` or `10GiB`, as bytes. + /// + /// - Returns: The size, or `nil` if the text isn't one. + static func bytes(from text: String) -> UInt64? { + let units: [Character: UnitInformationStorage] = [ + "b": .bytes, "k": .kibibytes, "m": .mebibytes, "g": .gibibytes, "t": .tebibytes, "p": .pebibytes, + ] + let text = text.trimmingCharacters(in: .whitespaces).lowercased() + let unitStart = text.firstIndex { !"0123456789.".contains($0) } ?? text.endIndex + let unitText = text[unitStart...].trimmingCharacters(in: .whitespaces) + let unitSymbol = unitText.first ?? "b" + + guard let number = Double(text[.. AsyncStream<[String]> { + // FSEvents reports real paths: `/var` comes back as `/private/var`, which + // `resolvingSymlinksInPath()` would strip again. + let path = folder.path(percentEncoded: false) + let root = + realpath(path, nil).map { resolved in + defer { free(resolved) } + return String(cString: resolved) + } ?? path + let prefix = root.hasSuffix("/") ? root : root + "/" + + return AsyncStream { continuation in + let receiver = Receiver(prefix: prefix, continuation: continuation) + var context = FSEventStreamContext( + version: 0, + info: Unmanaged.passRetained(receiver).toOpaque(), + retain: nil, + release: { info in + guard let info else { return } + Unmanaged.fromOpaque(info).release() + }, + copyDescription: nil + ) + let flags = FSEventStreamCreateFlags( + kFSEventStreamCreateFlagUseCFTypes | kFSEventStreamCreateFlagFileEvents | kFSEventStreamCreateFlagWatchRoot + ) + + guard + let stream = FSEventStreamCreate( + nil, + { _, info, _, paths, _, _ in + guard let info else { return } + + let receiver = Unmanaged.fromOpaque(info).takeUnretainedValue() + let paths = unsafeBitCast(paths, to: NSArray.self) as? [String] ?? [] + + receiver.receive(paths) + }, + &context, + [root] as CFArray, + FSEventStreamEventId(kFSEventStreamEventIdSinceNow), + latency, + flags + ) + else { + continuation.finish() + return + } + + let handle = StreamHandle(stream: stream) + + FSEventStreamSetDispatchQueue(stream, DispatchQueue(label: "app.containers.folder-events")) + FSEventStreamStart(stream) + + continuation.onTermination = { _ in + handle.invalidate() + } + } + } + + /// Hands the callback's paths to the stream, from the stream's own queue. + private final class Receiver: Sendable { + let prefix: String + let continuation: AsyncStream<[String]>.Continuation + + init(prefix: String, continuation: AsyncStream<[String]>.Continuation) { + self.prefix = prefix + self.continuation = continuation + } + + func receive(_ paths: [String]) { + let relativePaths = paths.compactMap { path in + path.hasPrefix(prefix) ? String(path.dropFirst(prefix.count)) : nil + } + + guard !relativePaths.isEmpty else { return } + + continuation.yield(relativePaths) + } + } + + /// `@unchecked Sendable`: the stream is only touched again once, to stop it, after which it's + /// released and never used. + private final class StreamHandle: @unchecked Sendable { + private let stream: FSEventStreamRef + + init(stream: FSEventStreamRef) { + self.stream = stream + } + + func invalidate() { + FSEventStreamStop(stream) + FSEventStreamInvalidate(stream) + FSEventStreamRelease(stream) + } + } +} diff --git a/ContainerSystem/Common/KeyValue.swift b/ContainersCore/Common/KeyValue.swift similarity index 100% rename from ContainerSystem/Common/KeyValue.swift rename to ContainersCore/Common/KeyValue.swift diff --git a/ContainersCore/Common/ManagedResource.swift b/ContainersCore/Common/ManagedResource.swift new file mode 100644 index 0000000..dfa51a4 --- /dev/null +++ b/ContainersCore/Common/ManagedResource.swift @@ -0,0 +1,14 @@ +// +// ManagedResource.swift +// Containers +// + +import Foundation + +/// Something the container system manages: a container, an image or a volume. +public protocol ManagedResource: Identifiable, Sendable where ID == String { + var id: String { get } + var name: String { get } + var creationDate: Date { get } + var labels: ResourceLabels { get } +} diff --git a/ContainersCore/Common/ResourceLabels.swift b/ContainersCore/Common/ResourceLabels.swift new file mode 100644 index 0000000..80a647c --- /dev/null +++ b/ContainersCore/Common/ResourceLabels.swift @@ -0,0 +1,97 @@ +// +// ResourceLabels.swift +// Containers +// + +import Foundation + +/// The labels on a resource, each with a key that's valid for a label. +/// +/// A key is one or more lowercase names separated by `/`, each made of letters and digits in parts joined by `.`, +/// with `-` allowed inside a part, such as `com.example.team` or `example.com/owner`. +public struct ResourceLabels: Sendable, Equatable { + public enum LabelError: LocalizedError, Equatable { + case invalidKey(String) + case keyTooLong(String) + case labelTooLong(key: String) + + public var errorDescription: String? { + switch self { + case .invalidKey(let key): + "The label key “\(key)” isn’t valid." + case .keyTooLong(let key): + "The label key “\(key)” is longer than \(ResourceLabels.keyLengthMax) characters." + case .labelTooLong(let key): + "The label “\(key)” is longer than \(ResourceLabels.labelLengthMax) characters, with its value." + } + } + } + + /// The longest a key can be. + public static let keyLengthMax = 128 + + /// The longest a label can be, written as `key=value`. + public static let labelLengthMax = 4096 + + /// The key that says what a resource is for. + public static let roleKey = "com.apple.container.resource.role" + + /// The role of a resource the system made itself. + public static let builtinRole = "builtin" + + public let dictionary: [String: String] + + public var isEmpty: Bool { dictionary.isEmpty } + + /// Whether the system made the resource itself, so it can't be deleted. + public var isBuiltin: Bool { dictionary[Self.roleKey] == Self.builtinRole } + + public init() { + self.dictionary = [:] + } + + /// - Throws: ``LabelError`` for the first label that isn't valid. + public init(_ dictionary: [String: String]) throws { + for (key, value) in dictionary { + try Self.validate(key: key, value: value) + } + + self.dictionary = dictionary + } + + public subscript(key: String) -> String? { + dictionary[key] + } + + private static let keyPattern = { + let part = "[a-z0-9](?:[a-z0-9-]*[a-z0-9])?" + let name = "\(part)(?:\\.\(part))*" + + return "^\(name)(?:/\(name))*$" + }() + + private static func validate(key: String, value: String) throws { + guard key.count <= keyLengthMax else { + throw LabelError.keyTooLong(key) + } + + guard key.range(of: keyPattern, options: .regularExpression) != nil else { + throw LabelError.invalidKey(key) + } + + guard key.count + 1 + value.count <= labelLengthMax else { + throw LabelError.labelTooLong(key: key) + } + } +} + +// Coded as the dictionary itself, so labels read and write as they're stored. +extension ResourceLabels: Codable { + public init(from decoder: Decoder) throws { + try self.init(try [String: String](from: decoder)) + } + + public func encode(to encoder: Encoder) throws { + try dictionary.encode(to: encoder) + } +} diff --git a/ContainersCore/Common/SystemConfiguration.swift b/ContainersCore/Common/SystemConfiguration.swift new file mode 100644 index 0000000..d53efc2 --- /dev/null +++ b/ContainersCore/Common/SystemConfiguration.swift @@ -0,0 +1,220 @@ +// +// SystemConfiguration.swift +// Containers +// +// Created by Axel Martinez on 2026/10/30. +// + +import Configuration +import ConfigurationTOML +import Foundation +import SystemPackage + +/// The container system's settings, kept in a `config.toml` in the system's folder, with defaults for whatever +/// the file leaves out. +public struct SystemConfiguration: Equatable, Sendable { + public var kernelURL: String + public var kernelBinaryPath: String + /// `nil` for a kernel URL of the user's own given without one, which can't be installed. + public var kernelDigest: String? + public var initImage: String + public var builderImage: String + public var buildRosetta: Bool + public var buildCPUs: Int + public var buildMemoryInBytes: UInt64 + public var containerCPUs: Int + public var containerMemoryInBytes: UInt64 + public var dnsDomain: String? + /// The registry for image references that don't name one. + public var registryDomain: String + /// The IPv4 subnet for the built-in network, or `nil` for one vmnet picks. + public var subnet: String? + + /// The settings a folder without a `config.toml` uses. + public static let defaults = SystemConfiguration( + kernelURL: "https://github.com/kata-containers/kata-containers/releases/download/3.32.0/kata-static-3.32.0-arm64.tar.zst", + kernelBinaryPath: "opt/kata/share/kata-containers/vmlinux-6.18.35-197-debug", + kernelDigest: "sha256:8736c054d9223974735394f822000823baef509e1c33405ec798240fa9b6e4b5", + initImage: "ghcr.io/apple/containerization/vminit:0.53.0", + builderImage: "ghcr.io/apple/container-builder-shim/builder:0.13.2", + buildRosetta: true, + buildCPUs: 2, + buildMemoryInBytes: 2048 * 1024 * 1024, + containerCPUs: 4, + containerMemoryInBytes: 1024 * 1024 * 1024, + dnsDomain: nil, + registryDomain: "docker.io", + subnet: nil + ) + + /// Where the settings live in a system's folder. + static func file(in appRoot: URL) -> URL { + appRoot.appending(path: "config/config.toml") + } + + /// Reads the settings for a system's folder. + /// + /// - Parameter appRoot: The folder the system keeps its data in. + /// - Returns: The folder's settings, with the defaults for any the file doesn't set. + static func load(appRoot: URL) async -> SystemConfiguration { + await load(files: [file(in: appRoot)]) + } + + /// Reads layered files, highest precedence first. + /// + /// A file the sandbox can't read, or that isn't valid, is skipped, so its settings fall back to the defaults. + static func load(files: [URL]) async -> SystemConfiguration { + var providers: [any ConfigProvider] = [] + + for file in files where FileManager.default.isReadableFile(atPath: file.path(percentEncoded: false)) { + if let provider = try? await FileProvider(filePath: FilePath(file.path(percentEncoded: false))) { + providers.append(provider) + } + } + + guard !providers.isEmpty else { return .defaults } + + return SystemConfiguration(reader: ConfigReader(providers: providers)) + } + + init(reader: ConfigReader) { + let defaults = Self.defaults + let kernelURL = reader.string(forKey: "kernel.url") ?? defaults.kernelURL + + self.kernelURL = kernelURL + self.kernelBinaryPath = reader.string(forKey: "kernel.binaryPath") ?? defaults.kernelBinaryPath + self.kernelDigest = reader.string(forKey: "kernel.digest") ?? (kernelURL == defaults.kernelURL ? defaults.kernelDigest : nil) + self.initImage = reader.string(forKey: "vminit.image") ?? defaults.initImage + self.builderImage = reader.string(forKey: "build.image") ?? defaults.builderImage + self.buildRosetta = reader.bool(forKey: "build.rosetta") ?? defaults.buildRosetta + self.buildCPUs = reader.int(forKey: "build.cpus") ?? defaults.buildCPUs + self.buildMemoryInBytes = reader.string(forKey: "build.memory").flatMap(ByteSize.bytes(from:)) ?? defaults.buildMemoryInBytes + self.containerCPUs = reader.int(forKey: "container.cpus") ?? defaults.containerCPUs + self.containerMemoryInBytes = + reader.string(forKey: "container.memory").flatMap(ByteSize.bytes(from:)) ?? defaults.containerMemoryInBytes + self.dnsDomain = reader.string(forKey: "dns.domain") + self.registryDomain = reader.string(forKey: "registry.domain") ?? defaults.registryDomain + self.subnet = reader.string(forKey: "network.subnet") + } + + init( + kernelURL: String, + kernelBinaryPath: String, + kernelDigest: String?, + initImage: String, + builderImage: String, + buildRosetta: Bool, + buildCPUs: Int, + buildMemoryInBytes: UInt64, + containerCPUs: Int, + containerMemoryInBytes: UInt64, + dnsDomain: String?, + registryDomain: String, + subnet: String? + ) { + self.kernelURL = kernelURL + self.kernelBinaryPath = kernelBinaryPath + self.kernelDigest = kernelDigest + self.initImage = initImage + self.builderImage = builderImage + self.buildRosetta = buildRosetta + self.buildCPUs = buildCPUs + self.buildMemoryInBytes = buildMemoryInBytes + self.containerCPUs = containerCPUs + self.containerMemoryInBytes = containerMemoryInBytes + self.dnsDomain = dnsDomain + self.registryDomain = registryDomain + self.subnet = subnet + } + + /// The settings with only what differs from the defaults, so a later default still applies + /// to what was never changed. + var tomlText: String { + let defaults = Self.defaults + var sections: [(name: String, entries: [(key: String, value: String)])] = [] + + func add(_ section: String, _ key: String, _ value: String) { + if let index = sections.firstIndex(where: { $0.name == section }) { + sections[index].entries.append((key, value)) + } else { + sections.append((section, [(key, value)])) + } + } + + if kernelURL != defaults.kernelURL { add("kernel", "url", Self.quoted(kernelURL)) } + if kernelBinaryPath != defaults.kernelBinaryPath { add("kernel", "binaryPath", Self.quoted(kernelBinaryPath)) } + if let kernelDigest, kernelDigest != defaults.kernelDigest { add("kernel", "digest", Self.quoted(kernelDigest)) } + if initImage != defaults.initImage { add("vminit", "image", Self.quoted(initImage)) } + if builderImage != defaults.builderImage { add("build", "image", Self.quoted(builderImage)) } + if buildRosetta != defaults.buildRosetta { add("build", "rosetta", String(buildRosetta)) } + if buildCPUs != defaults.buildCPUs { add("build", "cpus", String(buildCPUs)) } + if buildMemoryInBytes != defaults.buildMemoryInBytes { add("build", "memory", Self.quoted("\(buildMemoryInBytes)b")) } + if containerCPUs != defaults.containerCPUs { add("container", "cpus", String(containerCPUs)) } + if containerMemoryInBytes != defaults.containerMemoryInBytes { + add("container", "memory", Self.quoted("\(containerMemoryInBytes)b")) + } + if let dnsDomain { add("dns", "domain", Self.quoted(dnsDomain)) } + if registryDomain != defaults.registryDomain { add("registry", "domain", Self.quoted(registryDomain)) } + if let subnet { add("network", "subnet", Self.quoted(subnet)) } + + return sections.map { section in + (["[\(section.name)]"] + section.entries.map { "\($0.key) = \($0.value)" }).joined(separator: "\n") + } + .joined(separator: "\n\n") + (sections.isEmpty ? "" : "\n") + } + + /// A TOML basic string. + private static func quoted(_ value: String) -> String { + var escaped = "" + + for character in value.unicodeScalars { + switch character { + case "\"": escaped += "\\\"" + case "\\": escaped += "\\\\" + case "\n": escaped += "\\n" + case "\t": escaped += "\\t" + case "\r": escaped += "\\r" + default: + if character.value < 0x20 || character.value == 0x7F { + escaped += String(format: "\\u%04X", character.value) + } else { + escaped.unicodeScalars.append(character) + } + } + } + + return "\"\(escaped)\"" + } + + /// Saves the settings in a system's folder, or removes the file when nothing differs from the defaults. + func write(to appRoot: URL) throws { + let file = Self.file(in: appRoot) + let text = tomlText + + guard !text.isEmpty else { + try? FileManager.default.removeItem(at: file) + return + } + + try FileManager.default.createDirectory(at: file.deletingLastPathComponent(), withIntermediateDirectories: true) + try Data(text.utf8).write(to: file, options: .atomic) + } + + /// The value for a key the app looks up by name. + func value(for key: DefaultsStore.Key) -> String? { + switch key { + case .defaultInitImage: initImage + case .defaultBuilderImage: builderImage + case .defaultKernelURL: kernelURL + case .defaultKernelBinaryPath: kernelBinaryPath + case .defaultKernelDigest: kernelDigest + case .defaultDNSDomain: dnsDomain + case .buildRosetta: String(buildRosetta) + case .defaultContainerCPUs: String(containerCPUs) + case .defaultContainerMemory: String(containerMemoryInBytes) + case .defaultBuildCPUs: String(buildCPUs) + case .defaultBuildMemory: String(buildMemoryInBytes) + case .registryDomain: registryDomain + } + } +} diff --git a/ContainersCore/Common/URL+SameFolder.swift b/ContainersCore/Common/URL+SameFolder.swift new file mode 100644 index 0000000..7325d13 --- /dev/null +++ b/ContainersCore/Common/URL+SameFolder.swift @@ -0,0 +1,15 @@ +// +// URL+SameFolder.swift +// Containers +// +// Created by Axel Martinez on 2026/11/02. +// + +import Foundation + +extension URL { + /// Whether both reach the same folder, through links or not. + public func isSameFolder(as other: URL) -> Bool { + resolvingSymlinksInPath().pathComponents == other.resolvingSymlinksInPath().pathComponents + } +} diff --git a/ContainersCore/Common/URL+SecurityScope.swift b/ContainersCore/Common/URL+SecurityScope.swift new file mode 100644 index 0000000..9ab75b6 --- /dev/null +++ b/ContainersCore/Common/URL+SecurityScope.swift @@ -0,0 +1,39 @@ +// +// URL+SecurityScope.swift +// Containers +// +// Created by Axel Martinez on 2026/11/05. +// + +import Foundation + +extension URL { + /// Runs `body` with access to the folder or file the user granted, which the sandbox only allows + /// for a URL from a panel or a security-scoped bookmark. + func withSecurityScopedAccess(_ body: () throws -> Result) rethrows -> Result { + let didAccess = startAccessingSecurityScopedResource() + + defer { + if didAccess { + stopAccessingSecurityScopedResource() + } + } + + return try body() + } + + func withSecurityScopedAccess( + isolation: isolated (any Actor)? = #isolation, + _ body: () async throws -> Result + ) async rethrows -> Result { + let didAccess = startAccessingSecurityScopedResource() + + defer { + if didAccess { + stopAccessingSecurityScopedResource() + } + } + + return try await body() + } +} diff --git a/ContainerSystem/Container/Bundle.swift b/ContainersCore/Container/Bundle.swift similarity index 100% rename from ContainerSystem/Container/Bundle.swift rename to ContainersCore/Container/Bundle.swift diff --git a/ContainerSystem/Container/ContainerConfiguration.swift b/ContainersCore/Container/ContainerConfiguration.swift similarity index 74% rename from ContainerSystem/Container/ContainerConfiguration.swift rename to ContainersCore/Container/ContainerConfiguration.swift index c253d43..f3dc85d 100644 --- a/ContainerSystem/Container/ContainerConfiguration.swift +++ b/ContainersCore/Container/ContainerConfiguration.swift @@ -38,15 +38,27 @@ public struct ContainerConfiguration: Sendable, Codable { public var cpus: Int public var memoryInBytes: UInt64 public var storage: UInt64? + public var cpuOverhead: Int public init( cpus: Int = 2, memoryInBytes: UInt64 = 2 * 1024 * 1024 * 1024, - storage: UInt64? = nil + storage: UInt64? = nil, + cpuOverhead: Int = 1 ) { self.cpus = cpus self.memoryInBytes = memoryInBytes self.storage = storage + self.cpuOverhead = cpuOverhead + } + + // Defaults for what a stored configuration leaves out. + public init(from decoder: any Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.cpus = try container.decodeIfPresent(Int.self, forKey: .cpus) ?? 4 + self.memoryInBytes = try container.decodeIfPresent(UInt64.self, forKey: .memoryInBytes) ?? 1024 * 1024 * 1024 + self.storage = try container.decodeIfPresent(UInt64.self, forKey: .storage) + self.cpuOverhead = try container.decodeIfPresent(Int.self, forKey: .cpuOverhead) ?? 1 } } @@ -63,13 +75,19 @@ public struct ContainerConfiguration: Sendable, Codable { public var initProcess: ProcessConfiguration public var platform: Platform = .current public var resources: Resources = Resources() + public var runtimeHandler: String = "container-runtime-linux" public var virtualization: Bool = false public var ssh: Bool = false public var useInit: Bool = false public var readOnly: Bool = false - public var capabilities: [String] = [] + /// Linux capabilities to add to the OCI default set, or "ALL". + public var capAdd: [String] = [] + /// Linux capabilities to drop from the OCI default set, or "ALL". + public var capDrop: [String] = [] public var shmSize: UInt64? public var stopSignal: String? + public var maskedPaths: [String]? + public var readonlyPaths: [String]? public var creationDate: Date = Date() enum CodingKeys: String, CodingKey { @@ -86,13 +104,17 @@ public struct ContainerConfiguration: Sendable, Codable { case initProcess case platform case resources + case runtimeHandler case virtualization case ssh case useInit case readOnly - case capabilities + case capAdd + case capDrop case shmSize case stopSignal + case maskedPaths + case readonlyPaths case creationDate } @@ -110,14 +132,18 @@ public struct ContainerConfiguration: Sendable, Codable { self.rosetta = try container.decodeIfPresent(Bool.self, forKey: .rosetta) ?? false self.initProcess = try container.decode(ProcessConfiguration.self, forKey: .initProcess) self.platform = try container.decodeIfPresent(Platform.self, forKey: .platform) ?? .current - self.resources = try container.decodeIfPresent(Resources.self, forKey: .resources) ?? Resources() + self.resources = try container.decodeIfPresent(Resources.self, forKey: .resources) ?? Resources(cpus: 4, memoryInBytes: 1024 * 1024 * 1024) + self.runtimeHandler = try container.decodeIfPresent(String.self, forKey: .runtimeHandler) ?? "container-runtime-linux" self.virtualization = try container.decodeIfPresent(Bool.self, forKey: .virtualization) ?? false self.ssh = try container.decodeIfPresent(Bool.self, forKey: .ssh) ?? false self.useInit = try container.decodeIfPresent(Bool.self, forKey: .useInit) ?? false self.readOnly = try container.decodeIfPresent(Bool.self, forKey: .readOnly) ?? false - self.capabilities = try container.decodeIfPresent([String].self, forKey: .capabilities) ?? [] + self.capAdd = try container.decodeIfPresent([String].self, forKey: .capAdd) ?? [] + self.capDrop = try container.decodeIfPresent([String].self, forKey: .capDrop) ?? [] self.shmSize = try container.decodeIfPresent(UInt64.self, forKey: .shmSize) self.stopSignal = try container.decodeIfPresent(String.self, forKey: .stopSignal) + self.maskedPaths = try container.decodeIfPresent([String].self, forKey: .maskedPaths) + self.readonlyPaths = try container.decodeIfPresent([String].self, forKey: .readonlyPaths) self.creationDate = try container.decodeIfPresent(Date.self, forKey: .creationDate) ?? Date(timeIntervalSince1970: 0) } diff --git a/ContainerSystem/Container/ContainerOptions.swift b/ContainersCore/Container/ContainerOptions.swift similarity index 88% rename from ContainerSystem/Container/ContainerOptions.swift rename to ContainersCore/Container/ContainerOptions.swift index 93a7a95..0e834f9 100644 --- a/ContainerSystem/Container/ContainerOptions.swift +++ b/ContainersCore/Container/ContainerOptions.swift @@ -10,9 +10,11 @@ import Foundation /// Options for creating a container. public struct ContainerCreateOptions: Sendable, Codable { public let autoRemove: Bool + public let rootFsOverride: Filesystem? - public init(autoRemove: Bool = false) { + public init(autoRemove: Bool = false, rootFsOverride: Filesystem? = nil) { self.autoRemove = autoRemove + self.rootFsOverride = rootFsOverride } } diff --git a/ContainerSystem/Container/ContainerProcess.swift b/ContainersCore/Container/ContainerProcess.swift similarity index 100% rename from ContainerSystem/Container/ContainerProcess.swift rename to ContainersCore/Container/ContainerProcess.swift diff --git a/ContainerSystem/Container/ContainerSnapshot.swift b/ContainersCore/Container/ContainerSnapshot.swift similarity index 79% rename from ContainerSystem/Container/ContainerSnapshot.swift rename to ContainersCore/Container/ContainerSnapshot.swift index 97f6210..c8679da 100644 --- a/ContainerSystem/Container/ContainerSnapshot.swift +++ b/ContainersCore/Container/ContainerSnapshot.swift @@ -6,17 +6,9 @@ import ContainerizationOCI import Foundation -public enum ContainerStatus: String, Sendable, Codable, Hashable { - case starting - case running - case stopped - case stopping - case unknown -} - public struct ContainerSnapshot: Sendable, Codable { public var configuration: ContainerConfiguration - public var status: ContainerStatus + public var status: RuntimeStatus public var networks: [Attachment] public var startedDate: Date? @@ -38,7 +30,7 @@ public struct ContainerSnapshot: Sendable, Codable { public init( configuration: ContainerConfiguration, - status: ContainerStatus, + status: RuntimeStatus, networks: [Attachment], startedDate: Date? = nil ) { diff --git a/ContainersCore/Container/ContainerStats.swift b/ContainersCore/Container/ContainerStats.swift new file mode 100644 index 0000000..7444190 --- /dev/null +++ b/ContainersCore/Container/ContainerStats.swift @@ -0,0 +1,25 @@ +// +// ContainerStats.swift +// Containers +// +// Created by Axel Martinez on 15/09/2026. +// + +import Foundation + +/// One running container's statistics: its memory, CPU time, network traffic and disk I/O, as `container stats` shows them. +public struct ContainerStats: Sendable { + public let id: String + public let memoryBytes: UInt64 + /// The most memory the container can use. + public let memoryLimitBytes: UInt64 + public let cpuUsageMicroseconds: UInt64 + /// The bytes the container's network interfaces received since it started. + public let networkReceivedBytes: UInt64 + /// The bytes the container's network interfaces sent since it started. + public let networkSentBytes: UInt64 + /// The bytes read from the container's disks since it started. + public let diskReadBytes: UInt64 + /// The bytes written to the container's disks since it started. + public let diskWriteBytes: UInt64 +} diff --git a/ContainersCore/Container/ContainerStatus.swift b/ContainersCore/Container/ContainerStatus.swift new file mode 100644 index 0000000..791f61b --- /dev/null +++ b/ContainersCore/Container/ContainerStatus.swift @@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +import Foundation + +/// The runtime status of a container. Identity-free: the container's id lives +/// on its ``ContainerConfiguration``. +public struct ContainerStatus: Codable, Sendable { + /// The state-machine value for the container (running, stopped, …). + public let state: RuntimeStatus + /// Network attachments provided to the container. + public let networks: [Attachment] + /// When the container was started, if it has been. + public let startedDate: Date? + + public init(state: RuntimeStatus, networks: [Attachment], startedDate: Date? = nil) { + self.state = state + self.networks = networks + self.startedDate = startedDate + } +} diff --git a/ContainerSystem/Container/Filesystem.swift b/ContainersCore/Container/Filesystem.swift similarity index 90% rename from ContainerSystem/Container/Filesystem.swift rename to ContainersCore/Container/Filesystem.swift index 58a8943..d7e6767 100644 --- a/ContainerSystem/Container/Filesystem.swift +++ b/ContainersCore/Container/Filesystem.swift @@ -12,32 +12,31 @@ import SystemPackage public struct Filesystem: Sendable, Codable { /// Cache mode for block devices. - public enum CacheMode: String, Sendable, Codable, Equatable { + public enum CacheMode: Sendable, Codable, Equatable { case on case off case auto } /// Sync mode for block devices. - public enum SyncMode: String, Sendable, Codable, Equatable { + public enum SyncMode: Sendable, Codable, Equatable { case full case fsync case nosync - case none = "" } /// The type of filesystem mount. public enum FilesystemType: Sendable, Codable, Equatable { case block( format: String, - cache: CacheMode = .auto, - sync: SyncMode = .none + cache: CacheMode = .on, + sync: SyncMode = .fsync ) case volume( name: String, format: String, - cache: CacheMode = .auto, - sync: SyncMode = .none + cache: CacheMode = .on, + sync: SyncMode = .fsync ) case virtiofs case tmpfs @@ -96,8 +95,8 @@ public struct Filesystem: Sendable, Codable { format: String = "ext4", source: String, destination: String, - cache: CacheMode = .auto, - sync: SyncMode = .none, + cache: CacheMode = .on, + sync: SyncMode = .fsync, options: [String] = [] ) -> Filesystem { Filesystem( @@ -142,7 +141,7 @@ public struct Filesystem: Sendable, Codable { public static func tmpfs(destination: String, options: [String] = []) -> Filesystem { Filesystem( type: .tmpfs, - source: "", + source: "tmpfs", destination: destination, options: options ) diff --git a/ContainersCore/Container/ManagedContainer.swift b/ContainersCore/Container/ManagedContainer.swift new file mode 100644 index 0000000..4aa1e5f --- /dev/null +++ b/ContainersCore/Container/ManagedContainer.swift @@ -0,0 +1,64 @@ +// +// ManagedContainer.swift +// Containers +// + +import ContainerizationOCI +import Foundation + +/// A container, with what it was configured as and what it is doing now. +public struct ManagedContainer: ManagedResource, Codable { + public let configuration: ContainerConfiguration + public let status: ContainerStatus + + public var id: String { configuration.id } + /// Containers have no name of their own: they're known by their id. + public var name: String { configuration.id } + public var creationDate: Date { configuration.creationDate } + /// Empty where any of the configuration's labels isn't valid. + public var labels: ResourceLabels { (try? ResourceLabels(configuration.labels)) ?? ResourceLabels() } + public var platform: Platform { configuration.platform } + + /// The names of the volumes the container mounts. + public var volumeNames: [String] { + configuration.mounts.compactMap(\.volumeName) + } + + public init(configuration: ContainerConfiguration, status: ContainerStatus) { + self.configuration = configuration + self.status = status + } + + public init(_ snapshot: ContainerSnapshot) { + self.configuration = snapshot.configuration + self.status = ContainerStatus( + state: snapshot.status, + networks: snapshot.networks, + startedDate: snapshot.startedDate + ) + } +} + +// Coded with the id alongside, so a container can be read back in the same shape. +extension ManagedContainer { + enum CodingKeys: String, CodingKey { + case id + case configuration + case status + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + try container.encode(id, forKey: .id) + try container.encode(configuration, forKey: .configuration) + try container.encode(status, forKey: .status) + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + + self.configuration = try container.decode(ContainerConfiguration.self, forKey: .configuration) + self.status = try container.decode(ContainerStatus.self, forKey: .status) + } +} diff --git a/ContainerSystem/Container/Parser.swift b/ContainersCore/Container/Parser.swift similarity index 99% rename from ContainerSystem/Container/Parser.swift rename to ContainersCore/Container/Parser.swift index 124ef07..ed95623 100644 --- a/ContainerSystem/Container/Parser.swift +++ b/ContainersCore/Container/Parser.swift @@ -307,7 +307,7 @@ public enum Parser { } // Every unit is a binary one, so "m", "mb" and "mib" all name the - // same size, the way the container CLI reads them. + // same size. let multiplier: Double switch suffix { case "k", "kb", "kib": diff --git a/ContainerSystem/Container/ProcessConfiguration.swift b/ContainersCore/Container/ProcessConfiguration.swift similarity index 100% rename from ContainerSystem/Container/ProcessConfiguration.swift rename to ContainersCore/Container/ProcessConfiguration.swift diff --git a/ContainerSystem/Container/PublishPort.swift b/ContainersCore/Container/PublishPort.swift similarity index 100% rename from ContainerSystem/Container/PublishPort.swift rename to ContainersCore/Container/PublishPort.swift diff --git a/ContainersCore/Container/PublishSocket.swift b/ContainersCore/Container/PublishSocket.swift new file mode 100644 index 0000000..bc075a7 --- /dev/null +++ b/ContainersCore/Container/PublishSocket.swift @@ -0,0 +1,52 @@ +// +// PublishSocket.swift +// Containers +// +// Local implementation of PublishSocket (replaces ContainerResource.PublishSocket) +// + +import Foundation +import SystemPackage + +/// Represents a socket that should be published from container to host. +public struct PublishSocket: Sendable, Codable { + public var containerPath: URL + public var hostPath: URL + public var permissions: FilePermissions? + + public init( + containerPath: URL, + hostPath: URL, + permissions: FilePermissions? = nil + ) { + self.containerPath = containerPath + self.hostPath = hostPath + self.permissions = permissions + } +} + +// Paths are stored as plain strings. +extension PublishSocket { + enum CodingKeys: String, CodingKey { + case containerPath + case hostPath + case permissions + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + let containerPath = try container.decode(String.self, forKey: .containerPath) + let hostPath = try container.decode(String.self, forKey: .hostPath) + + self.containerPath = URL(filePath: containerPath) + self.hostPath = URL(filePath: hostPath) + self.permissions = try container.decodeIfPresent(FilePermissions.self, forKey: .permissions) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(containerPath.path(percentEncoded: false), forKey: .containerPath) + try container.encode(hostPath.path(percentEncoded: false), forKey: .hostPath) + try container.encodeIfPresent(permissions, forKey: .permissions) + } +} diff --git a/ContainerSystem/Container/RequestScheme.swift b/ContainersCore/Container/RequestScheme.swift similarity index 100% rename from ContainerSystem/Container/RequestScheme.swift rename to ContainersCore/Container/RequestScheme.swift diff --git a/ContainersCore/Container/RuntimeStatus.swift b/ContainersCore/Container/RuntimeStatus.swift new file mode 100644 index 0000000..6092356 --- /dev/null +++ b/ContainersCore/Container/RuntimeStatus.swift @@ -0,0 +1,15 @@ +// +// RuntimeStatus.swift +// Containers +// + +import Foundation + +/// Where a container is in its lifecycle. +public enum RuntimeStatus: String, Sendable, Codable, Hashable { + case starting + case running + case stopped + case stopping + case unknown +} diff --git a/ContainerSystem/Container/TypeAliases.swift b/ContainersCore/Container/TypeAliases.swift similarity index 100% rename from ContainerSystem/Container/TypeAliases.swift rename to ContainersCore/Container/TypeAliases.swift diff --git a/ContainerSystem/Image/ImageLayer.swift b/ContainersCore/Image/ImageLayer.swift similarity index 100% rename from ContainerSystem/Image/ImageLayer.swift rename to ContainersCore/Image/ImageLayer.swift diff --git a/ContainerSystem/Image/ImageResource.swift b/ContainersCore/Image/ImageResource.swift similarity index 76% rename from ContainerSystem/Image/ImageResource.swift rename to ContainersCore/Image/ImageResource.swift index 9484b4b..28c9289 100644 --- a/ContainerSystem/Image/ImageResource.swift +++ b/ContainersCore/Image/ImageResource.swift @@ -9,7 +9,11 @@ import Containerization import ContainerizationOCI import Foundation -public struct ImageResource: Codable, Sendable { +/// An image, with the platform variants that were read for it. +public struct ImageResource: ManagedResource, Codable { + /// The creation date of an image that doesn't record one. + public static let unknownCreationDate = Date(timeIntervalSince1970: 0) + public let configuration: ImageConfiguration public let variants: [Variant] @@ -25,6 +29,21 @@ public struct ImageResource: Codable, Sendable { configuration.creationDate } + /// The image's labels, from its index's annotations. Empty where any of them isn't valid. + public var labels: ResourceLabels { + (try? ResourceLabels(configuration.descriptor.annotations ?? [:])) ?? ResourceLabels() + } + + /// The reference and descriptor the image service knows the image by. + public var imageDescription: ImageDescription { + ImageDescription(reference: name, descriptor: configuration.descriptor) + } + + /// The variant for a platform, if it was read. + public func variant(for platform: Platform) -> Variant? { + variants.first { $0.platform == platform } + } + public struct Variant: Codable, Sendable { public let platform: Platform public let digest: String diff --git a/ContainersCore/Image/Reference+Normalized.swift b/ContainersCore/Image/Reference+Normalized.swift new file mode 100644 index 0000000..a28b9a1 --- /dev/null +++ b/ContainersCore/Image/Reference+Normalized.swift @@ -0,0 +1,34 @@ +// +// Reference+Normalized.swift +// Containers +// +// Created by Axel Martinez on 03/10/2026. +// + +import ContainerizationOCI +import Foundation + +extension Reference { + /// Parses a reference as typed, filling in what a short name leaves out: + /// the default registry from the system's settings, `library/` for Docker + /// Hub's official images, and the `latest` tag. + /// + /// - Parameters: + /// - reference: The reference as typed. + /// - registry: The registry for a reference that doesn't name one. + /// - Returns: The complete reference. + /// - Throws: An error if the text isn't a reference. + public static func normalized(_ reference: String, registry: String = DefaultsStore.get(key: .registryDomain)) throws -> Reference { + let trimmed = reference.trimmingCharacters(in: .whitespacesAndNewlines) + var parsed = try parse(trimmed) + + // The init image is used as configured, so a local build of it can stand in. + if parsed.domain == nil, trimmed != DefaultsStore.get(key: .defaultInitImage) { + parsed = try parse("\(registry)/\(trimmed)") + } + + parsed.normalize() + + return parsed + } +} diff --git a/ContainerSystem/Image/String+Digest.swift b/ContainersCore/Image/String+Digest.swift similarity index 100% rename from ContainerSystem/Image/String+Digest.swift rename to ContainersCore/Image/String+Digest.swift diff --git a/ContainerSystem/Log/OSLogHandler.swift b/ContainersCore/Log/OSLogHandler.swift similarity index 98% rename from ContainerSystem/Log/OSLogHandler.swift rename to ContainersCore/Log/OSLogHandler.swift index 162fcb2..c5364ab 100644 --- a/ContainerSystem/Log/OSLogHandler.swift +++ b/ContainersCore/Log/OSLogHandler.swift @@ -1,6 +1,6 @@ // // OSLogHandler.swift -// ContainerSystem +// ContainersCore // import Logging diff --git a/ContainerSystem/Managers/ContainerManager.swift b/ContainersCore/Managers/ContainerManager.swift similarity index 81% rename from ContainerSystem/Managers/ContainerManager.swift rename to ContainersCore/Managers/ContainerManager.swift index 5f6cde3..06a6c2c 100644 --- a/ContainerSystem/Managers/ContainerManager.swift +++ b/ContainersCore/Managers/ContainerManager.swift @@ -19,7 +19,7 @@ import Logging @Observable @MainActor public final class ContainerManager { - let runtime: ContainerRuntime + let containerSystem: ContainerSystem private let logger: Logger private static let internalContainerIDs: Set = ["buildkit"] @@ -28,21 +28,21 @@ public final class ContainerManager { /// /// Observe this property to refresh a list of containers when one of them changes. public var lastContainerChange: Date { - runtime.lastContainerStateChange + containerSystem.lastContainerStateChange } /// Creates a manager for the shared container system. public init() { - self.runtime = ContainerRuntime.shared + self.containerSystem = ContainerSystem.shared var logger = Logger(label: "app.containers.manager.container") logger.logLevel = .info self.logger = logger } #if DEBUG - /// Creates a manager for the given runtime, so tests can use a runtime of their own. - init(testRuntime: ContainerRuntime) { - self.runtime = testRuntime + /// Creates a manager over the given container system, so tests can use one of their own. + init(testSystem: ContainerSystem) { + self.containerSystem = testSystem var logger = Logger(label: "app.containers.manager.container.test") logger.logLevel = .debug self.logger = logger @@ -55,7 +55,6 @@ public final class ContainerManager { /// /// - Parameters: /// - imageReference: The image to create the container from. - /// - imagesDir: The folder that holds the container system's images. /// - arguments: Arguments to pass to the container's process, after its entry point. /// - process: How to run the container's process, such as its environment and working directory. /// - configuration: The container's resources, mounts, ports and other settings. @@ -63,11 +62,10 @@ public final class ContainerManager { /// - registryScheme: The scheme to reach the image's registry with. /// - progress: A progress that follows the work, step by step, or `nil` to not follow it. /// - Returns: The container's ID. - /// - Throws: An error if a container with the same ID exists, or the container can't be created. + /// - Throws: An error if a container with the same ID exists or the container can't be created. @discardableResult public func create( - imageReference: String, - imagesDir: URL, + from imageReference: String, arguments: [KeyValue], process: ContainerProcess, configuration: ContainerConfiguration, @@ -75,7 +73,7 @@ public final class ContainerManager { registryScheme: String = RequestScheme.auto.rawValue, progress: Progress? = nil ) async throws -> String { - let service = try await runtime.getContainersService() + let service = try containerSystem.containerService let containerID = try Self.createContainerID(name: options.name) logger.info("Creating container", metadata: ["id": "\(containerID)", "image": "\(imageReference)"]) @@ -94,40 +92,61 @@ public final class ContainerManager { let progress = progress ?? Progress(parent: nil) progress.totalUnitCount = 6 - let (configuration, kernel) = try await progress.performStep(pendingUnitCount: 5) { step in - try await createContainerConfig( - id: containerID, - imageReference: imageReference, - imagesDir: imagesDir, - arguments: arguments.map { "\($0.key)=\($0.value)" }, - process: process, - configuration: configuration, - options: options, - registryScheme: registryScheme, - progress: step - ) - } + // An image the creation pulls goes with it when it's cancelled, as no work is resumed; one that was + // there before is kept. + let imageService = try containerSystem.imageService + let processedReference = try Reference.normalized(imageReference).description + let imageExisted = try await imageService.list().contains { $0.reference == processedReference } + var isCreated = false - try Task.checkCancellation() + do { + let (settled, kernel) = try await progress.performStep(pendingUnitCount: 5) { step in + try await createContainerConfig( + id: containerID, + imageReference: imageReference, + arguments: arguments.map { "\($0.key)=\($0.value)" }, + process: process, + configuration: configuration, + options: options, + registryScheme: registryScheme, + progress: step + ) + } - try await progress.performStep("Creating container") { _ in - try await service.create( - configuration: configuration, - kernel: kernel, - options: ContainerCreateOptions(autoRemove: options.deleteOnTermination) - ) - } + try Task.checkCancellation() + + try await progress.performStep("Creating container") { _ in + try await service.create( + configuration: settled, + kernel: kernel, + options: ContainerCreateOptions(autoRemove: options.deleteOnTermination) + ) + } + + isCreated = true + + try Task.checkCancellation() + } catch { + if Task.isCancelled { + logger.info("Creation cancelled, discarding container \(containerID)") + + if isCreated { + try? await service.delete(id: containerID) + } + + if !imageExisted { + await imageService.discard(references: [processedReference]) + } + } - if Task.isCancelled { - try? await service.delete(id: configuration.id) - throw CancellationError() + throw error } if !options.cidfile.isEmpty { - try writeCIDFile(path: options.cidfile, id: configuration.id) + try writeCIDFile(path: options.cidfile, id: containerID) } - return configuration.id + return containerID } /// Starts a container. @@ -142,7 +161,7 @@ public final class ContainerManager { public func run(id: String, detach: Bool = true, progress: Progress? = nil) async throws -> Int32? { logger.info("Starting container", metadata: ["id": "\(id)"]) progress?.localizedDescription = "Starting container" - let service = try await runtime.getContainersService() + let service = try containerSystem.containerService do { try await service.bootstrap(id: id, stdio: [nil, nil, nil]) @@ -166,22 +185,31 @@ public final class ContainerManager { return try await service.wait(id: id) } - /// Returns the memory and CPU time each running container uses, or an empty array if the system isn't running. - public func resourceUsage() async -> [ContainerResourceUsage] { - guard let service = try? await runtime.getContainersService() else { + /// Returns the memory, CPU time, network and disk I/O each running container uses, or an empty array if the system isn't running. + public func stats() async -> [ContainerStats] { + guard let service = try? containerSystem.containerService else { return [] } - return await service.resourceUsage() + return await service.stats() + } + + /// Returns whether any container is running, including the ones the container system runs itself, such as the builder. + public func hasRunningContainers() async -> Bool { + guard let service = try? containerSystem.containerService else { + return false + } + + return await service.list().contains { $0.status == .running } } /// Returns every container, except the ones the container system uses itself, such as the builder. - public func list() async throws -> [ContainerSnapshot] { - let service = try await runtime.getContainersService() + public func list() async throws -> [ManagedContainer] { + let service = try containerSystem.containerService - return await service.list().filter { snapshot in - !Self.internalContainerIDs.contains(snapshot.configuration.id) - } + return await service.list() + .filter { !Self.internalContainerIDs.contains($0.configuration.id) } + .map(ManagedContainer.init) } /// Returns a container. @@ -189,9 +217,8 @@ public final class ContainerManager { /// - Parameter id: The container's ID. /// - Returns: The container. /// - Throws: An error if there's no container with that ID. - public func get(id: String) async throws -> ContainerSnapshot { - let service = try await runtime.getContainersService() - + public func container(withID id: String) async throws -> ManagedContainer { + let service = try containerSystem.containerService let snapshots = await service.list() guard @@ -200,7 +227,7 @@ public final class ContainerManager { throw ContainerizationError(.notFound, message: "Container not found: \(id)") } - return snapshot + return ManagedContainer(snapshot) } /// Runs a command in a running container and returns its output. @@ -211,7 +238,7 @@ public final class ContainerManager { /// - Returns: What the command writes to its standard output. /// - Throws: An error if the container isn't running or the command can't run. public func exec(id: String, arguments: [String]) async throws -> String { - let service = try await runtime.getContainersService() + let service = try containerSystem.containerService return try await service.exec(id: id, arguments: arguments) } @@ -222,8 +249,7 @@ public final class ContainerManager { /// - timeoutSeconds: How long to wait for each process to exit after sending it `SIGTERM`. /// - Throws: An error that lists each container that couldn't be stopped. public func stop(ids: [String], timeoutSeconds: Int32) async throws { - let service = try await runtime.getContainersService() - + let service = try containerSystem.containerService let stopOptions = ContainerStopOptions(timeoutInSeconds: timeoutSeconds, signal: SIGTERM) var failed: [(String, Error)] = [] @@ -262,7 +288,7 @@ public final class ContainerManager { /// - force: Whether to stop a running container and delete it, rather than leave it. /// - Throws: An error that lists each container that couldn't be deleted. public func delete(ids: [String], force: Bool) async throws { - let service = try await runtime.getContainersService() + let service = try containerSystem.containerService let snapshots = await service.list() var deleted: [String] = [] @@ -295,7 +321,7 @@ public final class ContainerManager { } } - try await runtime.getReportsService().delete(named: deleted, ofKind: [.container]) + try await containerSystem.reportService.delete(named: deleted, ofKind: [.container]) if !failed.isEmpty { let failures = failed.map({ "\($0.0): \($0.1)" }).joined(separator: "\n") @@ -376,7 +402,7 @@ public final class ContainerManager { return UUID().uuidString.lowercased() } - guard isValidContainerName(trimmedName) else { + guard EntityName.isValid(trimmedName) else { let message = """ Invalid container name '\(trimmedName)': must start with a letter or number and contain only letters, numbers, underscores, periods, and hyphens. @@ -387,19 +413,14 @@ public final class ContainerManager { return trimmedName } - /// Returns a Boolean value that indicates whether a name can be a container's ID. - public static func isValidContainerName(_ name: String) -> Bool { - EntityName.isValid(name) - } - private func resolveImage( reference: String, platform: Platform, insecure: Bool, - imagesService: ImagesService, + imageService: ImageService, progress: Progress ) async throws -> ImageDescription { - let existingImages = try await imagesService.list() + let existingImages = try await imageService.list() // Try exact match first if let existing = existingImages.first(where: { @@ -451,7 +472,7 @@ public final class ContainerManager { } } - return try await imagesService.pull( + return try await imageService.pull( reference: reference, platform: platform, insecure: insecure, @@ -462,7 +483,6 @@ public final class ContainerManager { private func createContainerConfig( id: String, imageReference: String, - imagesDir: URL, arguments: [String], process: ContainerProcess, configuration: ContainerConfiguration, @@ -482,7 +502,7 @@ public final class ContainerManager { let processedReference = try Reference.normalized(imageReference) .description - let imagesService = try await runtime.getImagesService() + let imageService = try containerSystem.imageService progress.totalUnitCount = 5 @@ -493,14 +513,14 @@ public final class ContainerManager { reference: processedReference, platform: platform, insecure: insecure, - imagesService: imagesService, + imageService: imageService, progress: step ) } try Task.checkCancellation() try await progress.performStep("Unpacking image") { step in - try await imagesService.unpack( + try await imageService.unpack( description: imageDescription, platform: platform, progressUpdate: step.updateHandler() @@ -516,7 +536,7 @@ public final class ContainerManager { try Task.checkCancellation() let initImageDescription = try await progress.performStep("Fetching init image") { step in - try await imagesService.pull( + try await imageService.pull( reference: initImageReference, platform: .current, insecure: insecure, @@ -526,17 +546,14 @@ public final class ContainerManager { try Task.checkCancellation() try await progress.performStep("Unpacking init image") { step in - try await imagesService.unpack( + try await imageService.unpack( description: initImageDescription, platform: platform, progressUpdate: step.updateHandler() ) } - // Get image config - we need to use the lower level ImageStore for this - // since ImagesService doesn't expose config fetching - let imageStore = try ImageStore(path: imagesDir) - let image = try await imageStore.get(reference: imageDescription.reference) + let image = try await imageService.image(for: imageDescription.reference) let imageConfig = try await image.config(for: platform).config config.id = id config.image = imageDescription @@ -550,30 +567,16 @@ public final class ContainerManager { config.stopSignal = config.stopSignal ?? imageConfig?.stopSignal config.networks = try getAttachmentConfigurations(containerId: id, networkIds: options.networks) - // Only configure DNS if explicitly requested - // If not set, containers will use the host's DNS via the VM network - // Setting DNS causes the framework to write /etc/resolv.conf which can fail on read-only rootfs + // Without nameservers, the runtime points the container at its network's gateway. if options.dnsDisabled { config.dns = nil - } else if !options.dnsNameservers.isEmpty - || options.dnsDomain != nil - || !options.dnsSearchDomains.isEmpty - || !options.dnsOptions.isEmpty - { - // User has explicitly configured DNS settings, so apply them - let domain: String? = options.dnsDomain ?? DefaultsStore.getOptional(key: .defaultDNSDomain) - - let dnsConfig = ContainerConfiguration.DNSConfiguration( - nameservers: options.dnsNameservers.isEmpty ? getHostDNSServers() : options.dnsNameservers, - domain: domain, + } else { + config.dns = ContainerConfiguration.DNSConfiguration( + nameservers: options.dnsNameservers, + domain: options.dnsDomain ?? DefaultsStore.getOptional(key: .defaultDNSDomain), searchDomains: options.dnsSearchDomains, options: options.dnsOptions ) - - config.dns = dnsConfig - } else { - // No DNS configuration specified - let it use host DNS via VM network - config.dns = nil } if Platform.current.architecture == "arm64" @@ -619,12 +622,12 @@ public final class ContainerManager { guard item.offset == 0 else { return AttachmentConfiguration( network: item.element, - options: AttachmentOptions(hostname: containerId) + options: AttachmentOptions(hostname: containerId, mtu: 1280) ) } return AttachmentConfiguration( network: item.element, - options: AttachmentOptions(hostname: fqdn ?? containerId) + options: AttachmentOptions(hostname: fqdn ?? containerId, mtu: 1280) ) } } @@ -635,13 +638,13 @@ public final class ContainerManager { return [ AttachmentConfiguration( network: defaultNetworkName, - options: AttachmentOptions(hostname: fqdn ?? containerId) + options: AttachmentOptions(hostname: fqdn ?? containerId, mtu: 1280) ) ] } private func getKernel(options: ContainerManagementOptions) async throws -> Kernel { - let kernelService = try await runtime.getKernelService() + let kernelService = try containerSystem.kernelService // For the image itself we'll take the user input and try with it as we can do userspace // emulation for x86, but for the kernel we need it to match the hosts architecture. @@ -739,21 +742,4 @@ public final class ContainerManager { supplementalGroups: additionalGroups ) } - - // MARK: - DNS Helpers - - /// Read the host's DNS nameservers from /etc/resolv.conf, falling back to public DNS. - private func getHostDNSServers() -> [String] { - if let contents = try? String(contentsOfFile: "/etc/resolv.conf", encoding: .utf8) { - let servers = contents.components(separatedBy: .newlines) - .filter { $0.hasPrefix("nameserver ") } - .compactMap { $0.split(separator: " ").last.map(String.init) } - .filter { !$0.isEmpty } // Filter out empty entries - if !servers.isEmpty { - return servers - } - } - // Fallback to public DNS if /etc/resolv.conf is unavailable or has no nameservers - return ["8.8.8.8", "1.1.1.1"] - } } diff --git a/ContainerSystem/Managers/ImageManager.swift b/ContainersCore/Managers/ImageManager.swift similarity index 71% rename from ContainerSystem/Managers/ImageManager.swift rename to ContainersCore/Managers/ImageManager.swift index 50c6a63..cff790c 100644 --- a/ContainerSystem/Managers/ImageManager.swift +++ b/ContainersCore/Managers/ImageManager.swift @@ -23,22 +23,22 @@ import Observation @Observable @MainActor public final class ImageManager { - let runtime: ContainerRuntime + let containerSystem: ContainerSystem private let logger: Logger /// Creates a manager for the shared container system. public init() { - self.runtime = ContainerRuntime.shared + self.containerSystem = ContainerSystem.shared var logger = Logger(label: "app.containers.manager.image") logger.logLevel = .info self.logger = logger } #if DEBUG - /// Creates a manager for the given runtime, so tests can use a runtime of their own. - init(testRuntime: ContainerRuntime) { - self.runtime = testRuntime + /// Creates a manager over the given container system, so tests can use one of their own. + init(testSystem: ContainerSystem) { + self.containerSystem = testSystem var logger = Logger(label: "app.containers.manager.image.test") logger.logLevel = .debug self.logger = logger @@ -47,62 +47,65 @@ public final class ImageManager { // MARK: - Public API - /// Returns every image, except the ones the container system uses itself, with whether a container uses it. + /// Returns every image, except the ones the container system uses itself. /// /// - Parameters: - /// - platform: The platform to describe each image for, such as its size and creation date, or `nil` - /// to describe only the image as a whole. - /// - includeVariants: Whether to also describe every platform in each image's index, which means - /// reading their manifests and configurations. - /// - Returns: The images. + /// - platform: The platform to read each image's variant for, such as its size and creation date, or `nil` + /// to read only the image as a whole. + /// - includeVariants: Whether to read every platform in each image's index instead, which means + /// reading all their manifests and configurations. + /// - Returns: The images, each with the variants that were read. One whose variant couldn't be read has none. /// - Throws: An error if the container system isn't running. public func list( platform: Platform? = nil, includeVariants: Bool = false - ) async throws -> [ImageSummary] { - let service = try await runtime.getImagesService() - let containersService = try await runtime.getContainersService() - let images = try await service.list().filter { + ) async throws -> [ImageResource] { + let service = try containerSystem.imageService + let descriptions = try await service.list().filter { !Self.isInfraImage(name: $0.reference) } - let usedImageDigests = Set( - await containersService.list().map { $0.configuration.image.digest } - ) - guard let platform else { - return images.map { - ImageSummary(description: $0, platform: nil, isInUse: usedImageDigests.contains($0.digest)) + guard platform != nil || includeVariants else { + return descriptions.map { + ImageResource(name: $0.reference, descriptor: $0.descriptor, variants: [], creationDate: ImageResource.unknownCreationDate) } } - let imageStore = try await getImageStore() - var items: [ImageSummary] = [] + var images: [ImageResource] = [] + + for description in descriptions { + var variants: [ImageResource.Variant] = [] - for description in images { do { - let image = try await imageStore.get(reference: description.reference) - let summary = try await self.summary(for: image, platform: platform) - let variants = includeVariants ? try await self.variants(of: image) : [] - let item = ImageSummary( - description: description, - platform: summary, - variants: variants, - isInUse: usedImageDigests.contains(description.digest) - ) + let image = try await service.image(for: description.reference) - items.append(item) + if includeVariants { + variants = try await self.variants(of: image) + } else if let platform { + variants = [try await self.variant(of: image, for: platform)] + } } catch { - let item = ImageSummary( - description: description, - platform: Self.fallbackSummary(for: description, platform: platform), - isInUse: usedImageDigests.contains(description.digest) - ) - - items.append(item) + // Listed all the same, as the image as a whole. } + + images.append( + ImageResource( + name: description.reference, + descriptor: description.descriptor, + variants: variants, + creationDate: Self.creationDate(from: variants) + ) + ) } - return items + return images + } + + /// Returns the digests of the images a container was made from. + public func digestsInUse() async throws -> Set { + let service = try containerSystem.containerService + + return Set(await service.list().map(\.configuration.image.digest)) } /// Returns the details of an image, including every platform in its index. @@ -111,7 +114,7 @@ public final class ImageManager { /// - Returns: The image's details. /// - Throws: An error if the image isn't in the container system. public func inspect(image: ImageDescription) async throws -> ImageResource { - let storedImage = try await getStoredImage(reference: image.reference) + let storedImage = try await containerSystem.imageService.image(for: image.reference) let index = try await storedImage.index() let descriptor = resolvedDescriptor(for: image.descriptor, in: index) let variants = try await self.variants(of: storedImage, in: index) @@ -139,7 +142,7 @@ public final class ImageManager { scheme: RequestScheme = .auto, progress: Progress? = nil ) async throws { - let service = try await runtime.getImagesService() + let service = try containerSystem.imageService let processedReference = try Reference.normalized(reference).description let insecure = scheme == .http @@ -148,25 +151,37 @@ public final class ImageManager { let progress = progress ?? Progress(parent: nil) progress.totalUnitCount = 2 - let imageDescription = try await progress.performStep("Fetching image") { step in - try await service.pull( - reference: processedReference, - platform: platform, - insecure: insecure, - progressUpdate: step.updateHandler() - ) - } + // An image pulled again is kept when the pull is cancelled; one the pull added isn't. + let existed = try await service.list().contains { $0.reference == processedReference } + + do { + let imageDescription = try await progress.performStep("Fetching image") { step in + try await service.pull( + reference: processedReference, + platform: platform, + insecure: insecure, + progressUpdate: step.updateHandler() + ) + } - try Task.checkCancellation() + try Task.checkCancellation() - logger.info("Unpacking image") + logger.info("Unpacking image") - try await progress.performStep("Unpacking image") { step in - try await service.unpack( - description: imageDescription, - platform: platform, - progressUpdate: step.updateHandler() - ) + try await progress.performStep("Unpacking image") { step in + try await service.unpack( + description: imageDescription, + platform: platform, + progressUpdate: step.updateHandler() + ) + } + } catch { + if Task.isCancelled, !existed { + logger.info("Pull cancelled, discarding image: \(processedReference)") + await service.discard(references: [processedReference]) + } + + throw error } logger.info("Image pulled successfully: \(processedReference)") @@ -177,6 +192,8 @@ public final class ImageManager { /// Each build starts the builder container, or restarts it so that it can read the build's files. /// The built image is written to `outputs`: an OCI output adds it to the container system's images, /// and a tar or local output writes its files to the output's destination. + /// + /// - Throws: An error if the builder can't start or the build fails. public func build( dockerFile: URL, contextDirectory: URL, @@ -194,10 +211,14 @@ public final class ImageManager { cacheOut: [String] = [], progress: Progress? = nil ) async throws { - let containersService = try await runtime.getContainersService() - let imagesService = try await runtime.getImagesService() - let appRoot = try runtime.getAppRoot() - let contentStore = try runtime.getContentStore() + // Checked here rather than in a service: the build writes its folders in the system's folder before + // it starts the builder. + + let containerService = try containerSystem.containerService + let imageService = try containerSystem.imageService + guard let appRoot = containerSystem.appRoot else { + throw ContainerSystem.notRunningError + } logger.info("Building image from Dockerfile") @@ -217,7 +238,8 @@ public final class ImageManager { // STEP 1: Generate buildID and create export directory FIRST let dockerFileData = try await FileIO.shared.contents(of: dockerFile) - let exportPath = appRoot.appendingPathComponent(".build") + // The folder the builder mounts for its exports. + let exportPath = appRoot.appendingPathComponent("builder") let id = UUID().uuidString // Create the buildID subdirectory for exports BEFORE starting builder @@ -240,6 +262,12 @@ public final class ImageManager { attributes: nil ) + // Removed however the build ends, a cancelled one included, as no build is resumed. + defer { + try? FileManager.default.removeItem(at: buildSessionDir) + try? FileManager.default.removeItem(at: buildIDDir) + } + let exportDestination = buildIDDir.appendingPathComponent("out.tar") // STEP 2: Start/restart the builder NOW with the directory already in place @@ -255,6 +283,15 @@ public final class ImageManager { // STEP 3: Connect to the (re)started builder let timeout: Duration = .seconds(120) let buildkitId = BuilderController.builderContainerId + // TODO: Consider `NIOSingletons.posixEventLoopGroup`, which the DNS servers use: shared and never shut down, + // it would leave no group to make or shut down here. The build would then share its threads with them. + // One group for every attempt to connect, and the build that follows. + let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount) + + // Shut down however the build ends. `defer` can't wait, and nothing needs the threads once it has ended. + defer { + Task { try? await eventLoopGroup.shutdownGracefully() } + } let builder: Builder = try await withThrowingTaskGroup(of: Builder.self) { group in defer { @@ -267,7 +304,7 @@ public final class ImageManager { self.logger.info("Getting Builder container") // Check if builder container exists and is running - let containerList = await containersService.list() + let containerList = await containerService.list() guard let builderContainer = containerList.first(where: { $0.configuration.id == buildkitId @@ -285,19 +322,22 @@ public final class ImageManager { self.logger.info("Dialing Builder...") - let fileHandle = try await containersService.dial(id: buildkitId, port: vSockPort) - let threadGroup = MultiThreadedEventLoopGroup(numberOfThreads: System.coreCount) + let fileHandle = try await containerService.dial(id: buildkitId, port: vSockPort) // Use SandboxedBuilder to avoid XPC-based ClientImage calls - let builder = try Builder( + let builder = try await Builder( socket: fileHandle, - group: threadGroup, - imagesService: imagesService, - contentStore: contentStore + group: eventLoopGroup, + imageService: imageService ) - // If this call succeeds, then BuildKit is running. - let _ = try await builder.info() + do { + // If this call succeeds, then BuildKit is running. + _ = try await builder.info() + } catch { + builder.close() + throw error + } return builder } catch { @@ -324,6 +364,10 @@ public final class ImageManager { return builder } + defer { + builder.close() + } + // Copy context directory to a temporary location accessible by the builder // This is necessary because sandboxed apps can't directly share user-selected directories with the VM let tempContextDir = buildSessionDir.appendingPathComponent("context") @@ -339,17 +383,7 @@ public final class ImageManager { throw error } - defer { - try? FileManager.default.removeItem(at: buildSessionDir) - try? FileManager.default.removeItem(at: exportDestination) - } - - let imageName: String = try { - let parsedReference = try Reference.parse(tag) - parsedReference.normalize() - - return parsedReference.description - }() + let imageName = try Reference.normalized(tag).description let exports: [Builder.BuildExport] = try outputs.map { output in try output.verify() @@ -378,7 +412,6 @@ public final class ImageManager { try await progress.performStep("Building image") { step in let config = Builder.BuildConfig.init( id: id, - contentStore: contentStore, args: buildArguments.map { "\($0.key)=\($0.value)" }, contextDir: tempContextDir.path, dockerfile: dockerFileData, @@ -442,23 +475,37 @@ public final class ImageManager { .appendingPathComponent("oci-layout") try await FileIO.shared.extractArchive(at: dest, to: extractedLayoutDirectory) - let (imageDescriptions, _) = try await imagesService.load( - from: extractedLayoutDirectory, - force: false - ) + // Images built before under the same tag are kept when the build is cancelled. + let existing = Set(try await imageService.list().map(\.reference)) + var imageDescriptions: [ImageDescription] = [] - try await progress.performStep("Unpacking built image") { step in - let update = step.updateHandler() + do { + imageDescriptions = try await imageService.load( + from: extractedLayoutDirectory, + force: false + ).0 - for imageDesc in imageDescriptions { - try Task.checkCancellation() + try await progress.performStep("Unpacking built image") { step in + let update = step.updateHandler() - try await imagesService.unpack( - description: imageDesc, - platform: Platform?.none, - progressUpdate: update + for imageDesc in imageDescriptions { + try Task.checkCancellation() + + try await imageService.unpack( + description: imageDesc, + platform: Platform?.none, + progressUpdate: update + ) + } + } + } catch { + if Task.isCancelled { + await imageService.discard( + references: imageDescriptions.map(\.reference).filter { !existing.contains($0) } ) } + + throw error } case BuildImageOutputConfiguration.BuildType.tar.rawValue: @@ -482,7 +529,18 @@ public final class ImageManager { throw ContainerizationError(.invalidArgument, message: "expected local output not found") } - try await FileIO.shared.copyItem(at: localDir, to: dest) + // Only a copy the build made is removed when it's cancelled, never what was there before. + let destinationExisted = FileManager.default.fileExists(atPath: dest.path) + + do { + try await FileIO.shared.copyItem(at: localDir, to: dest) + } catch { + if Task.isCancelled, !destinationExisted { + try? FileManager.default.removeItem(at: dest) + } + + throw error + } default: throw ContainerizationError(.invalidArgument, message: "invalid exporter.") } @@ -499,7 +557,7 @@ public final class ImageManager { /// - outputURL: Where to write the archive. /// - Throws: An error if an image can't be saved or the archive can't be written. public func save(images: [ImageDescription], platform: Platform = .current, outputURL: URL) async throws { - let service = try await runtime.getImagesService() + let service = try containerSystem.imageService logger.info("Saving \(images.count) image(s)") @@ -525,16 +583,19 @@ public final class ImageManager { /// - force: Whether to load the archive even if some of its entries were rejected while extracting it, /// such as entries with unsafe paths. /// - progress: A progress that follows the work, step by step, or `nil` to not follow it. + /// - willLoad: Given the references of the images the archive holds once it has been read, before any is + /// recorded. Throwing stops the load with nothing recorded. /// - Returns: The images the archive held, which is only known once it has been read. - /// - Throws: An error if the archive can't be read or loaded, or if it has rejected entries and `force` is - /// `false`. + /// - Throws: An error if the archive can't be read or loaded, or if it has rejected + /// entries and `force` is `false`. @discardableResult public func load( tar: URL, force: Bool = false, - progress: Progress? = nil + progress: Progress? = nil, + willLoad: (@Sendable ([String]) async throws -> Void)? = nil ) async throws -> [ImageDescription] { - let service = try await runtime.getImagesService() + let service = try containerSystem.imageService let didAccessTar = tar.startAccessingSecurityScopedResource() defer { if didAccessTar { @@ -561,53 +622,68 @@ public final class ImageManager { source = tar stagingDirectory = nil } else { - let extractedDirectory = FileManager.default.temporaryDirectory + source = FileManager.default.temporaryDirectory .appending(path: "oci-layout-\(UUID().uuidString)") - try FileManager.default.createDirectory(at: extractedDirectory, withIntermediateDirectories: true) + stagingDirectory = source + } + + // Removed however the load ends, a cancelled extraction included. + defer { + if let stagingDirectory { + try? FileManager.default.removeItem(at: stagingDirectory) + } + } + + if let stagingDirectory { + try FileManager.default.createDirectory(at: stagingDirectory, withIntermediateDirectories: true) let rejectedMembers = try await FileIO.shared - .extractArchive(at: tar, to: extractedDirectory) + .extractArchive(at: tar, to: stagingDirectory) if !rejectedMembers.isEmpty && !force { - try? FileManager.default.removeItem(at: extractedDirectory) let rejectedList = rejectedMembers.joined(separator: ", ") throw ContainerizationError( .invalidArgument, message: "Cannot load tar image with rejected paths: \(rejectedList)" ) } - - source = extractedDirectory - stagingDirectory = extractedDirectory } - defer { - if let stagingDirectory { - try? FileManager.default.removeItem(at: stagingDirectory) - } - } + try await willLoad?(try service.references(inLayout: source)) - let loaded = try await progress.performStep("Loading tar archive") { _ in - try await service.load(from: source, force: force) - } + // Images the archive holds that were there before are kept when the load is cancelled. + let existing = Set(try await service.list().map(\.reference)) + var loaded: [ImageDescription] = [] - logger.info("Unpacking images") + do { + loaded = try await progress.performStep("Loading tar archive") { _ in + try await service.load(from: source, force: force).0 + } - try await progress.performStep("Unpacking image") { step in - let update = step.updateHandler() + logger.info("Unpacking images") - for imageDescription in loaded.0 { - try await service.unpack( - description: imageDescription, - platform: Platform?.none, - progressUpdate: update - ) + try await progress.performStep("Unpacking image") { step in + let update = step.updateHandler() + + for imageDescription in loaded { + try await service.unpack( + description: imageDescription, + platform: Platform?.none, + progressUpdate: update + ) + } + } + } catch { + if Task.isCancelled { + await service.discard(references: loaded.map(\.reference).filter { !existing.contains($0) }) } + + throw error } logger.info("Images loaded successfully") - return loaded.0 + return loaded } /// Deletes images, along with any reports about pulling or building them. @@ -617,8 +693,7 @@ public final class ImageManager { /// - Parameter images: The images to delete. /// - Throws: An error that lists each image that couldn't be deleted. public func delete(images: [ImageDescription]) async throws { - let service = try await runtime.getImagesService() - + let service = try containerSystem.imageService logger.info("Deleting \(images.count) image(s)") var deleted: [String] = [] @@ -640,8 +715,17 @@ public final class ImageManager { } } + // Deleting an image only removes its reference; its snapshots and the content no other image + // shares are deleted once, after all of them. + if didDeleteAnyImage { + let (_, freedBytes) = try await service.cleanUpOrphanedBlobs() + let freed = ByteCountFormatter.string(fromByteCount: Int64(freedBytes), countStyle: .file) + + logger.info("Reclaimed \(freed) in disk space") + } + // A build is reported against the image it was making, so both go with the image. - try await runtime.getReportsService().delete(named: deleted, ofKind: [.image, .build]) + try await containerSystem.reportService.delete(named: deleted, ofKind: [.image, .build]) if !failed.isEmpty { let failures = (failed.map({ "\($0.0): \($0.1)" })).joined(separator: "\n") @@ -662,14 +746,10 @@ public final class ImageManager { /// - platform: The platform whose layers to return. /// - Returns: The image's layers. /// - Throws: An error if the image or its configuration can't be read. - public func getImageLayers(imageReference: String, platform: Platform) async throws -> [ImageLayer] { - let appRoot = try runtime.getAppRoot() - let imagesDir = appRoot.appendingPathComponent("images") - + public func layers(of imageReference: String, platform: Platform) async throws -> [ImageLayer] { logger.info("Getting layer information for image: \(imageReference)") - let imageStore = try ImageStore(path: imagesDir) - let image = try await imageStore.get(reference: imageReference) + let image = try await containerSystem.imageService.image(for: imageReference) // Get both manifest (for layer sizes) and image config (for history/commands) let manifest = try await image.manifest(for: platform) @@ -734,20 +814,8 @@ public final class ImageManager { // MARK: - Private Helper Methods (moved from Utility) - private func getStoredImage(reference: String) async throws -> Containerization.Image { - let imageStore = try await getImageStore() - return try await imageStore.get(reference: reference) - } - - private func getImageStore() async throws -> ImageStore { - let appRoot = try runtime.getAppRoot() - let imagesDir = appRoot.appendingPathComponent("images") - return try ImageStore(path: imagesDir) - } - - /// Mirrors `ClientImage.toImageResource` in apple/container: one variant - /// per platform manifest in the index, skipping any whose manifest or - /// config can't be read. + /// One variant per platform manifest in the index, skipping any whose + /// manifest or config can't be read. private func variants( of image: Containerization.Image, in index: Index? = nil @@ -782,29 +850,16 @@ public final class ImageManager { return variants } - private func summary( - for image: Containerization.Image, - platform: Platform - ) async throws -> ImageSummary.Platform { - let imageData = try await image.config(for: platform) + private func variant( + of image: Containerization.Image, + for platform: Platform + ) async throws -> ImageResource.Variant { + let descriptor = try await image.descriptor(for: platform) + let config = try await image.config(for: platform) let manifest = try await image.manifest(for: platform) + let size = descriptor.size + manifest.config.size + manifest.layers.reduce(0) { $0 + $1.size } - let createdDate: Date = { - guard let createdString = imageData.created, let date = Self.date(from: createdString) else { - return ImageSummary.unknownCreationDate - } - return date - }() - - let size = manifest.config.size + manifest.layers.reduce(0) { $0 + $1.size } - - return ImageSummary.Platform( - variant: platform.variant, - created: createdDate, - os: platform.os, - architecture: platform.architecture, - size: size - ) + return ImageResource.Variant(platform: platform, digest: descriptor.digest, size: size, config: config) } private func resolvedDescriptor(for descriptor: Descriptor, in index: Index) -> Descriptor { @@ -828,20 +883,7 @@ public final class ImageManager { return date } - return ImageSummary.unknownCreationDate - } - - private static func fallbackSummary( - for description: ImageDescription, - platform: Platform - ) -> ImageSummary.Platform { - ImageSummary.Platform( - variant: platform.variant, - created: ImageSummary.unknownCreationDate, - os: platform.os, - architecture: platform.architecture, - size: description.descriptor.size - ) + return ImageResource.unknownCreationDate } private static func date(from string: String) -> Date? { @@ -856,18 +898,28 @@ public final class ImageManager { return formatter.date(from: string) } - private static let infraImages = [ - DefaultsStore.get(key: .defaultBuilderImage), - DefaultsStore.get(key: .defaultInitImage), + /// The repositories of the images the system runs itself, whatever their version, such as + /// `ghcr.io/apple/containerization/vminit`. + private nonisolated static let infraRepositories: Set = [ + repository(of: DefaultsStore.get(key: .defaultBuilderImage)), + repository(of: DefaultsStore.get(key: .defaultInitImage)), ] - private static func isInfraImage(name: String) -> Bool { - for infraImage in infraImages { - if name == infraImage { - return true - } + nonisolated static func isInfraImage(name: String) -> Bool { + infraRepositories.contains(repository(of: name)) + } + + /// The reference without its tag or digest: `ghcr.io/apple/containerization/vminit:0.28.0` + /// becomes `ghcr.io/apple/containerization/vminit`. + private nonisolated static func repository(of reference: String) -> String { + let name = reference.split(separator: "@", maxSplits: 1).first.map(String.init) ?? reference + + // A colon after the last slash starts the tag; one before it ends a registry's host. + guard let colon = name.lastIndex(of: ":"), !name[colon...].contains("/") else { + return name } - return false + + return String(name[.. [NetworkResource] { + try await containerSystem.networkService.list().map(NetworkResource.init) + } + + /// Creates a network. + /// + /// - Parameters: + /// - name: The network's name, which must be unique and use only valid characters. + /// - mode: Whether containers on it reach outside networks. + /// - subnet: The IPv4 subnet in CIDR form, such as `192.168.100.0/24`, which ``NetworkConfiguration/ipv4Subnet(parsing:)`` + /// accepts, or `nil` for one vmnet picks. + /// - Throws: An error if the name or subnet isn't valid or is taken. + public func createNetwork(name: String, mode: NetworkMode = .nat, subnet: String? = nil) async throws { + let configuration = try NetworkConfiguration(name: name, mode: mode, ipv4Subnet: try subnet.map { try NetworkConfiguration.ipv4Subnet(parsing: $0) }) + + try await containerSystem.networkService.create(configuration) + logger.info("Created network: \(name)") + } + + /// Deletes a network no container uses. + /// + /// - Parameter name: The network to delete. + /// - Throws: An error for the built-in network or one a container uses. + public func deleteNetwork(named name: String) async throws { + let networks = try containerSystem.networkService + + // No container can be created between the check and the delete. + try await containerSystem.containerService.withContainerList { configurations in + let containerIDs = configurations.filter { $0.networks.contains { $0.network == name } }.map(\.id) + + try await networks.delete(named: name, inUseBy: containerIDs) + } + logger.info("Deleted network: \(name)") + } + // MARK: - Public API /// Returns the DNS domains that resolver files in a folder configure for containers, sorted by name. @@ -42,7 +103,7 @@ public final class NetworkManager { /// /// - Parameter directory: The folder to read, usually ``resolverDirectory``. /// - Returns: The domains, or an empty array if the folder can't be read. - public func listDomains(in directory: URL) -> [String] { + public func domains(in directory: URL) -> [String] { let fileManager = FileManager.default let isScoped = directory.startAccessingSecurityScopedResource() diff --git a/ContainerSystem/Managers/ReportManager.swift b/ContainersCore/Managers/ReportManager.swift similarity index 89% rename from ContainerSystem/Managers/ReportManager.swift rename to ContainersCore/Managers/ReportManager.swift index 226c8dd..831773c 100644 --- a/ContainerSystem/Managers/ReportManager.swift +++ b/ContainersCore/Managers/ReportManager.swift @@ -16,25 +16,25 @@ import Observation @Observable @MainActor public final class ReportManager { - let runtime: ContainerRuntime + let containerSystem: ContainerSystem private let logger: Logger /// The reports, most recent first. public var reports: [Report] { - runtime.reports + containerSystem.reports } /// Creates a manager for the shared container system. public init() { - self.runtime = ContainerRuntime.shared + self.containerSystem = ContainerSystem.shared self.logger = Logger(label: "app.containers.manager.report") } #if DEBUG - /// Creates a manager for the given runtime, so tests can use a runtime of their own. - init(testRuntime: ContainerRuntime) { - self.runtime = testRuntime + /// Creates a manager over the given container system, so tests can use one of their own. + init(testSystem: ContainerSystem) { + self.containerSystem = testSystem self.logger = Logger(label: "app.containers.manager.report.test") } #endif @@ -62,7 +62,7 @@ public final class ReportManager { startedAt: Date? = nil ) async -> Report? { do { - return try await runtime.getReportsService() + return try await containerSystem.reportService .record( level: level, kind: kind, @@ -86,7 +86,7 @@ public final class ReportManager { /// Marks reports as read. /// /// - Parameter ids: The IDs of the reports to mark. - public func markRead(_ ids: [String]) async { + public func markRead(ids: [String]) async { let ids = Set(ids) let unread = reports.filter { !$0.isRead && ids.contains($0.id) }.map(\.id) @@ -98,8 +98,7 @@ public final class ReportManager { /// Reloads the reports from the storage folder. public func refresh() async { guard let service = service() else { return } - - runtime.reports = await service.list() + containerSystem.reports = await service.list() } /// Returns the most recent report about something. @@ -126,7 +125,7 @@ public final class ReportManager { /// /// - Parameter id: The report's ID. /// - Returns: `true` if the report has been read or doesn't exist. - public func isRead(_ id: String) -> Bool { + public func isRead(id: String) -> Bool { reports.first { $0.id == id }?.isRead ?? true } @@ -134,9 +133,8 @@ public final class ReportManager { /// /// - Parameter id: The report's ID. /// - Returns: The report, or `nil` if it doesn't exist. - public func get(id: String) async -> Report? { + public func report(withID id: String) async -> Report? { guard let service = service() else { return nil } - return await service.get(id: id) } @@ -171,9 +169,9 @@ public final class ReportManager { service()?.url(for: id) } - private func service() -> ReportsService? { + private func service() -> ReportService? { do { - return try runtime.getReportsService() + return try containerSystem.reportService } catch { logger.error("Couldn’t reach the reports: \(error)") diff --git a/ContainersCore/Managers/VolumeManager.swift b/ContainersCore/Managers/VolumeManager.swift new file mode 100644 index 0000000..3269c70 --- /dev/null +++ b/ContainersCore/Managers/VolumeManager.swift @@ -0,0 +1,159 @@ +// +// VolumeManager.swift +// Containers +// +// Manager for volume operations +// +// Created by Axel Martinez on 2026/02/04. +// + +import ContainerizationError +import Foundation +import Logging +import Observation + +/// A manager that creates, lists and deletes volumes. +/// +/// Each volume is an ext4 disk image in the container system's storage folder. +@Observable +@MainActor +public final class VolumeManager { + + let containerSystem: ContainerSystem + + private let logger: Logger + + /// Creates a manager for the shared container system. + public init() { + self.containerSystem = ContainerSystem.shared + + var logger = Logger(label: "app.containers.manager.volume") + logger.logLevel = .info + + self.logger = logger + } + + #if DEBUG + /// Creates a manager over the given container system, so tests can use one of their own. + init(testSystem: ContainerSystem) { + self.containerSystem = testSystem + + var logger = Logger(label: "app.containers.manager.volumes.test") + logger.logLevel = .debug + + self.logger = logger + } + #endif + + // MARK: - Public API + + /// Creates a volume. + /// + /// - Parameters: + /// - name: The volume's name, which must be unique and use only valid characters. + /// - labels: Labels to add to the volume. + /// - options: Driver options for the volume. + /// - sizeInBytes: The volume's size, or `nil` for the default size. + /// - Returns: The new volume. + /// - Throws: An error if the name isn't valid, a volume with that name exists, or the + /// volume can't be created. + @discardableResult + public func create( + name: String, + labels: [KeyValue], + options: [KeyValue], + sizeInBytes: UInt64? + ) async throws -> VolumeResource { + let configuration = try await containerSystem.volumeService.create( + name: name, + labels: labels.reduce(into: [:]) { $0[$1.key] = $1.value }, + options: options.reduce(into: [:]) { $0[$1.key] = $1.value }, + sizeInBytes: sizeInBytes + ) + + logger.info("Created volume: \(name)") + + return VolumeResource(configuration: configuration) + } + + /// Returns every volume. + public func list() async throws -> [VolumeResource] { + try await containerSystem.volumeService.list().map(VolumeResource.init) + } + + /// Returns the names of the volumes a container mounts. + public func namesInUse() async throws -> Set { + let service = try containerSystem.containerService + + return Set(await service.list().flatMap(\.volumeNames)) + } + + /// Deletes volumes, along with their data and any reports about them. + /// + /// A volume that a container uses isn't deleted. + /// + /// - Parameter volumes: The volumes to delete. + /// - Throws: An error that lists each volume that couldn't be deleted. + public func delete(volumes: [VolumeResource]) async throws { + let volumeService = try containerSystem.volumeService + let containerService = try containerSystem.containerService + + var failed: [(String, Error)] = [] + var deleted: [String] = [] + + for volume in volumes { + let name = volume.name + + do { + // No container can be created between the check and the delete. + try await containerService.withContainerList { configurations in + let containerIDs = configurations.filter { $0.mounts.contains { $0.isVolume && $0.volumeName == name } }.map(\.id) + + try await volumeService.delete(named: name, inUseBy: containerIDs) + } + + deleted.append(name) + logger.info("Deleted volume: \(name)") + } catch { + logger.error("Failed to delete volume \(name): \(error)") + failed.append((name, error)) + } + } + + try await containerSystem.reportService.delete(named: deleted, ofKind: [.volume]) + + if !failed.isEmpty { + throw ContainerizationError( + .internalError, + message: + "Failed to delete one or more volumes: \n\(failed.map({"\($0.0): \($0.1)"}).joined(separator: "\n"))" + ) + } + } + +} + +extension VolumeManager { + /// Returns the volume with a name, creating it if it doesn't exist yet. + /// + /// - Parameters: + /// - name: The volume's name. An empty name creates a new anonymous volume. + /// - existing: The volumes that exist, to look the name up in. + /// - Returns: The existing or new volume. + /// - Throws: An error if the volume can't be created. + public func volume(named name: String, among existing: [VolumeResource]) async throws -> VolumeResource { + if !name.isEmpty, let match = existing.first(where: { $0.name == name }) { + return match + } + + var volumeName = name + var labels: [KeyValue] = [] + + if volumeName.isEmpty { + volumeName = VolumeStorage.generateAnonymousVolumeName() + labels.append(.init(key: VolumeConfiguration.anonymousLabel)) + } + + return try await create(name: volumeName, labels: labels, options: [], sizeInBytes: nil) + } +} diff --git a/ContainerSystem/Network/Attachment.swift b/ContainersCore/Network/Attachment.swift similarity index 51% rename from ContainerSystem/Network/Attachment.swift rename to ContainersCore/Network/Attachment.swift index 7faa92e..de88837 100644 --- a/ContainerSystem/Network/Attachment.swift +++ b/ContainersCore/Network/Attachment.swift @@ -51,8 +51,41 @@ public struct AttachmentConfiguration: Sendable, Codable { /// Options for a network attachment. public struct AttachmentOptions: Sendable, Codable { public let hostname: String + public let macAddress: MACAddress? + public let mtu: UInt32? + public let aliases: [String] - public init(hostname: String = "") { + public init(hostname: String = "", macAddress: MACAddress? = nil, mtu: UInt32? = nil, aliases: [String] = []) { self.hostname = hostname + self.macAddress = macAddress + self.mtu = mtu + self.aliases = aliases + } + + private enum CodingKeys: String, CodingKey { + case hostname + case macAddress + case mtu + case aliases + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + self.hostname = try container.decode(String.self, forKey: .hostname) + self.macAddress = try container.decodeIfPresent(MACAddress.self, forKey: .macAddress) + self.mtu = try container.decodeIfPresent(UInt32.self, forKey: .mtu) + self.aliases = try container.decodeIfPresent([String].self, forKey: .aliases) ?? [] + } + + // Without the key when there are no aliases. + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + try container.encode(hostname, forKey: .hostname) + try container.encodeIfPresent(macAddress, forKey: .macAddress) + try container.encodeIfPresent(mtu, forKey: .mtu) + + if !aliases.isEmpty { + try container.encode(aliases, forKey: .aliases) + } } } diff --git a/ContainersCore/Network/DNSServer/AliasPolicy.swift b/ContainersCore/Network/DNSServer/AliasPolicy.swift new file mode 100644 index 0000000..6cde75d --- /dev/null +++ b/ContainersCore/Network/DNSServer/AliasPolicy.swift @@ -0,0 +1,114 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied unchanged from apple/container (Sources/DNSServer). +// swift-format-ignore-file + +/// The rules that the aliases of one network attachment must follow. +/// +/// The API server checks these rules when a container is created, again when a stored container is +/// started, and the network helper checks them again when it registers the aliases. Each of those +/// reads the aliases from somewhere that can be wrong or malicious, so none of them takes the aliases +/// on faith. Rules that involve other containers, such as a name that is already taken, are not here. +public enum AliasPolicy { + /// The most aliases that a single attachment may declare. + public static let maximumAliasesPerAttachment = 32 + + /// The fewest labels that an exact alias, or the base of a subtree alias, may have. + /// + /// A name with one label is not under any domain, so the system resolver never sends queries for + /// it to the container DNS server, and an alias like that would never resolve. For a subtree it + /// also keeps an alias from capturing a whole top-level domain. + public static let minimumLabels = 2 + + /// A rule that an alias breaks. The description says which alias and why. + public struct Violation: Error, CustomStringConvertible, Equatable { + public let description: String + + init(_ description: String) { + self.description = description + } + } + + /// Parses the aliases of one attachment and checks that they follow the rules. + /// + /// - There are at most `maximumAliasesPerAttachment` of them, and each one is a valid rule. + /// - No alias is listed twice, and an exact alias is not the hostname of the attachment. + /// - An exact alias has at least `minimumLabels` labels. + /// - A subtree alias has a base with at least `minimumLabels` labels, and the base is the hostname + /// of the attachment or one of its exact aliases, so an attachment cannot claim the names below + /// a name that it does not own. + /// + /// - Parameters: + /// - aliases: The aliases in their string form. + /// - hostname: The hostname of the attachment, or nil if it is not a valid DNS name. + /// - network: The name of the network, which is used in error descriptions. + /// - Returns: The aliases as rules, in the order they were given. + /// - Throws: `Violation` for the first rule that is broken. + public static func validate(aliases: [String], hostname: DNSName?, network: String) throws -> [DNSMatchRule] { + guard aliases.count <= Self.maximumAliasesPerAttachment else { + throw Violation("network \(network) has \(aliases.count) aliases, but at most \(Self.maximumAliasesPerAttachment) are allowed") + } + + var rules = [(alias: String, rule: DNSMatchRule)]() + for alias in aliases { + do { + rules.append((alias, try DNSMatchRule(alias))) + } catch { + throw Violation("invalid alias \"\(alias)\" for network \(network): \(error)") + } + } + + // The names this attachment owns, which are the roots a subtree alias may use. + var owned = Set() + if let hostname { + owned.insert(hostname) + } + for case (_, .exact(let name)) in rules { + owned.insert(name) + } + + var seen = Set() + for (alias, rule) in rules { + guard seen.insert(rule).inserted else { + throw Violation("alias \"\(alias)\" is listed more than once for network \(network)") + } + switch rule { + case .exact(let name): + guard name.labels.count >= Self.minimumLabels else { + throw Violation( + "alias \"\(alias)\" must be a fully qualified name with at least \(Self.minimumLabels) labels, such as \"api.example.test\". Configure a default DNS domain to have the domain added to a name that has none" + ) + } + guard name != hostname else { + throw Violation("alias \"\(alias)\" is already a hostname of the container") + } + case .subtree(let base): + guard base.labels.count >= Self.minimumLabels else { + throw Violation( + "alias \"\(alias)\" must have at least \(Self.minimumLabels) labels after the leading dot. Configure a default DNS domain to have the domain added to a name that has none" + ) + } + guard owned.contains(base) else { + throw Violation( + "alias \"\(alias)\" must be below the hostname or an exact alias of network \(network), but \"\(base.pqdn)\" is neither" + ) + } + } + } + return rules.map { $0.rule } + } +} diff --git a/ContainersCore/Network/DNSServer/DNSHandler.swift b/ContainersCore/Network/DNSServer/DNSHandler.swift new file mode 100644 index 0000000..642ff91 --- /dev/null +++ b/ContainersCore/Network/DNSServer/DNSHandler.swift @@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2025-2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied unchanged from apple/container (Sources/DNSServer). +// swift-format-ignore-file + +/// Protocol for implementing custom DNS handlers. +public protocol DNSHandler { + /// Attempt to answer a DNS query + /// - Parameter query: the query message + /// - Throws: a server failure occurred during the query + /// - Returns: The response message for the query, or nil if the request + /// is not within the scope of the handler. + func answer(query: Message) async throws -> Message? +} diff --git a/ContainersCore/Network/DNSServer/DNSMatchRule.swift b/ContainersCore/Network/DNSServer/DNSMatchRule.swift new file mode 100644 index 0000000..2e6e0c4 --- /dev/null +++ b/ContainersCore/Network/DNSServer/DNSMatchRule.swift @@ -0,0 +1,81 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied unchanged from apple/container (Sources/DNSServer). +// swift-format-ignore-file + +/// A rule that matches DNS names, as written in an alias. +/// +/// The string form is the name itself for an exact rule (`api.example.test`) and the name with a +/// leading dot for a subtree rule (`.example.test`). A subtree rule matches every name below its +/// base, at one or more labels, and does not match the base itself, which follows the wildcard +/// semantics of RFC 4592. Matching is by label, so `evilexample.test` is not below `example.test`. +public enum DNSMatchRule: Sendable, Hashable, CustomStringConvertible { + /// Matches exactly one name. + case exact(DNSName) + /// Matches every name below the base name. + case subtree(DNSName) + + /// Creates a rule from its string form. + /// + /// The name is validated and lowercased by `DNSName`, and a trailing dot is accepted. + /// + /// - Throws: `DNSBindError.invalidName` if the name is empty or is only a dot, contains `*`, + /// or is not a valid DNS name. + public init(_ string: String) throws { + guard !string.contains("*") else { + throw DNSBindError.invalidName( + "\"\(string)\" contains \"*\"; use a leading dot to match every name below a domain, for example \".example.test\"" + ) + } + + let isSubtree = string.hasPrefix(".") + let name = try DNSName(isSubtree ? String(string.dropFirst()) : string) + guard !name.labels.isEmpty else { + throw DNSBindError.invalidName("\"\(string)\" does not name a host") + } + self = isSubtree ? .subtree(name) : .exact(name) + } + + /// The normalized string form: lowercase, without a trailing dot, and with a leading dot for a subtree. + public var description: String { + switch self { + case .exact(let name): + return name.pqdn + case .subtree(let base): + return "." + base.pqdn + } + } + + /// Returns whether the rule matches the name. + public func matches(_ name: DNSName) -> Bool { + switch self { + case .exact(let exact): + return name == exact + case .subtree(let base): + return name.labels.count > base.labels.count && name.labels.suffix(base.labels.count) == base.labels + } + } + + /// Returns the names a subtree rule would need as its base to match `name`. + /// + /// These are the proper suffixes of `name` that have at least one label, longest first. For + /// `a.b.example.test` they are `b.example.test`, `example.test` and `test`. A lookup that + /// wants the most specific subtree tries them in order. + public static func subtreeBases(of name: DNSName) -> [DNSName] { + (1..>, + packet: inout AddressedEnvelope + ) async throws { + // RFC 1035 §2.3.4 limits UDP DNS messages to 512 bytes. We don't implement + // EDNS0 (RFC 6891), and this server only resolves host A/AAAA queries, so a + // legitimate query will never approach this limit. Reject oversized packets + // before reading to avoid allocating memory for malformed or malicious datagrams. + let maxPacketSize = 512 + guard packet.data.readableBytes <= maxPacketSize else { + self.log?.error("dropping oversized DNS packet: \(packet.data.readableBytes) bytes") + return + } + + var data = Data() + self.log?.debug("reading data") + while packet.data.readableBytes > 0 { + if let chunk = packet.data.readBytes(length: packet.data.readableBytes) { + data.append(contentsOf: chunk) + } + } + + self.log?.debug("deserializing message") + + // always send response + let responseData: Data + do { + let query = try Message(deserialize: data) + self.log?.debug("processing query: \(query.questions)") + + self.log?.debug("awaiting processing") + var response = + try await handler.answer(query: query) + ?? Message( + id: query.id, + type: .response, + returnCode: .notImplemented, + questions: query.questions, + answers: [] + ) + + // Only set NXDOMAIN if handler didn't explicitly set noError (NODATA response). + // This preserves NODATA responses for AAAA queries when A record exists, + // which prevents musl libc from treating empty AAAA as "domain doesn't exist". + if response.answers.isEmpty && response.returnCode != .noError { + response.returnCode = .nonExistentDomain + } + + self.log?.debug("serializing response") + responseData = try response.serialize() + } catch let error as DNSBindError { + // Best-effort: echo the transaction ID from the first two bytes of the raw packet. + let rawId = data.count >= 2 ? data[0..<2].withUnsafeBytes { $0.load(as: UInt16.self) } : 0 + let id = UInt16(bigEndian: rawId) + let returnCode: ReturnCode + switch error { + case .unsupportedValue: + self.log?.error("not implemented processing DNS message: \(error)") + returnCode = .notImplemented + default: + self.log?.error("format error processing DNS message: \(error)") + returnCode = .formatError + } + let response = Message( + id: id, + type: .response, + returnCode: returnCode, + questions: [], + answers: [] + ) + responseData = try response.serialize() + } catch { + let rawId = data.count >= 2 ? data[0..<2].withUnsafeBytes { $0.load(as: UInt16.self) } : 0 + let id = UInt16(bigEndian: rawId) + self.log?.error("error processing DNS message: \(error)") + let response = Message( + id: id, + type: .response, + returnCode: .serverFailure, + questions: [], + answers: [] + ) + responseData = try response.serialize() + } + + self.log?.debug("sending response") + let rData = ByteBuffer(bytes: responseData) + do { + try await outbound.write(AddressedEnvelope(remoteAddress: packet.remoteAddress, data: rData)) + } catch { + self.log?.error("failed to send DNS response: \(error)") + } + + self.log?.debug("processing done") + + } +} diff --git a/ContainersCore/Network/DNSServer/DNSServer.swift b/ContainersCore/Network/DNSServer/DNSServer.swift new file mode 100644 index 0000000..0425153 --- /dev/null +++ b/ContainersCore/Network/DNSServer/DNSServer.swift @@ -0,0 +1,89 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2025-2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied unchanged from apple/container (Sources/DNSServer). +// swift-format-ignore-file + +import Foundation +import Logging +import NIOCore +import NIOPosix + +/// Provides a DNS server. +/// - Parameters: +/// - host: The host address on which to listen. +/// - port: The port for the server to listen. +public struct DNSServer { + public var handler: DNSHandler + let log: Logger? + + public init( + handler: DNSHandler, + log: Logger? = nil + ) { + self.handler = handler + self.log = log + } + + public func run(host: String, port: Int) async throws { + // TODO: TCP server + let srv = try await DatagramBootstrap(group: NIOSingletons.posixEventLoopGroup) + .channelOption(.socketOption(.so_reuseaddr), value: 1) + .bind(host: host, port: port) + .flatMapThrowing { channel in + try NIOAsyncChannel( + wrappingChannelSynchronously: channel, + configuration: NIOAsyncChannel.Configuration( + inboundType: AddressedEnvelope.self, + outboundType: AddressedEnvelope.self + ) + ) + } + .get() + + try await srv.executeThenClose { inbound, outbound in + for try await var packet in inbound { + try await self.handle(outbound: outbound, packet: &packet) + } + } + } + + public func run(socketPath: String) async throws { + // TODO: TCP server + let srv = try await DatagramBootstrap(group: NIOSingletons.posixEventLoopGroup) + .bind(unixDomainSocketPath: socketPath, cleanupExistingSocketFile: true) + .flatMapThrowing { channel in + try NIOAsyncChannel( + wrappingChannelSynchronously: channel, + configuration: NIOAsyncChannel.Configuration( + inboundType: AddressedEnvelope.self, + outboundType: AddressedEnvelope.self + ) + ) + } + .get() + + try await srv.executeThenClose { inbound, outbound in + for try await var packet in inbound { + log?.debug("received packet from \(packet.remoteAddress)") + try await self.handle(outbound: outbound, packet: &packet) + log?.debug("sent packet") + } + } + } + + public func stop() async throws {} +} diff --git a/ContainersCore/Network/DNSServer/Handlers/CompositeResolver.swift b/ContainersCore/Network/DNSServer/Handlers/CompositeResolver.swift new file mode 100644 index 0000000..0727b3f --- /dev/null +++ b/ContainersCore/Network/DNSServer/Handlers/CompositeResolver.swift @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2025-2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied unchanged from apple/container (Sources/DNSServer). +// swift-format-ignore-file + +/// Delegates a query sequentially to handlers until one provides a response. +public struct CompositeResolver: DNSHandler { + private let handlers: [DNSHandler] + + public init(handlers: [DNSHandler]) { + self.handlers = handlers + } + + public func answer(query: Message) async throws -> Message? { + for handler in self.handlers { + if let response = try await handler.answer(query: query) { + return response + } + } + + return nil + } +} diff --git a/ContainersCore/Network/DNSServer/Handlers/HostTableResolver.swift b/ContainersCore/Network/DNSServer/Handlers/HostTableResolver.swift new file mode 100644 index 0000000..6dd9d05 --- /dev/null +++ b/ContainersCore/Network/DNSServer/Handlers/HostTableResolver.swift @@ -0,0 +1,98 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2025-2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied unchanged from apple/container (Sources/DNSServer). +// swift-format-ignore-file + +import ContainerizationExtras + +/// Handler that uses table lookup to resolve hostnames. +/// +/// Keys in `hosts4` are normalized to `DNSName` on construction, so lookups +/// are case-insensitive and trailing dots are optional. +public struct HostTableResolver: DNSHandler { + public let hosts4: [DNSName: IPv4Address] + private let ttl: UInt32 + + /// Creates a resolver backed by a static IPv4 host table. + /// + /// - Parameter hosts4: A dictionary mapping domain names to IPv4 addresses. + /// Keys are normalized to `DNSName` (lowercased, trailing dot stripped), so + /// `"FOO."`, `"foo."`, and `"foo"` all refer to the same entry. + /// - Parameter ttl: The TTL in seconds to set on answer records (default is 300). + /// - Throws: `DNSBindError.invalidName` if any key is not a valid DNS name. + public init(hosts4: [String: IPv4Address], ttl: UInt32 = 300) throws { + self.hosts4 = try Dictionary(uniqueKeysWithValues: hosts4.map { (try DNSName($0.key), $0.value) }) + self.ttl = ttl + } + + public func answer(query: Message) async throws -> Message? { + guard let question = query.questions.first else { + return nil + } + let n = question.name.hasSuffix(".") ? String(question.name.dropLast()) : question.name + let key = try DNSName(labels: n.isEmpty ? [] : n.split(separator: ".", omittingEmptySubsequences: false).map(String.init)) + let record: ResourceRecord? + switch question.type { + case ResourceRecordType.host: + record = answerHost(question: question, key: key) + case ResourceRecordType.host6: + // Return NODATA (noError with empty answers) for AAAA queries ONLY if A record exists. + // This is required because musl libc has issues when A record exists but AAAA returns NXDOMAIN. + // musl treats NXDOMAIN on AAAA as "domain doesn't exist" and fails DNS resolution entirely. + // NODATA correctly indicates "no IPv6 address available, but domain exists". + if hosts4[key] != nil { + return Message( + id: query.id, + type: .response, + returnCode: .noError, + questions: query.questions, + answers: [] + ) + } + // If hostname doesn't exist, return nil which will become NXDOMAIN + return nil + default: + return Message( + id: query.id, + type: .response, + returnCode: .notImplemented, + questions: query.questions, + answers: [] + ) + } + + guard let record else { + return nil + } + + return Message( + id: query.id, + type: .response, + returnCode: .noError, + questions: query.questions, + answers: [record] + ) + } + + private func answerHost(question: Question, key: DNSName) -> ResourceRecord? { + guard let ip = hosts4[key] else { + return nil + } + + return HostRecord(name: question.name, ttl: ttl, ip: ip) + } +} diff --git a/ContainersCore/Network/DNSServer/Handlers/NxDomainResolver.swift b/ContainersCore/Network/DNSServer/Handlers/NxDomainResolver.swift new file mode 100644 index 0000000..876593d --- /dev/null +++ b/ContainersCore/Network/DNSServer/Handlers/NxDomainResolver.swift @@ -0,0 +1,49 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2025-2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied unchanged from apple/container (Sources/DNSServer). +// swift-format-ignore-file + +/// Handler that returns NXDOMAIN for all hostnames. +public struct NxDomainResolver: DNSHandler { + private let ttl: UInt32 + + public init(ttl: UInt32 = 300) { + self.ttl = ttl + } + + public func answer(query: Message) async throws -> Message? { + let question = query.questions[0] + switch question.type { + case ResourceRecordType.host: + return Message( + id: query.id, + type: .response, + returnCode: .nonExistentDomain, + questions: query.questions, + answers: [] + ) + default: + return Message( + id: query.id, + type: .response, + returnCode: .notImplemented, + questions: query.questions, + answers: [] + ) + } + } +} diff --git a/ContainersCore/Network/DNSServer/Handlers/StandardQueryValidator.swift b/ContainersCore/Network/DNSServer/Handlers/StandardQueryValidator.swift new file mode 100644 index 0000000..cb6b386 --- /dev/null +++ b/ContainersCore/Network/DNSServer/Handlers/StandardQueryValidator.swift @@ -0,0 +1,67 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2025-2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied unchanged from apple/container (Sources/DNSServer). +// swift-format-ignore-file + +/// Pass standard queries to a delegate handler. +public struct StandardQueryValidator: DNSHandler { + private let handler: DNSHandler + + /// Create the handler. + /// - Parameter delegate: the handler that receives valid queries + public init(handler: DNSHandler) { + self.handler = handler + } + + /// Ensures the query is valid before forwarding it to the delegate. + /// - Parameter msg: the query message + /// - Returns: the delegate response if the query is valid, and an + /// error response otherwise + public func answer(query: Message) async throws -> Message? { + // Reject response messages. + guard query.type == .query else { + return Message( + id: query.id, + type: .response, + returnCode: .formatError, + questions: query.questions + ) + } + + // Standard DNS servers handle only query operations. + guard query.operationCode == .query else { + return Message( + id: query.id, + type: .response, + returnCode: .notImplemented, + questions: query.questions + ) + } + + // Standard DNS servers only handle messages with exactly one question. + guard query.questions.count == 1 else { + return Message( + id: query.id, + type: .response, + returnCode: .formatError, + questions: query.questions + ) + } + + return try await handler.answer(query: query) + } +} diff --git a/ContainersCore/Network/DNSServer/Records/DNSBindError.swift b/ContainersCore/Network/DNSServer/Records/DNSBindError.swift new file mode 100644 index 0000000..57ddb72 --- /dev/null +++ b/ContainersCore/Network/DNSServer/Records/DNSBindError.swift @@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied unchanged from apple/container (Sources/DNSServer). +// swift-format-ignore-file + +/// Errors that can occur during DNS message serialization/deserialization. +public enum DNSBindError: Error, CustomStringConvertible { + case marshalFailure(type: String, field: String) + case unmarshalFailure(type: String, field: String) + case unsupportedValue(type: String, field: String) + case invalidName(String) + case unexpectedOffset(type: String, expected: Int, actual: Int) + + public var description: String { + switch self { + case .marshalFailure(let type, let field): + return "failed to marshal \(type).\(field)" + case .unmarshalFailure(let type, let field): + return "failed to unmarshal \(type).\(field)" + case .unsupportedValue(let type, let field): + return "unsupported value for \(type).\(field)" + case .invalidName(let reason): + return "invalid DNS name: \(reason)" + case .unexpectedOffset(let type, let expected, let actual): + return "unexpected offset serializing \(type): expected \(expected), got \(actual)" + } + } +} diff --git a/ContainersCore/Network/DNSServer/Records/DNSEnums.swift b/ContainersCore/Network/DNSServer/Records/DNSEnums.swift new file mode 100644 index 0000000..5f200aa --- /dev/null +++ b/ContainersCore/Network/DNSServer/Records/DNSEnums.swift @@ -0,0 +1,170 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied unchanged from apple/container (Sources/DNSServer). +// swift-format-ignore-file + +/// DNS message type (query or response). +public enum MessageType: UInt16, Sendable { + case query = 0 + case response = 1 +} + +/// DNS operation code (RFC 1035, 1996, 2136). +public enum OperationCode: UInt8, Sendable { + case query = 0 // Standard query (RFC 1035) + case inverseQuery = 1 // Inverse query (obsolete, RFC 3425) + case status = 2 // Server status request (RFC 1035) + // 3 is reserved + case notify = 4 // Zone change notification (RFC 1996) + case update = 5 // Dynamic update (RFC 2136) + case dso = 6 // DNS Stateful Operations (RFC 8490) + // 7-15 reserved +} + +/// DNS response return codes (RFC 1035, 2136, 2845, 6895). +public enum ReturnCode: UInt8, Sendable { + case noError = 0 // No error + case formatError = 1 // Format error - unable to interpret query + case serverFailure = 2 // Server failure + case nonExistentDomain = 3 // Name error - domain does not exist (NXDOMAIN) + case notImplemented = 4 // Not implemented - query type not supported + case refused = 5 // Refused - policy restriction + case yxDomain = 6 // Name exists when it should not (RFC 2136) + case yxRRSet = 7 // RR set exists when it should not (RFC 2136) + case nxRRSet = 8 // RR set does not exist when it should (RFC 2136) + case notAuthoritative = 9 // Server not authoritative (RFC 2136) / Not authorized (RFC 2845) + case notZone = 10 // Name not in zone (RFC 2136) + case dsoTypeNotImplemented = 11 // DSO-TYPE not implemented (RFC 8490) + // 12-15 reserved + case badSignature = 16 // TSIG signature failure (RFC 2845) + case badKey = 17 // Key not recognized (RFC 2845) + case badTime = 18 // Signature out of time window (RFC 2845) + case badMode = 19 // Bad TKEY mode (RFC 2930) + case badName = 20 // Duplicate key name (RFC 2930) + case badAlgorithm = 21 // Algorithm not supported (RFC 2930) + case badTruncation = 22 // Bad truncation (RFC 4635) + case badCookie = 23 // Bad/missing server cookie (RFC 7873) +} + +/// DNS resource record types (RFC 1035, 3596, 2782, and others). +public enum ResourceRecordType: UInt16, Sendable { + case host = 1 // A - IPv4 address (RFC 1035) + case nameServer = 2 // NS - Authoritative name server (RFC 1035) + case mailDestination = 3 // MD - Mail destination (obsolete, RFC 1035) + case mailForwarder = 4 // MF - Mail forwarder (obsolete, RFC 1035) + case alias = 5 // CNAME - Canonical name (RFC 1035) + case startOfAuthority = 6 // SOA - Start of authority (RFC 1035) + case mailbox = 7 // MB - Mailbox domain name (experimental, RFC 1035) + case mailGroup = 8 // MG - Mail group member (experimental, RFC 1035) + case mailRename = 9 // MR - Mail rename domain name (experimental, RFC 1035) + case null = 10 // NULL - Null RR (experimental, RFC 1035) + case wellKnownService = 11 // WKS - Well known service (RFC 1035) + case pointer = 12 // PTR - Domain name pointer (RFC 1035) + case hostInfo = 13 // HINFO - Host information (RFC 1035) + case mailInfo = 14 // MINFO - Mailbox information (RFC 1035) + case mailExchange = 15 // MX - Mail exchange (RFC 1035) + case text = 16 // TXT - Text strings (RFC 1035) + case responsiblePerson = 17 // RP - Responsible person (RFC 1183) + case afsDatabase = 18 // AFSDB - AFS database location (RFC 1183) + case x25 = 19 // X25 - X.25 PSDN address (RFC 1183) + case isdn = 20 // ISDN - ISDN address (RFC 1183) + case routeThrough = 21 // RT - Route through (RFC 1183) + case nsapAddress = 22 // NSAP - NSAP address (RFC 1706) + case nsapPointer = 23 // NSAP-PTR - NSAP pointer (RFC 1706) + case signature = 24 // SIG - Security signature (RFC 2535) + case key = 25 // KEY - Security key (RFC 2535) + case pxRecord = 26 // PX - X.400 mail mapping (RFC 2163) + case gpos = 27 // GPOS - Geographical position (RFC 1712) + case host6 = 28 // AAAA - IPv6 address (RFC 3596) + case location = 29 // LOC - Location information (RFC 1876) + case nextDomain = 30 // NXT - Next domain (obsolete, RFC 2535) + case endpointId = 31 // EID - Endpoint identifier + case nimrodLocator = 32 // NIMLOC - Nimrod locator + case service = 33 // SRV - Service locator (RFC 2782) + case atma = 34 // ATMA - ATM address + case namingPointer = 35 // NAPTR - Naming authority pointer (RFC 3403) + case keyExchange = 36 // KX - Key exchange (RFC 2230) + case cert = 37 // CERT - Certificate (RFC 4398) + case a6Record = 38 // A6 - IPv6 address (obsolete, RFC 2874) + case dname = 39 // DNAME - Delegation name (RFC 6672) + case sink = 40 // SINK - Kitchen sink + case opt = 41 // OPT - EDNS option (RFC 6891) + case apl = 42 // APL - Address prefix list (RFC 3123) + case delegationSigner = 43 // DS - Delegation signer (RFC 4034) + case sshFingerprint = 44 // SSHFP - SSH key fingerprint (RFC 4255) + case ipsecKey = 45 // IPSECKEY - IPsec key (RFC 4025) + case resourceSignature = 46 // RRSIG - Resource record signature (RFC 4034) + case nsec = 47 // NSEC - Next secure record (RFC 4034) + case dnsKey = 48 // DNSKEY - DNS key (RFC 4034) + case dhcid = 49 // DHCID - DHCP identifier (RFC 4701) + case nsec3 = 50 // NSEC3 - NSEC3 (RFC 5155) + case nsec3Param = 51 // NSEC3PARAM - NSEC3 parameters (RFC 5155) + case tlsa = 52 // TLSA - TLSA certificate (RFC 6698) + case smimea = 53 // SMIMEA - S/MIME cert association (RFC 8162) + // 54 unassigned + case hip = 55 // HIP - Host identity protocol (RFC 8005) + case ninfo = 56 // NINFO + case rkey = 57 // RKEY + case taLink = 58 // TALINK - Trust anchor link + case cds = 59 // CDS - Child DS (RFC 7344) + case cdnsKey = 60 // CDNSKEY - Child DNSKEY (RFC 7344) + case openPGPKey = 61 // OPENPGPKEY - OpenPGP key (RFC 7929) + case csync = 62 // CSYNC - Child-to-parent sync (RFC 7477) + case zoneDigest = 63 // ZONEMD - Zone message digest (RFC 8976) + case svcBinding = 64 // SVCB - Service binding (RFC 9460) + case httpsBinding = 65 // HTTPS - HTTPS binding (RFC 9460) + // 66-98 unassigned + case spf = 99 // SPF - Sender policy framework (RFC 7208) + case uinfo = 100 // UINFO + case uid = 101 // UID + case gid = 102 // GID + case unspec = 103 // UNSPEC + case nid = 104 // NID - Node identifier (RFC 6742) + case l32 = 105 // L32 - Locator32 (RFC 6742) + case l64 = 106 // L64 - Locator64 (RFC 6742) + case lp = 107 // LP - Locator FQDN (RFC 6742) + case eui48 = 108 // EUI48 - 48-bit MAC (RFC 7043) + case eui64 = 109 // EUI64 - 64-bit MAC (RFC 7043) + // 110-248 unassigned + case tkey = 249 // TKEY - Transaction key (RFC 2930) + case tsig = 250 // TSIG - Transaction signature (RFC 2845) + case incrementalZoneTransfer = 251 // IXFR - Incremental zone transfer (RFC 1995) + case standardZoneTransfer = 252 // AXFR - Full zone transfer (RFC 1035) + case mailboxRecords = 253 // MAILB - Mailbox-related records (RFC 1035) + case mailAgentRecords = 254 // MAILA - Mail agent RRs (obsolete, RFC 1035) + case all = 255 // * - All records (RFC 1035) + case uri = 256 // URI - Uniform resource identifier (RFC 7553) + case caa = 257 // CAA - Certification authority authorization (RFC 8659) + case avc = 258 // AVC - Application visibility and control + case doa = 259 // DOA - Digital object architecture + case amtRelay = 260 // AMTRELAY - Automatic multicast tunneling relay (RFC 8777) + case resInfo = 261 // RESINFO - Resolver information + // ... + case ta = 32768 // TA - DNSSEC trust authorities + case dlv = 32769 // DLV - DNSSEC lookaside validation (RFC 4431) +} + +/// DNS resource record class (RFC 1035). +public enum ResourceRecordClass: UInt16, Sendable { + case internet = 1 // IN - Internet (RFC 1035) + // 2 unassigned + case chaos = 3 // CH - Chaos (RFC 1035) + case hesiod = 4 // HS - Hesiod (RFC 1035) + // 5-253 unassigned + case none = 254 // NONE - None (RFC 2136) + case any = 255 // * - Any class (RFC 1035) +} diff --git a/ContainersCore/Network/DNSServer/Records/DNSName.swift b/ContainersCore/Network/DNSServer/Records/DNSName.swift new file mode 100644 index 0000000..1889106 --- /dev/null +++ b/ContainersCore/Network/DNSServer/Records/DNSName.swift @@ -0,0 +1,212 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied unchanged from apple/container (Sources/DNSServer). +// swift-format-ignore-file + +import Foundation + +/// A DNS name encoded as a sequence of labels. +/// +/// DNS names are encoded as: `[length][label][length][label]...[0]` +/// For example, "example.com" becomes: `[7]example[3]com[0]` +public struct DNSName: Sendable, Hashable, CustomStringConvertible { + /// The labels that make up this name (e.g., ["example", "com"]). + public private(set) var labels: [String] + + /// Creates a DNS name representing the root (empty label list). + public init() { + self.labels = [] + } + + /// Creates a validated DNS name from an array of labels. + /// + /// Validates structural RFC 1035 constraints only: no empty labels, each label ≤ 63 + /// bytes, total wire length ≤ 255 bytes. Does not enforce hostname character rules. + /// Labels are lowercased to normalize for case-insensitive DNS comparison. + /// + /// - Throws: `DNSBindError.invalidName` if any label is empty, exceeds 63 bytes, + /// or if the total wire representation exceeds 255 bytes. + public init(labels: [String]) throws { + for label in labels { + guard !label.isEmpty else { + throw DNSBindError.invalidName("empty label") + } + guard label.utf8.count <= 63 else { + throw DNSBindError.invalidName("label too long: \"\(label)\"") + } + } + let wireLength = labels.reduce(1) { $0 + 1 + $1.utf8.count } + guard wireLength <= 255 else { + throw DNSBindError.invalidName("name too long") + } + self.labels = labels.map { $0.lowercased() } + } + + /// Creates a validated DNS name from a dot-separated hostname string + /// (e.g., `"example.com."` or `"example.com"`). + /// + /// A trailing dot is accepted but not required. + /// An empty string produces the root name without error. + /// + /// Labels must start and end with a letter or digit (LDH hostname rule). + /// Use `init(labels:)` directly when working with wire-decoded names that + /// may contain non-hostname labels (e.g. service-discovery labels like `"_dns"`). + /// + /// - Throws: `DNSBindError.invalidName` if any label violates the character rules, + /// or if structural limits are exceeded (see `init(labels:)`). + public init(_ hostname: String) throws { + let normalized = hostname.hasSuffix(".") ? String(hostname.dropLast()) : hostname + guard !normalized.isEmpty else { + self.init() + return + } + let parts = normalized.split(separator: ".", omittingEmptySubsequences: false).map { String($0) } + let hostnameRegex = /[a-zA-Z0-9](?:[a-zA-Z0-9\-_]*[a-zA-Z0-9])?/ + for part in parts { + guard part.wholeMatch(of: hostnameRegex) != nil else { + throw DNSBindError.invalidName( + "label must start and end with a letter or digit: \"\(part)\"" + ) + } + } + try self.init(labels: parts) + } + + /// The wire format size of this name in bytes. + public var size: Int { + // Each label: 1 byte length + label bytes, plus 1 byte for null terminator + labels.reduce(1) { $0 + 1 + $1.utf8.count } + } + + /// The fully-qualified domain name with trailing dot. + public var description: String { + labels.joined(separator: ".") + "." + } + + /// The partially-qualified domain name, which is the FQDN less the trailing dot. + public var pqdn: String { + labels.joined(separator: ".") + } + + /// Serialize this name into the buffer at the given offset. + public func appendBuffer(_ buffer: inout [UInt8], offset: Int) throws -> Int { + let startOffset = offset + var offset = offset + + for label in labels { + let bytes = Array(label.utf8) + guard bytes.count <= 63 else { + throw DNSBindError.marshalFailure(type: "DNSName", field: "label") + } + + guard let newOffset = buffer.copyIn(as: UInt8.self, value: UInt8(bytes.count), offset: offset) else { + throw DNSBindError.marshalFailure(type: "DNSName", field: "label") + } + offset = newOffset + + guard let newOffset = buffer.copyIn(buffer: bytes, offset: offset) else { + throw DNSBindError.marshalFailure(type: "DNSName", field: "label") + } + offset = newOffset + } + + // Null terminator + guard let newOffset = buffer.copyIn(as: UInt8.self, value: 0, offset: offset) else { + throw DNSBindError.marshalFailure(type: "DNSName", field: "terminator") + } + + guard newOffset == startOffset + size else { + throw DNSBindError.unexpectedOffset(type: "DNSName", expected: startOffset + size, actual: newOffset) + } + return newOffset + } + + /// Deserialize a name from the buffer at the given offset. + /// + /// - Parameters: + /// - buffer: The buffer to read from. + /// - offset: The offset to start reading. + /// - messageStart: The start of the DNS message (for compression pointer resolution). + /// - Returns: The new offset after reading. + public mutating func bindBuffer( + _ buffer: inout [UInt8], + offset: Int, + messageStart: Int = 0 + ) throws -> Int { + var offset = offset + var collectedLabels: [String] = [] + var jumped = false + var returnOffset = offset + var pointerHops = 0 + + while true { + guard offset < buffer.count else { + throw DNSBindError.unmarshalFailure(type: "DNSName", field: "name") + } + + let length = buffer[offset] + + // Check for compression pointer (top 2 bits set) + if (length & 0xC0) == 0xC0 { + guard offset + 1 < buffer.count else { + throw DNSBindError.unmarshalFailure(type: "DNSName", field: "pointer") + } + + pointerHops += 1 + guard pointerHops <= 10 else { + throw DNSBindError.unmarshalFailure(type: "DNSName", field: "pointer") + } + + if !jumped { + returnOffset = offset + 2 + } + + // Calculate pointer offset from message start + let pointer = Int(length & 0x3F) << 8 | Int(buffer[offset + 1]) + let pointerTarget = messageStart + pointer + guard pointerTarget >= 0 && pointerTarget < offset && pointerTarget < buffer.count else { + throw DNSBindError.unmarshalFailure(type: "DNSName", field: "pointer") + } + offset = pointerTarget + jumped = true + continue + } + + offset += 1 + + // Null terminator - end of name + if length == 0 { + break + } + + guard offset + Int(length) <= buffer.count else { + throw DNSBindError.unmarshalFailure(type: "DNSName", field: "label") + } + + let labelBytes = Array(buffer[offset..> 11) & 0x0F)) else { + throw DNSBindError.unsupportedValue(type: "Message", field: "opcode") + } + self.operationCode = opCode + self.authoritativeAnswer = (flags & 0x0400) != 0 + self.truncation = (flags & 0x0200) != 0 + self.recursionDesired = (flags & 0x0100) != 0 + self.recursionAvailable = (flags & 0x0080) != 0 + guard let returnCode = ReturnCode(rawValue: UInt8(flags & 0x000F)) else { + throw DNSBindError.unsupportedValue(type: "Message", field: "rcode") + } + self.returnCode = returnCode + + // Read counts + guard let (newOffset, rawQdCount) = buffer.copyOut(as: UInt16.self, offset: offset) else { + throw DNSBindError.unmarshalFailure(type: "Message", field: "qdcount") + } + let qdCount = UInt16(bigEndian: rawQdCount) + offset = newOffset + + guard let (newOffset, rawAnCount) = buffer.copyOut(as: UInt16.self, offset: offset) else { + throw DNSBindError.unmarshalFailure(type: "Message", field: "ancount") + } + let anCount = UInt16(bigEndian: rawAnCount) + offset = newOffset + + guard let (newOffset, rawNsCount) = buffer.copyOut(as: UInt16.self, offset: offset) else { + throw DNSBindError.unmarshalFailure(type: "Message", field: "nscount") + } + // nsCount not used for now, but we need to read past it + _ = UInt16(bigEndian: rawNsCount) + offset = newOffset + + guard let (newOffset, rawArCount) = buffer.copyOut(as: UInt16.self, offset: offset) else { + throw DNSBindError.unmarshalFailure(type: "Message", field: "arcount") + } + // arCount not used for now, but we need to read past it + _ = UInt16(bigEndian: rawArCount) + offset = newOffset + + // Read questions + self.questions = [] + for _ in 0.. Data { + // Calculate exact buffer size. + var bufferSize = Self.headerSize + for question in questions { + // name + type + class + let n = question.name.hasSuffix(".") ? String(question.name.dropLast()) : question.name + bufferSize += (try DNSName(labels: n.isEmpty ? [] : n.split(separator: ".", omittingEmptySubsequences: false).map(String.init))).size + 4 + } + for answer in answers { + // name + type + class + ttl + rdlen + rdata + let n = answer.name.hasSuffix(".") ? String(answer.name.dropLast()) : answer.name + let rdataSize = answer.type == .host ? 4 : 16 + bufferSize += (try DNSName(labels: n.isEmpty ? [] : n.split(separator: ".", omittingEmptySubsequences: false).map(String.init))).size + 10 + rdataSize + } + + var buffer = [UInt8](repeating: 0, count: bufferSize) + var offset = 0 + + // Write ID + guard let newOffset = buffer.copyIn(as: UInt16.self, value: id.bigEndian, offset: offset) else { + throw DNSBindError.marshalFailure(type: "Message", field: "id") + } + offset = newOffset + + // Build and write flags + var flags: UInt16 = 0 + flags |= type == .response ? 0x8000 : 0 + flags |= UInt16(operationCode.rawValue) << 11 + flags |= authoritativeAnswer ? 0x0400 : 0 + flags |= truncation ? 0x0200 : 0 + flags |= recursionDesired ? 0x0100 : 0 + flags |= recursionAvailable ? 0x0080 : 0 + flags |= UInt16(returnCode.rawValue) + + guard let newOffset = buffer.copyIn(as: UInt16.self, value: flags.bigEndian, offset: offset) else { + throw DNSBindError.marshalFailure(type: "Message", field: "flags") + } + offset = newOffset + + // Write counts + guard questions.count <= UInt16.max else { + throw DNSBindError.marshalFailure(type: "Message", field: "qdcount") + } + guard answers.count <= UInt16.max else { + throw DNSBindError.marshalFailure(type: "Message", field: "ancount") + } + guard authorities.count <= UInt16.max else { + throw DNSBindError.marshalFailure(type: "Message", field: "nscount") + } + guard additional.count <= UInt16.max else { + throw DNSBindError.marshalFailure(type: "Message", field: "arcount") + } + + guard let newOffset = buffer.copyIn(as: UInt16.self, value: UInt16(questions.count).bigEndian, offset: offset) else { + throw DNSBindError.marshalFailure(type: "Message", field: "qdcount") + } + offset = newOffset + + guard let newOffset = buffer.copyIn(as: UInt16.self, value: UInt16(answers.count).bigEndian, offset: offset) else { + throw DNSBindError.marshalFailure(type: "Message", field: "ancount") + } + offset = newOffset + + guard let newOffset = buffer.copyIn(as: UInt16.self, value: UInt16(authorities.count).bigEndian, offset: offset) else { + throw DNSBindError.marshalFailure(type: "Message", field: "nscount") + } + offset = newOffset + + guard let newOffset = buffer.copyIn(as: UInt16.self, value: UInt16(additional.count).bigEndian, offset: offset) else { + throw DNSBindError.marshalFailure(type: "Message", field: "arcount") + } + offset = newOffset + + // Write questions + for question in questions { + offset = try question.appendBuffer(&buffer, offset: offset) + } + + // Write answers + for answer in answers { + offset = try answer.appendBuffer(&buffer, offset: offset) + } + + // Write authorities + for authority in authorities { + offset = try authority.appendBuffer(&buffer, offset: offset) + } + + // Write additional + for record in additional { + offset = try record.appendBuffer(&buffer, offset: offset) + } + + guard offset == bufferSize else { + throw DNSBindError.unexpectedOffset(type: "Message", expected: bufferSize, actual: offset) + } + return Data(buffer[0.. Int { + let startOffset = offset + var offset = offset + + // Write name + let normalized = name.hasSuffix(".") ? String(name.dropLast()) : name + let dnsName = try DNSName(labels: normalized.isEmpty ? [] : normalized.split(separator: ".", omittingEmptySubsequences: false).map(String.init)) + offset = try dnsName.appendBuffer(&buffer, offset: offset) + + // Write type (big-endian) + guard let newOffset = buffer.copyIn(as: UInt16.self, value: type.rawValue.bigEndian, offset: offset) else { + throw DNSBindError.marshalFailure(type: "Question", field: "type") + } + offset = newOffset + + // Write class (big-endian) + guard let newOffset = buffer.copyIn(as: UInt16.self, value: recordClass.rawValue.bigEndian, offset: offset) else { + throw DNSBindError.marshalFailure(type: "Question", field: "class") + } + + let expectedOffset = startOffset + dnsName.size + 4 + guard newOffset == expectedOffset else { + throw DNSBindError.unexpectedOffset(type: "Question", expected: expectedOffset, actual: newOffset) + } + return newOffset + } + + /// Deserialize a question from the buffer. + public mutating func bindBuffer(_ buffer: inout [UInt8], offset: Int, messageStart: Int = 0) throws -> Int { + var offset = offset + + // Read name + var dnsName = DNSName() + offset = try dnsName.bindBuffer(&buffer, offset: offset, messageStart: messageStart) + self.name = dnsName.description + + // Read type (big-endian) + guard let (newOffset, rawType) = buffer.copyOut(as: UInt16.self, offset: offset) else { + throw DNSBindError.unmarshalFailure(type: "Question", field: "type") + } + guard let qtype = ResourceRecordType(rawValue: UInt16(bigEndian: rawType)) else { + throw DNSBindError.unsupportedValue(type: "Question", field: "type") + } + self.type = qtype + offset = newOffset + + // Read class (big-endian) + guard let (newOffset, rawClass) = buffer.copyOut(as: UInt16.self, offset: offset) else { + throw DNSBindError.unmarshalFailure(type: "Question", field: "class") + } + guard let qclass = ResourceRecordClass(rawValue: UInt16(bigEndian: rawClass)) else { + throw DNSBindError.unsupportedValue(type: "Question", field: "class") + } + self.recordClass = qclass + + return newOffset + } +} diff --git a/ContainersCore/Network/DNSServer/Records/ResourceRecord.swift b/ContainersCore/Network/DNSServer/Records/ResourceRecord.swift new file mode 100644 index 0000000..997bf1f --- /dev/null +++ b/ContainersCore/Network/DNSServer/Records/ResourceRecord.swift @@ -0,0 +1,106 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied unchanged from apple/container (Sources/DNSServer). +// swift-format-ignore-file + +import Foundation + +/// Protocol for DNS resource records. +public protocol ResourceRecord: Sendable { + /// The domain name this record applies to. + var name: String { get } + + /// The record type. + var type: ResourceRecordType { get } + + /// The record class. + var recordClass: ResourceRecordClass { get } + + /// Time to live in seconds. + var ttl: UInt32 { get } + + /// Serialize this record into the buffer. + func appendBuffer(_ buffer: inout [UInt8], offset: Int) throws -> Int +} + +/// A host record (A or AAAA) containing an IP address. +public struct HostRecord: ResourceRecord { + public let name: String + public let type: ResourceRecordType + public let recordClass: ResourceRecordClass + public let ttl: UInt32 + public let ip: T + + public init( + name: String, + ttl: UInt32 = 300, + ip: T, + recordClass: ResourceRecordClass = .internet + ) { + self.name = name + self.type = T.recordType + self.recordClass = recordClass + self.ttl = ttl + self.ip = ip + } + + public func appendBuffer(_ buffer: inout [UInt8], offset: Int) throws -> Int { + let startOffset = offset + var offset = offset + + // Write name + let normalized = name.hasSuffix(".") ? String(name.dropLast()) : name + let dnsName = try DNSName(labels: normalized.isEmpty ? [] : normalized.split(separator: ".", omittingEmptySubsequences: false).map(String.init)) + offset = try dnsName.appendBuffer(&buffer, offset: offset) + + // Write type (big-endian) + guard let newOffset = buffer.copyIn(as: UInt16.self, value: type.rawValue.bigEndian, offset: offset) else { + throw DNSBindError.marshalFailure(type: "HostRecord", field: "type") + } + offset = newOffset + + // Write class (big-endian) + guard let newOffset = buffer.copyIn(as: UInt16.self, value: recordClass.rawValue.bigEndian, offset: offset) else { + throw DNSBindError.marshalFailure(type: "HostRecord", field: "class") + } + offset = newOffset + + // Write TTL (big-endian) + guard let newOffset = buffer.copyIn(as: UInt32.self, value: ttl.bigEndian, offset: offset) else { + throw DNSBindError.marshalFailure(type: "HostRecord", field: "ttl") + } + offset = newOffset + + // Write rdlength (big-endian) + let rdlength = UInt16(T.size) + guard let newOffset = buffer.copyIn(as: UInt16.self, value: rdlength.bigEndian, offset: offset) else { + throw DNSBindError.marshalFailure(type: "HostRecord", field: "rdlength") + } + offset = newOffset + + // Write IP address bytes + guard let newOffset = buffer.copyIn(buffer: ip.bytes, offset: offset) else { + throw DNSBindError.marshalFailure(type: "HostRecord", field: "rdata") + } + + let expectedOffset = startOffset + dnsName.size + 10 + T.size + guard newOffset == expectedOffset else { + throw DNSBindError.unexpectedOffset(type: "HostRecord", expected: expectedOffset, actual: newOffset) + } + return newOffset + } +} diff --git a/ContainersCore/Network/DNSServer/Records/UInt8+Binding.swift b/ContainersCore/Network/DNSServer/Records/UInt8+Binding.swift new file mode 100644 index 0000000..9117cc8 --- /dev/null +++ b/ContainersCore/Network/DNSServer/Records/UInt8+Binding.swift @@ -0,0 +1,75 @@ +//===----------------------------------------------------------------------===// +// Copyright © 2026 Apple Inc. and the container project authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//===----------------------------------------------------------------------===// + +// Copied from apple/container (Sources/DNSServer), with its `package` declarations made internal. +// swift-format-ignore-file + +import Foundation + +// TODO: This copies some of the Bindable code from Containerization, +// but we can't use Bindable as it presumes a fixed length record. +// We can look at refining this later to see if we can use some common +// bit fiddling code everywhere. + +extension [UInt8] { + /// Copy a value into the buffer at the given offset. + /// - Returns: The new offset after writing, or nil if the buffer is too small. + mutating func copyIn(as type: T.Type, value: T, offset: Int = 0) -> Int? { + let size = MemoryLayout.size + guard self.count >= size + offset else { + return nil + } + return self.withUnsafeMutableBytes { + $0.baseAddress?.advanced(by: offset).assumingMemoryBound(to: T.self).pointee = value + return offset + size + } + } + + /// Copy a value out of the buffer at the given offset. + /// - Returns: A tuple of (new offset, value), or nil if the buffer is too small. + func copyOut(as type: T.Type, offset: Int = 0) -> (Int, T)? { + let size = MemoryLayout.size + guard self.count >= size + offset else { + return nil + } + return self.withUnsafeBytes { + guard let value = $0.baseAddress?.advanced(by: offset).assumingMemoryBound(to: T.self).pointee else { + return nil + } + return (offset + size, value) + } + } + + /// Copy a byte array into the buffer at the given offset. + /// - Returns: The new offset after writing, or nil if the buffer is too small. + mutating func copyIn(buffer: [UInt8], offset: Int = 0) -> Int? { + guard offset + buffer.count <= self.count else { + return nil + } + self[offset.. Int? { + guard offset + buffer.count <= self.count else { + return nil + } + buffer[0.. NetworkConfiguration { + try NetworkConfiguration(name: defaultName, ipv4Subnet: subnet, labels: [ResourceLabels.roleKey: ResourceLabels.builtinRole]) + } + + /// The private address blocks (RFC 1918) vmnet takes a network's addresses from. + private static let privateIPv4Blocks = ["10.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16"].compactMap { try? CIDRv4($0) } + + /// The longest prefix that leaves a container an address, beside the three vmnet reserves. + private static let longestIPv4Prefix = 30 + + /// Parses an IPv4 subnet vmnet can make a network on, such as `192.168.100.0/24`. + /// + /// A sandboxed app can't make a vmnet network to try a subnet without the restricted `com.apple.vm.networking` + /// entitlement, so this checks what vmnet requires instead. An address with host bits set, such as + /// `192.168.100.5/24`, is kept as written; the network runs from its network address. + /// + /// - Parameter text: The subnet in CIDR form. + /// - Returns: The subnet. + /// - Throws: An `invalidArgument` error that says what's wrong with the subnet. + public static func ipv4Subnet(parsing text: String) throws -> CIDRv4 { + let subnet = try CIDRv4(text) + + guard Int(subnet.prefix.length) <= longestIPv4Prefix else { + throw ContainerizationError(.invalidArgument, message: "IPv4 subnet \(subnet) is too small; use a prefix of /\(longestIPv4Prefix) or shorter") + } + + guard privateIPv4Blocks.contains(where: { $0.lower.value <= subnet.lower.value && subnet.upper.value <= $0.upper.value }) else { + throw ContainerizationError( + .invalidArgument, + message: "IPv4 subnet \(subnet) isn't private; use one inside 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16" + ) + } + + return subnet + } + + /// Lowercase letters, digits, `.`, `_` and `-`, starting and ending with a letter or digit, up to 63 characters. + public static func isValidName(_ name: String) -> Bool { + name.range(of: #"^[a-z0-9](?:[a-z0-9._-]{0,61}[a-z0-9])?$"#, options: .regularExpression) != nil + } + + private enum CodingKeys: String, CodingKey { + case name + case creationDate + case mode + case ipv4Subnet + case ipv6Subnet + case labels + case plugin + case options + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + + name = try container.decode(String.self, forKey: .name) + creationDate = try container.decodeIfPresent(Date.self, forKey: .creationDate) ?? Date(timeIntervalSince1970: 0) + mode = try container.decode(NetworkMode.self, forKey: .mode) + ipv4Subnet = try container.decodeIfPresent(String.self, forKey: .ipv4Subnet).map { try CIDRv4($0) } + ipv6Subnet = try container.decodeIfPresent(String.self, forKey: .ipv6Subnet).map { try CIDRv6($0) } + labels = try container.decodeIfPresent([String: String].self, forKey: .labels) ?? [:] + plugin = try container.decodeIfPresent(String.self, forKey: .plugin) ?? Self.vmnetPlugin + options = try container.decodeIfPresent([String: String].self, forKey: .options) ?? [:] + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + try container.encode(name, forKey: .name) + try container.encode(creationDate, forKey: .creationDate) + try container.encode(mode, forKey: .mode) + try container.encodeIfPresent(ipv4Subnet?.description, forKey: .ipv4Subnet) + try container.encodeIfPresent(ipv6Subnet?.description, forKey: .ipv6Subnet) + try container.encode(labels, forKey: .labels) + try container.encode(plugin, forKey: .plugin) + try container.encode(options, forKey: .options) + } +} + +public enum NetworkMode: String, Codable, Sendable, CaseIterable { + /// Containers reach outside networks through the Mac, which translates their addresses. + case nat + /// Containers reach only each other and the Mac. + case hostOnly +} diff --git a/ContainersCore/Network/NetworkResource.swift b/ContainersCore/Network/NetworkResource.swift new file mode 100644 index 0000000..59582a3 --- /dev/null +++ b/ContainersCore/Network/NetworkResource.swift @@ -0,0 +1,49 @@ +// +// NetworkResource.swift +// Containers +// + +import Foundation + +/// A network containers attach to, as it was configured. +/// +/// The addresses a network is given once it runs aren't known here, so there's no status alongside the +/// configuration. +public struct NetworkResource: ManagedResource, Codable, Equatable { + public let configuration: NetworkConfiguration + + public var id: String { configuration.name } + /// For networks, name and id are the same. + public var name: String { configuration.name } + public var creationDate: Date { configuration.creationDate } + /// Empty where any of the configuration's labels isn't valid. + public var labels: ResourceLabels { (try? ResourceLabels(configuration.labels)) ?? ResourceLabels() } + + /// Whether the system made the network itself, so it can't be deleted. + public var isBuiltin: Bool { configuration.isBuiltin } + + public init(configuration: NetworkConfiguration) { + self.configuration = configuration + } +} + +// Coded with the id alongside, so a network can be read back in the same shape. +extension NetworkResource { + enum CodingKeys: String, CodingKey { + case id + case configuration + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + try container.encode(id, forKey: .id) + try container.encode(configuration, forKey: .configuration) + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + + self.configuration = try container.decode(NetworkConfiguration.self, forKey: .configuration) + } +} diff --git a/ContainerSystem/Network/PortForwarder.swift b/ContainersCore/Network/PortForwarder.swift similarity index 100% rename from ContainerSystem/Network/PortForwarder.swift rename to ContainersCore/Network/PortForwarder.swift diff --git a/ContainersCore/Persistence/DefaultsStore.swift b/ContainersCore/Persistence/DefaultsStore.swift new file mode 100644 index 0000000..29565d8 --- /dev/null +++ b/ContainersCore/Persistence/DefaultsStore.swift @@ -0,0 +1,63 @@ +// +// DefaultsStore.swift +// Containers +// +// Provides default configuration values for the container system. +// + +import Foundation +import Synchronization + +/// The container system's settings, by name, as its `config.toml` sets them. +/// +/// The system reads them from its folder each time it starts; until then, they're the defaults. +public enum DefaultsStore { + /// Known configuration keys. + public enum Key: String { + case defaultInitImage = "defaultInitImage" + case defaultBuilderImage = "defaultBuilderImage" + case defaultKernelURL = "defaultKernelURL" + case defaultKernelBinaryPath = "defaultKernelBinaryPath" + case defaultKernelDigest = "defaultKernelDigest" + case defaultDNSDomain = "defaultDNSDomain" + case buildRosetta = "buildRosetta" + case defaultContainerCPUs = "defaultContainerCPUs" + case defaultContainerMemory = "defaultContainerMemory" + case defaultBuildCPUs = "defaultBuildCPUs" + case defaultBuildMemory = "defaultBuildMemory" + case registryDomain = "registryDomain" + } + + private static let current = Mutex(SystemConfiguration.defaults) + + /// The settings of the system's folder. + public static var configuration: SystemConfiguration { + get { current.withLock { $0 } } + set { current.withLock { $0 = newValue } } + } + + /// Get a required configuration value, or an empty string for one that isn't set. + public static func get(key: Key) -> String { + configuration.value(for: key) ?? "" + } + + /// Get an optional configuration value. Returns nil if not set. + public static func getOptional(key: Key) -> String? { + configuration.value(for: key) + } + + /// Get a boolean configuration value. Returns nil if not set. + public static func getBool(key: Key) -> Bool? { + configuration.value(for: key).map { $0 == "true" } + } + + /// Get an integer configuration value. Returns nil if not set. + public static func getInt(key: Key) -> Int? { + configuration.value(for: key).flatMap(Int.init) + } + + /// Get a UInt64 configuration value. Returns nil if not set. + public static func getUInt64(key: Key) -> UInt64? { + configuration.value(for: key).flatMap(UInt64.init) + } +} diff --git a/ContainersCore/Persistence/FilesystemEntityStore.swift b/ContainersCore/Persistence/FilesystemEntityStore.swift new file mode 100644 index 0000000..057ac66 --- /dev/null +++ b/ContainersCore/Persistence/FilesystemEntityStore.swift @@ -0,0 +1,83 @@ +// +// FilesystemEntityStore.swift +// Containers +// +// Generic JSON-based filesystem persistence for entity types. +// + +import Foundation +import Logging + +/// A simple JSON-based store that persists each entity in a folder of its own. +/// +/// Laid out with `/entity.json` under the store's folder. +public struct FilesystemEntityStore: Sendable { + private static var metadataFilename: String { "entity.json" } + + private let path: URL + private let type: String + private let logger: Logger + + public init(path: URL, type: String, log: Logger) throws { + self.path = path + self.type = type + self.logger = log + + try FileManager.default.createDirectory( + at: path, + withIntermediateDirectories: true + ) + } + + public func list() async throws -> [T] { + let directories = try FileManager.default.contentsOfDirectory( + at: path, + includingPropertiesForKeys: nil + ) + let decoder = JSONDecoder() + + var entities: [T] = [] + + for directory in directories { + let file = directory.appendingPathComponent(Self.metadataFilename) + + guard FileManager.default.fileExists(atPath: file.path) else { + continue + } + + do { + let data = try Data(contentsOf: file) + let entity = try decoder.decode(T.self, from: data) + entities.append(entity) + } catch { + logger.warning( + "Failed to decode \(type) from \(directory.lastPathComponent): \(error)" + ) + } + } + + return entities + } + + public func create(_ entity: T) async throws where T: Identifiable, T.ID == String { + let directory = path.appendingPathComponent(entity.id) + + try FileManager.default.createDirectory( + at: directory, + withIntermediateDirectories: true + ) + + let data = try JSONEncoder().encode(entity) + + try data.write(to: directory.appendingPathComponent(Self.metadataFilename)) + } + + /// Deletes the entity's folder, with anything else kept in it. + public func delete(_ id: String) async throws { + let directory = path.appendingPathComponent(id) + + if FileManager.default.fileExists(atPath: directory.path) { + try FileManager.default.removeItem(at: directory) + } + } +} diff --git a/ContainerSystem/Progress/Progress+Steps.swift b/ContainersCore/Progress/Progress+Steps.swift similarity index 100% rename from ContainerSystem/Progress/Progress+Steps.swift rename to ContainersCore/Progress/Progress+Steps.swift diff --git a/ContainerSystem/Reports/BuildFailure.swift b/ContainersCore/Reports/BuildFailure.swift similarity index 100% rename from ContainerSystem/Reports/BuildFailure.swift rename to ContainersCore/Reports/BuildFailure.swift diff --git a/ContainerSystem/Reports/Gzip.swift b/ContainersCore/Reports/Gzip.swift similarity index 100% rename from ContainerSystem/Reports/Gzip.swift rename to ContainersCore/Reports/Gzip.swift diff --git a/ContainerSystem/Reports/Report.swift b/ContainersCore/Reports/Report.swift similarity index 82% rename from ContainerSystem/Reports/Report.swift rename to ContainersCore/Reports/Report.swift index 41149c4..b2a5709 100644 --- a/ContainerSystem/Reports/Report.swift +++ b/ContainersCore/Reports/Report.swift @@ -14,15 +14,6 @@ public struct Report: Identifiable, Sendable, Hashable { case container case volume - public var title: String { - switch self { - case .build: "Build" - case .image: "Image" - case .container: "Container" - case .volume: "Volume" - } - } - /// How the kind is written in the manifest. var domainType: String { "app.containers.ReportDomainType.\(rawValue.localizedCapitalized)" @@ -41,13 +32,6 @@ public struct Report: Identifiable, Sendable, Hashable { case warning case error - public var title: String { - switch self { - case .warning: "Warning" - case .error: "Error" - } - } - /// The letter the manifest keeps var status: String { switch self { diff --git a/ContainerSystem/Reports/ReportStore.swift b/ContainersCore/Reports/ReportStore.swift similarity index 100% rename from ContainerSystem/Reports/ReportStore.swift rename to ContainersCore/Reports/ReportStore.swift diff --git a/ContainersCore/System/ContainerSystem+AppRoot.swift b/ContainersCore/System/ContainerSystem+AppRoot.swift new file mode 100644 index 0000000..4db1d49 --- /dev/null +++ b/ContainersCore/System/ContainerSystem+AppRoot.swift @@ -0,0 +1,59 @@ +// +// ContainerSystem+AppRoot.swift +// Containers +// +// Which folders the container system can keep its data in. +// +// Created by Axel Martinez on 2026/11/23. +// + +import Darwin +import Foundation + +extension ContainerSystem { + /// Why the container system can't keep its data in a folder. + public enum AppRootError: LocalizedError, Equatable { + /// The folder is, or lies inside, one where Apple's container CLI keeps its data, which the CLI would + /// change under the system. + case containerCLIFolder + + public var errorDescription: String? { + "This folder is the container CLI’s, so Containers can’t store its data in it." + } + } + + /// Whether the container system can keep its data in `folder`. + /// + /// A folder that is, or lies inside, the container CLI's default folder can't, nor can a folder the CLI has + /// started in, as the file its API server writes there tells. The sandbox doesn't let the app read the folders + /// around the chosen one, so a folder inside one the CLI was started in elsewhere can't be told apart. + public nonisolated static func canStoreData(in folder: URL) -> Bool { + folder.withSecurityScopedAccess { + let resolved = folder.resolvingSymlinksInPath() + let apiServerPlist = resolved.appending(path: "apiserver/apiserver.plist") + + return !resolved.pathComponents.starts(with: containerCLIFolderComponents) + && !FileManager.default.fileExists(atPath: apiServerPlist.path(percentEncoded: false)) + } + } + + /// The container CLI's default folder, in the user's own home rather than the sandbox container that `FileManager` reports. + private nonisolated static let containerCLIFolderComponents: [String] = { + let home = getpwuid(getuid()).map { String(cString: $0.pointee.pw_dir) } ?? NSHomeDirectory() + let folder = URL(filePath: home, directoryHint: .isDirectory).appending( + path: "Library/Application Support/com.apple.container", + directoryHint: .isDirectory + ) + + return folder.resolvingSymlinksInPath().pathComponents + }() + + func requireOwnFolder(_ appRoot: URL) throws { + guard !Self.canStoreData(in: appRoot) else { return } + + logger.warning("Not starting over the container CLI's folder") + startupError = AppRootError.containerCLIFolder + + throw AppRootError.containerCLIFolder + } +} diff --git a/ContainersCore/System/ContainerSystem+Configuration.swift b/ContainersCore/System/ContainerSystem+Configuration.swift new file mode 100644 index 0000000..4aa318f --- /dev/null +++ b/ContainersCore/System/ContainerSystem+Configuration.swift @@ -0,0 +1,37 @@ +// +// ContainerSystem+Configuration.swift +// Containers +// +// Created by Axel Martinez on 2026/11/05. +// + +import Foundation + +extension ContainerSystem { + /// The settings in a system folder's `config.toml`, read even while the system is stopped. + /// + /// - Parameter appRoot: The folder the system keeps its data in. + /// - Returns: The settings, with the defaults for what the file leaves out. + public func configuration(in appRoot: URL) async -> SystemConfiguration { + await appRoot.withSecurityScopedAccess { + await SystemConfiguration.load(appRoot: appRoot) + } + } + + /// Saves a change to the system's settings in the `config.toml` of its folder. + /// + /// - Parameters: + /// - appRoot: The folder the system keeps its data in. + /// - change: The change to make. + /// - Throws: An error if the file can't be written. + public func updateConfiguration(in appRoot: URL, _ change: (inout SystemConfiguration) -> Void) async throws { + var configuration = await configuration(in: appRoot) + change(&configuration) + + try appRoot.withSecurityScopedAccess { + try configuration.write(to: appRoot) + } + + DefaultsStore.configuration = configuration + } +} diff --git a/ContainerSystem/Runtime/ContainerRuntime+Prerequisites.swift b/ContainersCore/System/ContainerSystem+Prerequisites.swift similarity index 83% rename from ContainerSystem/Runtime/ContainerRuntime+Prerequisites.swift rename to ContainersCore/System/ContainerSystem+Prerequisites.swift index f92955d..745c8cc 100644 --- a/ContainerSystem/Runtime/ContainerRuntime+Prerequisites.swift +++ b/ContainersCore/System/ContainerSystem+Prerequisites.swift @@ -1,8 +1,8 @@ // -// ContainerRuntime+Prerequisites.swift +// ContainerSystem+Prerequisites.swift // Containers // -// Prerequisites installation extension for ContainerRuntime. +// Prerequisites installation extension for ContainerSystem. // Handles installation of init filesystem and default kernel. // // Created by Axel Martinez on 2026/02/08. @@ -13,13 +13,22 @@ import ContainerizationError import ContainerizationOCI import Foundation -extension ContainerRuntime { - func installPrerequisites() async throws { +extension ContainerSystem { + /// Installs the init image and the default kernel if they're missing, asking first for the kernel. + /// + /// - Parameter installingKernel: Whether the user agreed to download the default kernel if it's missing. + /// - Throws: ``ContainerSystem/SetupError/kernelInstallNotConfirmed`` if the kernel is missing and the user + /// hasn't agreed, or an error if either can't be installed. + func installPrerequisites(installingKernel: Bool) async throws { let initExists = await initImageExists() let kernelExistsResult = await kernelExists() guard !initExists || !kernelExistsResult else { return } + guard kernelExistsResult || installingKernel else { + throw ContainerSystem.SetupError.kernelInstallNotConfirmed + } + // Only what is missing is counted, so the bar measures what will actually be done. let progress = Progress.discreteProgress( totalUnitCount: (initExists ? 0 : 2) + (kernelExistsResult ? 0 : 2) @@ -54,7 +63,7 @@ extension ContainerRuntime { private func installInitialFilesystem(progress: Progress) async throws { let initFsRef = DefaultsStore.get(key: .defaultInitImage) - let service = try await getImagesService() + let service = try imageService progress.totalUnitCount = 2 @@ -81,7 +90,7 @@ extension ContainerRuntime { } private func installDefaultKernel(progress: Progress) async throws { - // Get kernel URL and binary path from DefaultsStore (same as Apple Container CLI) + // Get kernel URL and binary path from DefaultsStore let defaultKernelURL = DefaultsStore.get(key: .defaultKernelURL) let defaultKernelBinaryPath = DefaultsStore.get( key: .defaultKernelBinaryPath @@ -145,12 +154,13 @@ extension ContainerRuntime { // Unpacking happens on the kernel service's actor, off the main thread try await progress.performStep("Unpacking kernel") { _ in - let service = try await getKernelService() + let service = try kernelService try await service.installKernelFrom( tar: tarFile, kernelFilePath: defaultKernelBinaryPath, platform: .current, + expectedDigest: DefaultsStore.get(key: .defaultKernelDigest), force: true ) } @@ -159,7 +169,7 @@ extension ContainerRuntime { } private func initImageExists() async -> Bool { - guard let service = try? await getImagesService() else { + guard let service = try? imageService else { return false } @@ -174,7 +184,7 @@ extension ContainerRuntime { } private func kernelExists() async -> Bool { - guard let service = try? await getKernelService() else { + guard let service = try? kernelService else { return false } diff --git a/ContainersCore/System/ContainerSystem+Preview.swift b/ContainersCore/System/ContainerSystem+Preview.swift new file mode 100644 index 0000000..de88bd7 --- /dev/null +++ b/ContainersCore/System/ContainerSystem+Preview.swift @@ -0,0 +1,27 @@ +// +// ContainerSystem+Preview.swift +// Containers +// +// Stand-ins for SwiftUI previews, so they never start or read the real container system. +// +// Created by Axel Martinez on 2026/11/10. +// + +#if DEBUG +extension ContainerSystem { + /// A container system that is never started. + public static let preview = ContainerSystem() +} + +extension ContainerManager { + public static let preview = ContainerManager(testSystem: .preview) +} + +extension NetworkManager { + public static let preview = NetworkManager(testSystem: .preview) +} + +extension ReportManager { + public static let preview = ReportManager(testSystem: .preview) +} +#endif diff --git a/ContainersCore/System/ContainerSystem+Services.swift b/ContainersCore/System/ContainerSystem+Services.swift new file mode 100644 index 0000000..bc570bd --- /dev/null +++ b/ContainersCore/System/ContainerSystem+Services.swift @@ -0,0 +1,111 @@ +// +// ContainerSystem+Services.swift +// Containers +// +// The services the container system runs. +// +// Created by Axel Martinez on 2026/11/08. +// + +import Containerization +import ContainerizationOCI +import Foundation + +extension ContainerSystem { + /// The services the system runs. + struct Services { + let containerService: ContainerService + let imageService: ImageService + let networkService: NetworkService + let volumeService: VolumeService + let kernelService: KernelService + let reportService: ReportService + } + + func makeServices(appRoot: URL) throws -> Services { + logger.info("Initializing services...") + + let contentStore = try LocalContentStore( + path: appRoot.appendingPathComponent("content") + ) + let imageStore = try ImageStore( + path: appRoot, + contentStore: contentStore + ) + let images = try ImageService( + contentStore: contentStore, + imageStore: imageStore, + snapshotsPath: appRoot.appendingPathComponent("snapshots"), + log: logger + ) + let networks = NetworkService(appRoot: appRoot, log: logger) + let volumes = VolumeService(appRoot: appRoot, log: logger) + let containers = try ContainerService( + appRoot: appRoot, + imageService: images, + networkService: networks, + log: logger + ) + + return Services( + containerService: containers, + imageService: images, + networkService: networks, + volumeService: volumes, + kernelService: try KernelService(log: logger, appRoot: appRoot), + reportService: try ReportService(appRoot: appRoot, log: logger) + ) + } + + /// Keeps the system's observable state in step with the services. + func observe(_ services: Services) async { + await services.containerService.addStateChangeCallback { @MainActor [weak self] in + self?.lastContainerStateChange = Date() + } + + await services.reportService.addChangeCallback { @MainActor [weak self] reports in + self?.reports = reports + } + } + + func createDataDirectories(appRoot: URL) throws { + logger.info("Creating data directories...") + + // The services create the folders they keep inside it. + try FileManager.default.createDirectory( + at: appRoot, + withIntermediateDirectories: true + ) + } + + /// The folders work keeps its files in only while it runs: downloads, unpacks and builds. + static func workFolders(in appRoot: URL) -> [URL] { + [ + appRoot.appendingPathComponent("content/ingest"), + appRoot.appendingPathComponent("snapshots/ingest"), + appRoot.appendingPathComponent("builder"), + ] + } + + /// Empties the folders work keeps its files in while it runs, which hold anything only when the app + /// quit or crashed during it. Called before the services start, so nothing can be using them; no work + /// is resumed. + func removeInterruptedWork(appRoot: URL) { + let fileManager = FileManager.default + + for folder in Self.workFolders(in: appRoot) { + guard let leftovers = try? fileManager.contentsOfDirectory(at: folder, includingPropertiesForKeys: nil) else { + continue + } + + for leftover in leftovers { + do { + try fileManager.removeItem(at: leftover) + logger.info("Removed what interrupted work left: \(leftover.lastPathComponent)") + } catch { + logger.error("Failed to remove what interrupted work left at \(leftover.path): \(error)") + } + } + } + } +} diff --git a/ContainersCore/System/ContainerSystem.swift b/ContainersCore/System/ContainerSystem.swift new file mode 100644 index 0000000..1efc1b8 --- /dev/null +++ b/ContainersCore/System/ContainerSystem.swift @@ -0,0 +1,380 @@ +// +// ContainerSystem.swift +// Containers +// +// The container system: its status and lifecycle, and the services it runs. +// +// Created by Axel Martinez on 2026/02/08. +// + +import Containerization +import ContainerizationError +import ContainerizationOCI +import Foundation +import Logging +import Observation + +/// The container system the app runs in process: it starts and stops the services that run containers, +/// and reports its status. +/// +/// Start the container system before you use the managers. The first start installs what the system +/// needs, such as the Linux kernel, and reports it through ``setupProgress``. +/// +/// The services are created when the system starts and released when it stops. Managers reach them +/// through the `…Service` properties, which throw while the system is stopped. +@Observable +@MainActor +public class ContainerSystem { + /// The container system the app and every manager use. + public static let shared = ContainerSystem() + + let logger: Logger + + private static let bootstrapLogging: Void = LoggingSystem.bootstrap { label in + let category = label.split(separator: ".").last.map(String.init) ?? label + return OSLogHandler(subsystem: "app.containers", category: category) + } + + // Internal, so that previews and tests can make container systems of their own. + init() { + _ = Self.bootstrapLogging + var logger = Logger(label: "app.containers.system") + #if DEBUG + logger.logLevel = .debug + #else + logger.logLevel = .info + #endif + self.logger = logger + } + + // MARK: - DNS + + /// The resolver folder the user gave the app access to, read for the localhost domains `container system dns create` + /// makes; it takes effect the next time the system starts. + public var resolverDirectory: URL? + + // MARK: - Status + + /// The stages of the container system's life cycle. + public enum Status: Equatable { + /// The container system isn't running. + case notStarted + /// The container system is starting, and may be installing what it needs first. + case starting + /// The container system is running, and containers can be created and run. + case running + /// The container system is stopping its containers and services. + case stopping + /// The last start failed. ``ContainerSystem/startupError`` describes why. + case failed + } + + /// The stage the container system is in. + public internal(set) var status: Status = .notStarted + + /// Ends a start or a stop: failed if ``startupError`` says so, and not started otherwise, as after a + /// start that stopped to ask about the kernel. + func settleStopped() { + if let startupError, !(startupError is SetupError) { + status = .failed + } else { + status = .notStarted + } + } + + /// Whether the container system is running, so the managers can be used. + public var isRunning: Bool { + status == .running + } + + /// The error that made the last start fail, or `nil` if it didn't fail. + public internal(set) var startupError: (any Error)? + + /// The progress of installing what the container system needs, such as the Linux kernel and the + /// init image, while a start installs it. + /// + /// This property is `nil` when nothing is being installed. + public internal(set) var setupProgress: Progress? + + // MARK: - Kernel + + public enum SetupError: LocalizedError, Equatable { + case kernelInstallNotConfirmed + + public var errorDescription: String? { + "No default kernel is configured. Install the recommended default kernel to continue." + } + } + + public var needsKernelConfirmation: Bool { + startupError as? SetupError == .kernelInstallNotConfirmed + } + + public nonisolated static var defaultKernelURL: URL? { + URL(string: DefaultsStore.get(key: .defaultKernelURL)) + } + + // MARK: - State the Managers Observe + + var lastContainerStateChange = Date() + + // MARK: - Reports + + var reports: [Report] = [] + + // MARK: - Lifecycle + + private var startTask: Task? + + /// Starts the container system, installing what it needs the first time. + /// + /// - Parameters: + /// - appRoot: The folder where the container system keeps its data. + /// - installingKernel: Whether the user agreed to download the default kernel if it's missing. + /// - Throws: ``AppRootError/containerCLIFolder`` if `appRoot` is the container CLI's folder, or an error if the + /// system can't install what it needs, or start its storage or services. + public func start(appRoot: URL, installingKernel: Bool = false) async throws { + switch status { + case .starting, .running: return + case .notStarted, .stopping, .failed: break + } + + logger.info("Starting system", metadata: ["appRoot": "\(appRoot.path)"]) + + startupError = nil + status = .starting + + let task = Task { [self] in + // A start that fails before its services do, such as on the folder's check, ends here too. + defer { + if status == .starting { + settleStopped() + } + } + + try requireOwnFolder(appRoot) + + DefaultsStore.configuration = await configuration(in: appRoot) + + try await launch(appRoot: appRoot, installingKernel: installingKernel) + } + + startTask = task + + defer { + if startTask == task { + startTask = nil + } + } + + try await withTaskCancellationHandler { + try await task.value + } onCancel: { + task.cancel() + } + } + + /// Cancels a start that's in progress, including one another caller began. + public func cancelStart() { + logger.info("Cancelling start") + startTask?.cancel() + } + + /// Stops the container system, and every container that's running. + public func stop() async throws { + logger.info("Stopping system") + + try await shutdown() + } + + /// Returns the disk space the container system's data uses, in bytes, or `nil` if it isn't running. + public func diskUsage() async -> Int64? { + guard let appRoot else { return nil } + return await FileIO.shared.allocatedSize(of: appRoot) + } + + // MARK: - Services + + private var dnsService: DNSService? + private var isAccessingAppRootSecurityScope = false + /// The folder the running system keeps its data in, or `nil` while it's stopped. + var appRoot: URL? + + /// The services the system made when it started, or `nil` while it's stopped. + private var services: Services? + + /// The error for work that needs the system running while it's stopped. + nonisolated static var notRunningError: ContainerizationError { + ContainerizationError(.internalError, message: "Container system not running") + } + + /// The value from the system's services, which throws while the system is stopped. + private func service(_ value: KeyPath) throws -> Value { + guard let services else { + throw Self.notRunningError + } + + return services[keyPath: value] + } + + var containerService: ContainerService { + get throws { try service(\.containerService) } + } + + var imageService: ImageService { + get throws { try service(\.imageService) } + } + + var networkService: NetworkService { + get throws { try service(\.networkService) } + } + + var volumeService: VolumeService { + get throws { try service(\.volumeService) } + } + + var kernelService: KernelService { + get throws { try service(\.kernelService) } + } + + var reportService: ReportService { + get throws { try service(\.reportService) } + } + + /// Launches what the system runs: makes its services, installs the kernel and the init image the + /// first time, and starts the DNS servers. ``start(appRoot:installingKernel:)`` calls it once the + /// folder's check passes; tests override it to run without virtual machines. + /// + /// - Parameters: + /// - appRoot: The folder where the container system keeps its data. + /// - installingKernel: Whether the user agreed to download the default kernel if it's missing. + /// - Throws: An error if the system can't install what it needs, or start its storage or services. + func launch(appRoot: URL, installingKernel: Bool) async throws { + switch status { + case .running, .stopping: + logger.info("System already running or stopping") + return + case .notStarted, .failed, .starting: + break + } + + status = .starting + + logger.info("Starting services...") + + startupError = nil + isAccessingAppRootSecurityScope = appRoot.startAccessingSecurityScopedResource() + + do { + try createDataDirectories(appRoot: appRoot) + removeInterruptedWork(appRoot: appRoot) + + let services = try makeServices(appRoot: appRoot) + + self.services = services + self.appRoot = appRoot + self.reports = [] + + await observe(services) + + // Content and snapshots that interrupted work left, such as an image a crash stopped + // half way, while no work can be under way to make new ones. + do { + try await services.imageService.cleanUpOrphanedBlobs() + } catch { + logger.error("Failed to clean up unused content: \(error)") + } + + logger.info("Services initialized successfully") + + try await installPrerequisites(installingKernel: installingKernel) + + let dnsService = DNSService(log: logger) + await dnsService.start(containers: services.containerService, resolverDirectory: resolverDirectory) + self.dnsService = dnsService + + status = .running + startupError = nil + + logger.info("Container system started successfully") + + } catch { + let wasCancelled = error is CancellationError || Task.isCancelled + + startupError = wasCancelled ? nil : error + settleStopped() + + if isAccessingAppRootSecurityScope { + appRoot.stopAccessingSecurityScopedResource() + isAccessingAppRootSecurityScope = false + } + + discardServices() + + if wasCancelled { + logger.info("Start cancelled; system left stopped") + } else { + logger.error("Failed to start system: \(error)") + } + + throw error + } + } + + /// Shuts down what the system runs: stops every running container and the DNS servers, and lets go of + /// the services. ``stop()`` calls it; tests override it to run without virtual machines. + func shutdown() async throws { + guard status == .running else { + logger.info("System not running or already stopping") + return + } + + status = .stopping + + logger.info("Stopping container system...") + + let appRoot = self.appRoot + + await stopRunningContainers() + + discardServices() + settleStopped() + + if isAccessingAppRootSecurityScope { + appRoot?.stopAccessingSecurityScopedResource() + isAccessingAppRootSecurityScope = false + } + + logger.info("Container system stopped") + } + + private func stopRunningContainers() async { + if let service = services?.containerService { + let list = await service.list() + for container in list where container.status == .running { + do { + try await service.stop( + id: container.configuration.id, + options: .default + ) + } catch { + logger.error( + "Error stopping container \(container.configuration.id): \(error)" + ) + } + } + } + } + + /// Lets go of the services, so that the next start builds them again. + private func discardServices() { + if let dnsService { + Task { await dnsService.stop() } + } + + dnsService = nil + services = nil + appRoot = nil + } + +} diff --git a/ContainerSystem/Runtime/Services/Containers/ContainersService+Configuration.swift b/ContainersCore/System/Services/Container/ContainerService+Configuration.swift similarity index 68% rename from ContainerSystem/Runtime/Services/Containers/ContainersService+Configuration.swift rename to ContainersCore/System/Services/Container/ContainerService+Configuration.swift index a149dd3..7dbba0d 100644 --- a/ContainerSystem/Runtime/Services/Containers/ContainersService+Configuration.swift +++ b/ContainersCore/System/Services/Container/ContainerService+Configuration.swift @@ -1,5 +1,5 @@ // -// ContainersService+Configuration.swift +// ContainerService+Configuration.swift // Containers // // Turns a container configuration into the virtual machine and process LinuxContainer runs. @@ -57,17 +57,39 @@ extension Filesystem { } } -extension ContainersService { +extension ContainerService { static func configureContainer( czConfig: inout LinuxContainer.Configuration, config: ContainerConfiguration, precomputedMounts: [Containerization.Mount], - precomputedSockets: [UnixSocketConfiguration] + precomputedSockets: [UnixSocketConfiguration], + defaultNameservers: [String] = [] ) throws { czConfig.cpus = config.resources.cpus czConfig.memoryInBytes = config.resources.memoryInBytes - czConfig.sysctl = config.sysctls + + var sysctls = config.sysctls + sysctls["vm.overcommit_memory"] = "1" + sysctls["vm.max_map_count"] = "262144" + czConfig.sysctl = sysctls + czConfig.virtualization = config.virtualization + czConfig.useInit = config.useInit + + // nil leaves LinuxContainer's own default set in place. + if let maskedPaths = config.maskedPaths { + czConfig.maskedPaths = maskedPaths + } + if let readonlyPaths = config.readonlyPaths { + czConfig.readonlyPaths = readonlyPaths + } + + if let shmSize = config.shmSize { + for index in czConfig.mounts.indices where czConfig.mounts[index].destination == "/dev/shm" { + czConfig.mounts[index].options.removeAll { $0.hasPrefix("size=") } + czConfig.mounts[index].options.append("size=\(shmSize)") + } + } czConfig.mounts.append(contentsOf: precomputedMounts) czConfig.sockets.append(contentsOf: precomputedSockets) @@ -97,14 +119,16 @@ extension ContainersService { czConfig.sockets.append(socketConfig) } - czConfig.hostname = config.id + let hostnameSource = config.networks.first?.options.hostname ?? config.id + czConfig.hostname = + hostnameSource.split(separator: ".", maxSplits: 1, omittingEmptySubsequences: true) + .first + .map { String($0) } ?? config.id - // Only set DNS if explicitly provided by container configuration - // Setting DNS causes the framework to write /etc/resolv.conf which fails on read-only rootfs - // If not set, containers will use the host's DNS via the VM network - if let dns = config.dns, !dns.nameservers.isEmpty { + // No nameservers means the network's gateway. + if let dns = config.dns { czConfig.dns = DNS( - nameservers: dns.nameservers, + nameservers: dns.nameservers.isEmpty ? defaultNameservers : dns.nameservers, domain: dns.domain, searchDomains: dns.searchDomains, options: dns.options @@ -122,7 +146,7 @@ extension ContainersService { czConfig.process.arguments = [process.executable] + process.arguments czConfig.process.environmentVariables = process.environment - czConfig.process.capabilities = try capabilities(from: config.capabilities) + czConfig.process.capabilities = try capabilities(add: config.capAdd, drop: config.capDrop) if config.ssh, Foundation.ProcessInfo.processInfo.environment["SSH_AUTH_SOCK"] != nil { let sshEnvVar = "SSH_AUTH_SOCK" @@ -162,33 +186,32 @@ extension ContainersService { } } - private static func capabilities(from names: [String]) throws -> Containerization.LinuxCapabilities { - let capabilities = try capabilitySet(from: names) + /// The OCI defaults, or none if `capDrop` holds "ALL", then + /// every capability if `capAdd` holds "ALL" or each one it names, less each one `capDrop` names. + private static func capabilities(add: [String], drop: [String]) throws -> Containerization.LinuxCapabilities { + let add = names(add) + let drop = names(drop) - guard !capabilities.isEmpty else { - return .allCapabilities - } + var capabilities: Set = + drop.contains("ALL") ? [] : Set(Containerization.LinuxCapabilities.defaultOCICapabilities.effective) - return Containerization.LinuxCapabilities(capabilities: Array(capabilities)) - } - - private static func capabilitySet(from names: [String]) throws -> Set { - var capabilities: Set = [] - - for name in names { - let trimmedName = name.trimmingCharacters(in: .whitespacesAndNewlines) - - guard !trimmedName.isEmpty else { - continue + if add.contains("ALL") { + capabilities = Set(CapabilityName.allCases) + } else { + for name in add { + capabilities.insert(try CapabilityName(rawValue: name)) } + } - if trimmedName.uppercased() == "ALL" { - capabilities.formUnion(CapabilityName.allCases) - } else { - capabilities.insert(try CapabilityName(rawValue: trimmedName)) - } + for name in drop where name != "ALL" { + capabilities.remove(try CapabilityName(rawValue: name)) } - return capabilities + return Containerization.LinuxCapabilities(capabilities: Array(capabilities)) + } + + private static func names(_ capabilities: [String]) -> [String] { + capabilities.map { $0.trimmingCharacters(in: .whitespacesAndNewlines).uppercased() } + .filter { !$0.isEmpty } } } diff --git a/ContainersCore/System/Services/Container/ContainerService+Interfaces.swift b/ContainersCore/System/Services/Container/ContainerService+Interfaces.swift new file mode 100644 index 0000000..1d9c787 --- /dev/null +++ b/ContainersCore/System/Services/Container/ContainerService+Interfaces.swift @@ -0,0 +1,128 @@ +// +// ContainerService+Interfaces.swift +// Containers +// +// The interfaces containers get on their networks, and the addresses they hold. +// +// Created by Axel Martinez on 2026/10/24. +// + +import Containerization +import ContainerizationError +import ContainerizationExtras +import Foundation + +extension ContainerService { + /// One interface per network the container attaches to, and what the container's snapshot records of each. + /// + /// Only the first gets a default route, as only one can. + func attachInterfaces(for id: String, configuration: ContainerConfiguration) async throws -> [(interface: any Interface, attachment: Attachment)] { + var attached: [(interface: any Interface, attachment: Attachment)] = [] + + do { + for (index, network) in configuration.networks.enumerated() { + attached.append(try await attachInterface(for: id, to: network, isPrimary: index == 0)) + } + } catch { + releaseInterfaces(for: id) + throw error + } + + return attached + } + + private func attachInterface(for id: String, to network: AttachmentConfiguration, isPrimary: Bool) async throws -> ( + interface: any Interface, attachment: Attachment + ) { + let mtu = network.options.mtu ?? 1280 + let hostname = network.options.hostname.isEmpty ? id : network.options.hostname + let interface: any Interface + + if var vmnetNetwork = try await vmnetNetwork(named: network.network) { + let created = try isPrimary ? vmnetNetwork.createInterface(id, mtu: mtu) : vmnetNetwork.createInterfaceWithoutGateway(id) + + vmnetNetworks[network.network]?.network = vmnetNetwork + attachedNetworks[id, default: []].append(network.network) + + guard let created else { + throw ContainerizationError(.internalError, message: "no interface on network \(network.network)") + } + + interface = created + } else { + let (address, gateway) = try allocateSharedNATAddress(for: id) + + interface = NATInterface(ipv4Address: address, ipv4Gateway: gateway, macAddress: network.options.macAddress, mtu: mtu) + } + + let attachment = Attachment( + network: network.network, + hostname: hostname, + ipv4Address: interface.ipv4Address, + ipv4Gateway: interface.ipv4Gateway ?? interface.ipv4Address.gateway, + ipv6Address: interface.ipv6Address, + macAddress: interface.macAddress + ) + + return (interface, attachment) + } + + /// The vmnet network for a stored network, made the first time a container attaches to it. + /// + /// - Returns: The network, or `nil` for the built-in one where vmnet can't be used, which then falls back to + /// the Mac's shared NAT. + private func vmnetNetwork(named name: String) async throws -> VmnetNetwork? { + guard !usesSharedNAT || name != NetworkConfiguration.defaultName else { + return nil + } + + guard let configuration = try await networkService.list().first(where: { $0.name == name }) else { + throw ContainerizationError(.notFound, message: "network \(name) not found") + } + + // A network deleted and made again under the same name gets a vmnet network of its own. + if let cached = vmnetNetworks[name], cached.configuration == configuration { + return cached.network + } + + do { + let network = try VmnetNetwork( + mode: configuration.mode == .hostOnly ? .VMNET_HOST_MODE : .VMNET_SHARED_MODE, + subnet: configuration.ipv4Subnet, + prefixV6: configuration.ipv6Subnet + ) + + vmnetNetworks[name] = VmnetEntry(configuration: configuration, network: network) + log.info("Created network \(name)", metadata: ["subnet": "\(network.subnet)"]) + + return network + } catch where name == NetworkConfiguration.defaultName { + log.warning("vmnet unavailable, using the shared NAT for the default network: \(error)") + usesSharedNAT = true + + return nil + } catch { + throw ContainerizationError(.unsupported, message: "network \(name) couldn't be created: \(error)") + } + } + + private func allocateSharedNATAddress(for id: String) throws -> (address: CIDRv4, gateway: IPv4Address) { + let hostNumber = ipAllocations[id] ?? (UInt8(2)...254).first { !ipAllocations.values.contains($0) } + + guard let hostNumber else { + throw ContainerizationError(.internalError, message: "no available IP addresses") + } + + ipAllocations[id] = hostNumber + + return (try CIDRv4("192.168.64.\(hostNumber)/24"), try IPv4Address("192.168.64.1")) + } + + func releaseInterfaces(for id: String) { + for name in attachedNetworks.removeValue(forKey: id) ?? [] { + try? vmnetNetworks[name]?.network.releaseInterface(id) + } + + ipAllocations.removeValue(forKey: id) + } +} diff --git a/ContainerSystem/Runtime/Services/Containers/ContainersService+Lifecycle.swift b/ContainersCore/System/Services/Container/ContainerService+Lifecycle.swift similarity index 84% rename from ContainerSystem/Runtime/Services/Containers/ContainersService+Lifecycle.swift rename to ContainersCore/System/Services/Container/ContainerService+Lifecycle.swift index 389ab0f..303cf7e 100644 --- a/ContainerSystem/Runtime/Services/Containers/ContainersService+Lifecycle.swift +++ b/ContainersCore/System/Services/Container/ContainerService+Lifecycle.swift @@ -1,5 +1,5 @@ // -// ContainersService+Lifecycle.swift +// ContainerService+Lifecycle.swift // Containers // // Booting, starting, stopping and deleting containers, and handling their exits. @@ -13,8 +13,9 @@ import ContainerizationExtras import ContainerizationOS import Foundation import Logging +import SystemPackage -extension ContainersService { +extension ContainerService { func bootstrap(id: String, stdio: [FileHandle?]) async throws { try await lock(for: id).withLock { _ in try await self._bootstrap(id: id, stdio: stdio) @@ -45,9 +46,18 @@ extension ContainersService { } let bundle = state.bundle ?? Bundle(path: bundlePath(for: id)) - let config = try bundle.configuration - let bundleKernel = try bundle.kernel + var bundleKernel = try bundle.kernel + + // Defaults, each left out when the container already gives one by that name. + let defaultKernelArgs: KeyValuePairs = [ + "oops": "panic", + "lsm": "lockdown,capability,landlock,yama,apparmor", + ] + for (key, value) in defaultKernelArgs where !bundleKernel.commandLine.kernelArgs.contains(where: { $0.hasPrefix("\(key)=") }) { + bundleKernel.commandLine.kernelArgs.append("\(key)=\(value)") + } + let initMount = await MainActor.run { bundle.initialFilesystem.asMount } @@ -88,9 +98,14 @@ extension ContainersService { for mount in config.mounts { if try await MainActor.run(body: { try mount.isSocket() }) { + let attributes = try? FileManager.default.attributesOfItem(atPath: mount.source) + let permissions = (attributes?[.posixPermissions] as? NSNumber) + .map { FilePermissions(rawValue: mode_t($0.intValue)) } let socket = UnixSocketConfiguration( source: URL(filePath: mount.source), - destination: URL(filePath: mount.destination) + destination: URL(filePath: mount.destination), + permissions: permissions, + direction: .into ) precomputedSockets.append(socket) } else { @@ -99,22 +114,42 @@ extension ContainersService { } } - // Allocate IP before the closure (actor-isolated state) - let (ip, gw) = try allocateIP(for: id) + let attached = try await attachInterfaces(for: id, configuration: config) + let primary = attached.first?.attachment + + // Headroom beyond the container's cgroup limits for the guest kernel and vminitd. + let vmResources = VMResources( + cpus: config.resources.cpus + config.resources.cpuOverhead, + memoryInBytes: config.resources.memoryInBytes + VMResources.guestMemoryOverhead + ) + + // Released if the container can't be set up, as a failed boot releases them. + var isComplete = false - let container = try LinuxContainer(id, rootfs: rootfs, vmm: vmm, logger: self.log) { czConfig in + defer { + if !isComplete { + releaseInterfaces(for: id) + } + } + + let container = try LinuxContainer(id, rootfs: rootfs, vmm: vmm, vm: vmResources, logger: self.log) { czConfig in try Self.configureContainer( czConfig: &czConfig, config: config, precomputedMounts: precomputedMounts, - precomputedSockets: precomputedSockets + precomputedSockets: precomputedSockets, + defaultNameservers: primary.map { [$0.ipv4Gateway.description] } ?? [] ) - // Configure NATInterface (IsolatedInterfaceStrategy pattern) - czConfig.interfaces = [try NATInterface(ipv4Address: CIDRv4(ip), ipv4Gateway: IPv4Address(gw))] + czConfig.interfaces = attached.map(\.interface) - // Do not set hosts configuration - causes I/O errors when framework tries to write /etc/hosts - // The framework will handle hosts automatically + var hosts = [Hosts.Entry.localHostIPV4()] + + if let primary { + hosts.append(Hosts.Entry(ipAddress: primary.ipv4Address.address.description, hostnames: [czConfig.hostname ?? id])) + } + + czConfig.hosts = Hosts(entries: hosts) czConfig.process.stdout = stdout czConfig.process.stderr = stderr @@ -125,21 +160,14 @@ extension ContainersService { czConfig.bootLog = .file(path: bundle.bootLog, append: true) } + isComplete = true + do { try await container.create() state.container = container state.bundle = bundle - state.snapshot.networks = [ - Attachment( - network: "nat", - hostname: id, - ipv4Address: try CIDRv4(ip), - ipv4Gateway: try IPv4Address(gw), - ipv6Address: CIDRv6?.none, - macAddress: MACAddress?.none - ) - ] + state.snapshot.networks = attached.map(\.attachment) containers[id] = state hasBooted = true @@ -147,7 +175,7 @@ extension ContainersService { notifyStateChange() } catch { log.error("Failed to bootstrap container \(id): \(error)") - releaseIP(for: id) + releaseInterfaces(for: id) throw error } } @@ -330,7 +358,7 @@ extension ContainersService { state.snapshot.status = .stopped state.snapshot.networks = [] state.container = nil - releaseIP(for: id) + releaseInterfaces(for: id) containers[id] = state diff --git a/ContainerSystem/Runtime/Services/Containers/ContainersService+Processes.swift b/ContainersCore/System/Services/Container/ContainerService+Processes.swift similarity index 56% rename from ContainerSystem/Runtime/Services/Containers/ContainersService+Processes.swift rename to ContainersCore/System/Services/Container/ContainerService+Processes.swift index 8387578..ec9159d 100644 --- a/ContainerSystem/Runtime/Services/Containers/ContainersService+Processes.swift +++ b/ContainersCore/System/Services/Container/ContainerService+Processes.swift @@ -1,5 +1,5 @@ // -// ContainersService+Processes.swift +// ContainerService+Processes.swift // Containers // // Running commands in, connecting to, and measuring running containers. @@ -11,35 +11,47 @@ import Containerization import ContainerizationError import Foundation -extension ContainersService { +extension ContainerService { /// What each running container is using right now. A container that /// cannot say, because it is on its way down, is left out. - func resourceUsage() async -> [ContainerResourceUsage] { + func stats() async -> [ContainerStats] { // Taken before the first await: the actor can change underneath it. let running = containers.compactMap { id, state in state.snapshot.status == .running ? state.container.map { (id, $0) } : nil } - var usage: [ContainerResourceUsage] = [] - - for (id, container) in running { - guard - let stats = try? await container.statistics(categories: [.memory, .cpu]) - else { - continue + // Each container is asked in its own VM, so all at once. + return await withTaskGroup(of: ContainerStats?.self) { group in + for (id, container) in running { + group.addTask { + guard let stats = try? await container.statistics(categories: [.memory, .cpu, .network, .blockIO]) else { + return nil + } + + // Summed over the container's interfaces and disks. + let networks = stats.networks ?? [] + let devices = stats.blockIO?.devices ?? [] + + return ContainerStats( + id: id, + memoryBytes: stats.memory?.usageBytes ?? 0, + memoryLimitBytes: stats.memory?.limitBytes ?? 0, + cpuUsageMicroseconds: stats.cpu?.usageUsec ?? 0, + networkReceivedBytes: networks.reduce(0) { $0 + $1.receivedBytes }, + networkSentBytes: networks.reduce(0) { $0 + $1.transmittedBytes }, + diskReadBytes: devices.reduce(0) { $0 + $1.readBytes }, + diskWriteBytes: devices.reduce(0) { $0 + $1.writeBytes } + ) + } } - let entry = ContainerResourceUsage( - id: id, - memoryBytes: stats.memory?.usageBytes ?? 0, - cpuUsageMicroseconds: stats.cpu?.usageUsec ?? 0 - ) - - usage.append(entry) + return await group.reduce(into: []) { usage, entry in + if let entry { + usage.append(entry) + } + } } - - return usage } /// Execute a command in a running container and return its output (uses vsock, no networking needed). diff --git a/ContainerSystem/Runtime/Services/Containers/ContainersService+Streams.swift b/ContainersCore/System/Services/Container/ContainerService+Streams.swift similarity index 97% rename from ContainerSystem/Runtime/Services/Containers/ContainersService+Streams.swift rename to ContainersCore/System/Services/Container/ContainerService+Streams.swift index 0a43713..506e236 100644 --- a/ContainerSystem/Runtime/Services/Containers/ContainersService+Streams.swift +++ b/ContainersCore/System/Services/Container/ContainerService+Streams.swift @@ -1,5 +1,5 @@ // -// ContainersService+Streams.swift +// ContainerService+Streams.swift // Containers // // The stdio plumbing between containers and files, and waiting on a container to exit. @@ -10,7 +10,7 @@ import Containerization import Foundation -extension ContainersService { +extension ContainerService { struct MultiWriter: Writer { let handles: [FileHandle] diff --git a/ContainerSystem/Runtime/Services/Containers/ContainersService.swift b/ContainersCore/System/Services/Container/ContainerService.swift similarity index 60% rename from ContainerSystem/Runtime/Services/Containers/ContainersService.swift rename to ContainersCore/System/Services/Container/ContainerService.swift index 943e1db..4818308 100644 --- a/ContainerSystem/Runtime/Services/Containers/ContainersService.swift +++ b/ContainersCore/System/Services/Container/ContainerService.swift @@ -1,8 +1,8 @@ // -// ContainersService.swift +// ContainerService.swift // Containers // -// A containers service that runs LinuxContainer. +// The containers the system keeps in its folder, and runs with LinuxContainer. // // Created by Axel Martinez on 2026/02/04. // @@ -15,7 +15,7 @@ import Foundation import Logging /// A sandbox-compatible containers service that runs LinuxContainer in-process. -actor ContainersService { +actor ContainerService { struct ContainerState { var snapshot: ContainerSnapshot var container: LinuxContainer? @@ -24,17 +24,34 @@ actor ContainersService { var lastExitCode: Int32? } + /// A vmnet network, and the stored network it was made from. + struct VmnetEntry { + var configuration: NetworkConfiguration + var network: VmnetNetwork + } + let log: Logger let appRoot: URL let containerRoot: URL - let imagesService: ImagesService + let imageService: ImageService + let networkService: NetworkService var containers: [String: ContainerState] = [:] var ipAllocations: [String: UInt8] = [:] + var vmnetNetworks: [String: VmnetEntry] = [:] + /// The vmnet networks each running container holds an address on. + var attachedNetworks: [String: [String]] = [:] + /// Whether vmnet was refused, which leaves the default network on the Mac's shared NAT. + var usesSharedNAT = false var portForwarders: [String: PortForwarder] = [:] /// One lock per container, so booting or stopping one never waits on another. /// They're kept after a container is deleted: dropping a lock while a call /// waits on it would let a new one be made for the same ID. var containerLocks: [String: AsyncLock] = [:] + /// Held while a container is reserved, and by ``withContainerList(_:)``, so the list doesn't gain a + /// container while its callers act on it. + private let containerListLock = AsyncLock() + /// The containers being created, so their IDs and networks count before their bundles are made. + private var pendingCreates: [String: ContainerConfiguration] = [:] /// Callbacks to invoke when container state changes var stateChangeCallbacks: [@Sendable @MainActor () -> Void] = [] @@ -44,68 +61,85 @@ actor ContainersService { stateChangeCallbacks.append(callback) } - init(appRoot: URL, imagesService: ImagesService, log: Logger) throws { + init(appRoot: URL, imageService: ImageService, networkService: NetworkService, log: Logger) throws { let containerRoot = appRoot.appendingPathComponent("containers") try FileManager.default.createDirectory(at: containerRoot, withIntermediateDirectories: true) self.appRoot = appRoot self.containerRoot = containerRoot - self.imagesService = imagesService + self.imageService = imageService + self.networkService = networkService self.log = log self.containers = Self.loadAtBoot(root: containerRoot, log: log) let count = containers.count - log.info("ContainersService initialized with \(count) existing container(s)") + log.info("Container service initialized with \(count) existing container(s)") } - private static func loadAtBoot(root: URL, log: Logger) -> [String: ContainerState] { - var results = [String: ContainerState]() - + /// The bundles in the containers folder, with the configuration each one stores. A bundle without one + /// was left by a creation the app quit or crashed during, and is removed, as no work is resumed. + private static func storedBundles(in root: URL, log: Logger) -> [(configuration: ContainerConfiguration, bundle: Bundle)] { guard let directories = try? FileManager.default.contentsOfDirectory( at: root, includingPropertiesForKeys: [.isDirectoryKey] ) else { - return results + return [] } - for dir in directories where dir.isDirectory { - do { - let bundle = Bundle(path: dir) - let config = try bundle.configuration + var bundles: [(configuration: ContainerConfiguration, bundle: Bundle)] = [] - if (try? bundle.createOptions)?.autoRemove ?? false { - log.info("Reaping auto-remove container \(config.id)") - try? bundle.delete() - continue - } + for directory in directories where directory.isDirectory { + let bundle = Bundle(path: directory) - results[config.id] = ContainerState( - snapshot: ContainerSnapshot( - configuration: config, - status: .stopped, - networks: [], - startedDate: bundle.state.startedDate - ), - container: LinuxContainer?.none, - bundle: bundle - ) - // Container restored from disk + do { + bundles.append((try bundle.configuration, bundle)) } catch { - log.warning("Failed to load container bundle at \(dir.path): \(error)") + log.warning("Removing container bundle that can't be read at \(directory.path): \(error)") + try? FileManager.default.removeItem(at: directory) + } + } + + return bundles + } + + private static func loadAtBoot(root: URL, log: Logger) -> [String: ContainerState] { + var results = [String: ContainerState]() + + for (configuration, bundle) in storedBundles(in: root, log: log) { + if (try? bundle.createOptions)?.autoRemove ?? false { + log.info("Reaping auto-remove container \(configuration.id)") + try? bundle.delete() + continue } + + results[configuration.id] = ContainerState( + snapshot: ContainerSnapshot( + configuration: configuration, + status: .stopped, + networks: [], + startedDate: bundle.state.startedDate + ), + container: LinuxContainer?.none, + bundle: bundle + ) } + return results } // MARK: - Internal API + func list() async -> [ContainerSnapshot] { + await list(status: nil, labelFilter: nil, namePattern: nil) + } + /// List containers with optional filters. func list( - status: ContainerStatus? = nil, + status: RuntimeStatus? = nil, labelFilter: [String: String]? = nil, namePattern: String? = nil ) async -> [ContainerSnapshot] { @@ -137,12 +171,13 @@ actor ContainersService { kernel: Kernel, options: ContainerCreateOptions ) async throws { - // Creating container - - guard containers[configuration.id] == nil else { - throw ContainerizationError(.exists, message: "container already exists: \(configuration.id)") + try await containerListLock.withLock { _ in + try await self.reserve(configuration) } + // The bundle is made outside the lock, so containers are created side by side. + defer { pendingCreates.removeValue(forKey: configuration.id) } + let path = bundlePath(for: configuration.id) let systemPlatform = kernel.platform @@ -159,8 +194,8 @@ actor ContainersService { ) do { - // Get container image filesystem via in-process ImagesService (no XPC) - let imageFs = try await imagesService.getImageSnapshot( + // Get container image filesystem via in-process ImageService (no XPC) + let imageFs = try await imageService.getImageSnapshot( description: configuration.image, platform: configuration.platform ) @@ -182,6 +217,33 @@ actor ContainersService { } } + /// Runs `body` with the configuration of every container, those still being created included, while + /// no other container can be reserved. + func withContainerList(_ body: @Sendable @escaping ([ContainerConfiguration]) async throws -> T) async throws -> T { + try await containerListLock.withLock { _ in + try await body(await self.containerConfigurations()) + } + } + + private func containerConfigurations() -> [ContainerConfiguration] { + containers.values.map(\.snapshot.configuration) + pendingCreates.values + } + + /// Checks that the container's ID is free and its networks exist, and holds the ID until it's created. + private func reserve(_ configuration: ContainerConfiguration) async throws { + guard containers[configuration.id] == nil, pendingCreates[configuration.id] == nil else { + throw ContainerizationError(.exists, message: "container already exists: \(configuration.id)") + } + + let networks = Set(try await networkService.list().map(\.name)) + + if let unknown = configuration.networks.first(where: { !networks.contains($0.network) }) { + throw ContainerizationError(.notFound, message: "network \(unknown.network) not found") + } + + pendingCreates[configuration.id] = configuration + } + // MARK: - Container State func containerState(for id: String) throws -> ContainerState { @@ -222,7 +284,7 @@ actor ContainersService { func removeContainer(id: String) { try? FileManager.default.removeItem(at: bundlePath(for: id)) - releaseIP(for: id) + releaseInterfaces(for: id) containers.removeValue(forKey: id) } @@ -236,20 +298,20 @@ actor ContainersService { private func getInitBlock(for platform: Platform) async throws -> Filesystem { let initImageRef: String = DefaultsStore.get(key: .defaultInitImage) - let initDescription = try await imagesService.pull( + let initDescription = try await imageService.pull( reference: initImageRef, platform: platform, insecure: false, progressUpdate: nil ) - try await imagesService.unpack( + try await imageService.unpack( description: initDescription, platform: platform, progressUpdate: nil ) - var fs = try await imagesService.getImageSnapshot( + var fs = try await imageService.getImageSnapshot( description: initDescription, platform: platform ) diff --git a/ContainersCore/System/Services/DNS/ContainerDNSHandler.swift b/ContainersCore/System/Services/DNS/ContainerDNSHandler.swift new file mode 100644 index 0000000..7a2e78a --- /dev/null +++ b/ContainersCore/System/Services/DNS/ContainerDNSHandler.swift @@ -0,0 +1,82 @@ +// +// ContainerDNSHandler.swift +// Containers +// +// Created by Axel Martinez on 2026/10/30. +// + +import ContainerizationExtras +import Foundation + +/// Answers for the hostnames and aliases of running containers. +struct ContainerDNSHandler: DNSHandler { + let containers: @Sendable () async -> [ContainerSnapshot] + var ttl: UInt32 = 5 + + func answer(query: Message) async throws -> Message? { + guard let question = query.questions.first else { + return nil + } + + guard question.type == .host || question.type == .host6 else { + return Message(id: query.id, type: .response, returnCode: .notImplemented, questions: query.questions, answers: []) + } + + guard let attachment = Self.attachment(for: question.name, in: await containers()) else { + return nil + } + + let record: ResourceRecord? + + if question.type == .host { + record = HostRecord(name: question.name, ttl: ttl, ip: attachment.ipv4Address.address) + } else { + // A name with no IPv6 address answers with no records, not NXDOMAIN, which musl takes to mean the name doesn't exist. + record = attachment.ipv6Address.map { HostRecord(name: question.name, ttl: ttl, ip: $0.address) } + } + + return Message( + id: query.id, + type: .response, + returnCode: .noError, + questions: query.questions, + answers: record.map { [$0] } ?? [] + ) + } + + /// The attachment a name resolves to: a hostname first, then an exact alias, then the subtree alias with the + /// longest base. + static func attachment(for name: String, in snapshots: [ContainerSnapshot]) -> Attachment? { + let name = canonical(name) + let attachments = snapshots.filter { $0.status == .running }.flatMap { snapshot in + snapshot.networks.enumerated().map { index, attachment in + let aliases = snapshot.configuration.networks.indices.contains(index) ? snapshot.configuration.networks[index].options.aliases : [] + + return (attachment: attachment, aliases: aliases.map(canonical)) + } + } + + if let match = attachments.first(where: { canonical($0.attachment.hostname) == name }) { + return match.attachment + } + + if let match = attachments.first(where: { $0.aliases.contains(name) }) { + return match.attachment + } + + guard let dnsName = try? DNSName(name) else { return nil } + + for base in DNSMatchRule.subtreeBases(of: dnsName) { + if let match = attachments.first(where: { $0.aliases.contains("." + base.pqdn) }) { + return match.attachment + } + } + + return nil + } + + /// A name as compared: lowercased, without a trailing dot. + private static func canonical(_ name: String) -> String { + (name.hasSuffix(".") ? String(name.dropLast()) : name).lowercased() + } +} diff --git a/ContainersCore/System/Services/DNS/DNSService.swift b/ContainersCore/System/Services/DNS/DNSService.swift new file mode 100644 index 0000000..8f1d77f --- /dev/null +++ b/ContainersCore/System/Services/DNS/DNSService.swift @@ -0,0 +1,91 @@ +// +// DNSService.swift +// Containers +// +// Created by Axel Martinez on 2026/10/30. +// + +import Foundation +import Logging + +/// Resolves container hostnames for the Mac and the containers, on the addresses the container CLI's DNS servers use, +/// so the resolver files `container system dns create` writes work the same with either running the containers. +actor DNSService { + static let listenAddress = "127.0.0.1" + static let hostnamesPort = 2053 + static let localhostPort = 1053 + + private let log: Logger + private var tasks: [Task] = [] + + init(log: Logger) { + self.log = log + } + + /// Starts answering for the running containers, and for the localhost domains in a resolver folder. + /// + /// - Parameters: + /// - containers: The containers to answer for. + /// - resolverDirectory: The resolver folder the user gave the app access to, or `nil` without one. + func start(containers: ContainerService, resolverDirectory: URL?) { + guard tasks.isEmpty else { return } + + let hostnames = ContainerDNSHandler { await containers.list() } + + tasks.append(serve(hostnames, port: Self.hostnamesPort, name: "container hostnames")) + + if let resolverDirectory { + let localhost = LocalhostDNSHandler() + + tasks.append(serve(localhost, port: Self.localhostPort, name: "localhost")) + tasks.append(Task { await Self.follow(resolverDirectory, into: localhost) }) + } + } + + func stop() { + for task in tasks { + task.cancel() + } + + tasks = [] + } + + private func serve(_ handler: some DNSHandler & Sendable, port: Int, name: String) -> Task { + let log = log + + return Task { + let server = DNSServer( + handler: StandardQueryValidator(handler: CompositeResolver(handlers: [handler, NxDomainResolver()])), + log: log + ) + + log.info("Starting DNS resolver for \(name)", metadata: ["host": "\(Self.listenAddress)", "port": "\(port)"]) + + do { + try await server.run(host: Self.listenAddress, port: port) + } catch is CancellationError { + return + } catch { + // Most likely the CLI's own server, already listening. + log.error("DNS resolver for \(name) stopped: \(error)") + } + } + } + + /// Reads the resolver folder now and again whenever its files change, while the task runs. + private static func follow(_ directory: URL, into handler: LocalhostDNSHandler) async { + let didAccess = directory.startAccessingSecurityScopedResource() + + defer { + if didAccess { + directory.stopAccessingSecurityScopedResource() + } + } + + await handler.reload(from: directory) + + for await _ in FolderEvents.changes(under: directory) { + await handler.reload(from: directory) + } + } +} diff --git a/ContainersCore/System/Services/DNS/LocalhostDNSHandler.swift b/ContainersCore/System/Services/DNS/LocalhostDNSHandler.swift new file mode 100644 index 0000000..f608aef --- /dev/null +++ b/ContainersCore/System/Services/DNS/LocalhostDNSHandler.swift @@ -0,0 +1,73 @@ +// +// LocalhostDNSHandler.swift +// Containers +// +// Created by Axel Martinez on 2026/10/30. +// + +import ContainerizationExtras +import Foundation + +/// Answers for the domains `container system dns create --localhost` points at the Mac, from their resolver files. +actor LocalhostDNSHandler: DNSHandler { + /// The CLI's resolver files for these domains: `containerization.`, holding `options localhost:
`. + static let filePrefix = "containerization." + + private let ttl: UInt32 + private var addresses: [DNSName: IPv4Address] = [:] + + init(ttl: UInt32 = 5) { + self.ttl = ttl + } + + /// Reads the domains from a resolver folder, replacing those read before. + func reload(from directory: URL) { + addresses = Self.addresses(in: directory) + } + + func answer(query: Message) async throws -> Message? { + guard let question = query.questions.first else { + return nil + } + + let name = question.name.hasSuffix(".") ? String(question.name.dropLast()) : question.name + + guard let key = try? DNSName(name), let address = addresses[key] else { + return nil + } + + switch question.type { + case .host: + return Message( + id: query.id, + type: .response, + returnCode: .noError, + questions: query.questions, + answers: [HostRecord(name: question.name, ttl: ttl, ip: address)] + ) + case .host6: + return Message(id: query.id, type: .response, returnCode: .noError, questions: query.questions, answers: []) + default: + return Message(id: query.id, type: .response, returnCode: .notImplemented, questions: query.questions, answers: []) + } + } + + static func addresses(in directory: URL) -> [DNSName: IPv4Address] { + let files = (try? FileManager.default.contentsOfDirectory(at: directory, includingPropertiesForKeys: nil)) ?? [] + var addresses: [DNSName: IPv4Address] = [:] + + for file in files where file.lastPathComponent.hasPrefix(filePrefix) { + guard let contents = try? String(contentsOf: file, encoding: .utf8), + let match = contents.firstMatch(of: #/options localhost:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})/#), + let address = try? IPv4Address(String(match.1)), + let name = try? DNSName(String(file.lastPathComponent.dropFirst(filePrefix.count))) + else { + continue + } + + addresses[name] = address + } + + return addresses + } +} diff --git a/ContainersCore/System/Services/ImageService.swift b/ContainersCore/System/Services/ImageService.swift new file mode 100644 index 0000000..faf7fd8 --- /dev/null +++ b/ContainersCore/System/Services/ImageService.swift @@ -0,0 +1,320 @@ +// +// ImageService.swift +// Containers +// +// In-process image management service wrapping ImageStore and EXT4Unpacker. +// +// Created by Axel on 17/3/26. +// + +import Containerization +import ContainerizationError +import ContainerizationExtras +import ContainerizationOCI +import ContainerizationOS +import Foundation +import Logging + +/// A service that handles container images, wrapping ImageStore and EXT4Unpacker. +struct ImageService { + static let snapshotFilename = "snapshot" + static let snapshotInfoFilename = "snapshot-info" + + private let imageStore: ImageStore + /// The content the image store's images are made of, which a build also reads and writes. + let contentStore: ContentStore + /// The folder unpacked images are kept in, one snapshot per platform. + let snapshotsPath: URL + + private let ingestPath: URL + private let log: Logger + + init(contentStore: ContentStore, imageStore: ImageStore, snapshotsPath: URL, log: Logger) throws { + self.contentStore = contentStore + self.imageStore = imageStore + self.snapshotsPath = snapshotsPath + self.ingestPath = snapshotsPath.appendingPathComponent("ingest") + self.log = log + + try FileManager.default.createDirectory(at: ingestPath, withIntermediateDirectories: true) + } + + // MARK: - Internal API + + /// List all images in the store. + func list() async throws -> [ImageDescription] { + try await imageStore.list().map(\.description) + } + + /// The image stored under a reference. + func image(for reference: String) async throws -> Containerization.Image { + try await imageStore.get(reference: reference) + } + + /// The environment variables an image's configuration sets for its process. + func environment(of description: ImageDescription, platform: Platform) async throws -> [String] { + let image = try await imageStore.get(reference: description.reference) + + return try await image.config(for: platform).config?.env ?? [] + } + + /// Get a Filesystem representing the unpacked image snapshot. + func getImageSnapshot(description: ImageDescription, platform: Platform) async throws -> Filesystem { + let image = try await imageStore.get(reference: description.reference) + let directory = try await snapshotDirectory(for: image, platform: platform) + let info = directory.appendingPathComponent(Self.snapshotInfoFilename) + + guard FileManager.default.fileExists(atPath: info.path), + FileManager.default.fileExists(atPath: directory.appendingPathComponent(Self.snapshotFilename).path) + else { + throw ContainerizationError( + .notFound, + message: "image snapshot not found at \(directory.path). Was the image unpacked?" + ) + } + + return try JSONDecoder().decode(Filesystem.self, from: Data(contentsOf: info)) + } + + /// Save images to an OCI layout directory. + func save(references: [String], out: URL, platform: Platform?) async throws { + try await imageStore.save(references: references, out: out, platform: platform) + } + + /// One folder per platform manifest, named for its digest. + func snapshotDirectory(for image: Containerization.Image, platform: Platform) async throws -> URL { + let descriptor = try await image.descriptor(for: platform) + + return snapshotsPath.appendingPathComponent(descriptor.digest.digestHex, isDirectory: true) + } + + /// Pull an image from a remote registry. + func pull( + reference: String, + platform: Platform?, + insecure: Bool, + auth: Authentication? = nil, + progressUpdate: ProgressHandler? + ) async throws -> ImageDescription { + // Try provided auth first, then keychain, then environment variables + let resolvedAuth = auth ?? resolveAuthentication(for: reference) + + let image = try await imageStore.pull( + reference: reference, + platform: platform, + insecure: insecure, + auth: resolvedAuth, + progress: progressUpdate + ) + return image.description + } + + /// Unpack an image to an EXT4 block device for use as a container rootfs. + func unpack( + description: ImageDescription, + platform: Platform?, + progressUpdate: ProgressHandler? + ) async throws { + let image = try await imageStore.get(reference: description.reference) + let targetPlatform = platform ?? .current + let directory = try await snapshotDirectory(for: image, platform: targetPlatform) + + guard !FileManager.default.fileExists(atPath: directory.path) else { return } + + // Unpacked beside the snapshots and moved into place whole, so that a snapshot is never + // found half written. + let ingestDirectory = ingestPath.appendingPathComponent(UUID().uuidString) + + try FileManager.default.createDirectory(at: ingestDirectory, withIntermediateDirectories: true) + + do { + let initImage = DefaultsStore.get(key: .defaultInitImage) + let capacity = image.reference == initImage ? 512.mib() : 512.gib() + let unpacker = EXT4Unpacker(capacityInBytes: capacity, journal: .init(defaultMode: .ordered)) + let mount = try await unpacker.unpack( + image, + for: targetPlatform, + at: ingestDirectory.appendingPathComponent(Self.snapshotFilename), + progress: progressUpdate + ) + let snapshot = Filesystem.block( + format: mount.type, + source: directory.appendingPathComponent(Self.snapshotFilename).path, + destination: mount.destination, + options: mount.options + ) + let info = try JSONEncoder().encode(snapshot) + + try info.write(to: ingestDirectory.appendingPathComponent(Self.snapshotInfoFilename)) + try FileManager.default.moveItem(at: ingestDirectory, to: directory) + } catch let error as NSError where error.code == NSFileWriteFileExistsError { + // Another unpack of the same image got there first. + try? FileManager.default.removeItem(at: ingestDirectory) + } catch { + try? FileManager.default.removeItem(at: ingestDirectory) + throw error + } + } + + /// The references loading the OCI layout in `directory` records, read from its index in the order the image + /// store reads them, so they're known before any is recorded. + /// + /// - Parameter directory: The OCI layout. + /// - Returns: One reference for each image in the layout. + /// - Throws: An error if the layout's index can't be read. + func references(inLayout directory: URL) throws -> [String] { + let data = try Data(contentsOf: directory.appendingPathComponent("index.json")) + let index = try JSONDecoder().decode(ContainerizationOCI.Index.self, from: data) + + return index.manifests.map { descriptor in + let annotations = descriptor.annotations ?? [:] + + return annotations[AnnotationKeys.containerizationImageName] + ?? annotations[AnnotationKeys.containerdImageName] + ?? annotations[AnnotationKeys.openContainersImageName] + ?? "untagged@\(descriptor.digest)" + } + } + + /// Load images from an OCI layout directory on disk. + func load(from directory: URL, force: Bool = false) async throws -> ([ImageDescription], [String]) { + let images = try await imageStore.load(from: directory) + let descriptions = images.map { $0.description } + let references = descriptions.map { $0.reference } + return (descriptions, references) + } + + /// Tag an image with a new reference. + func tag(existing: String, new: String) async throws -> ImageDescription { + let image = try await imageStore.tag(existing: existing, new: new) + return image.description + } + + /// Push an image to a remote registry. + func push( + reference: String, + platform: Platform?, + insecure: Bool, + auth: Authentication? = nil, + progressUpdate: ProgressHandler? + ) async throws { + let resolvedAuth = auth ?? resolveAuthentication(for: reference) + + try await imageStore.push( + reference: reference, + platform: platform, + insecure: insecure, + auth: resolvedAuth, + progress: progressUpdate + ) + } + + /// Delete an image by reference. + func delete(reference: String, garbageCollect: Bool = false) async throws { + try await imageStore.delete(reference: reference, performCleanup: garbageCollect) + } + + /// Deletes images that work which was cancelled had added, with the content and snapshots only they used, + /// as no work is resumed. Each is deleted as far as it can be: what's left behind can't make the + /// cancellation fail. + /// + /// - Parameter references: The images' references. + func discard(references: [String]) async { + guard !references.isEmpty else { return } + + // One the work never got to record, such as a pull stopped while fetching, has nothing to delete. + let stored = Set((try? await list().map(\.reference)) ?? references) + + for reference in references where stored.contains(reference) { + do { + try await delete(reference: reference) + } catch { + log.error("Failed to discard image \(reference): \(error)") + } + } + + do { + try await cleanUpOrphanedBlobs() + } catch { + log.error("Failed to clean up after discarding images: \(error)") + } + } + + /// Deletes the snapshots and content that no image uses anymore, which deleting an image leaves behind. + /// + /// - Returns: The digests of the content deleted, and the bytes freed on disk. + @discardableResult + func cleanUpOrphanedBlobs() async throws -> (deleted: [String], freed: UInt64) { + let freedSnapshotBytes = try await cleanUpSnapshots(keepingSnapshotsFor: try await imageStore.list()) + let (deleted, freedContentBytes) = try await imageStore.cleanUpOrphanedBlobs() + + return (deleted, freedContentBytes + freedSnapshotBytes) + } + + // MARK: - Private Helpers + + /// Deletes every snapshot except those of `images`, leaving the folder that unpacks are made in. + /// + /// - Returns: The bytes freed on disk. + private func cleanUpSnapshots(keepingSnapshotsFor images: [Containerization.Image]) async throws -> UInt64 { + var namesToKeep: Set = [ingestPath.lastPathComponent] + + for image in images { + for manifest in try await image.index().manifests { + guard let platform = manifest.platform else { continue } + + namesToKeep.insert(try await image.descriptor(for: platform).digest.digestHex) + } + } + + let names = try FileManager.default.contentsOfDirectory(atPath: snapshotsPath.path) + var freedBytes: UInt64 = 0 + + for name in names where !namesToKeep.contains(name) { + let directory = snapshotsPath.appendingPathComponent(name, isDirectory: true) + + freedBytes += UInt64(await FileIO.shared.allocatedSize(of: directory)) + try FileManager.default.removeItem(at: directory) + } + + return freedBytes + } + + /// Security domain for keychain credential lookups. + private static let keychainDomain = "app.containers.registry" + + /// Resolve authentication for a registry reference. + private func resolveAuthentication(for reference: String) -> Authentication? { + guard let hostname = Self.extractHostname(from: reference) else { + return nil + } + + // 1. Check environment variables (highest priority, enables CI/CD) + let env = ProcessInfo.processInfo.environment + if env["CONTAINER_REGISTRY_HOST"] == hostname, + let user = env["CONTAINER_REGISTRY_USER"], + let token = env["CONTAINER_REGISTRY_TOKEN"] + { + return BasicAuthentication(username: user, password: token) + } + + // 2. Check macOS Keychain (credentials stored via `container registry login`) + let keychain = KeychainHelper(securityDomain: Self.keychainDomain) + if let keychainAuth = try? keychain.lookup(hostname: hostname) { + return keychainAuth + } + + // 3. No credentials found — return nil for anonymous access. + // The RegistryClient handles the 401 → Bearer token exchange for public images. + return nil + } + + /// Extract the registry hostname from an image reference. + private static func extractHostname(from reference: String) -> String? { + guard let parsed = try? ContainerizationOCI.Reference.parse(reference) + else { + return nil + } + return parsed.resolvedDomain + } +} diff --git a/ContainerSystem/Runtime/Services/KernelService.swift b/ContainersCore/System/Services/KernelService.swift similarity index 52% rename from ContainerSystem/Runtime/Services/KernelService.swift rename to ContainersCore/System/Services/KernelService.swift index 0e78233..ddc8228 100644 --- a/ContainerSystem/Runtime/Services/KernelService.swift +++ b/ContainersCore/System/Services/KernelService.swift @@ -10,11 +10,12 @@ import Containerization import ContainerizationArchive import ContainerizationError +import CryptoKit import Foundation import Logging /// Service for handling Linux kernel binaries used by container VMs. -actor KernelService { +struct KernelService: Sendable { private let log: Logger private let kernelsRoot: URL @@ -25,9 +26,14 @@ actor KernelService { try FileManager.default.createDirectory(at: kernelsRoot, withIntermediateDirectories: true) } + /// The link naming each platform's default kernel. + private func defaultKernelLink(for platform: SystemPlatform) -> URL { + kernelsRoot.appendingPathComponent("default.kernel-\(platform.architecture.rawValue)") + } + /// Get the default kernel for the given platform. func getDefaultKernel(platform: SystemPlatform) async throws -> Kernel { - let kernelPath = kernelsRoot.appendingPathComponent("default-\(platform.architecture.rawValue)") + let kernelPath = defaultKernelLink(for: platform).resolvingSymlinksInPath() guard FileManager.default.fileExists(atPath: kernelPath.path) else { throw ContainerizationError( @@ -39,7 +45,8 @@ actor KernelService { return Kernel(path: kernelPath, platform: platform) } - /// Install a kernel binary for the given platform from a tar archive. + /// Install a kernel binary for the given platform from a tar archive, and make it the + /// platform's default. /// /// Reading the kernel out of the archive is tens of megabytes of blocking /// I/O, so it runs on this actor rather than on the caller that asked @@ -48,26 +55,65 @@ actor KernelService { tar tarFile: URL, kernelFilePath: String, platform: SystemPlatform, + expectedDigest: String? = nil, force: Bool = false ) async throws { - let destination = kernelsRoot.appendingPathComponent("default-\(platform.architecture.rawValue)") + let link = defaultKernelLink(for: platform) - if FileManager.default.fileExists(atPath: destination.path) { - guard force else { - log.info("Kernel already installed for \(platform.architecture.rawValue), skipping") - return - } + if FileManager.default.fileExists(atPath: link.resolvingSymlinksInPath().path), !force { + log.info("Kernel already installed for \(platform.architecture.rawValue), skipping") + return + } - try FileManager.default.removeItem(at: destination) + if let expectedDigest { + try Self.verifyDigest(of: tarFile, expected: expectedDigest) } let kernel = try extractFile(tarFile: tarFile, at: kernelFilePath) + let destination = kernelsRoot.appendingPathComponent(URL(filePath: kernelFilePath).lastPathComponent) try kernel.write(to: destination, options: .atomic) + // Relative, so the link still resolves if the folder is reached by another path. + try? FileManager.default.removeItem(at: link) + try FileManager.default.createSymbolicLink( + atPath: link.path, + withDestinationPath: destination.lastPathComponent + ) + log.info("Kernel installed at \(destination.path), size: \(kernel.count) bytes") } + /// Checks an archive against a `sha256:` digest. + static func verifyDigest(of file: URL, expected: String) throws { + guard !expected.isEmpty else { + throw ContainerizationError(.invalidArgument, message: "kernel.digest is required when kernel.url is not the default URL") + } + + let parts = expected.lowercased().split(separator: ":", maxSplits: 1, omittingEmptySubsequences: false) + + guard parts.count == 2, parts[0] == "sha256", parts[1].count == 64, parts[1].allSatisfy(\.isHexDigit) else { + throw ContainerizationError(.invalidArgument, message: "invalid kernel archive digest '\(expected)'") + } + + var hasher = SHA256() + let handle = try FileHandle(forReadingFrom: file) + defer { try? handle.close() } + + while let data = try handle.read(upToCount: 1024 * 1024), !data.isEmpty { + hasher.update(data: data) + } + + let actual = hasher.finalize().map { String(format: "%02x", $0) }.joined() + + guard actual == parts[1] else { + throw ContainerizationError( + .invalidState, + message: "kernel archive digest mismatch: expected sha256:\(parts[1]), got sha256:\(actual)" + ) + } + } + /// Extract a file from an archive, returning its bytes rather than a path. private func extractFile(tarFile: URL, at path: String) throws -> Data { log.info("Extracting \(path) from archive: \(tarFile.path)") diff --git a/ContainersCore/System/Services/NetworkService.swift b/ContainersCore/System/Services/NetworkService.swift new file mode 100644 index 0000000..b72aecb --- /dev/null +++ b/ContainersCore/System/Services/NetworkService.swift @@ -0,0 +1,81 @@ +// +// NetworkService.swift +// Containers +// +// The networks containers attach to, as the system's folder keeps them. +// +// Created by Axel Martinez on 2026/11/05. +// + +import ContainerizationError +import ContainerizationExtras +import Foundation +import Logging + +/// The networks kept in the system's folder, which containers attach to. +/// +/// The interfaces containers get on them are ``ContainerService``'s, as they change with each container's state. +struct NetworkService { + let appRoot: URL + let log: Logger + + /// Every network, sorted by name, with the built-in one stored the first time it's asked for. + func list() async throws -> [NetworkConfiguration] { + var networks = try await store().list() + + if !networks.contains(where: { $0.name == NetworkConfiguration.defaultName }) { + let builtin = try NetworkConfiguration.builtin(subnet: DefaultsStore.configuration.subnet.flatMap { try? CIDRv4($0) }) + + try await store().create(builtin) + networks.append(builtin) + } + + return networks.sorted { $0.name < $1.name } + } + + func create(_ configuration: NetworkConfiguration) async throws { + let networks = try await list() + + guard !networks.contains(where: { $0.name == configuration.name }) else { + throw ContainerizationError(.exists, message: "network \(configuration.name) already exists") + } + + if let subnet = configuration.ipv4Subnet, + let overlap = networks.first(where: { other in + other.ipv4Subnet.map { $0.lower.value <= subnet.upper.value && subnet.lower.value <= $0.upper.value } ?? false + }) + { + throw ContainerizationError(.exists, message: "IPv4 subnet \(subnet) overlaps network \(overlap.name)") + } + + try await store().create(configuration) + } + + /// Deletes a network, unless it's the built-in one or a container uses it. + /// + /// - Parameters: + /// - name: The network to delete. + /// - containerIDs: The containers configured to attach to the network, running or not. + /// - Throws: An error if the network doesn't exist, is the built-in one, or a container uses it. + func delete(named name: String, inUseBy containerIDs: [String]) async throws { + guard let network = try await list().first(where: { $0.name == name }) else { + throw ContainerizationError(.notFound, message: "network \(name) not found") + } + + guard !network.isBuiltin else { + throw ContainerizationError(.invalidArgument, message: "cannot delete builtin network: \(name)") + } + + guard containerIDs.isEmpty else { + let names = containerIDs.sorted().joined(separator: ", ") + throw ContainerizationError(.invalidState, message: "cannot delete network \(name) used by containers: \(names)") + } + + try await store().delete(name) + } + + /// The networks kept in the system's folder, whose directory is made the first time it's needed. + private func store() throws -> FilesystemEntityStore { + try FilesystemEntityStore(path: appRoot.appendingPathComponent("networks"), type: "networks", log: log) + } +} diff --git a/ContainerSystem/Runtime/Services/ReportsService.swift b/ContainersCore/System/Services/ReportService.swift similarity index 98% rename from ContainerSystem/Runtime/Services/ReportsService.swift rename to ContainersCore/System/Services/ReportService.swift index c2741af..d924da6 100644 --- a/ContainerSystem/Runtime/Services/ReportsService.swift +++ b/ContainersCore/System/Services/ReportService.swift @@ -1,5 +1,5 @@ // -// ReportsService.swift +// ReportService.swift // Containers // // Keeps the reports of failed work. @@ -11,7 +11,7 @@ import Foundation import Logging /// Service for the reports generated from tasks, kept in a `ReportStore` under the app root. -actor ReportsService { +actor ReportService { private static let folderName = "reports" private let log: Logger diff --git a/ContainersCore/System/Services/VolumeService.swift b/ContainersCore/System/Services/VolumeService.swift new file mode 100644 index 0000000..0f2786c --- /dev/null +++ b/ContainersCore/System/Services/VolumeService.swift @@ -0,0 +1,168 @@ +// +// VolumeService.swift +// Containers +// +// The volumes containers mount, as ext4 disk images in the system's folder. +// +// Created by Axel Martinez on 2026/11/06. +// + +import ContainerizationEXT4 +import Foundation +import Logging +import SystemPackage + +/// The volumes kept in the system's folder, each an ext4 disk image beside its entry in the store. +struct VolumeService { + private static let blockFile = "volume.img" + + let volumesRoot: URL + let log: Logger + + init(appRoot: URL, log: Logger) { + self.volumesRoot = appRoot.appendingPathComponent("volumes") + self.log = log + } + + func list() async throws -> [VolumeConfiguration] { + try await store().list() + } + + /// Creates a volume, formatting its disk image. + /// + /// - Parameters: + /// - name: The volume's name, which must be unique and use only valid characters. + /// - labels: Labels to add to the volume. + /// - options: Driver options for the volume, such as its `size` and `journal`. + /// - sizeInBytes: The volume's size, or `nil` for the one in `options`, or the default size. + /// - Returns: The new volume. + /// - Throws: An error if the name isn't valid, a volume with that name exists, or the volume can't be created. + func create(name: String, labels: [String: String], options: [String: String], sizeInBytes: UInt64?) async throws -> VolumeConfiguration { + guard VolumeStorage.isValidVolumeName(name) else { + throw VolumeError.invalidVolumeName("invalid volume name '\(name)': must match \(VolumeStorage.volumeNamePattern)") + } + + let store = try store() + + if try await store.list().contains(where: { $0.name == name }) { + throw VolumeError.volumeAlreadyExists(name) + } + + let volumeDirectory = volumesRoot.appendingPathComponent(name) + + try FileManager.default.createDirectory(at: volumeDirectory, withIntermediateDirectories: true) + + let blockPath = volumeDirectory.appendingPathComponent(Self.blockFile).path + var options = options + + // Kept in the options, which is where the size is read back from. + if let sizeInBytes { + options["size"] = "\(sizeInBytes)" + } + + let filesystemSize: UInt64 + let journal: EXT4.JournalConfig? + + do { + filesystemSize = try options["size"].map(Self.parseSize) ?? VolumeStorage.defaultVolumeSizeBytes + journal = try options["journal"].map(Self.parseJournal) + } catch { + try? FileManager.default.removeItem(at: volumeDirectory) + + throw error + } + + do { + let formatter = try EXT4.Formatter(FilePath(blockPath), blockSize: 4096, minDiskSize: filesystemSize, journal: journal) + + try formatter.close() + } catch { + try? FileManager.default.removeItem(at: volumeDirectory) + + throw VolumeError.storageError("failed to create volume image: \(error)") + } + + let volume = VolumeConfiguration( + name: name, + driver: "local", + format: "ext4", + source: blockPath, + labels: labels, + options: options, + sizeInBytes: filesystemSize + ) + + do { + try await store.create(volume) + } catch { + try? FileManager.default.removeItem(at: volumeDirectory) + throw error + } + + return volume + } + + /// Deletes a volume and its disk image, unless a container uses it. + /// + /// - Parameters: + /// - name: The volume to delete. + /// - containerIDs: The containers configured to mount the volume, running or not. + /// - Throws: An error if a container uses the volume, or it can't be deleted. + func delete(named name: String, inUseBy containerIDs: [String]) async throws { + guard containerIDs.isEmpty else { + throw VolumeError.volumeInUse(name) + } + + try await store().delete(name) + + let volumeDirectory = volumesRoot.appendingPathComponent(name) + + if FileManager.default.fileExists(atPath: volumeDirectory.path) { + try FileManager.default.removeItem(at: volumeDirectory) + } + } + + /// The volumes in the system's folder, whose directory is made the first time it's needed. + private func store() throws -> FilesystemEntityStore { + try FilesystemEntityStore(path: volumesRoot, type: "volumes", log: log) + } + + // MARK: - Driver Options + + /// Reads a volume's size, which must be at least 1 MiB. + static func parseSize(_ value: String) throws -> UInt64 { + let bytes = try parseBytes(value) + + guard bytes >= 1024 * 1024 else { + throw VolumeError.storageError("volume size too small: minimum 1MiB") + } + + return bytes + } + + /// Reads a journal: `mode` or `mode:size`, with the mode `writeback`, `ordered` or `journal`. + static func parseJournal(_ value: String) throws -> EXT4.JournalConfig { + let parts = value.split(separator: ":", maxSplits: 1) + let mode: EXT4.JournalConfig.JournalMode + + switch parts.first.map(String.init) { + case "writeback": mode = .writeback + case "ordered": mode = .ordered + case "journal": mode = .journal + default: + throw VolumeError.storageError("invalid journal mode '\(parts.first ?? "")': must be writeback, ordered, or journal") + } + + let size = try parts.count > 1 ? parseBytes(String(parts[1])) : nil + + return EXT4.JournalConfig(size: size, defaultMode: mode) + } + + private static func parseBytes(_ value: String) throws -> UInt64 { + guard let bytes = ByteSize.bytes(from: value) else { + throw VolumeError.storageError("invalid volume size '\(value)'") + } + + return bytes + } +} diff --git a/ContainerSystem/Volume/Volume.swift b/ContainersCore/Volume/VolumeConfiguration.swift similarity index 56% rename from ContainerSystem/Volume/Volume.swift rename to ContainersCore/Volume/VolumeConfiguration.swift index 058a2f3..61b5e05 100644 --- a/ContainerSystem/Volume/Volume.swift +++ b/ContainersCore/Volume/VolumeConfiguration.swift @@ -1,17 +1,17 @@ // -// Volume.swift +// VolumeConfiguration.swift // Containers // import Foundation -/// Represents a container volume. -public struct Volume: Sendable, Codable, Identifiable, Equatable { +/// What a volume was created as. +public struct VolumeConfiguration: Sendable, Codable, Identifiable, Equatable { public var name: String public var driver: String public var format: String public var source: String - public var createdAt: Date + public var creationDate: Date public var labels: [String: String] public var options: [String: String] public var sizeInBytes: UInt64? @@ -19,7 +19,7 @@ public struct Volume: Sendable, Codable, Identifiable, Equatable { public var id: String { name } /// Label key used to mark anonymous volumes. - public static let anonymousLabel = "app.containers.resource.anonymous" + public static let anonymousLabel = "com.apple.container.resource.anonymous" /// Whether this volume is anonymous (auto-created, not explicitly named by user). public var isAnonymous: Bool { @@ -31,7 +31,7 @@ public struct Volume: Sendable, Codable, Identifiable, Equatable { driver: String = "local", format: String = "ext4", source: String = "", - createdAt: Date = Date(), + creationDate: Date = Date(), labels: [String: String] = [:], options: [String: String] = [:], sizeInBytes: UInt64? = nil @@ -40,13 +40,54 @@ public struct Volume: Sendable, Codable, Identifiable, Equatable { self.driver = driver self.format = format self.source = source - self.createdAt = createdAt + self.creationDate = creationDate self.labels = labels self.options = options self.sizeInBytes = sizeInBytes } } +extension VolumeConfiguration { + enum CodingKeys: String, CodingKey { + case name + case driver + case format + case source + case creationDate + case labels + case options + case sizeInBytes + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + + self.name = try container.decode(String.self, forKey: .name) + self.driver = try container.decode(String.self, forKey: .driver) + self.format = try container.decode(String.self, forKey: .format) + self.source = try container.decode(String.self, forKey: .source) + self.creationDate = + try container.decodeIfPresent(Date.self, forKey: .creationDate) + ?? Date(timeIntervalSince1970: 0) + self.labels = try container.decodeIfPresent([String: String].self, forKey: .labels) ?? [:] + self.options = try container.decodeIfPresent([String: String].self, forKey: .options) ?? [:] + self.sizeInBytes = try container.decodeIfPresent(UInt64.self, forKey: .sizeInBytes) + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + try container.encode(name, forKey: .name) + try container.encode(driver, forKey: .driver) + try container.encode(format, forKey: .format) + try container.encode(source, forKey: .source) + try container.encode(creationDate, forKey: .creationDate) + try container.encode(labels, forKey: .labels) + try container.encode(options, forKey: .options) + try container.encodeIfPresent(sizeInBytes, forKey: .sizeInBytes) + } +} + /// Errors related to volume operations. public enum VolumeError: Error, LocalizedError { case volumeNotFound(String) diff --git a/ContainersCore/Volume/VolumeResource.swift b/ContainersCore/Volume/VolumeResource.swift new file mode 100644 index 0000000..2147756 --- /dev/null +++ b/ContainersCore/Volume/VolumeResource.swift @@ -0,0 +1,43 @@ +// +// VolumeResource.swift +// Containers +// + +import Foundation + +/// A volume, as it was configured. +public struct VolumeResource: ManagedResource, Codable, Equatable { + public let configuration: VolumeConfiguration + + public var id: String { configuration.name } + public var name: String { configuration.name } + public var creationDate: Date { configuration.creationDate } + /// Empty where any of the configuration's labels isn't valid. + public var labels: ResourceLabels { (try? ResourceLabels(configuration.labels)) ?? ResourceLabels() } + public var isAnonymous: Bool { configuration.isAnonymous } + + public init(configuration: VolumeConfiguration) { + self.configuration = configuration + } +} + +// Coded with the id alongside, so a volume can be read back in the same shape. +extension VolumeResource { + enum CodingKeys: String, CodingKey { + case id + case configuration + } + + public func encode(to encoder: Encoder) throws { + var container = encoder.container(keyedBy: CodingKeys.self) + + try container.encode(id, forKey: .id) + try container.encode(configuration, forKey: .configuration) + } + + public init(from decoder: Decoder) throws { + let container = try decoder.container(keyedBy: CodingKeys.self) + + self.configuration = try container.decode(VolumeConfiguration.self, forKey: .configuration) + } +} diff --git a/ContainersCoreTests/AppRootTests.swift b/ContainersCoreTests/AppRootTests.swift new file mode 100644 index 0000000..56455ef --- /dev/null +++ b/ContainersCoreTests/AppRootTests.swift @@ -0,0 +1,81 @@ +// +// AppRootTests.swift +// ContainersCoreTests +// +// Keeping the container system's data out of the container CLI's folder. +// + +import Foundation +import Testing + +@testable import ContainersCore + +@Suite("App root") +struct AppRootTests { + @Test("A folder the container CLI has started in can't hold the system's data") + func refusesCLIFolder() throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + #expect(ContainerSystem.canStoreData(in: directory.url)) + + try writeAPIServerPlist(in: directory.url) + + #expect(!ContainerSystem.canStoreData(in: directory.url)) + } + + @Test("The folders around and beside the container CLI's can hold the system's data") + func acceptsFoldersAroundCLIFolder() throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + let cliFolder = directory.url.appending(path: "cli") + let unrelated = directory.url.appending(path: "other") + + try FileManager.default.createDirectory(at: unrelated, withIntermediateDirectories: true) + try writeAPIServerPlist(in: cliFolder) + + #expect(!ContainerSystem.canStoreData(in: cliFolder)) + #expect(ContainerSystem.canStoreData(in: directory.url)) + #expect(ContainerSystem.canStoreData(in: unrelated)) + } + + @Test("The system doesn't start in the container CLI's folder") + @MainActor + func doesNotStartInCLIFolder() async throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + try writeAPIServerPlist(in: directory.url) + + let containerSystem = MockContainerSystem() + + await #expect(throws: ContainerSystem.AppRootError.containerCLIFolder) { + try await containerSystem.start(appRoot: directory.url) + } + + #expect(containerSystem.status == .failed) + } + + @Test("The system starts in a folder of its own") + @MainActor + func startsInOwnFolder() async throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + let containerSystem = MockContainerSystem() + + try await containerSystem.start(appRoot: directory.url) + + #expect(containerSystem.status == .running) + + try await containerSystem.stop() + } + + private func writeAPIServerPlist(in folder: URL) throws { + let plist = folder.appending(path: "apiserver/apiserver.plist") + + try FileManager.default.createDirectory(at: plist.deletingLastPathComponent(), withIntermediateDirectories: true) + try Data("".utf8).write(to: plist) + } +} diff --git a/ContainerSystemTests/ContainerManagerTests.swift b/ContainersCoreTests/ContainerManagerTests.swift similarity index 60% rename from ContainerSystemTests/ContainerManagerTests.swift rename to ContainersCoreTests/ContainerManagerTests.swift index db30e16..31f1208 100644 --- a/ContainerSystemTests/ContainerManagerTests.swift +++ b/ContainersCoreTests/ContainerManagerTests.swift @@ -1,6 +1,6 @@ // // ContainerManagerTests.swift -// ContainerSystemTests +// ContainersCoreTests // // Created by Axel Martinez on 2026/02/08. // @@ -9,7 +9,7 @@ import ContainerizationError import Foundation import Testing -@testable import ContainerSystem +@testable import ContainersCore @Suite("Container manager") struct ContainerManagerTests { @@ -17,15 +17,14 @@ struct ContainerManagerTests { // MARK: - Setup Helper @MainActor - private func setupTestSystem() async throws -> (URL, ContainerRuntime) { + private func setupTestSystem() async throws -> (URL, ContainerSystem) { let appRoot = FileManager.default.temporaryDirectory .appendingPathComponent("test-containers-\(UUID().uuidString)") - let testRuntime = MockContainerRuntime() - let system = SystemManager(testRuntime: testRuntime) - try await system.start(appRoot: appRoot) + let containerSystem = MockContainerSystem() + try await containerSystem.start(appRoot: appRoot) - return (appRoot, testRuntime) + return (appRoot, containerSystem) } // MARK: - List Containers Tests @@ -33,10 +32,10 @@ struct ContainerManagerTests { @Test("Empty store lists no containers") @MainActor func emptyStoreListsNoContainers() async throws { - let (_, testRuntime) = try await setupTestSystem() + let (_, containerSystem) = try await setupTestSystem() - let manager = ContainerManager(testRuntime: testRuntime) - let containers = try await manager.list() + let containerManager = ContainerManager(testSystem: containerSystem) + let containers = try await containerManager.list() #expect(containers.isEmpty) } @@ -46,11 +45,11 @@ struct ContainerManagerTests { @Test("Get missing container throws") @MainActor func getMissingContainerThrows() async throws { - let (_, testRuntime) = try await setupTestSystem() + let (_, containerSystem) = try await setupTestSystem() - let manager = ContainerManager(testRuntime: testRuntime) + let containerManager = ContainerManager(testSystem: containerSystem) do { - _ = try await manager.get(id: "nonexistent-container-id") + _ = try await containerManager.container(withID: "nonexistent-container-id") Issue.record("Expected ContainerizationError") } catch let error as ContainerizationError { #expect(error.code == .notFound) diff --git a/ContainerSystemTests/ContainersServiceTests.swift b/ContainersCoreTests/ContainerServiceTests.swift similarity index 66% rename from ContainerSystemTests/ContainersServiceTests.swift rename to ContainersCoreTests/ContainerServiceTests.swift index f6b44a2..e8512b4 100644 --- a/ContainerSystemTests/ContainersServiceTests.swift +++ b/ContainersCoreTests/ContainerServiceTests.swift @@ -1,6 +1,6 @@ // -// ContainersServiceTests.swift -// ContainerSystemTests +// ContainerServiceTests.swift +// ContainersCoreTests // // Created by Axel Martinez on 2026/02/08. // @@ -12,22 +12,27 @@ import Foundation import Logging import Testing -@testable import ContainerSystem +@testable import ContainersCore -@Suite("Containers service") -struct ContainersServiceTests { - private func makeService(in directory: TemporaryDirectory) throws -> ContainersService { +@Suite("Container service") +struct ContainerServiceTests { + private func makeService(in directory: TemporaryDirectory) throws -> ContainerService { let log = Logger(label: "tests.containers") let imagesRoot = directory.appending("images") let contentStore = try LocalContentStore(path: imagesRoot.appendingPathComponent("content")) - let images = try ImagesService( + let images = try ImageService( contentStore: contentStore, imageStore: try ImageStore(path: imagesRoot, contentStore: contentStore), snapshotsPath: imagesRoot.appendingPathComponent("snapshots"), log: log ) - return try ContainersService(appRoot: directory.url, imagesService: images, log: log) + return try ContainerService( + appRoot: directory.url, + imageService: images, + networkService: NetworkService(appRoot: directory.url, log: log), + log: log + ) } /// Writes the files a container's bundle is read back from at launch. @@ -45,7 +50,7 @@ struct ContainersServiceTests { id: id, image: ImageDescription( reference: "docker.io/library/alpine:latest", - descriptor: Descriptor(mediaType: "", digest: "", size: 0) + descriptor: Descriptor(mediaType: "", digest: "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", size: 0) ), process: ProcessConfiguration(executable: "/bin/sh") ) @@ -57,6 +62,46 @@ struct ContainersServiceTests { try bundle.write(filename: "options.json", value: ContainerCreateOptions(autoRemove: autoRemove)) } + @Test("A container is set up with its sysctls, init, shared memory and DNS") + func configuresContainer() throws { + var configuration = ContainerConfiguration( + id: "web", + image: ImageDescription( + reference: "docker.io/library/alpine:latest", + descriptor: Descriptor(mediaType: "", digest: "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", size: 0) + ), + process: ProcessConfiguration(executable: "/bin/sh") + ) + configuration.sysctls = ["net.core.somaxconn": "1024"] + configuration.useInit = true + configuration.shmSize = 1_048_576 + configuration.maskedPaths = [] + configuration.networks = [AttachmentConfiguration(network: "default", options: AttachmentOptions(hostname: "web.test."))] + configuration.dns = ContainerConfiguration.DNSConfiguration(nameservers: []) + + var czConfig = LinuxContainer.Configuration() + + try ContainerService.configureContainer( + czConfig: &czConfig, + config: configuration, + precomputedMounts: [], + precomputedSockets: [], + defaultNameservers: ["192.168.64.1"] + ) + + #expect(czConfig.sysctl["net.core.somaxconn"] == "1024") + #expect(czConfig.sysctl["vm.overcommit_memory"] == "1") + #expect(czConfig.sysctl["vm.max_map_count"] == "262144") + #expect(czConfig.useInit) + #expect(czConfig.maskedPaths.isEmpty) + #expect(czConfig.readonlyPaths == LinuxContainer.defaultReadonlyPaths()) + #expect(czConfig.hostname == "web") + #expect(czConfig.dns?.nameservers == ["192.168.64.1"]) + + let shm = try #require(czConfig.mounts.first { $0.destination == "/dev/shm" }) + #expect(shm.options.filter { $0.hasPrefix("size=") } == ["size=1048576"]) + } + @Test("Empty root lists no containers") func emptyRootListsNothing() async throws { let directory = try TemporaryDirectory() @@ -95,8 +140,8 @@ struct ContainersServiceTests { #expect(!FileManager.default.fileExists(atPath: directory.appending("containers/temporary").path)) } - @Test("Unreadable bundle is skipped") - func skipsUnreadableBundle() async throws { + @Test("An unreadable bundle, which an interrupted creation leaves, is removed") + func removesUnreadableBundle() async throws { let directory = try TemporaryDirectory() defer { directory.remove() } @@ -106,6 +151,7 @@ struct ContainersServiceTests { let containers = try await makeService(in: directory).list() #expect(containers.map(\.id) == ["web"]) + #expect(!FileManager.default.fileExists(atPath: directory.url.appendingPathComponent("containers/broken").path)) } @Test("List filters by status, label and name") @@ -167,6 +213,6 @@ struct ContainersServiceTests { await #expect(throws: ContainerizationError.self) { _ = try await service.exec(id: "web", arguments: ["true"]) } - #expect(await service.resourceUsage().isEmpty) + #expect(await service.stats().isEmpty) } } diff --git a/ContainersCoreTests/ContainerSystemTests.swift b/ContainersCoreTests/ContainerSystemTests.swift new file mode 100644 index 0000000..ca9cdce --- /dev/null +++ b/ContainersCoreTests/ContainerSystemTests.swift @@ -0,0 +1,209 @@ +// +// ContainerSystemTests.swift +// ContainersCoreTests +// +// Starting and stopping the container system, and stopping a start that is under way. +// + +import Foundation +import Testing + +@testable import ContainersCore + +/// A start that never finishes of its own accord, so that only cancelling +/// brings it to an end. +@MainActor +private final class NeverFinishingSystem: ContainerSystem { + private(set) var didFinish = false + + override func launch(appRoot: URL, installingKernel: Bool) async throws { + status = .starting + + defer { + settleStopped() + } + + try await Task.sleep(for: .seconds(30)) + + didFinish = true + } +} + +/// Needs the kernel, as the real system does the first time it starts. +@MainActor +private final class MissingKernelSystem: ContainerSystem { + override func launch(appRoot: URL, installingKernel: Bool) async throws { + startupError = ContainerSystem.SetupError.kernelInstallNotConfirmed + throw ContainerSystem.SetupError.kernelInstallNotConfirmed + } +} + +@Suite("Container system", .serialized) +@MainActor +struct ContainerSystemTests { + + @Test("Start system") + func startSystem() async throws { + let containerSystem = MockContainerSystem() + + let appRoot = FileManager.default.temporaryDirectory + .appendingPathComponent("test-containers-\(UUID().uuidString)") + + try await containerSystem.start(appRoot: appRoot) + + #expect(containerSystem.status == .running) + + try await containerSystem.stop() + } + + @Test("Start twice") + func startTwice() async throws { + let containerSystem = MockContainerSystem() + + let appRoot = FileManager.default.temporaryDirectory + .appendingPathComponent("test-containers-\(UUID().uuidString)") + + try await containerSystem.start(appRoot: appRoot) + #expect(containerSystem.status == .running) + + // Starting again should not cause error + try await containerSystem.start(appRoot: appRoot) + #expect(containerSystem.status == .running) + + try await containerSystem.stop() + } + + @Test("Stop system") + func stopSystem() async throws { + let containerSystem = MockContainerSystem() + + // Ensure system is started + let appRoot = FileManager.default.temporaryDirectory + .appendingPathComponent("test-containers-\(UUID().uuidString)") + + try await containerSystem.start(appRoot: appRoot) + #expect(containerSystem.status == .running) + + // Stop the system + try await containerSystem.stop() + + #expect(containerSystem.status == .notStarted) + } + + /// The sheet that offers to stop a first run is not always the thing that + /// began it: the dashboard starts the system on later launches and the + /// sheet only opens onto the work. Cancelling has to reach it either way. + @Test("Cancel start begun elsewhere") + func cancelsStartBegunElsewhere() async throws { + let containerSystem = NeverFinishingSystem() + + // Whoever is waiting here never cancels its own task, the way the + // dashboard's start task does not. + let work = Task { try await containerSystem.start(appRoot: .temporaryDirectory) } + + while containerSystem.status != .starting { + try await Task.sleep(for: .milliseconds(10)) + } + + containerSystem.cancelStart() + + await #expect(throws: CancellationError.self) { + try await work.value + } + + #expect(containerSystem.didFinish == false) + #expect(containerSystem.status == .notStarted) + } + + @Test("Cancel start from caller") + func cancelsStartFromTheCaller() async throws { + let containerSystem = NeverFinishingSystem() + + let work = Task { try await containerSystem.start(appRoot: .temporaryDirectory) } + + while containerSystem.status != .starting { + try await Task.sleep(for: .milliseconds(10)) + } + + work.cancel() + + await #expect(throws: CancellationError.self) { + try await work.value + } + + #expect(containerSystem.didFinish == false) + } + + @Test("Doesn't download the kernel until asked to") + func waitsForKernelConfirmation() async throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + let containerSystem = MockContainerSystem() + try await containerSystem.launch(appRoot: directory.url, installingKernel: false) + + await #expect(throws: ContainerSystem.SetupError.kernelInstallNotConfirmed) { + try await containerSystem.installPrerequisites(installingKernel: false) + } + + #expect(containerSystem.setupProgress == nil) + + try await containerSystem.shutdown() + } + + @Test("A start waiting for the kernel leaves the system stopped") + func reportsKernelConfirmation() { + let containerSystem = MockContainerSystem() + + containerSystem.startupError = ContainerSystem.SetupError.kernelInstallNotConfirmed + + // Stopped, not failed: the kernel is asked about when the user starts the system. + #expect(containerSystem.status == .notStarted) + #expect(containerSystem.needsKernelConfirmation) + } + + @Test("A start stops for the kernel") + func stopsForKernel() async throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + let containerSystem = MissingKernelSystem() + + await #expect(throws: ContainerSystem.SetupError.kernelInstallNotConfirmed) { + try await containerSystem.start(appRoot: directory.url) + } + + #expect(containerSystem.needsKernelConfirmation) + #expect(containerSystem.status == .notStarted) + } + + @Test("Cancel with nothing starting") + func cancelsNothingSafely() { + let containerSystem = NeverFinishingSystem() + + containerSystem.cancelStart() + + #expect(containerSystem.status == .notStarted) + } + + @Test("Starting removes what work the app quit or crashed during left, and keeps the folders") + func removesInterruptedWork() throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + let leftovers = ["content/ingest/session", "snapshots/ingest/unpack", "builder/build/out.tar"] + let kept = "content/blobs/sha256/kept" + + for path in leftovers + [kept] { + try directory.write("partial", to: path) + } + + MockContainerSystem().removeInterruptedWork(appRoot: directory.url) + + for folder in ContainerSystem.workFolders(in: directory.url) { + #expect(try FileManager.default.contentsOfDirectory(atPath: folder.path).isEmpty) + } + + #expect(FileManager.default.fileExists(atPath: directory.appending(kept).path)) + } +} diff --git a/ContainersCoreTests/DNSServiceTests.swift b/ContainersCoreTests/DNSServiceTests.swift new file mode 100644 index 0000000..4b84956 --- /dev/null +++ b/ContainersCoreTests/DNSServiceTests.swift @@ -0,0 +1,125 @@ +// +// DNSServiceTests.swift +// ContainersCoreTests +// +// Created by Axel Martinez on 2026/10/30. +// + +import Containerization +import ContainerizationExtras +import ContainerizationOCI +import Darwin +import Foundation +import Testing + +@testable import ContainersCore + +@Suite("DNS service") +struct DNSServiceTests { + private func snapshot(id: String, hostname: String, address: String, aliases: [String] = [], status: RuntimeStatus = .running) throws + -> ContainerSnapshot + { + var configuration = ContainerConfiguration( + id: id, + image: ImageDescription( + reference: "docker.io/library/alpine:latest", + descriptor: Descriptor(mediaType: "", digest: "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", size: 0) + ), + process: ProcessConfiguration(executable: "/bin/sh") + ) + configuration.networks = [AttachmentConfiguration(network: "default", options: AttachmentOptions(hostname: hostname, aliases: aliases))] + + let attachment = Attachment( + network: "default", + hostname: hostname, + ipv4Address: try CIDRv4("\(address)/24"), + ipv4Gateway: try IPv4Address("192.168.64.1") + ) + + return ContainerSnapshot(configuration: configuration, status: status, networks: [attachment]) + } + + @Test("Resolves a running container's hostname, then its exact aliases, then the longest subtree alias") + func matchesHostnamesAndAliases() throws { + let snapshots = [ + try snapshot(id: "web", hostname: "web.test.", address: "192.168.64.2", aliases: ["www.test", ".apps.test"]), + try snapshot(id: "api", hostname: "api.test.", address: "192.168.64.3", aliases: [".api.apps.test"]), + try snapshot(id: "old", hostname: "old.test.", address: "192.168.64.4", status: .stopped), + ] + + #expect(ContainerDNSHandler.attachment(for: "WEB.test.", in: snapshots)?.hostname == "web.test.") + #expect(ContainerDNSHandler.attachment(for: "www.test", in: snapshots)?.hostname == "web.test.") + #expect(ContainerDNSHandler.attachment(for: "blog.apps.test.", in: snapshots)?.hostname == "web.test.") + #expect(ContainerDNSHandler.attachment(for: "v1.api.apps.test.", in: snapshots)?.hostname == "api.test.") + #expect(ContainerDNSHandler.attachment(for: "old.test.", in: snapshots) == nil) + #expect(ContainerDNSHandler.attachment(for: "other.test.", in: snapshots) == nil) + } + + @Test("Reads the localhost domains from the CLI's resolver files") + func readsLocalhostDomains() throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + try directory.write("domain host.internal\nsearch host.internal\nnameserver 127.0.0.1\nport 1053\noptions localhost:203.0.113.10\n", to: "containerization.host.internal") + try directory.write("domain test\nnameserver 127.0.0.1\nport 2053\n", to: "containerization.test") + try directory.write("nameserver 10.0.0.1\n", to: "corp.example") + + let addresses = LocalhostDNSHandler.addresses(in: directory.url) + + #expect(addresses.count == 1) + #expect(addresses[try DNSName("host.internal")] == (try IPv4Address("203.0.113.10"))) + } + + @Test("Answers a query over UDP on the loopback address, from inside the app's sandbox") + func answersOverUDP() async throws { + let snapshots = [try snapshot(id: "web", hostname: "web.test.", address: "192.168.64.2")] + let handler = ContainerDNSHandler { snapshots } + let server = DNSServer(handler: StandardQueryValidator(handler: CompositeResolver(handlers: [handler, NxDomainResolver()]))) + let port = Int.random(in: 40_000..<50_000) + let serving = Task { try await server.run(host: "127.0.0.1", port: port) } + defer { serving.cancel() } + + // Lets the server bind before the query is sent. + try await Task.sleep(for: .milliseconds(200)) + + let query = Message(id: 42, type: .query, questions: [Question(name: "web.test.", type: .host)]) + let response = try Self.exchange(try query.serialize(), port: port) + let reply = try Message(deserialize: response) + + #expect(reply.id == 42) + #expect(reply.returnCode == .noError) + // The decoder reads only questions, so the answer is checked in the bytes: one answer, ending in its IPv4 address. + #expect(UInt16(response[6]) << 8 | UInt16(response[7]) == 1) + #expect(Array(response.suffix(4)) == [192, 168, 64, 2]) + } + + /// Sends a datagram to the loopback address and waits up to two seconds for the reply. + private static func exchange(_ request: Data, port: Int) throws -> Data { + let socket = Darwin.socket(AF_INET, SOCK_DGRAM, 0) + try #require(socket >= 0) + defer { close(socket) } + + var timeout = timeval(tv_sec: 2, tv_usec: 0) + setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, &timeout, socklen_t(MemoryLayout.size)) + + var address = sockaddr_in() + address.sin_family = sa_family_t(AF_INET) + address.sin_port = in_port_t(UInt16(port).bigEndian) + address.sin_addr.s_addr = inet_addr("127.0.0.1") + + let sent = request.withUnsafeBytes { bytes in + withUnsafePointer(to: &address) { pointer in + pointer.withMemoryRebound(to: sockaddr.self, capacity: 1) { + sendto(socket, bytes.baseAddress, bytes.count, 0, $0, socklen_t(MemoryLayout.size)) + } + } + } + try #require(sent == request.count) + + var buffer = [UInt8](repeating: 0, count: 512) + let received = recv(socket, &buffer, buffer.count, 0) + try #require(received > 0) + + return Data(buffer.prefix(received)) + } +} diff --git a/ContainerSystemTests/EntityNameTests.swift b/ContainersCoreTests/EntityNameTests.swift similarity index 97% rename from ContainerSystemTests/EntityNameTests.swift rename to ContainersCoreTests/EntityNameTests.swift index b5122ca..ef1c1f2 100644 --- a/ContainerSystemTests/EntityNameTests.swift +++ b/ContainersCoreTests/EntityNameTests.swift @@ -1,6 +1,6 @@ // // EntityNameTests.swift -// ContainerSystemTests +// ContainersCoreTests // // The names a container or volume is allowed to carry. // @@ -8,7 +8,7 @@ import Foundation import Testing -@testable import ContainerSystem +@testable import ContainersCore @Suite("Entity name") struct EntityNameTests { diff --git a/ContainerSystemTests/FileIOTests.swift b/ContainersCoreTests/FileIOTests.swift similarity index 98% rename from ContainerSystemTests/FileIOTests.swift rename to ContainersCoreTests/FileIOTests.swift index f368184..0549279 100644 --- a/ContainerSystemTests/FileIOTests.swift +++ b/ContainersCoreTests/FileIOTests.swift @@ -1,6 +1,6 @@ // // FileIOTests.swift -// ContainerSystemTests +// ContainersCoreTests // // The blocking filesystem work the managers hand off. // @@ -8,7 +8,7 @@ import Foundation import Testing -@testable import ContainerSystem +@testable import ContainersCore @Suite("File IO") struct FileIOTests { diff --git a/ContainersCoreTests/FolderEventsTests.swift b/ContainersCoreTests/FolderEventsTests.swift new file mode 100644 index 0000000..56c713c --- /dev/null +++ b/ContainersCoreTests/FolderEventsTests.swift @@ -0,0 +1,70 @@ +// +// FolderEventsTests.swift +// ContainersCoreTests +// +// Hearing about changes another process makes under a data folder. +// + +import Foundation +import Testing + +@testable import ContainersCore + +@Suite("Folder events") +struct FolderEventsTests { + + @Test("Reports a changed file relative to the folder") + func reportsChangedFile() async throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + let changes = FolderEvents.changes(under: directory.url, latency: 0.05) + + // FSEvents starts reporting a moment after the stream is created. + try await Task.sleep(for: .milliseconds(300)) + try directory.write("{}", to: "state.json") + + let paths = await firstBatch(of: changes, timeout: .seconds(5)) + + #expect(paths?.contains("state.json") == true) + } + + @Test("Reports a new entry inside a subfolder") + func reportsNestedEntry() async throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + try directory.write("{}", to: "volumes/.keep") + + let changes = FolderEvents.changes(under: directory.url, latency: 0.05) + + try await Task.sleep(for: .milliseconds(300)) + try directory.write("{}", to: "volumes/data/entity.json") + + let paths = await firstBatch(of: changes, timeout: .seconds(5)) + + #expect(paths?.contains { $0.hasPrefix("volumes/") } == true) + } + + /// The first batch the stream yields, or `nil` if none arrives in time. + private func firstBatch(of changes: AsyncStream<[String]>, timeout: Duration) async -> [String]? { + await withTaskGroup(of: [String]?.self) { group in + group.addTask { + for await paths in changes { + return paths + } + + return nil + } + group.addTask { + try? await Task.sleep(for: timeout) + return nil + } + + let first = await group.next() ?? nil + group.cancelAll() + + return first + } + } +} diff --git a/ContainerSystemTests/GzipTests.swift b/ContainersCoreTests/GzipTests.swift similarity index 91% rename from ContainerSystemTests/GzipTests.swift rename to ContainersCoreTests/GzipTests.swift index e00fe18..97e0967 100644 --- a/ContainerSystemTests/GzipTests.swift +++ b/ContainersCoreTests/GzipTests.swift @@ -1,12 +1,12 @@ // // GzipTests.swift -// ContainerSystemTests +// ContainersCoreTests // import Foundation import Testing -@testable import ContainerSystem +@testable import ContainersCore @Suite("Gzip") struct GzipTests { diff --git a/ContainersCoreTests/ImageManagerTests.swift b/ContainersCoreTests/ImageManagerTests.swift new file mode 100644 index 0000000..1654074 --- /dev/null +++ b/ContainersCoreTests/ImageManagerTests.swift @@ -0,0 +1,233 @@ +// +// ImageManagerTests.swift +// ContainersCoreTests +// +// Created by Axel Martinez on 2026/02/08. +// + +import Containerization +import ContainerizationOCI +import Foundation +import Testing + +@testable import ContainersCore + +@Suite("Image manager") +struct ImageManagerTests { + + // MARK: - Setup Helper + + @MainActor + private func setupTestSystem() async throws -> (URL, ContainerSystem) { + let appRoot = FileManager.default.temporaryDirectory + .appendingPathComponent("test-containers-\(UUID().uuidString)") + + let containerSystem = MockContainerSystem() + try await containerSystem.start(appRoot: appRoot) + + return (appRoot, containerSystem) + } + + // MARK: - Infrastructure Images Tests + + @Test( + "Images the system runs itself are hidden, whatever their version", + arguments: [ + "ghcr.io/apple/containerization/vminit:0.28.0", + "ghcr.io/apple/containerization/vminit:0.26.5", + "ghcr.io/apple/containerization/vminit@sha256:0123456789abcdef", + "ghcr.io/apple/container-builder-shim/builder:0.6.1", + ] + ) + func hidesInfraImages(reference: String) { + #expect(ImageManager.isInfraImage(name: reference)) + } + + @Test( + "Other images are listed", + arguments: [ + "docker.io/library/alpine:latest", + "ghcr.io/apple/containerization/other:0.28.0", + "localhost:5000/vminit:1.0", + ] + ) + func listsOtherImages(reference: String) { + #expect(!ImageManager.isInfraImage(name: reference)) + } + + // MARK: - List Images Tests + + @Test("Empty store lists no images") + @MainActor + func emptyStoreListsNoImages() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let imageManager = ImageManager(testSystem: containerSystem) + let images = try await imageManager.list() + + #expect(images.isEmpty) + } + + @Test("List fails after stop") + @MainActor + func listFailsAfterStop() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let imageManager = ImageManager(testSystem: containerSystem) + try await containerSystem.stop() + + await #expect(throws: (any Error).self) { + _ = try await imageManager.list() + } + } + + @Test("List hides infrastructure images") + @MainActor + func listHidesInfrastructureImages() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let imageManager = ImageManager(testSystem: containerSystem) + let images = try await imageManager.list() + + // Verify no infra images + let hasInfraImages = images.contains { image in + image.name.hasPrefix("infra:") + } + #expect(hasInfraImages == false) + } + + // MARK: - Save Images Tests + + @Test("Save to directory") + @MainActor + func saveToDirectory() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let tempDir = FileManager.default.temporaryDirectory + .appendingPathComponent("ImageManagerTests") + .appendingPathComponent(UUID().uuidString) + + try FileManager.default.createDirectory( + at: tempDir, + withIntermediateDirectories: true + ) + + let imageManager = ImageManager(testSystem: containerSystem) + try await imageManager.save( + images: [], + platform: .current, + outputURL: tempDir.appendingPathComponent("images.tar") + ) + + // Cleanup + try? FileManager.default.removeItem( + at: tempDir.deletingLastPathComponent() + ) + } + + @Test("Save empty list") + @MainActor + func saveEmptyList() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let tempDir = FileManager.default.temporaryDirectory + .appendingPathComponent("ImageManagerTests") + .appendingPathComponent(UUID().uuidString) + + try FileManager.default.createDirectory( + at: tempDir, + withIntermediateDirectories: true + ) + + let imageManager = ImageManager(testSystem: containerSystem) + try await imageManager.save( + images: [], + platform: .current, + outputURL: tempDir.appendingPathComponent("images.tar") + ) + + // Cleanup + try? FileManager.default.removeItem( + at: tempDir.deletingLastPathComponent() + ) + } + + // MARK: - Delete Images Tests + + @Test("Delete empty list") + @MainActor + func deleteEmptyList() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let imageManager = ImageManager(testSystem: containerSystem) + try await imageManager.delete(images: []) + } + + @Test("Cleaning up deletes the snapshots no image uses, and keeps the ingest folder") + @MainActor + func cleanUpDeletesOrphanedSnapshots() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let service = try containerSystem.imageService + let ingest = service.snapshotsPath.appendingPathComponent("ingest") + let orphan = service.snapshotsPath.appendingPathComponent(String(repeating: "a", count: 64)) + + try FileManager.default.createDirectory(at: orphan, withIntermediateDirectories: true) + try Data(count: 4096).write(to: orphan.appendingPathComponent("snapshot")) + + let (_, freed) = try await service.cleanUpOrphanedBlobs() + + #expect(!FileManager.default.fileExists(atPath: orphan.path)) + #expect(FileManager.default.fileExists(atPath: ingest.path)) + #expect(freed > 0) + + try await containerSystem.stop() + } + + @Test("Reads the references a load records from the archive's index, before recording any") + @MainActor + func readsLayoutReferences() async throws { + let (_, containerSystem) = try await setupTestSystem() + let layout = FileManager.default.temporaryDirectory.appendingPathComponent("layout-\(UUID().uuidString)") + defer { try? FileManager.default.removeItem(at: layout) } + + try FileManager.default.createDirectory(at: layout, withIntermediateDirectories: true) + try Data( + #""" + {"schemaVersion": 2, "manifests": [ + {"mediaType": "application/vnd.oci.image.index.v1+json", "digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "size": 1, + "annotations": {"com.apple.containerization.image.name": "docker.io/library/nginx:latest", + "org.opencontainers.image.ref.name": "latest"}}, + {"mediaType": "application/vnd.oci.image.index.v1+json", "digest": "sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", "size": 1, + "annotations": {"io.containerd.image.name": "docker.io/library/redis:7"}}, + {"mediaType": "application/vnd.oci.image.index.v1+json", "digest": "sha256:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc", "size": 1} + ]} + """#.utf8 + ).write(to: layout.appendingPathComponent("index.json")) + + let references = try containerSystem.imageService.references(inLayout: layout) + + #expect(references == ["docker.io/library/nginx:latest", "docker.io/library/redis:7", "untagged@sha256:" + String(repeating: "c", count: 64)]) + + try await containerSystem.stop() + } + + @Test("Discarding an image a cancelled pull never recorded still deletes what nothing uses") + @MainActor + func discardsUnrecordedImage() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let service = try containerSystem.imageService + let orphan = service.snapshotsPath.appendingPathComponent(String(repeating: "b", count: 64)) + + try FileManager.default.createDirectory(at: orphan, withIntermediateDirectories: true) + try Data(count: 4096).write(to: orphan.appendingPathComponent("snapshot")) + + await service.discard(references: ["docker.io/library/never-pulled:latest"]) + + #expect(!FileManager.default.fileExists(atPath: orphan.path)) + #expect(try await service.list().isEmpty) + + try await containerSystem.stop() + } +} diff --git a/ContainerSystemTests/KernelServiceTests.swift b/ContainersCoreTests/KernelServiceTests.swift similarity index 86% rename from ContainerSystemTests/KernelServiceTests.swift rename to ContainersCoreTests/KernelServiceTests.swift index 3dddad0..353b828 100644 --- a/ContainerSystemTests/KernelServiceTests.swift +++ b/ContainersCoreTests/KernelServiceTests.swift @@ -1,6 +1,6 @@ // // KernelServiceTests.swift -// ContainerSystemTests +// ContainersCoreTests // // Installing a kernel out of the archive the app downloads. // @@ -11,7 +11,7 @@ import Foundation import Logging import Testing -@testable import ContainerSystem +@testable import ContainersCore @Suite("Kernel service") struct KernelServiceTests { @@ -206,4 +206,23 @@ struct KernelServiceTests { _ = try await service.getDefaultKernel(platform: .current) } } + + @Test("Checks a kernel archive against its digest") + func verifiesKernelDigest() throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + let archive = directory.url.appending(path: "kernel.tar.zst") + try Data("hello".utf8).write(to: archive) + + try KernelService.verifyDigest(of: archive, expected: "sha256:2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824") + try KernelService.verifyDigest(of: archive, expected: "SHA256:2CF24DBA5FB0A30E26E83B2AC5B9E29E1B161E5C1FA7425E73043362938B9824") + + #expect(throws: (any Error).self) { + try KernelService.verifyDigest(of: archive, expected: "sha256:\(String(repeating: "0", count: 64))") + } + #expect(throws: (any Error).self) { + try KernelService.verifyDigest(of: archive, expected: "md5:5d41402abc4b2a76b9719d911017c592") + } + } } diff --git a/ContainersCoreTests/Mocks/MockContainerSystem.swift b/ContainersCoreTests/Mocks/MockContainerSystem.swift new file mode 100644 index 0000000..19b53ac --- /dev/null +++ b/ContainersCoreTests/Mocks/MockContainerSystem.swift @@ -0,0 +1,170 @@ +// +// MockContainerSystem.swift +// ContainersCoreTests +// +// A container system for isolated testing without real container operations. +// + +import Containerization +import ContainerizationError +import ContainerizationOCI +import Foundation +import Logging + +@testable import ContainersCore + +/// A container system that provides isolated services for testing. +/// +/// Creates real but lightweight service instances backed by temporary +/// directories. All stores (ContentStore, ImageStore) are filesystem-only +/// and safe to use in a test host without special entitlements. +/// +/// The services live here rather than in the superclass's own storage, which +/// is private; its `…Service` properties and `launch(appRoot:installingKernel:)`/`shutdown()` are the seam, so they +/// are overridden to hand back these instances. +@MainActor +final class MockContainerSystem: ContainerSystem { + + /// Off for a test that starts again over the same folder, which the real system leaves in place. + var removesAppRootOnStop = true + + private var mockContainerService: ContainerService? + private var mockImageService: ImageService? + private var mockNetworkService: NetworkService? + private var mockVolumeService: VolumeService? + private var mockKernelService: KernelService? + private var mockReportService: ReportService? + + // MARK: - Service Accessors + + override var containerService: ContainerService { + get throws { try running(mockContainerService) } + } + + override var imageService: ImageService { + get throws { try running(mockImageService) } + } + + override var networkService: NetworkService { + get throws { try running(mockNetworkService) } + } + + override var volumeService: VolumeService { + get throws { try running(mockVolumeService) } + } + + override var kernelService: KernelService { + get throws { try running(mockKernelService) } + } + + override var reportService: ReportService { + get throws { try running(mockReportService) } + } + + private func running(_ value: Value?) throws -> Value { + guard let value else { + throw ContainerizationError(.internalError, message: "Container system not running") + } + + return value + } + + // MARK: - Lifecycle + + // Sets up isolated services in a temporary folder. + override func launch(appRoot: URL, installingKernel: Bool) async throws { + if status == .running { + return + } + + status = .starting + + defer { + if status == .starting { + settleStopped() + } + } + + // Create directory structure + let fm = FileManager.default + try fm.createDirectory(at: appRoot, withIntermediateDirectories: true) + + let imagesRoot = appRoot.appendingPathComponent("images") + try fm.createDirectory( + at: imagesRoot, + withIntermediateDirectories: true + ) + + let reports = try ReportService(appRoot: appRoot, log: logger) + + await reports.addChangeCallback { @MainActor [weak self] reports in + self?.reports = reports + } + + // Create stores — these are filesystem-only and safe in test hosts + let localContentStore = try LocalContentStore( + path: imagesRoot.appendingPathComponent("content") + ) + let imageStore = try ImageStore( + path: imagesRoot, + contentStore: localContentStore + ) + let snapshotsPath = imagesRoot.appendingPathComponent("snapshots") + + let images = try ImageService( + contentStore: localContentStore, + imageStore: imageStore, + snapshotsPath: snapshotsPath, + log: logger + ) + let networks = NetworkService(appRoot: appRoot, log: logger) + let volumes = VolumeService(appRoot: appRoot, log: logger) + + // KernelService — just creates a directory + let kernel = try KernelService( + log: logger, + appRoot: appRoot + ) + + // Reads existing containers from disk (empty in tests) + mockContainerService = try ContainerService( + appRoot: appRoot, + imageService: images, + networkService: networks, + log: logger + ) + mockImageService = images + mockNetworkService = networks + mockVolumeService = volumes + + mockKernelService = kernel + mockReportService = reports + self.appRoot = appRoot + status = .running + startupError = nil + } + + override func shutdown() async throws { + guard status == .running else { + return + } + + status = .stopping + + let appRoot = self.appRoot + + mockContainerService = nil + mockImageService = nil + mockNetworkService = nil + mockVolumeService = nil + mockKernelService = nil + mockReportService = nil + self.appRoot = nil + settleStopped() + + // Clean up temp directory + if let appRoot, removesAppRootOnStop { + try? FileManager.default.removeItem(at: appRoot) + } + } +} diff --git a/ContainerSystemTests/NetworkManagerTests.swift b/ContainersCoreTests/NetworkManagerTests.swift similarity index 81% rename from ContainerSystemTests/NetworkManagerTests.swift rename to ContainersCoreTests/NetworkManagerTests.swift index d73f1c1..b1cb78d 100644 --- a/ContainerSystemTests/NetworkManagerTests.swift +++ b/ContainersCoreTests/NetworkManagerTests.swift @@ -1,6 +1,6 @@ // // NetworkManagerTests.swift -// ContainerSystemTests +// ContainersCoreTests // // The DNS domains read out of the resolver files the CLI writes. // @@ -8,7 +8,7 @@ import Foundation import Testing -@testable import ContainerSystem +@testable import ContainersCore @Suite("Network manager") @MainActor @@ -54,9 +54,9 @@ struct NetworkManagerTests { "containerization.renamed": cliResolver ]) - let manager = NetworkManager() + let networkManager = NetworkManager() - #expect(manager.listDomains(in: directory) == ["test"]) + #expect(networkManager.domains(in: directory) == ["test"]) } @Test("Other resolvers are ignored") @@ -66,9 +66,9 @@ struct NetworkManagerTests { "example.com": "domain example.com\nnameserver 8.8.8.8\n", ]) - let manager = NetworkManager() + let networkManager = NetworkManager() - #expect(manager.listDomains(in: directory) == ["test"]) + #expect(networkManager.domains(in: directory) == ["test"]) } /// The CLI passes over a file it cannot read a domain out of, so a file @@ -79,9 +79,9 @@ struct NetworkManagerTests { "containerization.test": "nameserver 127.0.0.1\nport 2053\n" ]) - let manager = NetworkManager() + let networkManager = NetworkManager() - #expect(manager.listDomains(in: directory).isEmpty) + #expect(networkManager.domains(in: directory).isEmpty) } @Test("Domains are sorted") @@ -92,9 +92,9 @@ struct NetworkManagerTests { "containerization.mike": "domain mike\n", ]) - let manager = NetworkManager() + let networkManager = NetworkManager() - #expect(manager.listDomains(in: directory) == ["alpha", "mike", "zulu"]) + #expect(networkManager.domains(in: directory) == ["alpha", "mike", "zulu"]) } @Test("Localhost resolver is read") @@ -110,9 +110,9 @@ struct NetworkManagerTests { """ ]) - let manager = NetworkManager() + let networkManager = NetworkManager() - #expect(manager.listDomains(in: directory) == ["local"]) + #expect(networkManager.domains(in: directory) == ["local"]) } @Test("Missing directory yields no domains") @@ -120,6 +120,6 @@ struct NetworkManagerTests { let absent = URL.temporaryDirectory .appendingPathComponent("absent-\(UUID().uuidString)") - #expect(NetworkManager().listDomains(in: absent).isEmpty) + #expect(NetworkManager().domains(in: absent).isEmpty) } } diff --git a/ContainersCoreTests/NetworksTests.swift b/ContainersCoreTests/NetworksTests.swift new file mode 100644 index 0000000..41753f0 --- /dev/null +++ b/ContainersCoreTests/NetworksTests.swift @@ -0,0 +1,111 @@ +// +// NetworksTests.swift +// ContainersCoreTests +// +// Created by Axel Martinez on 2026/10/31. +// + +import Containerization +import ContainerizationError +import ContainerizationExtras +import ContainerizationOCI +import Foundation +import Logging +import Testing + +@testable import ContainersCore + +@Suite("Networks") +struct NetworksTests { + /// The built-in network, as it's stored. + private static let storedDefaultNetwork = """ + {"plugin":"container-network-vmnet","mode":"nat","labels":{"com.apple.container.resource.role":"builtin"},\ + "name":"default","creationDate":815058191.631105,"options":{}} + """ + + private func makeService(in directory: TemporaryDirectory) -> NetworkService { + NetworkService(appRoot: directory.url, log: Logger(label: "tests.networks")) + } + + @Test("Reads the built-in network, and writes it back with the same keys") + func readsAndWritesNetwork() throws { + let network = try JSONDecoder().decode(NetworkConfiguration.self, from: Data(Self.storedDefaultNetwork.utf8)) + + #expect(network.name == "default") + #expect(network.mode == .nat) + #expect(network.isBuiltin) + #expect(network.ipv4Subnet == nil) + + let encoded = try JSONSerialization.jsonObject(with: try JSONEncoder().encode(network)) as? [String: Any] + let original = try JSONSerialization.jsonObject(with: Data(Self.storedDefaultNetwork.utf8)) as? [String: Any] + + #expect(encoded.map { Set($0.keys) } == original.map { Set($0.keys) }) + } + + @Test("Makes the built-in network when the folder has none") + func makesBuiltinNetwork() async throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + let service = makeService(in: directory) + + #expect(try await service.list().map(\.name) == ["default"]) + #expect(FileManager.default.fileExists(atPath: directory.appending("networks/default/entity.json").path)) + } + + @Test("Refuses a taken name, an overlapping subnet, an invalid name, and deleting the built-in network or one in use") + func refusesInvalidNetworks() async throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + let service = makeService(in: directory) + + try await service.create(try NetworkConfiguration(name: "backend", ipv4Subnet: try CIDRv4("192.168.100.0/24"))) + + #expect(try await service.list().map(\.name) == ["backend", "default"]) + + await #expect(throws: ContainerizationError.self) { + try await service.create(try NetworkConfiguration(name: "backend")) + } + await #expect(throws: ContainerizationError.self) { + try await service.create(try NetworkConfiguration(name: "other", ipv4Subnet: try CIDRv4("192.168.100.128/25"))) + } + #expect(throws: ContainerizationError.self) { + try NetworkConfiguration(name: "Not Valid") + } + await #expect(throws: ContainerizationError.self) { + try await service.delete(named: "default", inUseBy: []) + } + await #expect(throws: ContainerizationError.self) { + try await service.delete(named: "backend", inUseBy: ["web"]) + } + + try await service.delete(named: "backend", inUseBy: []) + + #expect(try await service.list().map(\.name) == ["default"]) + } + + @Test( + "Accepts a private subnet with room for a container, with host bits kept as written", + arguments: ["192.168.100.0/24", "10.0.0.0/8", "172.16.4.0/22", "192.168.2.0/30", "192.168.2.100/24"] + ) + func acceptsSubnet(_ text: String) throws { + #expect(try NetworkConfiguration.ipv4Subnet(parsing: text).description == text) + } + + @Test( + "Refuses a subnet vmnet can't make a network on", + arguments: [ + "192.168.2.100/4", // Reaches past the private blocks, over the Mac's own network. + "8.8.8.0/24", // Isn't private. + "172.32.0.0/16", // Lies just past 172.16.0.0/12. + "192.168.2.0/31", // Leaves no address for a container. + "192.168.2.0", // Has no prefix. + ] + ) + func refusesSubnet(_ text: String) { + #expect(throws: (any Error).self) { + try NetworkConfiguration.ipv4Subnet(parsing: text) + } + } +} diff --git a/ContainerSystemTests/ProgressStepsTests.swift b/ContainersCoreTests/ProgressStepsTests.swift similarity index 94% rename from ContainerSystemTests/ProgressStepsTests.swift rename to ContainersCoreTests/ProgressStepsTests.swift index b75bf51..551d86c 100644 --- a/ContainerSystemTests/ProgressStepsTests.swift +++ b/ContainersCoreTests/ProgressStepsTests.swift @@ -1,6 +1,6 @@ // // ProgressStepsTests.swift -// ContainerSystemTests +// ContainersCoreTests // // How an operation counts its steps into a Progress. // @@ -9,7 +9,7 @@ import ContainerizationExtras import Foundation import Testing -@testable import ContainerSystem +@testable import ContainersCore @Suite("Progress steps") @MainActor @@ -39,7 +39,11 @@ struct ProgressStepsTests { await step.updateHandler()([.addTotalItems(4), .addItems(1)]) #expect(progress.localizedDescription == "Fetching builder image") - #expect(progress.localizedAdditionalDescription == "1 of 4") + #expect(step.completedUnitCount == 1) + #expect(step.totalUnitCount == 4) + // Foundation words the count in the Mac's language, so it's compared rather than spelled out. + #expect(!progress.localizedAdditionalDescription.isEmpty) + #expect(progress.localizedAdditionalDescription == step.localizedAdditionalDescription) } } } diff --git a/ContainerSystemTests/PublishPortTests.swift b/ContainersCoreTests/PublishPortTests.swift similarity index 97% rename from ContainerSystemTests/PublishPortTests.swift rename to ContainersCoreTests/PublishPortTests.swift index bc642c9..fa41f98 100644 --- a/ContainerSystemTests/PublishPortTests.swift +++ b/ContainersCoreTests/PublishPortTests.swift @@ -1,6 +1,6 @@ // // PublishPortTests.swift -// ContainerSystemTests +// ContainersCoreTests // // Clashes between the ports a container publishes. // @@ -9,7 +9,7 @@ import ContainerizationExtras import Foundation import Testing -@testable import ContainerSystem +@testable import ContainersCore @Suite("Published ports") struct PublishPortTests { diff --git a/ContainerSystemTests/ReferenceNormalizedTests.swift b/ContainersCoreTests/ReferenceNormalizedTests.swift similarity index 72% rename from ContainerSystemTests/ReferenceNormalizedTests.swift rename to ContainersCoreTests/ReferenceNormalizedTests.swift index 0fa1885..ec3310e 100644 --- a/ContainerSystemTests/ReferenceNormalizedTests.swift +++ b/ContainersCoreTests/ReferenceNormalizedTests.swift @@ -1,6 +1,6 @@ // // ReferenceNormalizedTests.swift -// ContainerSystemTests +// ContainersCoreTests // // What a short image name is filled in to. // @@ -8,7 +8,7 @@ import ContainerizationOCI import Testing -@testable import ContainerSystem +@testable import ContainersCore @Suite("Normalized references") struct ReferenceNormalizedTests { @@ -39,6 +39,18 @@ struct ReferenceNormalizedTests { #expect(try Reference.normalized(reference).description == expected) } + @Test( + "Short names take the default registry from the settings", + arguments: [ + ("app", "registry.example.com/app:latest"), + ("team/app:2", "registry.example.com/team/app:2"), + ("docker.io/nginx", "docker.io/library/nginx:latest"), + ] + ) + func defaultRegistry(reference: String, expected: String) throws { + #expect(try Reference.normalized(reference, registry: "registry.example.com").description == expected) + } + @Test("Invalid reference throws") func invalid() { #expect(throws: (any Error).self) { diff --git a/ContainersCoreTests/ReportManagerTests.swift b/ContainersCoreTests/ReportManagerTests.swift new file mode 100644 index 0000000..bfe9c68 --- /dev/null +++ b/ContainersCoreTests/ReportManagerTests.swift @@ -0,0 +1,74 @@ +// +// ReportManagerTests.swift +// ContainersCoreTests +// +// Recording reports, and keeping the container system's list in step with the store. +// + +import Foundation +import Testing + +@testable import ContainersCore + +@Suite("Report manager") +@MainActor +struct ReportManagerTests { + private struct Failure: Error {} + + private func makeManager(in directory: TemporaryDirectory) async throws -> ReportManager { + let containerSystem = MockContainerSystem() + + try await containerSystem.start(appRoot: directory.url) + + return ReportManager(testSystem: containerSystem) + } + + @Test("Recorded report comes first") + func recordedReportComesFirst() async throws { + let directory = try TemporaryDirectory() + + defer { directory.remove() } + + let reportManager = try await makeManager(in: directory) + + await reportManager.record(kind: .image, name: "alpine", message: "The pull failed.", error: Failure()) + let latest = try #require( + await reportManager.record(kind: .build, name: "nginx", message: "The build failed.", error: Failure()) + ) + + #expect(reportManager.reports.first == latest) + #expect(reportManager.reports.count == 2) + #expect(reportManager.unreadCount == 2) + } + + @Test("Marking read updates the list and the store") + func markingReadUpdatesListAndStore() async throws { + let directory = try TemporaryDirectory() + + defer { directory.remove() } + + let reportManager = try await makeManager(in: directory) + let report = try #require( + await reportManager.record(kind: .container, name: "web", message: "The container stopped.", error: Failure()) + ) + + await reportManager.markRead(ids: [report.id]) + + #expect(reportManager.isRead(id: report.id)) + #expect(reportManager.unreadCount == 0) + + await reportManager.refresh() + + #expect(reportManager.isRead(id: report.id)) + } + + @Test("Stopped system records nothing") + func stoppedSystemRecordsNothing() async { + let reportManager = ReportManager(testSystem: MockContainerSystem()) + + let report = await reportManager.record(kind: .image, name: "alpine", message: "The pull failed.", error: Failure()) + + #expect(report == nil) + #expect(reportManager.reports.isEmpty) + } +} diff --git a/ContainerSystemTests/ReportStoreTests.swift b/ContainersCoreTests/ReportStoreTests.swift similarity index 97% rename from ContainerSystemTests/ReportStoreTests.swift rename to ContainersCoreTests/ReportStoreTests.swift index d3dea10..a0615b8 100644 --- a/ContainerSystemTests/ReportStoreTests.swift +++ b/ContainersCoreTests/ReportStoreTests.swift @@ -1,6 +1,6 @@ // // ReportStoreTests.swift -// ContainerSystemTests +// ContainersCoreTests // // Keeping a report, and reading it back. // @@ -8,7 +8,7 @@ import Foundation import Testing -@testable import ContainerSystem +@testable import ContainersCore @Suite("Report store") struct ReportStoreTests { @@ -72,8 +72,8 @@ struct ReportStoreTests { #expect(try await store.body(of: written.id) == transcript) } - /// Deflated as Xcode deflates its own, so that anything that reads a gzip - /// file can read one of these. + /// Deflated in the gzip format, so that anything that reads a gzip file + /// can read one of these. @Test("Body is gzipped") func keepsBodyDeflated() async throws { let (store, root) = try makeStore() diff --git a/ContainersCoreTests/ResourceLabelsTests.swift b/ContainersCoreTests/ResourceLabelsTests.swift new file mode 100644 index 0000000..a2e82af --- /dev/null +++ b/ContainersCoreTests/ResourceLabelsTests.swift @@ -0,0 +1,83 @@ +// +// ResourceLabelsTests.swift +// ContainersCoreTests +// +// Which label keys and values a resource can carry. +// + +import Foundation +import Testing + +@testable import ContainersCore + +@Suite("Resource labels") +struct ResourceLabelsTests { + @Test( + "Accepts Docker and OCI style keys", + arguments: [ + "com.example.team", + "com.apple.container.resource.role", + "example.com/owner", + "a", + ] + ) + func acceptsValidKeys(_ key: String) throws { + let labels = try ResourceLabels([key: "value"]) + + #expect(labels[key] == "value") + } + + @Test("Refuses keys with capitals, spaces or edge dashes", arguments: ["Team", "my key", "-team", "team-", ""]) + func refusesInvalidKeys(_ key: String) { + #expect(throws: ResourceLabels.LabelError.self) { + try ResourceLabels([key: "value"]) + } + } + + @Test("Refuses a key longer than the limit") + func refusesLongKey() { + let key = String(repeating: "a", count: ResourceLabels.keyLengthMax + 1) + + #expect(throws: ResourceLabels.LabelError.keyTooLong(key)) { + try ResourceLabels([key: "value"]) + } + } + + @Test("Refuses a label longer than the limit") + func refusesLongLabel() { + let value = String(repeating: "v", count: ResourceLabels.labelLengthMax) + + #expect(throws: ResourceLabels.LabelError.labelTooLong(key: "key")) { + try ResourceLabels(["key": value]) + } + } + + @Test("Codes as a plain dictionary, and refuses an invalid one when read back") + func codesAsDictionary() throws { + let labels = try ResourceLabels(["com.example.team": "web"]) + let data = try JSONEncoder().encode(labels) + + #expect(try JSONDecoder().decode([String: String].self, from: data) == ["com.example.team": "web"]) + #expect(throws: ResourceLabels.LabelError.self) { + try JSONDecoder().decode(ResourceLabels.self, from: Data(#"{"Bad Key": "x"}"#.utf8)) + } + } + + @Test("A network the system made is built in, and others aren't") + func builtinNetwork() throws { + let builtin = NetworkResource(configuration: try .builtin(subnet: nil)) + let custom = NetworkResource(configuration: try NetworkConfiguration(name: "backend")) + + #expect(builtin.labels.isBuiltin) + #expect(builtin.isBuiltin) + #expect(!custom.labels.isBuiltin) + } + + @Test("A resource with an invalid label has none") + func invalidLabelsAreDropped() { + let volume = VolumeResource(configuration: VolumeConfiguration(name: "data", labels: ["Bad Key": "x"])) + + #expect(volume.labels.isEmpty) + #expect(volume.configuration.labels == ["Bad Key": "x"]) + } +} diff --git a/ContainerSystemTests/Support/TemporaryDirectory.swift b/ContainersCoreTests/Support/TemporaryDirectory.swift similarity index 98% rename from ContainerSystemTests/Support/TemporaryDirectory.swift rename to ContainersCoreTests/Support/TemporaryDirectory.swift index 824c185..a234c31 100644 --- a/ContainerSystemTests/Support/TemporaryDirectory.swift +++ b/ContainersCoreTests/Support/TemporaryDirectory.swift @@ -1,6 +1,6 @@ // // TemporaryDirectory.swift -// ContainerSystemTests +// ContainersCoreTests // // A unique scratch directory for a single test. // diff --git a/ContainersCoreTests/SystemConfigurationTests.swift b/ContainersCoreTests/SystemConfigurationTests.swift new file mode 100644 index 0000000..3594de1 --- /dev/null +++ b/ContainersCoreTests/SystemConfigurationTests.swift @@ -0,0 +1,95 @@ +// +// SystemConfigurationTests.swift +// ContainersCoreTests +// +// Reading and writing the settings in a system folder's config.toml. +// + +import Foundation +import Testing + +@testable import ContainersCore + +@Suite("System configuration") +struct SystemConfigurationTests { + @Test("Reads the settings from the folder, with the defaults for the rest") + func readsSystemConfiguration() async throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + try directory.write( + """ + [kernel] + url = "https://example.com/kernel.tar.zst" + + [container] + cpus = 8 + memory = "4g" + + [build] + memory = "2048MB" + rosetta = false + + [dns] + domain = "test" + + [registry] + domain = "registry.example.com" + + [vminit] + image = "ghcr.io/example/vminit:custom" + """, + to: "config/config.toml" + ) + + let configuration = await SystemConfiguration.load(appRoot: directory.url) + + #expect(configuration.kernelURL == "https://example.com/kernel.tar.zst") + #expect(configuration.kernelDigest == nil) + #expect(configuration.kernelBinaryPath == SystemConfiguration.defaults.kernelBinaryPath) + #expect(configuration.containerCPUs == 8) + #expect(configuration.containerMemoryInBytes == 4 * 1024 * 1024 * 1024) + #expect(configuration.buildMemoryInBytes == 2048 * 1024 * 1024) + #expect(configuration.buildCPUs == SystemConfiguration.defaults.buildCPUs) + #expect(!configuration.buildRosetta) + #expect(configuration.dnsDomain == "test") + #expect(configuration.registryDomain == "registry.example.com") + #expect(configuration.initImage == "ghcr.io/example/vminit:custom") + #expect(configuration.builderImage == SystemConfiguration.defaults.builderImage) + } + + @Test("Without a config.toml, the defaults apply") + func usesDefaults() async throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + let configuration = await SystemConfiguration.load(appRoot: directory.url) + + #expect(configuration == SystemConfiguration.defaults) + #expect(configuration.containerCPUs == 4) + #expect(configuration.containerMemoryInBytes == 1024 * 1024 * 1024) + } + + @Test("Writes only what differs from the defaults, in a file that reads back the same") + func writesConfiguration() async throws { + let directory = try TemporaryDirectory() + defer { directory.remove() } + + var configuration = SystemConfiguration.defaults + configuration.containerCPUs = 6 + configuration.buildMemoryInBytes = 3 * 1024 * 1024 * 1024 + configuration.dnsDomain = "my \"lab\"" + + try configuration.write(to: directory.url) + + let text = try String(contentsOf: directory.appending("config/config.toml"), encoding: .utf8) + + #expect(!text.contains("[kernel]")) + #expect(text.contains("[container]\ncpus = 6")) + #expect(await SystemConfiguration.load(appRoot: directory.url) == configuration) + + try SystemConfiguration.defaults.write(to: directory.url) + + #expect(!FileManager.default.fileExists(atPath: directory.appending("config/config.toml").path)) + } +} diff --git a/ContainersCoreTests/VolumeManagerTests.swift b/ContainersCoreTests/VolumeManagerTests.swift new file mode 100644 index 0000000..bbddd85 --- /dev/null +++ b/ContainersCoreTests/VolumeManagerTests.swift @@ -0,0 +1,240 @@ +// +// VolumeManagerTests.swift +// ContainersCoreTests +// +// Created by Axel Martinez on 2026/02/08. +// + +import ContainerizationEXT4 +import ContainerizationError +import Foundation +import Testing + +@testable import ContainersCore + +@Suite("Volume manager", .serialized) +struct VolumeManagerTests { + + // MARK: - Setup Helper + + @MainActor + private func setupTestSystem() async throws -> (URL, ContainerSystem) { + let appRoot = FileManager.default.temporaryDirectory + .appendingPathComponent("test-containers-\(UUID().uuidString)") + + let containerSystem = MockContainerSystem() + + try await containerSystem.start(appRoot: appRoot) + + return (appRoot, containerSystem) + } + + // MARK: - List Volumes Tests + + @Test("Empty store lists no volumes") + @MainActor + func emptyStoreListsNoVolumes() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let volumeManager = VolumeManager(testSystem: containerSystem) + let volumes = try await volumeManager.list() + + #expect(volumes.isEmpty) + } + + // MARK: - Create Volume Tests + + @Test("Created volume is listed") + @MainActor + func createdVolumeIsListed() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let volumeName = "test-volume-\(UUID().uuidString)" + let volumeManager = VolumeManager(testSystem: containerSystem) + + let volume = try await volumeManager.create( + name: volumeName, + labels: [], + options: [], + sizeInBytes: 1024 * 1024 // 1 MB + ) + + #expect(volume.name == volumeName) + #expect(volume.configuration.driver == "local") + #expect(volume.configuration.format == "ext4") + #expect(volume.configuration.source.hasSuffix("volume.img")) + #expect(volume.configuration.sizeInBytes == 1024 * 1024) + + let volumes = try await volumeManager.list() + #expect(volumes.contains(where: { $0.name == volumeName })) + } + + @Test("Default size when none given") + @MainActor + func createWithDefaultSize() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let volumeName = "test-volume-\(UUID().uuidString)" + let volumeManager = VolumeManager(testSystem: containerSystem) + + let volume = try await volumeManager.create( + name: volumeName, + labels: [], + options: [], + sizeInBytes: nil + ) + + #expect(volume.configuration.source.hasSuffix("volume.img")) + #expect(volume.configuration.sizeInBytes == VolumeStorage.defaultVolumeSizeBytes) + + let volumes = try await volumeManager.list() + #expect( + volumes.first(where: { $0.name == volumeName })?.configuration.sizeInBytes + == VolumeStorage.defaultVolumeSizeBytes + ) + } + + @Test("Size and journal come from the driver options") + @MainActor + func createWithDriverOptions() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let volumeManager = VolumeManager(testSystem: containerSystem) + + let volume = try await volumeManager.create( + name: "test-volume-\(UUID().uuidString)", + labels: [], + options: [KeyValue(key: "size", value: "2m"), KeyValue(key: "journal", value: "writeback")], + sizeInBytes: nil + ) + + #expect(volume.configuration.sizeInBytes == 2 * 1024 * 1024) + #expect(volume.configuration.options["size"] == "2m") + #expect(volume.configuration.options["journal"] == "writeback") + } + + @Test("A size given directly is kept in the options") + @MainActor + func createKeepsSizeInOptions() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let volumeManager = VolumeManager(testSystem: containerSystem) + + let volume = try await volumeManager.create(name: "test-volume-\(UUID().uuidString)", labels: [], options: [], sizeInBytes: 1024 * 1024) + + #expect(volume.configuration.options["size"] == "1048576") + } + + @Test("Reads sizes and journals from the driver options") + func parsesDriverOptions() throws { + #expect(try VolumeService.parseSize("512m") == 512 * 1024 * 1024) + #expect(try VolumeService.parseSize("10GiB") == 10 * 1024 * 1024 * 1024) + #expect(try VolumeService.parseSize("1048576") == 1024 * 1024) + #expect(throws: VolumeError.self) { try VolumeService.parseSize("1k") } + #expect(throws: VolumeError.self) { try VolumeService.parseSize("10x") } + + let journal = try VolumeService.parseJournal("journal:4m") + #expect(journal.defaultMode == .journal) + #expect(journal.size == 4 * 1024 * 1024) + #expect(throws: VolumeError.self) { try VolumeService.parseJournal("fast") } + } + + @Test("Invalid name throws") + @MainActor + func invalidNameThrows() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let volumeManager = VolumeManager(testSystem: containerSystem) + + await #expect(throws: VolumeError.self) { + _ = try await volumeManager.create( + name: "invalid name!", + labels: [], + options: [], + sizeInBytes: nil + ) + } + } + + @Test("Duplicate name throws") + @MainActor + func duplicateNameThrows() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let volumeName = "test-volume-\(UUID().uuidString)" + let volumeManager = VolumeManager(testSystem: containerSystem) + + _ = try await volumeManager.create( + name: volumeName, + labels: [], + options: [], + sizeInBytes: 1024 * 1024 + ) + + await #expect(throws: VolumeError.self) { + _ = try await volumeManager.create( + name: volumeName, + labels: [], + options: [], + sizeInBytes: 1024 * 1024 + ) + } + } + + // MARK: - Delete Volume Tests + + @Test("Delete empty list") + @MainActor + func deleteEmptyList() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let volumeManager = VolumeManager(testSystem: containerSystem) + + try await volumeManager.delete(volumes: []) + } + + @Test("Delete removes volume") + @MainActor + func deleteRemovesVolume() async throws { + let (_, containerSystem) = try await setupTestSystem() + + let volumeName = "test-volume-\(UUID().uuidString)" + let volumeManager = VolumeManager(testSystem: containerSystem) + + let volume = try await volumeManager.create( + name: volumeName, + labels: [], + options: [], + sizeInBytes: 1024 * 1024 + ) + + try await volumeManager.delete(volumes: [volume]) + + let volumes = try await volumeManager.list() + #expect(!volumes.contains(where: { $0.name == volumeName })) + } + + @Test("Delete removes the volume's reports") + @MainActor + func deleteRemovesVolumeReports() async throws { + struct Failure: Error {} + + let (_, containerSystem) = try await setupTestSystem() + + let volumeName = "test-volume-\(UUID().uuidString)" + let volumeManager = VolumeManager(testSystem: containerSystem) + let reportManager = ReportManager(testSystem: containerSystem) + + let volume = try await volumeManager.create( + name: volumeName, + labels: [], + options: [], + sizeInBytes: 1024 * 1024 + ) + + await reportManager.record(kind: .volume, name: volumeName, message: "The volume failed.", error: Failure()) + try await volumeManager.delete(volumes: [volume]) + + #expect(reportManager.reports.isEmpty) + } +} diff --git a/README.md b/README.md index b7a4079..0092ecb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

Containers

-A modern, native macOS application for managing Linux containers using Apple's container runtime. +A modern, native macOS app for running Linux containers. Containers pulls, builds and runs OCI images, and manages the containers and volumes made from them, from a dashboard and the menu bar. It is built on Apple's [Containerization](https://github.com/apple/containerization) package: each container runs in its own lightweight virtual machine, started directly by the app, with no daemon or command-line tools to install. > [!IMPORTANT] @@ -24,9 +24,8 @@ Download Containers from the [Mac App Store](). On first launch it sets up the c ## Next steps - Do the [initial setup](https://try-containers.github.io/documentation/containers/gettingstarted) of Containers. -- [Pull](https://try-containers.github.io/documentation/containers/pullinganimage) your first image and [run](https://try-containers.github.io/documentation/containers/runningacontainer) your first container. +- [Pull](https://try-containers.github.io/documentation/containers/pullinganimage) your first image and [run](https://try-containers.github.io/documentation/containers/runningacontainer) your first container. - Read the [technical overview](https://try-containers.github.io/documentation/containers/understandinghowcontainersworks) of Containers. -- Find out how to run Containers along Apple's [container](https://github.com/apple/container) CLI. - Browse the complete [documentation](https://try-containers.github.io/documentation/). ## Community diff --git a/scripts/update-help.sh b/scripts/update-help.sh new file mode 100755 index 0000000..c6c6da4 --- /dev/null +++ b/scripts/update-help.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Copies the documentation into the app, which shows it in its help window, as Xcode shows its own: from the app +# bundle, so it works offline and matches the app's version. +# +# Usage: scripts/update-help.sh +# +# Builds the website there, then copies the documentation's pages and the files they load into +# Containers/Supporting Files/Help.bundle, leaving out the landing page and its images. Run it whenever the +# documentation changes, and commit the result. + +set -euo pipefail + +if [ $# -ne 1 ]; then + echo "Usage: $0 " >&2 + exit 1 +fi + +website="$(cd "$1" && pwd)" +app="$(cd "$(dirname "$0")/.." && pwd)" +destination="$app/Containers/Supporting Files/Help.bundle" + +"$website/scripts/build-website.sh" + +site="$website/_site" +rm -rf "$destination" +mkdir -p "$destination" + +# DocC's renderer and the documentation's data, with the stylesheet and script the website adds to it. +for item in documentation data index css js img images/app.containers.Containers device-frames icons \ + styles/docs.css scripts/docs.js theme-settings.json metadata.json favicon.ico favicon.svg; do + if [ -e "$site/$item" ]; then + mkdir -p "$destination/$(dirname "$item")" + cp -R "$site/$item" "$destination/$item" + fi +done + +echo "Copied the documentation into $destination ($(du -sh "$destination" | cut -f1))."