SlateJS apply bold to regex match

I am trying to apply bold to **text** in slatejs editor and so far my attempts have been unsuccessful.
I came across this answer which seems to be a possible solution to the problem.

However, after modifying that answer it still refused to apply bold.

I tried adding match: n => Text.isText(n) and that made the whole paragraph bold.

Expected result:
**text** => **text**

Actual result:
**text** => **text**

How may I modify this to work as expected?

const withMarkdown = editor => {
    const { normalizeNode } = editor;

    editor.normalizeNode = entry => {
        const [node, path] = entry;

        if (!Text.isText(node)) {
            return normalizeNode([node, path]);
        }

        const boldMatch = node.text.match(/([*]{2})(.+?)([*]{2})/);
        if (!boldMatch) {
            return normalizeNode([node, path]);
        }

        let [searchMatch, asteriskMatch] = boldMatch;
        const { index: startIndex } = boldMatch;
        const endIndex = startIndex + searchMatch.length;

        /* does not apply bold */
        Transforms.setNodes(editor, { bold: true }, {
            at: {
                anchor: { path, offset: startIndex },
                focus: { path, offset: endIndex },
            }
        })

        normalizeNode([node, path]);
    }

    return editor;
}

THREE.JS fbx is recognized as a localhost link

I’ve been trying to write this Three.js project for a while now, and I seem to be running into a problem. When I try to use an FBX path-name as my custom 3d model then it just returns a 404 error. This is obviously because it is attaching the pathname to localhost:8080 but I have no idea how to fix it and cannot even fathom where to start looking to even get that information.

Here is the necessary information to determine the solution to my stupid problem

script.js

// const loader = new OBJLoader()
// import { OBJLoader, MTLLoader } from 'https://cdn.skypack.dev/@hbis/three-obj-mtl-loader'
// import objMtlLoader from 'https://cdn.skypack.dev/obj-mtl-loader';
import {FBXLoader} from 'https://cdn.jsdelivr.net/npm/[email protected]/examples/jsm/loaders/FBXLoader.js'
import * as THREE from 'https://cdn.jsdelivr.net/npm/[email protected]/build/three.module.js';

const path = new THREE.Path();


const loader = new FBXLoader();
loader.setPath('./models/')
loader.load('guard.fbx', (fbx) => {
    // this._target = fbx
    // this._target.scale.setScalar(0.035);
    // this._params.scene.add(this._target);
    scene.add(fbx)
});

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000)
const renderer = new THREE.WebGLRenderer();
renderer.setClearColor(0xffffff)

renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);


const sphere_geometry = new THREE.SphereGeometry(1, 32, 16);
const sphere_material = new THREE.MeshBasicMaterial({color: 0x000000})
const sphere = new THREE.Mesh(sphere_geometry, sphere_material);
scene.add(sphere);

document.addEventListener("onkeydown", function(e){
    switch(e.KeyCode){
        case 37:
            console.log("Left")
            break
        case 38:
            console.log("top")
            break
        case 39:
            console.log("right")
            break
        case 40:
            console.log("bottom")
            break
    }
})

// loader.load("/Users/dmitri/Desktop/flame/models/fresh_fire_01 (1).obj", function(object){
//     scene.add(object)
// })

var run = function() {
    requestAnimationFrame(run);
    renderer.render(scene, camera)
}
run()

index.html

<html>
    <head>
        <style>
            body{
                margin: 0;
                padding: 0;
            }
        </style>
    </head>
    <body>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/87/three.min.js"></script>
        <script src="/script.js" type="module"></script>
    </body>
</html>

File Structure

modules

–campfire.fbx

–fresh_fire_0 (1).obj

–guard.fbx

public

–index.html

–script.js

app.js


Pls help meh!

How to remove all parenthesis and their contents from a string using a regular expression or pure JavaScript and retain other text format

Currently I am entering text inside a text area and on clicking the submit button of my form, I am applying some changes to the text mainly using .replaceAll(); js methods and printing it out as a paragraph inside a div.

If I enter text that already has newlines as well as parenthesis into the text area, I want my script to strip/remove all parenthesis as well as the contents inside parenthesis AND keep all newlines as they are.

I have tried the following regex + js function with the sample text however there are some formatting issues that get introduced (some newlines are removed and text following parenthesis ends up on the same line as the text in the previous line where parenthesis was removed)

