@octane-xplat/lottie 0.0.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (361) hide show
  1. package/README.md +56 -2
  2. package/dist/native/cx.mobile.js +11 -0
  3. package/dist/native/escape-props.js +39 -0
  4. package/dist/native/index.js +183 -0
  5. package/dist/native/layout-child.js +38 -0
  6. package/dist/native/octane-client-build.json +8 -0
  7. package/dist/native/vendor/ui-lottie/index.android.js +286 -0
  8. package/dist/native/vendor/ui-lottie/index.ios.js +214 -0
  9. package/dist/native/vendor/ui-lottie/src/lottie/index.common.js +50 -0
  10. package/dist/native/vendor/ui-lottie/src/lottie/utils.js +6 -0
  11. package/dist/web/escape-props.web.js +17 -0
  12. package/dist/web/index.js +346 -0
  13. package/dist/web/layout-child.web.js +47 -0
  14. package/dist/web/octane-client-build.json +8 -0
  15. package/package.json +104 -11
  16. package/platforms/android/include.gradle +7 -0
  17. package/platforms/android/java/com/nativescript/lottie/LottieAnimationView.java +92 -0
  18. package/platforms/android/lottie.aar +0 -0
  19. package/platforms/android/native-api-usage.json +16 -0
  20. package/platforms/ios/Podfile +5 -0
  21. package/platforms/macos/LICENSE-EpoxyCore-Apache-2.0.txt +201 -0
  22. package/platforms/macos/LICENSE-LRUCache-MIT.txt +22 -0
  23. package/platforms/macos/LICENSE-Lottie-Apache-2.0.txt +201 -0
  24. package/platforms/macos/LICENSE-ZIPFoundation-MIT.txt +21 -0
  25. package/platforms/macos/UPSTREAM.md +13 -0
  26. package/platforms/macos/resources/PrivacyInfo.xcprivacy +23 -0
  27. package/platforms/macos/resources/THIRD-PARTY-NOTICES.txt +10 -0
  28. package/platforms/macos/src/XplatAppKitLottie.swift +246 -0
  29. package/platforms/macos/src/vendor/Lottie/PrivacyInfo.xcprivacy +23 -0
  30. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +81 -0
  31. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +476 -0
  32. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +92 -0
  33. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CustomPathAnimation.swift +89 -0
  34. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift +179 -0
  35. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift +53 -0
  36. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift +287 -0
  37. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/LayerProperty.swift +440 -0
  38. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/OpacityAnimation.swift +53 -0
  39. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/RectangleAnimation.swift +59 -0
  40. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift +246 -0
  41. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift +119 -0
  42. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift +96 -0
  43. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/TransformAnimations.swift +380 -0
  44. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/VisibilityAnimation.swift +63 -0
  45. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CompatibilityTracker.swift +129 -0
  46. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CoreAnimationLayer.swift +645 -0
  47. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +35 -0
  48. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +28 -0
  49. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift +345 -0
  50. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
  51. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/AnimationLayer.swift +169 -0
  52. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +46 -0
  53. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +120 -0
  54. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +169 -0
  55. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift +101 -0
  56. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ImageLayer.swift +81 -0
  57. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/InfiniteOpaqueAnimationLayer.swift +57 -0
  58. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +59 -0
  59. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/MaskCompositionLayer.swift +139 -0
  60. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/PreCompLayer.swift +107 -0
  61. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/RepeaterLayer.swift +113 -0
  62. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeItemLayer.swift +346 -0
  63. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeLayer.swift +569 -0
  64. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/SolidLayer.swift +66 -0
  65. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TextLayer.swift +157 -0
  66. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TransformLayer.swift +13 -0
  67. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/ValueProviderStore.swift +157 -0
  68. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +267 -0
  69. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +19 -0
  70. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
  71. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
  72. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +22 -0
  73. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +102 -0
  74. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
  75. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
  76. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
  77. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
  78. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
  79. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +31 -0
  80. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
  81. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
  82. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +58 -0
  83. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
  84. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +42 -0
  85. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
  86. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
  87. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +61 -0
  88. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
  89. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
  90. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +38 -0
  91. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
  92. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
  93. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
  94. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
  95. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
  96. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/README.md +30 -0
  97. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +34 -0
  98. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +38 -0
  99. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +165 -0
  100. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +127 -0
  101. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +468 -0
  102. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +146 -0
  103. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +39 -0
  104. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +41 -0
  105. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
  106. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
  107. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
  108. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +43 -0
  109. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +47 -0
  110. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +257 -0
  111. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
  112. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/README.md +43 -0
  113. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+BackingConfiguration.swift +149 -0
  114. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Deprecated.swift +23 -0
  115. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +361 -0
  116. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +205 -0
  117. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Progress.swift +66 -0
  118. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Reading.swift +160 -0
  119. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ReadingDeprecated.swift +50 -0
  120. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Writing.swift +403 -0
  121. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+WritingDeprecated.swift +95 -0
  122. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ZIP64.swift +191 -0
  123. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +404 -0
  124. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +632 -0
  125. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+CompressionDeprecated.swift +43 -0
  126. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +146 -0
  127. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift +101 -0
  128. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+Serialization.swift +191 -0
  129. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift +170 -0
  130. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +669 -0
  131. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +405 -0
  132. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIPDeprecated.swift +28 -0
  133. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/README.md +24 -0
  134. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift +34 -0
  135. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +177 -0
  136. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +54 -0
  137. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +191 -0
  138. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/NullCompositionLayer.swift +28 -0
  139. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +137 -0
  140. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +60 -0
  141. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +57 -0
  142. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +247 -0
  143. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +321 -0
  144. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +56 -0
  145. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +103 -0
  146. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +424 -0
  147. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +55 -0
  148. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +39 -0
  149. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +52 -0
  150. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +38 -0
  151. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +149 -0
  152. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +146 -0
  153. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +62 -0
  154. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +53 -0
  155. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyValueContainer.swift +26 -0
  156. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +23 -0
  157. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +43 -0
  158. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueContainer.swift +47 -0
  159. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/GroupInterpolator.swift +39 -0
  160. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/SingleValueProvider.swift +43 -0
  161. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +102 -0
  162. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +25 -0
  163. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +85 -0
  164. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +281 -0
  165. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +74 -0
  166. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +47 -0
  167. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +89 -0
  168. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +69 -0
  169. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +253 -0
  170. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +64 -0
  171. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +158 -0
  172. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +165 -0
  173. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +143 -0
  174. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +173 -0
  175. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +238 -0
  176. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +73 -0
  177. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +224 -0
  178. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +162 -0
  179. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +88 -0
  180. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +103 -0
  181. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +149 -0
  182. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +179 -0
  183. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +345 -0
  184. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +197 -0
  185. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +20 -0
  186. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +60 -0
  187. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +78 -0
  188. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +98 -0
  189. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/Asset.swift +51 -0
  190. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/AssetLibrary.swift +75 -0
  191. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/ImageAsset.swift +141 -0
  192. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/PrecompAsset.swift +47 -0
  193. package/platforms/macos/src/vendor/Lottie/Private/Model/DictionaryInitializable.swift +73 -0
  194. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieAnimation.swift +57 -0
  195. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieImageProvider.swift +89 -0
  196. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieManifest.swift +42 -0
  197. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieUtils.swift +71 -0
  198. package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/Bundle.swift +58 -0
  199. package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +71 -0
  200. package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeData.swift +111 -0
  201. package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeGroup.swift +265 -0
  202. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/DropShadowEffect.swift +52 -0
  203. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +45 -0
  204. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
  205. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +45 -0
  206. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/LayerEffect.swift +103 -0
  207. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/DropShadowStyle.swift +79 -0
  208. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/LayerStyle.swift +85 -0
  209. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ImageLayerModel.swift +49 -0
  210. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/LayerModel.swift +266 -0
  211. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/PreCompLayerModel.swift +74 -0
  212. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ShapeLayerModel.swift +50 -0
  213. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/SolidLayerModel.swift +63 -0
  214. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/TextLayerModel.swift +65 -0
  215. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/DashPattern.swift +42 -0
  216. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Marker.swift +35 -0
  217. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Mask.swift +80 -0
  218. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Transform.swift +261 -0
  219. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Ellipse.swift +79 -0
  220. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Fill.swift +79 -0
  221. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientFill.swift +142 -0
  222. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientStroke.swift +244 -0
  223. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Group.swift +55 -0
  224. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Merge.swift +63 -0
  225. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Rectangle.swift +79 -0
  226. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Repeater.swift +181 -0
  227. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/RoundedCorners.swift +53 -0
  228. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Shape.swift +63 -0
  229. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeItem.swift +171 -0
  230. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeTransform.swift +202 -0
  231. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Star.swift +136 -0
  232. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Stroke.swift +144 -0
  233. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Trim.swift +90 -0
  234. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Font.swift +67 -0
  235. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Glyph.swift +94 -0
  236. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextAnimator.swift +240 -0
  237. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextDocument.swift +142 -0
  238. package/platforms/macos/src/vendor/Lottie/Private/RootAnimationLayer.swift +54 -0
  239. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/AnimatorNodeDebugging.swift +23 -0
  240. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/LayerDebugging.swift +231 -0
  241. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/TestHelpers.swift +10 -0
  242. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/AnimationKeypathExtension.swift +303 -0
  243. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/BlendMode+Filter.swift +31 -0
  244. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGColor+RGB.swift +45 -0
  245. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGFloatExtensions.swift +152 -0
  246. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/DataExtension.swift +33 -0
  247. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/MathKit.swift +454 -0
  248. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/StringExtensions.swift +44 -0
  249. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnimationContext.swift +95 -0
  250. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnyEquatable.swift +23 -0
  251. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/Binding+Map.swift +19 -0
  252. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/View+ValueChanged.swift +35 -0
  253. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/InterpolatableExtensions.swift +143 -0
  254. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeExtensions.swift +47 -0
  255. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeInterpolator.swift +250 -0
  256. package/platforms/macos/src/vendor/Lottie/Private/Utility/LottieAnimationSource.swift +51 -0
  257. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPath.swift +509 -0
  258. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPathRoundExtension.swift +163 -0
  259. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CGPointExtension.swift +35 -0
  260. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/ColorExtension.swift +101 -0
  261. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CompoundBezierPath.swift +169 -0
  262. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CurveVertex.swift +190 -0
  263. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/PathElement.swift +78 -0
  264. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/UnitBezier.swift +119 -0
  265. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/VectorsExtensions.swift +368 -0
  266. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimation.swift +179 -0
  267. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationHelpers.swift +317 -0
  268. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationLayer.swift +1582 -0
  269. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationView.swift +1090 -0
  270. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationViewInitializers.swift +226 -0
  271. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottiePlaybackMode.swift +266 -0
  272. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieView.swift +643 -0
  273. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/AnimationCacheProvider.swift +21 -0
  274. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/DefaultAnimationCache.swift +67 -0
  275. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LRUAnimationCache.swift +11 -0
  276. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LottieAnimationCache.swift +15 -0
  277. package/platforms/macos/src/vendor/Lottie/Public/Configuration/DecodingStrategy.swift +15 -0
  278. package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieConfiguration.swift +54 -0
  279. package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieURLSession.swift +31 -0
  280. package/platforms/macos/src/vendor/Lottie/Public/Configuration/ReducedMotionOption.swift +128 -0
  281. package/platforms/macos/src/vendor/Lottie/Public/Configuration/RenderingEngineOption.swift +117 -0
  282. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedButton.swift +128 -0
  283. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedControl.swift +248 -0
  284. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedSwitch.swift +271 -0
  285. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieButton.swift +119 -0
  286. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieSwitch.swift +144 -0
  287. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieViewType.swift +79 -0
  288. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCache.swift +66 -0
  289. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCacheProvider.swift +21 -0
  290. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieConfiguration.swift +72 -0
  291. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFile.swift +186 -0
  292. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFileHelpers.swift +386 -0
  293. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnimationKeypath.swift +57 -0
  294. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnyValueProvider.swift +132 -0
  295. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +96 -0
  296. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +81 -0
  297. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +138 -0
  298. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +81 -0
  299. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +81 -0
  300. package/platforms/macos/src/vendor/Lottie/Public/FontProvider/AnimationFontProvider.swift +41 -0
  301. package/platforms/macos/src/vendor/Lottie/Public/ImageProvider/AnimationImageProvider.swift +43 -0
  302. package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Interpolatable.swift +285 -0
  303. package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Keyframe.swift +98 -0
  304. package/platforms/macos/src/vendor/Lottie/Public/Logging/LottieLogger.swift +138 -0
  305. package/platforms/macos/src/vendor/Lottie/Public/Primitives/AnimationTime.swift +15 -0
  306. package/platforms/macos/src/vendor/Lottie/Public/Primitives/LottieColor.swift +43 -0
  307. package/platforms/macos/src/vendor/Lottie/Public/Primitives/Vectors.swift +36 -0
  308. package/platforms/macos/src/vendor/Lottie/Public/TextProvider/AnimationTextProvider.swift +135 -0
  309. package/platforms/macos/src/vendor/Lottie/Public/iOS/AnimationSubview.swift +19 -0
  310. package/platforms/macos/src/vendor/Lottie/Public/iOS/BundleImageProvider.swift +98 -0
  311. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationKeypath.swift +33 -0
  312. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationView.swift +567 -0
  313. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleFontProvider.swift +41 -0
  314. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleImageProvider.swift +43 -0
  315. package/platforms/macos/src/vendor/Lottie/Public/iOS/FilepathImageProvider.swift +78 -0
  316. package/platforms/macos/src/vendor/Lottie/Public/iOS/LottieAnimationViewBase.swift +85 -0
  317. package/platforms/macos/src/vendor/Lottie/Public/iOS/UIColorExtension.swift +23 -0
  318. package/platforms/macos/src/vendor/Lottie/Public/macOS/AnimationSubview.macOS.swift +19 -0
  319. package/platforms/macos/src/vendor/Lottie/Public/macOS/BundleImageProvider.macOS.swift +90 -0
  320. package/platforms/macos/src/vendor/Lottie/Public/macOS/FilepathImageProvider.macOS.swift +86 -0
  321. package/platforms/macos/src/vendor/Lottie/Public/macOS/LottieAnimationViewBase.macOS.swift +102 -0
  322. package/src/Lottie.macos.tsrx +129 -0
  323. package/src/Lottie.tsrx +162 -0
  324. package/src/Lottie.web.tsrx +152 -0
  325. package/src/cx.mobile.ts +8 -0
  326. package/src/escape-props.ts +65 -0
  327. package/src/escape-props.web.ts +25 -0
  328. package/src/index.macos.ts +2 -0
  329. package/src/index.ts +2 -0
  330. package/src/index.web.ts +2 -0
  331. package/src/layout-child.ts +57 -0
  332. package/src/layout-child.web.ts +108 -0
  333. package/src/native-elements.d.ts +8 -0
  334. package/src/props.ts +133 -0
  335. package/src/references.d.ts +3 -0
  336. package/src/vendor/ui-lottie/LICENSE.md +21 -0
  337. package/src/vendor/ui-lottie/src/lottie/index.android.ts +447 -0
  338. package/src/vendor/ui-lottie/src/lottie/index.common.ts +84 -0
  339. package/src/vendor/ui-lottie/src/lottie/index.d.ts +133 -0
  340. package/src/vendor/ui-lottie/src/lottie/index.ios.ts +345 -0
  341. package/src/vendor/ui-lottie/src/lottie/typings/android.d.ts +4149 -0
  342. package/src/vendor/ui-lottie/src/lottie/typings/android.nativescript.d.ts +12 -0
  343. package/src/vendor/ui-lottie/src/lottie/typings/dotlottie.ios.d.ts +14 -0
  344. package/src/vendor/ui-lottie/src/lottie/typings/ios.d.ts +384 -0
  345. package/src/vendor/ui-lottie/src/lottie/utils.ts +9 -0
  346. package/types/generated/.tsrx-typegen-manifest.json +18 -0
  347. package/types/generated/Lottie.d.ts +7 -0
  348. package/types/generated/Lottie.web.d.ts +7 -0
  349. package/types/generated/cx.mobile.d.ts +6 -0
  350. package/types/generated/escape-props.d.ts +15 -0
  351. package/types/generated/escape-props.web.d.ts +5 -0
  352. package/types/generated/index.d.ts +2 -0
  353. package/types/generated/index.web.d.ts +2 -0
  354. package/types/generated/layout-child.d.ts +6 -0
  355. package/types/generated/layout-child.web.d.ts +15 -0
  356. package/types/generated/props.d.ts +110 -0
  357. package/types/generated/vendor/ui-lottie/src/lottie/index.common.d.ts +30 -0
  358. package/types/generated/vendor/ui-lottie/src/lottie/index.ios.d.ts +35 -0
  359. package/types/generated/vendor/ui-lottie/src/lottie/utils.d.ts +1 -0
  360. package/index.d.ts +0 -1
  361. package/index.js +0 -2
