@octane-xplat/lottie 0.9.0 → 0.11.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 (313) hide show
  1. package/README.md +36 -16
  2. package/dist/native/index.js +10 -9
  3. package/dist/native/octane-client-build.json +1 -1
  4. package/dist/web/index.js +39 -25
  5. package/dist/web/octane-client-build.json +1 -1
  6. package/package.json +25 -3
  7. package/platforms/macos/LICENSE-EpoxyCore-Apache-2.0.txt +201 -0
  8. package/platforms/macos/LICENSE-LRUCache-MIT.txt +22 -0
  9. package/platforms/macos/LICENSE-Lottie-Apache-2.0.txt +201 -0
  10. package/platforms/macos/LICENSE-ZIPFoundation-MIT.txt +21 -0
  11. package/platforms/macos/UPSTREAM.md +13 -0
  12. package/platforms/macos/resources/PrivacyInfo.xcprivacy +23 -0
  13. package/platforms/macos/resources/THIRD-PARTY-NOTICES.txt +10 -0
  14. package/platforms/macos/src/XplatAppKitLottie.swift +246 -0
  15. package/platforms/macos/src/vendor/Lottie/PrivacyInfo.xcprivacy +23 -0
  16. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +81 -0
  17. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +476 -0
  18. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +92 -0
  19. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CustomPathAnimation.swift +89 -0
  20. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift +179 -0
  21. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift +53 -0
  22. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift +287 -0
  23. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/LayerProperty.swift +440 -0
  24. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/OpacityAnimation.swift +53 -0
  25. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/RectangleAnimation.swift +59 -0
  26. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift +246 -0
  27. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift +119 -0
  28. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift +96 -0
  29. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/TransformAnimations.swift +380 -0
  30. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/VisibilityAnimation.swift +63 -0
  31. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CompatibilityTracker.swift +129 -0
  32. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CoreAnimationLayer.swift +645 -0
  33. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +35 -0
  34. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +28 -0
  35. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift +345 -0
  36. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
  37. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/AnimationLayer.swift +169 -0
  38. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +46 -0
  39. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +120 -0
  40. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +169 -0
  41. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift +101 -0
  42. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ImageLayer.swift +81 -0
  43. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/InfiniteOpaqueAnimationLayer.swift +57 -0
  44. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +59 -0
  45. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/MaskCompositionLayer.swift +139 -0
  46. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/PreCompLayer.swift +107 -0
  47. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/RepeaterLayer.swift +113 -0
  48. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeItemLayer.swift +346 -0
  49. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeLayer.swift +569 -0
  50. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/SolidLayer.swift +66 -0
  51. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TextLayer.swift +157 -0
  52. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TransformLayer.swift +13 -0
  53. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/ValueProviderStore.swift +157 -0
  54. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +267 -0
  55. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +19 -0
  56. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
  57. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
  58. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +22 -0
  59. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +102 -0
  60. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
  61. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
  62. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
  63. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
  64. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
  65. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +31 -0
  66. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
  67. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
  68. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +58 -0
  69. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
  70. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +42 -0
  71. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
  72. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
  73. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +61 -0
  74. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
  75. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
  76. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +38 -0
  77. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
  78. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
  79. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
  80. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
  81. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
  82. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/README.md +30 -0
  83. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +34 -0
  84. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +38 -0
  85. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +165 -0
  86. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +127 -0
  87. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +468 -0
  88. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +146 -0
  89. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +39 -0
  90. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +41 -0
  91. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
  92. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
  93. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
  94. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +43 -0
  95. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +47 -0
  96. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +257 -0
  97. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
  98. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/README.md +43 -0
  99. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+BackingConfiguration.swift +149 -0
  100. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Deprecated.swift +23 -0
  101. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +361 -0
  102. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +205 -0
  103. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Progress.swift +66 -0
  104. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Reading.swift +160 -0
  105. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ReadingDeprecated.swift +50 -0
  106. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Writing.swift +403 -0
  107. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+WritingDeprecated.swift +95 -0
  108. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ZIP64.swift +191 -0
  109. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +404 -0
  110. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +632 -0
  111. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+CompressionDeprecated.swift +43 -0
  112. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +146 -0
  113. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift +101 -0
  114. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+Serialization.swift +191 -0
  115. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift +170 -0
  116. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +669 -0
  117. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +405 -0
  118. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIPDeprecated.swift +28 -0
  119. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/README.md +24 -0
  120. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift +34 -0
  121. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +177 -0
  122. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +54 -0
  123. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +191 -0
  124. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/NullCompositionLayer.swift +28 -0
  125. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +137 -0
  126. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +60 -0
  127. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +57 -0
  128. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +247 -0
  129. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +321 -0
  130. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +56 -0
  131. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +103 -0
  132. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +424 -0
  133. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +55 -0
  134. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +39 -0
  135. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +52 -0
  136. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +38 -0
  137. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +149 -0
  138. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +146 -0
  139. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +62 -0
  140. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +53 -0
  141. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyValueContainer.swift +26 -0
  142. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +23 -0
  143. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +43 -0
  144. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueContainer.swift +47 -0
  145. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/GroupInterpolator.swift +39 -0
  146. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/SingleValueProvider.swift +43 -0
  147. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +102 -0
  148. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +25 -0
  149. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +85 -0
  150. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +281 -0
  151. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +74 -0
  152. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +47 -0
  153. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +89 -0
  154. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +69 -0
  155. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +253 -0
  156. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +64 -0
  157. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +158 -0
  158. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +165 -0
  159. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +143 -0
  160. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +173 -0
  161. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +238 -0
  162. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +73 -0
  163. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +224 -0
  164. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +162 -0
  165. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +88 -0
  166. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +103 -0
  167. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +149 -0
  168. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +179 -0
  169. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +345 -0
  170. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +197 -0
  171. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +20 -0
  172. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +60 -0
  173. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +78 -0
  174. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +98 -0
  175. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/Asset.swift +51 -0
  176. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/AssetLibrary.swift +75 -0
  177. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/ImageAsset.swift +141 -0
  178. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/PrecompAsset.swift +47 -0
  179. package/platforms/macos/src/vendor/Lottie/Private/Model/DictionaryInitializable.swift +73 -0
  180. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieAnimation.swift +57 -0
  181. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieImageProvider.swift +89 -0
  182. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieManifest.swift +42 -0
  183. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieUtils.swift +71 -0
  184. package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/Bundle.swift +58 -0
  185. package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +71 -0
  186. package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeData.swift +111 -0
  187. package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeGroup.swift +265 -0
  188. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/DropShadowEffect.swift +52 -0
  189. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +45 -0
  190. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
  191. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +45 -0
  192. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/LayerEffect.swift +103 -0
  193. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/DropShadowStyle.swift +79 -0
  194. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/LayerStyle.swift +85 -0
  195. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ImageLayerModel.swift +49 -0
  196. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/LayerModel.swift +266 -0
  197. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/PreCompLayerModel.swift +74 -0
  198. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ShapeLayerModel.swift +50 -0
  199. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/SolidLayerModel.swift +63 -0
  200. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/TextLayerModel.swift +65 -0
  201. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/DashPattern.swift +42 -0
  202. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Marker.swift +35 -0
  203. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Mask.swift +80 -0
  204. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Transform.swift +261 -0
  205. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Ellipse.swift +79 -0
  206. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Fill.swift +79 -0
  207. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientFill.swift +142 -0
  208. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientStroke.swift +244 -0
  209. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Group.swift +55 -0
  210. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Merge.swift +63 -0
  211. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Rectangle.swift +79 -0
  212. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Repeater.swift +181 -0
  213. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/RoundedCorners.swift +53 -0
  214. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Shape.swift +63 -0
  215. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeItem.swift +171 -0
  216. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeTransform.swift +202 -0
  217. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Star.swift +136 -0
  218. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Stroke.swift +144 -0
  219. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Trim.swift +90 -0
  220. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Font.swift +67 -0
  221. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Glyph.swift +94 -0
  222. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextAnimator.swift +240 -0
  223. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextDocument.swift +142 -0
  224. package/platforms/macos/src/vendor/Lottie/Private/RootAnimationLayer.swift +54 -0
  225. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/AnimatorNodeDebugging.swift +23 -0
  226. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/LayerDebugging.swift +231 -0
  227. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/TestHelpers.swift +10 -0
  228. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/AnimationKeypathExtension.swift +303 -0
  229. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/BlendMode+Filter.swift +31 -0
  230. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGColor+RGB.swift +45 -0
  231. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGFloatExtensions.swift +152 -0
  232. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/DataExtension.swift +33 -0
  233. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/MathKit.swift +454 -0
  234. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/StringExtensions.swift +44 -0
  235. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnimationContext.swift +95 -0
  236. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnyEquatable.swift +23 -0
  237. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/Binding+Map.swift +19 -0
  238. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/View+ValueChanged.swift +35 -0
  239. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/InterpolatableExtensions.swift +143 -0
  240. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeExtensions.swift +47 -0
  241. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeInterpolator.swift +250 -0
  242. package/platforms/macos/src/vendor/Lottie/Private/Utility/LottieAnimationSource.swift +51 -0
  243. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPath.swift +509 -0
  244. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPathRoundExtension.swift +163 -0
  245. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CGPointExtension.swift +35 -0
  246. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/ColorExtension.swift +101 -0
  247. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CompoundBezierPath.swift +169 -0
  248. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CurveVertex.swift +190 -0
  249. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/PathElement.swift +78 -0
  250. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/UnitBezier.swift +119 -0
  251. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/VectorsExtensions.swift +368 -0
  252. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimation.swift +179 -0
  253. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationHelpers.swift +317 -0
  254. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationLayer.swift +1582 -0
  255. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationView.swift +1090 -0
  256. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationViewInitializers.swift +226 -0
  257. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottiePlaybackMode.swift +266 -0
  258. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieView.swift +643 -0
  259. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/AnimationCacheProvider.swift +21 -0
  260. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/DefaultAnimationCache.swift +67 -0
  261. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LRUAnimationCache.swift +11 -0
  262. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LottieAnimationCache.swift +15 -0
  263. package/platforms/macos/src/vendor/Lottie/Public/Configuration/DecodingStrategy.swift +15 -0
  264. package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieConfiguration.swift +54 -0
  265. package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieURLSession.swift +31 -0
  266. package/platforms/macos/src/vendor/Lottie/Public/Configuration/ReducedMotionOption.swift +128 -0
  267. package/platforms/macos/src/vendor/Lottie/Public/Configuration/RenderingEngineOption.swift +117 -0
  268. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedButton.swift +128 -0
  269. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedControl.swift +248 -0
  270. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedSwitch.swift +271 -0
  271. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieButton.swift +119 -0
  272. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieSwitch.swift +144 -0
  273. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieViewType.swift +79 -0
  274. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCache.swift +66 -0
  275. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCacheProvider.swift +21 -0
  276. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieConfiguration.swift +72 -0
  277. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFile.swift +186 -0
  278. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFileHelpers.swift +386 -0
  279. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnimationKeypath.swift +57 -0
  280. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnyValueProvider.swift +132 -0
  281. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +96 -0
  282. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +81 -0
  283. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +138 -0
  284. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +81 -0
  285. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +81 -0
  286. package/platforms/macos/src/vendor/Lottie/Public/FontProvider/AnimationFontProvider.swift +41 -0
  287. package/platforms/macos/src/vendor/Lottie/Public/ImageProvider/AnimationImageProvider.swift +43 -0
  288. package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Interpolatable.swift +285 -0
  289. package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Keyframe.swift +98 -0
  290. package/platforms/macos/src/vendor/Lottie/Public/Logging/LottieLogger.swift +138 -0
  291. package/platforms/macos/src/vendor/Lottie/Public/Primitives/AnimationTime.swift +15 -0
  292. package/platforms/macos/src/vendor/Lottie/Public/Primitives/LottieColor.swift +43 -0
  293. package/platforms/macos/src/vendor/Lottie/Public/Primitives/Vectors.swift +36 -0
  294. package/platforms/macos/src/vendor/Lottie/Public/TextProvider/AnimationTextProvider.swift +135 -0
  295. package/platforms/macos/src/vendor/Lottie/Public/iOS/AnimationSubview.swift +19 -0
  296. package/platforms/macos/src/vendor/Lottie/Public/iOS/BundleImageProvider.swift +98 -0
  297. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationKeypath.swift +33 -0
  298. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationView.swift +567 -0
  299. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleFontProvider.swift +41 -0
  300. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleImageProvider.swift +43 -0
  301. package/platforms/macos/src/vendor/Lottie/Public/iOS/FilepathImageProvider.swift +78 -0
  302. package/platforms/macos/src/vendor/Lottie/Public/iOS/LottieAnimationViewBase.swift +85 -0
  303. package/platforms/macos/src/vendor/Lottie/Public/iOS/UIColorExtension.swift +23 -0
  304. package/platforms/macos/src/vendor/Lottie/Public/macOS/AnimationSubview.macOS.swift +19 -0
  305. package/platforms/macos/src/vendor/Lottie/Public/macOS/BundleImageProvider.macOS.swift +90 -0
  306. package/platforms/macos/src/vendor/Lottie/Public/macOS/FilepathImageProvider.macOS.swift +86 -0
  307. package/platforms/macos/src/vendor/Lottie/Public/macOS/LottieAnimationViewBase.macOS.swift +102 -0
  308. package/src/Lottie.macos.tsrx +129 -0
  309. package/src/Lottie.tsrx +6 -4
  310. package/src/Lottie.web.tsrx +28 -11
  311. package/src/index.macos.ts +2 -0
  312. package/src/props.ts +6 -1
  313. package/types/generated/props.d.ts +5 -1