regex+js code:

updatedText = updatedText.replaceAll(/s*(.*?)s*/g, '');

Sample input:

06.abbaa(bbbbadf)
01.lijer      ttt
06.foo(sample)dddddddddd(garbage)
06.text(lksdhfljkld)20001(kkkkkksssss)
01.asdfg
13.fffffffff(fdsgggg/asdfasdf)
03.ggggggg(defg/abc)
18.abc     123abc
blahblah
qqqqqq
anon
06.barbarbar
10.foobar
18.fooistbar
12.blahhhh(moreblah/blah)
15.2035number(test)(test0/2test)
12.testing morewords
03.random(blahhh)(blahahaha/morerandomstuff)
17.anotherrandomtextstring
11.string
testy(mctest)
isTestingStrings
11.string
11.string
11.string

the result outputted where lines are combined when they are not suppose to be is this:

06.abbaa01.lijer ttt
06.foodddddddddd06.text2000101.asdfg
13.fffffffff03.ggggggg18.abc 123abc
blahblah
qqqqqq
anon
06.barbarbar
10.foobar
18.fooistbar
12.blahhhh15.2035number12.testing morewords
03.random17.anotherrandomtextstring
11.string
testyisTestingStrings
11.string
11.string
11.string
  • for example “testy” and “isTestingStrings” should be on 2 separate lines.
  • each line could have any number of(0 or more) “(xxxx…)” parenthesis with content and in these cases should also retain the newlines.

Why does replacing the matched text with an empty string result in the newline character being removed from the string, and how can I resolve this issue in my script. Is there better regex to handle this or would this require writing a custom js parser?

Trying to randomize the padding of an element to create a small rain effect

I am trying to randomize the position of diagonal falling lines using padding. Whenever I try to use the below code the lines do not change. However, if I add style:padding-left:300px to the style of the rain and remove my JavaScript I can move the element to the right by 300px. I can theoretically do this and map out each line however I would like to know how to randomize the padding, preferably dynamically and not just onpageload

<script>
function randomnumber(min, max) {
  var rn = Math.random() * (max - min) + min;
  document.querySelector('#rain .line').style.padding = rn+'px';
}

</script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 

<style>   
body{
   background:#000000;
   margin: 100px; 
}

.line {
 height: 1px;
 width: 40px;
 background: white;
 transform: rotate(45deg);
}

.rainsize{
height:100%;
width:100%;
opacity:0%;
z-index:1000;
position:fixed;
width:100%;
top:0px;
left:0px;
}

.move{
position:relative; 
animation-name: moverain;
animation-duration: 3s;
animation-iteration-count: infinite;
}
@keyframes moverain {
0%{top:0px;left:0px;}
100%{top:1000px;left:1000px;}
}

</style>


<div onpageload="randomnumber('10','1000')"class="rainsize"></div>


<div id=rain class="move">
  <div class="line""></div> 
</div>

<div id=rain class="move">
  <div class="line""></div> 
</div>

<div id=rain class="move">
  <div class="line""></div> 
</div>

<div id=rain class="move">
  <div class="line""></div> 
</div>

<div id=rain class="move">
  <div class="line""></div> 
</div>

<div id=rain class="move">
  <div class="line""></div> 
</div>

<div id=rain class="move">
  <div class="line""></div> 
</div>

<div id=rain class="move">
  <div class="line""></div> 
</div>









How to prevent Nav Menue toggle from changing y position

I’m very new to WordPress and I’m experiencing a bug where the y position of the page gets updated involuntarily.

I’m using a floating menu but each time I toggle the Nav menu it resets my view to the top of the page (not very useful for links that point to a specific position on the page that are stored within the nav menu).

The element in question

<button type="button" class="navbar-toggle">
    <span class="screen-reader-text"><font style="vertical-align: inherit;"><font style="vertical-align: inherit;">Toggle sidebar &amp; navigation</font></font></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
</button>

After some research the closest I’ve been able to identify what is causing this issue is the line of code e(document.body).toggleClass("side-nav-open") in scripts.min.js?ver=1.6.0

