<commit_before>var inspectBasis = require('devpanel').inspectBasis;
var inspectBasisDomEvent = inspectBasis.require('basis.dom.event');

var Expression = require('basis.data.value').Expression;
var remoteInspectors = require('../../basisjs-tools-sync.js').remoteInspectors;

var View = require('./view/index.js');
var data = require('./data/index.js');

require('api')
  .local(require('./api.js'), data, inspectBasis)
  .channel(data.output.as(basis.getter('data')), remoteInspectors.send);

// view
var captureEvents = [
  'click',
  'mousedown',
  'mouseup',
  'mousemove',
  'mouseout',
  'mouseover',
  'mouseenter',
  'mouseleave'
];
var blockEvents = function(node){
  if (node)
    captureEvents.forEach(function(eventName){
      inspectBasisDomEvent.captureEvent(eventName, function(){});
    });
  else
    captureEvents.forEach(function(eventName){
      inspectBasisDomEvent.releaseEvent(eventName);
    });
};

new Expression(data.input, remoteInspectors, function(input, inspectors){
  return input && !inspectors;
})
  .as(function(showView){
    return showView ? new View() : null;
  })
  .link(null, function(view, oldView){
    if (view)
    {
      data.input.attach(blockEvents);
    }<commit_msg>devpanel: don't show template viewer on inspector lost<commit_after>var inspectBasis = require('devpanel').inspectBasis;
var inspectBasisDomEvent = inspectBasis.require('basis.dom.event');

var Value = require('basis.data').Value;
var Expression = require('basis.data.value').Expression;
var remote = require('../../basisjs-tools-sync.js').remoteInspectors;

var View = require('./view/index.js');
var data = require('./data/index.js');

require('api')
  .local(require('./api.js'), data, inspectBasis)
  .channel(data.output.as(basis.getter('data')), remote.send);

// view
var captureEvents = [
  'click',
  'mousedown',
  'mouseup',
  'mousemove',
  'mouseout',
  'mouseover',
  'mouseenter',
  'mouseleave'
];
var blockEvents = function(node){
  if (node)
    captureEvents.forEach(function(eventName){
      inspectBasisDomEvent.captureEvent(eventName, function(){});
    });
  else
    captureEvents.forEach(function(eventName){
      inspectBasisDomEvent.releaseEvent(eventName);
    });
};

new Expression(data.input, remote, function(input, remote){
  return {
    input: input,
    remote: remote
  };
})
  .link(new Value(), function(value, oldValue){
    this.set(value.input && !value.remote && (!oldValue || value.input !== oldValue.input));
  })
  .as(function(showView){
    return showView ? new View() : null;
  })
  .link(null, function(view, oldView){
    if (view)
    {
      data.input.attach(blockEvents);
    }
{'fraction_non_alphanumeric': 0.16955538809344387, 'fraction_numerical': 0.0, 'mean_word_length': 4.407331975560082, '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': '7307607', 'n_tokens_mistral': 865, 'n_tokens_neox': 851, 'n_words': 153}