@@ -0,0 +1,361 @@
1
+ //
2
+ // Archive+Helpers.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
+ func readUncompressed(
16
+ entry: Entry,
17
+ bufferSize: Int,
18
+ skipCRC32: Bool,
19
+ progress: Progress? = nil,
20
+ with consumer: Consumer
21
+ ) throws -> CRC32 {
22
+ let size = entry.centralDirectoryStructure.effectiveUncompressedSize
23
+ guard size <= .max else { throw ArchiveError.invalidEntrySize }
24
+ return try Data.consumePart(
25
+ of: Int64(size),
26
+ chunkSize: bufferSize,
27
+ skipCRC32: skipCRC32,
28
+ provider: { _, chunkSize -> Data in
29
+ return try Data.readChunk(of: chunkSize, from: self.archiveFile)
30
+ },
31
+ consumer: { data in
32
+ if progress?.isCancelled == true { throw ArchiveError.cancelledOperation }
33
+ try consumer(data)
34
+ progress?.completedUnitCount += Int64(data.count)
35
+ }
36
+ )
37
+ }
38
+
39
+ func readCompressed(
40
+ entry: Entry,
41
+ bufferSize: Int,
42
+ skipCRC32: Bool,
43
+ progress: Progress? = nil,
44
+ with consumer: Consumer
45
+ ) throws -> CRC32 {
46
+ let size = entry.centralDirectoryStructure.effectiveCompressedSize
47
+ guard size <= .max else { throw ArchiveError.invalidEntrySize }
48
+ return try Data.decompress(
49
+ size: Int64(size),
50
+ bufferSize: bufferSize,
51
+ skipCRC32: skipCRC32,
52
+ provider: { _, chunkSize -> Data in
53
+ return try Data.readChunk(of: chunkSize, from: self.archiveFile)
54
+ },
55
+ consumer: { data in
56
+ if progress?.isCancelled == true { throw ArchiveError.cancelledOperation }
57
+ try consumer(data)
58
+ progress?.completedUnitCount += Int64(data.count)
59
+ }
60
+ )
61
+ }
62
+
63
+ func writeEntry(
64
+ uncompressedSize: Int64,
65
+ type: Entry.EntryType,
66
+ compressionMethod: CompressionMethod,
67
+ bufferSize: Int,
68
+ progress: Progress? = nil,
69
+ provider: Provider
70
+ ) throws -> (sizeWritten: Int64, crc32: CRC32) {
71
+ var checksum = CRC32(0)
72
+ var sizeWritten = Int64(0)
73
+ switch type {
74
+ case .file:
75
+ switch compressionMethod {
76
+ case .none:
77
+ (sizeWritten, checksum) = try writeUncompressed(
78
+ size: uncompressedSize,
79
+ bufferSize: bufferSize,
80
+ progress: progress,
81
+ provider: provider
82
+ )
83
+
84
+ case .deflate:
85
+ (sizeWritten, checksum) = try writeCompressed(
86
+ size: uncompressedSize,
87
+ bufferSize: bufferSize,
88
+ progress: progress,
89
+ provider: provider
90
+ )
91
+ }
92
+
93
+ case .directory:
94
+ _ = try provider(0, 0)
95
+ if let progress { progress.completedUnitCount = progress.totalUnitCount }
96
+
97
+ case .symlink:
98
+ let (linkSizeWritten, linkChecksum) = try writeSymbolicLink(
99
+ size: Int(uncompressedSize),
100
+ provider: provider
101
+ )
102
+ (sizeWritten, checksum) = (Int64(linkSizeWritten), linkChecksum)
103
+ if let progress { progress.completedUnitCount = progress.totalUnitCount }
104
+ }
105
+ return (sizeWritten, checksum)
106
+ }
107
+
108
+ func writeLocalFileHeader(
109
+ path: String,
110
+ compressionMethod: CompressionMethod,
111
+ size: (uncompressed: UInt64, compressed: UInt64),
112
+ checksum: CRC32,
113
+ modificationDateTime: (UInt16, UInt16)
114
+ ) throws -> LocalFileHeader {
115
+ // We always set Bit 11 in generalPurposeBitFlag, which indicates an UTF-8 encoded path.
116
+ let fileNameData = Data(path.utf8)
117
+ var uncompressedSizeOfLFH = UInt32(0)
118
+ var compressedSizeOfLFH = UInt32(0)
119
+ var extraFieldLength = UInt16(0)
120
+ var zip64ExtendedInformation: Entry.ZIP64ExtendedInformation?
121
+ var versionNeededToExtract = Version.v20.rawValue
122
+ // ZIP64 Extended Information in the Local header MUST include BOTH original and compressed file size fields.
123
+ if size.uncompressed >= maxUncompressedSize || size.compressed >= maxCompressedSize {
124
+ uncompressedSizeOfLFH = .max
125
+ compressedSizeOfLFH = .max
126
+ extraFieldLength = UInt16(20) // 2 + 2 + 8 + 8
127
+ versionNeededToExtract = Version.v45.rawValue
128
+ zip64ExtendedInformation = Entry.ZIP64ExtendedInformation(
129
+ dataSize: extraFieldLength - 4,
130
+ uncompressedSize: size.uncompressed,
131
+ compressedSize: size.compressed,
132
+ relativeOffsetOfLocalHeader: 0,
133
+ diskNumberStart: 0
134
+ )
135
+ } else {
136
+ uncompressedSizeOfLFH = UInt32(size.uncompressed)
137
+ compressedSizeOfLFH = UInt32(size.compressed)
138
+ }
139
+
140
+ let localFileHeader = LocalFileHeader(
141
+ versionNeededToExtract: versionNeededToExtract,
142
+ generalPurposeBitFlag: UInt16(2048),
143
+ compressionMethod: compressionMethod.rawValue,
144
+ lastModFileTime: modificationDateTime.1,
145
+ lastModFileDate: modificationDateTime.0,
146
+ crc32: checksum,
147
+ compressedSize: compressedSizeOfLFH,
148
+ uncompressedSize: uncompressedSizeOfLFH,
149
+ fileNameLength: UInt16(fileNameData.count),
150
+ extraFieldLength: extraFieldLength,
151
+ fileNameData: fileNameData,
152
+ extraFieldData: zip64ExtendedInformation?.data ?? Data()
153
+ )
154
+ _ = try Data.write(chunk: localFileHeader.data, to: archiveFile)
155
+ return localFileHeader
156
+ }
157
+
158
+ func writeCentralDirectoryStructure(
159
+ localFileHeader: LocalFileHeader,
160
+ relativeOffset: UInt64,
161
+ externalFileAttributes: UInt32
162
+ ) throws -> CentralDirectoryStructure {
163
+ var extraUncompressedSize: UInt64?
164
+ var extraCompressedSize: UInt64?
165
+ var extraOffset: UInt64?
166
+ var relativeOffsetOfCD = UInt32(0)
167
+ var extraFieldLength = UInt16(0)
168
+ var zip64ExtendedInformation: Entry.ZIP64ExtendedInformation?
169
+ if localFileHeader.uncompressedSize == .max || localFileHeader.compressedSize == .max {
170
+ let zip64Field = Entry.ZIP64ExtendedInformation
171
+ .scanForZIP64Field(in: localFileHeader.extraFieldData, fields: [.uncompressedSize, .compressedSize])
172
+ extraUncompressedSize = zip64Field?.uncompressedSize
173
+ extraCompressedSize = zip64Field?.compressedSize
174
+ }
175
+ if relativeOffset >= maxOffsetOfLocalFileHeader {
176
+ extraOffset = relativeOffset
177
+ relativeOffsetOfCD = .max
178
+ } else {
179
+ relativeOffsetOfCD = UInt32(relativeOffset)
180
+ }
181
+ extraFieldLength = [extraUncompressedSize, extraCompressedSize, extraOffset]
182
+ .compactMap { $0 }
183
+ .reduce(UInt16(0)) { $0 + UInt16(MemoryLayout.size(ofValue: $1)) }
184
+ if extraFieldLength > 0 {
185
+ // Size of extra fields, shouldn't include the leading 4 bytes
186
+ zip64ExtendedInformation = Entry.ZIP64ExtendedInformation(
187
+ dataSize: extraFieldLength,
188
+ uncompressedSize: extraUncompressedSize ?? 0,
189
+ compressedSize: extraCompressedSize ?? 0,
190
+ relativeOffsetOfLocalHeader: extraOffset ?? 0,
191
+ diskNumberStart: 0
192
+ )
193
+ extraFieldLength += Entry.ZIP64ExtendedInformation.headerSize
194
+ }
195
+ let centralDirectory = CentralDirectoryStructure(
196
+ localFileHeader: localFileHeader,
197
+ fileAttributes: externalFileAttributes,
198
+ relativeOffset: relativeOffsetOfCD,
199
+ extraField: (
200
+ extraFieldLength,
201
+ zip64ExtendedInformation?.data ?? Data()
202
+ )
203
+ )
204
+ _ = try Data.write(chunk: centralDirectory.data, to: archiveFile)
205
+ return centralDirectory
206
+ }
207
+
208
+ func writeEndOfCentralDirectory(
209
+ centralDirectoryStructure: CentralDirectoryStructure,
210
+ startOfCentralDirectory: UInt64,
211
+ startOfEndOfCentralDirectory: UInt64,
212
+ operation: ModifyOperation
213
+ ) throws -> EndOfCentralDirectoryStructure {
214
+ var record = endOfCentralDirectoryRecord
215
+ let sizeOfCD = sizeOfCentralDirectory
216
+ let numberOfTotalEntries = totalNumberOfEntriesInCentralDirectory
217
+ let countChange = operation.rawValue
218
+ var dataLength = centralDirectoryStructure.extraFieldLength
219
+ dataLength += centralDirectoryStructure.fileNameLength
220
+ dataLength += centralDirectoryStructure.fileCommentLength
221
+ let cdDataLengthChange = countChange * (Int(dataLength) + CentralDirectoryStructure.size)
222
+ let (updatedSizeOfCD, updatedNumberOfEntries): (UInt64, UInt64) = try {
223
+ switch operation {
224
+ case .add:
225
+ guard .max - sizeOfCD >= cdDataLengthChange else {
226
+ throw ArchiveError.invalidCentralDirectorySize
227
+ }
228
+ guard .max - numberOfTotalEntries >= countChange else {
229
+ throw ArchiveError.invalidCentralDirectoryEntryCount
230
+ }
231
+ return (sizeOfCD + UInt64(cdDataLengthChange), numberOfTotalEntries + UInt64(countChange))
232
+
233
+ case .remove:
234
+ return (sizeOfCD - UInt64(-cdDataLengthChange), numberOfTotalEntries - UInt64(-countChange))
235
+ }
236
+ }()
237
+ let sizeOfCDForEOCD = updatedSizeOfCD >= maxSizeOfCentralDirectory
238
+ ? UInt32.max
239
+ : UInt32(updatedSizeOfCD)
240
+ let numberOfTotalEntriesForEOCD = updatedNumberOfEntries >= maxTotalNumberOfEntries
241
+ ? UInt16.max
242
+ : UInt16(updatedNumberOfEntries)
243
+ let offsetOfCDForEOCD = startOfCentralDirectory >= maxOffsetOfCentralDirectory
244
+ ? UInt32.max
245
+ : UInt32(startOfCentralDirectory)
246
+ // ZIP64 End of Central Directory
247
+ var zip64EOCD: ZIP64EndOfCentralDirectory?
248
+ if numberOfTotalEntriesForEOCD == .max || offsetOfCDForEOCD == .max || sizeOfCDForEOCD == .max {
249
+ zip64EOCD = try writeZIP64EOCD(
250
+ totalNumberOfEntries: updatedNumberOfEntries,
251
+ sizeOfCentralDirectory: updatedSizeOfCD,
252
+ offsetOfCentralDirectory: startOfCentralDirectory,
253
+ offsetOfEndOfCentralDirectory: startOfEndOfCentralDirectory
254
+ )
255
+ }
256
+ record = EndOfCentralDirectoryRecord(
257
+ record: record,
258
+ numberOfEntriesOnDisk: numberOfTotalEntriesForEOCD,
259
+ numberOfEntriesInCentralDirectory: numberOfTotalEntriesForEOCD,
260
+ updatedSizeOfCentralDirectory: sizeOfCDForEOCD,
261
+ startOfCentralDirectory: offsetOfCDForEOCD
262
+ )
263
+ _ = try Data.write(chunk: record.data, to: archiveFile)
264
+ return (record, zip64EOCD)
265
+ }
266
+
267
+ func writeUncompressed(
268
+ size: Int64,
269
+ bufferSize: Int,
270
+ progress: Progress? = nil,
271
+ provider: Provider
272
+ ) throws -> (sizeWritten: Int64, checksum: CRC32) {
273
+ var position: Int64 = 0
274
+ var sizeWritten: Int64 = 0
275
+ var checksum = CRC32(0)
276
+ while position < size {
277
+ if progress?.isCancelled == true { throw ArchiveError.cancelledOperation }
278
+ let readSize = (size - position) >= bufferSize ? bufferSize : Int(size - position)
279
+ let entryChunk = try provider(position, readSize)
280
+ checksum = entryChunk.crc32(checksum: checksum)
281
+ sizeWritten += Int64(try Data.write(chunk: entryChunk, to: archiveFile))
282
+ position += Int64(bufferSize)
283
+ progress?.completedUnitCount = sizeWritten
284
+ }
285
+ return (sizeWritten, checksum)
286
+ }
287
+
288
+ func writeCompressed(
289
+ size: Int64,
290
+ bufferSize: Int,
291
+ progress: Progress? = nil,
292
+ provider: Provider
293
+ ) throws -> (sizeWritten: Int64, checksum: CRC32) {
294
+ var sizeWritten: Int64 = 0
295
+ let consumer: Consumer = { data in sizeWritten += Int64(try Data.write(chunk: data, to: self.archiveFile)) }
296
+ let checksum = try Data.compress(
297
+ size: size,
298
+ bufferSize: bufferSize,
299
+ provider: { position, size -> Data in
300
+ if progress?.isCancelled == true { throw ArchiveError.cancelledOperation }
301
+ let data = try provider(position, size)
302
+ progress?.completedUnitCount += Int64(data.count)
303
+ return data
304
+ },
305
+ consumer: consumer
306
+ )
307
+ return (sizeWritten, checksum)
308
+ }
309
+
310
+ func writeSymbolicLink(size: Int, provider: Provider) throws -> (sizeWritten: Int, checksum: CRC32) {
311
+ // The reported size of a symlink is the number of characters in the path it points to.
312
+ let linkData = try provider(0, size)
313
+ let checksum = linkData.crc32(checksum: 0)
314
+ let sizeWritten = try Data.write(chunk: linkData, to: archiveFile)
315
+ return (sizeWritten, checksum)
316
+ }
317
+
318
+ func writeZIP64EOCD(
319
+ totalNumberOfEntries: UInt64,
320
+ sizeOfCentralDirectory: UInt64,
321
+ offsetOfCentralDirectory: UInt64,
322
+ offsetOfEndOfCentralDirectory: UInt64
323
+ ) throws -> ZIP64EndOfCentralDirectory {
324
+ var zip64EOCD: ZIP64EndOfCentralDirectory = zip64EndOfCentralDirectory ?? {
325
+ // Shouldn't include the leading 12 bytes: (size - 12 = 44)
326
+ let record = ZIP64EndOfCentralDirectoryRecord(
327
+ sizeOfZIP64EndOfCentralDirectoryRecord: UInt64(44),
328
+ versionMadeBy: UInt16(789),
329
+ versionNeededToExtract: Version.v45.rawValue,
330
+ numberOfDisk: 0,
331
+ numberOfDiskStart: 0,
332
+ totalNumberOfEntriesOnDisk: 0,
333
+ totalNumberOfEntriesInCentralDirectory: 0,
334
+ sizeOfCentralDirectory: 0,
335
+ offsetToStartOfCentralDirectory: 0,
336
+ zip64ExtensibleDataSector: Data()
337
+ )
338
+ let locator = ZIP64EndOfCentralDirectoryLocator(
339
+ numberOfDiskWithZIP64EOCDRecordStart: 0,
340
+ relativeOffsetOfZIP64EOCDRecord: 0,
341
+ totalNumberOfDisk: 1
342
+ )
343
+ return ZIP64EndOfCentralDirectory(record: record, locator: locator)
344
+ }()
345
+
346
+ let updatedRecord = ZIP64EndOfCentralDirectoryRecord(
347
+ record: zip64EOCD.record,
348
+ numberOfEntriesOnDisk: totalNumberOfEntries,
349
+ numberOfEntriesInCD: totalNumberOfEntries,
350
+ sizeOfCentralDirectory: sizeOfCentralDirectory,
351
+ offsetToStartOfCD: offsetOfCentralDirectory
352
+ )
353
+ let updatedLocator = ZIP64EndOfCentralDirectoryLocator(
354
+ locator: zip64EOCD.locator,
355
+ offsetOfZIP64EOCDRecord: offsetOfEndOfCentralDirectory
356
+ )
357
+ zip64EOCD = ZIP64EndOfCentralDirectory(record: updatedRecord, locator: updatedLocator)
358
+ _ = try Data.write(chunk: zip64EOCD.data, to: archiveFile)
359
+ return zip64EOCD
360
+ }
361
+ }
@@ -0,0 +1,205 @@
1
+ //
2
+ // Archive+MemoryFile.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
+ var isMemoryArchive: Bool {
15
+ url.scheme == memoryURLScheme
16
+ }
17
+ }
18
+
19
+ #if swift(>=5.0)
20
+
21
+ extension Archive {
22
+
23
+ final class MemoryFile {
24
+
25
+ // MARK: Lifecycle
26
+
27
+ init(data: Data = Data()) {
28
+ self.data = data
29
+ }
30
+
31
+ // MARK: Internal
32
+
33
+ private(set) var data: Data
34
+
35
+ func open(mode: AccessMode) throws -> FILEPointer {
36
+ let cookie = Unmanaged.passRetained(self)
37
+ #if os(macOS) || os(iOS) || os(tvOS) || os(visionOS) || os(watchOS) || os(Android)
38
+ guard
39
+ let result = mode.isWritable
40
+ ? funopen(cookie.toOpaque(), readStub, writeStub, seekStub, closeStub)
41
+ : funopen(cookie.toOpaque(), readStub, nil, seekStub, closeStub)
42
+ else { throw MemoryFileError.invalidMemoryFile }
43
+ #else
44
+ let stubs = cookie_io_functions_t(read: readStub, write: writeStub, seek: seekStub, close: closeStub)
45
+ guard let result = fopencookie(cookie.toOpaque(), mode.posixMode, stubs)
46
+ else { throw MemoryFileError.invalidMemoryFile }
47
+ #endif
48
+ return result
49
+ }
50
+
51
+ // MARK: Private
52
+
53
+ private var offset = 0
54
+
55
+ }
56
+
57
+ /// Returns a `Data` object containing a representation of the receiver.
58
+ var data: Data? {
59
+ memoryFile?.data
60
+ }
61
+ }
62
+
63
+ enum MemoryFileError: Error {
64
+ case invalidMemoryFile
65
+ }
66
+
67
+ extension Archive.MemoryFile {
68
+
69
+ fileprivate func readData(buffer: UnsafeMutableRawBufferPointer) -> Int {
70
+ let size = min(buffer.count, data.count - offset)
71
+ let start = data.startIndex
72
+ data.copyBytes(to: buffer.bindMemory(to: UInt8.self), from: start + offset..<start + offset + size)
73
+ offset += size
74
+ return size
75
+ }
76
+
77
+ fileprivate func writeData(buffer: UnsafeRawBufferPointer) -> Int {
78
+ let start = data.startIndex
79
+ if offset < data.count, offset + buffer.count > data.count {
80
+ data.removeSubrange(start + offset..<start + data.count)
81
+ } else if offset > data.count {
82
+ data.append(Data(count: offset - data.count))
83
+ }
84
+ if offset == data.count {
85
+ data.append(buffer.bindMemory(to: UInt8.self))
86
+ } else {
87
+ let start = data.startIndex // May have changed in earlier mutation
88
+ data.replaceSubrange(
89
+ start + offset..<start + offset + buffer.count,
90
+ with: buffer.bindMemory(to: UInt8.self)
91
+ )
92
+ }
93
+ offset += buffer.count
94
+ return buffer.count
95
+ }
96
+
97
+ fileprivate func seek(offset: Int, whence: Int32) -> Int {
98
+ var result = -1
99
+ if whence == SEEK_SET {
100
+ result = offset
101
+ } else if whence == SEEK_CUR {
102
+ result = self.offset + offset
103
+ } else if whence == SEEK_END {
104
+ result = data.count + offset
105
+ }
106
+ self.offset = result
107
+ return self.offset
108
+ }
109
+ }
110
+
111
+ private func fileFromCookie(cookie: UnsafeRawPointer) -> Archive.MemoryFile {
112
+ Unmanaged<Archive.MemoryFile>.fromOpaque(cookie).takeUnretainedValue()
113
+ }
114
+
115
+ private func closeStub(_ cookie: UnsafeMutableRawPointer?) -> Int32 {
116
+ if let cookie {
117
+ Unmanaged<Archive.MemoryFile>.fromOpaque(cookie).release()
118
+ }
119
+ return 0
120
+ }
121
+
122
+ #if os(macOS) || os(iOS) || os(tvOS) || os(visionOS) || os(watchOS) || os(Android)
123
+
124
+ private func readStub(
125
+ _ cookie: UnsafeMutableRawPointer?,
126
+ _ bytePtr: UnsafeMutablePointer<Int8>?,
127
+ _ count: Int32
128
+ ) -> Int32 {
129
+ guard let cookie, let bytePtr else { return 0 }
130
+ return Int32(fileFromCookie(cookie: cookie).readData(
131
+ buffer: UnsafeMutableRawBufferPointer(start: bytePtr, count: Int(count))
132
+ ))
133
+ }
134
+
135
+ private func writeStub(
136
+ _ cookie: UnsafeMutableRawPointer?,
137
+ _ bytePtr: UnsafePointer<Int8>?,
138
+ _ count: Int32
139
+ ) -> Int32 {
140
+ guard let cookie, let bytePtr else { return 0 }
141
+ return Int32(fileFromCookie(cookie: cookie).writeData(
142
+ buffer: UnsafeRawBufferPointer(start: bytePtr, count: Int(count))
143
+ ))
144
+ }
145
+
146
+ private func seekStub(
147
+ _ cookie: UnsafeMutableRawPointer?,
148
+ _ offset: fpos_t,
149
+ _ whence: Int32
150
+ ) -> fpos_t {
151
+ guard let cookie else { return 0 }
152
+ return fpos_t(fileFromCookie(cookie: cookie).seek(offset: Int(offset), whence: whence))
153
+ }
154
+
155
+ #else
156
+
157
+ extension Archive.AccessMode {
158
+
159
+ var posixMode: String {
160
+ switch self {
161
+ case .read: "rb"
162
+ case .create: "wb+"
163
+ case .update: "rb+"
164
+ }
165
+ }
166
+ }
167
+
168
+ private func readStub(
169
+ _ cookie: UnsafeMutableRawPointer?,
170
+ _ bytePtr: UnsafeMutablePointer<Int8>?,
171
+ _ count: Int
172
+ ) -> Int {
173
+ guard let cookie, let bytePtr else { return 0 }
174
+ return fileFromCookie(cookie: cookie).readData(
175
+ buffer: UnsafeMutableRawBufferPointer(start: bytePtr, count: count)
176
+ )
177
+ }
178
+
179
+ private func writeStub(
180
+ _ cookie: UnsafeMutableRawPointer?,
181
+ _ bytePtr: UnsafePointer<Int8>?,
182
+ _ count: Int
183
+ ) -> Int {
184
+ guard let cookie, let bytePtr else { return 0 }
185
+ return fileFromCookie(cookie: cookie).writeData(
186
+ buffer: UnsafeRawBufferPointer(start: bytePtr, count: count)
187
+ )
188
+ }
189
+
190
+ private func seekStub(
191
+ _ cookie: UnsafeMutableRawPointer?,
192
+ _ offset: UnsafeMutablePointer<Int>?,
193
+ _ whence: Int32
194
+ ) -> Int32 {
195
+ guard let cookie, let offset else { return 0 }
196
+ let result = fileFromCookie(cookie: cookie).seek(offset: Int(offset.pointee), whence: whence)
197
+ if result >= 0 {
198
+ offset.pointee = result
199
+ return 0
200
+ } else {
201
+ return -1
202
+ }
203
+ }
204
+ #endif
205
+ #endif
@@ -0,0 +1,66 @@
1
+ //
2
+ // Archive+Progress.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
+ /// The number of the work units that have to be performed when
15
+ /// removing `entry` from the receiver.
16
+ ///
17
+ /// - Parameter entry: The entry that will be removed.
18
+ /// - Returns: The number of the work units.
19
+ func totalUnitCountForRemoving(_ entry: Entry) -> Int64 {
20
+ Int64(offsetToStartOfCentralDirectory - entry.localSize)
21
+ }
22
+
23
+ func makeProgressForRemoving(_ entry: Entry) -> Progress {
24
+ Progress(totalUnitCount: totalUnitCountForRemoving(entry))
25
+ }
26
+
27
+ /// The number of the work units that have to be performed when
28
+ /// reading `entry` from the receiver.
29
+ ///
30
+ /// - Parameter entry: The entry that will be read.
31
+ /// - Returns: The number of the work units.
32
+ func totalUnitCountForReading(_ entry: Entry) -> Int64 {
33
+ switch entry.type {
34
+ case .file, .symlink:
35
+ Int64(entry.uncompressedSize)
36
+ case .directory:
37
+ defaultDirectoryUnitCount
38
+ }
39
+ }
40
+
41
+ func makeProgressForReading(_ entry: Entry) -> Progress {
42
+ Progress(totalUnitCount: totalUnitCountForReading(entry))
43
+ }
44
+
45
+ /// The number of the work units that have to be performed when
46
+ /// adding the file at `url` to the receiver.
47
+ /// - Parameter entry: The entry that will be removed.
48
+ /// - Returns: The number of the work units.
49
+ func totalUnitCountForAddingItem(at url: URL) -> Int64 {
50
+ var count = Int64(0)
51
+ do {
52
+ let type = try FileManager.typeForItem(at: url)
53
+ switch type {
54
+ case .file, .symlink:
55
+ count = Int64(try FileManager.fileSizeForItem(at: url))
56
+ case .directory:
57
+ count = defaultDirectoryUnitCount
58
+ }
59
+ } catch { count = -1 }
60
+ return count
61
+ }
62
+
63
+ func makeProgressForAddingItem(at url: URL) -> Progress {
64
+ Progress(totalUnitCount: totalUnitCountForAddingItem(at: url))
65
+ }
66
+ }