 
 
 # Set a version flag for easy external retrieval.
-OriDomi.VERSION = '0.1.2'
+OriDomi.VERSION = '0.1.3'
 
 # External function to enable `devMode`.
 OriDomi.devMode = ->


class OriDomi
  # The constructor takes two arguments: a target element and an options object literal.
  constructor: (@el, options) ->
    # If `devMode` is enabled, start a benchmark timer for the constructor.
    devMode and console.time 'oridomiConstruction'
    # If the browser doesn't support oriDomi, return the element unmodified.
    return @el unless oriDomiSupport
    
    # If the constructor wasn't called with the `new` keyword, invoke it again.
    unless @ instanceof OriDomi
      return new oriDomi @el, @settings

    # Extend any passed options with the defaults map.
    @settings = extendObj options, defaults

    # Return if the first argument isn't a DOM element.
    unless @el? or @el.nodeType isnt 1
      return devMode and console.warn 'oriDomi: First argument must be a DOM element'

    # Destructure some instance variables from the settings object.
    {@shading, @shadingIntensity, @vPanels, @hPanels} = @settings
    # Record the current global styling of the target element.
    elStyle = root.getComputedStyle @el

    # Calculate the element's total width by adding all horizontal dimensions.
    @width = parseInt(elStyle.width, 10) +

    @_callback callback: callback


  # Disables oriDomi slicing by showing the original, untouched target element.
  # This is useful for certain user interactions on the inner content.
  freeze: (callback) ->
    # Return if already frozen.
    if @isFrozen
      callback() if typeof callback is 'function'
    else
      # Make sure to reset folding first.
      @reset =>
        @isFrozen = true
        # Swap the visibility of the elements.
        @el.style.display = 'none'
        @cleanEl.style.display = @displayStyle
        callback() if typeof callback is 'function'


  # Restores the oriDomi version of the element for folding purposes.
  unfreeze: ->
    # Only unfreeze if already frozen.
    if @isFrozen
      @isFrozen = false
      # Swap the visibility of the elements.
      @cleanEl.style.display = 'none'
      @el.style.display = @displayStyle


  # Removes the oriDomi element and deletes its instance from memory.
  destroy: (callback) ->
    # First restore the original element.
    @freeze =>
      # Remove the data reference if using jQuery.
      if $
        $.data @cleanEl, 'oriDomi', null
      # Remove the oriDomi element from the DOM.
      @el.parentNode.removeChild @el
      # Free up this instance for garbage collection.
      instances[instances.indexOf @] = null
      callback() if typeof callback is 'function'


  # oriDomi's most basic effect. Transforms the target like its namesake.
  accordion: (angle, anchor, options) ->
    normalized = @_normalizeArgs 'accordion', arguments
    # If `_normalizeArgs` returns false, we need to abort for a reset operation.
