std::regex is different than Javascript [duplicate]

I thought that std::regex was ECMAScript compatible. However, that does not seem to be true, at least not by default, e.g.

The expression :user will match asd:user in Javascript but not with std::regex while .*:user will match.

What is the cause for the difference and is there any flags or options I can pass to std::regex and/or std::regex_match to make std::regex behave exactly like Javascript RegExp?

I get a gas error when I try to mint a token

I am trying to estimate gas for the mint function in a smart contract I created.

      try {
        const gas = await publicClient.estimateContractGas({
          address: provider.token,
          abi: fiatAbi,
          functionName: 'mint',
          account,
          args: [
            `0x${p.userId}`,
            BigInt(p.settledAmount) * 10n ** BigInt(provider.decimals),
          ],
        })

Here is the minimized token contract code

// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

import {Initializable} from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {ERC20Upgradeable} from "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
...

abstract contract PepperBaseTokenV1 is
    Initializable,
    ERC20Upgradeable,
    ...
{
    ... 
    
    function mint(address to, uint256 amount) public onlyOwner {
        _mint(to, amount);
    }

    ...
    
    function _update(
        address from,
        address to,
        uint256 value
    ) internal virtual override(ERC20Upgradeable, ERC20PausableUpgradeable) whenNotPaused {
        require(!blockList[from], "Sender is blacklisted");
        require(!blockList[to], "Recipient is blacklisted");

        super._update(from, to, value);
    }
}

But everytime I try to mint or estimate gas I get this error.

{

  "details": "insufficient funds for transfer",

  "metaMessages": [

    "This error could arise when the account does not have enough funds to:",

    " - pay for the total gas fee,",

    " - pay for the value to send.",

    " ",

    "The cost of the transaction is calculated as `gas * gas fee + value`, where:",

    " - `gas` is the amount of gas needed for transaction to execute,",

    " - `gas fee` is the gas fee,",

    " - `value` is the amount of ether to send to the recipient."

  ],

  "shortMessage": "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.",

  "version": "2.21.3",

  "name": "InsufficientFundsError"

}

I know my wallet has enough eth for gas fee. From the error it seems the code is trying to send ETH. I am not sure why that is as the mint function takes two argument, to and value.

Netsuite PagedData inconsistencies

I have developed the following RESTlet in Netsuite to provide custom search results as API.

var 
    log,
    search,
    response = new Object();    

define( [ 'N/log', 'N/search' ], main );

function main( logModule, searchModule, searchSortModule ) {
    log = logModule;
    search = searchModule;
    search.Sort = searchSortModule;
    return { post: postProcess }
}

function postProcess(request) {
    try {
        if (typeof request.searchID === 'undefined' || request.searchID === null || request.searchID === '') {
            throw { 'type': 'error.SavedSearchAPIError', 'name': 'INVALID_REQUEST', 'message': 'No searchID was specified.' };
        }

        var searchObj = search.load({ id: request.searchID });
        log.debug('Search ID: ', request.searchID);

        // Add sorting by internalid in ascending order
        var internalIdSort = search.Sort.ASC;
        searchObj.columns.push(search.createColumn({
            name: 'internalid',
            sort: internalIdSort
        }));

        response.results = [];

        // Start from the last index if provided, else default to 0
        var start = (request.lastIndex && !isNaN(request.lastIndex)) ? parseInt(request.lastIndex) : 0;

        // Get the total record count using runPaged on search object
        var pagedData = searchObj.runPaged();
        log.debug('Total Record Count', pagedData.count);

        // Return the total record count
        response.totalRecords = pagedData.count;

        var results = [];
        var pageIndex = Math.floor(start / 1000);  // Calculate the starting page index
        var recordOffset = start % 1000;  // Calculate the record offset within the page

        log.debug('Starting at page:', pageIndex);
        log.debug('Starting at record offset:', recordOffset);

        // Fetch the starting page and subsequent pages if necessary
        for (var i = pageIndex; i < pagedData.pageRanges.length; i++) {
            var currentPage = pagedData.fetch({ index: i });

            // If starting in the middle of a page, skip the records before the offset
            var pageData = (i === pageIndex) ? currentPage.data.slice(recordOffset) : currentPage.data;

            pageData.forEach(function(result) {
                results.push(result);
            });

            // Update start for the next batch
            start += pageData.length;

            // Concatenate results
            response.results = response.results.concat(pageData);

            // Stop fetching if we reach 1000 results in this response
            if (response.results.length >= 1000) {
                response.lastIndex = start;
                break;
            }

            // If we've fetched all available records, stop
            if (start >= pagedData.count) {
                log.debug('End of records reached.');
                response.lastIndex = null; // Indicate no more records
                break;
            }
        }

        // If we fetched less than 1000 results and there are no more records
        if (response.results.length < 1000 && start >= pagedData.count) {
            response.lastIndex = null;
        }

        return response;

    } catch (e) {
        log.debug({ 'title': 'error', 'details': e });
        return { 'error': { 'type': e.type, 'name': e.name, 'message': e.message } };
    }
}

The script works as expected, with an index and pagination management. The main issue is the inconsistency between the total number of records returned by the RESTlet and the number of records I have in Netsuite for the given searchId. (For example, 83.228 records vs 130.245 in Netsuite)

Question: Where do the inconsistencies come from? PagedData should return the correct metadata, at least for the count.

Troubleshooting for CSS layout issue [duplicate]

I am facing some trouble in implementing the layout of a page that I am working on. I have attached a screenshot of the desired layout. The main element is the box in the bottom right showing tab-content and header; I want that box to take 50% of the visible right half.
This is the code snippet showing what I am attempting.

html,
body {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  background: lightcoral;
  height: 50px;
}

.main {
  background: blue;
  flex: 1;
}

.page {
  height: 100%;
  background: white;
  display: flex;
  flex-direction: column;
}

.page-header {
  height: 50px;
  background: yellow;
}

.page-content {
  background: lightgoldenrodyellow;
  flex: 1;
  display: flex;
}

.element1 {
  background: lightgreen;
  width: 50%;
  height: 100%
  max-height: 100%;
  overflow-y: auto;
}

.element-1-content {
  height: 1000px;
}

.element2 {
  width: 50%;
  background: lightblue;
  display: flex;
  height: 50%;
  flex-direction: column;
}

.tab {
  background: lightslategrey;
  height: 20px;
}

.tab-content {
  flex: 1;
  background: lightpink;
}
<header class="header">
  <p>
    some header
  </p>
</header>
<main class="main">
  <div class="page">
    <header class="page-header">
      <p>
        page header
      </p>
    </header>
    <main class="page-content">
      <div class="element1">
        <div class="element-1-content">
          Element 1 content
        </div>
      </div>
      <div class="element2">
        <div class="tab">
          tab header
        </div>
        <div class="tab-content">
          tab content
        </div>

      </div>
    </main>

  </div>
</main>

Desired layout

How to go from mapped source to minified code

I need to find where a specific function in main.js.map is in the minified code main.js.

I tried to do it in Chrome dev tools, but that does not seem possible. Chrome directs me to the entire minified file, not to a specific location in the minified file.

I saw a method involving break points, but that would not work for my use case

I am happy to do it manually, with less, but I’m not sure how to do it.

Any pointer?

I cannot send a variable with multiple values in Jquery

I have a code that generates dynamically table rows and I want to make that whenever the user clicks on a row it sends that information to a function and it process it in a modal.

The thing is that I am having trouble passing information, I’ve tried everything I know, even passing ASCII the special characters such as ‘.’ or ‘_’ but still cannot manage to make it.

The error: Uncaught SyntaxError: Invalid or unexpected token (at AdminTab:1:14)

The program is taking the values as they were numbers and strings but I am parsing all of them to string always RESULT: acceptModal( 195Pending95User permission requested95gbilbao95gbilbao@gestamp46com95ES95Admin)

I provide the code of cshtml and jquery:

$(document).ready(function () {
    $.ajax({
        type: "GET",
        url: '/AdminTab/ShowAllUserPetitions',
        error: function () {
            //alert("An error occurred.");
        },
        success: function (data, type, full) {          
            var IDPetition = {};
            var Status = {};
            var PetitionDate = {};
            var Description = {};
            var Username = {};
            var Email = {};
            var Domain = {};
            var Privilege = {};
            var newRowContent = ``;
            var newRowContentResolved = ``;
            var newRowContentUnResolved = ``;
            var counterUnResolved = 0;
            var counterResolved = 0;
            var counterConfirmed = 0;

            IDPetition = data.data.map(function (e) {
                return e.id_user_petition;
            });
            Status = data.data.map(function (e) {
                return e.petition_status;
            });
            PetitionDate = data.data.map(function (e) {
                return e.petition_date;
            });
            Description = data.data.map(function (e) {
                return e.petition_description;
            });
            Username = data.data.map(function (e) {
                return e.username;
            });
            Email = data.data.map(function (e) {
                return e.email;
            });
            Domain = data.data.map(function (e) {
                return e.domain;
            });
            Privilege = data.data.map(function (e) {
                return e.privilege;
            });

            let ASCIILowBar = "95";

            $.each(Privilege, function (key, value) {
                if (Status[key] == "Pending" || Status[key] == "Confirmed")
                {   
                    debugger;

                    sendUserRequest = IDPetition[key].toString() + ASCIILowBar + Status[key].toString() + ASCIILowBar + Description[key].toString() + ASCIILowBar + Username[key].toString() + ASCIILowBar + Email[key].toLocaleString() + ASCIILowBar + Domain[key].toString() + ASCIILowBar + Privilege[key].toString();

                    do {
                        let indexofDot = sendUserRequest.indexOf('.');
                        let asciiValueDot = sendUserRequest.charCodeAt(indexofDot);
                        sendUserRequest = sendUserRequest.replace('.', asciiValueDot);
                    } while (sendUserRequest.indexOf('.') != -1);


                    //const sendContent = [IDPetition[key].toString(), Status[key].toString()/*, Description[key], Username[key], Email[key], Domain[key], Privilege[key]*/];
                    newRowContentUnResolved = newRowContentUnResolved +
                        `   <tr id = "` + IDPetition[key] + "_" + Status[key] + `" onclick="acceptModal( ` + sendUserRequest + `)">
                            <td class="text-center">
                                <h7 class="no-margin"> ` + PetitionDate[key] + ` <small class="display-block text-size-small no-margin"></small></h7>
                                <h6 class="no-margin">
                            </td>
                            <td>`;
                    if (Status[key] == "Pending") {
                        counterUnResolved = counterUnResolved + 1;
                        newRowContentUnResolved = newRowContentUnResolved + `
                        <div class="media-left media-middle">
                            <a href="#" class="button">
                                <i class="icon-circle2" style="color:#EE8A32"></i>
                            </a>
                        </div>
                        <div class="media-body">
                            <a href="#" class="display-inline-block text-default text-semibold letter-icon-title"> User Petition</a>
                            <div class="text-muted text-size-small"><h7 style="color:#EE8A32; font-weight:600">` + Status[key] + ` </h7></div>
                        </div>                      
                        `;
                    }
                    else
                    {
                        counterConfirmed = counterConfirmed + 1;
                        newRowContentUnResolved = newRowContentUnResolved + `
                        <div class="media-left media-middle">
                            <a href="#" class="button">
                                <i class="icon-circle2" style="color:#57A7C8"></i> 
                            </a>
                        </div>
                        <div class="media-body">
                            <a href="#" class="display-inline-block text-default text-semibold letter-icon-title"> User Petition</a>
                            <div class="text-muted text-size-small"><h7 style="color:#57A7C8; font-weight:600">` + Status[key] + ` </h7></div>
                        </div>                      
                        `;
                    }
                    newRowContentUnResolved = newRowContentUnResolved + `
                            </td>
                            <td>
                                <a href="#" class="text-default display-inline-block">
                                    <span class="text-semibold">[#` + IDPetition[key] + `] User addition requested for ` + Username[key] + `</span>
                                    <span class="display-block text-muted">` + Description[key] + `</span>
                                </a>
                            </td>
                            <td>
                                <a href="#" class="text-default display-inline-block">
                                    <span class="text-semibold"> Privilege: </span> <span>` + Privilege[key] + `</span><span class="text-semibold"> Email: </span> <span>` + Email[key] + ` </span> <span class="text-semibold">Domain: </span><span>` + Domain[key] + ` </span>
                                </a>
                            </td>`;
                    if (Status[key] == "Pending") {
                        newRowContentUnResolved = newRowContentUnResolved + `
                            <td class="text-center">
                                <ul class="icons-list">
                                    <li class="dropdown">
                                        <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
                                        <ul class="dropdown-menu dropdown-menu-right">
                                            <li id="petition_accept" ` + IDPetition[key] + ` onclick="acceptModal(` + IDPetition[key] + ` )"><a href="#"><i class="icon-checkmark3 text-success"></i> Accept Petition</a></li>
                                            <li><a href="#"><i class="icon-cross2 text-danger"></i> Decline Petition</a></li>
                                        </ul>
                                    </li>
                                </ul>
                            </td>
                        </tr>`;
                    }
                    else {
                        newRowContentUnResolved = newRowContentUnResolved + `
                            <td class="text-center">
                                <ul class="icons-list">
                                    <li class="dropdown">
                                        <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
                                        <ul class="dropdown-menu dropdown-menu-right">
                                            <li><a href="#"><i class="icon-pencil4"></i> Add Comments</a></li>
                                            <li><a href="#"><i class="icon-history"></i> Rollback Request</a></li>
                                        </ul>
                                    </li>
                                </ul>
                            </td>
                        </tr>`;
                    }
                }               
            });

            counterResolved = Status.length - counterUnResolved - counterConfirmed;

            newRowContent = `<tr class="active border-double">
                                <td colspan="4"><h7 style="font-weight:500">Active tickets</h7></td>
                                <td class="text-right">
                                    <span class="badge bg-orange">` + counterUnResolved + `</span>
                                    <span class="badge bg-blue">` + counterConfirmed + `</span>
                                </td>
                             </tr>`;

            newRowContentResolved =
                `<tr class="active border-double">
                <td colspan="4"><h7 style="font-weight:500">Resolved tickets</h7></td>
                <td class="text-right">
                    <span class="badge bg-success">` + counterResolved + `</span>
                </td>
                </tr>`;

            $.each(Privilege, function (key, value) {
                if (Status[key] == "Inserted") {        
                    newRowContentResolved = newRowContentResolved +
                        `   <tr>
                            <td class="text-center">
                                <h7 class="no-margin"> ` + PetitionDate[key] + ` <small class="display-block text-size-small no-margin"></small></h7>
                                <h6 class="no-margin">
                            </td>
                            <td>
                                <div class="media-left media-middle">
                                    <a href="#" class="button">
                                        <i class="icon-circle2" style="color:#87C857"></i>
                                    </a>
                                </div>

                                <div class="media-body">
                                    <a href="#" class="display-inline-block text-default text-semibold letter-icon-title"> User Petition</a>
                                    <div class="text-muted text-size-small"><h7 style="color:#87C857; font-weight:600">` + Status[key] + ` </h7></div>
                                </div>
                            </td>
                            <td>
                                <a href="#" class="text-default display-inline-block">
                                    <span class="text-semibold">[#` + IDPetition[key] + `] User addition requested for ` + Username[key] + `</span>
                                    <span class="display-block text-muted">` + Description[key] + `</span>
                                </a>
                            </td>
                            <td>
                                <a href="#" class="text-default display-inline-block">
                                    <span class="text-semibold"> Privilege: </span> <span>` + Privilege[key] + `</span><span class="text-semibold"> Email: </span> <span>` + Email[key] + ` </span> <span class="text-semibold">Domain: </span><span>` + Domain[key] + ` </span>
                                </a>
                            </td>
                            <td class="text-center">
                                <ul class="icons-list">
                                    <li class="dropdown">
                                        <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="icon-menu7"></i></a>
                                        <ul class="dropdown-menu dropdown-menu-right">
                                            <li><a href="#"><i class="icon-pencil4"></i> Add Comments</a></li>
                                            <li><a href="#"><i class="icon-cancel-square" style="color:red"></i> Delete Request</a></li>
                                        </ul>
                                    </li>
                                </ul>
                            </td>
                        </tr>`;
                }
            });

            $("#activeTickets tbody").html(newRowContent + newRowContentUnResolved + newRowContentResolved);
        }
    });
    
});
function acceptModal(receivedValue) {
    debugger;
    var newRowContent;

    //test = sendUserRequest[0];
    //test2 = sendUserRequest[1];

    newRowContent = `<div class="form-group row" style="margin-bottom: 10px;">
                        <label class="col-md-4 col-form-label">Plant Reference</label>
                        <div class="col-md-8">
                            <input id="#" name="#" type="text" placeholder="Automatic Web App" class="form-control" disabled />
                        </div>
                    </div>`;
    $("#modalForSpecificPetition").html(newRowContent);

    $('#modal_user').modal('toggle');
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<div class="row">
                            <div class="col-lg-12">
                                <div class="col-lg-12-offset-2">
                                <!-- Support tickets -->
                                <div class="tab-content">
                                <div class="tab-pane pushbar_main_content" id="requestsUserAdmin">
                                <div class="panel panel-flat">
                                    <div class="panel-heading">
                                        <h5 class="panel-title" style="font-weight:500">USER REQUESTS</h5>
                                        <div class="heading-elements">
                                            <button type="button" class="btn btn-link daterange-ranges heading-btn text-semibold">
                                                <i class="icon-calendar3 position-left"></i> <span></span> <b class="caret"></b>
                                            </button>
                                        </div>
                                    </div>
                                    <div class="table-responsive">
                                        <table class="table text-nowrap" id="activeTickets">
                                            <thead>
                                                <tr>
                                                    <th style="width: 50px; font-size:14px">Due</th>
                                                    <th style="width: 300px;font-size:14px">Type</th>
                                                    <th style="font-size:14px">Description</th>
                                                    <th style="font-size:14px">Petition Information</th>
                                                    <th class="text-center" style="width: 20px;font-size:14px"><i class="icon-arrow-down12"></i></th>
                                                </tr>
                                            </thead>
                                            <tbody>

                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                </div>
                                </div>
                                <!-- /support tickets -->

                            </div>
                            </div>
                        </div>

Note that the code for the function is not finished yet because first I want to solve the variable issue.

I tried firstly to pass 1 value or variable, it worked without any issue. Then I tried to send multiple variables and then started failing. Trying to fix it I made an array so send only 1 value but the same error persisted. Other thing I tried and is the one that now appears in the code is to parse the special characters to ASCII values but nothing but the same error happened.

What is the simplest possible way to get a div button to hide its parent div on click in React.js

I have a task that is simple (one line) in plain HTML/CSS/JS, but I can’t find a simple and working method in React.

I have a parent div, and it has two children. The second child is the meaningful content. The first child is a “hide” button, that, when clicked, hides the parent div (including, of course, both child divs).

function SecondPage({ thisData }) {

    function hidePage(thisID) {
        let thisElement = document.getElementById(thisID)
        thisElement.style.display='none';
    }

    return ( <>
        <div className="page" id="InfoPage">
            <div className="hidePageButton" onClick={hidePage("InfoPage")}>
                ✖
            </div>
            <div className="pageContent"> 
                Some text and stuff
            </div>
        </div>
    );
}

In fact, there is an even easier/simpler way using onClick={hidePage(this)} and function hidePage(el) {el.parentNode.style.display='none' }

But these methods don’t work in React. I’ve seen some proposed solutions for React that supposedly do what I want, but they are complicated. They propose defining classes with embedded functions and all kinds of seemingly extra baggage to do this simple task.

I’ve also read hints that being able to get elements by IDs and getting parents is not in line with React’s philosophy. But I don’t care about that. I don’t need the best way according to React gospel, or the most modular, or the safest, or anything like that. But I also prefer not to install some extra package that provides this functionality, because that may not be robust or work properly in the future, but I’ll consider it if it’s a really strongly supported package.

I understand that I probably have to use useState and useEffect to get this to work. Create a toggle variable that holds the visible status, and use that variable in a conditional statement that determines whether to show the page or show null. Then onClick I change the value of the toggle, which changes the rendering of the page. I found some examples similar to that, but not a minimal example that worked in React.

What is the simplest possible way to get a div button to hide its parent div (or make other style changes) on click in React (jsx).

YouTube Caption Scraper Randomly Fails with “Could not find captions for video”

I’m trying to grab YouTube video captions using the youtube-captions-scraper package. Most of the time, it works perfectly, but sometimes it fails with the following error: Could not find captions for video: video-id

This error seems to occur randomly, even for videos where captions are available when checked manually.

const { getSubtitles } = require('youtube-captions-scraper');

const videoId = 'some-video-id';

getSubtitles({
  videoID: videoId, // YouTube video ID
  lang: 'en' // language code
})
.then(captions => {
  console.log(captions);
})
.catch(err => {
  console.error('Error:', err.message);
});
  • The video definitely has captions (I verified them on the YouTube).
  • The error does not always occur for the same video ID; sometimes the same video will work fine on subsequent attempts.
  • I have tried this on different networks and systems, but the behavior is inconsistent.

Has anyone faced this issue or know why this happens? Could it be related to rate-limiting or API throttling by YouTube? Any advice on how to handle this more gracefully or avoid the error altogether would be appreciated.

Disable Shopify Add to Cart button based on metafield value

I have a boolean variant metafield which when set to “True” on a variant, and this variant is selected, changes the price element to a placeholder text showing “POA”. I would also like the “Add to Cart” button to be disabled when this happens too, but that part I am struggling with. I have managed to achieve this when the page loads to the variant with the metafield set to true, but not when its selected after the page load and I guess that is where Javascript comes in. I am fairly comfortable with liquid/html coding but not Javascript. I have amended some to get the price to change. It’s a 2.0 theme from the Shopify store called “Stockmart”.

I have tried to look at the Javascript files and can see the Javascript code that disables the “Add to cart” button currently, but this is based on the product inventory settings so can’t directly utilise that I guess.

Thank you.

vue List Rendering: change value of string before “v-for”

I am trying to replace a certain string with a condition before it gets to the output.

Below is my code

<script setup>
import { ref } from 'vue'

const items = ref([{ letter: "A", message: '1' }, { letter: "B", message: '2' }])
</script>

<template>
    <li v-for="(item, index) in items">
        <p v-if="item.message === '1'">
            {{ item.letter }} - {{ 'Apple' }}
        </p>
        <p v-if="item.message === '2'">
            {{ item.letter }} - {{ 'Banana' }}
        </p>
    </li>
</template>

I tried adding the v-if inside the v-for but this seems impractical. I am trying to figure out a way to have item.message replace its string value before v-for. Any suggestions?

How to ignore empty rows when submitting to database

I have a problem when I submit the form which had empty rows so that in the database the empty rows are still inputted even though they are empty which causes the next input to skip the empty row.

Input data only on 2 rows:

enter image description here

Result in database:

enter image description here

`function submitFR() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var formSS = SpreadsheetApp.openById(“1OWqOlqy_pfZgmtgOx8i-b-V_u3IBZnsOklahh4pXGSM”).getSheetByName(“Form”);
var datasheet = SpreadsheetApp.openById(“1OonemP29xCjyChjYUYJWWGKyjo-BFFUVSJhoyx6MQEg”).getSheetByName(“Database Jurnal”);

var values = [[formSS.getRange(“B22”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+1, 1, 1, 1).setValues(values);

var values = [[formSS.getRange(“D22”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 2, 1, 1).setValues(values);

var values = [[formSS.getRange(“E22”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 3, 1, 1).setValues(values);

var values = [[formSS.getRange(“L22”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 4, 1, 1).setValues(values);

var values = [[formSS.getRange(“M22”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 5, 1, 1).setValues(values);

var values = [[formSS.getRange(“N22”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 6, 1, 1).setValues(values);

var values = [[formSS.getRange(“O22”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 7, 1, 1).setValues(values);

var values = [[formSS.getRange(“P22”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 8, 1, 1).setValues(values);

var values = [[formSS.getRange(“R22”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 9, 1, 1).setValues(values);

var values = [[formSS.getRange(“S22”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 10, 1, 1).setValues(values);

var values = [[formSS.getRange(“B23”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+1, 1, 1, 1).setValues(values);

var values = [[formSS.getRange(“D23”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 2, 1, 1).setValues(values);

var values = [[formSS.getRange(“E23”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 3, 1, 1).setValues(values);

var values = [[formSS.getRange(“L23”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 4, 1, 1).setValues(values);

var values = [[formSS.getRange(“M23”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 5, 1, 1).setValues(values);

var values = [[formSS.getRange(“N23”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 6, 1, 1).setValues(values);

var values = [[formSS.getRange(“O23”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 7, 1, 1).setValues(values);

var values = [[formSS.getRange(“P23”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 8, 1, 1).setValues(values);

var values = [[formSS.getRange(“R23”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 9, 1, 1).setValues(values);

var values = [[formSS.getRange(“S23”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 10, 1, 1).setValues(values);

var values = [[formSS.getRange(“B24”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+1, 1, 1, 1).setValues(values);

var values = [[formSS.getRange(“D24”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 2, 1, 1).setValues(values);

var values = [[formSS.getRange(“E24”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 3, 1, 1).setValues(values);

var values = [[formSS.getRange(“L24”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 4, 1, 1).setValues(values);

var values = [[formSS.getRange(“M24”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 5, 1, 1).setValues(values);

var values = [[formSS.getRange(“N24”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 6, 1, 1).setValues(values);

var values = [[formSS.getRange(“O24”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 7, 1, 1).setValues(values);

var values = [[formSS.getRange(“P24”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 8, 1, 1).setValues(values);

var values = [[formSS.getRange(“R24”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 9, 1, 1).setValues(values);

var values = [[formSS.getRange(“S24”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 10, 1, 1).setValues(values);

var values = [[formSS.getRange(“B25”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+1, 1, 1, 1).setValues(values);

var values = [[formSS.getRange(“D25”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 2, 1, 1).setValues(values);

var values = [[formSS.getRange(“E25”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 3, 1, 1).setValues(values);

var values = [[formSS.getRange(“L25”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 4, 1, 1).setValues(values);

var values = [[formSS.getRange(“M25”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 5, 1, 1).setValues(values);

var values = [[formSS.getRange(“N25”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 6, 1, 1).setValues(values);

var values = [[formSS.getRange(“O25”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 7, 1, 1).setValues(values);

var values = [[formSS.getRange(“P25”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 8, 1, 1).setValues(values);

var values = [[formSS.getRange(“R25”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 9, 1, 1).setValues(values);

var values = [[formSS.getRange(“S25”).getValue()]];
datasheet.getRange(datasheet.getLastRow()+0, 10, 1, 1).setValues(values);

}`

Why I am having the email protected problem in laravel?

I have a view on which I am displaying some text. That is generating through API url. When I am printing that page in flutter application. I am getting the problem that the email in that text is converting to email protected. What is the solution to this.

this is the code:

<center style="margin-bottom: 30px;" class="">
        <strong class="company-header">{!! nl2br(e(str_replace(',', "n", $adminUser->company_header))) !!}</strong>
      
    </center>

And this is the output of the view on web:
enter image description here

When I am printing this in the flutter application, the email changes to email protected.

Move elements from one div to another to modify a map

Its a page of a project with Blazor, .NET and JS.

I am trying to modify a map based on the positions of each element, and my problem is that when I try to move from the “drawing-list” element (it is a div where there are three elements that you can drag and move it to the main div to add more elements to the map if you wish.) nothing happens, but then when modifying it is not draggable within the main div, and all dragging elements are blocked.

The code (script) of a drawing-list:

    window.initializeSortableForDrawings = () => {
        const mapContainer = document.querySelector('.map-container');
        const drawingList = document.querySelector('.drawing-list');

        if (mapContainer && drawingList) {
            Sortable.create(drawingList, {
                group: {
                    name: "drawings",
                    pull: "clone",
                    put: false
                },
                sort: false
            });

            Sortable.create(mapContainer, {
                group: "drawings",
                onAdd: function (evt) {
                    const itemEl = evt.item;
                    const dibujoId = itemEl.id.replace('dibujo-list-', '');

                    // Clonar el elemento arrastrado
                    var clonedElement = itemEl.cloneNode(true);
                    clonedElement.id = `dibujo-${dibujoId}`;
                    clonedElement.removeAttribute('draggable');
                    clonedElement.style.position = 'absolute';

                    // Obtener las coordenadas del evento de arrastre y soltar
                    const containerRect = evt.target.getBoundingClientRect();
                    clonedElement.style.left = `${evt.clientX}px`;
                    clonedElement.style.top = `${evt.clientY}px`;

                    // Añadir el elemento clonado al zoom-container
                    evt.target.appendChild(clonedElement);

                    // Eliminar el original para evitar duplicación
                    evt.from.removeChild(itemEl);

                    console.log(`Dibujo ${dibujoId} añadido al mapa.`);

                    // Verifica si dotNetRef está definido antes de llamar a invokeMethodAsync
                    if (dotNetRef) {
                        dotNetRef.invokeMethodAsync('ActualizarMapa')
                            .then(() => {
                                console.log('Mapa actualizado.');
                            })
                            .catch(error => console.error('Error al actualizar el mapa:', error));
                    } else {
                        console.error('dotNetRef no está definido.');
                    }
                }
            });
        }
    };

    // Permite que el contenedor acepte elementos arrastrados
    function allowDrop(ev) {
        ev.preventDefault();
    }

    // Llamado cuando se inicia el arrastre
    function drag(ev) {
        ev.dataTransfer.setData("text", ev.target.dataset.dibujoId); // Guardar el ID del dibujo
    }

    // Llamado mientras se está arrastrando
    function dragging(ev) {
        ev.preventDefault();
        var dibujoId = ev.dataTransfer.getData("text");
        var dibujoElement = document.getElementById('dibujo-list-' + dibujoId);

        // Crear una versión visual mientras se arrastra
        var previewElement = document.getElementById('drag-preview');
        if (!previewElement) {
            previewElement = dibujoElement.cloneNode(true);
            previewElement.id = 'drag-preview';
            previewElement.style.position = 'fixed';
            previewElement.style.pointerEvents = 'none'; // Evita interacciones con el elemento mientras se arrastra
            previewElement.style.zIndex = '1000';
            document.body.appendChild(previewElement);
        }

        // Actualiza la posición del preview mientras se arrastra
        previewElement.style.left = ev.clientX + 'px';
        previewElement.style.top = ev.clientY + 'px';
    }

    // Llamado cuando se suelta el elemento
    function drop(ev) {
        ev.preventDefault();
        var dibujoId = ev.dataTransfer.getData("text"); // Obtener el ID del dibujo
        var dibujoElement = document.getElementById('dibujo-list-' + dibujoId);

        // Clonar el elemento arrastrado y agregarlo al contenedor del mapa (zoom-container)
        var clonedElement = dibujoElement.cloneNode(true);
        clonedElement.removeAttribute('draggable'); // No permitir arrastrar el elemento nuevamente
        clonedElement.style.position = 'absolute'; // Posicionar el elemento en el mapa

        // Posicionarlo en las coordenadas donde se suelta
        const containerRect = ev.target.getBoundingClientRect();
        clonedElement.style.left = (ev.clientX - containerRect.left) + 'px';
        clonedElement.style.top = (ev.clientY - containerRect.top) + 'px';

        // Agregar el elemento clonado al contenedor de zoom
        ev.target.appendChild(clonedElement);

        // Eliminar el preview del arrastre
        var previewElement = document.getElementById('drag-preview');
        if (previewElement) {
            previewElement.remove();
        }

        // RE-RENDERIZADO
        clonedElement.style.display = 'none';
        requestAnimationFrame(() => {
            clonedElement.style.display = '';
        });

        dotNetRef.invokeMethodAsync('ActualizarMapa')
            .then(() => {
                logMessage('Mapa actualizado en Blazor.');
            })
            .catch(error => {
                logMessage('Error al actualizar el mapa:', error);
            });
    }

The code of the main div:

window.initializeSortable = () => {
        const tryInitialize = () => {
            const container = document.querySelector('.zoom-container');
            if (container) {
                logMessage('Contenedor encontrado:', container);

                Sortable.create(container, {
                    animation: 150,
                    onStart: (evt) => {
                        const element = evt.item;
                        element.classList.add("dragging");
                        logMessage(`Iniciando arrastre para: ${element.id}`);
                        DotNet.invokeMethodAsync('RMSuit_v2', 'SetDraggingState', true)
                            .catch(error => logMessage(`Error al actualizar estado de arrastre: ${error}`));
                    },
                    onEnd: (evt) => {
                        const element = evt.item;
                        element.classList.remove("dragging");
                        const elementId = evt.item.id.replace('dibujo-', '');

                        const rect = element.getBoundingClientRect();

                        const container = document.querySelector('.map-container');
                        const containerRect = container.getBoundingClientRect();

                        const newX = Math.round(rect.left - containerRect.left);
                        const newY = Math.round(rect.top - containerRect.top);

                        logMessage(`Elemento ${elementId} movido a X: ${newX}, Y: ${newY}`);

                        dotNetRef.invokeMethodAsync('UpdateElementPositionAsync', parseInt(elementId), newX, newY)
                            .catch(error => logMessage(`Error al actualizar la posición: ${error}`));

                        DotNet.invokeMethodAsync('RMSuit_v2', 'SetDraggingState', false)
                            .catch(error => logMessage(`Error al actualizar estado de arrastre: ${error}`));
                    },
                    onMove: (evt) => {
                        const element = evt.dragged;
                        const container = document.querySelector('.map-container');
                        const containerRect = container.getBoundingClientRect();

                        // Usamos el evento original del mouse para obtener las coordenadas correctas
                        const mouseEvent = evt.originalEvent;
                        const newX = Math.round(mouseEvent.clientX - containerRect.left - element.offsetWidth / 2);
                        const newY = Math.round(mouseEvent.clientY - containerRect.top - element.offsetHeight / 2);

                        // Actualizar la posición del elemento en tiempo real
                        element.style.left = `${newX}px`;
                        element.style.top = `${newY}px`;

                        logMessage(`Moviendo elemento: ${element.id}, X: ${newX}, Y: ${newY}`);
                    }
                });
            } else {
                logMessage('Sortable: el contenedor no se encontró, reintentando...');
                setTimeout(tryInitialize, 100); // Reintento después de 100ms
            }
        };

        tryInitialize();
    };

The complete code is here:

https://github.com/MarcomedSoltel/Problem/commit/b384ca942e2858774706d69dda74b01226bf4ead

Try to solve it by debugging to see what could happen. I also try to give a unique id to each new element, but all I can think of is that the changes are not updated well visually or why the positions are 1,1 instead of dragging it correctly on the map. I’m a little stuck on this, and I don’t really know how to move forward.