{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/node.ts","webpack:///./src/util.ts","webpack:///external \"jQuery\"","webpack:///./src/simple.widget.ts","webpack:///./src/tree.jquery.ts","webpack:///./src/version.ts","webpack:///./src/drag_and_drop_handler.ts","webpack:///./src/elements_renderer.ts","webpack:///./src/data_loader.ts","webpack:///./src/key_handler.ts","webpack:///./src/mouse.widget.ts","webpack:///./src/save_state_handler.ts","webpack:///./src/scroll_handler.ts","webpack:///./src/select_node_handler.ts","webpack:///./src/node_element.ts"],"names":[],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAyC,iCAAiC;AAC1E,wHAAgH,mBAAmB,EAAE;AACrI;AACA;;AAEA;AACA;AACA;AACA,mCAA2B,0BAA0B,EAAE;AACvD,yCAAiC,eAAe;AAChD;AACA;AACA;;AAEA;AACA,8DAAsD,+DAA+D;;AAErH;AACA;;;AAGA;AACA;;;;;;;;AClFa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,uDAAuD;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,4BAA4B;AACnE;AACA;AACA,gCAAgC,gBAAgB;AAChD,mCAAmC,kBAAkB;AACrD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA,iBAAiB,sBAAsB;;AAEvC,iBAAiB,sCAAsC;;AAEvD,mCAAmC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yEAAyE;AACzE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAiB,iBAAiB;AAClC,iBAAiB;AACjB;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,oBAAoB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,oDAAoD,gBAAgB;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,uBAAuB;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,2BAA2B,EAAE;AACpF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0DAA0D,gBAAgB;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,4BAA4B,EAAE;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA,yCAAyC,wBAAwB;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2DAA2D,4BAA4B;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;ACrhBa;AACb;AACA,8BAA8B,6CAA6C;AAC3E,mCAAmC,gCAAgC;AACnE,0CAA0C;AAC1C;AACA;AACA,6BAA6B;AAC7B,4BAA4B;AAC5B,4BAA4B;AAC5B,8BAA8B;AAC9B,8BAA8B;AAC9B,+BAA+B;AAC/B;AACA,0CAA0C,mCAAmC;;;;;;;ACd7E,wB;;;;;;;ACAa;AACb;AACA;AACA;AACA;AACA;AACA,uCAAuC;AACvC;AACA;AACA,sCAAsC,sCAAsC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,gBAAgB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,gBAAgB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4CAA4C,gBAAgB;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,uBAAuB;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;AClGa;AACb;AACA;AACA;AACA,cAAc,gBAAgB,sCAAsC,iBAAiB,EAAE;AACvF,6BAA6B,uDAAuD;AACpF;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD;AACA;AACA,gDAAgD,OAAO;AACvD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgB,mBAAO,CAAC,CAAW;AACnC,aAAa,mBAAO,CAAC,CAAQ;AAC7B,8BAA8B,mBAAO,CAAC,CAAyB;AAC/D,0BAA0B,mBAAO,CAAC,CAAqB;AACvD,oBAAoB,mBAAO,CAAC,CAAe;AAC3C,oBAAoB,mBAAO,CAAC,CAAe;AAC3C,qBAAqB,mBAAO,CAAC,EAAgB;AAC7C,2BAA2B,mBAAO,CAAC,EAAsB;AACzD,uBAAuB,mBAAO,CAAC,EAAkB;AACjD,4BAA4B,mBAAO,CAAC,EAAuB;AAC3D,sBAAsB,mBAAO,CAAC,CAAiB;AAC/C,aAAa,mBAAO,CAAC,CAAQ;AAC7B,aAAa,mBAAO,CAAC,CAAQ;AAC7B,qBAAqB,mBAAO,CAAC,EAAgB;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qBAAqB;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uDAAuD,yBAAyB,EAAE;AAClF,sDAAsD,yBAAyB,EAAE;;AAEjF;AACA;AACA;AACA,0CAA0C,yBAAyB,EAAE;AACrE,2CAA2C,yBAAyB,EAAE;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mEAAmE;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,cAAc;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA,+CAA+C;AAC/C,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA,4BAA4B;AAC5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8BAA8B;AAC9B,uCAAuC,qCAAqC;AAC5E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kDAAkD,kBAAkB;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mFAAmF,wCAAwC;AAC3H;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,cAAc;AAC7C;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6BAA6B;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;AC78Ba;AACb;AACA;AACA;;;;;;;;ACHa;AACb;AACA;AACA;AACA,cAAc,gBAAgB,sCAAsC,iBAAiB,EAAE;AACvF,6BAA6B,uDAAuD;AACpF;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD;AACA,aAAa,mBAAO,CAAC,CAAQ;AAC7B,aAAa,mBAAO,CAAC,CAAQ;AAC7B,aAAa,mBAAO,CAAC,CAAQ;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,yBAAyB;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA,CAAC;;;;;;;;ACveY;AACb;AACA,aAAa,mBAAO,CAAC,CAAQ;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+CAA+C,wBAAwB;AACvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;ACtMa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA,0CAA0C,gBAAgB,iCAAiC,eAAe;AAC1G;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;ACpFa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;ACrHa;AACb;AACA;AACA;AACA,cAAc,gBAAgB,sCAAsC,iBAAiB,EAAE;AACvF,6BAA6B,uDAAuD;AACpF;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA,sBAAsB,mBAAO,CAAC,CAAiB;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;AC9Ja;AACb;AACA,aAAa,mBAAO,CAAC,CAAQ;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA,yEAAyE,aAAa,EAAE;AACxF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,uBAAuB;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C,uBAAuB;AACpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAiD,uBAAuB;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;ACtNa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iEAAiE,6BAA6B;AAC9F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uEAAuE,gBAAgB;AACvF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;AClNa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,yCAAyC,yBAAyB;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiB;AACjB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;;;;;;;;AC3Ga;AACb;AACA;AACA;AACA,cAAc,gBAAgB,sCAAsC,iBAAiB,EAAE;AACvF,6BAA6B,uDAAuD;AACpF;AACA;AACA;AACA;AACA,uBAAuB,sBAAsB;AAC7C;AACA;AACA,CAAC;AACD;AACA,aAAa,mBAAO,CAAC,CAAQ;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,cAAc;AAC7C,wCAAwC,yBAAyB;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,+BAA+B,cAAc;AAC7C,wCAAwC,yBAAyB;AACjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,aAAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,+BAA+B;AACvD;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","file":"tree.jquery.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 16);\n","\"use strict\";\nexports.__esModule = true;\nvar Position;\n(function (Position) {\n Position[Position[\"Before\"] = 1] = \"Before\";\n Position[Position[\"After\"] = 2] = \"After\";\n Position[Position[\"Inside\"] = 3] = \"Inside\";\n Position[Position[\"None\"] = 4] = \"None\";\n})(Position = exports.Position || (exports.Position = {}));\nvar positionNames = {\n before: Position.Before,\n after: Position.After,\n inside: Position.Inside,\n none: Position.None\n};\nexports.getPositionName = function (position) {\n for (var name_1 in positionNames) {\n if (positionNames.hasOwnProperty(name_1)) {\n if (positionNames[name_1] === position) {\n return name_1;\n }\n }\n }\n return \"\";\n};\nexports.getPosition = function (name) { return positionNames[name]; };\nvar Node = /** @class */ (function () {\n function Node(o, isRoot, nodeClass) {\n if (isRoot === void 0) { isRoot = false; }\n if (nodeClass === void 0) { nodeClass = Node; }\n this.name = \"\";\n this.setData(o);\n this.children = [];\n this.parent = null;\n if (isRoot) {\n this.idMapping = {};\n this.tree = this;\n this.nodeClass = nodeClass;\n }\n }\n /*\n Set the data of this node.\n\n setData(string): set the name of the node\n setdata(object): set attributes of the node\n\n Examples:\n setdata('node1')\n\n setData({ name: 'node1', id: 1});\n\n setData({ name: 'node2', id: 2, color: 'green'});\n\n * This is an internal function; it is not in the docs\n * Does not remove existing node values\n */\n Node.prototype.setData = function (o) {\n var _this = this;\n var setName = function (name) {\n if (name != null) {\n _this.name = name;\n }\n };\n if (!o) {\n return;\n }\n else if (typeof o !== \"object\") {\n setName(o);\n }\n else {\n for (var key in o) {\n if (o.hasOwnProperty(key)) {\n var value = o[key];\n if (key === \"label\") {\n // You can use the 'label' key instead of 'name'; this is a legacy feature\n setName(value);\n }\n else if (key !== \"children\") {\n // You can't update the children using this function\n this[key] = value;\n }\n }\n }\n }\n };\n /*\n Create tree from data.\n\n Structure of data is:\n [\n {\n name: 'node1',\n children: [\n { name: 'child1' },\n { name: 'child2' }\n ]\n },\n {\n name: 'node2'\n }\n ]\n */\n Node.prototype.loadFromData = function (data) {\n this.removeChildren();\n for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {\n var o = data_1[_i];\n var node = new this.tree.nodeClass(o);\n this.addChild(node);\n if (typeof o === \"object\" && o[\"children\"]) {\n node.loadFromData(o[\"children\"]);\n }\n }\n };\n /*\n Add child.\n\n tree.addChild(\n new Node('child1')\n );\n */\n Node.prototype.addChild = function (node) {\n this.children.push(node);\n node._setParent(this);\n };\n /*\n Add child at position. Index starts at 0.\n\n tree.addChildAtPosition(\n new Node('abc'),\n 1\n );\n */\n Node.prototype.addChildAtPosition = function (node, index) {\n this.children.splice(index, 0, node);\n node._setParent(this);\n };\n /*\n Remove child. This also removes the children of the node.\n\n tree.removeChild(tree.children[0]);\n */\n Node.prototype.removeChild = function (node) {\n // remove children from the index\n node.removeChildren();\n this._removeChild(node);\n };\n /*\n Get child index.\n\n var index = getChildIndex(node);\n */\n Node.prototype.getChildIndex = function (node) {\n return jQuery.inArray(node, this.children);\n };\n /*\n Does the tree have children?\n\n if (tree.hasChildren()) {\n //\n }\n */\n Node.prototype.hasChildren = function () {\n return this.children.length !== 0;\n };\n Node.prototype.isFolder = function () {\n return this.hasChildren() || this.load_on_demand;\n };\n /*\n Iterate over all the nodes in the tree.\n\n Calls callback with (node, level).\n\n The callback must return true to continue the iteration on current node.\n\n tree.iterate(\n function(node, level) {\n console.log(node.name);\n\n // stop iteration after level 2\n return (level <= 2);\n }\n );\n\n */\n Node.prototype.iterate = function (callback) {\n var _iterate = function (node, level) {\n if (node.children) {\n for (var _i = 0, _a = node.children; _i < _a.length; _i++) {\n var child = _a[_i];\n var result = callback(child, level);\n if (result && child.hasChildren()) {\n _iterate(child, level + 1);\n }\n }\n }\n };\n _iterate(this, 0);\n };\n /*\n Move node relative to another node.\n\n Argument position: Position.BEFORE, Position.AFTER or Position.Inside\n\n // move node1 after node2\n tree.moveNode(node1, node2, Position.AFTER);\n */\n Node.prototype.moveNode = function (movedNode, targetNode, position) {\n if (!movedNode.parent || movedNode.isParentOf(targetNode)) {\n // - Node is parent of target node\n // - Or, parent is empty\n return;\n }\n else {\n movedNode.parent._removeChild(movedNode);\n if (position === Position.After) {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(movedNode, targetNode.parent.getChildIndex(targetNode) + 1);\n }\n }\n else if (position === Position.Before) {\n if (targetNode.parent) {\n targetNode.parent.addChildAtPosition(movedNode, targetNode.parent.getChildIndex(targetNode));\n }\n }\n else if (position === Position.Inside) {\n // move inside as first child\n targetNode.addChildAtPosition(movedNode, 0);\n }\n }\n };\n /*\n Get the tree as data.\n */\n Node.prototype.getData = function (includeParent) {\n if (includeParent === void 0) { includeParent = false; }\n function getDataFromNodes(nodes) {\n return nodes.map(function (node) {\n var tmpNode = {};\n for (var k in node) {\n if ([\"parent\", \"children\", \"element\", \"tree\"].indexOf(k) ===\n -1 &&\n Object.prototype.hasOwnProperty.call(node, k)) {\n var v = node[k];\n tmpNode[k] = v;\n }\n }\n if (node.hasChildren()) {\n tmpNode[\"children\"] = getDataFromNodes(node.children);\n }\n return tmpNode;\n });\n }\n if (includeParent) {\n return getDataFromNodes([this]);\n }\n else {\n return getDataFromNodes(this.children);\n }\n };\n Node.prototype.getNodeByName = function (name) {\n return this.getNodeByCallback(function (node) { return node.name === name; });\n };\n Node.prototype.getNodeByCallback = function (callback) {\n var result = null;\n this.iterate(function (node) {\n if (callback(node)) {\n result = node;\n return false;\n }\n else {\n return true;\n }\n });\n return result;\n };\n Node.prototype.addAfter = function (nodeInfo) {\n if (!this.parent) {\n return null;\n }\n else {\n var node = new this.tree.nodeClass(nodeInfo);\n var child_index = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, child_index + 1);\n if (typeof nodeInfo === \"object\" &&\n nodeInfo[\"children\"] &&\n nodeInfo[\"children\"].length) {\n node.loadFromData(nodeInfo[\"children\"]);\n }\n return node;\n }\n };\n Node.prototype.addBefore = function (nodeInfo) {\n if (!this.parent) {\n return null;\n }\n else {\n var node = new this.tree.nodeClass(nodeInfo);\n var child_index = this.parent.getChildIndex(this);\n this.parent.addChildAtPosition(node, child_index);\n if (typeof nodeInfo === \"object\" &&\n nodeInfo[\"children\"] &&\n nodeInfo[\"children\"].length) {\n node.loadFromData(nodeInfo[\"children\"]);\n }\n return node;\n }\n };\n Node.prototype.addParent = function (nodeInfo) {\n if (!this.parent) {\n return null;\n }\n else {\n var newParent = new this.tree.nodeClass(nodeInfo);\n newParent._setParent(this.tree);\n var originalParent = this.parent;\n for (var _i = 0, _a = originalParent.children; _i < _a.length; _i++) {\n var child = _a[_i];\n newParent.addChild(child);\n }\n originalParent.children = [];\n originalParent.addChild(newParent);\n return newParent;\n }\n };\n Node.prototype.remove = function () {\n if (this.parent) {\n this.parent.removeChild(this);\n this.parent = null;\n }\n };\n Node.prototype.append = function (nodeInfo) {\n var node = new this.tree.nodeClass(nodeInfo);\n this.addChild(node);\n if (typeof nodeInfo === \"object\" &&\n nodeInfo[\"children\"] &&\n nodeInfo[\"children\"].length) {\n node.loadFromData(nodeInfo[\"children\"]);\n }\n return node;\n };\n Node.prototype.prepend = function (nodeInfo) {\n var node = new this.tree.nodeClass(nodeInfo);\n this.addChildAtPosition(node, 0);\n if (typeof nodeInfo === \"object\" &&\n nodeInfo[\"children\"] &&\n nodeInfo[\"children\"].length) {\n node.loadFromData(nodeInfo[\"children\"]);\n }\n return node;\n };\n Node.prototype.isParentOf = function (node) {\n var parent = node.parent;\n while (parent) {\n if (parent === this) {\n return true;\n }\n parent = parent.parent;\n }\n return false;\n };\n Node.prototype.getLevel = function () {\n var level = 0;\n var node = this;\n while (node.parent) {\n level += 1;\n node = node.parent;\n }\n return level;\n };\n Node.prototype.getNodeById = function (nodeId) {\n return this.idMapping[nodeId];\n };\n Node.prototype.addNodeToIndex = function (node) {\n if (node.id != null) {\n this.idMapping[node.id] = node;\n }\n };\n Node.prototype.removeNodeFromIndex = function (node) {\n if (node.id != null) {\n delete this.idMapping[node.id];\n }\n };\n Node.prototype.removeChildren = function () {\n var _this = this;\n this.iterate(function (child) {\n _this.tree.removeNodeFromIndex(child);\n return true;\n });\n this.children = [];\n };\n Node.prototype.getPreviousSibling = function () {\n if (!this.parent) {\n return null;\n }\n else {\n var previousIndex = this.parent.getChildIndex(this) - 1;\n if (previousIndex >= 0) {\n return this.parent.children[previousIndex];\n }\n else {\n return null;\n }\n }\n };\n Node.prototype.getNextSibling = function () {\n if (!this.parent) {\n return null;\n }\n else {\n var nextIndex = this.parent.getChildIndex(this) + 1;\n if (nextIndex < this.parent.children.length) {\n return this.parent.children[nextIndex];\n }\n else {\n return null;\n }\n }\n };\n Node.prototype.getNodesByProperty = function (key, value) {\n return this.filter(function (node) { return node[key] === value; });\n };\n Node.prototype.filter = function (f) {\n var result = [];\n this.iterate(function (node) {\n if (f(node)) {\n result.push(node);\n }\n return true;\n });\n return result;\n };\n Node.prototype.getNextNode = function (includeChildren) {\n if (includeChildren === void 0) { includeChildren = true; }\n if (includeChildren && this.hasChildren() && this.is_open) {\n // First child\n return this.children[0];\n }\n else {\n if (!this.parent) {\n return null;\n }\n else {\n var nextSibling = this.getNextSibling();\n if (nextSibling) {\n // Next sibling\n return nextSibling;\n }\n else {\n // Next node of parent\n return this.parent.getNextNode(false);\n }\n }\n }\n };\n Node.prototype.getPreviousNode = function () {\n if (!this.parent) {\n return null;\n }\n else {\n var previousSibling = this.getPreviousSibling();\n if (previousSibling) {\n if (!previousSibling.hasChildren() ||\n !previousSibling.is_open) {\n // Previous sibling\n return previousSibling;\n }\n else {\n // Last child of previous sibling\n return previousSibling.getLastChild();\n }\n }\n else {\n return this.getParent();\n }\n }\n };\n Node.prototype.getParent = function () {\n // Return parent except if it is the root node\n if (!this.parent) {\n return null;\n }\n else if (!this.parent.parent) {\n // Root node -> null\n return null;\n }\n else {\n return this.parent;\n }\n };\n Node.prototype.getLastChild = function () {\n if (!this.hasChildren()) {\n return null;\n }\n else {\n var lastChild = this.children[this.children.length - 1];\n if (!lastChild.hasChildren() || !lastChild.is_open) {\n return lastChild;\n }\n else {\n return lastChild.getLastChild();\n }\n }\n };\n // Init Node from data without making it the root of the tree\n Node.prototype.initFromData = function (data) {\n var _this = this;\n var addNode = function (nodeData) {\n _this.setData(nodeData);\n if (nodeData[\"children\"]) {\n addChildren(nodeData[\"children\"]);\n }\n };\n var addChildren = function (childrenData) {\n for (var _i = 0, childrenData_1 = childrenData; _i < childrenData_1.length; _i++) {\n var child = childrenData_1[_i];\n var node = new _this.tree.nodeClass(\"\");\n node.initFromData(child);\n _this.addChild(node);\n }\n };\n addNode(data);\n };\n Node.prototype._setParent = function (parent) {\n this.parent = parent;\n this.tree = parent.tree;\n this.tree.addNodeToIndex(this);\n };\n Node.prototype._removeChild = function (node) {\n this.children.splice(this.getChildIndex(node), 1);\n this.tree.removeNodeFromIndex(node);\n };\n return Node;\n}());\nexports.Node = Node;\n","\"use strict\";\nexports.__esModule = true;\nexports.isInt = function (n) { return typeof n === \"number\" && n % 1 === 0; };\nexports.isFunction = function (v) { return typeof v === \"function\"; };\n// Escape a string for HTML interpolation; copied from underscore js\nexports.htmlEscape = function (text) {\n return (\"\" + text)\n .replace(/&/g, \"&\")\n .replace(//g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\")\n .replace(/\\//g, \"/\");\n};\nexports.getBoolString = function (value) { return (value ? \"true\" : \"false\"); };\n","module.exports = jQuery;","\"use strict\";\nexports.__esModule = true;\nvar SimpleWidget = /** @class */ (function () {\n function SimpleWidget(el, options) {\n this.$el = jQuery(el);\n var defaults = this.constructor.defaults;\n this.options = jQuery.extend({}, defaults, options);\n }\n SimpleWidget.register = function (widgetClass, widgetName) {\n var getDataKey = function () { return \"simple_widget_\" + widgetName; };\n function getWidgetData(el, dataKey) {\n var widget = jQuery.data(el, dataKey);\n if (widget && widget instanceof SimpleWidget) {\n return widget;\n }\n else {\n return null;\n }\n }\n function createWidget($el, options) {\n var dataKey = getDataKey();\n for (var _i = 0, _a = $el.get(); _i < _a.length; _i++) {\n var el = _a[_i];\n var existingWidget = getWidgetData(el, dataKey);\n if (!existingWidget) {\n var widget = new widgetClass(el, options);\n if (!jQuery.data(el, dataKey)) {\n jQuery.data(el, dataKey, widget);\n }\n // Call init after setting data, so we can call methods\n widget._init();\n }\n }\n return $el;\n }\n function destroyWidget($el) {\n var dataKey = getDataKey();\n for (var _i = 0, _a = $el.get(); _i < _a.length; _i++) {\n var el = _a[_i];\n var widget = getWidgetData(el, dataKey);\n if (widget) {\n widget.destroy();\n }\n jQuery.removeData(el, dataKey);\n }\n }\n function callFunction($el, functionName, args) {\n var result = null;\n for (var _i = 0, _a = $el.get(); _i < _a.length; _i++) {\n var el = _a[_i];\n var widget = jQuery.data(el, getDataKey());\n if (widget && widget instanceof SimpleWidget) {\n var widgetFunction = widget[functionName];\n if (widgetFunction &&\n typeof widgetFunction === \"function\") {\n result = widgetFunction.apply(widget, args);\n }\n }\n }\n return result;\n }\n // tslint:disable-next-line: only-arrow-functions\n jQuery.fn[widgetName] = function (argument1) {\n var args = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n args[_i - 1] = arguments[_i];\n }\n var $el = this;\n if (argument1 === undefined || typeof argument1 === \"object\") {\n var options = argument1;\n return createWidget($el, options);\n }\n else if (typeof argument1 === \"string\" && argument1[0] !== \"_\") {\n var functionName = argument1;\n if (functionName === \"destroy\") {\n return destroyWidget($el);\n }\n else if (functionName === \"get_widget_class\") {\n return widgetClass;\n }\n else {\n return callFunction($el, functionName, args);\n }\n }\n };\n };\n SimpleWidget.prototype.destroy = function () {\n this._deinit();\n };\n SimpleWidget.prototype._init = function () {\n //\n };\n SimpleWidget.prototype._deinit = function () {\n //\n };\n SimpleWidget.defaults = {};\n return SimpleWidget;\n}());\nexports[\"default\"] = SimpleWidget;\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nexports.__esModule = true;\nvar version_1 = require(\"./version\");\nvar jQuery = require(\"jquery\");\nvar drag_and_drop_handler_1 = require(\"./drag_and_drop_handler\");\nvar elements_renderer_1 = require(\"./elements_renderer\");\nvar data_loader_1 = require(\"./data_loader\");\nvar key_handler_1 = require(\"./key_handler\");\nvar mouse_widget_1 = require(\"./mouse.widget\");\nvar save_state_handler_1 = require(\"./save_state_handler\");\nvar scroll_handler_1 = require(\"./scroll_handler\");\nvar select_node_handler_1 = require(\"./select_node_handler\");\nvar simple_widget_1 = require(\"./simple.widget\");\nvar node_1 = require(\"./node\");\nvar util_1 = require(\"./util\");\nvar node_element_1 = require(\"./node_element\");\nvar NODE_PARAM_IS_EMPTY = \"Node parameter is empty\";\nvar PARAM_IS_EMPTY = \"Parameter is empty: \";\nvar JqTreeWidget = /** @class */ (function (_super) {\n __extends(JqTreeWidget, _super);\n function JqTreeWidget() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._handleClick = function (e) {\n var clickTarget = _this._getClickTarget(e.target);\n if (clickTarget) {\n if (clickTarget.type === \"button\") {\n _this.toggle(clickTarget.node, _this.options.slide);\n e.preventDefault();\n e.stopPropagation();\n }\n else if (clickTarget.type === \"label\") {\n var node = clickTarget.node;\n var event_1 = _this._triggerEvent(\"tree.click\", {\n node: node,\n click_event: e\n });\n if (!event_1.isDefaultPrevented()) {\n _this._selectNode(node);\n }\n }\n }\n };\n _this._handleDblclick = function (e) {\n var clickTarget = _this._getClickTarget(e.target);\n if (clickTarget && clickTarget.type === \"label\") {\n _this._triggerEvent(\"tree.dblclick\", {\n node: clickTarget.node,\n click_event: e\n });\n }\n };\n _this._handleContextmenu = function (e) {\n var $div = jQuery(e.target).closest(\"ul.jqtree-tree .jqtree-element\");\n if ($div.length) {\n var node = _this._getNode($div);\n if (node) {\n e.preventDefault();\n e.stopPropagation();\n _this._triggerEvent(\"tree.contextmenu\", {\n node: node,\n click_event: e\n });\n return false;\n }\n }\n return null;\n };\n return _this;\n }\n JqTreeWidget.prototype.toggle = function (node, slideParam) {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n var slide = slideParam == null ? this.options.slide : slideParam;\n if (node.is_open) {\n this.closeNode(node, slide);\n }\n else {\n this.openNode(node, slide);\n }\n return this.element;\n };\n JqTreeWidget.prototype.getTree = function () {\n return this.tree;\n };\n JqTreeWidget.prototype.selectNode = function (node, optionsParam) {\n this._selectNode(node, optionsParam);\n return this.element;\n };\n JqTreeWidget.prototype.getSelectedNode = function () {\n if (this.selectNodeHandler) {\n return this.selectNodeHandler.getSelectedNode();\n }\n else {\n return false;\n }\n };\n JqTreeWidget.prototype.toJson = function () {\n return JSON.stringify(this.tree.getData());\n };\n JqTreeWidget.prototype.loadData = function (data, parent_node) {\n this._loadData(data, parent_node);\n return this.element;\n };\n /*\n signatures:\n - loadDataFromUrl(url, parent_node=null, on_finished=null)\n loadDataFromUrl('/my_data');\n loadDataFromUrl('/my_data', node1);\n loadDataFromUrl('/my_data', node1, function() { console.log('finished'); });\n loadDataFromUrl('/my_data', null, function() { console.log('finished'); });\n\n - loadDataFromUrl(parent_node=null, on_finished=null)\n loadDataFromUrl();\n loadDataFromUrl(node1);\n loadDataFromUrl(null, function() { console.log('finished'); });\n loadDataFromUrl(node1, function() { console.log('finished'); });\n */\n JqTreeWidget.prototype.loadDataFromUrl = function (param1, param2, param3) {\n if (typeof param1 === \"string\") {\n // first parameter is url\n this._loadDataFromUrl(param1, param2, param3);\n }\n else {\n // first parameter is not url\n this._loadDataFromUrl(null, param1, param2);\n }\n return this.element;\n };\n JqTreeWidget.prototype.reload = function (onFinished) {\n this._loadDataFromUrl(null, null, onFinished);\n return this.element;\n };\n JqTreeWidget.prototype.getNodeById = function (nodeId) {\n return this.tree.getNodeById(nodeId);\n };\n JqTreeWidget.prototype.getNodeByName = function (name) {\n return this.tree.getNodeByName(name);\n };\n JqTreeWidget.prototype.getNodesByProperty = function (key, value) {\n return this.tree.getNodesByProperty(key, value);\n };\n JqTreeWidget.prototype.getNodeByHtmlElement = function (element) {\n return this._getNode(jQuery(element));\n };\n JqTreeWidget.prototype.getNodeByCallback = function (callback) {\n return this.tree.getNodeByCallback(callback);\n };\n JqTreeWidget.prototype.openNode = function (node, param1, param2) {\n var _this = this;\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n var parseParams = function () {\n var onFinished;\n var slide;\n if (util_1.isFunction(param1)) {\n onFinished = param1;\n slide = null;\n }\n else {\n slide = param1;\n onFinished = param2;\n }\n if (slide == null) {\n slide = _this.options.slide;\n }\n return [slide, onFinished];\n };\n var _a = parseParams(), slide = _a[0], onFinished = _a[1];\n this._openNode(node, slide, onFinished);\n return this.element;\n };\n JqTreeWidget.prototype.closeNode = function (node, slideParam) {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n var slide = slideParam == null ? this.options.slide : slideParam;\n if (node.isFolder()) {\n new node_element_1.FolderElement(node, this).close(slide, this.options.animationSpeed);\n this._saveState();\n }\n return this.element;\n };\n JqTreeWidget.prototype.isDragging = function () {\n if (this.dndHandler) {\n return this.dndHandler.isDragging;\n }\n else {\n return false;\n }\n };\n JqTreeWidget.prototype.refreshHitAreas = function () {\n if (this.dndHandler) {\n this.dndHandler.refresh();\n }\n return this.element;\n };\n JqTreeWidget.prototype.addNodeAfter = function (newNodeInfo, existingNode) {\n var newNode = existingNode.addAfter(newNodeInfo);\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n return newNode;\n };\n JqTreeWidget.prototype.addNodeBefore = function (newNodeInfo, existingNode) {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n var newNode = existingNode.addBefore(newNodeInfo);\n if (newNode) {\n this._refreshElements(existingNode.parent);\n }\n return newNode;\n };\n JqTreeWidget.prototype.addParentNode = function (newNodeInfo, existingNode) {\n if (!existingNode) {\n throw Error(PARAM_IS_EMPTY + \"existingNode\");\n }\n var newNode = existingNode.addParent(newNodeInfo);\n if (newNode) {\n this._refreshElements(newNode.parent);\n }\n return newNode;\n };\n JqTreeWidget.prototype.removeNode = function (inode) {\n if (!inode) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n var node = inode;\n if (node.parent && this.selectNodeHandler) {\n this.selectNodeHandler.removeFromSelection(node, true); // including children\n node.remove();\n this._refreshElements(node.parent);\n }\n return this.element;\n };\n JqTreeWidget.prototype.appendNode = function (newNodeInfo, parentNodeParam) {\n var parentNode = parentNodeParam || this.tree;\n var node = parentNode.append(newNodeInfo);\n this._refreshElements(parentNode);\n return node;\n };\n JqTreeWidget.prototype.prependNode = function (newNodeInfo, parentNodeParam) {\n var parentNode = !parentNodeParam\n ? this.tree\n : parentNodeParam;\n var node = parentNode.prepend(newNodeInfo);\n this._refreshElements(parentNode);\n return node;\n };\n JqTreeWidget.prototype.updateNode = function (node, data) {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n var id_is_changed = data.id && data.id !== node.id;\n if (id_is_changed) {\n this.tree.removeNodeFromIndex(node);\n }\n node.setData(data);\n if (id_is_changed) {\n this.tree.addNodeToIndex(node);\n }\n if (typeof data === \"object\" && data.children) {\n node.removeChildren();\n if (data.children.length) {\n node.loadFromData(data.children);\n }\n }\n this._refreshElements(node);\n this._selectCurrentNode();\n return this.element;\n };\n JqTreeWidget.prototype.moveNode = function (node, targetNode, position) {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n if (!targetNode) {\n throw Error(PARAM_IS_EMPTY + \"targetNode\");\n }\n var positionIndex = node_1.getPosition(position);\n this.tree.moveNode(node, targetNode, positionIndex);\n this._refreshElements(null);\n return this.element;\n };\n JqTreeWidget.prototype.getStateFromStorage = function () {\n if (this.saveStateHandler) {\n return this.saveStateHandler.getStateFromStorage();\n }\n };\n JqTreeWidget.prototype.addToSelection = function (inode, mustSetFocus) {\n if (!inode) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n var node = inode;\n if (this.selectNodeHandler) {\n this.selectNodeHandler.addToSelection(node);\n this._getNodeElementForNode(node).select(mustSetFocus === undefined ? true : mustSetFocus);\n this._saveState();\n }\n return this.element;\n };\n JqTreeWidget.prototype.getSelectedNodes = function () {\n if (!this.selectNodeHandler) {\n return [];\n }\n else {\n return this.selectNodeHandler.getSelectedNodes();\n }\n };\n JqTreeWidget.prototype.isNodeSelected = function (node) {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n if (!this.selectNodeHandler) {\n return false;\n }\n else {\n return this.selectNodeHandler.isNodeSelected(node);\n }\n };\n JqTreeWidget.prototype.removeFromSelection = function (node) {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n if (this.selectNodeHandler) {\n this.selectNodeHandler.removeFromSelection(node);\n this._getNodeElementForNode(node).deselect();\n this._saveState();\n }\n return this.element;\n };\n JqTreeWidget.prototype.scrollToNode = function (node) {\n if (!node) {\n throw Error(NODE_PARAM_IS_EMPTY);\n }\n if (this.scrollHandler) {\n var node_offset = jQuery(node.element).offset();\n var node_top = node_offset ? node_offset.top : 0;\n var tree_offset = this.$el.offset();\n var tree_top = tree_offset ? tree_offset.top : 0;\n var top_1 = node_top - tree_top;\n this.scrollHandler.scrollToY(top_1);\n }\n return this.element;\n };\n JqTreeWidget.prototype.getState = function () {\n if (this.saveStateHandler) {\n return this.saveStateHandler.getState();\n }\n };\n JqTreeWidget.prototype.setState = function (state) {\n if (this.saveStateHandler) {\n this.saveStateHandler.setInitialState(state);\n this._refreshElements(null);\n }\n return this.element;\n };\n JqTreeWidget.prototype.setOption = function (option, value) {\n this.options[option] = value;\n return this.element;\n };\n JqTreeWidget.prototype.moveDown = function () {\n if (this.keyHandler) {\n this.keyHandler.moveDown();\n }\n return this.element;\n };\n JqTreeWidget.prototype.moveUp = function () {\n if (this.keyHandler) {\n this.keyHandler.moveUp();\n }\n return this.element;\n };\n JqTreeWidget.prototype.getVersion = function () {\n return version_1[\"default\"];\n };\n JqTreeWidget.prototype.testGenerateHitAreas = function (movingNode) {\n if (!this.dndHandler) {\n return [];\n }\n else {\n this.dndHandler.currentItem = this._getNodeElementForNode(movingNode);\n this.dndHandler.generateHitAreas();\n return this.dndHandler.hitAreas;\n }\n };\n JqTreeWidget.prototype._triggerEvent = function (eventName, values) {\n var event = jQuery.Event(eventName);\n jQuery.extend(event, values);\n this.element.trigger(event);\n return event;\n };\n JqTreeWidget.prototype._openNode = function (node, slide, onFinished) {\n var _this = this;\n if (slide === void 0) { slide = true; }\n var doOpenNode = function (_node, _slide, _onFinished) {\n var folder_element = new node_element_1.FolderElement(_node, _this);\n folder_element.open(_onFinished, _slide, _this.options.animationSpeed);\n };\n if (node.isFolder()) {\n if (node.load_on_demand) {\n this._loadFolderOnDemand(node, slide, onFinished);\n }\n else {\n var parent_1 = node.parent;\n while (parent_1) {\n // nb: do not open root element\n if (parent_1.parent) {\n doOpenNode(parent_1, false, null);\n }\n parent_1 = parent_1.parent;\n }\n doOpenNode(node, slide, onFinished);\n this._saveState();\n }\n }\n };\n /*\n Redraw the tree or part of the tree.\n from_node: redraw this subtree\n */\n JqTreeWidget.prototype._refreshElements = function (fromNode) {\n this.renderer.render(fromNode);\n this._triggerEvent(\"tree.refresh\");\n };\n JqTreeWidget.prototype._getNodeElementForNode = function (node) {\n if (node.isFolder()) {\n return new node_element_1.FolderElement(node, this);\n }\n else {\n return new node_element_1.NodeElement(node, this);\n }\n };\n JqTreeWidget.prototype._getNodeElement = function ($element) {\n var node = this._getNode($element);\n if (node) {\n return this._getNodeElementForNode(node);\n }\n else {\n return null;\n }\n };\n JqTreeWidget.prototype._containsElement = function (element) {\n var node = this._getNode(jQuery(element));\n return node != null && node.tree === this.tree;\n };\n JqTreeWidget.prototype._getScrollLeft = function () {\n return (this.scrollHandler && this.scrollHandler.getScrollLeft()) || 0;\n };\n JqTreeWidget.prototype._init = function () {\n _super.prototype._init.call(this);\n this.element = this.$el;\n this.mouseDelay = 300;\n this.isInitialized = false;\n this.options.rtl = this._getRtlOption();\n if (this.options.closedIcon === null) {\n this.options.closedIcon = this._getDefaultClosedIcon();\n }\n this.renderer = new elements_renderer_1[\"default\"](this);\n this.dataLoader = new data_loader_1[\"default\"](this);\n if (save_state_handler_1[\"default\"] != null) {\n this.saveStateHandler = new save_state_handler_1[\"default\"](this);\n }\n else {\n this.options.saveState = false;\n }\n if (select_node_handler_1[\"default\"] != null) {\n this.selectNodeHandler = new select_node_handler_1[\"default\"](this);\n }\n if (drag_and_drop_handler_1.DragAndDropHandler != null) {\n this.dndHandler = new drag_and_drop_handler_1.DragAndDropHandler(this);\n }\n else {\n this.options.dragAndDrop = false;\n }\n if (scroll_handler_1[\"default\"] != null) {\n this.scrollHandler = new scroll_handler_1[\"default\"](this);\n }\n if (key_handler_1[\"default\"] != null && select_node_handler_1[\"default\"] != null) {\n this.keyHandler = new key_handler_1[\"default\"](this);\n }\n this._initData();\n this.element.click(this._handleClick);\n this.element.dblclick(this._handleDblclick);\n if (this.options.useContextMenu) {\n this.element.on(\"contextmenu\", this._handleContextmenu);\n }\n };\n JqTreeWidget.prototype._deinit = function () {\n this.element.empty();\n this.element.off();\n if (this.keyHandler) {\n this.keyHandler.deinit();\n }\n this.tree = new node_1.Node({}, true);\n _super.prototype._deinit.call(this);\n };\n JqTreeWidget.prototype._mouseCapture = function (positionInfo) {\n if (this.options.dragAndDrop && this.dndHandler) {\n return this.dndHandler.mouseCapture(positionInfo);\n }\n else {\n return false;\n }\n };\n JqTreeWidget.prototype._mouseStart = function (positionInfo) {\n if (this.options.dragAndDrop && this.dndHandler) {\n return this.dndHandler.mouseStart(positionInfo);\n }\n else {\n return false;\n }\n };\n JqTreeWidget.prototype._mouseDrag = function (positionInfo) {\n if (this.options.dragAndDrop && this.dndHandler) {\n var result = this.dndHandler.mouseDrag(positionInfo);\n if (this.scrollHandler) {\n this.scrollHandler.checkScrolling();\n }\n return result;\n }\n else {\n return false;\n }\n };\n JqTreeWidget.prototype._mouseStop = function (positionInfo) {\n if (this.options.dragAndDrop && this.dndHandler) {\n return this.dndHandler.mouseStop(positionInfo);\n }\n else {\n return false;\n }\n };\n JqTreeWidget.prototype._initData = function () {\n if (this.options.data) {\n this._loadData(this.options.data, null);\n }\n else {\n var data_url = this._getDataUrlInfo(null);\n if (data_url) {\n this._loadDataFromUrl(null, null, null);\n }\n else {\n this._loadData([], null);\n }\n }\n };\n JqTreeWidget.prototype._getDataUrlInfo = function (node) {\n var _this = this;\n var data_url = this.options.dataUrl || this.element.data(\"url\");\n var getUrlFromString = function () {\n var url_info = { url: data_url };\n setUrlInfoData(url_info);\n return url_info;\n };\n var setUrlInfoData = function (url_info) {\n if (node && node.id) {\n // Load on demand of a subtree; add node parameter\n var data = { node: node.id };\n // tslint:disable-next-line: no-string-literal\n url_info[\"data\"] = data;\n }\n else {\n // Add selected_node parameter\n var selected_node_id = _this._getNodeIdToBeSelected();\n if (selected_node_id) {\n var data = { selected_node: selected_node_id };\n // tslint:disable-next-line: no-string-literal\n url_info[\"data\"] = data;\n }\n }\n };\n if (typeof data_url === \"function\") {\n return data_url(node);\n }\n else if (typeof data_url === \"string\") {\n return getUrlFromString();\n }\n else if (typeof data_url === \"object\") {\n setUrlInfoData(data_url);\n return data_url;\n }\n else {\n return data_url;\n }\n };\n JqTreeWidget.prototype._getNodeIdToBeSelected = function () {\n if (this.options.saveState && this.saveStateHandler) {\n return this.saveStateHandler.getNodeIdToBeSelected();\n }\n else {\n return null;\n }\n };\n JqTreeWidget.prototype._initTree = function (data) {\n var _this = this;\n var doInit = function () {\n if (!_this.isInitialized) {\n _this.isInitialized = true;\n _this._triggerEvent(\"tree.init\");\n }\n };\n this.tree = new this.options.nodeClass(null, true, this.options.nodeClass);\n if (this.selectNodeHandler) {\n this.selectNodeHandler.clear();\n }\n this.tree.loadFromData(data);\n var mustLoadOnDemand = this._setInitialState();\n this._refreshElements(null);\n if (!mustLoadOnDemand) {\n doInit();\n }\n else {\n // Load data on demand and then init the tree\n this._setInitialStateOnDemand(doInit);\n }\n };\n // Set initial state, either by restoring the state or auto-opening nodes\n // result: must load nodes on demand?\n JqTreeWidget.prototype._setInitialState = function () {\n var _this = this;\n var restoreState = function () {\n // result: is state restored, must load on demand?\n if (!(_this.options.saveState && _this.saveStateHandler)) {\n return [false, false];\n }\n else {\n var state = _this.saveStateHandler.getStateFromStorage();\n if (!state) {\n return [false, false];\n }\n else {\n var mustLoadOnDemand_1 = _this.saveStateHandler.setInitialState(state);\n // return true: the state is restored\n return [true, mustLoadOnDemand_1];\n }\n }\n };\n var autoOpenNodes = function () {\n // result: must load on demand?\n if (_this.options.autoOpen === false) {\n return false;\n }\n var max_level = _this._getAutoOpenMaxLevel();\n var mustLoadOnDemand = false;\n _this.tree.iterate(function (node, level) {\n if (node.load_on_demand) {\n mustLoadOnDemand = true;\n return false;\n }\n else if (!node.hasChildren()) {\n return false;\n }\n else {\n node.is_open = true;\n return level !== max_level;\n }\n });\n return mustLoadOnDemand;\n };\n // tslint:disable-next-line: prefer-const\n var _a = restoreState(), isRestored = _a[0], mustLoadOnDemand = _a[1];\n if (!isRestored) {\n mustLoadOnDemand = autoOpenNodes();\n }\n return mustLoadOnDemand;\n };\n // Set the initial state for nodes that are loaded on demand\n // Call cb_finished when done\n JqTreeWidget.prototype._setInitialStateOnDemand = function (cbFinished) {\n var _this = this;\n var restoreState = function () {\n if (!(_this.options.saveState && _this.saveStateHandler)) {\n return false;\n }\n else {\n var state = _this.saveStateHandler.getStateFromStorage();\n if (!state) {\n return false;\n }\n else {\n _this.saveStateHandler.setInitialStateOnDemand(state, cbFinished);\n return true;\n }\n }\n };\n var autoOpenNodes = function () {\n var maxLevel = _this._getAutoOpenMaxLevel();\n var loadingCount = 0;\n var loadAndOpenNode = function (node) {\n loadingCount += 1;\n _this._openNode(node, false, function () {\n loadingCount -= 1;\n openNodes();\n });\n };\n var openNodes = function () {\n _this.tree.iterate(function (node, level) {\n if (node.load_on_demand) {\n if (!node.is_loading) {\n loadAndOpenNode(node);\n }\n return false;\n }\n else {\n _this._openNode(node, false, null);\n return level !== maxLevel;\n }\n });\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n openNodes();\n };\n if (!restoreState()) {\n autoOpenNodes();\n }\n };\n JqTreeWidget.prototype._getAutoOpenMaxLevel = function () {\n if (this.options.autoOpen === true) {\n return -1;\n }\n else {\n return parseInt(this.options.autoOpen, 10);\n }\n };\n JqTreeWidget.prototype._getClickTarget = function (element) {\n var $target = jQuery(element);\n var $button = $target.closest(\".jqtree-toggler\");\n if ($button.length) {\n var node = this._getNode($button);\n if (node) {\n return {\n type: \"button\",\n node: node\n };\n }\n }\n else {\n var $el = $target.closest(\".jqtree-element\");\n if ($el.length) {\n var node = this._getNode($el);\n if (node) {\n return {\n type: \"label\",\n node: node\n };\n }\n }\n }\n return null;\n };\n JqTreeWidget.prototype._getNode = function ($element) {\n var $li = $element.closest(\"li.jqtree_common\");\n if ($li.length === 0) {\n return null;\n }\n else {\n return $li.data(\"node\");\n }\n };\n JqTreeWidget.prototype._saveState = function () {\n if (this.options.saveState && this.saveStateHandler) {\n this.saveStateHandler.saveState();\n }\n };\n JqTreeWidget.prototype._selectCurrentNode = function () {\n var node = this.getSelectedNode();\n if (node) {\n var node_element = this._getNodeElementForNode(node);\n if (node_element) {\n node_element.select(true);\n }\n }\n };\n JqTreeWidget.prototype._deselectCurrentNode = function () {\n var node = this.getSelectedNode();\n if (node) {\n this.removeFromSelection(node);\n }\n };\n JqTreeWidget.prototype._getDefaultClosedIcon = function () {\n if (this.options.rtl) {\n // triangle to the left\n return \"◀\";\n }\n else {\n // triangle to the right\n return \"►\";\n }\n };\n JqTreeWidget.prototype._getRtlOption = function () {\n if (this.options.rtl != null) {\n return this.options.rtl;\n }\n else {\n var data_rtl = this.element.data(\"rtl\");\n if (data_rtl != null && data_rtl !== false) {\n return true;\n }\n else {\n return false;\n }\n }\n };\n JqTreeWidget.prototype._selectNode = function (inode, optionsParam) {\n var _this = this;\n if (!this.selectNodeHandler) {\n return;\n }\n var defaultOptions = { mustSetFocus: true, mustToggle: true };\n var selectOptions = __assign({}, defaultOptions, (optionsParam || {}));\n var canSelect = function () {\n if (_this.options.onCanSelectNode) {\n return (_this.options.selectable &&\n _this.options.onCanSelectNode(inode));\n }\n else {\n return _this.options.selectable;\n }\n };\n var openParents = function () {\n var parent = inode.parent;\n if (parent && parent.parent && !parent.is_open) {\n _this.openNode(parent, false);\n }\n };\n var saveState = function () {\n if (_this.options.saveState && _this.saveStateHandler) {\n _this.saveStateHandler.saveState();\n }\n };\n if (!inode) {\n // Called with empty node -> deselect current node\n this._deselectCurrentNode();\n saveState();\n return;\n }\n if (!canSelect()) {\n return;\n }\n var node = inode;\n if (this.selectNodeHandler.isNodeSelected(node)) {\n if (selectOptions.mustToggle) {\n this._deselectCurrentNode();\n this._triggerEvent(\"tree.select\", {\n node: null,\n previous_node: node\n });\n }\n }\n else {\n var deselected_node = this.getSelectedNode();\n this._deselectCurrentNode();\n this.addToSelection(node, selectOptions.mustSetFocus);\n this._triggerEvent(\"tree.select\", {\n node: node,\n deselected_node: deselected_node\n });\n openParents();\n }\n saveState();\n };\n JqTreeWidget.prototype._loadData = function (data, parentNode) {\n if (!data) {\n return;\n }\n else {\n this._triggerEvent(\"tree.load_data\", { tree_data: data });\n if (parentNode) {\n this._deselectNodes(parentNode);\n this._loadSubtree(data, parentNode);\n }\n else {\n this._initTree(data);\n }\n if (this.isDragging() && this.dndHandler) {\n this.dndHandler.refresh();\n }\n }\n };\n JqTreeWidget.prototype._deselectNodes = function (parentNode) {\n if (this.selectNodeHandler) {\n var selectedNodesUnderParent = this.selectNodeHandler.getSelectedNodesUnder(parentNode);\n for (var _i = 0, selectedNodesUnderParent_1 = selectedNodesUnderParent; _i < selectedNodesUnderParent_1.length; _i++) {\n var n = selectedNodesUnderParent_1[_i];\n this.selectNodeHandler.removeFromSelection(n);\n }\n }\n };\n JqTreeWidget.prototype._loadSubtree = function (data, parentNode) {\n parentNode.loadFromData(data);\n parentNode.load_on_demand = false;\n parentNode.is_loading = false;\n this._refreshElements(parentNode);\n };\n JqTreeWidget.prototype._loadDataFromUrl = function (urlInfoParam, parentNode, onFinished) {\n var urlInfo = urlInfoParam || this._getDataUrlInfo(parentNode);\n this.dataLoader.loadFromUrl(urlInfo, parentNode, onFinished);\n };\n JqTreeWidget.prototype._loadFolderOnDemand = function (node, slide, on_finished) {\n var _this = this;\n if (slide === void 0) { slide = true; }\n node.is_loading = true;\n this._loadDataFromUrl(null, node, function () {\n _this._openNode(node, slide, on_finished);\n });\n };\n JqTreeWidget.defaults = {\n animationSpeed: \"fast\",\n autoOpen: false,\n saveState: false,\n dragAndDrop: false,\n selectable: true,\n useContextMenu: true,\n onCanSelectNode: null,\n onSetStateFromStorage: null,\n onGetStateFromStorage: null,\n onCreateLi: null,\n onIsMoveHandle: null,\n // Can this node be moved?\n onCanMove: null,\n // Can this node be moved to this position? function(moved_node, target_node, position)\n onCanMoveTo: null,\n onLoadFailed: null,\n autoEscape: true,\n dataUrl: null,\n // The symbol to use for a closed node - â–º BLACK RIGHT-POINTING POINTER\n // http://www.fileformat.info/info/unicode/char/25ba/index.htm\n closedIcon: null,\n // The symbol to use for an open node - â–¼ BLACK DOWN-POINTING TRIANGLE\n // http://www.fileformat.info/info/unicode/char/25bc/index.htm\n openedIcon: \"▼\",\n slide: true,\n nodeClass: node_1.Node,\n dataFilter: null,\n keyboardSupport: true,\n openFolderDelay: 500,\n rtl: false,\n onDragMove: null,\n onDragStop: null,\n buttonLeft: true,\n onLoading: null,\n tabIndex: 0\n };\n return JqTreeWidget;\n}(mouse_widget_1[\"default\"]));\nsimple_widget_1[\"default\"].register(JqTreeWidget, \"tree\");\n","\"use strict\";\nexports.__esModule = true;\nvar version = \"1.4.10\";\nexports[\"default\"] = version;\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nexports.__esModule = true;\nvar jQuery = require(\"jquery\");\nvar node_1 = require(\"./node\");\nvar util_1 = require(\"./util\");\nvar DragAndDropHandler = /** @class */ (function () {\n function DragAndDropHandler(treeWidget) {\n this.treeWidget = treeWidget;\n this.hoveredArea = null;\n this.hitAreas = [];\n this.isDragging = false;\n this.currentItem = null;\n this.positionInfo = null;\n }\n DragAndDropHandler.prototype.mouseCapture = function (positionInfo) {\n var $element = jQuery(positionInfo.target);\n if (!this.mustCaptureElement($element)) {\n return null;\n }\n if (this.treeWidget.options.onIsMoveHandle &&\n !this.treeWidget.options.onIsMoveHandle($element)) {\n return null;\n }\n var nodeElement = this.treeWidget._getNodeElement($element);\n if (nodeElement && this.treeWidget.options.onCanMove) {\n if (!this.treeWidget.options.onCanMove(nodeElement.node)) {\n nodeElement = null;\n }\n }\n this.currentItem = nodeElement;\n return this.currentItem != null;\n };\n DragAndDropHandler.prototype.generateHitAreas = function () {\n if (!this.currentItem) {\n this.hitAreas = [];\n }\n else {\n var hitAreasGenerator = new HitAreasGenerator(this.treeWidget.tree, this.currentItem.node, this.getTreeDimensions().bottom);\n this.hitAreas = hitAreasGenerator.generate();\n }\n };\n DragAndDropHandler.prototype.mouseStart = function (positionInfo) {\n if (!this.currentItem ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined) {\n return false;\n }\n else {\n this.refresh();\n var offset = jQuery(positionInfo.target).offset();\n var left = offset ? offset.left : 0;\n var top_1 = offset ? offset.top : 0;\n var node = this.currentItem.node;\n var nodeName = this.treeWidget.options.autoEscape\n ? util_1.htmlEscape(node.name)\n : node.name;\n this.dragElement = new DragElement(nodeName, positionInfo.pageX - left, positionInfo.pageY - top_1, this.treeWidget.element);\n this.isDragging = true;\n this.positionInfo = positionInfo;\n this.currentItem.$element.addClass(\"jqtree-moving\");\n return true;\n }\n };\n DragAndDropHandler.prototype.mouseDrag = function (positionInfo) {\n if (!this.currentItem ||\n !this.dragElement ||\n positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined) {\n return false;\n }\n else {\n this.dragElement.move(positionInfo.pageX, positionInfo.pageY);\n this.positionInfo = positionInfo;\n var area = this.findHoveredArea(positionInfo.pageX, positionInfo.pageY);\n var canMoveTo = this.canMoveToArea(area);\n if (canMoveTo && area) {\n if (!area.node.isFolder()) {\n this.stopOpenFolderTimer();\n }\n if (this.hoveredArea !== area) {\n this.hoveredArea = area;\n // If this is a closed folder, start timer to open it\n if (this.mustOpenFolderTimer(area)) {\n this.startOpenFolderTimer(area.node);\n }\n else {\n this.stopOpenFolderTimer();\n }\n this.updateDropHint();\n }\n }\n else {\n this.removeHover();\n this.removeDropHint();\n this.stopOpenFolderTimer();\n }\n if (!area) {\n if (this.treeWidget.options.onDragMove) {\n this.treeWidget.options.onDragMove(this.currentItem.node, positionInfo.originalEvent);\n }\n }\n return true;\n }\n };\n DragAndDropHandler.prototype.mouseStop = function (positionInfo) {\n this.moveItem(positionInfo);\n this.clear();\n this.removeHover();\n this.removeDropHint();\n this.removeHitAreas();\n var currentItem = this.currentItem;\n if (this.currentItem) {\n this.currentItem.$element.removeClass(\"jqtree-moving\");\n this.currentItem = null;\n }\n this.isDragging = false;\n this.positionInfo = null;\n if (!this.hoveredArea && currentItem) {\n if (this.treeWidget.options.onDragStop) {\n this.treeWidget.options.onDragStop(currentItem.node, positionInfo.originalEvent);\n }\n }\n return false;\n };\n DragAndDropHandler.prototype.refresh = function () {\n this.removeHitAreas();\n if (this.currentItem) {\n this.generateHitAreas();\n this.currentItem = this.treeWidget._getNodeElementForNode(this.currentItem.node);\n if (this.isDragging) {\n this.currentItem.$element.addClass(\"jqtree-moving\");\n }\n }\n };\n DragAndDropHandler.prototype.mustCaptureElement = function ($element) {\n return !$element.is(\"input,select,textarea\");\n };\n DragAndDropHandler.prototype.canMoveToArea = function (area) {\n if (!area || !this.currentItem) {\n return false;\n }\n else if (this.treeWidget.options.onCanMoveTo) {\n var position_name = node_1.getPositionName(area.position);\n return this.treeWidget.options.onCanMoveTo(this.currentItem.node, area.node, position_name);\n }\n else {\n return true;\n }\n };\n DragAndDropHandler.prototype.removeHitAreas = function () {\n this.hitAreas = [];\n };\n DragAndDropHandler.prototype.clear = function () {\n if (this.dragElement) {\n this.dragElement.remove();\n this.dragElement = null;\n }\n };\n DragAndDropHandler.prototype.removeDropHint = function () {\n if (this.previousGhost) {\n this.previousGhost.remove();\n }\n };\n DragAndDropHandler.prototype.removeHover = function () {\n this.hoveredArea = null;\n };\n DragAndDropHandler.prototype.findHoveredArea = function (x, y) {\n var dimensions = this.getTreeDimensions();\n if (x < dimensions.left ||\n y < dimensions.top ||\n x > dimensions.right ||\n y > dimensions.bottom) {\n return null;\n }\n var low = 0;\n var high = this.hitAreas.length;\n while (low < high) {\n // tslint:disable-next-line: no-bitwise\n var mid = (low + high) >> 1;\n var area = this.hitAreas[mid];\n if (y < area.top) {\n high = mid;\n }\n else if (y > area.bottom) {\n low = mid + 1;\n }\n else {\n return area;\n }\n }\n return null;\n };\n DragAndDropHandler.prototype.mustOpenFolderTimer = function (area) {\n var node = area.node;\n return (node.isFolder() &&\n !node.is_open &&\n area.position === node_1.Position.Inside);\n };\n DragAndDropHandler.prototype.updateDropHint = function () {\n if (!this.hoveredArea) {\n return;\n }\n // remove previous drop hint\n this.removeDropHint();\n // add new drop hint\n var node_element = this.treeWidget._getNodeElementForNode(this.hoveredArea.node);\n this.previousGhost = node_element.addDropHint(this.hoveredArea.position);\n };\n DragAndDropHandler.prototype.startOpenFolderTimer = function (folder) {\n var _this = this;\n var openFolder = function () {\n _this.treeWidget._openNode(folder, _this.treeWidget.options.slide, function () {\n _this.refresh();\n _this.updateDropHint();\n });\n };\n this.stopOpenFolderTimer();\n this.openFolderTimer = window.setTimeout(openFolder, this.treeWidget.options.openFolderDelay);\n };\n DragAndDropHandler.prototype.stopOpenFolderTimer = function () {\n if (this.openFolderTimer) {\n clearTimeout(this.openFolderTimer);\n this.openFolderTimer = null;\n }\n };\n DragAndDropHandler.prototype.moveItem = function (positionInfo) {\n var _this = this;\n if (this.currentItem &&\n this.hoveredArea &&\n this.hoveredArea.position !== node_1.Position.None &&\n this.canMoveToArea(this.hoveredArea)) {\n var moved_node_1 = this.currentItem.node;\n var target_node_1 = this.hoveredArea.node;\n var position_1 = this.hoveredArea.position;\n var previous_parent = moved_node_1.parent;\n if (position_1 === node_1.Position.Inside) {\n this.hoveredArea.node.is_open = true;\n }\n var doMove = function () {\n _this.treeWidget.tree.moveNode(moved_node_1, target_node_1, position_1);\n _this.treeWidget.element.empty();\n _this.treeWidget._refreshElements(null);\n };\n var event_1 = this.treeWidget._triggerEvent(\"tree.move\", {\n move_info: {\n moved_node: moved_node_1,\n target_node: target_node_1,\n position: node_1.getPositionName(position_1),\n previous_parent: previous_parent,\n do_move: doMove,\n original_event: positionInfo.originalEvent\n }\n });\n if (!event_1.isDefaultPrevented()) {\n doMove();\n }\n }\n };\n DragAndDropHandler.prototype.getTreeDimensions = function () {\n // Return the dimensions of the tree. Add a margin to the bottom to allow\n // to drag-and-drop after the last element.\n var offset = this.treeWidget.element.offset();\n if (!offset) {\n return { left: 0, top: 0, right: 0, bottom: 0 };\n }\n else {\n var el = this.treeWidget.element;\n var width = el.width() || 0;\n var height = el.height() || 0;\n var left = offset.left + this.treeWidget._getScrollLeft();\n return {\n left: left,\n top: offset.top,\n right: left + width,\n bottom: offset.top + height + 16\n };\n }\n };\n return DragAndDropHandler;\n}());\nexports.DragAndDropHandler = DragAndDropHandler;\nvar VisibleNodeIterator = /** @class */ (function () {\n function VisibleNodeIterator(tree) {\n this.tree = tree;\n }\n VisibleNodeIterator.prototype.iterate = function () {\n var _this = this;\n var isFirstNode = true;\n var _iterateNode = function (node, nextNode) {\n var mustIterateInside = (node.is_open || !node.element) && node.hasChildren();\n var $element = null;\n if (node.element) {\n $element = jQuery(node.element);\n if (!$element.is(\":visible\")) {\n return;\n }\n if (isFirstNode) {\n _this.handleFirstNode(node);\n isFirstNode = false;\n }\n if (!node.hasChildren()) {\n _this.handleNode(node, nextNode, $element);\n }\n else if (node.is_open) {\n if (!_this.handleOpenFolder(node, $element)) {\n mustIterateInside = false;\n }\n }\n else {\n _this.handleClosedFolder(node, nextNode, $element);\n }\n }\n if (mustIterateInside) {\n var children_length_1 = node.children.length;\n node.children.forEach(function (_, i) {\n if (i === children_length_1 - 1) {\n _iterateNode(node.children[i], null);\n }\n else {\n _iterateNode(node.children[i], node.children[i + 1]);\n }\n });\n if (node.is_open && $element) {\n _this.handleAfterOpenFolder(node, nextNode);\n }\n }\n };\n _iterateNode(this.tree, null);\n };\n return VisibleNodeIterator;\n}());\nvar HitAreasGenerator = /** @class */ (function (_super) {\n __extends(HitAreasGenerator, _super);\n function HitAreasGenerator(tree, currentNode, treeBottom) {\n var _this = _super.call(this, tree) || this;\n _this.currentNode = currentNode;\n _this.treeBottom = treeBottom;\n return _this;\n }\n HitAreasGenerator.prototype.generate = function () {\n this.positions = [];\n this.lastTop = 0;\n this.iterate();\n return this.generateHitAreas(this.positions);\n };\n HitAreasGenerator.prototype.generateHitAreas = function (positions) {\n var previousTop = -1;\n var group = [];\n var hitAreas = [];\n for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {\n var position = positions_1[_i];\n if (position.top !== previousTop && group.length) {\n if (group.length) {\n this.generateHitAreasForGroup(hitAreas, group, previousTop, position.top);\n }\n previousTop = position.top;\n group = [];\n }\n group.push(position);\n }\n this.generateHitAreasForGroup(hitAreas, group, previousTop, this.treeBottom);\n return hitAreas;\n };\n HitAreasGenerator.prototype.handleOpenFolder = function (node, $element) {\n if (node === this.currentNode) {\n // Cannot move inside current item\n // Stop iterating\n return false;\n }\n // Cannot move before current item\n if (node.children[0] !== this.currentNode) {\n this.addPosition(node, node_1.Position.Inside, this.getTop($element));\n }\n // Continue iterating\n return true;\n };\n HitAreasGenerator.prototype.handleClosedFolder = function (node, nextNode, $element) {\n var top = this.getTop($element);\n if (node === this.currentNode) {\n // Cannot move after current item\n this.addPosition(node, node_1.Position.None, top);\n }\n else {\n this.addPosition(node, node_1.Position.Inside, top);\n // Cannot move before current item\n if (nextNode !== this.currentNode) {\n this.addPosition(node, node_1.Position.After, top);\n }\n }\n };\n HitAreasGenerator.prototype.handleFirstNode = function (node) {\n if (node !== this.currentNode) {\n this.addPosition(node, node_1.Position.Before, this.getTop(jQuery(node.element)));\n }\n };\n HitAreasGenerator.prototype.handleAfterOpenFolder = function (node, next_node) {\n if (node === this.currentNode || next_node === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, node_1.Position.None, this.lastTop);\n }\n else {\n this.addPosition(node, node_1.Position.After, this.lastTop);\n }\n };\n HitAreasGenerator.prototype.handleNode = function (node, nextNode, $element) {\n var top = this.getTop($element);\n if (node === this.currentNode) {\n // Cannot move inside current item\n this.addPosition(node, node_1.Position.None, top);\n }\n else {\n this.addPosition(node, node_1.Position.Inside, top);\n }\n if (nextNode === this.currentNode || node === this.currentNode) {\n // Cannot move before or after current item\n this.addPosition(node, node_1.Position.None, top);\n }\n else {\n this.addPosition(node, node_1.Position.After, top);\n }\n };\n HitAreasGenerator.prototype.getTop = function ($element) {\n var offset = $element.offset();\n return offset ? offset.top : 0;\n };\n HitAreasGenerator.prototype.addPosition = function (node, position, top) {\n var area = {\n top: top,\n bottom: 0,\n node: node,\n position: position\n };\n this.positions.push(area);\n this.lastTop = top;\n };\n HitAreasGenerator.prototype.generateHitAreasForGroup = function (hitAreas, positionsInGroup, top, bottom) {\n // limit positions in group\n var position_count = Math.min(positionsInGroup.length, 4);\n var area_height = Math.round((bottom - top) / position_count);\n var area_top = top;\n var i = 0;\n while (i < position_count) {\n var position = positionsInGroup[i];\n hitAreas.push({\n top: area_top,\n bottom: area_top + area_height,\n node: position.node,\n position: position.position\n });\n area_top += area_height;\n i += 1;\n }\n };\n return HitAreasGenerator;\n}(VisibleNodeIterator));\nexports.HitAreasGenerator = HitAreasGenerator;\nvar DragElement = /** @class */ (function () {\n function DragElement(node_name, offset_x, offset_y, $tree) {\n this.offsetX = offset_x;\n this.offsetY = offset_y;\n this.$element = jQuery(\"\" + node_name + \"\");\n this.$element.css(\"position\", \"absolute\");\n $tree.append(this.$element);\n }\n DragElement.prototype.move = function (pageX, pageY) {\n this.$element.offset({\n left: pageX - this.offsetX,\n top: pageY - this.offsetY\n });\n };\n DragElement.prototype.remove = function () {\n this.$element.remove();\n };\n return DragElement;\n}());\n","\"use strict\";\nexports.__esModule = true;\nvar util_1 = require(\"./util\");\nvar ElementsRenderer = /** @class */ (function () {\n function ElementsRenderer(treeWidget) {\n this.treeWidget = treeWidget;\n this.openedIconElement = this.createButtonElement(treeWidget.options.openedIcon);\n this.closedIconElement = this.createButtonElement(treeWidget.options.closedIcon);\n }\n ElementsRenderer.prototype.render = function (fromNode) {\n if (fromNode && fromNode.parent) {\n this.renderFromNode(fromNode);\n }\n else {\n this.renderFromRoot();\n }\n };\n ElementsRenderer.prototype.renderFromRoot = function () {\n var $element = this.treeWidget.element;\n $element.empty();\n this.createDomElements($element[0], this.treeWidget.tree.children, true, 1);\n };\n ElementsRenderer.prototype.renderFromNode = function (node) {\n // remember current li\n var $previousLi = jQuery(node.element);\n // create element\n var li = this.createLi(node, node.getLevel());\n this.attachNodeData(node, li);\n // add element to dom\n $previousLi.after(li);\n // remove previous li\n $previousLi.remove();\n // create children\n if (node.children) {\n this.createDomElements(li, node.children, false, node.getLevel() + 1);\n }\n };\n ElementsRenderer.prototype.createDomElements = function (element, children, isRootNode, level) {\n var ul = this.createUl(isRootNode);\n element.appendChild(ul);\n for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\n var child = children_1[_i];\n var li = this.createLi(child, level);\n ul.appendChild(li);\n this.attachNodeData(child, li);\n if (child.hasChildren()) {\n this.createDomElements(li, child.children, false, level + 1);\n }\n }\n };\n ElementsRenderer.prototype.attachNodeData = function (node, li) {\n node.element = li;\n jQuery(li).data(\"node\", node);\n };\n ElementsRenderer.prototype.createUl = function (isRootNode) {\n var classString;\n var role;\n if (!isRootNode) {\n classString = \"\";\n role = \"group\";\n }\n else {\n classString = \"jqtree-tree\";\n role = \"tree\";\n if (this.treeWidget.options.rtl) {\n classString += \" jqtree-rtl\";\n }\n }\n var ul = document.createElement(\"ul\");\n ul.className = \"jqtree_common \" + classString;\n ul.setAttribute(\"role\", role);\n return ul;\n };\n ElementsRenderer.prototype.createLi = function (node, level) {\n var isSelected = Boolean(this.treeWidget.selectNodeHandler &&\n this.treeWidget.selectNodeHandler.isNodeSelected(node));\n var li = node.isFolder()\n ? this.createFolderLi(node, level, isSelected)\n : this.createNodeLi(node, level, isSelected);\n if (this.treeWidget.options.onCreateLi) {\n this.treeWidget.options.onCreateLi(node, jQuery(li), isSelected);\n }\n return li;\n };\n ElementsRenderer.prototype.createFolderLi = function (node, level, isSelected) {\n var buttonClasses = this.getButtonClasses(node);\n var folderClasses = this.getFolderClasses(node, isSelected);\n var iconElement = node.is_open\n ? this.openedIconElement\n : this.closedIconElement;\n // li\n var li = document.createElement(\"li\");\n li.className = \"jqtree_common \" + folderClasses;\n li.setAttribute(\"role\", \"presentation\");\n // div\n var div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"presentation\");\n li.appendChild(div);\n // button link\n var buttonLink = document.createElement(\"a\");\n buttonLink.className = buttonClasses;\n buttonLink.appendChild(iconElement.cloneNode(true));\n buttonLink.setAttribute(\"role\", \"presentation\");\n buttonLink.setAttribute(\"aria-hidden\", \"true\");\n if (this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n // title span\n div.appendChild(this.createTitleSpan(node.name, level, isSelected, node.is_open, true));\n if (!this.treeWidget.options.buttonLeft) {\n div.appendChild(buttonLink);\n }\n return li;\n };\n ElementsRenderer.prototype.createNodeLi = function (node, level, isSelected) {\n var liClasses = [\"jqtree_common\"];\n if (isSelected) {\n liClasses.push(\"jqtree-selected\");\n }\n var classString = liClasses.join(\" \");\n // li\n var li = document.createElement(\"li\");\n li.className = classString;\n li.setAttribute(\"role\", \"presentation\");\n // div\n var div = document.createElement(\"div\");\n div.className = \"jqtree-element jqtree_common\";\n div.setAttribute(\"role\", \"presentation\");\n li.appendChild(div);\n // title span\n div.appendChild(this.createTitleSpan(node.name, level, isSelected, node.is_open, false));\n return li;\n };\n ElementsRenderer.prototype.createTitleSpan = function (nodeName, level, isSelected, isOpen, isFolder) {\n var titleSpan = document.createElement(\"span\");\n var classes = \"jqtree-title jqtree_common\";\n if (isFolder) {\n classes += \" jqtree-title-folder\";\n }\n titleSpan.className = classes;\n titleSpan.setAttribute(\"role\", \"treeitem\");\n titleSpan.setAttribute(\"aria-level\", \"\" + level);\n titleSpan.setAttribute(\"aria-selected\", util_1.getBoolString(isSelected));\n titleSpan.setAttribute(\"aria-expanded\", util_1.getBoolString(isOpen));\n if (isSelected) {\n titleSpan.setAttribute(\"tabindex\", this.treeWidget.options.tabIndex);\n }\n titleSpan.innerHTML = this.escapeIfNecessary(nodeName);\n return titleSpan;\n };\n ElementsRenderer.prototype.getButtonClasses = function (node) {\n var classes = [\"jqtree-toggler\", \"jqtree_common\"];\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n if (this.treeWidget.options.buttonLeft) {\n classes.push(\"jqtree-toggler-left\");\n }\n else {\n classes.push(\"jqtree-toggler-right\");\n }\n return classes.join(\" \");\n };\n ElementsRenderer.prototype.getFolderClasses = function (node, isSelected) {\n var classes = [\"jqtree-folder\"];\n if (!node.is_open) {\n classes.push(\"jqtree-closed\");\n }\n if (isSelected) {\n classes.push(\"jqtree-selected\");\n }\n if (node.is_loading) {\n classes.push(\"jqtree-loading\");\n }\n return classes.join(\" \");\n };\n ElementsRenderer.prototype.escapeIfNecessary = function (value) {\n if (this.treeWidget.options.autoEscape) {\n return util_1.htmlEscape(value);\n }\n else {\n return value;\n }\n };\n ElementsRenderer.prototype.createButtonElement = function (value) {\n if (typeof value === \"string\") {\n // convert value to html\n var div = document.createElement(\"div\");\n div.innerHTML = value;\n return document.createTextNode(div.innerHTML);\n }\n else {\n return jQuery(value)[0];\n }\n };\n return ElementsRenderer;\n}());\nexports[\"default\"] = ElementsRenderer;\n","\"use strict\";\nexports.__esModule = true;\nvar DataLoader = /** @class */ (function () {\n function DataLoader(treeWidget) {\n this.treeWidget = treeWidget;\n }\n DataLoader.prototype.loadFromUrl = function (urlInfo, parentNode, onFinished) {\n var _this = this;\n if (!urlInfo) {\n return;\n }\n var $el = this.getDomElement(parentNode);\n this.addLoadingClass($el);\n this.notifyLoading(true, parentNode, $el);\n var stopLoading = function () {\n _this.removeLoadingClass($el);\n _this.notifyLoading(false, parentNode, $el);\n };\n var handleSuccess = function (data) {\n stopLoading();\n _this.treeWidget.loadData(_this.parseData(data), parentNode);\n if (onFinished && typeof onFinished === \"function\") {\n onFinished();\n }\n };\n var handleError = function (jqXHR) {\n stopLoading();\n var onLoadFailed = _this.treeWidget.options.onLoadFailed;\n if (onLoadFailed) {\n onLoadFailed(jqXHR);\n }\n };\n this.submitRequest(urlInfo, handleSuccess, handleError);\n };\n DataLoader.prototype.addLoadingClass = function ($el) {\n if ($el) {\n $el.addClass(\"jqtree-loading\");\n }\n };\n DataLoader.prototype.removeLoadingClass = function ($el) {\n if ($el) {\n $el.removeClass(\"jqtree-loading\");\n }\n };\n DataLoader.prototype.getDomElement = function (parentNode) {\n if (parentNode) {\n return jQuery(parentNode.element);\n }\n else {\n return this.treeWidget.element;\n }\n };\n DataLoader.prototype.notifyLoading = function (isLoading, node, $el) {\n var onLoading = this.treeWidget.options.onLoading;\n if (onLoading) {\n onLoading(isLoading, node, $el);\n }\n this.treeWidget._triggerEvent(\"tree.loading_data\", {\n isLoading: isLoading,\n node: node,\n $el: $el\n });\n };\n DataLoader.prototype.submitRequest = function (urlInfo, handleSuccess, handleError) {\n var ajaxSettings = jQuery.extend({ method: \"GET\" }, typeof urlInfo === \"string\" ? { url: urlInfo } : urlInfo, {\n cache: false,\n dataType: \"json\",\n success: handleSuccess,\n error: handleError\n });\n ajaxSettings.method = ajaxSettings.method.toUpperCase();\n jQuery.ajax(ajaxSettings);\n };\n DataLoader.prototype.parseData = function (data) {\n var dataFilter = this.treeWidget.options.dataFilter;\n var parsedData = data instanceof Array || typeof data === \"object\"\n ? data\n : data != null\n ? jQuery.parseJSON(data)\n : [];\n return dataFilter ? dataFilter(parsedData) : parsedData;\n };\n return DataLoader;\n}());\nexports[\"default\"] = DataLoader;\n","\"use strict\";\nexports.__esModule = true;\nvar KeyHandler = /** @class */ (function () {\n function KeyHandler(treeWidget) {\n var _this = this;\n this.handleKeyDown = function (e) {\n if (!_this.canHandleKeyboard()) {\n return true;\n }\n else {\n var key = e.which;\n switch (key) {\n case KeyHandler.DOWN:\n return _this.moveDown();\n case KeyHandler.UP:\n return _this.moveUp();\n case KeyHandler.RIGHT:\n return _this.moveRight();\n case KeyHandler.LEFT:\n return _this.moveLeft();\n default:\n return true;\n }\n }\n };\n this.treeWidget = treeWidget;\n if (treeWidget.options.keyboardSupport) {\n jQuery(document).on(\"keydown.jqtree\", this.handleKeyDown);\n }\n }\n KeyHandler.prototype.deinit = function () {\n jQuery(document).off(\"keydown.jqtree\");\n };\n KeyHandler.prototype.moveDown = function () {\n var node = this.treeWidget.getSelectedNode();\n if (node) {\n return this.selectNode(node.getNextNode());\n }\n else {\n return false;\n }\n };\n KeyHandler.prototype.moveUp = function () {\n var node = this.treeWidget.getSelectedNode();\n if (node) {\n return this.selectNode(node.getPreviousNode());\n }\n else {\n return false;\n }\n };\n KeyHandler.prototype.moveRight = function () {\n var node = this.treeWidget.getSelectedNode();\n if (!node) {\n return true;\n }\n else if (!node.isFolder()) {\n return true;\n }\n else {\n // folder node\n if (node.is_open) {\n // Right moves to the first child of an open node\n return this.selectNode(node.getNextNode());\n }\n else {\n // Right expands a closed node\n this.treeWidget.openNode(node);\n return false;\n }\n }\n };\n KeyHandler.prototype.moveLeft = function () {\n var node = this.treeWidget.getSelectedNode();\n if (!node) {\n return true;\n }\n else if (node.isFolder() && node.is_open) {\n // Left on an open node closes the node\n this.treeWidget.closeNode(node);\n return false;\n }\n else {\n // Left on a closed or end node moves focus to the node's parent\n return this.selectNode(node.getParent());\n }\n };\n KeyHandler.prototype.selectNode = function (node) {\n if (!node) {\n return true;\n }\n else {\n this.treeWidget.selectNode(node);\n if (this.treeWidget.scrollHandler &&\n !this.treeWidget.scrollHandler.isScrolledIntoView(jQuery(node.element).find(\".jqtree-element\"))) {\n this.treeWidget.scrollToNode(node);\n }\n return false;\n }\n };\n KeyHandler.prototype.canHandleKeyboard = function () {\n return (this.treeWidget.options.keyboardSupport &&\n this.isFocusOnTree() &&\n this.treeWidget.getSelectedNode() != null);\n };\n KeyHandler.prototype.isFocusOnTree = function () {\n var activeElement = document.activeElement;\n return Boolean(activeElement &&\n activeElement.tagName === \"SPAN\" &&\n this.treeWidget._containsElement(activeElement));\n };\n KeyHandler.LEFT = 37;\n KeyHandler.UP = 38;\n KeyHandler.RIGHT = 39;\n KeyHandler.DOWN = 40;\n return KeyHandler;\n}());\nexports[\"default\"] = KeyHandler;\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nexports.__esModule = true;\n/*\nThis widget does the same a the mouse widget in jqueryui.\n*/\nvar simple_widget_1 = require(\"./simple.widget\");\nvar MouseWidget = /** @class */ (function (_super) {\n __extends(MouseWidget, _super);\n function MouseWidget() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this.mouseDown = function (e) {\n // Is left mouse button?\n if (e.which !== 1) {\n return;\n }\n var result = _this._handleMouseDown(_this._getPositionInfo(e));\n if (result) {\n e.preventDefault();\n }\n return result;\n };\n _this.mouseMove = function (e) {\n return _this._handleMouseMove(e, _this._getPositionInfo(e));\n };\n _this.mouseUp = function (e) {\n return _this._handleMouseUp(_this._getPositionInfo(e));\n };\n _this.touchStart = function (e) {\n var touchEvent = e.originalEvent;\n if (touchEvent.touches.length > 1) {\n return;\n }\n var touch = touchEvent.changedTouches[0];\n return _this._handleMouseDown(_this._getPositionInfo(touch));\n };\n _this.touchMove = function (e) {\n var touchEvent = e.originalEvent;\n if (touchEvent.touches.length > 1) {\n return;\n }\n var touch = touchEvent.changedTouches[0];\n return _this._handleMouseMove(e, _this._getPositionInfo(touch));\n };\n _this.touchEnd = function (e) {\n var touchEvent = e.originalEvent;\n if (touchEvent.touches.length > 1) {\n return;\n }\n var touch = touchEvent.changedTouches[0];\n return _this._handleMouseUp(_this._getPositionInfo(touch));\n };\n return _this;\n }\n MouseWidget.prototype.setMouseDelay = function (mouseDelay) {\n this.mouseDelay = mouseDelay;\n };\n MouseWidget.prototype._init = function () {\n this.$el.on(\"mousedown.mousewidget\", this.mouseDown);\n this.$el.on(\"touchstart.mousewidget\", this.touchStart);\n this.isMouseStarted = false;\n this.mouseDelay = 0;\n this.mouseDelayTimer = null;\n this.isMouseDelayMet = true;\n this.mouseDownInfo = null;\n };\n MouseWidget.prototype._deinit = function () {\n this.$el.off(\"mousedown.mousewidget\");\n this.$el.off(\"touchstart.mousewidget\");\n var $document = jQuery(document);\n $document.off(\"mousemove.mousewidget\");\n $document.off(\"mouseup.mousewidget\");\n };\n MouseWidget.prototype._handleMouseDown = function (positionInfo) {\n // We may have missed mouseup (out of window)\n if (this.isMouseStarted) {\n this._handleMouseUp(positionInfo);\n }\n this.mouseDownInfo = positionInfo;\n if (!this._mouseCapture(positionInfo)) {\n return;\n }\n this._handleStartMouse();\n return true;\n };\n MouseWidget.prototype._handleStartMouse = function () {\n var $document = jQuery(document);\n $document.on(\"mousemove.mousewidget\", this.mouseMove);\n $document.on(\"touchmove.mousewidget\", this.touchMove);\n $document.on(\"mouseup.mousewidget\", this.mouseUp);\n $document.on(\"touchend.mousewidget\", this.touchEnd);\n if (this.mouseDelay) {\n this._startMouseDelayTimer();\n }\n };\n MouseWidget.prototype._startMouseDelayTimer = function () {\n var _this = this;\n if (this.mouseDelayTimer) {\n clearTimeout(this.mouseDelayTimer);\n }\n this.mouseDelayTimer = window.setTimeout(function () {\n _this.isMouseDelayMet = true;\n }, this.mouseDelay);\n this.isMouseDelayMet = false;\n };\n MouseWidget.prototype._handleMouseMove = function (e, positionInfo) {\n if (this.isMouseStarted) {\n this._mouseDrag(positionInfo);\n return e.preventDefault();\n }\n if (this.mouseDelay && !this.isMouseDelayMet) {\n return true;\n }\n if (this.mouseDownInfo) {\n this.isMouseStarted =\n this._mouseStart(this.mouseDownInfo) !== false;\n }\n if (this.isMouseStarted) {\n this._mouseDrag(positionInfo);\n }\n else {\n this._handleMouseUp(positionInfo);\n }\n return !this.isMouseStarted;\n };\n MouseWidget.prototype._getPositionInfo = function (e) {\n return {\n pageX: e.pageX,\n pageY: e.pageY,\n target: e.target,\n originalEvent: e\n };\n };\n MouseWidget.prototype._handleMouseUp = function (positionInfo) {\n var $document = jQuery(document);\n $document.off(\"mousemove.mousewidget\");\n $document.off(\"touchmove.mousewidget\");\n $document.off(\"mouseup.mousewidget\");\n $document.off(\"touchend.mousewidget\");\n if (this.isMouseStarted) {\n this.isMouseStarted = false;\n this._mouseStop(positionInfo);\n }\n };\n return MouseWidget;\n}(simple_widget_1[\"default\"]));\nexports[\"default\"] = MouseWidget;\n","\"use strict\";\nexports.__esModule = true;\nvar util_1 = require(\"./util\");\nvar SaveStateHandler = /** @class */ (function () {\n function SaveStateHandler(treeWidget) {\n this.treeWidget = treeWidget;\n }\n SaveStateHandler.prototype.saveState = function () {\n var state = JSON.stringify(this.getState());\n if (this.treeWidget.options.onSetStateFromStorage) {\n this.treeWidget.options.onSetStateFromStorage(state);\n }\n else if (this.supportsLocalStorage()) {\n localStorage.setItem(this.getKeyName(), state);\n }\n };\n SaveStateHandler.prototype.getStateFromStorage = function () {\n var jsonData = this._loadFromStorage();\n if (jsonData) {\n return this._parseState(jsonData);\n }\n else {\n return null;\n }\n };\n SaveStateHandler.prototype.getState = function () {\n var _this = this;\n var getOpenNodeIds = function () {\n var openNodes = [];\n _this.treeWidget.tree.iterate(function (node) {\n if (node.is_open && node.id && node.hasChildren()) {\n openNodes.push(node.id);\n }\n return true;\n });\n return openNodes;\n };\n var getSelectedNodeIds = function () {\n return _this.treeWidget.getSelectedNodes().map(function (n) { return n.id; });\n };\n return {\n open_nodes: getOpenNodeIds(),\n selected_node: getSelectedNodeIds()\n };\n };\n /*\n Set initial state\n Don't handle nodes that are loaded on demand\n\n result: must load on demand\n */\n SaveStateHandler.prototype.setInitialState = function (state) {\n if (!state) {\n return false;\n }\n else {\n var mustLoadOnDemand = false;\n if (state.open_nodes) {\n mustLoadOnDemand = this._openInitialNodes(state.open_nodes);\n }\n if (state.selected_node) {\n this._resetSelection();\n this._selectInitialNodes(state.selected_node);\n }\n return mustLoadOnDemand;\n }\n };\n SaveStateHandler.prototype.setInitialStateOnDemand = function (state, cb_finished) {\n if (state) {\n this._setInitialStateOnDemand(state.open_nodes, state.selected_node, cb_finished);\n }\n else {\n cb_finished();\n }\n };\n SaveStateHandler.prototype.getNodeIdToBeSelected = function () {\n var state = this.getStateFromStorage();\n if (state && state.selected_node) {\n return state.selected_node[0];\n }\n else {\n return null;\n }\n };\n SaveStateHandler.prototype._parseState = function (jsonData) {\n var state = jQuery.parseJSON(jsonData);\n // Check if selected_node is an int (instead of an array)\n if (state && state.selected_node && util_1.isInt(state.selected_node)) {\n // Convert to array\n state.selected_node = [state.selected_node];\n }\n return state;\n };\n SaveStateHandler.prototype._loadFromStorage = function () {\n if (this.treeWidget.options.onGetStateFromStorage) {\n return this.treeWidget.options.onGetStateFromStorage();\n }\n else if (this.supportsLocalStorage()) {\n return localStorage.getItem(this.getKeyName());\n }\n };\n SaveStateHandler.prototype._openInitialNodes = function (nodeIds) {\n var mustLoadOnDemand = false;\n for (var _i = 0, nodeIds_1 = nodeIds; _i < nodeIds_1.length; _i++) {\n var node_id = nodeIds_1[_i];\n var node = this.treeWidget.getNodeById(node_id);\n if (node) {\n if (!node.load_on_demand) {\n node.is_open = true;\n }\n else {\n mustLoadOnDemand = true;\n }\n }\n }\n return mustLoadOnDemand;\n };\n SaveStateHandler.prototype._selectInitialNodes = function (nodeIds) {\n var select_count = 0;\n for (var _i = 0, nodeIds_2 = nodeIds; _i < nodeIds_2.length; _i++) {\n var node_id = nodeIds_2[_i];\n var node = this.treeWidget.getNodeById(node_id);\n if (node) {\n select_count += 1;\n if (this.treeWidget.selectNodeHandler) {\n this.treeWidget.selectNodeHandler.addToSelection(node);\n }\n }\n }\n return select_count !== 0;\n };\n SaveStateHandler.prototype._resetSelection = function () {\n var selectNodeHandler = this.treeWidget.selectNodeHandler;\n if (selectNodeHandler) {\n var selectedNodes = selectNodeHandler.getSelectedNodes();\n selectedNodes.forEach(function (node) {\n selectNodeHandler.removeFromSelection(node);\n });\n }\n };\n SaveStateHandler.prototype._setInitialStateOnDemand = function (nodeIdsParam, selectedNodes, cbFinished) {\n var _this = this;\n var loadingCount = 0;\n var nodeIds = nodeIdsParam;\n var openNodes = function () {\n var newNodesIds = [];\n for (var _i = 0, nodeIds_3 = nodeIds; _i < nodeIds_3.length; _i++) {\n var node_id = nodeIds_3[_i];\n var node = _this.treeWidget.getNodeById(node_id);\n if (!node) {\n newNodesIds.push(node_id);\n }\n else {\n if (!node.is_loading) {\n if (node.load_on_demand) {\n loadAndOpenNode(node);\n }\n else {\n _this.treeWidget._openNode(node, false, null);\n }\n }\n }\n }\n nodeIds = newNodesIds;\n if (_this._selectInitialNodes(selectedNodes)) {\n _this.treeWidget._refreshElements(null);\n }\n if (loadingCount === 0) {\n cbFinished();\n }\n };\n var loadAndOpenNode = function (node) {\n loadingCount += 1;\n _this.treeWidget._openNode(node, false, function () {\n loadingCount -= 1;\n openNodes();\n });\n };\n openNodes();\n };\n SaveStateHandler.prototype.getKeyName = function () {\n if (typeof this.treeWidget.options.saveState === \"string\") {\n return this.treeWidget.options.saveState;\n }\n else {\n return \"tree\";\n }\n };\n SaveStateHandler.prototype.supportsLocalStorage = function () {\n var testSupport = function () {\n // Is local storage supported?\n if (localStorage == null) {\n return false;\n }\n else {\n // Check if it's possible to store an item. Safari does not allow this in private browsing mode.\n try {\n var key = \"_storage_test\";\n sessionStorage.setItem(key, \"value\");\n sessionStorage.removeItem(key);\n }\n catch (error) {\n return false;\n }\n return true;\n }\n };\n if (this._supportsLocalStorage == null) {\n this._supportsLocalStorage = testSupport();\n }\n return this._supportsLocalStorage;\n };\n return SaveStateHandler;\n}());\nexports[\"default\"] = SaveStateHandler;\n","\"use strict\";\nexports.__esModule = true;\nvar ScrollHandler = /** @class */ (function () {\n function ScrollHandler(tree_widget) {\n this.treeWidget = tree_widget;\n this.previousTop = -1;\n this.isInitialized = false;\n }\n ScrollHandler.prototype.checkScrolling = function () {\n this.ensureInit();\n this.checkVerticalScrolling();\n this.checkHorizontalScrolling();\n };\n ScrollHandler.prototype.scrollToY = function (top) {\n this.ensureInit();\n if (this.$scrollParent) {\n this.$scrollParent[0].scrollTop = top;\n }\n else {\n var offset = this.treeWidget.$el.offset();\n var treeTop = offset ? offset.top : 0;\n jQuery(document).scrollTop(top + treeTop);\n }\n };\n ScrollHandler.prototype.isScrolledIntoView = function ($element) {\n this.ensureInit();\n var elementBottom;\n var viewBottom;\n var elementTop;\n var viewTop;\n var elHeight = $element.height() || 0;\n if (this.$scrollParent) {\n viewTop = 0;\n viewBottom = this.$scrollParent.height() || 0;\n var offset = $element.offset();\n var originalTop = offset ? offset.top : 0;\n elementTop = originalTop - this.scrollParentTop;\n elementBottom = elementTop + elHeight;\n }\n else {\n viewTop = jQuery(window).scrollTop() || 0;\n var windowHeight = jQuery(window).height() || 0;\n viewBottom = viewTop + windowHeight;\n var offset = $element.offset();\n elementTop = offset ? offset.top : 0;\n elementBottom = elementTop + elHeight;\n }\n return elementBottom <= viewBottom && elementTop >= viewTop;\n };\n ScrollHandler.prototype.getScrollLeft = function () {\n if (!this.$scrollParent) {\n return 0;\n }\n else {\n return this.$scrollParent.scrollLeft() || 0;\n }\n };\n ScrollHandler.prototype.initScrollParent = function () {\n var _this = this;\n var getParentWithOverflow = function () {\n var cssAttributes = [\"overflow\", \"overflow-y\"];\n var hasOverFlow = function ($el) {\n for (var _i = 0, cssAttributes_1 = cssAttributes; _i < cssAttributes_1.length; _i++) {\n var attr = cssAttributes_1[_i];\n var overflowValue = $el.css(attr);\n if (overflowValue === \"auto\" ||\n overflowValue === \"scroll\") {\n return true;\n }\n }\n return false;\n };\n if (hasOverFlow(_this.treeWidget.$el)) {\n return _this.treeWidget.$el;\n }\n for (var _i = 0, _a = _this.treeWidget.$el.parents().get(); _i < _a.length; _i++) {\n var el = _a[_i];\n var $el = jQuery(el);\n if (hasOverFlow($el)) {\n return $el;\n }\n }\n return null;\n };\n var setDocumentAsScrollParent = function () {\n _this.scrollParentTop = 0;\n _this.$scrollParent = null;\n };\n if (this.treeWidget.$el.css(\"position\") === \"fixed\") {\n setDocumentAsScrollParent();\n }\n var $scrollParent = getParentWithOverflow();\n if ($scrollParent &&\n $scrollParent.length &&\n $scrollParent[0].tagName !== \"HTML\") {\n this.$scrollParent = $scrollParent;\n var offset = this.$scrollParent.offset();\n this.scrollParentTop = offset ? offset.top : 0;\n }\n else {\n setDocumentAsScrollParent();\n }\n this.isInitialized = true;\n };\n ScrollHandler.prototype.ensureInit = function () {\n if (!this.isInitialized) {\n this.initScrollParent();\n }\n };\n ScrollHandler.prototype.handleVerticalScrollingWithScrollParent = function (area) {\n var scrollParent = this.$scrollParent && this.$scrollParent[0];\n if (!scrollParent) {\n return;\n }\n var distanceBottom = this.scrollParentTop + scrollParent.offsetHeight - area.bottom;\n if (distanceBottom < 20) {\n scrollParent.scrollTop += 20;\n this.treeWidget.refreshHitAreas();\n this.previousTop = -1;\n }\n else if (area.top - this.scrollParentTop < 20) {\n scrollParent.scrollTop -= 20;\n this.treeWidget.refreshHitAreas();\n this.previousTop = -1;\n }\n };\n ScrollHandler.prototype.handleVerticalScrollingWithDocument = function (area) {\n var scrollTop = jQuery(document).scrollTop() || 0;\n var distanceTop = area.top - scrollTop;\n if (distanceTop < 20) {\n jQuery(document).scrollTop(scrollTop - 20);\n }\n else {\n var windowHeight = jQuery(window).height() || 0;\n if (windowHeight - (area.bottom - scrollTop) < 20) {\n jQuery(document).scrollTop(scrollTop + 20);\n }\n }\n };\n ScrollHandler.prototype.checkVerticalScrolling = function () {\n var hoveredArea = this.treeWidget.dndHandler &&\n this.treeWidget.dndHandler.hoveredArea;\n if (hoveredArea && hoveredArea.top !== this.previousTop) {\n this.previousTop = hoveredArea.top;\n if (this.$scrollParent) {\n this.handleVerticalScrollingWithScrollParent(hoveredArea);\n }\n else {\n this.handleVerticalScrollingWithDocument(hoveredArea);\n }\n }\n };\n ScrollHandler.prototype.checkHorizontalScrolling = function () {\n var positionInfo = this.treeWidget.dndHandler &&\n this.treeWidget.dndHandler.positionInfo;\n if (!positionInfo) {\n return;\n }\n if (this.$scrollParent) {\n this.handleHorizontalScrollingWithParent(positionInfo);\n }\n else {\n this.handleHorizontalScrollingWithDocument(positionInfo);\n }\n };\n ScrollHandler.prototype.handleHorizontalScrollingWithParent = function (positionInfo) {\n if (positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined) {\n return;\n }\n var $scrollParent = this.$scrollParent;\n var scrollParentOffset = $scrollParent && $scrollParent.offset();\n if (!($scrollParent && scrollParentOffset)) {\n return;\n }\n var scrollParent = $scrollParent[0];\n var canScrollRight = scrollParent.scrollLeft + scrollParent.clientWidth <\n scrollParent.scrollWidth;\n var canScrollLeft = scrollParent.scrollLeft > 0;\n var rightEdge = scrollParentOffset.left + scrollParent.clientWidth;\n var leftEdge = scrollParentOffset.left;\n var isNearRightEdge = positionInfo.pageX > rightEdge - 20;\n var isNearLeftEdge = positionInfo.pageX < leftEdge + 20;\n if (isNearRightEdge && canScrollRight) {\n scrollParent.scrollLeft = Math.min(scrollParent.scrollLeft + 20, scrollParent.scrollWidth);\n }\n else if (isNearLeftEdge && canScrollLeft) {\n scrollParent.scrollLeft = Math.max(scrollParent.scrollLeft - 20, 0);\n }\n };\n ScrollHandler.prototype.handleHorizontalScrollingWithDocument = function (positionInfo) {\n if (positionInfo.pageX === undefined ||\n positionInfo.pageY === undefined) {\n return;\n }\n var $document = jQuery(document);\n var scrollLeft = $document.scrollLeft() || 0;\n var windowWidth = jQuery(window).width() || 0;\n var canScrollLeft = scrollLeft > 0;\n var isNearRightEdge = positionInfo.pageX > windowWidth - 20;\n var isNearLeftEdge = positionInfo.pageX - scrollLeft < 20;\n if (isNearRightEdge) {\n $document.scrollLeft(scrollLeft + 20);\n }\n else if (isNearLeftEdge && canScrollLeft) {\n $document.scrollLeft(Math.max(scrollLeft - 20, 0));\n }\n };\n return ScrollHandler;\n}());\nexports[\"default\"] = ScrollHandler;\n","\"use strict\";\nexports.__esModule = true;\nvar SelectNodeHandler = /** @class */ (function () {\n function SelectNodeHandler(tree_widget) {\n this.treeWidget = tree_widget;\n this.clear();\n }\n SelectNodeHandler.prototype.getSelectedNode = function () {\n var selectedNodes = this.getSelectedNodes();\n if (selectedNodes.length) {\n return selectedNodes[0];\n }\n else {\n return false;\n }\n };\n SelectNodeHandler.prototype.getSelectedNodes = function () {\n if (this.selectedSingleNode) {\n return [this.selectedSingleNode];\n }\n else {\n var selectedNodes = [];\n for (var id in this.selectedNodes) {\n if (this.selectedNodes.hasOwnProperty(id)) {\n var node = this.treeWidget.getNodeById(id);\n if (node) {\n selectedNodes.push(node);\n }\n }\n }\n return selectedNodes;\n }\n };\n SelectNodeHandler.prototype.getSelectedNodesUnder = function (parent) {\n if (this.selectedSingleNode) {\n if (parent.isParentOf(this.selectedSingleNode)) {\n return [this.selectedSingleNode];\n }\n else {\n return [];\n }\n }\n else {\n var selectedNodes = [];\n for (var id in this.selectedNodes) {\n if (this.selectedNodes.hasOwnProperty(id)) {\n var node = this.treeWidget.getNodeById(id);\n if (node && parent.isParentOf(node)) {\n selectedNodes.push(node);\n }\n }\n }\n return selectedNodes;\n }\n };\n SelectNodeHandler.prototype.isNodeSelected = function (node) {\n if (!node) {\n return false;\n }\n else if (node.id != null) {\n if (this.selectedNodes[node.id]) {\n return true;\n }\n else {\n return false;\n }\n }\n else if (this.selectedSingleNode) {\n return this.selectedSingleNode.element === node.element;\n }\n else {\n return false;\n }\n };\n SelectNodeHandler.prototype.clear = function () {\n this.selectedNodes = {};\n this.selectedSingleNode = null;\n };\n SelectNodeHandler.prototype.removeFromSelection = function (node, includeChildren) {\n var _this = this;\n if (includeChildren === void 0) { includeChildren = false; }\n if (node.id == null) {\n if (this.selectedSingleNode &&\n node.element === this.selectedSingleNode.element) {\n this.selectedSingleNode = null;\n }\n }\n else {\n delete this.selectedNodes[node.id];\n if (includeChildren) {\n node.iterate(function () {\n delete _this.selectedNodes[node.id];\n return true;\n });\n }\n }\n };\n SelectNodeHandler.prototype.addToSelection = function (node) {\n if (node.id != null) {\n this.selectedNodes[node.id] = true;\n }\n else {\n this.selectedSingleNode = node;\n }\n };\n return SelectNodeHandler;\n}());\nexports[\"default\"] = SelectNodeHandler;\n","\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nexports.__esModule = true;\nvar node_1 = require(\"./node\");\nvar NodeElement = /** @class */ (function () {\n function NodeElement(node, treeWidget) {\n this.init(node, treeWidget);\n }\n NodeElement.prototype.init = function (node, treeWidget) {\n this.node = node;\n this.treeWidget = treeWidget;\n if (!node.element) {\n node.element = this.treeWidget.element.get(0);\n }\n this.$element = jQuery(node.element);\n };\n NodeElement.prototype.addDropHint = function (position) {\n if (this.mustShowBorderDropHint(position)) {\n return new BorderDropHint(this.$element, this.treeWidget._getScrollLeft());\n }\n else {\n return new GhostDropHint(this.node, this.$element, position);\n }\n };\n NodeElement.prototype.select = function (mustSetFocus) {\n var $li = this.getLi();\n $li.addClass(\"jqtree-selected\");\n $li.attr(\"aria-selected\", \"true\");\n var $span = this.getSpan();\n $span.attr(\"tabindex\", this.treeWidget.options.tabIndex);\n if (mustSetFocus) {\n $span.focus();\n }\n };\n NodeElement.prototype.deselect = function () {\n var $li = this.getLi();\n $li.removeClass(\"jqtree-selected\");\n $li.attr(\"aria-selected\", \"false\");\n var $span = this.getSpan();\n $span.removeAttr(\"tabindex\");\n $span.blur();\n };\n NodeElement.prototype.getUl = function () {\n return this.$element.children(\"ul:first\");\n };\n NodeElement.prototype.getSpan = function () {\n return this.$element\n .children(\".jqtree-element\")\n .find(\"span.jqtree-title\");\n };\n NodeElement.prototype.getLi = function () {\n return this.$element;\n };\n NodeElement.prototype.mustShowBorderDropHint = function (position) {\n return position === node_1.Position.Inside;\n };\n return NodeElement;\n}());\nexports.NodeElement = NodeElement;\nvar FolderElement = /** @class */ (function (_super) {\n __extends(FolderElement, _super);\n function FolderElement() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FolderElement.prototype.open = function (onFinished, slide, animationSpeed) {\n var _this = this;\n if (slide === void 0) { slide = true; }\n if (animationSpeed === void 0) { animationSpeed = \"fast\"; }\n if (this.node.is_open) {\n return;\n }\n this.node.is_open = true;\n var $button = this.getButton();\n $button.removeClass(\"jqtree-closed\");\n $button.html(\"\");\n var button_el = $button.get(0);\n if (button_el) {\n var icon = this.treeWidget.renderer.openedIconElement.cloneNode(true);\n button_el.appendChild(icon);\n }\n var doOpen = function () {\n var $li = _this.getLi();\n $li.removeClass(\"jqtree-closed\");\n var $span = _this.getSpan();\n $span.attr(\"aria-expanded\", \"true\");\n if (onFinished) {\n onFinished(_this.node);\n }\n _this.treeWidget._triggerEvent(\"tree.open\", {\n node: _this.node\n });\n };\n if (slide) {\n this.getUl().slideDown(animationSpeed, doOpen);\n }\n else {\n this.getUl().show();\n doOpen();\n }\n };\n FolderElement.prototype.close = function (slide, animationSpeed) {\n var _this = this;\n if (slide === void 0) { slide = true; }\n if (animationSpeed === void 0) { animationSpeed = \"fast\"; }\n if (!this.node.is_open) {\n return;\n }\n this.node.is_open = false;\n var $button = this.getButton();\n $button.addClass(\"jqtree-closed\");\n $button.html(\"\");\n var button_el = $button.get(0);\n if (button_el) {\n var icon = this.treeWidget.renderer.closedIconElement.cloneNode(true);\n button_el.appendChild(icon);\n }\n var doClose = function () {\n var $li = _this.getLi();\n $li.addClass(\"jqtree-closed\");\n var $span = _this.getSpan();\n $span.attr(\"aria-expanded\", \"false\");\n _this.treeWidget._triggerEvent(\"tree.close\", {\n node: _this.node\n });\n };\n if (slide) {\n this.getUl().slideUp(animationSpeed, doClose);\n }\n else {\n this.getUl().hide();\n doClose();\n }\n };\n FolderElement.prototype.mustShowBorderDropHint = function (position) {\n return !this.node.is_open && position === node_1.Position.Inside;\n };\n FolderElement.prototype.getButton = function () {\n return this.$element\n .children(\".jqtree-element\")\n .find(\"a.jqtree-toggler\");\n };\n return FolderElement;\n}(NodeElement));\nexports.FolderElement = FolderElement;\nvar BorderDropHint = /** @class */ (function () {\n function BorderDropHint($element, scrollLeft) {\n var $div = $element.children(\".jqtree-element\");\n var elWidth = $element.width() || 0;\n var width = Math.max(elWidth + scrollLeft - 4, 0);\n var elHeight = $div.outerHeight() || 0;\n var height = Math.max(elHeight - 4, 0);\n this.$hint = jQuery('');\n $div.append(this.$hint);\n this.$hint.css({ width: width, height: height });\n }\n BorderDropHint.prototype.remove = function () {\n this.$hint.remove();\n };\n return BorderDropHint;\n}());\nexports.BorderDropHint = BorderDropHint;\nvar GhostDropHint = /** @class */ (function () {\n function GhostDropHint(node, $element, position) {\n this.$element = $element;\n this.node = node;\n this.$ghost = jQuery(\"