function s() {
    e(document.body).toggleClass("side-nav-open").addClass("side-nav-transitioning"); <-----
    const t = e("#slider").data("flexslider");
    t && (e(document.body).hasClass("side-nav-open") ? (i = t.playing,
    t.playing && t.pause()) : i && t.play());
    let s = !1;
    e(".site").one("transitionend", function() {
        e(document.body).removeClass("side-nav-transitioning"),
        s = !0
    }),
    setTimeout(function() {
        s || e(document.body).removeClass("side-nav-transitioning"),
        n.trigger("resize")
    }, 230)
}
e(".navbar-toggle, .side-nav-overlay").on("click touchend", function() {
    e(document.body).hasClass("side-nav-transitioning") || (s(),
    e(document.body).hasClass("side-nav-open") ? n.width() <= 640 ? t.find(".side-nav__close-button > button").focus() : t.find("nav.mobile-menu-wrapper ul li:first-child").focus() : t.find(".header-navigation-wrapper button.navbar-toggle").focus(),
    e.fn.keepFocusInMobileSidebar())
}),

using break points I was able to stop at the line e(document.body).toggleClass("side-nav-open").addClass("side-nav-transitioning"); and executing e(document.body).toggleClass("side-nav-open") in the console I saw my page jump to the top.

I’m hoping someone could help me complete my research and identify why my page no longer stays put when the navigation menu is clicked. Since I very rarely work on WordPress I’m not sure what info would be pertinent and what information would be noise, please post in the comments the data that would be most beneficial to trouble shoot this issue.

The current active theme is Inspiro version 1.6 https://www.wpzoom.com/free-wordpress-themes/inspiro-lite/

How can I disable the save credit card info popup in the chrome on Android device?

I am try to run some automation scripts writing with WD.js on the lamda cloud server,but I can not handle this popup,any suggestions?Thanks so much!

Here is my capabilities setting,but it seems not work.

  exports.config = {
  seleniumHost: 'hub.lambdatest.com',
  seleniumPort: 80,
  test: '../tests/demo.js',
  capabilities: [{
        build: "test demo",
        name: "work flow",
        platform: "Android",
        deviceName: "Huawei P20 Pro",
        platformVersion: "9",
        acceptSslCerts: true,
        visual: "true",
        browserName: 'chrome',
        chromeOptions: {
          prefs: {
            credentials_enable_service: false,
            'profile.password_manager_enabled': false,
            'profile.default_content_setting_values.notifications': '2'
        },
         args: ['--ignore-certificate-errors',
           '--disable-features=Translate',
           '--disable-popup-blocking',
           '--disable-notifications',
           '-incognito']
    }
    }]
}

enter image description here

I want to get array of multiple emp for particular Manager

I have a data where each emp has manager, i’m trying to get an array with emp with perticular manager. for ex: Manager1 with array of all his emp and Manager2 with all his emp. i have pasted a sample out.how can i get that?

const response = [
    {
        "emp":{
            "firstName":"Abhi"
        },
        "manager":{
            "firstName":"Ashok"
        }
    },
    {
        "emp":{
            "firstName":"Lokesh"
        },
        "manager":{
            "firstName":"Ashok"
        }
    },
    {
        "emp":{
            "firstName":"Harish"
        },
        "manager":{
            "firstName":"Ashok"
        }
    },
    {
        "emp":{
            "firstName":"Kaushik"
        },
        "manager":{
            "firstName":"Sunil"
        }
    },
]
            
            

Sample output i need:

[
    {
        "manager":"Ashok",
        "emp":[
            {
                "firstName":"Abhi"
            },
            {
                "firstName":"Lokesh"
            },
            {
                "firstName":"Harish"
            }
        ]
    },
    {
        "manager":"Sunil",
        "emp":[
            {
                "firstName":"Kaushik"
            }
        ]
    }
]

How can I stop the browser from url-encoding for react js form for POST data values with password field value included with #

I wanted to stop URL encoding for reactjs form password filed, when I entered the ‘#” in password browser automatically converts it into URL encoding format like ‘%23’, want to stop that or any other solution for this issue.

