{"version":3,"sources":["https://lively-kernel.org/lively4/lively4-drawio/src/client/reactive/active-group/utils.js"],"names":["pushIfMissing","array","item","exists","len","length","i","push","removeIfExisting","index","indexOf","splice","isPrimitive","elem","getType","Object","prototype","toString","call","slice","type","identity","x","Stack","constructor","arr","el","pop","top","last"],"mappings":";;;AAAO,aAASA,aAAT,CAAuBC,KAAvB,EAA8BC,IAA9B,EAAoC;AACvC;AACA,YAAIC,SAAS,KAAb;AACA,YAAIC,MAAMH,MAAMI,MAAhB;AACA,aAAI,IAAIC,IAAI,CAAZ,EAAeA,IAAIF,GAAnB,EAAwBE,GAAxB,EACI,IAAGL,MAAMK,CAAN,KAAYJ,IAAf,EAAqB;AACjBC,qBAAS,IAAT;AACA;AACH;;AAEL;AACA,YAAI,CAACA,MAAL,EAAa;AACTF,kBAAMM,IAAN,CAAWL,IAAX;AACH;;AAED;AACA,eAAO,CAACC,MAAR;AACH;;6BAjBeH,a;;AAmBT,aAASQ,gBAAT,CAA0BP,KAA1B,EAAiCC,IAAjC,EAAuC;AAC1C,YAAIO,QAAQR,MAAMS,OAAN,CAAcR,IAAd,CAAZ;AACA,YAAIO,UAAU,CAAC,CAAf,EAAkB;AACdR,kBAAMU,MAAN,CAAaF,KAAb,EAAoB,CAApB;AACA;AACA,mBAAO,IAAP;AACH;AACD,eAAO,KAAP;AACH;;gCAReD,gB;;AA4BT,aAASI,WAAT,CAAqBC,IAArB,EAA2B;AAC9B,YAAIC,UAAU,UAAUD,IAAV,EAAgB;AAC1B,mBAAOE,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BL,IAA/B,EAAqCM,KAArC,CAA2C,CAA3C,EAA8C,CAAC,CAA/C,CAAP;AACH,SAFD;;AAIA,YAAIC,OAAON,QAAQD,IAAR,CAAX;;AAEA,eAAOO,SAAS,QAAT,IACHA,SAAS,QADN,IAEHA,SAAS,SAFN,IAGHA,SAAS,QAHN,IAIHA,SAAS,MAJN,IAKHA,SAAS,WALb;AAMH;;2BAbeR,W;;AAeT,aAASS,QAAT,CAAkBC,CAAlB,EAAqB;AAAE,eAAOA,CAAP;AAAW;;wBAAzBD,Q;;;;;;;;;;AAjCT,kBAAME,KAAN,CAAY;AACfC,8BAAc;AACV,yBAAKC,GAAL,GAAW,EAAX;AACH;;AAEDlB,qBAAKmB,EAAL,EAAS;AACL,yBAAKD,GAAL,CAASlB,IAAT,CAAcmB,EAAd;AACH;;AAEDC,sBAAM;AACF,yBAAKF,GAAL,CAASpB,MAAT;AACH;;AAEDuB,sBAAM;AACF,2BAAO,KAAKH,GAAL,CAASI,IAAT,EAAP;AACH;AAfc","file":"utils.js","sourcesContent":["export function pushIfMissing(array, item) {\n    // check for already existing.\n    var exists = false;\n    var len = array.length;\n    for(var i = 0; i < len; i++)\n        if(array[i] == item) {\n            exists = true;\n            break;\n        }\n\n    // do not add an already existing item\n    if (!exists) {\n        array.push(item);\n    }\n\n    // return true if the given element was pushed, otherwise false\n    return !exists;\n}\n\nexport function removeIfExisting(array, item) {\n    var index = array.indexOf(item);\n    if (index !== -1) {\n        array.splice(index, 1);\n        // return true if the given element was actually removed\n        return true;\n    }\n    return false;\n}\n\nexport class Stack {\n    constructor() {\n        this.arr = [];\n    }\n\n    push(el) {\n        this.arr.push(el);\n    }\n\n    pop() {\n        this.arr.length--;\n    }\n\n    top() {\n        return this.arr.last();\n    }\n}\n\nexport function isPrimitive(elem) {\n    var getType = function (elem) {\n        return Object.prototype.toString.call(elem).slice(8, -1);\n    };\n\n    var type = getType(elem);\n\n    return type === 'String' ||\n        type === 'RegExp' ||\n        type === 'Boolean' ||\n        type === 'Number' ||\n        type === 'Null' ||\n        type === 'Undefined';\n}\n\nexport function identity(x) { return x; }\n"]}