biojs-vis-pinpad
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -14,3 +14,2 @@ require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
category.title = catTitle; | ||
category.index = pinPad.categories.length; | ||
category.open = true; | ||
@@ -35,5 +34,3 @@ category.data = []; | ||
.on('click', function() { | ||
categoryContainer.remove(); | ||
category.pinPad.categories.splice(category.index, 1); | ||
category.pinPad.dispatcher.remove({category: category.title}); | ||
category.remove(); | ||
}); | ||
@@ -43,2 +40,19 @@ | ||
category.remove = function() { | ||
while (category.elements.length !== 0) { | ||
category.elements[0].remove(category.data[0].id, category.title, false); | ||
} | ||
}; | ||
category.removeDom = function() { | ||
var index = _.findIndex(category.pinPad.categories, function(cat) { | ||
return cat.title === category.title; | ||
}); | ||
if (index !== -1) { | ||
categoryContainer.remove(); | ||
category.pinPad.categories.splice(index, 1); | ||
category.pinPad.dispatcher.remove({category: category.title}); | ||
} | ||
}; | ||
category.toggle = function() { | ||
@@ -57,6 +71,6 @@ if (category.padContainer.style('display') === 'none') { | ||
category.addElement = function(id, sections) { | ||
var elem = {sortAttribute: sections[0].title, id: id, sections: sections}; | ||
var sortedIndex = _.sortedIndex(category.data, elem, 'sortAttribute'); | ||
elem.sortedIndex = sortedIndex; | ||
category.data.splice(sortedIndex, 0, elem); | ||
var datum = {sortAttribute: sections[0].title, id: id, sections: sections}; | ||
var sortedIndex = _.sortedIndex(category.data, datum, 'sortAttribute'); | ||
datum.sortedIndex = sortedIndex; | ||
category.data.splice(sortedIndex, 0, datum); | ||
return sortedIndex; | ||
@@ -68,3 +82,3 @@ }; | ||
if (sortedIndex === (category.data.length-1)) { | ||
newElem = ElementFactory.createElement(category, category.data[category.data.length-1]); | ||
newElem = ElementFactory.createElement(category, category.data[category.data.length-1]); | ||
category.elements.push(newElem); | ||
@@ -90,5 +104,16 @@ } else { | ||
}, | ||
removeCategory: function(category) { | ||
category.remove(); | ||
}, | ||
createElement: function(category, id, sections) { | ||
var sortedIndex = category.addElement(id, sections); | ||
return category.displayElements(sortedIndex); | ||
}, | ||
removeElement: function(category, elId) { | ||
var index = _.findIndex(category.data, function(datum){ | ||
return datum.id === elId; | ||
}); | ||
if (index !== -1) { | ||
ElementFactory.removeElement(category.elements[index], category.title); | ||
} | ||
} | ||
@@ -165,3 +190,3 @@ }; | ||
} else { | ||
tr.append('td').text(key.replace('_', ' ')); | ||
tr.append('td').text(key.replace(/_/g, ' ')); | ||
addValue(tr.append('td'), info); | ||
@@ -197,3 +222,3 @@ } | ||
var elemContainer = element.category.padContainer.append('div'); | ||
var elemContainer = element.category.padContainer.append('div').attr('id', 'pinned_elem_id_' + elem.id); | ||
element.first(element.category.title, elemContainer, _.first(element.content.sections)); | ||
@@ -222,8 +247,3 @@ element.tail(element.table, _.tail(element.content.sections)); | ||
.on('click', function() { | ||
container.remove(); | ||
element.category.elements.splice(element.sortedIndex, 1); | ||
element.category.data.splice(element.sortedIndex, 1); | ||
element.category.pinPad.dispatcher.remove({element: { | ||
category: catTitle, id: element.content.id, sections: element.content.sections} | ||
}); | ||
element.remove(element.content.id, catTitle); | ||
}); | ||
@@ -247,6 +267,23 @@ | ||
Element.prototype.remove = function(id, catTitle) { | ||
var element = this; | ||
var container = d3.select('#' + 'pinned_elem_id_' + id); | ||
container.remove(); | ||
element.category.elements.splice(element.sortedIndex, 1); | ||
element.category.data.splice(element.sortedIndex, 1); | ||
element.category.pinPad.dispatcher.remove({element: { | ||
category: catTitle, id: element.content.id, sections: element.content.sections} | ||
}); | ||
if (element.category.elements.length === 0) { | ||
element.category.removeDom(); | ||
} | ||
}; | ||
var ElementFactory = function () { | ||
return { | ||
createElement: function(category, element) { | ||
return new Element(category, element); | ||
createElement: function(category, elem) { | ||
return new Element(category, elem); | ||
}, | ||
removeElement: function(element, catTitle) { | ||
element.remove(element.content.id, catTitle); | ||
} | ||
@@ -367,2 +404,24 @@ }; | ||
PinpadViewer.prototype.removeElement = function(id) { | ||
var pinPad = this; | ||
var category = _.find(pinPad.categories, function(cat) { | ||
return _.some(cat.data, function(datum) { | ||
return datum.id === id; | ||
}); | ||
}); | ||
if (category) { | ||
CategoryFactory.removeElement(category, id); | ||
} | ||
}; | ||
PinpadViewer.prototype.removeCategory = function(catTitle) { | ||
var pinPad = this; | ||
var category = _.find(pinPad.categories, function(cat) { | ||
return cat.title === catTitle; | ||
}); | ||
if (category) { | ||
CategoryFactory.removeCategory(category); | ||
} | ||
}; | ||
/** | ||
@@ -382,2 +441,2 @@ * Method responsible to say Hello | ||
},{"./CategoryFactory":1,"d3":"d3","underscore":"underscore"}]},{},["biojs-vis-pinpad"]) | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlc1xcYnJvd3NlcmlmeVxcbm9kZV9tb2R1bGVzXFxicm93c2VyLXBhY2tcXF9wcmVsdWRlLmpzIiwibGliXFxDYXRlZ29yeUZhY3RvcnkuanMiLCJsaWJcXEVsZW1lbnRGYWN0b3J5LmpzIiwibGliXFxQaW5wYWRWaWV3ZXIuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUNBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUF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tcclxuICAgICAgICB9LFxyXG4gICAgICAgIGNyZWF0ZUVsZW1lbnQ6IGZ1bmN0aW9uKGNhdGVnb3J5LCBpZCwgc2VjdGlvbnMpIHtcclxuICAgICAgICAgICAgdmFyIHNvcnRlZEluZGV4ID0gY2F0ZWdvcnkuYWRkRWxlbWVudChpZCwgc2VjdGlvbnMpO1xyXG4gICAgICAgICAgICByZXR1cm4gY2F0ZWdvcnkuZGlzcGxheUVsZW1lbnRzKHNvcnRlZEluZGV4KTtcclxuICAgICAgICB9XHJcbiAgICB9O1xyXG59KCk7XHJcblxyXG5tb2R1bGUuZXhwb3J0cyA9IENhdGVnb3J5RmFjdG9yeTsiLCIvKmpzbGludCBub2RlOiB0cnVlICovXHJcbi8qanNoaW50IGxheGJyZWFrOiB0cnVlICovXHJcblwidXNlIHN0cmljdFwiO1xyXG5cclxudmFyIGQzID0gcmVxdWlyZSgnZDMnKTtcclxudmFyIF8gPSByZXF1aXJlKCd1bmRlcnNjb3JlJyk7XHJcblxyXG52YXIgaXNMaW5rID0gZnVuY3Rpb24oaW5mbykge1xyXG4gICAgaWYgKCh0eXBlb2YgaW5mbyA9PT0gJ29iamVjdCcpICYmICEoaW5mbyBpbnN0YW5jZW9mIEFycmF5KSkge1xyXG4gICAgICAgIHZhciBrZXlzID0gXy5rZXlzKGluZm8pO1xyXG4gICAgICAgIGlmICgoa2V5cy5sZW5ndGggPT09IDIpICYmIF8uY29udGFpbnMoa2V5cywgJ3ZhbHVlJykgJiYgXy5jb250YWlucyhrZXlzLCAnbGluaycpKSB7XHJcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgICAgIH1cclxuICAgIH1cclxuICAgIHJldHVybiBmYWxzZVxyXG59O1xyXG5cclxudmFyIGFkZExpbmsgPSBmdW5jdGlvbihjb250YWluZXIsIGluZm9UZXh0LCBpbmZvTGluaykge1xyXG4gICAgaWYgKGluZm9MaW5rICYmIChpbmZvTGluayAhPT0gJy0nKSkge1xyXG4gICAgICAgIGNvbnRhaW5lci5hcHBlbmQoJ2EnKVxyXG4gICAgICAgICAgICAuYXR0cignaHJlZicsIGluZm9MaW5rKVxyXG4gICAgICAgICAgICAuYXR0cigndGFyZ2V0JywgJ19ibGFuaycpXHJcbiAgICAgICAgICAgIC50ZXh0KGluZm9UZXh0KTtcclxuICAgIH0gZWxzZSB7XHJcbiAgICAgICAgY29udGFpbmVyLnRleHQoaW5mb1RleHQpO1xyXG4gICAgfVxyXG59O1xyXG5cclxudmFyIGFkZFZhbHVlID0gZnVuY3Rpb24oY29udGFpbmVyLCBpbmZvKSB7XHJcbiAgICBpZiAoKHR5cGVvZiBpbmZvID09PSAnc3RyaW5nJykgfHwgKHR5cGVvZiBpbmZvID09PSAnbnVtYmVyJykgfHwgKHR5cGVvZiBpbmZvID09PSAnYm9vbGVhbicpKSB7XHJcbiAgICAgICAgY29udGFpbmVyLnRleHQoaW5mbyk7XHJcbiAgICB9IGVsc2UgaWYgKGlzTGluayhpbmZvKSkge1xyXG4gICAgICAgIGFkZExpbmsoY29udGFpbmVyLCBpbmZvLnZhbHVlLCBpbmZvLmxpbmspO1xyXG4gICAgfSBlbHNlIGlmIChpbmZvIGluc3RhbmNlb2YgQXJyYXkpIHtcclxuICAgICAgICBfLmVhY2goaW5mbywgZnVuY3Rpb24oZGF0dW0sIGluZGV4KSB7XHJcbiAgICAgICAgICAgIHZhciBzcGFuID0gY29udGFpbmVyLmFwcGVuZCgnc3BhbicpO1xyXG4gICAgICAgICAgICBhZGRWYWx1ZShzcGFuLCBkYXR1bSk7XHJcbiAgICAgICAgICAgIGlmIChpbmRleCAhPT0gKGluZm8ubGVuZ3RoLTEpKSB7XHJcbiAgICAgICAgICAgICAgICBjb250YWluZXIuYXBwZW5kKCdzcGFuJykudGV4dCgnLCAnKTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0pO1xyXG4gICAgfSBlbHNlIHtcclxuICAgICAgICBhZGREYXRhKGNvbnRhaW5lci5hcHBlbmQoJ3RhY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WRkVmFsdWUodHIuYXBwZW5kKCd0ZCcpLCBpbmZvKTtcclxuICAgIH1cclxufTtcclxuXHJcbnZhciBhZGREYXRhID0gZnVuY3Rpb24odGFibGUsIGRhdGEpIHtcclxuICAgIF8uZWFjaChkYXRhLCBmdW5jdGlvbihpbmZvLCBrZXkpIHtcclxuICAgICAgICBhZGREYXR1bSh0YWJsZSwga2V5LCBpbmZvKTtcclxuICAgIH0pO1xyXG59O1xyXG5cclxudmFyIEVsZW1lbnQgPSBmdW5jdGlvbihjYXRlZ29yeSwgZWxlbSkge1xyXG4gICAgdmFyIGVsZW1lbnQgPSB0aGlzO1xyXG4gICAgZWxlbWVudC5jYXRlZ29yeSA9IGNhdGVnb3J5O1xyXG4gICAgZWxlbWVudC5jb250ZW50ID0gZWxlbTtcclxuICAgIGVsZW1lbnQuaGVhZGVyID0gdW5kZWZpbmVkO1xyXG4gICAgZWxlbWVudC50YWJsZUNvbnRhaW5lciA9IHVuZGVmaW5lZDtcclxuICAgIGVsZW1lbnQudGFibGUgPSB1bmRlZmluZWQ7XHJcblxyXG4gICAgZWxlbWVudC50b2dnbGUgPSBmdW5jdGlvbigpIHtcclxuICAgICAgICBpZiAoZWxlbWVudC50YWJsZUNvbnRhaW5lci5zdHlsZSgnZGlzcGxheScpID09PSAnbm9uZScpIHtcclxuICAgICAgICAgICAgZWxlbWVudC50YWJsZUNvbnRhaW5lci5zdHlsZSgnZGlzcGxheScsICdibG9jaycpO1xyXG4gICAgICAgICAgICBlbGVtZW50LmhlYWRlci50aXRsZS5hdHRyKCdjbGFzcycsICd1cF9wcF9lbGVtZW50LW5hbWUgdXBfcGZ0dl9hcnJvdy1kb3duJyk7XHJcbiAgICAgICAgICAgIGVsZW1lbnQuY29udGVudC5vcGVuID0gdHJ1ZTtcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICBlbGVtZW50LnRhYmxlQ29udGFpbmVyLnN0eWxlKCdkaXNwbGF5JywgJ25vbmUnKTtcclxuICAg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biAgICBpZiAoKHR5cGVvZiBpbmZvID09PSAnb2JqZWN0JykgJiYgIShpbmZvIGluc3RhbmNlb2YgQXJyYXkpKSB7XHJcbiAgICAgICAgdmFyIGtleXMgPSBfLmtleXMoaW5mbyk7XHJcbiAgICAgICAgaWYgKChrZXlzLmxlbmd0aCA9PT0gMikgJiYgXy5jb250YWlucyhrZXlzLCAndmFsdWUnKSAmJiBfLmNvbnRhaW5zKGtleXMsICdsaW5rJykpIHtcclxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG4gICAgcmV0dXJuIGZhbHNlXHJcbn07XHJcblxyXG52YXIgYWRkTGluayA9IGZ1bmN0aW9uKGNvbnRhaW5lciwgaW5mb1RleHQsIGluZm9MaW5rKSB7XHJcbiAgICBpZiAoaW5mb0xpbmsgJiYgKGluZm9MaW5rICE9PSAnLScpKSB7XHJcbiAgICAgICAgY29udGFpbmVyLmFwcGVuZCgnYScpXHJcbiAgICAgICAgICAgIC5hdHRyKCdocmVmJywgaW5mb0xpbmspXHJcbiAgICAgICAgICAgIC5hdHRyKCd0YXJnZXQnLCAnX2JsYW5rJylcclxuICAgICAgICAgICAgLnRleHQoaW5mb1RleHQpO1xyXG4gICAgfSBlbHNlIHtcclxuICAgICAgICBjb250YWluZXIudGV4dChpbmZvVGV4dCk7XHJcbiAgICB9XHJcbn07XHJcblxyXG52YXIgYWRkVmFsdWUgPSBmdW5jdGlvbihjb250YWluZXIsIGluZm8pIHtcclxuICAgIGlmICgodHlwZW9mIGluZm8gPT09ICdzdHJpbmcnKSB8fCAodHlwZW9mIGluZm8gPT09ICdudW1iZXInKSB8fCAodHlwZW9mIGluZm8gPT09ICdib29sZWFuJykpIHtcclxuICAgICAgICBjb250YWluZXIudGV4dChpbmZvKTtcclxuICAgIH0gZWxzZSBpZiAoaXNMaW5rKGluZm8pKSB7XHJcbiAgICAgICAgYWRkTGluayhjb250YWluZXIsIGluZm8udmFsdWUsIGluZm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JcblxyXG4gICAgZWxlbWVudC50b2dnbGUgPSBmdW5jdGlvbigpIHtcclxuICAgICAgICBpZiAoZWxlbWVudC50YWJsZUNvbnRhaW5lci5zdHlsZSgnZGlzcGxheScpID09PSAnbm9uZScpIHtcclxuICAgICAgICAgICAgZWxlbWVudC50YWJsZUNvbnRhaW5lci5zdHlsZSgnZGlzcGxheScsICdibG9jaycpO1xyXG4gICAgICAgICAgICBlbGVtZW50LmhlYWRlci50aXRsZS5hdHRyKCdjbGFzcycsICd1cF9wcF9lbGVtZW50LW5hbWUgdXBfcGZ0dl9hcnJvdy1kb3duJyk7XHJcbiAgICAgICAgICAgIGVsZW1lbnQuY29udGVudC5vcGVuID0gdHJ1ZTtcclxuICAgICAgICB9IGVsc2Uge1xyXG4gICAgICAgICAgICBlbGVtZW50LnRhYmxlQ29udGFpbmVyLnN0eWxlKCdkaXNwbGF5JywgJ25vbmUnKTtcclxuICAgICAgICAgICAgZWxlbWVudC5oZWFkZXIudGl0bGUuYXR0cignY2xhc3MnLCAndXBfcHBfZWxlbWVudC1uYW1lIHVwX3BmdHZfYXJyb3ctcmlnaHQnKTtcclxuICAgICAgICAgICAgZWxlbWVudC5jb250ZW50Lm9wZW4gPSBmYWxzZTtcclxuICAgICAgICB9XHJcbiAgICB9O1xyXG5cclxuICAgIHZhciBlbGVtQ29udGFpbmVyID0gZWxlbWVudC5jYXRlZ29yeS5wYWRDb250YWluZXIuYXBwZW5kKCdkaXYnKS5hdHRyKCdpZCcsICdwaW5uZWRfZWxlbV9pZF8nICsgZWxlbS5pZCk7XHJcbiAgICBlbGVtZW50LmZpcnN0KGVsZW1lbnQuY2F0ZWdvcnkudGl0bGUsIGVsZW1Db250YWluZXIsIF8uZmlyc3QoZWxlbWVudC5jb250ZW50LnNlY3Rpb25zKSk7XHJcbiAgICBlbGVtZW50LnRhaWwoZWxlbWVudC50YWJsZSwgXy50YWlsKGVsZW1lbnQuY29udGVudC5zZWN0aW9ucykpO1xyXG5cclxuICAgIGl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xsb1xyXG4gKiBAZXhhbXBsZVxyXG4gKiAgICAgYmlvanN2aXNwaW5wYWQuaGVsbG8oJ2Jpb2pzJyk7XHJcbiAqIEBtZXRob2QgaGVsbG9cclxuICogQHBhcmFtIHtTdHJpbmd9IG5hbWUgTmFtZSBvZiBhIHBlcnNvblxyXG4gKiBAcmV0dXJuIHtTdHJpbmd9IFJldHVybnMgaGVsbG8gbmFtZVxyXG4gKi9cclxuUGlucGFkVmlld2VyLmhlbGxvID0gZnVuY3Rpb24gKG5hbWUpIHtcclxuICAgIHJldHVybiAnaGVsbG8gJyArIG5hbWU7XHJcbn07XHJcblxyXG5tb2R1bGUuZXhwb3J0cyA9IFBpbnBhZFZpZXdlcjsiXX0= |
@@ -1,14 +0,14 @@ | ||
� �Y_o��*6����V��E�,�{h���=�=�AK��[�T):�������(ٱ��S_b����8����y�=��%'<2TR� Z�G����A<�O�>=3=)2�II����D�lg3���=�lVĚ�����N1�k���r�3�_&��V:"�LJe&[!�ɓ*%��@n� ���+���eR'�*xF�����|Z������Ͽ���кA~y��gG��R���iV����1�YYFy�>Q�M�[ef ���q�DU���)���~'���G�G���4Av�=��"[���YRr�3�����U���Mt\���xx|$��Oj�En��$�"��GS�=Ȃ�:W��8�*���o�J�ĥ���F�W �Yȶ3�^�+�TB�Ɗ�S�aJ��� ���8���҂�Nt��*.��� | ||
fX��O�=���Uk�8�Xq��aBr�� | ||
6 �x&q����9��uU��a����@2�szf��ߒ���ov�u��>�Kˍ�13ɞ��y� �_�z����o&2qf��"�J�`��`N�ە<��@ | ||
l]1y�� ���'�yd[*f@8-v{�"1V`^Us�57�����Ed���O�-�u���z�i�� � | ||
v�ȅ]T� �L�����bꂫi��Ļ� | ||
��K[�f��D*�!�!so>�d�w�eJ6������>]����V�?}�����%T5���pe�L-Pٱ���N����:j���H9���Q���b����?1��PEɀ�+[H�iW7| i�� | ||
J | ||
�L���q�6ٳ�d�9s�o˭�N��]d2�䚃��H�#F��qP���P�!��� Hr�� | ||
�+�g�,�,�{�;Yխ�� �BCg 9E���",rP�4�7�̴Z[��>����� | ||
���+��B�q�i{ | ||
C�<>vJ��i"hԾf���Ӷ�����;��Tv��������6���V��F|"dm��q���5�Œ����݈]n�7���l�j0 yf��/�BB�p�g�pXa�lF]U����)�?Ӏ��o йW��c�_oJ�����r�4�����^��;��� ����F��� ����m��ϝ��Ī ��g��C40}X���>jx+)А�io��r6ӵ�:!�#i�� v0T��ތfO��u��:ֶ��$��k{9Y���K�D�;f3�|c_�W����!'�m ������kLE��R���`,�a�J�[�Hj�)TimHoOZ��ݺg�"��-�1[[����!V�s�1P �0@�"k� ��Q�K�M�(FO#���ѯ����X}���s�����kP�h׃�Khb��,��L�_! | ||
�. | ||
�� X\����=�� cզQ��<��Ƙ�[����v��z��1Qzm�ֽ�%�����Y��W��2 | ||
k_{��Ć�e.CUo�����������H��`�����s 1!��d��@�"m�1/ѽ}wq���%Ƣaօ�(z`�N��iZ����(�<A6&7<g�Q�=�w�X��`�v�F5*h��'�kp|�ͷ�{�<�4 �)��b�r�ґ��s���̭[�;¤9`���l����?�zq��w�QG��%����ƃ�~#��u]JnZT��sL����h_�ĕ{U*����\�!��!k{%T�*k�2���ȋO]��Oo[=W� ��Z�C�_��~^s��L}y���!������Ђ��m��UA������am}3ZB�4E\��O ��Z�kW�`Ũ߄� ��`��� �w�m=Ɠ�e����S�&(찌 &58�3A]���/��+#k�hX�m�Ch����c��$5'!_�Q������ C���d8�a#T���u��td�CFT^�'���Z0��d�� �����7^��f[�z'� �f���"��p_�G{�o4�ѭO��iA8�kG���~3NB1�*�Å�P"�������f�)J��ݕ ��X}�.:�aծ2=�y@�b��Y@�*�D� �> |