| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 | const Behavior = {  type: {    WHDimensions: "warehouse_dimension",    palletType: "pallet_type",    palletHeight: "pallet_height",    palletWeight: "pallet_weight",    rackingOrient: "racking_orientation",    rackingLevel: "racking_level",    palletOverhang: "pallet_overhang",    sku: "sku",    throughput: "throughput",    playAnimation: "play_animation",    upRightDistance: "upRight_distance",    icubeDimension: "icube_dimension",    addIcube: "add_icube",    removeIcube: "remove_icube",    addXtrack: "add_xtrack",    addLift: "add_lift",    addLiftpreloading: "add_lift",    addPort: "add_IOport",    addConnection: "add_connection",    addPassthrough: "add_passthrough",    addSpacing: "add_spacing",    addCharger: "add_charger",    addSafetyfence: "add_safetyFence",    addTransfercart: "add_transferCart",    addItem: "add_new_item",    moveItem: "move_item",    deleteItem: "delete_item",    multiplyItem: "multiply_item",    addChainconveyor: "add_chainConveyor",    addPillers: "add_pillers",    optimization: "optimization",    saves: "saves",    time: "time",  },  list: [    Object.fromEntries(      Object.entries(currentTemplateType).map(([e, t]) => [        e,        JSON.stringify(t),      ])    ),  ],  index: 0,  undo: function () {    this.index <= 0 || (this.index--, this.update(!1));  },  redo: function () {    this.index != this.list.length - 1 && (this.index++, this.update(!0));  },  update: function (e) {    var t;    -1 !== this.index &&      0 !== this.list.length &&      ((t = this.list[this.index]),      this.list[this.index + (e ? -1 : 1)].icubeData === t.icubeData        ? ((extraInfo = JSON.parse(t.extraInfo)),          (extraPrice = JSON.parse(t.extraPrice)),          (WHDimensions = JSON.parse(t.warehouse_dimensions)),          warehouse.update(WHDimensions),          removeManualItems(),          loadItemMData(JSON.parse(t.itemMData)),          renderScene(1e3))        : ((e = {            document_name: documentName,            warehouse_dimensions: JSON.parse(t.warehouse_dimensions),            icubeData: JSON.parse(t.icubeData),            itemMData: JSON.parse(t.itemMData),            extraInfo: JSON.parse(t.extraInfo),            extraPrice: JSON.parse(t.extraPrice),            measurements: JSON.parse(t.measurements),            custom_values: JSON.parse(t.custom_values),          }),          setProject(e, !1)));  },  init: function () {    (this.index = 0), (this.list.length = 1), (g_saveBehaviour = !0);  },  add: function (e, t = 0) {    g_saveBehaviour &&      e &&      ("time" !== e &&        (this.index++,        (this.list[this.index] = this.collect()),        (this.list.length = this.index + 1)),      this.save(e, t));  },  collect: function () {    var e = getIcubeData(),      t = getManualItems(),      i = getAllMeasurements();    return {      warehouse_dimensions: JSON.stringify(WHDimensions),      icubeData: JSON.stringify(e),      itemMData: JSON.stringify(t),      extraInfo: JSON.stringify(extraInfo),      extraPrice: JSON.stringify(extraPrice),      measurements: JSON.stringify(i),      custom_values: JSON.stringify(custom_values),    };  },  save: function (e) {    let t = {      behaviorName: e,      documentName: documentName,    };    0 < documentInfo &&      (t = Object.assign({}, t, {        slid: documentInfo,      })),      "time" === e &&        hasUpdates() &&        (t = Object.assign({}, t, {          documentData: this.collect(),        })),      Utils.request(g_BasePath + "home/saveBehavior", "POST", t, null, () => {        "time" === e && (tracking(20), window.location.reload());      });  },};
 |