<commit_before>define([
  "esri/core/Accessor", 
  "esri/core/HandleRegistry",
  "dojo/dom-class"
], function(Accessor, HandleRegistry, domClass) {
  var state = {
      disabled: "disabled",
      ready: "ready"
    },
    mode = {
      on: "on",
      off: "off"
    },
    fullscreenEvent = 'fullscreenchange';
  return Accessor.createSubclass({
    declaredClass: "fesri.widgets.FullScreenViewModel",
    properties: {
      navigationMode: {},
      state: {
        dependsOn: ["view.ready"],
        readOnly: !0
      },
      view: {}
    },
    constructor: function() {

      this._handles = new HandleRegistry;
      this.toggle = this.toggle.bind(this);      
    },
    initialize: function() {

      if ("onmozfullscreenchange" in document) {
        this.fullscreenEvent = "mozfullscreenchange";
      }
      else if ("onwebkitfullscreenchange" in document) {
        this.fullscreenEvent = "webkitfullscreenchange";
      }
      else if ("onmsfullscreenchange" in document) {
        this.fullscreenEvent = "MSFullscreenChange";
      }

      document.addEventListener(this.fullscreenEvent, this._fullScreenHandler.bind(this));
    },
    destroy: function() {

      this._handles.destroy();
      document.removeEventListener(this.fullscreenEvent, this._fullScreenHandler);
    },
    _handles: null,
    state: state.disabled,
    _stateGetter: function() {

      return this.get("view.ready") ? state.ready : state.disabled
    },
    _fullScreenHandler: function () {

        this.mode = 
          document.fullscreenElement ||
          document.msFullscreenElement ||
          document.webkitFullscreenElement ||
          document.mozFullScreenElement          
          ? mode.on : mode.off;

        if (this.mode === mode.off) {
          domClass.remove(this.view.container, 'view-fullscreen-on');
        }
        else {
          domClass.add(this.view.container, 'view-fullscreen-on');
        }
    },
    mode: mode.off,
    _modeGetter: function() {

      return this._get("mode") || mode.off;
    },
    view: null,
    toggle: function() {

      if (this.state !== state.disabled) {

        this.mode = this.mode !== mode.on ? mode.on : mode.off;
             
        if (this.mode === mode.off) {
                  
          if (document.exitFullscreen) {
            document.exitFullscreen();
          } else if (document.msExitFullscreen) {
            document.msExitFullscreen();
          } else if (document.webkitCancelFullScreen) {
            document.webkitCancelFullScreen();
          } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
          } else {
            console.log("Fullscreen API is not supported");
          }
        }
        else {

          var node = this.view.container;

          if (node.requestFullscreen) {
            node.requestFullscreen();
          } else if (node.msRequestFullscreen) {
            node.msRequestFullscreen();
          } else if (node.webkitRequestFullscreen) {
            node.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
          } else if (node.mozRequestFullScreen) {
            node.mozRequestFullScreen();
          } else {
            console.log("Fullscreen API is not supported");
          }
        }
      }
    }
  })
});<commit_msg>tidy up<commit_after>define([
  "esri/core/Accessor", 
  "esri/core/HandleRegistry",
  "dojo/dom-class"
], function(Accessor, HandleRegistry, domClass) {
  var state = {
      disabled: "disabled",
      ready: "ready"
    },
    mode = {
      on: "on",
      off: "off"
    },
    fullscreenEvent = 'fullscreenchange';
  return Accessor.createSubclass({
    declaredClass: "fesri.widgets.FullScreenViewModel",
    properties: {
      navigationMode: {},
      state: {
        dependsOn: ["view.ready"],
        readOnly: !0
      },
      view: {}
    },
    constructor: function() {

      this._handles = new HandleRegistry;
      this.toggle = this.toggle.bind(this);      
    },
    initialize: function() {

      if ("onmozfullscreenchange" in document) {
        this.fullscreenEvent = "mozfullscreenchange";
      }
      else if ("onwebkitfullscreenchange" in document) {
        this.fullscreenEvent = "webkitfullscreenchange";
      }
      else if ("onmsfullscreenchange" in document) {
        this.fullscreenEvent = "MSFullscreenChange";
      }

      document.addEventListener(this.fullscreenEvent, this._fullScreenHandler.bind(this));
    },
    destroy: function() {

      this._handles.destroy();
      document.removeEventListener(this.fullscreenEvent, this._fullScreenHandler);
    },
    _handles: null,
    state: state.disabled,
    _stateGetter: function() {

      return this.get("view.ready") ? state.ready : state.disabled
    },
    _fullScreenHandler: function () {

        this.mode = 
          document.fullscreenElement ||
          document.msFullscreenElement ||
          document.webkitFullscreenElement ||
          document.mozFullScreenElement          
          ? mode.on : mode.off;

        if (this.mode === mode.off) {
          domClass.remove(this.view.container, 'view-fullscreen-on');
        }
        else {
          domClass.add(this.view.container, 'view-fullscreen-on');
        }
    },
    mode: mode.off,
    _modeGetter: function() {

      return this._get("mode") || mode.off;
    },
    view: null,
    toggle: function(e) {

      e.preventDefault();

      if (this.state === state.disabled) {
        return;
      }

      this.mode = this.mode !== mode.on ? mode.on : mode.off;
             
      if (this.mode === mode.off) {
                
        this._exitFullscreen();
      }
      else {

        this._requestFullscreen(this.view.container);
      }      
    },
    _requestFullscreen: function(element) {

      if (element.requestFullscreen) {
        element.requestFullscreen();
      } else if (element.webkitRequestFullscreen) {
        element.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
      } else if (element.mozRequestFullScreen) {
        element.mozRequestFullScreen();
      } else if (element.msRequestFullscreen) {
        element.msRequestFullscreen();
      } else {
        console.log('Fullscreen API is not supported.');
      }
    },
    _exitFullscreen: function() {

      if (document.exitFullscreen) {
        document.exitFullscreen();
      } else if (document.webkitExitFullscreen) {
        document.webkitExitFullscreen();
      } else if (document.mozCancelFullScreen) {
        document.mozCancelFullScreen();
      } else if (document.msExitFullscreen) {
        document.msExitFullscreen();
      } else {
        console.log('Fullscreen API is not supported.');
      }
    }
  })
});
{'fraction_non_alphanumeric': 0.12238540275923454, 'fraction_numerical': 0.0002966918854769322, 'mean_word_length': 2.1578454332552695, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6944393', 'n_tokens_mistral': 1940, 'n_tokens_neox': 1901, 'n_words': 332}