@@ -0,0 +1,95 @@
1
+ //
2
+ // Archive+WritingDeprecated.swift
3
+ // ZIPFoundation
4
+ //
5
+ // Copyright © 2017-2025 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors.
6
+ // Released under the MIT License.
7
+ //
8
+ // See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information.
9
+ //
10
+
11
+ import Foundation
12
+
13
+ extension Archive {
14
+
15
+ @available(
16
+ *,
17
+ deprecated,
18
+ message: "Please use `Int` for `bufferSize`."
19
+ )
20
+ func addEntry(
21
+ with path: String,
22
+ relativeTo baseURL: URL,
23
+ compressionMethod: CompressionMethod = .none,
24
+ bufferSize: UInt32,
25
+ progress: Progress? = nil
26
+ ) throws {
27
+ try addEntry(
28
+ with: path,
29
+ relativeTo: baseURL,
30
+ compressionMethod: compressionMethod,
31
+ bufferSize: Int(bufferSize),
32
+ progress: progress
33
+ )
34
+ }
35
+
36
+ @available(
37
+ *,
38
+ deprecated,
39
+ message: "Please use `Int` for `bufferSize`."
40
+ )
41
+ func addEntry(
42
+ with path: String,
43
+ fileURL: URL,
44
+ compressionMethod: CompressionMethod = .none,
45
+ bufferSize: UInt32,
46
+ progress: Progress? = nil
47
+ ) throws {
48
+ try addEntry(
49
+ with: path,
50
+ fileURL: fileURL,
51
+ compressionMethod: compressionMethod,
52
+ bufferSize: Int(bufferSize),
53
+ progress: progress
54
+ )
55
+ }
56
+
57
+ @available(
58
+ *,
59
+ deprecated,
60
+ message: "Please use `Int64` for `uncompressedSize` and provider `position`. `Int` for `bufferSize`."
61
+ )
62
+ func addEntry(
63
+ with path: String,
64
+ type: Entry.EntryType,
65
+ uncompressedSize: UInt32,
66
+ modificationDate: Date = Date(),
67
+ permissions: UInt16? = nil,
68
+ compressionMethod: CompressionMethod = .none,
69
+ bufferSize: Int = defaultWriteChunkSize,
70
+ progress: Progress? = nil,
71
+ provider: (_ position: Int, _ size: Int) throws -> Data
72
+ ) throws {
73
+ let newProvider: Provider = { try provider(Int($0), $1) }
74
+ try addEntry(
75
+ with: path,
76
+ type: type,
77
+ uncompressedSize: Int64(uncompressedSize),
78
+ modificationDate: modificationDate,
79
+ permissions: permissions,
80
+ compressionMethod: compressionMethod,
81
+ bufferSize: bufferSize,
82
+ progress: progress,
83
+ provider: newProvider
84
+ )
85
+ }
86
+
87
+ @available(
88
+ *,
89
+ deprecated,
90
+ message: "Please use `Int` for `bufferSize`."
91
+ )
92
+ func remove(_ entry: Entry, bufferSize: UInt32, progress: Progress? = nil) throws {
93
+ try remove(entry, bufferSize: Int(bufferSize), progress: progress)
94
+ }
95
+ }
@@ -0,0 +1,191 @@
1
+ //
2
+ // Archive+ZIP64.swift
3
+ // ZIPFoundation
4
+ //
5
+ // Copyright © 2017-2025 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors.
6
+ // Released under the MIT License.
7
+ //
8
+ // See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information.
9
+ //
10
+
11
+ import Foundation
12
+
13
+ let zip64EOCDRecordStructSignature = 0x06064b50
14
+ let zip64EOCDLocatorStructSignature = 0x07064b50
15
+
16
+ // MARK: - ExtraFieldHeaderID
17
+
18
+ enum ExtraFieldHeaderID: UInt16 {
19
+ case zip64ExtendedInformation = 0x0001
20
+ }
21
+
22
+ extension Archive {
23
+ struct ZIP64EndOfCentralDirectory {
24
+ let record: ZIP64EndOfCentralDirectoryRecord
25
+ let locator: ZIP64EndOfCentralDirectoryLocator
26
+ }
27
+
28
+ struct ZIP64EndOfCentralDirectoryRecord: DataSerializable {
29
+ static let size = 56
30
+
31
+ let zip64EOCDRecordSignature = UInt32(zip64EOCDRecordStructSignature)
32
+ let sizeOfZIP64EndOfCentralDirectoryRecord: UInt64
33
+ let versionMadeBy: UInt16
34
+ let versionNeededToExtract: UInt16
35
+ let numberOfDisk: UInt32
36
+ let numberOfDiskStart: UInt32
37
+ let totalNumberOfEntriesOnDisk: UInt64
38
+ let totalNumberOfEntriesInCentralDirectory: UInt64
39
+ let sizeOfCentralDirectory: UInt64
40
+ let offsetToStartOfCentralDirectory: UInt64
41
+ let zip64ExtensibleDataSector: Data
42
+ }
43
+
44
+ struct ZIP64EndOfCentralDirectoryLocator: DataSerializable {
45
+ static let size = 20
46
+
47
+ let zip64EOCDLocatorSignature = UInt32(zip64EOCDLocatorStructSignature)
48
+ let numberOfDiskWithZIP64EOCDRecordStart: UInt32
49
+ let relativeOffsetOfZIP64EOCDRecord: UInt64
50
+ let totalNumberOfDisk: UInt32
51
+ }
52
+ }
53
+
54
+ extension Archive.ZIP64EndOfCentralDirectoryRecord {
55
+
56
+ // MARK: Lifecycle
57
+
58
+ init?(data: Data, additionalDataProvider _: (Int) throws -> Data) {
59
+ guard data.count == Archive.ZIP64EndOfCentralDirectoryRecord.size else { return nil }
60
+ guard data.scanValue(start: 0) == zip64EOCDRecordSignature else { return nil }
61
+ sizeOfZIP64EndOfCentralDirectoryRecord = data.scanValue(start: 4)
62
+ versionMadeBy = data.scanValue(start: 12)
63
+ versionNeededToExtract = data.scanValue(start: 14)
64
+ // Version Needed to Extract: 4.5 - File uses ZIP64 format extensions
65
+ guard versionNeededToExtract >= Archive.Version.v45.rawValue else { return nil }
66
+ numberOfDisk = data.scanValue(start: 16)
67
+ numberOfDiskStart = data.scanValue(start: 20)
68
+ totalNumberOfEntriesOnDisk = data.scanValue(start: 24)
69
+ totalNumberOfEntriesInCentralDirectory = data.scanValue(start: 32)
70
+ sizeOfCentralDirectory = data.scanValue(start: 40)
71
+ offsetToStartOfCentralDirectory = data.scanValue(start: 48)
72
+ zip64ExtensibleDataSector = Data()
73
+ }
74
+
75
+ init(
76
+ record: Archive.ZIP64EndOfCentralDirectoryRecord,
77
+ numberOfEntriesOnDisk: UInt64,
78
+ numberOfEntriesInCD: UInt64,
79
+ sizeOfCentralDirectory: UInt64,
80
+ offsetToStartOfCD: UInt64
81
+ ) {
82
+ sizeOfZIP64EndOfCentralDirectoryRecord = record.sizeOfZIP64EndOfCentralDirectoryRecord
83
+ versionMadeBy = record.versionMadeBy
84
+ versionNeededToExtract = record.versionNeededToExtract
85
+ numberOfDisk = record.numberOfDisk
86
+ numberOfDiskStart = record.numberOfDiskStart
87
+ totalNumberOfEntriesOnDisk = numberOfEntriesOnDisk
88
+ totalNumberOfEntriesInCentralDirectory = numberOfEntriesInCD
89
+ self.sizeOfCentralDirectory = sizeOfCentralDirectory
90
+ offsetToStartOfCentralDirectory = offsetToStartOfCD
91
+ zip64ExtensibleDataSector = record.zip64ExtensibleDataSector
92
+ }
93
+
94
+ // MARK: Internal
95
+
96
+ var data: Data {
97
+ var zip64EOCDRecordSignature = zip64EOCDRecordSignature
98
+ var sizeOfZIP64EOCDRecord = sizeOfZIP64EndOfCentralDirectoryRecord
99
+ var versionMadeBy = versionMadeBy
100
+ var versionNeededToExtract = versionNeededToExtract
101
+ var numberOfDisk = numberOfDisk
102
+ var numberOfDiskStart = numberOfDiskStart
103
+ var totalNumberOfEntriesOnDisk = totalNumberOfEntriesOnDisk
104
+ var totalNumberOfEntriesInCD = totalNumberOfEntriesInCentralDirectory
105
+ var sizeOfCD = sizeOfCentralDirectory
106
+ var offsetToStartOfCD = offsetToStartOfCentralDirectory
107
+ var data = Data()
108
+ withUnsafePointer(to: &zip64EOCDRecordSignature) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
109
+ withUnsafePointer(to: &sizeOfZIP64EOCDRecord) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
110
+ withUnsafePointer(to: &versionMadeBy) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
111
+ withUnsafePointer(to: &versionNeededToExtract) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
112
+ withUnsafePointer(to: &numberOfDisk) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
113
+ withUnsafePointer(to: &numberOfDiskStart) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
114
+ withUnsafePointer(to: &totalNumberOfEntriesOnDisk) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
115
+ withUnsafePointer(to: &totalNumberOfEntriesInCD) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
116
+ withUnsafePointer(to: &sizeOfCD) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
117
+ withUnsafePointer(to: &offsetToStartOfCD) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
118
+ data.append(zip64ExtensibleDataSector)
119
+ return data
120
+ }
121
+
122
+ }
123
+
124
+ extension Archive.ZIP64EndOfCentralDirectoryLocator {
125
+
126
+ // MARK: Lifecycle
127
+
128
+ init?(data: Data, additionalDataProvider _: (Int) throws -> Data) {
129
+ guard data.count == Archive.ZIP64EndOfCentralDirectoryLocator.size else { return nil }
130
+ guard data.scanValue(start: 0) == zip64EOCDLocatorSignature else { return nil }
131
+ numberOfDiskWithZIP64EOCDRecordStart = data.scanValue(start: 4)
132
+ relativeOffsetOfZIP64EOCDRecord = data.scanValue(start: 8)
133
+ totalNumberOfDisk = data.scanValue(start: 16)
134
+ }
135
+
136
+ init(locator: Archive.ZIP64EndOfCentralDirectoryLocator, offsetOfZIP64EOCDRecord: UInt64) {
137
+ numberOfDiskWithZIP64EOCDRecordStart = locator.numberOfDiskWithZIP64EOCDRecordStart
138
+ relativeOffsetOfZIP64EOCDRecord = offsetOfZIP64EOCDRecord
139
+ totalNumberOfDisk = locator.totalNumberOfDisk
140
+ }
141
+
142
+ // MARK: Internal
143
+
144
+ var data: Data {
145
+ var zip64EOCDLocatorSignature = zip64EOCDLocatorSignature
146
+ var numberOfDiskWithZIP64EOCD = numberOfDiskWithZIP64EOCDRecordStart
147
+ var offsetOfZIP64EOCDRecord = relativeOffsetOfZIP64EOCDRecord
148
+ var totalNumberOfDisk = totalNumberOfDisk
149
+ var data = Data()
150
+ withUnsafePointer(to: &zip64EOCDLocatorSignature) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
151
+ withUnsafePointer(to: &numberOfDiskWithZIP64EOCD) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
152
+ withUnsafePointer(to: &offsetOfZIP64EOCDRecord) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
153
+ withUnsafePointer(to: &totalNumberOfDisk) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
154
+ return data
155
+ }
156
+
157
+ }
158
+
159
+ extension Archive.ZIP64EndOfCentralDirectory {
160
+ var data: Data {
161
+ record.data + locator.data
162
+ }
163
+ }
164
+
165
+ /// Properties that represent the maximum value of each field
166
+ var maxUInt32 = UInt32.max
167
+ var maxUInt16 = UInt16.max
168
+
169
+ var maxCompressedSize: UInt32 {
170
+ maxUInt32
171
+ }
172
+
173
+ var maxUncompressedSize: UInt32 {
174
+ maxUInt32
175
+ }
176
+
177
+ var maxOffsetOfLocalFileHeader: UInt32 {
178
+ maxUInt32
179
+ }
180
+
181
+ var maxOffsetOfCentralDirectory: UInt32 {
182
+ maxUInt32
183
+ }
184
+
185
+ var maxSizeOfCentralDirectory: UInt32 {
186
+ maxUInt32
187
+ }
188
+
189
+ var maxTotalNumberOfEntries: UInt16 {
190
+ maxUInt16
191
+ }
@@ -0,0 +1,404 @@
1
+ //
2
+ // Archive.swift
3
+ // ZIPFoundation
4
+ //
5
+ // Copyright © 2017-2025 Thomas Zoechling, https://www.peakstep.com and the ZIP Foundation project authors.
6
+ // Released under the MIT License.
7
+ //
8
+ // See https://github.com/weichsel/ZIPFoundation/blob/master/LICENSE for license information.
9
+ //
10
+
11
+ import Foundation
12
+
13
+ /// The default chunk size when reading entry data from an archive.
14
+ let defaultReadChunkSize = Int(16 * 1024)
15
+ /// The default chunk size when writing entry data to an archive.
16
+ let defaultWriteChunkSize = defaultReadChunkSize
17
+ /// The default permissions for newly added entries.
18
+ let defaultFilePermissions = UInt16(0o644)
19
+ /// The default permissions for newly added directories.
20
+ let defaultDirectoryPermissions = UInt16(0o755)
21
+ let defaultPOSIXBufferSize = defaultReadChunkSize
22
+ let defaultDirectoryUnitCount = Int64(1)
23
+ let minEndOfCentralDirectoryOffset = Int64(22)
24
+ let endOfCentralDirectoryStructSignature = 0x06054b50
25
+ let localFileHeaderStructSignature = 0x04034b50
26
+ let dataDescriptorStructSignature = 0x08074b50
27
+ let centralDirectoryStructSignature = 0x02014b50
28
+ let memoryURLScheme = "memory"
29
+
30
+ // MARK: - Archive
31
+
32
+ /// A sequence of uncompressed or compressed ZIP entries.
33
+ ///
34
+ /// You use an `Archive` to create, read or update ZIP files.
35
+ /// To read an existing ZIP file, you have to pass in an existing file `URL` and `AccessMode.read`:
36
+ ///
37
+ /// var archiveURL = URL(fileURLWithPath: "/path/file.zip")
38
+ /// var archive = Archive(url: archiveURL, accessMode: .read)
39
+ ///
40
+ /// An `Archive` is a sequence of entries. You can
41
+ /// iterate over an archive using a `for`-`in` loop to get access to individual `Entry` objects:
42
+ ///
43
+ /// for entry in archive {
44
+ /// print(entry.path)
45
+ /// }
46
+ ///
47
+ /// Each `Entry` in an `Archive` is represented by its `path`. You can
48
+ /// use `path` to retrieve the corresponding `Entry` from an `Archive` via subscripting:
49
+ ///
50
+ /// let entry = archive['/path/file.txt']
51
+ ///
52
+ /// To create a new `Archive`, pass in a non-existing file URL and `AccessMode.create`. To modify an
53
+ /// existing `Archive` use `AccessMode.update`:
54
+ ///
55
+ /// var archiveURL = URL(fileURLWithPath: "/path/file.zip")
56
+ /// var archive = Archive(url: archiveURL, accessMode: .update)
57
+ /// try archive?.addEntry("test.txt", relativeTo: baseURL, compressionMethod: .deflate)
58
+ final class Archive: Sequence {
59
+
60
+ // MARK: Lifecycle
61
+
62
+ /// Initializes a new ZIP `Archive`.
63
+ ///
64
+ /// You can use this initalizer to create new archive files or to read and update existing ones.
65
+ /// The `mode` parameter indicates the intended usage of the archive: `.read`, `.create` or `.update`.
66
+ /// - Parameters:
67
+ /// - url: File URL to the receivers backing file.
68
+ /// - mode: Access mode of the receiver.
69
+ /// - pathEncoding: Encoding for entry paths. Overrides the encoding specified in the archive.
70
+ /// This encoding is only used when _decoding_ paths from the receiver.
71
+ /// Paths of entries added with `addEntry` are always UTF-8 encoded.
72
+ /// - Returns: An archive initialized with a backing file at the passed in file URL and the given access mode
73
+ /// or `nil` if the following criteria are not met:
74
+ /// - Note:
75
+ /// - The file URL _must_ point to an existing file for `AccessMode.read`.
76
+ /// - The file URL _must_ point to a non-existing file for `AccessMode.create`.
77
+ /// - The file URL _must_ point to an existing file for `AccessMode.update`.
78
+ init(url: URL, accessMode mode: AccessMode, pathEncoding: String.Encoding? = nil) throws {
79
+ self.url = url
80
+ accessMode = mode
81
+ self.pathEncoding = pathEncoding
82
+ let config = try Archive.makeBackingConfiguration(for: url, mode: mode)
83
+ archiveFile = config.file
84
+ endOfCentralDirectoryRecord = config.endOfCentralDirectoryRecord
85
+ zip64EndOfCentralDirectory = config.zip64EndOfCentralDirectory
86
+ setvbuf(archiveFile, nil, _IOFBF, Int(defaultPOSIXBufferSize))
87
+ }
88
+
89
+ deinit {
90
+ fclose(self.archiveFile)
91
+ }
92
+
93
+ // MARK: Internal
94
+
95
+ typealias LocalFileHeader = Entry.LocalFileHeader
96
+ typealias DataDescriptor = Entry.DefaultDataDescriptor
97
+ typealias ZIP64DataDescriptor = Entry.ZIP64DataDescriptor
98
+ typealias CentralDirectoryStructure = Entry.CentralDirectoryStructure
99
+
100
+ /// An error that occurs during reading, creating or updating a ZIP file.
101
+ enum ArchiveError: Error {
102
+ /// Thrown when an archive file is either damaged or inaccessible.
103
+ case unreadableArchive
104
+ /// Thrown when an archive is either opened with AccessMode.read or the destination file is unwritable.
105
+ case unwritableArchive
106
+ /// Thrown when the path of an `Entry` cannot be stored in an archive.
107
+ case invalidEntryPath
108
+ /// Thrown when an `Entry` can't be stored in the archive with the proposed compression method.
109
+ case invalidCompressionMethod
110
+ /// Thrown when the stored checksum of an `Entry` doesn't match the checksum during reading.
111
+ case invalidCRC32
112
+ /// Thrown when an extract, add or remove operation was canceled.
113
+ case cancelledOperation
114
+ /// Thrown when an extract operation was called with zero or negative `bufferSize` parameter.
115
+ case invalidBufferSize
116
+ /// Thrown when uncompressedSize/compressedSize exceeds `Int64.max` (Imposed by file API).
117
+ case invalidEntrySize
118
+ /// Thrown when the offset of local header data exceeds `Int64.max` (Imposed by file API).
119
+ case invalidLocalHeaderDataOffset
120
+ /// Thrown when the size of local header exceeds `Int64.max` (Imposed by file API).
121
+ case invalidLocalHeaderSize
122
+ /// Thrown when the offset of central directory exceeds `Int64.max` (Imposed by file API).
123
+ case invalidCentralDirectoryOffset
124
+ /// Thrown when the size of central directory exceeds `UInt64.max` (Imposed by ZIP specification).
125
+ case invalidCentralDirectorySize
126
+ /// Thrown when number of entries in central directory exceeds `UInt64.max` (Imposed by ZIP specification).
127
+ case invalidCentralDirectoryEntryCount
128
+ /// Thrown when an archive does not contain the required End of Central Directory Record.
129
+ case missingEndOfCentralDirectoryRecord
130
+ /// Thrown when an entry contains a symlink pointing to a path outside the destination directory.
131
+ case uncontainedSymlink
132
+ }
133
+
134
+ /// The access mode for an `Archive`.
135
+ enum AccessMode: UInt {
136
+ /// Indicates that a newly instantiated `Archive` should create its backing file.
137
+ case create
138
+ /// Indicates that a newly instantiated `Archive` should read from an existing backing file.
139
+ case read
140
+ /// Indicates that a newly instantiated `Archive` should update an existing backing file.
141
+ case update
142
+
143
+ /// Indicates that the archive can be written to.
144
+ var isWritable: Bool {
145
+ self != .read
146
+ }
147
+ }
148
+
149
+ /// The version of an `Archive`
150
+ enum Version: UInt16 {
151
+ /// The minimum version for deflate compressed archives
152
+ case v20 = 20
153
+ /// The minimum version for archives making use of ZIP64 extensions
154
+ case v45 = 45
155
+ }
156
+
157
+ struct EndOfCentralDirectoryRecord: DataSerializable {
158
+ static let size = 22
159
+
160
+ let endOfCentralDirectorySignature = UInt32(endOfCentralDirectoryStructSignature)
161
+ let numberOfDisk: UInt16
162
+ let numberOfDiskStart: UInt16
163
+ let totalNumberOfEntriesOnDisk: UInt16
164
+ let totalNumberOfEntriesInCentralDirectory: UInt16
165
+ let sizeOfCentralDirectory: UInt32
166
+ let offsetToStartOfCentralDirectory: UInt32
167
+ let zipFileCommentLength: UInt16
168
+ let zipFileCommentData: Data
169
+ }
170
+
171
+ /// URL of an Archive's backing file.
172
+ let url: URL
173
+ /// Access mode for an archive file.
174
+ let accessMode: AccessMode
175
+ var endOfCentralDirectoryRecord: EndOfCentralDirectoryRecord
176
+ var zip64EndOfCentralDirectory: ZIP64EndOfCentralDirectory?
177
+ var pathEncoding: String.Encoding?
178
+
179
+ #if swift(>=5.0)
180
+ var memoryFile: MemoryFile?
181
+
182
+ /// Initializes a new in-memory ZIP `Archive`.
183
+ ///
184
+ /// You can use this initalizer to create new in-memory archive files or to read and update existing ones.
185
+ ///
186
+ /// - Parameters:
187
+ /// - data: `Data` object used as backing for in-memory archives.
188
+ /// - mode: Access mode of the receiver.
189
+ /// - pathEncoding: Encoding for entry paths. Overrides the encoding specified in the archive.
190
+ /// This encoding is only used when _decoding_ paths from the receiver.
191
+ /// Paths of entries added with `addEntry` are always UTF-8 encoded.
192
+ /// - Returns: An in-memory archive initialized with passed in backing data.
193
+ /// - Note:
194
+ /// - The backing `data` _must_ contain a valid ZIP archive for `AccessMode.read` and `AccessMode.update`.
195
+ /// - The backing `data` _must_ be empty (or omitted) for `AccessMode.create`.
196
+ init(data: Data = Data(), accessMode mode: AccessMode, pathEncoding: String.Encoding? = nil) throws {
197
+ let url = URL(string: "\(memoryURLScheme)://")!
198
+ self.url = url
199
+ accessMode = mode
200
+ self.pathEncoding = pathEncoding
201
+ let config = try Archive.makeBackingConfiguration(for: data, mode: mode)
202
+ archiveFile = config.file
203
+ memoryFile = config.memoryFile
204
+ endOfCentralDirectoryRecord = config.endOfCentralDirectoryRecord
205
+ zip64EndOfCentralDirectory = config.zip64EndOfCentralDirectory
206
+ }
207
+ #endif
208
+
209
+ var archiveFile: FILEPointer {
210
+ willSet {
211
+ fclose(archiveFile)
212
+ }
213
+ }
214
+
215
+ var totalNumberOfEntriesInCentralDirectory: UInt64 {
216
+ zip64EndOfCentralDirectory?.record.totalNumberOfEntriesInCentralDirectory
217
+ ?? UInt64(endOfCentralDirectoryRecord.totalNumberOfEntriesInCentralDirectory)
218
+ }
219
+
220
+ var sizeOfCentralDirectory: UInt64 {
221
+ zip64EndOfCentralDirectory?.record.sizeOfCentralDirectory
222
+ ?? UInt64(endOfCentralDirectoryRecord.sizeOfCentralDirectory)
223
+ }
224
+
225
+ var offsetToStartOfCentralDirectory: UInt64 {
226
+ zip64EndOfCentralDirectory?.record.offsetToStartOfCentralDirectory
227
+ ?? UInt64(endOfCentralDirectoryRecord.offsetToStartOfCentralDirectory)
228
+ }
229
+
230
+ static func scanForEndOfCentralDirectoryRecord(in file: FILEPointer)
231
+ -> EndOfCentralDirectoryStructure?
232
+ {
233
+ var eocdOffset: UInt64 = 0
234
+ var index = minEndOfCentralDirectoryOffset
235
+ fseeko(file, 0, SEEK_END)
236
+ let archiveLength = Int64(ftello(file))
237
+ guard archiveLength >= 0 else { return nil }
238
+
239
+ while eocdOffset == 0, index <= archiveLength {
240
+ fseeko(file, off_t(archiveLength - index), SEEK_SET)
241
+ var potentialDirectoryEndTag = UInt32()
242
+ fread(&potentialDirectoryEndTag, 1, MemoryLayout<UInt32>.size, file)
243
+ if potentialDirectoryEndTag == UInt32(endOfCentralDirectoryStructSignature) {
244
+ eocdOffset = UInt64(archiveLength - index)
245
+ guard let eocd: EndOfCentralDirectoryRecord = Data.readStruct(from: file, at: eocdOffset) else {
246
+ return nil
247
+ }
248
+ let zip64EOCD = scanForZIP64EndOfCentralDirectory(in: file, eocdOffset: eocdOffset)
249
+ return (eocd, zip64EOCD)
250
+ }
251
+ index += 1
252
+ }
253
+ return nil
254
+ }
255
+
256
+ func makeIterator() -> AnyIterator<Entry> {
257
+ let totalNumberOfEntriesInCD = totalNumberOfEntriesInCentralDirectory
258
+ var directoryIndex = offsetToStartOfCentralDirectory
259
+ var index = 0
260
+ return AnyIterator {
261
+ guard index < totalNumberOfEntriesInCD else { return nil }
262
+ guard
263
+ let centralDirStruct: CentralDirectoryStructure = Data.readStruct(
264
+ from: self.archiveFile,
265
+ at: directoryIndex
266
+ )
267
+ else {
268
+ return nil
269
+ }
270
+ let offset = UInt64(centralDirStruct.effectiveRelativeOffsetOfLocalHeader)
271
+ guard
272
+ let localFileHeader: LocalFileHeader = Data.readStruct(
273
+ from: self.archiveFile,
274
+ at: offset
275
+ )
276
+ else { return nil }
277
+ var dataDescriptor: DataDescriptor?
278
+ var zip64DataDescriptor: ZIP64DataDescriptor?
279
+ if centralDirStruct.usesDataDescriptor {
280
+ let additionalSize = UInt64(localFileHeader.fileNameLength) + UInt64(localFileHeader.extraFieldLength)
281
+ let isCompressed = centralDirStruct.compressionMethod != CompressionMethod.none.rawValue
282
+ let dataSize = isCompressed
283
+ ? centralDirStruct.effectiveCompressedSize
284
+ : centralDirStruct.effectiveUncompressedSize
285
+ let descriptorPosition = offset + UInt64(LocalFileHeader.size) + additionalSize + dataSize
286
+ if centralDirStruct.isZIP64 {
287
+ zip64DataDescriptor = Data.readStruct(from: self.archiveFile, at: descriptorPosition)
288
+ } else {
289
+ dataDescriptor = Data.readStruct(from: self.archiveFile, at: descriptorPosition)
290
+ }
291
+ }
292
+ defer {
293
+ directoryIndex += UInt64(CentralDirectoryStructure.size)
294
+ directoryIndex += UInt64(centralDirStruct.fileNameLength)
295
+ directoryIndex += UInt64(centralDirStruct.extraFieldLength)
296
+ directoryIndex += UInt64(centralDirStruct.fileCommentLength)
297
+ index += 1
298
+ }
299
+ return Entry(
300
+ centralDirectoryStructure: centralDirStruct,
301
+ localFileHeader: localFileHeader,
302
+ dataDescriptor: dataDescriptor,
303
+ zip64DataDescriptor: zip64DataDescriptor
304
+ )
305
+ }
306
+ }
307
+
308
+ /// Retrieve the ZIP `Entry` with the given `path` from the receiver.
309
+ ///
310
+ /// - Note: The ZIP file format specification does not enforce unique paths for entries.
311
+ /// Therefore an archive can contain multiple entries with the same path. This method
312
+ /// always returns the first `Entry` with the given `path`.
313
+ ///
314
+ /// - Parameter path: A relative file path identifying the corresponding `Entry`.
315
+ /// - Returns: An `Entry` with the given `path`. Otherwise, `nil`.
316
+ subscript(path: String) -> Entry? {
317
+ if let encoding = pathEncoding {
318
+ return first { $0.path(using: encoding) == path }
319
+ }
320
+ return first { $0.path == path }
321
+ }
322
+
323
+ // MARK: Private
324
+
325
+ private static func scanForZIP64EndOfCentralDirectory(in file: FILEPointer, eocdOffset: UInt64)
326
+ -> ZIP64EndOfCentralDirectory?
327
+ {
328
+ guard UInt64(ZIP64EndOfCentralDirectoryLocator.size) < eocdOffset else { return nil }
329
+
330
+ let locatorOffset = eocdOffset - UInt64(ZIP64EndOfCentralDirectoryLocator.size)
331
+ guard UInt64(ZIP64EndOfCentralDirectoryRecord.size) < locatorOffset else { return nil }
332
+
333
+ let recordOffset = locatorOffset - UInt64(ZIP64EndOfCentralDirectoryRecord.size)
334
+ guard
335
+ let locator: ZIP64EndOfCentralDirectoryLocator = Data.readStruct(from: file, at: locatorOffset),
336
+ let record: ZIP64EndOfCentralDirectoryRecord = Data.readStruct(from: file, at: recordOffset)
337
+ else {
338
+ return nil
339
+ }
340
+ return ZIP64EndOfCentralDirectory(record: record, locator: locator)
341
+ }
342
+ }
343
+
344
+ extension Archive.EndOfCentralDirectoryRecord {
345
+
346
+ // MARK: Lifecycle
347
+
348
+ init?(data: Data, additionalDataProvider provider: (Int) throws -> Data) {
349
+ guard data.count == Archive.EndOfCentralDirectoryRecord.size else { return nil }
350
+ guard data.scanValue(start: 0) == endOfCentralDirectorySignature else { return nil }
351
+ numberOfDisk = data.scanValue(start: 4)
352
+ numberOfDiskStart = data.scanValue(start: 6)
353
+ totalNumberOfEntriesOnDisk = data.scanValue(start: 8)
354
+ totalNumberOfEntriesInCentralDirectory = data.scanValue(start: 10)
355
+ sizeOfCentralDirectory = data.scanValue(start: 12)
356
+ offsetToStartOfCentralDirectory = data.scanValue(start: 16)
357
+ zipFileCommentLength = data.scanValue(start: 20)
358
+ guard let commentData = try? provider(Int(zipFileCommentLength)) else { return nil }
359
+ guard commentData.count == Int(zipFileCommentLength) else { return nil }
360
+ zipFileCommentData = commentData
361
+ }
362
+
363
+ init(
364
+ record: Archive.EndOfCentralDirectoryRecord,
365
+ numberOfEntriesOnDisk: UInt16,
366
+ numberOfEntriesInCentralDirectory: UInt16,
367
+ updatedSizeOfCentralDirectory: UInt32,
368
+ startOfCentralDirectory: UInt32
369
+ ) {
370
+ numberOfDisk = record.numberOfDisk
371
+ numberOfDiskStart = record.numberOfDiskStart
372
+ totalNumberOfEntriesOnDisk = numberOfEntriesOnDisk
373
+ totalNumberOfEntriesInCentralDirectory = numberOfEntriesInCentralDirectory
374
+ sizeOfCentralDirectory = updatedSizeOfCentralDirectory
375
+ offsetToStartOfCentralDirectory = startOfCentralDirectory
376
+ zipFileCommentLength = record.zipFileCommentLength
377
+ zipFileCommentData = record.zipFileCommentData
378
+ }
379
+
380
+ // MARK: Internal
381
+
382
+ var data: Data {
383
+ var endOfCDSignature = endOfCentralDirectorySignature
384
+ var numberOfDisk = numberOfDisk
385
+ var numberOfDiskStart = numberOfDiskStart
386
+ var totalNumberOfEntriesOnDisk = totalNumberOfEntriesOnDisk
387
+ var totalNumberOfEntriesInCD = totalNumberOfEntriesInCentralDirectory
388
+ var sizeOfCentralDirectory = sizeOfCentralDirectory
389
+ var offsetToStartOfCD = offsetToStartOfCentralDirectory
390
+ var zipFileCommentLength = zipFileCommentLength
391
+ var data = Data()
392
+ withUnsafePointer(to: &endOfCDSignature) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
393
+ withUnsafePointer(to: &numberOfDisk) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
394
+ withUnsafePointer(to: &numberOfDiskStart) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
395
+ withUnsafePointer(to: &totalNumberOfEntriesOnDisk) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
396
+ withUnsafePointer(to: &totalNumberOfEntriesInCD) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
397
+ withUnsafePointer(to: &sizeOfCentralDirectory) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
398
+ withUnsafePointer(to: &offsetToStartOfCD) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
399
+ withUnsafePointer(to: &zipFileCommentLength) { data.append(UnsafeBufferPointer(start: $0, count: 1)) }
400
+ data.append(zipFileCommentData)
401
+ return data
402
+ }
403
+
404
+ }