form is like:

              labels={{
                        passwordInputLabel: 'Password',
                        passwordPlaceHolder: 'Enter password',
                        loginButtonMessage: 'Logging In'

How to run a request in a function in Nodejs?

I have the following code to run a request and return the result in NodeJS :

const https = require('https')

async function GetStatus(HostName, Path) {  
    const options = {hostname: HostName,port: 443,path: Path,method: 'GET'}                     
    const req = https.request(options, res => {     
        res.on('data', d => {
            var result = JSON.parse(d);
            console.log('A - the status is ' + result.status);
            return result.status;               
        })
    })
    
    req.on('error', error => {console.error(error)});
    req.end();  
}

async function T() {
    var x = await GetStatus('www.domain.com', '/path');     
    console.log('B - The status is ' + x);
}

T();

I’m trying to run the function GetStatus to get some results based on the https request.

When running this code, I’m getting A – The status is something while the output of the function is B – The status is undefined

Does anyone know how to solve that please ? such that the function returns the result as expected instead of undefined.

Thanks.
Regards,

All my requests to Firestore are classified as unverified because of AppCheck?

I enforced Firebase AppCheck for Firestore.

Now, when I try to access data, I get an error:

    firebase
      .firestore()
      .doc(firestoreRoot.configs.priceIds._pathUrl)
      .get()
      .then((v) => console.log(v.data()));

appcheck error

In Firebase, it says all my requests are unverified:

enter image description here

This only happens for firestore.

Is there something else I must do?

I enabled AppCheck in my app using:

  const appCheck = firebase.appCheck();
  appCheck.activate("MY_SITE_KEY", true);

I tried disabling AppCheck in the firebase console, and now all my requests are accepted.

Trying to get value from object using external url but

When i start bot console say:

Online with undefined/5

and when 10 secconds are passed give this error:

undefined:1
[object Promise]
^
SyntaxError: Unexpected token o in JSON at position 1

My Code:

let jogadores
client.on("ready", async () => {

async function players_online() {
    const response = fetch(`http://ip:port/dynamic.json`);
    const data = JSON.parse(response);
    jogadores = data.clients;


}

async function autoconnect() {

    if (jogadores === -1) {
        console.log('Offline');

    } else {
        console.log('Online with ' + jogadores + '/5')

    }
}
autoconnect()

setInterval(() => {
    client.user.setStatus('dnd');
    client.user.setActivity(`Online with ${jogadores} players.`, { type: 'PLAYING' })
    players_online()
}, 10000)

})

The script does not send the changed data

I encountered a problem that my script does not send the changed data to Discord.
All other functionality works well. What could be the problem?

Here’s the code:

var send = WebSocket.prototype.send;

WebSocket.prototype.send = function (data) {
    if (WebSocket.prototype.toString.call(data) === "[object ArrayBuffer]") {
        var array = new Uint8Array(data);
        var modules = DiscordNative.nativeModules.requireModule('discord_erlpack');
        var unpackeddata = modules.unpack(array);
        console.Log("(WS LOG) received wsdata -> " + JSON.stringify(unpackeddata));
        if (unpackeddata.op == 4) {
            unpackeddata.d.self_mute = true;
            unpackeddata.d.self_deaf = true;
            unpackeddata.d.self_video = true;
            console.log("WS Packet 4")
        } else if (unpackeddata.op == 12) {
            for (var stream of unpackeddata.d.streams) {
                stream.quality = 1;
                stream.max_bitrate = 8000;
                stream.max_framerate = 10;
                console.log("WS Packet 12")
            }
        } else if (unpackeddata.op == 24) {
            unpackeddata.d.type = 123;
            unpackeddata.d.limit = 123;
            unpackeddata.d.offset = 123;
            console.log("WS Packet 24");
        }
        var packed = modules.pack(unpackeddata);
        var buffer = packed.buffer;
        array = new Uint8Array(buffer);
        data = array;
    } else {
        console.log("(WS LOG) received wsdata -> " + data);
    }
    return send.apply(this, [data]);
}

How do I secure my React Native Expo app from hackers? [closed]

I’d hate to build an entire application to only have it hacked.

I am using Firebase and Expo. I know about security rules for Firebase but is there any rules I need to abide by for the JavaScript within React Native/Expo?

Like, is there anyway a user can just change my javascript code and use it against me? I’ve heard about runtime attacks but I don’t know if people can do that in a mobile app like they can in a browser. I’ve seen where a user/attacker can literally just change variables and turn it into code that sends application data to the attackers server but I don’t know how that works.

Reactjs: Navigating to component from Navbar component without using data file

I am new to React and following a React tutorial. I am confused about how to have my Accordion component be directed to the path without utilizing the data file I created while following the tutorial. In general, I want the user to click “FAQ” in the navbar and be sent to the Accordion component.

Thank you for helping me further my knowledge in React!!

Navbar:

import React, {useState, useEffect} from 'react';
import { NavLink } from 'react-router-dom';
import { FaBars } from "react-icons/fa";
import {Nav, ExternalButton, NavbarContainer, NavLogo, MobileIcon, NavMenu, NavItem, NavLinks, NavBtnLink, NavBtn } from './NavbarElements';
import { IconContext } from 'react-icons/lib';
import Accordion from '../Accordion/Accordion';
import { animateScroll as scroll } from 'react-scroll';

const Navbar = ({toggle}) => {
    const [scrollNav, setScrollNav] = useState(false)

    const changeNav = ()=>{
        if(window.scrollY >= 80)
        {
            setScrollNav(true)
        }
        else
        {
            setScrollNav(false)
        }
    }
    useEffect(()=> {
        window.addEventListener('scroll', changeNav)
    }, []);

    const toggleHome = () => {
        scroll.scrollToTop();
    }
    return (
      <>
      <IconContext.Provider value={{color: '#fff'}}>
      <Nav scrollNav={scrollNav}>
          <NavbarContainer>
              <NavLogo to='/' onClick={toggleHome}>Verticality</NavLogo>
              <MobileIcon onClick={toggle}>
                  <FaBars />
              </MobileIcon>
              <NavMenu>
                  <NavItem>
                      <NavLinks to="about"
                      smooth={true} duration={500} spy={true} exact='true' offset={-80}
                      >About</NavLinks>
                  </NavItem>
                  <NavItem>
                      <NavLinks to="start"
                      smooth={true} duration={500} spy={true} exact='true' offset={-80}
                      >Get Started</NavLinks>
                  </NavItem>
                  <NavItem>
                      <NavLinks to='faq'
                      smooth={true} duration={500} spy={true} exact='true' offset={-80}
                      >FAQ</NavLinks>
                  </NavItem>
                  <NavItem>
                      <NavLinks to="nft"
                      smooth={true} duration={500} spy={true} exact='true' offset={-80}>NFTs</NavLinks>
                  </NavItem>
              </NavMenu>
              <NavBtn>
                  <ExternalButton href="google.com" target="_blank" rel="noopener"> Purchase</ExternalButton> 
              </NavBtn>
          </NavbarContainer>
      </Nav>
      </IconContext.Provider> 
      </> 
    );
};


export default Navbar

Data.js

import Accordion from '../Accordion/Accordion';
export const homeObjOne = {
    id: 'about', 
    lightBg: false,
    lightText: true, 
    lightTextDesc: true, 
    // topLine: 'A Crypto which is here to stay',
    headline: 'Buy Now or Regret Later',
    description: 'Text ',
    buttonLabel: 'Purchase',
    imgStart: true,
    img: require('../../images/svg1.svg').default,
    alt: 'Car',
    dark: true,
    primary: true,
    darkText: false
};

export const homeObjTwo = {
    id: 'start', 
    lightBg: true,
    lightText: false, 
    lightTextDesc: false, 
    topLine: 'So, how do we get started?',
     description: 
    `text `,
    buttonLabel: <td onClick={() => window.open("https://docs.pancakeswap.finance/get-started", "_blank")}>Learn More</td>, 
    imgStart: true,
    img: require('../../images/svg2.svg').default,
    alt: 'checking off list  ',
    dark: false,
    primary: false,
    darkText: true
};


export const homeObjThree = {
    id: 'nft', 
    lightBg: false,
    lightText: true, 
    lightTextDesc: true, 
    topLine: 'NFTs are here to stay...',
    headline: 'AND SO ARE WE!',
    description: 'text  ',
    imgStart: true,
    img: require('../../images/svg3.svg').default,
    alt: 'Construction',
    dark: true,
    primary: false,
    darkText: false
};

App.js

import React from 'react';
import {BrowserRouter as Router, Switch, Route, Link} from 'react-router-dom';
import './App.css';
import Accordion from './components/Accordion/Accordion';
import DisclaimerPage from './components/FooterPages';
import { homeObjTwo } from './components/InfoSection/Data';
import Home from './pages';
import aboutUs from './pages/aboutUs';
import disclaimer from './pages/disclaimer';

function App() {
  return (
    <Router>
      <Switch>
        <Route path='/' component={Home} exact />
        <Route path='/aboutUs' component={aboutUs} exact />
        <Route path='/disclaimer' component={disclaimer} exact />
        <Route path='/faq' component={Accordion} exact /> //does not work
      </Switch>
    </Router>
  );
}

export default App;

I don’t how much help this will be but here is the Accordion.js

import React,{useState} from 'react';
import {Data} from './Data';
import styled from 'styled-components';
import { IconContext } from 'react-icons';
import { FiPlus, FiMinus} from 'react-icons/fi'
import { AccordionSection, Container, Wrap, Dropdown} from './AccordionElements';





const Accordion = () => {
    const [clicked, setClicked] = useState(false)
    const toggle = index => {
        if(clicked == index)
        {
            return setClicked(null)
        }
        setClicked(index)
    }
    return (
        <IconContext.Provider value={{color : '#00FFB9', size: '25px'}}>
        <AccordionSection>  
        <Container>
            {Data.map((item, index) => {
               return (
                   <>
                   <Wrap onClick={()=> toggle(index)} key={index}>
                   <h1>{item.question}</h1>
                   <span>{clicked === index ? <FiMinus /> : <FiPlus />}</span>
                   </Wrap>
                  {clicked === index ? (
                    <Dropdown>
                   <p>{item.answer}</p>
                   </Dropdown>
                  ) : null}
                  
                   </>
               ) 
            })}
        </Container>
        </AccordionSection>
        </IconContext.Provider>

        )
}

export default Accordion

How to add delay/ fade effect when changing inputs in Shiny?

I would like to add delay/ fade effects to the value, subtitle, icon and color arguments of a reactive valueBox on shinydashboard. I have no idea how to do this as I have little knowledge of Javascript, and it seems that the solutions for this require JS. Alternatives with CSS are also useful.

I tried use shinycssloaders but I didn’t like the effect it produces when the value changes from less or more than 100.

My code:

library(shiny)
library(shinydashboard)

header <- dashboardHeader()

sidebar <- dashboardSidebar(
  sidebarMenu(
    
    id = "tabs", width = 300,
    
    menuItem("Analysis", tabName = "dashboard", icon = icon("list-ol"))
    
  )
)

body <- dashboardBody(
  
  tabItems(
    
    tabItem(tabName = "dashboard", titlePanel("Analysis"), 
            
            fluidPage(
              
              column(2, 
                     
                     box(title = "Analysis", width = 75, 
                         sliderInput(
                           inputId = 'aa', label = 'AA', 
                           value = 0.5 * 100, 
                           min = 0 * 100, 
                           max = 1 * 100, 
                           step = 1
                         ), 
                         
                         sliderInput(
                           inputId = 'bb', label = 'BB', 
                           value = 0.5 * 100, 
                           min = 0 * 100, 
                           max = 1 * 100, 
                           step = 1
                         ), 
                         
                         sliderInput(
                           inputId = 'cc', label = 'CC', 
                           value = 2.5, min = 1, max = 5, step = .15
                         ), 
                         
                         sliderInput(
                           inputId = 'dd', label = 'DD', 
                           value = 2.5, min = 1, max = 5, step = .15
                         ), 
                         
                         actionButton("execute1", "Click me")
                     )
              ), 
              
              column(8, 
                     tagAppendAttributes(class = "b1", valueBoxOutput(outputId = "box1", width = 6)))
            )
    )
  )
)

ui <- dashboardPage(header, sidebar, body)

server <- function(input, output, session) {
  
  ac <- function(aa, bb, cc, dd) {
    (aa + cc) + (bb + dd)
  }
  
  reac_1 <- reactive({
    tibble(
      aa = input$aa, 
      bb = input$bb, 
      cc = input$cc, 
      dd = input$dd
    )
  })
  
  pred_1 <- reactive({
    temp <- reac_1()
    ac(
      aa = input$aa, 
      bb = input$bb, 
      cc = input$cc, 
      dd = input$dd
    )
  })
  
  output$box1 <- renderValueBox({
    req(input$execute1)
    expr = isolate(valueBox(
      value = pred_1(), 
      subtitle = ifelse(test = pred_1() <= 100, 
                        "subtitle 1", "subtitle 2"), 
      icon = icon(ifelse(test = pred_1() <= 100, "smile", "angry")),  
      color = ifelse(test = pred_1() <= 100, "light-blue", "orange")
    ))
  })
  
}

shinyApp(ui, server)