class CKEditor5::Rails::Cdn::CKBoxBundle

def initialize(version, theme: :lark, cdn: Engine.base.default_cdn, translations: [])

def initialize(version, theme: :lark, cdn: Engine.base.default_cdn, translations: [])
  raise ArgumentError, 'version must be semver' unless version.is_a?(Semver)
  raise ArgumentError, 'theme must be a string' unless theme.is_a?(String)
  raise ArgumentError, 'translations must be an array' unless translations.is_a?(Array)
  super()
  @cdn = cdn
  @version = version
  @theme = theme
  @translations = translations
end

def scripts

def scripts
  @scripts ||= [
    Assets::JSExportsMeta.new(
      create_cdn_url('ckbox', 'ckbox.js', version),
      *translations_js_exports_meta
    )
  ]
end

def stylesheets

def stylesheets
  @stylesheets ||= [
    create_cdn_url('ckbox', "styles/themes/#{theme}.css", version)
  ]
end

def translations_js_exports_meta

def translations_js_exports_meta
  translations.map do |lang|
    url = create_cdn_url('ckbox', "translations/#{lang}.js", version)
    Assets::JSExportsMeta.new(url, window_name: 'CKBOX_TRANSLATIONS', translation: true)
  end
end