| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283 | function finishToSet(e) {  $("#set-icube-" + e).hasClass("active-icube-setting") &&    (selectedIcube && selectedIcube.finishToSetProperty(e),    "connection" === e && updateConnectorsPrice()),    (g_sceneMode = sceneMode.normal);}function clickOn(t, e) {  if (    (updateDrawButtonState(),    ["passthrough", "charger"].includes(t)      ? (currentView !== ViewType.free          ? switch_to_free_camera()          : switchCamera(ViewType.free),        (scene.activeCamera.alpha =          g_rackingOrientation === OrientationRacking.horizontal            ? Math.PI / 4            : (3 * Math.PI) / 4),        (scene.activeCamera.beta = 1))      : currentView !== ViewType.top && switch_to_top_camera(),    $(e).hasClass("active-icube-setting"))  )    finishToSet(t);  else {    if ("connection" === t)      if (0 === getValidIcubeToConect().length)        return void Utils.logg("无法连接SIMANC!", "错误");    htmlElemAttr.forEach(e => {      e !== t && finishToSet(e);    }),      selectedIcube && selectedIcube.previewProperty(t),      tracking(65 + parseInt(htmlElemAttr.indexOf(t)));  }  renderScene(1e3);}function updateDistrPallet(e, t) {  var a = g_palletInfo.max,    i = [...g_palletInfo.value];  (g_palletInfo.value[e] = t),    (g_palletInfo.type = optimizeDistrCalculation(e, g_palletInfo.value)),    updatePalletDistributions(g_palletInfo.value),    (g_xtrackFixedDim = 2 !== g_palletInfo.max ? 1.35 : 1.55),    g_palletInfo.max !== a ||    (0 == i[0] && 0 != g_palletInfo.value[0]) ||    (0 == i[1] && 0 != g_palletInfo.value[1]) ||    (0 == i[2] && 0 != g_palletInfo.value[2]) ||    (0 != i[0] && 0 == g_palletInfo.value[0]) ||    (0 != i[1] && 0 == g_palletInfo.value[1]) ||    (0 != i[2] && 0 == g_palletInfo.value[2])      ? (selectedIcube &&          g_palletInfo.max !== a &&          (selectedIcube.activedPillers = []),        updateSelectedIcube())      : palletsNoJS(),    Behavior.add(Behavior.type.palletType),    renderScene();}function recreateAutoIcube() {  currentView !== ViewType.free    ? switch_to_free_camera()    : switchCamera(ViewType.free),    removeAllIcubes(),    autoDrawIcube();}function updateCarrierAmount(e, t) {  null !== selectedIcube &&    ((g_recomandedCarrierAmount = parseInt(e)),    $("#carrierAmount").html(g_recomandedCarrierAmount),    $("#extracarrierAmount").val(parseInt(t)));}function updateLiftAmount(e, t) {  (g_recomandedLiftAmount = parseInt(e)),    $("#liftAmount").html(g_recomandedLiftAmount),    $("#extraliftAmount").html(parseInt(t));}function updateXtrackAmount(e, t) {  (g_recomandedXtrackAmount = parseInt(e)),    $("#xtrackAmount").html(g_recomandedXtrackAmount),    $("#extraxtrackAmount").html(parseInt(t));}function initToolBar() {  if (    (SetUIUnits(),    ChangeUnits(),    setUnitForInput(),    $("#numberOfSKU").val(parseInt(g_SKU)),    $("#numberOfPalletInOutPerHour").val(parseInt(g_movesPerHour)),    $("#carrierAmount").html(parseInt(g_recomandedCarrierAmount)),    $("#liftAmount").html(parseInt(g_recomandedLiftAmount)),    $("#extracarrierAmount").val(parseInt(g_extraCarrierAmount)),    $("#extraliftAmount").html(parseInt(g_extraLiftAmount)),    $("#xtrackAmount").html(parseInt(g_recomandedXtrackAmount)),    $("#extraxtrackAmount").html(parseInt(g_extraXtrackAmount)),    updateRackingHighLevel(!0),    updatePalletDistributions(g_palletInfo.value),    $("#input-pallet-weight").val(g_palletWeight),    $("#palletOverhang").val(g_palletOverhang),    $("#loadPalletOverhang").val(g_loadPalletOverhang),    $('select[name="orientationRacking"]').val(g_rackingOrientation),    $("#spacing_b_rows").val(g_spacingBetweenRows),    0 < g_palletAtLevel.length && $("#customLastRow").trigger("click"),    0 === g_drawMode)  ) {    if ($("#custom-upRightDist").hasClass("active-icube-setting")) return;    $("#auto-upRightDist").removeClass("active-icube-setting"),      $("#input-upRightDistance").attr("disabled", !1),      $("#custom-upRightDist").addClass("active-icube-setting");  } else {    if ($("#auto-upRightDist").hasClass("active-icube-setting")) return;    $("#custom-upRightDist").removeClass("active-icube-setting"),      $("#input-upRightDistance").attr("disabled", !0),      $("#auto-upRightDist").addClass("active-icube-setting");  }  createPassThList(),    (isEditByAdmin ||      0 < g_palletAtLevel.length ||      1 < g_palletInfo.order.length) &&      !$("#settingsModeA1").hasClass("active-icube-setting") &&      $("#settingsModeA1").trigger("click");}function initToolBarForICube(e, t, a, i, n, s, l, o, r, c, u, d, m, h, g) {  (g_rackingHighLevel = e),    (g_rackingOrientation = t),    (g_palletHeight = a),    (g_palletWeight = i),    (g_palletOverhang = n),    (g_loadPalletOverhang = s),    (g_SKU = l),    (g_movesPerHour = o),    (g_recomandedCarrierAmount = r),    (g_recomandedLiftAmount = c),    (g_extraCarrierAmount = u.carrier),    (g_extraLiftAmount = u.lift),    (g_extraXtrackAmount = u.xtrack),    (g_distUpRight = d),    (g_palletAtLevel = h),    (g_spacingBetweenRows = g),    (currentUnits = unit_measurement),    initToolBar();}function saveProject(a) {  var e = getIcubeData(),    t = getManualItems(),    i = getAllMeasurements(),    n =      ((WHDimensions = WHDimensions.map(e =>        parseFloat(e.toFixed(unit_measurement ? 3 : 2))      )),      {        document_name: documentName,        warehouse_dimensions: WHDimensions,        icubeData: e,        itemMData: t,        unit_measurement: unit_measurement,        layoutMap: layoutMap,        extraInfo: extraInfo,        extraPrice: extraPrice,        measurements: i,        custom_values: custom_values,      });  initData(n),    Utils.request(      g_BasePath + "home/save",      "POST",      {        documentInfo: documentInfo,        document_name: documentName,        isEditByAdmin: parseInt(isEditByAdmin),        warehouse_dimensions: JSON.stringify(WHDimensions),        icubeData: JSON.stringify(e),        itemMData: JSON.stringify(t),        unit_measurement: JSON.stringify(unit_measurement),        layoutMap: JSON.stringify(layoutMap),        extraInfo: JSON.stringify(extraInfo),        extraPrice: JSON.stringify(extraPrice),        measurements: JSON.stringify(i),        custom_values: JSON.stringify(custom_values),        inventory: g_inventory,      },      e => {        (documentName = e.documentName),          $("#project-name").html(documentName),          Utils.logg("布局已成功保存!", "成功"),          Behavior.add(Behavior.type.saves);        let t = {          document_name: documentName,        };        getRevisions(          (t =            0 < documentInfo              ? Object.assign({}, t, {                  slid: documentInfo,                })              : t)        ),          a && a();      },      () => {        alert("保存失败!请稍后再试.");      }    );}function loadProject(e, t = -1, a = !1) {  let i = {    document_name: e,  };  -1 !== t &&    (i = Object.assign({}, i, {      slid: t,    })),    a &&      (i = Object.assign({}, i, {        useBackUp: a,      })),    Utils.request(      g_BasePath + "home/load",      "POST",      i,      e => {        setProject(e);      },      () => {        alert("加载失败!请稍后再试.");      }    );}function setProject(t, e = !0, a = -1) {  currentView !== ViewType.top && switch_to_top_camera(),    (extraInfo = t.extraInfo),    (extraPrice = t.extraPrice || []),    (unit_measurement = t.unit_measurement || 0),    (msments = t.measurements || []),    (custom_values = t.custom_values || []),    (documentInfo = isEditByAdmin ? t.documentInfo : ""),    (documentName = t.document_name),    (Array.isArray(t.warehouse_dimensions) &&      0 !== t.warehouse_dimensions.length) ||      (t.warehouse_dimensions =        Template.values[Template.type.Default].warehouse_dimensions),    (WHDimensions = [      parseFloat(t.warehouse_dimensions[0]),      parseFloat(t.warehouse_dimensions[1]),      parseFloat(t.warehouse_dimensions[2]),    ]),    initToolBar(),    removeAllIcubes(),    removeManualItems(),    removeAllMeasurements(),    warehouse.update(WHDimensions),    (g_palletHeight =      0 !== t.icubeData.length        ? t.icubeData[t.icubeData.length - 1].palletHeight        : g_palletHeight),    resetConfigVariables(),    loadIcubeData(t.icubeData, t.itemMData, t.layoutMap),    $("#customValue").html(      0 < custom_values.length ? "<b>? 此项目包含自定义值?</b>" : ""    );  for (let e = 0; e < msments.length; e++) {    const i = new Measurement(      {        id: msments[e][2],        pi: new BABYLON.Vector3(msments[e][0][0], 0, msments[e][0][1]),        pf: new BABYLON.Vector3(msments[e][1][0], 0, msments[e][1][1]),      },      scene    );    i.isCompleted(), g_measurementList.push(i);  }  if (    ($(".tab-content").is(":visible") ||      $("#main-tabs-tab-Size").trigger("click"),    e)  ) {    initData(t);    let e = {      document_name: documentName,    };    getRevisions(      (e =        0 < documentInfo          ? Object.assign({}, e, {              slid: documentInfo,            })          : e),      a    ),      Behavior.init(),      createBehavior(),      Behavior.add(Behavior.type.addIcube),      $("#project-name").html(documentName),      Utils.logg("布局已成功加载!", "成功");  }}function deleteProject(e, t = -1) {  let a = {    document_name: e,  };  -1 !== t &&    (a = Object.assign({}, a, {      slid: t,    })),    Utils.request(      g_BasePath + "home/delete",      "POST",      a,      () => {        Utils.logg("布局已成功删除!", "成功");      },      () => {        alert("删除失败!请稍后再试。");      }    );}function renameProject(e, t) {  Utils.request(    g_BasePath + "home/rename",    "POST",    {      document_name: e,      slid: t,    },    () => {      Utils.logg("已成功重命名布局!", "成功");    },    () => {      alert("重命名失败!请稍后再试。");    }  );}function sendProjectNotify(e, t) {  Utils.request(    g_BasePath + "home/sentNotificationSA",    "POST",    {      docName: e,      email: t,    },    () => {      Utils.logg("通知已成功发送!", "成功");    },    () => {      alert("通知失败!请稍后再试。");    }  );}function showModal(e) {  $("#" + e)    .removeClass("fade")    .show(),    "new-modal" === e && $("#inputDocument").val("").focus(),    "saveAs-modal" === e && $("#inputDocumentAs").val("").focus(),    "load-modal" === e && $("#searchProject").val("").focus();}function hideModal(e) {  $("#" + e)    .addClass("fade")    .hide(),    $(".modal-backdrop").hide();}function createProjectList(t) {  let a = "";  $(".list-group").html("");  for (let e = 0; e < t.length; e++)    a +=      `<div class="form-group projectList">      <div class="col-lg-11 loadP" style="cursor:pointer;">        <h5 style="font-weight:bold;">` +      t[e].document_name +      `</h5>        <span>` +      t[e].saved_time +      `</span>      </div>      <div class="col-lg-1">        <button type="button" class="loadP-btn deleteP" title="Delete project"><i class="fa fa-times" aria-hidden="true"></i></button>` +      (t[e].backup        ? '<button type="button" class="loadP-btn loadBP" title="Restore project from auto-saves"><i class="fa fa-hdd-o" aria-hidden="true"></i></button>'        : "") +      `</div>    </div>`;  $(".list-group").append(a),    showModal("load-modal"),    $(".loadP").click(function () {      loadProject($(this).find("h5").html()), hideModal("load-modal");    }),    $(".deleteP").click(function (e) {      deleteProject($(this).parent().prev()[0].firstElementChild.innerHTML),        $(this).parent().parent().remove();    }),    $(".loadBP").click(function () {      loadProject(        $(this).parent().prev()[0].firstElementChild.innerHTML,        -1,        !0      ),        hideModal("load-modal");    });}function initData(t) {  for (var a in t)    if (Array.isArray(t[a])) {      if (((init_data[a] = []), 0 < t[a].length))        if (isNaN(parseInt(t[a])))          if ("icubeData" === a)            for (let e = 0; e < t[a].length; e++)              for (var i in ((init_data[a][e] = {}), t[a][e]))                ["name", "uid", "baseLines"].includes(i) ||                  (Array.isArray(t[a][e][i])                    ? !isNaN(parseInt(t[a][e][i])) ||                      "activedCarrierInfos" === i                      ? (init_data[a][e][i] = [...t[a][e][i]])                      : (init_data[a][e][i] = t[a][e][i].map(e => ({                          ...e,                        })))                    : isNaN(parseInt(t[a][e][i]))                    ? (init_data[a][e][i] = JSON.parse(t[a][e][i]))                    : (init_data[a][e][i] = t[a][e][i]));          else            init_data[a] = t[a].map(e => ({              ...e,            }));        else init_data[a] = [...t[a]];    } else init_data[a] = t[a];}function hasUpdates() {  var i = getIcubeData(),    e = getManualItems(),    t = getAllMeasurements();  if (0 === i.length && 0 === e.length) return !1;  if (    JSON.stringify(init_data.layoutMap) != JSON.stringify(layoutMap) ||    JSON.stringify(init_data.extraInfo) != JSON.stringify(extraInfo) ||    JSON.stringify(init_data.extraPrice) != JSON.stringify(extraPrice) ||    JSON.stringify(init_data.measurements) != JSON.stringify(t) ||    JSON.stringify(init_data.custom_values) != JSON.stringify(custom_values) ||    JSON.stringify(init_data.warehouse_dimensions) !=      JSON.stringify(WHDimensions) ||    JSON.stringify(init_data.itemMData) != JSON.stringify(e)  )    return !0;  {    let a = !0;    for (let t = 0; t < init_data.icubeData.length; t++)      if (i[t]) {        let e = [];        for (var n in init_data.icubeData[t])          Array.isArray(init_data.icubeData[t][n])            ? e.push(                JSON.stringify(init_data.icubeData[t][n]) !=                  JSON.stringify(i[t][n])              )            : e.push(init_data.icubeData[t][n] != i[t][n]);        var s = e.filter(e => !0 === e);        if (!(a = 0 < s.length)) break;      }    return a;  }}function documentNameOverlapCheck(t) {  Utils.request(    g_BasePath + "home/documentNameOverlapCheck",    "GET",    {},    e => {      t(e);    },    null  );}function getProjectList(t) {  Utils.request(    g_BasePath + "home/getProjectList",    "GET",    {},    e => {      t(e);    },    null  );}function getUserInfo(t = null) {  Utils.request(    g_BasePath + "home/getUserInfo",    "POST",    {      documentInfo: documentInfo,    },    e => {      (userName = e.name),        (userEmail = e.email),        (userPhone = e.phone),        (loginCount = e.login_count),        0 === parseInt(e.projects) && (loginCount = 1),        userRole !== g_UserRole.Demo && $("#emailP").val(userEmail),        isEditByAdmin || userRole !== g_UserRole.Sales || getUsersSA(),        t && t();    },    null  );}function SetUIUnits() {  currentUnits === Units.metric    ? ($("#metric").attr("checked", !0),      $("#usStand").attr("checked", !1),      $('select[name="metric"]').attr("disabled", !1),      $('select[name="usStand"]').attr("disabled", !0),      $(".unit-text2").text(" mm "))    : currentUnits === Units.usStand &&      ($("#metric").attr("checked", !1),      $("#usStand").attr("checked", !0),      $('select[name="metric"]').attr("disabled", !0),      $('select[name="usStand"]').attr("disabled", !1),      $(".unit-text2").text(" in ")),    $('select[name="metric"]').val(currentMetric),    $('select[name="usStand"]').val(currentUSStand);  for (let e = 0; e < palletTypeNameM.length; e++)    currentUnits === Units.metric      ? ($("#palletDistr_" + e)          .prev()          .text(palletTypeNameM[e]),        $("#palletDistrC_" + e)          .prev()          .text(palletTypeNameM[e]))      : ($("#palletDistr_" + e)          .prev()          .text(palletTypeNameU[e]),        $("#palletDistrC_" + e)          .prev()          .text(palletTypeNameU[e]));  for (let e = 0; e < palletTypeNameM.length; e++)    currentUnits === Units.metric      ? $(".palletSizeList li:nth-child(" + (e + 1) + ") > label").html(          palletTypeNameM[e]        )      : $(".palletSizeList li:nth-child(" + (e + 1) + ") > label").html(          palletTypeNameU[e]        );}function ChangeUnits() {  if (    ((rateUnit = 1),    (unitChar = UnitChars.meters),    currentUnits === Units.metric)  )    switch (currentMetric) {      case Metric.millimeters:        (rateUnit *= 1e3), (unitChar = UnitChars.millimeters);        break;      case Metric.centimeters:        (rateUnit *= 100), (unitChar = UnitChars.centimeters);        break;      case Metric.meters:        (rateUnit = +rateUnit), (unitChar = UnitChars.meters);    }  else if (currentUnits === Units.usStand)    switch (currentUSStand) {      case USStand.feet:        (rateUnit *= 3.28084), (unitChar = UnitChars.feet);        break;      case USStand.inches:        (rateUnit *= 39.3701), (unitChar = UnitChars.inches);    }  setUnitForInput(),    $(".unit-text").each(function (e) {      $(this).text(unitChar);    }),    updateIcubesDimensions();}function setUnitForInput() {  $("#input-wh-width").val(    (WHDimensions[0] * rateUnit).toFixed(      unitChar === UnitChars.millimeters ? 0 : 2    )  ),    $("#input-wh-length").val(      (WHDimensions[1] * rateUnit).toFixed(        unitChar === UnitChars.millimeters ? 0 : 2      )    ),    $("#input-wh-height").val(      (WHDimensions[2] * rateUnit).toFixed(        unitChar === UnitChars.millimeters ? 0 : 2      )    ),    $("#input-pallet-height").val(      (g_palletHeight * rateUnit).toFixed(        unitChar === UnitChars.millimeters ? 0 : 2      )    ),    $("#input-upRightDistance").val(      (g_distUpRight * rateUnit).toFixed(        unitChar === UnitChars.millimeters ? 0 : 3      )    ),    $("#spacing_b_rows")      .find("option")      .each(function () {        $(this).text(          ($(this).val() * rateUnit).toFixed(            unitChar === UnitChars.millimeters ? 0 : 2          )        );      }),    $("#palletOverhang, #loadPalletOverhang")      .find("option")      .each(function () {        currentUnits === Units.metric          ? ($(this).text(1e3 * $(this).val()), $(".unit-text2").text("mm"))          : ($(this).text((39.3701 * $(this).val()).toFixed(3)),            $(".unit-text2").text("in"));      }),    currentUnits === Units.metric      ? $("#palletSize > label").html(palletTypeNameM[g_palletInfo.order[0]])      : $("#palletSize > label").html(palletTypeNameU[g_palletInfo.order[0]]);}function formatIntNumber(e) {  return Math.round(e)    .toString()    .replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1.");}function checkForUnknownTable() {  if (userRole === g_UserRole.Sales) {    const t = document.getElementById("tablesHolder");    for (let e = t.childNodes.length - 1; 0 <= e; e -= 2)      if (1 < t.childNodes[e].childNodes.length) {        const a =          t.childNodes[e].childNodes[t.childNodes[e].childNodes.length - 2];        a.id &&          0 === icubes.filter(e => e.id === a.id).length &&          (t.removeChild(t.childNodes[e]), t.removeChild(t.childNodes[e - 2]));      }  }}function setPriceTable(t, a) {  if (!g_tutorialIsRunning && userRole === g_UserRole.Sales) {    checkForUnknownTable();    var i,      n,      s = {        racking: "Racking costs",        xtrack: "X-Track elements",        lift: "Vertical Transporters",        carrier: "3D-Carriers",        wifi: "System WiFi connectivity",        data_control: "Dat-A-Control WMS Software",        software_implementation: "Software implementation and deployment",        central_panel: "Central control panel",        extra_carrier: "Extra 3D-Carriers",        total_excluding:          "Total price estimation \n (excluding transport and installation)",      },      l = $("#priceDetails").is(":checked");    let e = "";    for (i in t)      (!l && "total_excluding" != i) ||        (e =          (e =            (e =              (e += "<tr>") +              "<td>" +              s[i] +              ("lift" == i && 0 < a.extra.lift                ? " (" + a.extra.lift + " added by customer)"                : "") +              "</td>") +            '<td class="text-right">' +            (-1 === t[i].qty ? " " : formatIntNumber(t[i].qty)) +            ("racking" === i ? " pallet positions" : "") +            "</td>") +          '<td class="text-right">' +          formatIntNumber(t[i].val) +          "</td></tr>");    document.getElementById(a.id)      ? (document.getElementById(a.id).innerHTML = e)      : ((n =          `      <div class="itemTable" style="margin-top:50px; padding: 10px; font-weight: bold;">` +          a.name +          `</div>      <table class="table itemTable table-responsive-lg table-bordered table-striped table-sm mb-0 mt-0">        <colgroup>          <col width="30%">          <col width="8%">          <col width="10%">        </colgroup>        <thead>          <tr>            <th>` +          (!1 === l ? "Item name" : "Automatic item name") +          `</th>            <th class="text-right">Quantity</th>            <th class="text-right">Price estimation</th>          </tr>        </thead>        <tbody id="` +          a.id +          '">' +          e +          `</tbody>      </table>`),        (document.getElementById("tablesHolder").innerHTML += n)),      (g_totalPrice = parseFloat(updateExtraPriceTable())),      (g_totalPrice +=        1e3 * parseFloat(document.getElementById("connectorPrice").innerHTML));    for (let e = 0; e < icubes.length; e++)      g_totalPrice += icubes[e].estimatedPrice;    $("#totalPrice").text("" + formatIntNumber(g_totalPrice));  }}function updateInventory() {  if (selectedIcube) {    let t = 0,      a =        (icubes.forEach(e => {          e = e.getPalletNoJS();          t = (t = (t += e[0]) + e[1]) + e[2];        }),        []),      i = [0, 0, 0, 0, 0];    for (let t = 0; t < selectedIcube.stores.length; t++)      for (let e = 0; e < selectedIcube.stores[t].dimension.length; e++) {        const n = _round(          selectedIcube.stores[t].dimension[e][1] -            selectedIcube.stores[t].dimension[e][0],          3        );        if (          (n < 5            ? i[0]++            : n < 10 && 5 <= n            ? i[1]++            : n < 25 && 10 <= n            ? i[2]++            : n < 50 && 25 <= n            ? i[3]++            : i[4]++,          0 === a.length)        )          a.push({            length: n,            pallets: selectedIcube.stores[t].capacity[e][g_palletInfo.max],            numbers: 1,          });        else {          const s = a.filter(e => e.length == n);          0 < s.length            ? (s[0].numbers += 1)            : a.push({                length: n,                pallets: selectedIcube.stores[t].capacity[e][g_palletInfo.max],                numbers: 1,              });        }      }    g_inventory = {      stores: JSON.stringify(a),      dimension: JSON.stringify(WHDimensions),      pallet_800: g_palletInfo.value[0],      pallet_1000: g_palletInfo.value[1],      pallet_1200: g_palletInfo.value[2],      levelHeight: g_palletHeight,      rackingLevels: g_rackingHighLevel,      SKU: g_SKU,      throughput: g_movesPerHour,      g_lift: selectedIcube.calculatedLiftsNo + selectedIcube.extra.lift,      g_carrier:        selectedIcube.calculatedCarriersNo + selectedIcube.extra.carrier,      g_port: selectedIcube.activedIOPorts.length,      g_capacity: t,      g_rail_5: i[0],      g_rail_5_10: i[1],      g_rail_10_25: i[2],      g_rail_25_50: i[3],      g_rail_50: i[4],      m_xtrack: manualItemInfo[0].meshData.length,      m_palletDropS: manualItemInfo[1].meshData.length,      m_palletDropSCS: manualItemInfo[9].meshData.length,      m_palletDropSCC: manualItemInfo[6].meshData.length,      m_chainC400: manualItemInfo[4].meshData.length,      m_chainC540: manualItemInfo[5].meshData.length,      m_rollerCC: manualItemInfo[8].meshData.length,      m_roller200: manualItemInfo[7].meshData.length,      m_sfence100: manualItemInfo[10].meshData.length,      m_sfence200: manualItemInfo[2].meshData.length,      m_sfenceDoor: manualItemInfo[11].meshData.length,      m_scanner: manualItemInfo[12].meshData.length,      m_stairs: manualItemInfo[13].meshData.length,      m_rail_5: 0,      m_rail_5_10: 0,      m_rail_10_25: 0,      m_rail_25_50: 0,      m_rail_50: 0,      m_others: 0,    };  }}function showLoadingPopUp(e) {  $("#loadingScene").fadeIn(1, e);}function hideLoadingPopUp() {  $("#loadingScene").fadeOut(100);}function checkPlacedXtracklift() {  let t = !0,    a,    i;  for (let e = 0; e < icubes.length; e++)    if (      ((a =        parseInt(icubes[e].calculatedXtracksNo) -        parseInt(icubes[e].activedXtrackIds.length)),      (i =        parseInt(icubes[e].calculatedLiftsNo) +        parseInt(icubes[e].extra.lift) -        parseInt(icubes[e].activedLiftInfos.length)),      0 !== a || 0 !== i)    ) {      t = !1;      break;    }  let e = "";  return (    t ||      (0 !== a && 0 !== i        ? (e +=            "You have not placed the required x-Track(s) and Vertical Transporters to the layout.<br>Are you sure you want to submit for pricing or would you like to first add the missing x-Track(s) and Vertical Transporters")        : 0 !== a        ? (e +=            "You have not placed the required x-Track(s) to the layout.<br>Are you sure you want to submit for pricing or would you like to first add the missing x-Track(s)")        : (e +=            "You have not placed the required Vertical Transporters to the layout.<br>Are you sure you want to submit for pricing or would you like to first add the missing Vertical Transporters")),    [t, e]  );}function _generateLabels(  i,  n = "",  s = !1,  l = Math.PI / 2,  o = 0,  r = 0,  c = 0) {  if (0 === i.length) return null;  const u = parseInt(Math.floor(Math.sqrt(i.length)) + 1),    d = new BABYLON.DynamicTexture(      "DynamicTexture",      {        width: 64 * u,        height: 32 * u,      },      scene    );  d.hasAlpha = s;  var m = [28, 26, 22, 2];  for (let a = 0; a < u; a++)    for (let t = 0; t < u; t++) {      let e = n + (a * u + t + 1);      i[a * u + t] && i[a * u + t][3] && (e = n + i[a * u + t][3]),        !0 === s          ? d.drawText(              e,              m[e.length] + 64 * t,              25 + 32 * (u - a - 1),              "normal 26px monospace",              "#ffffff",              null            )          : (d.drawText(              e,              m[e.length] + 64 * t - 3,              27 + 32 * (u - a - 1),              "bold 40px monospace",              "#adadad",              null            ),            d.drawText(              e,              m[e.length] + 64 * t - 0.5,              25.5 + 32 * (u - a - 1),              "normal 38px monospace",              "#ffffff",              null            ));    }  const e = new BABYLON.MeshBuilder.CreatePlane(      "TextPlane",      {        width: 1,        height: 1,        sideOrientation: 2,      },      scene    ),    t =      ((e.isPickable = !1),      new BABYLON.StandardMaterial("TextPlaneMaterial", scene)),    a =      ((t.emissiveTexture = d),      (t.emissiveTexture.hasAlpha = !0),      (t.opacityTexture = d),      (t.specularColor = BABYLON.Color3.Black()),      t.freeze(),      new BABYLON.SolidParticleSystem("SPSLabels", scene)),    h = (a.addShape(e, i.length), a.buildMesh());  return (    (h.material = t),    (e.position.y = s ? 0.1 : 0.05),    e.dispose(),    (a.initParticles = function () {      for (let e = 0; e < this.nbParticles; e++)        this.recycleParticle(this.particles[e]);    }),    (a.recycleParticle = function (e) {      var t = e.idx % u,        a = Math.floor(e.idx / u);      (e.position.x = i[e.idx][0]),        (e.position.y = i[e.idx][1] - c),        (e.position.z = i[e.idx][2]),        (e.rotation.x = l),        (e.rotation.z = o),        (e.rotation.y = r),        (e.uvs.x = (64 * t) / (64 * u)),        (e.uvs.y = (32 * a) / (32 * u)),        (e.uvs.z = (64 * (1 + t)) / (64 * u)),        (e.uvs.w = (32 * (a + 1)) / (32 * u));    }),    a.initParticles(),    a.setParticles(),    a.refreshVisibleSize(),    (a.computeParticleRotation = !1),    (a.computeParticleTexture = !1),    (a.computeParticleColor = !1),    (a.computeParticleVertex = !1),    a.mesh.freezeWorldMatrix(),    a.mesh.freezeNormals(),    a  );}function clickManualItem(e) {  scene.unfreezeActiveMeshes(),    tracking(35),    clearSceneItemManual(),    (selectedItemMesh = addNewItem(      manualItemInfo[parseInt(e)],      "Item-" + manualItemInfo[parseInt(e)].name    ));  var t = [    [      ITEMDIRECTION.right,      ITEMDIRECTION.bottom,      ITEMDIRECTION.bottom,      ITEMDIRECTION.bottom,      ITEMDIRECTION.top,      ITEMDIRECTION.bottom,      ITEMDIRECTION.left,      ITEMDIRECTION.left,      ITEMDIRECTION.left,      ITEMDIRECTION.bottom,      ITEMDIRECTION.bottom,      ITEMDIRECTION.bottom,      ITEMDIRECTION.bottom,      ITEMDIRECTION.bottom,    ],    [      ITEMDIRECTION.bottom,      ITEMDIRECTION.left,      ITEMDIRECTION.bottom,      ITEMDIRECTION.left,      ITEMDIRECTION.right,      ITEMDIRECTION.left,      ITEMDIRECTION.bottom,      ITEMDIRECTION.bottom,      ITEMDIRECTION.bottom,      ITEMDIRECTION.left,      ITEMDIRECTION.bottom,      ITEMDIRECTION.bottom,      ITEMDIRECTION.bottom,      ITEMDIRECTION.bottom,    ],  ];  if (e < 800) {    if (void 0 === t[0][parseInt(e)])      return void console.error("Set fixed direction first");    (selectedItemMesh.direction = t[0][parseInt(e)]),      selectedIcube &&        !selectedIcube.isHorizontal &&        (selectedItemMesh.direction = t[1][parseInt(e)]),      (selectedItemMesh.rotation.y =        (parseInt(selectedItemMesh.direction) * Math.PI) / 2);  }  if (    (((currentMesh = selectedItemMesh).position = new BABYLON.Vector3(      -g_WarehouseMaxWidth,      0,      -g_WarehouseMaxLength    )),    (startingPoint = null),    !currentMesh.ruler)  ) {    (currentMesh.ruler = new RulerMItems(currentMesh, scene)),      (currentMesh.ruler.buttons[0].isClicked = !0);    for (let e = 0; e < currentMesh.ruler.buttons.length; e++)      currentMesh.ruler.buttons[e].isPointerBlocker = !1;    matManager.matHighLight.hasMesh(currentMesh) ||      Utils.addMatHighLight(currentMesh),      setTimeout(() => {        if (currentMesh && currentMesh.ruler)          for (let e = 0; e < currentMesh.ruler.buttons.length; e++)            currentMesh.ruler.buttons[e].isPointerBlocker = !0;      }, 150);  }}function addNewItem(a, e) {  let i = a.originMesh.clone(e);  if (    (i.setEnabled(!0),    [ITEMTYPE.Manual.ContourScanner, ITEMTYPE.Manual.ExteriorStairs].includes(      a.type    ))  ) {    let t = g_palletHeight;    (t =      1 <= g_palletHeight        ? g_palletHeight - 0.26 * (g_palletHeight - 1)        : g_palletHeight + 0.26 * (1 - g_palletHeight)),      (i.scaling.y = t);    e = i.material;    if (      selectedIcube &&      2 < g_rackingHighLevel &&      a.type === ITEMTYPE.Manual.ExteriorStairs    ) {      for (let e = 1; e < g_rackingHighLevel - 1; e++) {        const n = a.originMesh.clone(a.originMesh);        (n.scaling.y = t),          (n.position.y = (g_palletHeight + g_railHeight) * e),          (i = BABYLON.Mesh.MergeMeshes([i, n], !0, !0, null, !0, !0));      }      i.material = e;    }  }  return (    1e3 <= parseInt(a.type) &&      a.hasOwnProperty("atDist") &&      (i.atDist = a.atDist),    a.type === ITEMTYPE.Manual.RailOutside &&      ((a.atDist = 0), (i.atDist = a.atDist)),    (i.name = a.name),    (i.type = a.type),    (i.width = a.width),    (i.height = a.height),    (i.length = a.length),    (i.multiply = a.multiply),    (i.direction = a.direction),    (i.isPickable = !0),    (i.actionManager = new BABYLON.ActionManager(scene)),    (i.actionManager.hoverCursor = "pointer"),    i.actionManager.registerAction(      new BABYLON.ExecuteCodeAction(        BABYLON.ActionManager.OnPointerOverTrigger,        () => {}      )    ),    i.actionManager.registerAction(      new BABYLON.ExecuteCodeAction(        BABYLON.ActionManager.OnLeftPickTrigger,        e => {          (startingPoint = null),            currentMesh &&              (currentMesh.ruler &&                (currentMesh.ruler.multiplyPanel &&                currentMesh.ruler.multiplyPanel.isVisible                  ? onOkNumMultiply(currentMesh.prevDirection)                  : (currentMesh.ruler.dispose(), delete currentMesh.ruler),                isCtrlPressed && itemsGroup.push(currentMesh)),              currentMesh &&                matManager.matHighLight.hasMesh(currentMesh) &&                !isCtrlPressed &&                (Utils.removeMatHighLight(currentMesh), removeItemsGroup())),            (currentMesh = e.meshUnderPointer).ruler ||              (currentMesh.ruler = new RulerMItems(i, scene)),            matManager.matHighLight.hasMesh(currentMesh) ||              Utils.addMatHighLight(currentMesh),            setTimeout(() => {              if (currentMesh && currentMesh.ruler)                for (let e = 0; e < currentMesh.ruler.buttons.length; e++)                  currentMesh.ruler.buttons[e].isPointerBlocker = !0;            }, 150),            selectedItemMesh &&              (manualItemInfo[parseInt(selectedItemMesh.type)].meshData.push(                selectedItemMesh              ),              Behavior.add(Behavior.type.addItem),              (selectedItemMesh = void 0));        }      )    ),    i  );}function removeItemsGroup(t = !1) {  0 < itemsGroup.length &&    itemsGroup.forEach(e => {      Utils.removeMatHighLight(e), t && (removeItemData(e), e.dispose());    }),    (itemsGroup = []);}function unsetCurrentMesh(e = !1) {  currentMesh &&    (Utils.removeMatHighLight(currentMesh),    removeItemsGroup(),    currentMesh.ruler &&      (currentMesh.ruler.dispose(), delete currentMesh.ruler),    e && (removeItemData(currentMesh), currentMesh.dispose()),    (currentMesh = null));}function clearSceneItemManual() {  selectedItemMesh && (selectedItemMesh.dispose(), (selectedItemMesh = null)),    currentMesh &&      (currentMesh &&      currentMesh.ruler &&      currentMesh.ruler.multiplyPanel &&      currentMesh.ruler.multiplyPanel.isVisible        ? onOkNumMultiply(currentMesh.prevDirection)        : unsetCurrentMesh(!1));}function saveTutorial(e) {  Utils.request(g_BasePath + "home/tutorial/" + e, "POST", {}, null, null);}function getUsersSA() {  Utils.request(    g_BasePath + "home/getUsersSA",    "GET",    {},    e => {      createUsersSAhtml(e);    },    null  );}function createUsersSAhtml(n) {  $("#createdAccounts").html("");  for (let i = 0; i < n.length; i++) {    const a = document.createElement("div"),      s =        ((a.style.marginBottom = "5px"),        a.classList.add("col-sm-12"),        document.createElement("div")),      l =        (s.classList.add("col-sm-9", "padding-no"),        (s.style.fontWeight = "bold"),        (s.innerHTML = n[i].email),        a.appendChild(s),        document.createElement("div"));    l.classList.add("col-sm-3", "padding-no"),      (l.style.textAlign = "right"),      a.appendChild(l);    var e = createUsersSAbut("New project", "fa-plus", () => {      confirm("是否要将当前布局另存为用户的新项目 " + n[i].name + "?") &&        ((documentInfo = n[i].id),        saveProject(() => {          (documentInfo = ""),            setProject(Template.values[Template.type.Default], !1),            setTimeout(() => {              getUsersSA();            }, 1e3);        }));    });    l.appendChild(e),      0 < n[i].projects.length &&        ((e = createUsersSAbut("Projects list", "fa-bars", () => {          const e = document.getElementById("slv_" + i);          "none" === e.style.display            ? (e.style.display = "block")            : (e.style.display = "none");        })),        l.appendChild(e)),      $("#createdAccounts").append(a);    const o = document.createElement("div");    $(o).attr("id", "slv_" + i), (o.style.display = "none");    for (let a = 0; a < n[i].projects.length; a++) {      const u = document.createElement("div"),        d =          (u.classList.add("col-lg-12"),          o.appendChild(u),          document.createElement("div")),        m =          (d.classList.add("col-sm-6", "padding-no"),          (d.innerHTML = a + 1 + ". " + n[i].projects[a].document_name),          $(d).attr("title", n[i].projects[a].saved_time),          u.appendChild(d),          document.createElement("div"));      m.classList.add("col-sm-6", "padding-no"),        (m.style.textAlign = "right"),        u.appendChild(m);      var t = createUsersSAbut("Rename", "fa-pencil", () => {          var e = n[i].projects[a].document_name,            t = prompt(              "Please enter project name:",              n[i].projects[a].document_name            );          null != t &&            "" != t &&            (documentName == e && (documentName = t),            renameProject(t, n[i].projects[a].id),            setTimeout(() => {              getUsersSA();            }, 1e3));        }),        t =          (m.appendChild(t),          createUsersSAbut("Delete", "fa-times", () => {            confirm("是否要删除此布局?") &&              (deleteProject(n[i].projects[a].document_name, n[i].id),              setProject(Template.values[Template.type.Default], !1),              setTimeout(() => {                getUsersSA();              }, 1e3));          })),        t =          (m.appendChild(t),          createUsersSAbut("Edit", "fa-edit", () => {            confirm("是否要查看/编辑此布局?") &&              loadProject(n[i].projects[a].document_name, n[i].id);          })),        t =          (m.appendChild(t),          createUsersSAbut("Overwrite", "fa-exchange", () => {            if (confirm("是否用当前布局覆盖此布局?")) {              documentInfo = n[i].id;              const e = documentName;              (documentName = n[i].projects[a].document_name),                saveProject(() => {                  (documentInfo = ""),                    (documentName = e),                    setProject(Template.values[Template.type.Default], !1),                    setTimeout(() => {                      getUsersSA();                    }, 1e3);                });            }          })),        t =          (m.appendChild(t),          createUsersSAbut("Notify", "fa-envelope", () => {            confirm("是否要发送电子邮件通知?") &&              sendProjectNotify(n[i].projects[a].document_name, n[i].email);          }));      m.appendChild(t);    }    $("#createdAccounts").append(o);    const r = document.createElement("div"),      c = (r.classList.add("col-lg-12"), document.createElement("hr"));    c.classList.add("short"), r.appendChild(c), $("#createdAccounts").append(r);  }}function createUsersSAbut(e, t, a) {  const i = document.createElement("div");  return (    i.classList.add("fa", t, "fa_icon2"),    $(i).attr("title", e),    i.addEventListener("click", a, !1),    i  );}function prepareTexture() {  if (layoutMap && layoutMap.hasOwnProperty("url"))    if ("" !== layoutMap.url) {      const e = new BABYLON.Texture(layoutMap.url, scene);      (e.uScale = layoutMap.scale),        (e.vScale = layoutMap.scale),        (e.uOffset = layoutMap.uOffset),        (e.vOffset = layoutMap.vOffset),        (e.wrapU = 0),        (e.wrapV = 0),        (warehouse.floor.material.albedoTexture = e),        $("#layoutScale").val(          parseFloat((100 * (2 - layoutMap.scale)).toFixed(2))        );    } else      warehouse.floor.material.albedoTexture &&        (warehouse.floor.material.albedoTexture.dispose(),        (warehouse.floor.material.albedoTexture = null));  else    warehouse.floor.material.albedoTexture &&      (warehouse.floor.material.albedoTexture.dispose(),      (warehouse.floor.material.albedoTexture = null));  renderScene();}function createPassThList() {  if (($("#passthroughList").html(""), selectedIcube))    for (let e = 0; e < selectedIcube.activedPassthrough.length; e++) {      const a = document.createElement("div"),        i =          ((a.style.display = "inline-flex"),          a.classList.add("col-lg-12"),          $(a).attr("id", "pass" + e),          document.createElement("div"));      i.classList.add("col-lg-12"),        (i.style.overflow = "hidden"),        (i.innerHTML = "Passthrough" + (e + 1)),        a.appendChild(i);      var t = createUsersSAbut("Edit", "fa-edit", () => {          $("#set-icube-passthrough")            .addClass("active-icube-setting")            .text("确认放置"),            selectedIcube.property.passthrough.selectors.forEach(e => {              e.dispose();            }),            (selectedIcube.property.passthrough.selectors = []),            selectedIcube.showSelectors(0, e),            selectedIcube.showSelectors(1, e),            selectedIcube.showSelectors(2, e);        }),        t =          (a.appendChild(t),          createUsersSAbut("Delete", "fa-times", () => {            selectedIcube.activedPassthrough.splice(e, 1),              selectedIcube.updateRacking(),              Behavior.add(Behavior.type.addPassthrough),              createPassThList(),              renderScene();          }));      a.appendChild(t);      const n = document.createElement("hr");      n.classList.add("short"),        a.appendChild(n),        $("#passthroughList").append(a);    }}function optimizeDistrCalculation(e, t) {  let a = 0;  for (let e = 0; e < t.length; e++) a += t[e];  var i,    n = 100 < a || a < 100 ? a - 100 : 0;  if (0 != n)    switch (parseInt(e)) {      case 0:        0 !== t[1] && 0 !== t[2]          ? n < 0            ? (t[1] += Math.abs(n))            : t[1] >= n            ? (t[1] -= n)            : ((i = n - t[1]), (t[1] = 0), (t[2] -= i))          : 0 !== t[1]          ? (t[1] = t[1] + (0 < n ? -1 : 1) * Math.abs(n))          : 0 !== t[2]          ? (t[2] = t[2] + (0 < n ? -1 : 1) * Math.abs(n))          : (t[1] = Math.abs(n));        break;      case 1:        0 !== t[0] && 0 !== t[2]          ? n < 0            ? (t[0] += Math.abs(n))            : t[0] >= n            ? (t[0] -= n)            : ((i = n - t[0]), (t[0] = 0), (t[2] -= i))          : 0 !== t[0]          ? (t[0] = t[0] + (0 < n ? -1 : 1) * Math.abs(n))          : 0 !== t[2]          ? (t[2] = t[2] + (0 < n ? -1 : 1) * Math.abs(n))          : (t[0] = Math.abs(n));        break;      case 2:        0 !== t[0] && 0 !== t[1]          ? n < 0            ? (t[0] += Math.abs(n))            : t[0] >= n            ? (t[0] -= n)            : ((i = n - t[0]), (t[0] = 0), (t[1] -= i))          : 0 !== t[0]          ? (t[0] = t[0] + (0 < n ? -1 : 1) * Math.abs(n))          : 0 !== t[1]          ? (t[1] = t[1] + (0 < n ? -1 : 1) * Math.abs(n))          : (t[0] = Math.abs(n));    }  return t;}function updateInputPallet(e, t) {  var a,    i,    n = $("#palletL_" + e + "_" + t).val(),    s = $("#palletL_" + (1 - e) + "_" + t).val();  let l = -1;  for (let e = 0; e < g_palletAtLevel.length; e++)    if (g_palletAtLevel[e].idx === t) {      l = e;      break;    }  0 === e    ? ((a = parseFloat(n)),      (i = parseFloat(        (          WHDimensions[2] -          g_bottomLength -          g_railHeight -          (g_rackingHighLevel - 1) * parseFloat(g_palletHeight + g_railHeight)        ).toFixed(2)      )) < a && $("#palletL_" + e + "_" + t).val(i),      -1 !== l        ? n === g_palletHeight && s === g_palletWeight          ? g_palletAtLevel.splice(l, 1)          : (g_palletAtLevel[l].height = n)        : g_palletAtLevel.push({            idx: t,            height: n,            weight: s,          }),      updateRackingAtLevel(),      Behavior.add(Behavior.type.palletHeight))    : (-1 !== l        ? n === g_palletWeight && s === g_palletHeight          ? g_palletAtLevel.splice(l, 1)          : (g_palletAtLevel[l].weight = n)        : g_palletAtLevel.push({            idx: t,            height: s,            weight: n,          }),      updateRackingAtLevel(!1),      Behavior.add(Behavior.type.palletWeight));}function updateRackingAtLevel(e = !0) {  e    ? (updateRackingHighLevel(), updateSelectedIcube())    : selectedIcube && (selectedIcube.palletAtLevel = g_palletAtLevel);}function updateExtraPriceTable() {  let a = 0;  return (    $("#extraPriceHolder").html(""),    Array.isArray(extraPrice) &&      0 < extraPrice.length &&      ($("#extraPriceTable")[0] ||        (document.getElementById(          "extraPriceHolder"        ).innerHTML = `<table id="extraPriceTable" class="table itemTable table-responsive-lg table-bordered table-striped table-sm mb-0" style="margin-top: 10px;">        <colgroup>          <col width="30%">          <col width="8%">          <col width="10%">          <col width="1%">        </colgroup>        <tbody></tbody>      </table>`),      extraPrice.forEach((e, t) => {        a += parseFloat(e.quantity) * parseFloat(e.value);        e =          '<tr id="extraP_' +          t +          `">        <td class="epName">` +          e.name +          `</td>        <td class="epQuantity" style="text-align:right">` +          formatIntNumber(e.quantity) +          `</td>        <td class="epValue" style="text-align:right">` +          formatIntNumber(e.value) +          `</td>        <td style="text-align:right"><i class="fa fa-trash" title="Delete custom row" onclick="deleteExtraPrice(` +          t +          `)"></i></td>      </tr>`;        $("#extraPriceTable tbody").append(e);      })),    a  );}function saveExtraPrice(e) {  var t = $("#extraP_" + e + " > td > .epName")[0].value,    a = $("#extraP_" + e + " > td > .epQuantity")[0].value,    e = $("#extraP_" + e + " > td > .epValue")[0].value;  extraPrice.push({    name: t,    quantity: a,    value: e,  }),    tracking(42),    saveProject(() => {      null !== selectedIcube && selectedIcube.getEstimationPrice();    });}function deleteExtraPrice(e) {  extraPrice.splice(e, 1),    tracking(43),    saveProject(() => {      null !== selectedIcube && selectedIcube.getEstimationPrice();    });}function createFakeManualItem(e) {  const t = {    display: e.name,    name: e.name,    type: e.type,    direction: ITEMDIRECTION.bottom,    multiply: e.length + 0.2,    width: e.width,    length: e.length,    height: e.height,    meshData: [],    originMesh: null,    colors: e.colors,    atDist: e.atDist,  };  let a = new Array(6);  for (let e = 0; e < 6; e++) a[e] = new BABYLON.Vector4(0, 0, 0, 0);  a[4] = new BABYLON.Vector4(0, 0, 1, 1);  const i = BABYLON.MeshBuilder.CreateBox(    t.display,    {      height: 1,      width: 1,      depth: 1,      faceUV: a,    },    scene  );  (i.position.y = 0.5),    i.bakeCurrentTransformIntoVertices(),    i.setEnabled(!1),    (i.isPickable = !1),    (i.scaling = new BABYLON.Vector3(t.width, t.height, t.length)),    i.freezeWorldMatrix();  var n = 120 * t.width,    s = 120 * t.length;  const l = new BABYLON.DynamicTexture(      "dynamic texture",      {        width: s,        height: n,      },      scene,      !1    ),    o = l.getContext();  o.font = "12px Arial";  var r = o.measureText(t.display).width,    r = r / 12;  let c = Math.floor(Math.min(n, s) / r);  c = c < 100 ? c : c / 2;  n = parseInt(c) + "px Arial";  l.drawText(t.display, null, null, n, "white", t.colors);  const u = new BABYLON.PBRMaterial("placeholderM", scene);  (u.albedoTexture = l),    (u.alpha = 0.5),    (u.roughness = 1),    u.freeze(),    (i.material = u),    (t.originMesh = i),    (manualItemInfo[e.type] = t);}function addTitleToPage(e, t) {  custompPdf[t].title = $(e).val();}function addScreenToPage(t, a) {  scene.render(),    BABYLON.Tools.CreateScreenshot(      scene.getEngine(),      scene.activeCamera,      {        width: 1440,        height: 870,      },      function (e) {        (custompPdf[a].image = e),          renderScene(),          $(t).html('Add image <i class="el fa fa-check"></i>');      }    );}function removeFromPage(e) {  custompPdf.splice(e, 1), $("#pdfPages").html("");  for (let e = 0; e < custompPdf.length; e++) {    var t =      `      <div class="form-group mb10" style="text-align:center;">        <label class="col-sm-1 control-label padding-no labelpad">` +      parseInt(e + 1) +      `</label>        <input class="col-sm-5 form-control" style="width:41%;" type="text" placeholder="Title" onchange="addTitleToPage(this, ` +      e +      ')" value="' +      custompPdf[e].title +      `">        <button class="icube-tool btn btn-primary col-sm-5" onclick="addScreenToPage(this, ` +      e +      ')">Add image ' +      ("" !== custompPdf[e].image ? '<i class="el fa fa-check"></i>' : "") +      `</button>        <label class="col-sm-1 control-label padding-no labelpad" style="text-align:center;cursor:pointer;" onclick=removeFromPage(` +      e +      `)><i class="el fa fa-trash" href="#"></i></label>      </div>`;    $("#pdfPages").append(t);  }}function getRevisions(e, n = -1) {  Utils.request(    g_BasePath + "home/getRevisions",    "POST",    e,    i => {      if (((revisions = i), $("#revisions_list").html(""), 0 < i.length))        for (let a = 0; a < i.length; a++) {          let e = "",            t = "";          -1 !== n            ? a === n && (t = "btn-primary")            : a === i.length - 1 && (t = "btn-primary"),            (e =              a === i.length - 1                ? `            <div class="price_rev ` +                  t +                  `" style="display:inline-flex;">                                 <span onclick="loadVersion(` +                  a +                  ')" title="' +                  i[a].saved_time +                  '" style="overflow:hidden;min-width:150px;">' +                  documentName +                  ` - Latest</span>                               </div>`                : `            <div class="price_rev ` +                  t +                  `" style="display:inline-flex;">              <i class="fa fa-pencil" onclick="editRevisionName(this)" title="Rename" style="line-height:24px;"></i>                              <span onclick="loadVersion(` +                  a +                  ')" title="' +                  i[a].saved_time +                  '" style="overflow:hidden;min-width:150px;">' +                  i[a].name +                  `</span>              <input class="price_rev_input hide" value="` +                  i[a].name +                  '" onchange="updateVersionName(this, ' +                  a +                  `)" onfocusout="cancelRevisionEdit(this)" />                              <i class="fa fa-times" onclick="deleteVersion(` +                  a +                  `)" title="Delete" style="line-height:24px;"></i>            </div>`),            $("#revisions_list").append(e);        }      else        $("#revisions_list").append(          '<div style="padding: 5px;">No previous versions</div>'        );    },    null  );}function updateVersionName(e, t) {  cancelRevisionEdit(e),    $(e).prev().html($(e).val()),    Utils.request(g_BasePath + "home/renameVersion", "POST", {      saved_time: revisions[t].saved_time,      name: $(e).val(),    });}function deleteVersion(e) {  $("#revisions_list").children().eq(e).remove(),    Utils.request(      g_BasePath + "home/deleteVersion",      "POST",      {        saved_time: revisions[e].saved_time,      },      () => {        var e = {          document_name: documentName,        };        0 < documentInfo &&          Object.assign({}, e, {            slid: documentInfo,          }),          loadVersion(revisions.length - 2);      }    );}function loadVersion(e) {  var t = JSON.parse(revisions[e].documentData);  let a = JSON.parse(revisions[e].icubeData);  (a = a && Array.isArray(a) ? a : []).forEach(e => {    for (key in e)      ["name", "uid"].includes(key) || (e[key] = JSON.parse(e[key]));  }),    setProject(      {        extraInfo: JSON.parse(t.extraInfo),        extraPrice: JSON.parse(t.extraPrice),        measurements: JSON.parse(t.measurements),        custom_values: JSON.parse(t.custom_values),        documentInfo: isEditByAdmin ? documentInfo : "",        document_name: revisions[e].document_name,        itemMData: JSON.parse(t.itemMData),        layoutMap: JSON.parse(t.layoutMap),        unit_measurement: JSON.parse(t.unit_measurement),        warehouse_dimensions: JSON.parse(t.warehouse_dimensions),        icubeData: a,      },      !0,      e    ),    e < revisions.length - 1 &&      $("#project-name").html(        revisions[e].hasOwnProperty("name") ? revisions[e].name : documentName      );}function editRevisionName(e) {  $(e).next().addClass("hide"), $(e).next().next().removeClass("hide").focus();}function cancelRevisionEdit(e) {  $(e).addClass("hide"), $(e).prev().removeClass("hide");}function updateConfigVariables() {  var e = g_palletInfo.max;  custom_values.filter(e => -1 === e).length === custom_values.length &&    (custom_values = []),    resetConfigVariables(),    custom_values[0] &&      800 < custom_values[0] &&      custom_values[0] < 1400 &&      (g_PalletW[e] = useP(custom_values[0], !1)),    custom_values[1] &&      1e3 < custom_values[1] &&      custom_values[1] < 1400 &&      (g_PalletH[e] = useP(custom_values[1], !1)),    custom_values[2] &&      0 <= custom_values[2] &&      custom_values[2] <= 200 &&      (g_palletOverhang = parseFloat((custom_values[2] / 1e3).toFixed(4))),    custom_values[3] &&      0 <= custom_values[3] &&      custom_values[3] <= 1e3 &&      (g_railHeight = useP(custom_values[3], !1)),    custom_values[4] &&      0 <= custom_values[4] &&      custom_values[4] <= 500 &&      (g_difftoXtrack[e] = useP(custom_values[4], !1)),    custom_values[5] &&      0 <= custom_values[5] &&      custom_values[5] <= 500 &&      ((g_diffToEnd[e] = useP(custom_values[5], !1)),      (g_railOutside = g_diffToEnd[e])),    custom_values[6] &&      0 <= custom_values[6] &&      custom_values[6] <= 500 &&      (g_bottomLength = useP(custom_values[6], !1)),    custom_values[7] &&      0 <= custom_values[7] &&      custom_values[7] <= 500 &&      (g_StoreTopGap = useP(custom_values[7], !1)),    (g_palletInfo.type = g_palletInfo.value),    updateSelectedIcube();}function resetConfigVariables() {  (g_PalletW = [0.8, 1, 1.2]),    (g_PalletH = [1.2, 1.2, 1.2]),    (g_palletOverhang = 0.05),    (g_difftoXtrack = [0.15, 0.05, 0.05]),    (g_diffToEnd = [0.175, 0.175, 0.175]),    (g_railOutside = 0.175),    (g_railHeight = 0.38),    (g_bottomLength = 0.27),    (g_StoreTopGap = 0),    (g_palletInfo.type = g_palletInfo.value);}htmlElemAttr.forEach(e => {  $("#set-icube-" + e).on("click", function () {    clickOn(e, this);  });}),  $(".a-tabs").on("click", function () {    updateDrawButtonState(),      htmlElemAttr.forEach(e => {        finishToSet(e);      }),      clearSceneItemManual(),      endSimulation(),      unsetCurrentMesh();    const e = $(this).attr("aria-controls");    tracking(56 + parseInt(menuTab.indexOf(e.split("-")[3]))),      "#main-tabs-pane-Price" === e &&        (updateConnectorsPrice(),        userRole === g_UserRole.Sales &&          g_priceChanged !== g_priceUpdated &&          $("#waiting").show()),      "#main-tabs-pane-Export" === e &&        icubes.forEach(e => {          e.software.update();        }),      "#main-tabs-pane-Simulation" === e &&        selectedIcube &&        (selectedIcube.activedIOPorts.filter(          e =>            e.portPosition === (selectedIcube.isHorizontal ? "bottom" : "left")        ).length === selectedIcube.activedIOPorts.length          ? $('select[name="simLiftA"]').val(1)          : $('select[name="simLiftA"]').val(0)),      "#main-tabs-pane-Contact" === e &&        ($("#con_fullName").val(userName), $("#con_email").val(userEmail)),      $(".a-tabs").parent().removeClass("active"),      $(".a-tabs").attr("aria-selected", !1).attr("tabindex", -1),      $(e).hasClass("show")        ? ($(".tab-pane").removeClass("show"), $(e).parent().addClass("hide"))        : ($(this).parent().addClass("active"),          $(this).attr("aria-selected", !0).removeAttr("tabindex"),          $(".tab-pane").removeClass("show"),          $(e).parent().removeClass("hide"),          $(e).addClass("show")),      resizeRenderer();  }),  $(".input-spinner").on("change", function (t) {    if (menuEnabled) {      let e = parseFloat(t.target.value);      switch ($(this).parent().attr("controller")) {        case "width":          isNaN(parseFloat(e))            ? (e = WHDimensions[0])            : (e = useP(e) / useP(rateUnit)) < g_WarehouseMinWidth            ? (e = g_WarehouseMinWidth)            : e > g_WarehouseMaxWidth && (e = g_WarehouseMaxWidth),            (WHDimensions[0] = _round(e, 2)),            warehouse.update(WHDimensions),            selectedIcube && selectedIcube.addRowLabels(),            tracking(55),            Behavior.add(Behavior.type.WHDimensions);          break;        case "length":          isNaN(parseFloat(e))            ? (e = WHDimensions[1])            : (e =                (e = useP(e) / useP(rateUnit)) < g_WarehouseMinLength                  ? g_WarehouseMinLength                  : e) > g_WarehouseMaxLength && (e = g_WarehouseMaxLength),            (WHDimensions[1] = _round(e, 2)),            warehouse.update(WHDimensions),            selectedIcube && selectedIcube.addRowLabels(),            tracking(54),            Behavior.add(Behavior.type.WHDimensions);          break;        case "height":          isNaN(parseFloat(e))            ? (e = WHDimensions[2])            : (e =                (e = useP(e) / useP(rateUnit)) < g_WarehouseMinHeight                  ? g_WarehouseMinHeight                  : e) > g_WarehouseMaxHeight && (e = g_WarehouseMaxHeight),            (WHDimensions[2] = _round(e, 2)),            warehouse.update(WHDimensions),            updateRackingHighLevel(),            updateSelectedIcube(),            tracking(53),            Behavior.add(Behavior.type.WHDimensions);          break;        case "pallet-height":          isNaN(parseFloat(e))            ? (e = g_palletHeight)            : (e =                (e = useP(e) / useP(rateUnit)) < g_PalletMinHeight                  ? g_PalletMinHeight                  : e) > g_PalletMaxHeight && (e = g_PalletMaxHeight),            (g_palletHeight = useP(useP(e), !1)),            tracking(52),            updateRackingHighLevel(),            0 < g_palletHeight && g_palletHeight <= 1.2              ? simulateEvent("palletOverhang", "change", 0.05)              : 1.2 < g_palletHeight && g_palletHeight <= 1.8              ? simulateEvent("palletOverhang", "change", 0.075)              : simulateEvent("palletOverhang", "change", 0.1);          break;        case "pallet-weight":          isNaN(parseFloat(e)) && (e = g_palletHeight),            (g_palletWeight = useP(useP(e), !1)),            selectedIcube && (selectedIcube.palletWeight = g_palletWeight),            tracking(51),            Behavior.add(Behavior.type.palletWeight);          break;        case "layoutScale":          0 < e &&            e < 200 &&            ((layoutMap.scale = parseFloat(              (2 - parseFloat(e / 100)).toFixed(2)            )),            warehouse.update(WHDimensions));      }      setUnitForInput();    }  }),  $(".spinner-up").on("click", function () {    if (menuEnabled) {      switch ($(this).parent().parent().attr("controller")) {        case "width":          WHDimensions[0] < g_WarehouseMaxWidth &&            ((WHDimensions[0] += g_WarehouseIncValue),            warehouse.update(WHDimensions),            selectedIcube && selectedIcube.addRowLabels(),            tracking(55),            Behavior.add(Behavior.type.WHDimensions));          break;        case "length":          WHDimensions[1] < g_WarehouseMaxLength &&            ((WHDimensions[1] += g_WarehouseIncValue),            warehouse.update(WHDimensions),            selectedIcube && selectedIcube.addRowLabels(),            tracking(54),            Behavior.add(Behavior.type.WHDimensions));          break;        case "height":          WHDimensions[2] < g_WarehouseMaxHeight &&            ((WHDimensions[2] += g_WarehouseIncValue),            warehouse.update(WHDimensions),            updateRackingHighLevel(),            updateSelectedIcube(),            tracking(53),            Behavior.add(Behavior.type.WHDimensions));          break;        case "pallet-height":          g_palletHeight < g_PalletMaxHeight &&            ((g_palletHeight += g_PalletIncValue),            tracking(52),            updateRackingHighLevel(),            0 < g_palletHeight && g_palletHeight <= 1.2              ? simulateEvent("palletOverhang", "change", 0.05)              : 1.2 < g_palletHeight && g_palletHeight <= 1.8              ? simulateEvent("palletOverhang", "change", 0.075)              : simulateEvent("palletOverhang", "change", 0.1));          break;        case "pallet-weight":          g_palletWeight < g_PalletMaxWeight &&            ((g_palletWeight =              parseFloat($("#input-pallet-weight").val()) + 100),            $("#input-pallet-weight").val(g_palletWeight),            selectedIcube && (selectedIcube.palletWeight = g_palletWeight),            tracking(51),            Behavior.add(Behavior.type.palletWeight));          break;        case "layoutScale":          if (layoutMap && 0 < layoutMap.scale) {            let e = parseFloat($("#layoutScale").val());            (e += 0.1),              $("#layoutScale").val(parseFloat(e.toFixed(2))),              (layoutMap.scale = 2 - parseFloat(e / 100)),              warehouse.update(WHDimensions);          }      }      setUnitForInput();    }  }),  $(".spinner-down").on("click", function () {    if (menuEnabled) {      switch ($(this).parent().parent().attr("controller")) {        case "width":          WHDimensions[0] > g_WarehouseMinWidth &&            ((WHDimensions[0] -= g_WarehouseIncValue),            $("#input-wh-width").val(WHDimensions[0]),            warehouse.update(WHDimensions),            selectedIcube && selectedIcube.addRowLabels(),            tracking(55),            Behavior.add(Behavior.type.WHDimensions));          break;        case "length":          WHDimensions[1] > g_WarehouseMinLength &&            ((WHDimensions[1] -= g_WarehouseIncValue),            $("#input-wh-length").val(WHDimensions[1]),            warehouse.update(WHDimensions),            selectedIcube && selectedIcube.addRowLabels(),            tracking(54),            Behavior.add(Behavior.type.WHDimensions));          break;        case "height":          WHDimensions[2] > g_WarehouseMinHeight &&            ((WHDimensions[2] -= g_WarehouseIncValue),            $("#input-wh-height").val(WHDimensions[2]),            warehouse.update(WHDimensions),            updateRackingHighLevel(),            updateSelectedIcube(),            tracking(53),            Behavior.add(Behavior.type.WHDimensions));          break;        case "pallet-height":          g_palletHeight > g_PalletMinHeight &&            ((g_palletHeight -= g_PalletIncValue),            tracking(52),            updateRackingHighLevel(),            0 < g_palletHeight && g_palletHeight <= 1.2              ? simulateEvent("palletOverhang", "change", 0.05)              : 1.2 < g_palletHeight && g_palletHeight <= 1.8              ? simulateEvent("palletOverhang", "change", 0.075)              : simulateEvent("palletOverhang", "change", 0.1));          break;        case "pallet-weight":          g_palletWeight > g_PalletMinWeight &&            ((g_palletWeight =              parseFloat($("#input-pallet-weight").val()) - 100),            $("#input-pallet-weight").val(g_palletWeight),            selectedIcube && (selectedIcube.palletWeight = g_palletWeight),            tracking(51),            Behavior.add(Behavior.type.palletWeight));          break;        case "layoutScale":          if (layoutMap && layoutMap.scale < 2) {            let e = parseFloat($("#layoutScale").val());            (e -= 0.1),              $("#layoutScale").val(parseFloat(e.toFixed(2))),              (layoutMap.scale = 2 - parseFloat(e / 100)),              warehouse.update(WHDimensions);          }      }      setUnitForInput();    }  }),  $("#draw-baseline").on("click", function () {    (g_drawMode = 0),      $(this).hasClass("active-icube-setting")        ? updateDrawButtonState()        : ($("#draw-baseline").addClass("active-icube-setting"),          $("#draw-baseline").text("确认图纸"),          currentView !== ViewType.top && switch_to_top_camera(),          tracking(30),          (g_sceneMode = sceneMode.draw));  }),  $("#draw-auto").on("click", function () {    (g_drawMode = 1), updateDrawButtonState();    var e = getManualItems();    0 < icubes.length || 0 < e.length      ? Utils.logg("在绘制货架之前清除场景!", "提示")      : (tracking(31), recreateAutoIcube());  }),  $("#remove-all-icubes").on("click", function () {    updateDrawButtonState(),      removeAllIcubes(),      Behavior.add(Behavior.type.removeIcube),      renderScene();  }),  $("#remove-all-items").on("click", function () {    confirm("这将从工作区中删除所有项目。你确定吗?") &&      (updateDrawButtonState(),      removeManualItems(),      Behavior.add(Behavior.type.deleteItem),      renderScene());  }),  $("#input-upRightDistance").on("change", function (e) {    tracking(50);    let t = parseFloat(e.target.value);    (t =      (t = useP(t) / useP(rateUnit)) < 0.6 * g_MinDistUpRights        ? 0.6 * g_MinDistUpRights        : t) > g_MaxDistUpRights && (t = g_MaxDistUpRights),      (g_distUpRight = useP(useP(t), !1)),      updateRackingHighLevel(),      updateSelectedIcube(),      Behavior.add(Behavior.type.upRightDistance);  }),  $("#palletDistr_0, #palletDistr_1, #palletDistr_2").on(    "change",    function (e) {      tracking(41),        updateDistrPallet(          $(this).attr("id").split("_")[1],          parseInt(e.target.value)        );    }  ),  $("#rackingHighLevel").on("change", function (e) {    (g_rackingHighLevel = parseInt(e.target.value)),      updateRackingHighLevel(),      updateSelectedIcube(),      tracking(49),      Behavior.add(Behavior.type.rackingLevel);  }),  $("#palletOverhang").on("change", function (e) {    (g_palletOverhang = parseFloat(e.target.value)),      updateSelectedIcube(),      tracking(48),      Behavior.add(Behavior.type.palletOverhang);  }),  $("#loadPalletOverhang").on("change", function (e) {    (g_loadPalletOverhang = parseFloat(e.target.value)),      (g_palletInfo.type = g_palletInfo.value),      updateSelectedIcube(),      tracking(47),      Behavior.add(Behavior.type.palletOverhang);  }),  $("#orientationRacking").on("change", function (e) {    (g_rackingOrientation = parseInt(e.target.value)),      null !== selectedIcube &&        (1 === g_drawMode          ? recreateAutoIcube()          : (selectedIcube.resetIcubeData(), updateSelectedIcube())),      tracking(46),      Behavior.add(Behavior.type.rackingOrient);  }),  $("#numberOfSKU").on("change", function (e) {    g_SKU = parseInt(e.target.value);    e = g_recomandedXtrackAmount;    null !== selectedIcube &&      (calculateProps(selectedIcube.baseLines),      e !== g_recomandedXtrackAmount &&        (selectedIcube.resetIcubeData(), updateSelectedIcube())),      tracking(45),      Behavior.add(Behavior.type.sku);  }),  $("#numberOfPalletInOutPerHour").on("change", function (e) {    (g_movesPerHour = parseInt(e.target.value)),      null !== selectedIcube &&        (selectedIcube.updateThroughput(g_movesPerHour),        selectedIcube.getEstimationPrice()),      tracking(44),      Behavior.add(Behavior.type.throughput),      renderScene();  }),  $("#extracarrierAmount").on("change", function (e) {    selectedIcube &&      ((g_extraCarrierAmount =        parseInt(e.target.value) < 0 ? 0 : parseInt(e.target.value)),      selectedIcube.updateCarrier(g_extraCarrierAmount),      selectedIcube.getEstimationPrice(),      Behavior.add(Behavior.type.addCharger),      renderScene());  }),  $("#cameraView3D").on("click", function () {    g_simMultipleView || switch_to_free_camera();  }),  $("#cameraView2D").on("click", function () {    g_simMultipleView || switch_to_top_camera();  }),  $("#cameraFront").on("click", function () {    g_simMultipleView || switch_to_front_camera();  }),  $("#cameraSide").on("click", function () {    g_simMultipleView || switch_to_side_camera();  }),  $("#zoomIn").on("click", function () {    switch (currentView) {      case ViewType.top:        zoom2DCamera(-1, !1);        break;      case ViewType.free:        --scene.activeCamera.radius;        break;      case ViewType.front:      case ViewType.side:        zoom2DCamera(-1, !0);    }    renderScene();  }),  $("#zoomOut").on("click", function () {    switch (currentView) {      case ViewType.top:        zoom2DCamera(1, !1);        break;      case ViewType.free:        scene.activeCamera.radius += 1;        break;      case ViewType.front:      case ViewType.side:        zoom2DCamera(1, !0);    }    renderScene();  }),  $("#resetCamera").on("click", function () {    switchCamera(currentView);  }),  $(".new-btn").on("click", function () {    (currenntDataBaseAction = DataBaseAction.new),      $(".new-modal-close").show(),      hasUpdates() && confirm("你想保存你的工作吗?")        ? saveProject(() => {            showModal("new-modal");          })        : showModal("new-modal");  }),  $(".save-btn").on("click", function () {    (currenntDataBaseAction = DataBaseAction.save),      "" === documentName        ? showModal("saveAs-modal")        : hasUpdates() &&          (tracking(3),          saveProject(() => {            userRole === g_UserRole.Demo &&              window.location.replace("home/logout");          }));  }),  $(".saveAs-btn").on("click", function () {    (currenntDataBaseAction = DataBaseAction.save), showModal("saveAs-modal");  }),  $(".adminLoadAutoSave-btn").on("click", function () {    (currenntDataBaseAction = DataBaseAction.load),      loadProject(documentName, documentInfo, !0);  }),  $(".load-btn").on("click", function () {    (currenntDataBaseAction = DataBaseAction.load),      $(".load-modal-close").show(),      hasUpdates()        ? confirm("你想保存你的工作吗?")          ? saveProject(function () {              getProjectList(function (e) {                createProjectList(e);              });            })          : getProjectList(function (e) {              createProjectList(e);            })        : getProjectList(function (e) {            createProjectList(e);          });  }),  $(".load-modal-close").on("click", function () {    hideModal("load-modal");  }),  $(".new-modal-close").on("click", function () {    hideModal("new-modal");  }),  $(".saveAs-modal-close").on("click", function () {    hideModal("saveAs-modal");  }),  $(".rating-modal-close").on("click", function () {    Utils.request(      g_BasePath + "home/rating",      "POST",      {        complete: 0,      },      () => {        hideModal("rating-modal");      }    );  }),  $(".planAddInfo-modal-close").on("click", function () {    hideModal("planAddInfo-modal");  }),  $(".saveAs-modal-confirm").on("click", function () {    "" == $("#inputDocumentAs").val()      ? $("#inputDocumentAs").focus()      : ((old_documentName = documentName),        (documentName = $("#inputDocumentAs").val().trim()),        documentNameOverlapCheck(function (e) {          let t = !1;          e.map(e => {            e.document_name == documentName && (t = !0);          }),            t              ? ((documentName = old_documentName),                Utils.logg("项目名称已存在。选择其他名称。", "error"),                $("#inputDocumentAs").val("").focus())              : (createBehavior(),                $("#project-name").html(documentName),                hideModal("saveAs-modal"),                tracking(37),                (currenntDataBaseAction = DataBaseAction.save),                saveProject());        }));  }),  $(".new-modal-confirm").on("click", function () {    "" == $("#inputDocument").val()      ? $("#inputDocument").focus()      : ((old_documentName = documentName),        (documentName = $("#inputDocument").val().trim()),        documentNameOverlapCheck(e => {          let t = !1;          e.map(e => {            e.document_name == documentName && (t = !0);          }),            t              ? ((documentName = ""),                Utils.logg("项目名称已存在。选择其他名称。", "error"),                $("#inputDocument").val("").focus())              : ($("#project-name").html(documentName),                hideModal("new-modal"),                saveProject(),                ((currenntDataBaseAction = DataBaseAction.new) !==                  DataBaseAction.new &&                  currenntDataBaseAction !== DataBaseAction.load &&                  !isEditByAdmin) ||                  ((currentTemplateType.document_name = documentName),                  setProject(currentTemplateType)));        }));  }),  $(".undo-btn").on("click", function () {    Behavior.undo();  }),  $(".redo-btn").on("click", function () {    Behavior.redo();  }),  $(".img-rounded").on("click", function () {    currentTemplateType = Template.values[Template.type[$(this).attr("key")]];    const t = $(".template-item-box");    for (let e = 0; e < t.length; e++) t[e].classList.remove("select");    $(this).parent().addClass("select");  }),  $("#btn-full-screen").on("click", function () {    scene.getEngine().enterFullscreen(!1);  }),  $("#btn-save-pdf").on("click", function () {    $("#waiting").show("fast", () => {      Export_PDF.generateFile(!1), tracking(8);    }),      isEditByAdmin ||        Utils.request(g_BasePath + "home/downloadPDF", "POST", {}, null, null);  }),  $("#btn-save-dxf").on("click", function () {    $("#waiting").show("fast", () => {      if ((tracking(12), $("#cadAsPDF").is(":checked")))        Export_CAD.generateFile(!1, !0);      else {        const e = new FormData();        e.append("dxf", Export_CAD.generateFile(!1, !1)),          e.append(            "data",            JSON.stringify({              documentName: documentName,              documentInfo: documentInfo,            })          ),          Utils.requestFormData(            g_BasePath + "home/uploadCAD",            "POST",            e,            async e => {              const i = JSON.parse(e);              if (0 === i.url.length)                return (                  $("#waiting").hide(), void Utils.logg("首先保存项目", "error")                );              e = i.url.replace(/ /g, "%20");              const n = "https://api.cloudconvert.com/v2",                s = i.url.split("/").pop().split(".").shift();              (e = {                tasks: {                  file1: {                    operation: "import/url",                    url: e,                  },                  converttodwg: {                    operation: "convert",                    input_format: "dxf",                    output_format: "dwg",                    engine: "cadconverter",                    input: ["file1"],                    engine_version: "8.9",                    filename: s + ".dwg",                  },                  converted: {                    operation: "export/url",                    input: ["converttodwg"],                    inline: !1,                    archive_multiple_files: !1,                  },                },                tag: "logiqs",              }),                (e = {                  method: "POST",                  body: JSON.stringify(e),                  headers: {                    Authorization: "Bearer " + i.key,                    "Content-type": "application/json",                  },                });              const t = await fetch(n + "/jobs", e);              t.json().then(async e => {                var t = {                  method: "GET",                  headers: {                    Authorization: "Bearer " + i.key,                  },                };                const a = await fetch(                  n + "/tasks/" + e.data.tasks[2].id + "/wait",                  t                );                a.json().then(e => {                  var t;                  $("#waiting").hide(),                    !e.data.result ||                      (e.data.result && 0 === e.data.result.files.length) ||                      ((e = e.data.result.files[0].url),                      (t = s + ".dwg"),                      Utils.download(t, e, !1));                });              });            }          );      }    });  }),  $("#btn-save-3ds").on("click", function () {    $("#waiting").show("fast", async () => {      await Export_OBJ.generateFile(), $("#waiting").hide(), tracking(43);    });  }),  $("#btn-save-view").on("click", function () {    hasUpdates()      ? saveProject(() => {          Export_PNG.generateFile(), tracking(40);        })      : (Export_PNG.generateFile(), tracking(40));  }),  $("#btnSubmission").on("click", function () {    $("#waiting").show("fast", () => {      Export_PDF.generateFile(!0);    });  }),  $("#contact-form").on("submit", function (e) {    e.preventDefault();  }),  $("#contact_submit").on("click", async function () {    if ($("#contact-form").valid()) {      $("#waiting").show();      const a = new window.jspdf.jsPDF("l", "pt", "a4", !0);      a.setFont("arial-unicode-ms"),        a.setFontSize(15),        a.text(50, 50, "UserName : " + $("#con_fullName").val()),        a.setFontSize(15),        a.text(50, 80, "Email : " + $("#con_email").val()),        a.setFontSize(15),        a.text(50, 110, "Company : " + $("#con_company").val()),        a.setFontSize(15),        a.text(50, 140, "Location : " + $("#con_location").val()),        a.setFontSize(15),        a.text(50, 170, "Crop : " + $("#con_crop").val()),        a.setFontSize(15),        a.text(          50,          200,          $("#schedule_yes").is(":checked")            ? "Client want to schedule an appointment with sales"            : "Client don't want to schedule an appointment with sales"        ),        a.setFontSize(15),        a.text(50, 230, "Preferred date : " + $("#con_preferred_date").val()),        a.setFontSize(15),        a.text(50, 260, "Question : ");      var e,        t = a.splitTextToSize($("#con_question").val(), 650);      a.text(100, 290, t),        $("#include_yes").is(":checked") &&          (a.addPage(),          (t = currentView),          (e = await getImage(ViewType.free, !0)),          a.addImage(e, "JPEG", 20, 40, 800, 500, void 0, "FAST"),          getImage(t));      const i = new FormData();      i.append("pdf", a.output("blob")),        Utils.requestFormData(g_BasePath + "home/contact", "POST", i, () => {          $("#waiting").hide(), Utils.logg("您的问题已成功提交!", "成功");        });    }  }),  $(".units").on("change", function () {    (currentUnits =      currentUnits === Units.metric ? Units.usStand : Units.metric),      (unit_measurement = currentUnits),      tracking(36),      SetUIUnits(),      ChangeUnits();  }),  $('select[name="metric"]').on("change", function (e) {    (currentMetric = parseInt(e.target.value)), ChangeUnits();  }),  $('select[name="usStand"]').on("change", function (e) {    (currentUSStand = parseInt(e.target.value)), ChangeUnits();  }),  $("#con_preferred_date")    .datepicker({      minDate: "+1d",      beforeShowDay: $.datepicker.noWeekends,    })    .datepicker("setDate", "+1d"),  $("#addInfo_delivery_date, #addInfo_delivery_date2")    .datepicker({      minDate: "+1m",      beforeShowDay: $.datepicker.noWeekends,    })    .datepicker("setDate", "+1m"),  $(document).ready(function () {    $('[data-toggle="tooltip"]').tooltip(),      document.addEventListener("contextmenu", e => e.preventDefault());  }),  (window.onerror = (e, t, a) => {    console.log(e, t, a);    const i = new FormData();    return (      i.append("documentName", documentName),      i.append("lineNumber", a),      i.append("message", e),      i.append("url", t),      BABYLON.Tools.CreateScreenshotAsync(        scene.getEngine(),        scene.activeCamera,        {          width: 1600,          height: 1e3,        }      ).then(e => {        i.append("screenshot", e),          Utils.requestFormData(g_BasePath + "home/load", "POST", i);      }),      !0    );  }),  $(".faq").on("click", function () {    $(".faq").removeClass("faq_active"),      $(".faq").next().addClass("hide"),      $(this).addClass("faq_active"),      $(this).next().removeClass("hide");  }),  $("#btnSubmissionPlan").on("click", function () {    var e = checkPlacedXtracklift();    e[0]      ? showModal("planAddInfo-modal")      : ($("#submit-modal-mess").html(e[1]), showModal("submit-modal"));  }),  $("#btnSubmissionPlanToManager").on("click", function () {    $("#waiting").show("fast", () => {      Export_PDF.generateFile(!0);    }),      hideModal("planAddInfo-modal");  }),  $("#btnSubmissionPlanToManager2").on("click", function () {    var e = checkPlacedXtracklift();    (extraInfo = {      email: $("#emailP").val(),      compName: (userRole === g_UserRole.Sales        ? $("#addInfo_company")        : $("#addInfo_company2")      ).val(),      contactP: (userRole === g_UserRole.Sales        ? $("#addInfo_contacter")        : $("#addInfo_contacter2")      ).val(),      location: (userRole === g_UserRole.Sales        ? $("#addInfo_location")        : $("#addInfo_location2")      ).val(),      delDate: (userRole === g_UserRole.Sales        ? $("#addInfo_delivery_date")        : $("#addInfo_delivery_date2")      ).val(),      temperature:        userRole === g_UserRole.Sales          ? $("#addInfo_temp").is(":checked")            ? "Yes"            : "No"          : $("#addInfo_temp2").is(":checked")          ? "Yes"          : "No",      flammable:        userRole === g_UserRole.Sales          ? $("#addInfo_flammable").is(":checked")            ? "Yes"            : "No"          : $("#addInfo_flammable2").is(":checked")          ? "Yes"          : "No",      food:        userRole === g_UserRole.Sales          ? $("#addInfo_food").is(":checked")            ? "Yes"            : "No"          : $("#addInfo_food2").is(":checked")          ? "Yes"          : "No",      feedback: $("#help_feedback").val(),    }),      e[0]        ? userRole !== g_UserRole.Demo          ? $("#waiting").show("fast", () => {              Export_PDF.generateFile(!0);            })          : 0 !== extraInfo.contactP.length &&            0 !== extraInfo.email.length &&            Utils.validateEmail(extraInfo.email) &&            Utils.request(              g_BasePath + "home/createDemoAccount",              "POST",              {                name: extraInfo.contactP,                email: extraInfo.email,              },              e => {                (documentInfo = e.documentInfo),                  (userEmail = extraInfo.email),                  (userName = extraInfo.contactP),                  $("#waiting").show("fast", () => {                    Export_PDF.generateFile(!0);                  });              },              () => {                Utils.logg("帐户创建失败!请稍后再试", "error");              }            )        : ($("#submit-modal-mess").html(e[1]),          $("#submit-modal").removeClass("fade").show());  }),  $(".submit-modal-close").on("click", function () {    $("#submit-modal").addClass("fade").hide(),      document        .getElementById("main-tabs-tab-Racking")        .dispatchEvent(new Event("click"));  }),  $(".submit-modal-confirm").on("click", function () {    hideModal("submit-modal"),      userRole === g_UserRole.Sales        ? showModal("planAddInfo-modal")        : $("#waiting").show("fast", () => {            Export_PDF.generateFile(!0);          });  }),  $(".equipment-item").on("click", function () {    clickManualItem($(this).attr("idx"));  }),  $("#show_tutorial_atFirst").on("click", function () {    switchCamera(currentView),      hideModal("hello-modal"),      (g_saveBehaviour = !1),      $(".tab-content").is(":visible") &&        $("#main-tabs-tab-Size").trigger("click"),      tutorialTour.start(() => {        setProject(currentTemplateType, !1),          initData(currentTemplateType),          onBegin();      });  }),  $("#show_tutorial").on("click", function () {    switchCamera(currentView), (g_saveBehaviour = !1);    const e = {      document_name: documentName,      warehouse_dimensions: [...WHDimensions],      icubeData: [...getIcubeData()],      itemMData: [...getManualItems()],      unit_measurement: unit_measurement,      extraInfo: extraInfo,      extraPrice: [...extraPrice],      measurements: [...getAllMeasurements()],      custom_values: [...custom_values],      layoutMap: {        ...layoutMap,      },    };    setProject(Template.values[Template.type.Default], !1),      $(".tab-content").is(":visible") &&        $("#main-tabs-tab-Size").trigger("click"),      tutorialTour.start(() => {        setProject(e, !1), Behavior.init();      });  }),  $("#send_feedback").on("click", function () {    Utils.request(      g_BasePath + "home/sendFeedback",      "POST",      {        fmessage: $("#help_feedback").val(),      },      e => {        e && Utils.logg("反馈已发送!", "成功");      },      null    );  }),  $("#gotoRacking").on("click", function () {    document      .getElementById("main-tabs-tab-Racking")      .dispatchEvent(new Event("click")),      $(".tab-content").animate(        {          scrollTop: 0,        },        1      );  }),  $("#auto-upRightDist").on("click", function () {    $(this).hasClass("active-icube-setting") ||      ($("#custom-upRightDist").removeClass("active-icube-setting"),      $("#input-upRightDistance").attr("disabled", !0),      $(this).addClass("active-icube-setting"));  }),  $("#custom-upRightDist").on("click", function () {    $(this).hasClass("active-icube-setting") ||      ($("#auto-upRightDist").removeClass("active-icube-setting"),      $("#input-upRightDistance").attr("disabled", !1),      $(this).addClass("active-icube-setting"));  }),  $("#download_it").on("click", function () {    selectedIcube && selectedIcube.software.download();  }),  $("#download_it_wms").on("click", function () {    selectedIcube && selectedIcube.software.download_wms();  }),  $("#accountToCreate").on("click", function () {    var e = $("#nameToCreate").val(),      t = $("#emailToCreate").val();    0 !== e.length &&      0 !== t.length &&      Utils.validateEmail(t) &&      Utils.request(        g_BasePath + "home/createAccountSA",        "POST",        {          name: e,          email: t,        },        e => {          "Error" === e            ? Utils.logg("此用户已存在", "error")            : createUsersSAhtml(e);        },        () => {          Utils.logg("帐户创建失败!请稍后再试", "error");        }      );  }),  $("#uploadedLayout").on("change", function () {    var e = new FormData($("#uploader").get(0));    Utils.requestFormData(      g_BasePath + "home/uploadCAD_layout",      "POST",      e,      e => {        0 === e.length          ? Utils.logg("上传失败!", "error")          : Utils.logg("上传完成!", "success"),          ((layoutMap =            layoutMap && (!layoutMap || layoutMap.hasOwnProperty("url"))              ? layoutMap              : {                  url: "",                  scale: 1,                  uOffset: 0,                  vOffset: 0,                }).url = e),          (layoutMap.scale = 1),          (layoutMap.uOffset = 0),          (layoutMap.vOffset = 0),          prepareTexture();      }    );  }),  $("#layoutDrawing").on("click", function () {    for (let e = layoutArrows.length - 1; 0 <= e; e--)      layoutArrows[e].dispose();    if (((layoutArrows = []), $(this).hasClass("active-icube-setting")))      $(this).removeClass("active-icube-setting").text("负载建筑图纸(可选)"),        $("#uploader").hide(),        tracking(38);    else {      $(this).addClass("active-icube-setting").text("确认放置"),        $("#uploader").show();      for (let t = 0; t < 4; t++) {        const e = otherItemInfo[          ITEMTYPE.Other.PortArrow        ].originMesh.createInstance("inst_" + t);        (e.rotationQuaternion = null),          (e.scaling.y = 0.001),          t % 2 == 0            ? ((e.position.x = ((0 === t ? -1 : 1) * warehouse.width) / 1.8),              (e.rotation.y = 0 === t ? -Math.PI / 2 : Math.PI / 2))            : ((e.position.z = ((1 === t ? -1 : 1) * warehouse.length) / 1.8),              (e.rotation.y = 1 === t ? Math.PI : 0)),          (e.actionManager = new BABYLON.ActionManager(scene)),          (e.actionManager.hoverCursor = "pointer"),          e.actionManager.registerAction(            new BABYLON.ExecuteCodeAction(              BABYLON.ActionManager.OnPointerOverTrigger,              () => {}            )          ),          e.actionManager.registerAction(            new BABYLON.ExecuteCodeAction(              BABYLON.ActionManager.OnPickDownTrigger,              e => {                if (layoutMap) {                  switch (t) {                    case 0:                      layoutMap.uOffset += 0.1;                      break;                    case 1:                      layoutMap.vOffset += 0.1;                      break;                    case 2:                      layoutMap.uOffset -= 0.1;                      break;                    case 3:                      layoutMap.vOffset -= 0.1;                  }                  warehouse.floor.material.albedoTexture &&                    ((warehouse.floor.material.albedoTexture.uOffset =                      layoutMap.uOffset),                    (warehouse.floor.material.albedoTexture.vOffset =                      layoutMap.vOffset));                }              }            )          ),          layoutArrows.push(e);      }      warehouse.update(WHDimensions);    }    renderScene(4e3);  }),  $("#customLastRow").on("click", function () {    (visibility = !$("#lastLSetting").is(":visible")),      $("#lastLSetting").css("display", visibility ? "block" : "none"),      $("#input-pallet-height").attr("disabled", visibility),      $("#input-pallet-height").next().children().attr("disabled", visibility),      $("#input-pallet-weight").attr("disabled", visibility),      $("#input-pallet-weight").next().children().attr("disabled", visibility);  }),  $("#spacing_b_rows").on("change", function (e) {    (g_spacingBetweenRows = parseFloat(e.target.value)),      selectedIcube &&        (selectedIcube.updateDistanceBetweenRows(),        selectedIcube.getEstimationPrice());  }),  $("#start_sim").on("click", function () {    if (simulation) {      updateSimulation(simulation);      const e = document.getElementById("carriersHolder");      e.childNodes.forEach(function (e) {        e.removeChild(e.childNodes[0]);      }),        simulation.remove(),        (simulation = null),        $(this).text("开始"),        $("#pause_sim").hide();    } else      (document.getElementById("liftsHolder").innerHTML = ""),        (document.getElementById("carriersHolder").innerHTML = "") !==        (simulation = new Simulation({          input: parseInt(document.querySelector('input[id="simIn"]').value),          output: parseInt(document.querySelector('input[id="simOut"]').value),          process: parseInt(            document.querySelector('select[name="simProces"]').value          ),          strategy: parseInt(            document.querySelector('select[name="simStrat"]').value          ),          multiply: parseInt(            document.querySelector('select[name="simSpeed"]').value          ),          liftAssign: parseInt(            document.querySelector('select[name="simLiftA"]').value          ),          sharePath: !!document.querySelector(            'input[name="simHandoff"]:checked'          ),          isReply: !1,          onEnd: () => {            tracking(15), endSimulation();          },        })).error          ? (simulation.remove(), (simulation = null))          : (tracking(14),            Behavior.add(Behavior.type.playAnimation),            saveSimulation(simulation),            $(this).text("停止"),            $("#pause_sim").text("暂停").show());  }),  $('select[name="simSpeed"]').on("change", function () {    simulation && (simulation.multiply = parseInt($(this)[0].value));  }),  $("#pause_sim").on("click", function () {    simulation.isPlaying      ? (simulation.pause(), $(this).text("继续"))      : (simulation.resume(), $(this).text("暂停"));  }),  $("#simMultipleView").on("change", function () {    (g_simMultipleView = $(this).is(":checked")), toggleMultipleView();  }),  $("#addPriceRow").on("click", function () {    $("#extraPriceTable")[0] ||      (document.getElementById(        "extraPriceHolder"      ).innerHTML = `<table id="extraPriceTable" class="table itemTable table-responsive-lg table-bordered table-striped table-sm mb-0" style="margin-top: 10px;">      <colgroup>        <col width="30%">        <col width="8%">        <col width="10%">        <col width="3%">      </colgroup>      <tbody></tbody>    </table>`);    var e =      '<tr id="extraP_' +      extraPrice.length +      `">    <td><input class="epName" type="text" style="width:100%" /></td>    <td><input class="epQuantity" type="number" style="width:100%;text-align:right" value="0" /></td>    <td><input class="epValue" type="number" style="width:100%;text-align:right"  value="0" /></td>    <td><button style="width:100%;font-size:10px;padding:0" onclick="saveExtraPrice(` +      extraPrice.length +      `)">Save</button></td>  </tr>`;    $("#extraPriceTable tbody").append(e);  }),  $("#viewer2d_it").on("click", function () {    const e = document.getElementById("itHelper");    var t = $("#itHelper > canvas")[0];    "none" === e.style.display      ? ((e.style.display = "block"),        it3DEngine && (it3DEngine.dispose(), (it3DEngine = null)),        (it2DEngine = create2DViewerIt(t)))      : ((e.style.display = "none"),        it2DEngine && (it2DEngine.dispose(), (it2DEngine = null)));  }),  $("#viewer3d_it").on("click", function () {    const e = document.getElementById("itHelper");    var t = $("#itHelper > canvas")[0];    "none" === e.style.display      ? ((e.style.display = "block"),        it2DEngine && (it2DEngine.dispose(), (it2DEngine = null)),        (it3DEngine = create3DViewerIt(t)))      : ((e.style.display = "none"),        it3DEngine && (it3DEngine.dispose(), (it3DEngine = null)));  }),  $("#submit-rating-btn").on("click", function () {    var e = $("input[name=rating_star]:checked").val();    if (isNaN(parseFloat(e)))      return (        $(this).parent().append("<p>Please choose a rating star</p>"),        void setTimeout(() => {          const e = document.getElementById("submit-rating-btn").parentNode;          e.removeChild(e.lastChild);        }, 2e3)      );    var t = $("#rating_comment").val(),      a = $("#rating_agent").is(":checked");    Utils.request(      g_BasePath + "home/rating",      "POST",      {        stars: e,        comm: t,        agent: a,        complete: 1,      },      () => {        Utils.logg("反馈成功发送!", "成功"), hideModal("rating-modal");      },      () => {        alert("反馈失败!请稍后再试。");      }    );  }),  $("#manualItem-placeholder").on("change", function () {    $("#placeholder_data").toggle();  }),  $("#add-placeholder").on("click", function () {    let e = manualItemInfo.indexOf(manualItemInfo[manualItemInfo.length - 1]);    e < 1e3 ? (e = 1e3) : (e += 1),      createFakeManualItem({        type: e,        name: $("#machine_name").val(),        width: parseFloat($("#machine_width").val()),        length: parseFloat($("#machine_length").val()),        height: parseFloat($("#machine_height").val()),        colors: $("#machine_color").val(),        atDist: parseFloat($("#machine_atDist").val()),      }),      clickManualItem(e);  }),  $("#add-people").on("click", function () {    clickManualItem(899);  }),  $(".fa-question-circle")    .on("mouseenter", function () {      document.getElementById($(this)[0].dataset.info).style.display = "block";    })    .on("mouseout", function () {      document.getElementById($(this)[0].dataset.info).style.display = "none";    }),  $("#add-pdfPage").on("click", function () {    var e =      `    <div class="form-group mb10" style="text-align:center;">      <label class="col-sm-1 control-label padding-no labelpad">` +      parseInt(custompPdf.length + 1) +      `</label>      <input class="col-sm-5 form-control" style="width:41%;" type="text" placeholder="Title" value="" onchange="addTitleToPage(this, ` +      custompPdf.length +      `)">      <button class="icube-tool btn btn-primary col-sm-5" onclick="addScreenToPage(this, ` +      custompPdf.length +      `)">Add image</button>      <label class="col-sm-1 control-label padding-no labelpad" style="text-align:center;cursor:pointer;" onclick=removeFromPage(` +      custompPdf.length +      `)><i class="el fa fa-trash" href="#"></i></label>    </div>`;    $("#pdfPages").append(e),      custompPdf.push({        title: "",        image: "",      });  }),  $("#gen-pdf").on("click", function () {    $("#waiting").show("fast", () => {      Export_PDF.generateCustomFile(), tracking(39);    });  }),  $("#add-measurement").on("click", function () {    (g_measureEnabled = !g_measureEnabled), clickableItems(!g_measureEnabled);  }),  $("#settingsModeS1").on("click", function () {    $("#advancedSettings01").hide(),      $("#advancedSettings11").hide(),      $("#advancedSettings12").hide(),      $("#simpleSettings12").show(),      $("#lastLSetting").is(":visible") && $("#customLastRow").trigger("click"),      $("#customLastRow").attr("disabled", !0),      $(this).hasClass("active-icube-setting") ||        $(this).addClass("active-icube-setting"),      $("#settingsModeA1").hasClass("active-icube-setting") &&        $("#settingsModeA1").removeClass("active-icube-setting"),      $("#settingsModeS2").hasClass("active-icube-setting") ||        $("#settingsModeS2").trigger("click");  }),  $("#settingsModeA1").on("click", function () {    $("#advancedSettings01").show(),      $("#advancedSettings11").show(),      $("#advancedSettings12").show(),      $("#simpleSettings12").hide(),      $("#customLastRow").attr("disabled", !1),      $(this).hasClass("active-icube-setting") ||        $(this).addClass("active-icube-setting"),      $("#settingsModeS1").hasClass("active-icube-setting") &&        $("#settingsModeS1").removeClass("active-icube-setting"),      $("#settingsModeA2").hasClass("active-icube-setting") ||        $("#settingsModeA2").trigger("click");  }),  $("#settingsModeS2").on("click", function () {    $("#advancedSettings22").hide(),      $("#set-icube-charger").hide(),      $("#set-icube-liftpreloading").hide(),      $(this).hasClass("active-icube-setting") ||        $(this).addClass("active-icube-setting"),      $("#settingsModeA2").hasClass("active-icube-setting") &&        $("#settingsModeA2").removeClass("active-icube-setting"),      $("#settingsModeS1").hasClass("active-icube-setting") ||        $("#settingsModeS1").trigger("click");  }),  $("#settingsModeA2").on("click", function () {    $("#advancedSettings22").show(),      $("#set-icube-charger").show(),      $("#set-icube-liftpreloading").show(),      $(this).hasClass("active-icube-setting") ||        $(this).addClass("active-icube-setting"),      $("#settingsModeS2").hasClass("active-icube-setting") &&        $("#settingsModeS2").removeClass("active-icube-setting"),      $("#settingsModeA1").hasClass("active-icube-setting") ||        $("#settingsModeA1").trigger("click");  }),  $("#palletSize").on("click", function () {    $(".palletSizeList").toggle();  }),  $(".palletSizeList li").on("click", function () {    tracking(41), $(this).parent().hide();    $("#palletSize > span").css(      "color",      ["#3bf582", "#fc3f3f", "#d2fa41"][$(this).index()]    ),      $("#palletSize > label").html($(this).children("label").text()),      updateDistrPallet($(this).index(), 100);  }),  $("#searchProject").on("keyup", function (e) {    const t = e.target.value;    $(".list-group").children().show(),      "" !== t &&        $(".list-group")          .children()          .filter(function () {            return (              -1 ===              $(this)[0]                .children[0].innerHTML.toLowerCase()                .indexOf(t.toLowerCase())            );          })          .hide();  }),  $("#optimizeRacking").on("click", function () {    selectedIcube && selectedIcube.optimizeRacking(), tracking(34);  }),  $(".dupl").on("click", function () {    var e = parseInt($(this).attr("control"));    5 === e      ? $("#duplicate-tab").hide()      : 4 === e      ? (multiplyIcube(), $("#duplicate-tab").hide())      : ((duplData[1] = e),        $(".dupl").css("color", "#ffffff"),        $(this).css("color", "#333333"));  }),  $(".dupl2").on("click", function () {    var e = parseInt($(this).attr("control"));    (duplData[3] = 6 === e),      $(".dupl2").css("color", "#ffffff"),      $(this).css("color", "#333333");  }),  $("#dupl_distance").on("change", function () {    duplData[0] = parseFloat(event.target.value);  }),  $('input[name="optimize"]').on("change", function (e) {    g_optimizeDirectTL = !!parseInt(e.target.value);  }),  $("#revisions").on("click", function () {    $("#revisions_list").toggle();  }),  $("#newProject").on("click", function () {    $(".new-modal-close").hide(),      showModal("new-modal"),      hideModal("hello-modal"),      (g_tutorialIsRunning = !1);  }),  $("#loadProject").on("click", function () {    getProjectList(function (e) {      $(".load-modal-close").hide(),        createProjectList(e),        hideModal("hello-modal"),        (g_tutorialIsRunning = !1);    });  }),  $(".checkbox-dropdown").on("click", function () {    $(this).toggleClass("is-active");  }),  $(".checkbox-dropdown ul").on("click", function (e) {    e.stopPropagation();  }),  $("#send_report").on("click", function () {    showModal("report-modal");  }),  $(".report-modal-close").on("click", function () {    hideModal("report-modal");  }),  $(".report-modal-confirm").on("click", async function () {    const t = new FormData();    t.append("documentName", documentName),      t.append("name", $("#reportName").val()),      t.append("description", $("#reportDesc").val());    var e = await BABYLON.Tools.CreateScreenshotAsync(      scene.getEngine(),      scene.activeCamera,      {        width: 1600,        height: 1e3,      }    );    t.append("screenshot", e);    for (let e = 0; e < $("#reportFile")[0].files.length; e++)      t.append("file_" + e, $("#reportFile")[0].files[e]);    Utils.requestFormData(g_BasePath + "home/saveReport", "POST", t),      Utils.logg("错误报告已发送!", "成功"),      hideModal("report-modal");  }),  $("#configVariables").on("click", function () {    custom_values[0] &&      -1 !== custom_values[0] &&      $("#var_palletWidth").val(custom_values[0]),      custom_values[1] &&        -1 !== custom_values[1] &&        $("#var_palletLength").val(custom_values[1]),      custom_values[2] &&        -1 !== custom_values[2] &&        $("#var_palletOverhang").val(custom_values[2]),      custom_values[3] &&        -1 !== custom_values[3] &&        $("#var_railHeight").val(custom_values[3]),      custom_values[4] &&        -1 !== custom_values[4] &&        $("#var_distToXtrack").val(custom_values[4]),      custom_values[5] &&        -1 !== custom_values[5] &&        $("#var_distToMargin").val(custom_values[5]),      custom_values[6] &&        -1 !== custom_values[6] &&        $("#var_distTo1stStore").val(custom_values[6]),      custom_values[7] &&        -1 !== custom_values[7] &&        $("#var_distToNextStore").val(custom_values[7]),      showModal("configVariables-modal");  }),  $(".configVariables-modal-close").on("click", function () {    hideModal("configVariables-modal");  }),  $(".configVariables-modal-confirm").on("click", function () {    var e = parseFloat($("#var_distToNextStore").val()),      t = parseFloat($("#var_distTo1stStore").val()),      a = parseFloat($("#var_distToMargin").val()),      i = parseFloat($("#var_distToXtrack").val()),      n = parseFloat($("#var_railHeight").val()),      s = parseFloat($("#var_palletOverhang").val()),      l = parseFloat($("#var_palletLength").val()),      o = parseFloat($("#var_palletWidth").val());    (custom_values = [      isNaN(o) ? -1 : o,      isNaN(l) ? -1 : l,      isNaN(s) ? -1 : s,      isNaN(n) ? -1 : n,      isNaN(i) ? -1 : i,      isNaN(a) ? -1 : a,      isNaN(t) ? -1 : t,      isNaN(e) ? -1 : e,    ]),      updateConfigVariables(),      hideModal("configVariables-modal"),      $("#customValue").html(        0 < custom_values.length          ? "<b>? This project contains custom values ?</b>"          : ""      );  });
 |