solid-panes 3.7.3-125af630 → 3.7.3-1bd42721

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/RDFXMLPane.js +58 -0
  2. package/dist/RDFXMLPane.js.map +1 -0
  3. package/dist/argument/argumentPane.js +61 -0
  4. package/dist/argument/argumentPane.js.map +1 -0
  5. package/dist/attach/attachPane.js +394 -0
  6. package/dist/attach/attachPane.js.map +1 -0
  7. package/dist/audio/audioPane.js +182 -0
  8. package/dist/audio/audioPane.js.map +1 -0
  9. package/dist/classInstancePane.js +92 -0
  10. package/dist/classInstancePane.js.map +1 -0
  11. package/dist/dataContentPane.js +259 -0
  12. package/dist/dataContentPane.js.map +1 -0
  13. package/dist/defaultPane.js +75 -0
  14. package/dist/defaultPane.js.map +1 -0
  15. package/dist/dokieli/dokieliPane.js +169 -0
  16. package/dist/dokieli/dokieliPane.js.map +1 -0
  17. package/dist/dokieli/new.js +28 -0
  18. package/dist/dokieli/new.js.map +1 -0
  19. package/dist/form/pane.js +185 -0
  20. package/dist/form/pane.js.map +1 -0
  21. package/dist/humanReadablePane.js +135 -0
  22. package/dist/humanReadablePane.js.map +1 -0
  23. package/dist/imagePane.js +70 -0
  24. package/dist/imagePane.js.map +1 -0
  25. package/dist/microblogPane/microblogPane.js +1031 -0
  26. package/dist/microblogPane/microblogPane.js.map +1 -0
  27. package/dist/n3Pane.js +56 -0
  28. package/dist/n3Pane.js.map +1 -0
  29. package/dist/outline/manager.js +1997 -0
  30. package/dist/outline/manager.js.map +1 -0
  31. package/dist/outline/outlineIcons.js +127 -0
  32. package/dist/outline/outlineIcons.js.map +1 -0
  33. package/dist/outline/queryByExample.js +285 -0
  34. package/dist/outline/queryByExample.js.map +1 -0
  35. package/dist/outline/userInput.js +1819 -0
  36. package/dist/outline/userInput.js.map +1 -0
  37. package/dist/playlist/playlistPane.js +124 -0
  38. package/dist/playlist/playlistPane.js.map +1 -0
  39. package/dist/registerPanes.js +146 -0
  40. package/dist/registerPanes.js.map +1 -0
  41. package/dist/schedule/formsForSchedule.js +124 -0
  42. package/dist/schedule/formsForSchedule.js.map +1 -0
  43. package/dist/schedule/schedulePane.js +889 -0
  44. package/dist/schedule/schedulePane.js.map +1 -0
  45. package/dist/slideshow/slideshowPane.js +80 -0
  46. package/dist/slideshow/slideshowPane.js.map +1 -0
  47. package/dist/socialPane.js +430 -0
  48. package/dist/socialPane.js.map +1 -0
  49. package/dist/tableViewPane.js +57 -0
  50. package/dist/tableViewPane.js.map +1 -0
  51. package/dist/transaction/pane.js +478 -0
  52. package/dist/transaction/pane.js.map +1 -0
  53. package/dist/transaction/period.js +324 -0
  54. package/dist/transaction/period.js.map +1 -0
  55. package/dist/trip/tripPane.js +175 -0
  56. package/dist/trip/tripPane.js.map +1 -0
  57. package/dist/ui/pane.js +147 -0
  58. package/dist/ui/pane.js.map +1 -0
  59. package/dist/versionInfo.js +2 -2
  60. package/dist/video/videoPane.js +43 -0
  61. package/dist/video/videoPane.js.map +1 -0
  62. package/package.json +3 -2
@@ -0,0 +1,324 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var UI = _interopRequireWildcard(require("solid-ui"));
8
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
9
+ /* Financial Period Pane
10
+ **
11
+ ** This outline pane allows a user to interact with a period
12
+ ** downloaded from a bank statement, annotting it with classes and comments,
13
+ ** trips, etc
14
+ */
15
+
16
+ const ns = UI.ns;
17
+ var _default = exports.default = {
18
+ icon: UI.icons.iconBase + 'noun_142708.svg',
19
+ name: 'period',
20
+ audience: [ns.solid('PowerUser')],
21
+ // Does the subject deserve this pane?
22
+ label: function (subject, context) {
23
+ const kb = context.session.store;
24
+ const t = kb.findTypeURIs(subject);
25
+ if (t['http://www.w3.org/2000/10/swap/pim/qif#Period']) return 'period';
26
+ return null; // No under other circumstances (while testing at least!)
27
+ },
28
+ render: function (subject, context) {
29
+ const dom = context.dom;
30
+ const kb = context.session.store;
31
+ const ns = UI.ns;
32
+ const div = dom.createElement('div');
33
+ div.setAttribute('class', 'periodPane');
34
+ const mention = function mention(message, style) {
35
+ if (!style) style = 'color: grey;';
36
+ const pre = dom.createElement('pre');
37
+ pre.setAttribute('style', style);
38
+ div.appendChild(pre);
39
+ pre.appendChild(dom.createTextNode(message));
40
+ };
41
+ const happy = function happy(message) {
42
+ return mention('✓ ' + message, 'color: #010; background-color: #efe');
43
+ };
44
+ const complain = function complain(message) {
45
+ return mention(message, 'color: #100; background-color: #fee');
46
+ };
47
+ /*
48
+ var rerender = function (div) {
49
+ var parent = div.parentNode
50
+ var div2 = thisPane.render(subject, dom)
51
+ parent.replaceChild(div2, div)
52
+ }
53
+ */
54
+ const renderPeriod = function () {
55
+ const dtstart = kb.any(subject, ns.cal('dtstart'));
56
+ if (dtstart === undefined) {
57
+ complain('(Error: There is no start date known for this period <' + subject.uri + '>,\n -- every period needs one.)');
58
+ }
59
+ const dtend = kb.any(subject, ns.cal('dtend'));
60
+ if (dtend === undefined) {
61
+ complain('(Error: There is no end date known for this period <' + subject.uri + '>,\n -- every period needs one.)');
62
+ }
63
+
64
+ // var store = kb.any(subject, UI.ns.qu('annotationStore')) || null
65
+
66
+ const predicateURIsDone = {};
67
+ const donePredicate = function (pred) {
68
+ predicateURIsDone[pred.uri] = true;
69
+ };
70
+ donePredicate(ns.rdf('type'));
71
+ const inPeriod = function (date) {
72
+ return !!(date && date >= dtstart && date < dtend);
73
+ };
74
+ const d2 = function (n) {
75
+ const s = '' + n;
76
+ if (s.indexOf('.') >= 0) {
77
+ return s.split('.')[0] + '.' + (s.split('.')[1] + '00').slice(0, 2);
78
+ }
79
+ return s + '.00';
80
+ };
81
+ const transactionInPeriod = function (x) {
82
+ return inPeriod(kb.any(x, ns.qu('date')));
83
+ };
84
+ const oderByDate = function (x, y) {
85
+ const dx = kb.any(x, ns.qu('date'));
86
+ const dy = kb.any(y, ns.qu('date'));
87
+ if (dx !== undefined && dy !== undefined) {
88
+ if (dx.value < dy.value) return -1;
89
+ if (dx.value > dy.value) return 1;
90
+ }
91
+ if (x.uri < y.uri) return -1; // Arbitrary but repeatable
92
+ if (x.uri > y.uri) return 1;
93
+ return 0;
94
+ };
95
+ /*
96
+ var setPaneStyle = function (account) {
97
+ var mystyle = 'padding: 0.5em 1.5em 1em 1.5em; '
98
+ if (account) {
99
+ var backgroundColor = kb.any(account, UI.ns.ui('backgroundColor'))
100
+ if (backgroundColor) {
101
+ mystyle += 'background-color: ' + backgroundColor.value + '; '
102
+ }
103
+ }
104
+ div.setAttribute('style', mystyle)
105
+ }
106
+ // setPaneStyle();
107
+ */
108
+ const h2 = div.appendChild(dom.createElement('h2'));
109
+ h2.textContent = 'Period ' + dtstart.value.slice(0, 10) + ' - ' + dtend.value.slice(0, 10);
110
+ const insertedPane = function (context, subject, paneName) {
111
+ const p = context.session.paneRegistry.byName(paneName);
112
+ const d = p.render(subject, context);
113
+ d.setAttribute('style', 'border: 0.1em solid green;');
114
+ return d;
115
+ };
116
+ const expandAfterRow = function (dom, row, subject, paneName, solo) {
117
+ const siblings = row.parentNode.children;
118
+ if (solo) {
119
+ for (let j = siblings.length - 1; j >= 0; j--) {
120
+ if (siblings[j].expanded) {
121
+ siblings[j].parentNode.removeChild(siblings[j].expanded);
122
+ siblings[j].expanded = false;
123
+ }
124
+ }
125
+ }
126
+ const tr = dom.createElement('tr');
127
+ const td = tr.appendChild(dom.createElement('td'));
128
+ td.setAttribute('style', 'width: 98%; padding: 1em; border: 0.1em solid grey;');
129
+ const cols = row.children.length;
130
+ if (row.nextSibling) {
131
+ row.parentNode.insertBefore(tr, row.nextSibling);
132
+ } else {
133
+ row.parentNode.appendChild(tr);
134
+ }
135
+ row.expanded = tr;
136
+ td.setAttribute('colspan', '' + cols);
137
+ td.appendChild(insertedPane(context, subject, paneName));
138
+ };
139
+ const expandAfterRowOrCollapse = function (dom, row, subject, paneName, solo) {
140
+ if (row.expanded) {
141
+ row.parentNode.removeChild(row.expanded);
142
+ row.expanded = false;
143
+ } else {
144
+ expandAfterRow(dom, row, subject, paneName, solo);
145
+ }
146
+ };
147
+ const transactionTable = function (dom, list) {
148
+ const table = dom.createElement('table');
149
+ table.setAttribute('style', 'margin-left: 100; font-size: 9pt; width: 85%;');
150
+ const transactionRow = function (dom, x) {
151
+ const tr = dom.createElement('tr');
152
+ const setTRStyle = function (tr, account) {
153
+ // var mystyle = "padding: 0.5em 1.5em 1em 1.5em; ";
154
+ let mystyle = 'margin-left: 8em; padding-left: 5em;';
155
+ if (account) {
156
+ const backgroundColor = kb.any(account, UI.ns.ui('backgroundColor'));
157
+ if (backgroundColor) {
158
+ mystyle += 'background-color: ' + backgroundColor.value + '; ';
159
+ }
160
+ }
161
+ tr.setAttribute('style', mystyle);
162
+ };
163
+ const account = kb.any(x, ns.qu('toAccount'));
164
+ setTRStyle(tr, account);
165
+ const c0 = tr.appendChild(dom.createElement('td'));
166
+ const date = kb.any(x, ns.qu('date'));
167
+ c0.textContent = date ? date.value.slice(0, 10) : '???';
168
+ c0.setAttribute('style', 'width: 7em;');
169
+ const c1 = tr.appendChild(dom.createElement('td'));
170
+ c1.setAttribute('style', 'width: 36em;');
171
+ const payee = kb.any(x, ns.qu('payee'));
172
+ c1.textContent = payee ? payee.value : '???';
173
+ const a1 = c1.appendChild(dom.createElement('a'));
174
+ a1.textContent = ' ➜';
175
+ a1.setAttribute('href', x.uri);
176
+ const c3 = tr.appendChild(dom.createElement('td'));
177
+ const amount = kb.any(x, ns.qu('in_USD'));
178
+ c3.textContent = amount ? d2(amount.value) : '???';
179
+ c3.setAttribute('style', 'width: 6em; text-align: right; '); // @@ decimal alignment?
180
+ tr.addEventListener('click', function (e) {
181
+ // solo unless shift key
182
+ expandAfterRowOrCollapse(dom, tr, x, 'transaction', !e.shiftKey);
183
+ }, false);
184
+ return tr;
185
+ };
186
+ const list2 = list.filter(transactionInPeriod);
187
+ list2.sort(oderByDate);
188
+ for (let i = 0; i < list2.length; i++) {
189
+ table.appendChild(transactionRow(dom, list2[i]));
190
+ }
191
+ return table;
192
+ };
193
+
194
+ // List unclassified transactions
195
+
196
+ const dummies = {
197
+ 'http://www.w3.org/2000/10/swap/pim/qif#Transaction': true,
198
+ // (we knew)
199
+ 'http://www.w3.org/2000/10/swap/pim/qif#Unclassified': true,
200
+ // pseudo classifications we may phase out
201
+ 'http://www.w3.org/2000/10/swap/pim/qif#UnclassifiedOutgoing': true,
202
+ 'http://www.w3.org/2000/10/swap/pim/qif#UnclassifiedIncome': true
203
+ };
204
+ const xURIs = kb.findMemberURIs(ns.qu('Transaction'));
205
+ const unclassifiedIn = [];
206
+ const unclassifiedOut = [];
207
+ let usd, z;
208
+ for (const y in xURIs) {
209
+ // For each thing which can be inferred to be a transaction
210
+ // @@ TODO: Write away the need for exception on next line
211
+
212
+ if (Object.prototype.hasOwnProperty.call(xURIs, y)) {
213
+ z = kb.sym(y);
214
+ const tt = kb.each(z, ns.rdf('type')); // What EXPLICIT definitions
215
+ let classified = false;
216
+ for (let j = 0; j < tt.length; j++) {
217
+ const t = tt[j];
218
+ if (dummies[t.uri] === undefined) {
219
+ classified = true;
220
+ }
221
+ }
222
+ if (!classified) {
223
+ usd = kb.any(z, ns.qu('in_USD'));
224
+ if (usd === undefined) {
225
+ usd = kb.any(z, ns.qu('amount'));
226
+ }
227
+ if (usd && ('' + usd.value).indexOf('-') >= 0) {
228
+ unclassifiedOut.push(kb.sym(y));
229
+ } else {
230
+ unclassifiedIn.push(kb.sym(y));
231
+ }
232
+ }
233
+ }
234
+ }
235
+ let tab, count;
236
+ if (unclassifiedIn.length) {
237
+ tab = transactionTable(dom, unclassifiedIn);
238
+ count = tab.children.length;
239
+ div.appendChild(dom.createElement('h3')).textContent = 'Unclassified Income' + (count < 4 ? '' : ' (' + count + ')');
240
+ div.appendChild(tab);
241
+ } else {
242
+ happy('No unclassified income');
243
+ }
244
+ if (unclassifiedOut.length) {
245
+ tab = transactionTable(dom, unclassifiedOut);
246
+ count = tab.children.length;
247
+ div.appendChild(dom.createElement('h3')).textContent = 'Unclassified Outgoings' + (count < 4 ? '' : ' (' + count + ')');
248
+ div.appendChild(tab);
249
+ } else {
250
+ happy('No unclassified outgoings ');
251
+ }
252
+
253
+ // /////////////// Check some categories of transaction for having given fields
254
+
255
+ const catSymbol = function (catTail) {
256
+ const cats = kb.findSubClassesNT(ns.qu('Transaction'));
257
+ for (const cat in cats) {
258
+ // @@ TODO: Write away the need for exception on next line
259
+
260
+ if (Object.prototype.hasOwnProperty.call(cats, cat)) {
261
+ if (cat.slice(1, -1).split('#')[1] === catTail) {
262
+ return kb.sym(cat.slice(1, -1));
263
+ }
264
+ }
265
+ }
266
+ return null;
267
+ };
268
+ const checkCatHasField = function (catTail, pred) {
269
+ const cat = catSymbol(catTail);
270
+ let tab;
271
+ const guilty = [];
272
+ let count = 0;
273
+ if (!cat) {
274
+ complain('Error: No category correspnding to ' + catTail);
275
+ return null;
276
+ }
277
+ const list = kb.each(undefined, ns.rdf('type'), cat);
278
+ for (let i = 0; i < list.length; i++) {
279
+ if (!kb.any(list[i], pred)) {
280
+ guilty.push(list[i]);
281
+ }
282
+ }
283
+ if (guilty.length) {
284
+ tab = transactionTable(dom, guilty);
285
+ count = tab.children.length;
286
+ div.appendChild(dom.createElement('h3')).textContent = UI.utils.label(cat) + ' with no ' + UI.utils.label(pred) + (count < 4 ? '' : ' (' + count + ')');
287
+ div.appendChild(tab);
288
+ }
289
+ return count;
290
+ };
291
+
292
+ // Load dynamically as properties of period
293
+ if (checkCatHasField('Reimbursables', ns.trip('trip')) === 0) {
294
+ happy('Reimbursables all have trips');
295
+ }
296
+ if (checkCatHasField('Other_Inc_Speaking', ns.trip('trip')) === 0) {
297
+ happy('Speaking income all has trips');
298
+ }
299
+ // end of render period instance
300
+ }; // renderPeriod
301
+
302
+ // //////////////////////////////////////////////////////////////////////////////
303
+
304
+ // var me = authn.currentUser()
305
+
306
+ // Render a single Period
307
+
308
+ // This works only if enough metadata about the properties can drive the RDFS
309
+ // (or actual type statements whichtypically are NOT there on)
310
+ const t = kb.findTypeURIs(subject);
311
+ if (t['http://www.w3.org/2000/10/swap/pim/qif#Period']) {
312
+ const needed = kb.each(subject, ns.rdfs('seeAlso'));
313
+ console.log('Loading before render: ' + needed.length);
314
+ kb.fetcher.load(needed).then(function () {
315
+ renderPeriod();
316
+ });
317
+ }
318
+
319
+ // if (!me) complain("You do not have your Web Id set. Set your Web ID to make changes.");
320
+
321
+ return div;
322
+ }
323
+ }; // ends
324
+ //# sourceMappingURL=period.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"period.js","names":["UI","_interopRequireWildcard","require","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ns","_default","exports","icon","icons","iconBase","name","audience","solid","label","subject","context","kb","session","store","findTypeURIs","render","dom","div","createElement","setAttribute","mention","message","style","pre","appendChild","createTextNode","happy","complain","renderPeriod","dtstart","any","cal","undefined","uri","dtend","predicateURIsDone","donePredicate","pred","rdf","inPeriod","date","d2","s","indexOf","split","slice","transactionInPeriod","x","qu","oderByDate","y","dx","dy","value","h2","textContent","insertedPane","paneName","p","paneRegistry","byName","d","expandAfterRow","row","solo","siblings","parentNode","children","j","length","expanded","removeChild","tr","td","cols","nextSibling","insertBefore","expandAfterRowOrCollapse","transactionTable","list","table","transactionRow","setTRStyle","account","mystyle","backgroundColor","ui","c0","c1","payee","a1","c3","amount","addEventListener","shiftKey","list2","filter","sort","dummies","xURIs","findMemberURIs","unclassifiedIn","unclassifiedOut","usd","z","prototype","sym","tt","each","classified","push","tab","count","catSymbol","catTail","cats","findSubClassesNT","cat","checkCatHasField","guilty","utils","trip","needed","rdfs","console","log","fetcher","load","then"],"sources":["../../src/transaction/period.js"],"sourcesContent":["/* Financial Period Pane\n **\n ** This outline pane allows a user to interact with a period\n ** downloaded from a bank statement, annotting it with classes and comments,\n ** trips, etc\n */\n\nimport * as UI from 'solid-ui'\nconst ns = UI.ns\n\nexport default {\n icon: UI.icons.iconBase + 'noun_142708.svg',\n\n name: 'period',\n\n audience: [ns.solid('PowerUser')],\n\n // Does the subject deserve this pane?\n label: function (subject, context) {\n const kb = context.session.store\n const t = kb.findTypeURIs(subject)\n if (t['http://www.w3.org/2000/10/swap/pim/qif#Period']) return 'period'\n return null // No under other circumstances (while testing at least!)\n },\n\n render: function (subject, context) {\n const dom = context.dom\n const kb = context.session.store\n const ns = UI.ns\n\n const div = dom.createElement('div')\n div.setAttribute('class', 'periodPane')\n\n const mention = function mention (message, style) {\n if (!style) style = 'color: grey;'\n const pre = dom.createElement('pre')\n pre.setAttribute('style', style)\n div.appendChild(pre)\n pre.appendChild(dom.createTextNode(message))\n }\n const happy = function happy (message) {\n return mention('✓ ' + message, 'color: #010; background-color: #efe')\n }\n const complain = function complain (message) {\n return mention(message, 'color: #100; background-color: #fee')\n }\n /*\n var rerender = function (div) {\n var parent = div.parentNode\n var div2 = thisPane.render(subject, dom)\n parent.replaceChild(div2, div)\n }\n*/\n const renderPeriod = function () {\n const dtstart = kb.any(subject, ns.cal('dtstart'))\n if (dtstart === undefined) {\n complain(\n '(Error: There is no start date known for this period <' +\n subject.uri +\n '>,\\n -- every period needs one.)'\n )\n }\n\n const dtend = kb.any(subject, ns.cal('dtend'))\n if (dtend === undefined) {\n complain(\n '(Error: There is no end date known for this period <' +\n subject.uri +\n '>,\\n -- every period needs one.)'\n )\n }\n\n // var store = kb.any(subject, UI.ns.qu('annotationStore')) || null\n\n const predicateURIsDone = {}\n const donePredicate = function (pred) {\n predicateURIsDone[pred.uri] = true\n }\n donePredicate(ns.rdf('type'))\n\n const inPeriod = function (date) {\n return !!(date && date >= dtstart && date < dtend)\n }\n\n const d2 = function (n) {\n const s = '' + n\n if (s.indexOf('.') >= 0) {\n return s.split('.')[0] + '.' + (s.split('.')[1] + '00').slice(0, 2)\n }\n return s + '.00'\n }\n\n const transactionInPeriod = function (x) {\n return inPeriod(kb.any(x, ns.qu('date')))\n }\n\n const oderByDate = function (x, y) {\n const dx = kb.any(x, ns.qu('date'))\n const dy = kb.any(y, ns.qu('date'))\n if (dx !== undefined && dy !== undefined) {\n if (dx.value < dy.value) return -1\n if (dx.value > dy.value) return 1\n }\n if (x.uri < y.uri) return -1 // Arbitrary but repeatable\n if (x.uri > y.uri) return 1\n return 0\n }\n /*\n var setPaneStyle = function (account) {\n var mystyle = 'padding: 0.5em 1.5em 1em 1.5em; '\n if (account) {\n var backgroundColor = kb.any(account, UI.ns.ui('backgroundColor'))\n if (backgroundColor) {\n mystyle += 'background-color: ' + backgroundColor.value + '; '\n }\n }\n div.setAttribute('style', mystyle)\n }\n // setPaneStyle();\n*/\n const h2 = div.appendChild(dom.createElement('h2'))\n h2.textContent =\n 'Period ' +\n dtstart.value.slice(0, 10) +\n ' - ' +\n dtend.value.slice(0, 10)\n\n const insertedPane = function (context, subject, paneName) {\n const p = context.session.paneRegistry.byName(paneName)\n const d = p.render(subject, context)\n d.setAttribute('style', 'border: 0.1em solid green;')\n return d\n }\n\n const expandAfterRow = function (dom, row, subject, paneName, solo) {\n const siblings = row.parentNode.children\n if (solo) {\n for (let j = siblings.length - 1; j >= 0; j--) {\n if (siblings[j].expanded) {\n siblings[j].parentNode.removeChild(siblings[j].expanded)\n siblings[j].expanded = false\n }\n }\n }\n const tr = dom.createElement('tr')\n const td = tr.appendChild(dom.createElement('td'))\n td.setAttribute(\n 'style',\n 'width: 98%; padding: 1em; border: 0.1em solid grey;'\n )\n const cols = row.children.length\n if (row.nextSibling) {\n row.parentNode.insertBefore(tr, row.nextSibling)\n } else {\n row.parentNode.appendChild(tr)\n }\n row.expanded = tr\n td.setAttribute('colspan', '' + cols)\n td.appendChild(insertedPane(context, subject, paneName))\n }\n\n const expandAfterRowOrCollapse = function (\n dom,\n row,\n subject,\n paneName,\n solo\n ) {\n if (row.expanded) {\n row.parentNode.removeChild(row.expanded)\n row.expanded = false\n } else {\n expandAfterRow(dom, row, subject, paneName, solo)\n }\n }\n\n const transactionTable = function (dom, list) {\n const table = dom.createElement('table')\n table.setAttribute(\n 'style',\n 'margin-left: 100; font-size: 9pt; width: 85%;'\n )\n const transactionRow = function (dom, x) {\n const tr = dom.createElement('tr')\n\n const setTRStyle = function (tr, account) {\n // var mystyle = \"padding: 0.5em 1.5em 1em 1.5em; \";\n let mystyle = 'margin-left: 8em; padding-left: 5em;'\n if (account) {\n const backgroundColor = kb.any(account, UI.ns.ui('backgroundColor'))\n if (backgroundColor) {\n mystyle += 'background-color: ' + backgroundColor.value + '; '\n }\n }\n tr.setAttribute('style', mystyle)\n }\n\n const account = kb.any(x, ns.qu('toAccount'))\n setTRStyle(tr, account)\n\n const c0 = tr.appendChild(dom.createElement('td'))\n const date = kb.any(x, ns.qu('date'))\n c0.textContent = date ? date.value.slice(0, 10) : '???'\n c0.setAttribute('style', 'width: 7em;')\n\n const c1 = tr.appendChild(dom.createElement('td'))\n c1.setAttribute('style', 'width: 36em;')\n const payee = kb.any(x, ns.qu('payee'))\n c1.textContent = payee ? payee.value : '???'\n const a1 = c1.appendChild(dom.createElement('a'))\n a1.textContent = ' ➜'\n a1.setAttribute('href', x.uri)\n\n const c3 = tr.appendChild(dom.createElement('td'))\n const amount = kb.any(x, ns.qu('in_USD'))\n c3.textContent = amount ? d2(amount.value) : '???'\n c3.setAttribute('style', 'width: 6em; text-align: right; ') // @@ decimal alignment?\n tr.addEventListener(\n 'click',\n function (e) {\n // solo unless shift key\n expandAfterRowOrCollapse(dom, tr, x, 'transaction', !e.shiftKey)\n },\n false\n )\n\n return tr\n }\n\n const list2 = list.filter(transactionInPeriod)\n list2.sort(oderByDate)\n\n for (let i = 0; i < list2.length; i++) {\n table.appendChild(transactionRow(dom, list2[i]))\n }\n return table\n }\n\n // List unclassified transactions\n\n const dummies = {\n 'http://www.w3.org/2000/10/swap/pim/qif#Transaction': true, // (we knew)\n 'http://www.w3.org/2000/10/swap/pim/qif#Unclassified': true, // pseudo classifications we may phase out\n 'http://www.w3.org/2000/10/swap/pim/qif#UnclassifiedOutgoing': true,\n 'http://www.w3.org/2000/10/swap/pim/qif#UnclassifiedIncome': true\n }\n const xURIs = kb.findMemberURIs(ns.qu('Transaction'))\n const unclassifiedIn = []\n const unclassifiedOut = []\n let usd, z\n for (const y in xURIs) {\n // For each thing which can be inferred to be a transaction\n // @@ TODO: Write away the need for exception on next line\n\n if (Object.prototype.hasOwnProperty.call(xURIs, y)) {\n z = kb.sym(y)\n const tt = kb.each(z, ns.rdf('type')) // What EXPLICIT definitions\n let classified = false\n for (let j = 0; j < tt.length; j++) {\n const t = tt[j]\n if (dummies[t.uri] === undefined) {\n classified = true\n }\n }\n if (!classified) {\n usd = kb.any(z, ns.qu('in_USD'))\n if (usd === undefined) {\n usd = kb.any(z, ns.qu('amount'))\n }\n if (usd && ('' + usd.value).indexOf('-') >= 0) {\n unclassifiedOut.push(kb.sym(y))\n } else {\n unclassifiedIn.push(kb.sym(y))\n }\n }\n }\n }\n let tab, count\n if (unclassifiedIn.length) {\n tab = transactionTable(dom, unclassifiedIn)\n count = tab.children.length\n div.appendChild(dom.createElement('h3')).textContent =\n 'Unclassified Income' + (count < 4 ? '' : ' (' + count + ')')\n div.appendChild(tab)\n } else {\n happy('No unclassified income')\n }\n if (unclassifiedOut.length) {\n tab = transactionTable(dom, unclassifiedOut)\n count = tab.children.length\n div.appendChild(dom.createElement('h3')).textContent =\n 'Unclassified Outgoings' + (count < 4 ? '' : ' (' + count + ')')\n div.appendChild(tab)\n } else {\n happy('No unclassified outgoings ')\n }\n\n // /////////////// Check some categories of transaction for having given fields\n\n const catSymbol = function (catTail) {\n const cats = kb.findSubClassesNT(ns.qu('Transaction'))\n for (const cat in cats) {\n // @@ TODO: Write away the need for exception on next line\n\n if (Object.prototype.hasOwnProperty.call(cats, cat)) {\n if (cat.slice(1, -1).split('#')[1] === catTail) {\n return kb.sym(cat.slice(1, -1))\n }\n }\n }\n return null\n }\n\n const checkCatHasField = function (catTail, pred) {\n const cat = catSymbol(catTail)\n let tab\n const guilty = []\n let count = 0\n if (!cat) {\n complain('Error: No category correspnding to ' + catTail)\n return null\n }\n const list = kb.each(undefined, ns.rdf('type'), cat)\n for (let i = 0; i < list.length; i++) {\n if (!kb.any(list[i], pred)) {\n guilty.push(list[i])\n }\n }\n if (guilty.length) {\n tab = transactionTable(dom, guilty)\n count = tab.children.length\n div.appendChild(dom.createElement('h3')).textContent =\n UI.utils.label(cat) +\n ' with no ' +\n UI.utils.label(pred) +\n (count < 4 ? '' : ' (' + count + ')')\n div.appendChild(tab)\n }\n return count\n }\n\n // Load dynamically as properties of period\n if (checkCatHasField('Reimbursables', ns.trip('trip')) === 0) {\n happy('Reimbursables all have trips')\n }\n if (checkCatHasField('Other_Inc_Speaking', ns.trip('trip')) === 0) {\n happy('Speaking income all has trips')\n }\n // end of render period instance\n } // renderPeriod\n\n // //////////////////////////////////////////////////////////////////////////////\n\n // var me = authn.currentUser()\n\n // Render a single Period\n\n // This works only if enough metadata about the properties can drive the RDFS\n // (or actual type statements whichtypically are NOT there on)\n const t = kb.findTypeURIs(subject)\n if (t['http://www.w3.org/2000/10/swap/pim/qif#Period']) {\n const needed = kb.each(subject, ns.rdfs('seeAlso'))\n console.log('Loading before render: ' + needed.length)\n kb.fetcher.load(needed).then(function () {\n renderPeriod()\n })\n }\n\n // if (!me) complain(\"You do not have your Web Id set. Set your Web ID to make changes.\");\n\n return div\n }\n}\n// ends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AAM6I,MAAM,GAAG/G,EAAE,CAACiG,IAAI,CAACnG,OAAO,EAAEV,EAAE,CAAC4H,IAAI,CAAC,SAAS,CAAC,CAAC;MACnDC,OAAO,CAACC,GAAG,CAAC,yBAAyB,GAAGH,MAAM,CAACrD,MAAM,CAAC;MACtD1D,EAAE,CAACmH,OAAO,CAACC,IAAI,CAACL,MAAM,CAAC,CAACM,IAAI,CAAC,YAAY;QACvCpG,YAAY,CAAC,CAAC;MAChB,CAAC,CAAC;IACJ;;IAEA;;IAEA,OAAOX,GAAG;EACZ;AACF,CAAC,EACD","ignoreList":[]}
@@ -0,0 +1,175 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var UI = _interopRequireWildcard(require("solid-ui"));
8
+ var $rdf = _interopRequireWildcard(require("rdflib"));
9
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
10
+ /* Trip Pane
11
+ **
12
+ ** This pane deals with trips themselves and also
13
+ ** will look at transactions organized by trip.
14
+ **
15
+ ** This outline pane allows a user to interact with a transaction
16
+ ** downloaded from a bank statement, annotting it with classes and comments,
17
+ ** trips, etc
18
+ */
19
+
20
+ const ns = UI.ns;
21
+ var _default = exports.default = {
22
+ icon: UI.icons.iconBase + 'noun_62007.svg',
23
+ name: 'travel expenses',
24
+ audience: [ns.solid('PowerUser')],
25
+ // Does the subject deserve this pane?
26
+ label: function (subject, context) {
27
+ const kb = context.session.store;
28
+ const t = kb.findTypeURIs(subject);
29
+
30
+ // if (t['http://www.w3.org/2000/10/swap/pim/qif#Transaction']) return "$$";
31
+ // if(kb.any(subject, UI.ns.qu('amount'))) return "$$$"; // In case schema not picked up
32
+
33
+ if (UI.ns.qu('Transaction') in kb.findSuperClassesNT(subject)) {
34
+ return 'by Trip';
35
+ }
36
+ if (t['http://www.w3.org/ns/pim/trip#Trip']) return 'Trip $';
37
+ return null; // No under other circumstances (while testing at least!)
38
+ },
39
+ render: function (subject, context) {
40
+ const myDocument = context.dom;
41
+ const kb = context.store;
42
+ const ns = UI.ns;
43
+ const CAL = $rdf.Namespace('http://www.w3.org/2002/12/cal/ical#');
44
+ const TRIP = $rdf.Namespace('http://www.w3.org/ns/pim/trip#');
45
+ const div = myDocument.createElement('div');
46
+ div.setAttribute('class', 'transactionPane');
47
+ div.innerHTML = '<h2>Trip transactions</h2>';
48
+ const complain = function complain(message, style) {
49
+ if (style === undefined) style = 'color: grey';
50
+ const pre = myDocument.createElement('pre');
51
+ pre.setAttribute('style', style);
52
+ div.appendChild(pre);
53
+ pre.appendChild(myDocument.createTextNode(message));
54
+ };
55
+
56
+ // //////////////////////////////////////////////////////////////////////////////
57
+ //
58
+ // Body of trip pane
59
+
60
+ const t = kb.findTypeURIs(subject);
61
+
62
+ // var me = authn.currentUser()
63
+
64
+ // Function: Render a single trip
65
+
66
+ const renderTrip = function renderTrip(subject, thisDiv) {
67
+ const query = new $rdf.Query(UI.utils.label(subject));
68
+ const vars = ['date', 'transaction', 'comment', 'type', 'in_USD'];
69
+ const v = {};
70
+ vars.forEach(function (x) {
71
+ query.vars.push(v[x] = $rdf.variable(x));
72
+ }); // Only used by UI
73
+ query.pat.add(v.transaction, TRIP('trip'), subject);
74
+ const opt = kb.formula();
75
+ opt.add(v.transaction, ns.rdf('type'), v.type); // Issue: this will get stored supertypes too
76
+ query.pat.optional.push(opt);
77
+ query.pat.add(v.transaction, UI.ns.qu('date'), v.date);
78
+ opt.add(v.transaction, ns.rdfs('comment'), v.comment);
79
+ query.pat.optional.push(opt);
80
+
81
+ // opt = kb.formula();
82
+ query.pat.add(v.transaction, UI.ns.qu('in_USD'), v.in_USD);
83
+ // query.pat.optional.push(opt);
84
+
85
+ const calculations = function () {
86
+ const total = {};
87
+ const trans = kb.each(undefined, TRIP('trip'), subject);
88
+ // complain("@@ Number of transactions in this trip: " + trans.length);
89
+ trans.forEach(function (t) {
90
+ let ty = kb.the(t, ns.rdf('type'));
91
+ // complain(" -- one trans: "+t.uri + ' -> '+kb.any(t, UI.ns.qu('in_USD')));
92
+ if (!ty) ty = UI.ns.qu('ErrorNoType');
93
+ if (ty && ty.uri) {
94
+ const tyuri = ty.uri;
95
+ if (!total[tyuri]) total[tyuri] = 0.0;
96
+ const lit = kb.any(t, UI.ns.qu('in_USD'));
97
+ if (!lit) {
98
+ complain(' @@ No amount in USD: ' + lit + ' for ' + t);
99
+ }
100
+ if (lit) {
101
+ total[tyuri] = total[tyuri] + parseFloat(lit.value);
102
+ // complain(' Trans type ='+ty+'; in_USD "' + lit
103
+ // +'; total[tyuri] = '+total[tyuri]+';')
104
+ }
105
+ }
106
+ });
107
+ let str = '';
108
+ let types = 0;
109
+ let grandTotal = 0.0;
110
+ for (const uri in total) {
111
+ str += UI.utils.label(kb.sym(uri)) + ': ' + total[uri] + '; ';
112
+ types++;
113
+ grandTotal += total[uri];
114
+ }
115
+ complain('Totals of ' + trans.length + ' transactions: ' + str, ''); // @@@@@ yucky -- need 2 col table
116
+ if (types > 1) {
117
+ complain('Overall net: ' + grandTotal, 'text-treatment: bold;');
118
+ }
119
+ };
120
+ const tableDiv = UI.table(myDocument, {
121
+ query,
122
+ onDone: calculations
123
+ });
124
+ thisDiv.appendChild(tableDiv);
125
+ };
126
+
127
+ // Render the set of trips which have transactions in this class
128
+
129
+ if (UI.ns.qu('Transaction') in kb.findSuperClassesNT(subject)) {
130
+ const ts = kb.each(undefined, ns.rdf('type'), subject);
131
+ const triples = [];
132
+ const index = [];
133
+ for (let i = 0; i < ts.length; i++) {
134
+ const trans = ts[i];
135
+ const trip = kb.any(trans, TRIP('trip'));
136
+ if (!trip) {
137
+ triples.push(trans);
138
+ } else {
139
+ if (!(trans in index)) index[trip] = {
140
+ total: 0,
141
+ transactions: []
142
+ };
143
+ const usd = kb.any(trans, UI.ns.qu('in_USD'));
144
+ if (usd) index[trip].total += usd;
145
+ const date = kb.any(trans, UI.ns.qu('date'));
146
+ index[trip.toNT()].transactions.push([date, trans]);
147
+ }
148
+ }
149
+ /* var byDate = function(a,b) {
150
+ return new Date(kb.any(a, CAL('dtstart'))) -
151
+ new Date(kb.any(b, CAL('dtstart')));
152
+ }
153
+ */
154
+ const list = [];
155
+ for (const h1 in index) {
156
+ const t1 = kb.fromNT(h1);
157
+ list.push([kb.any(t1, CAL('dtstart')), t1]);
158
+ }
159
+ list.sort();
160
+ for (let j = 0; j < list.length; j++) {
161
+ const t2 = list[j][1];
162
+ renderTrip(t2, div);
163
+ }
164
+
165
+ // Render a single trip
166
+ } else if (t['http://www.w3.org/ns/pim/trip#Trip']) {
167
+ renderTrip(subject, div);
168
+ }
169
+
170
+ // if (!me) complain("You do not have your Web Id set. Set your Web ID to make changes.");
171
+
172
+ return div;
173
+ }
174
+ }; // ends
175
+ //# sourceMappingURL=tripPane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tripPane.js","names":["UI","_interopRequireWildcard","require","$rdf","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ns","_default","exports","icon","icons","iconBase","name","audience","solid","label","subject","context","kb","session","store","findTypeURIs","qu","findSuperClassesNT","render","myDocument","dom","CAL","Namespace","TRIP","div","createElement","setAttribute","innerHTML","complain","message","style","undefined","pre","appendChild","createTextNode","renderTrip","thisDiv","query","Query","utils","vars","v","forEach","x","push","variable","pat","add","transaction","opt","formula","rdf","type","optional","date","rdfs","comment","in_USD","calculations","total","trans","each","ty","the","uri","tyuri","lit","any","parseFloat","value","str","types","grandTotal","sym","length","tableDiv","table","onDone","ts","triples","index","trip","transactions","usd","toNT","list","h1","t1","fromNT","sort","j","t2"],"sources":["../../src/trip/tripPane.js"],"sourcesContent":["/* Trip Pane\n **\n ** This pane deals with trips themselves and also\n ** will look at transactions organized by trip.\n **\n ** This outline pane allows a user to interact with a transaction\n ** downloaded from a bank statement, annotting it with classes and comments,\n ** trips, etc\n */\n\nimport * as UI from 'solid-ui'\nimport * as $rdf from 'rdflib'\nconst ns = UI.ns\n\nexport default {\n icon: UI.icons.iconBase + 'noun_62007.svg',\n\n name: 'travel expenses',\n\n audience: [ns.solid('PowerUser')],\n\n // Does the subject deserve this pane?\n label: function (subject, context) {\n const kb = context.session.store\n const t = kb.findTypeURIs(subject)\n\n // if (t['http://www.w3.org/2000/10/swap/pim/qif#Transaction']) return \"$$\";\n // if(kb.any(subject, UI.ns.qu('amount'))) return \"$$$\"; // In case schema not picked up\n\n if (UI.ns.qu('Transaction') in kb.findSuperClassesNT(subject)) {\n return 'by Trip'\n }\n if (t['http://www.w3.org/ns/pim/trip#Trip']) return 'Trip $'\n\n return null // No under other circumstances (while testing at least!)\n },\n\n render: function (subject, context) {\n const myDocument = context.dom\n const kb = context.store\n const ns = UI.ns\n const CAL = $rdf.Namespace('http://www.w3.org/2002/12/cal/ical#')\n const TRIP = $rdf.Namespace('http://www.w3.org/ns/pim/trip#')\n\n const div = myDocument.createElement('div')\n div.setAttribute('class', 'transactionPane')\n div.innerHTML = '<h2>Trip transactions</h2>'\n\n const complain = function complain (message, style) {\n if (style === undefined) style = 'color: grey'\n const pre = myDocument.createElement('pre')\n pre.setAttribute('style', style)\n div.appendChild(pre)\n pre.appendChild(myDocument.createTextNode(message))\n }\n\n // //////////////////////////////////////////////////////////////////////////////\n //\n // Body of trip pane\n\n const t = kb.findTypeURIs(subject)\n\n // var me = authn.currentUser()\n\n // Function: Render a single trip\n\n const renderTrip = function renderTrip (subject, thisDiv) {\n const query = new $rdf.Query(UI.utils.label(subject))\n const vars = ['date', 'transaction', 'comment', 'type', 'in_USD']\n const v = {}\n vars.forEach(function (x) {\n query.vars.push((v[x] = $rdf.variable(x)))\n }) // Only used by UI\n query.pat.add(v.transaction, TRIP('trip'), subject)\n\n const opt = kb.formula()\n opt.add(v.transaction, ns.rdf('type'), v.type) // Issue: this will get stored supertypes too\n query.pat.optional.push(opt)\n\n query.pat.add(v.transaction, UI.ns.qu('date'), v.date)\n\n opt.add(v.transaction, ns.rdfs('comment'), v.comment)\n query.pat.optional.push(opt)\n\n // opt = kb.formula();\n query.pat.add(v.transaction, UI.ns.qu('in_USD'), v.in_USD)\n // query.pat.optional.push(opt);\n\n const calculations = function () {\n const total = {}\n const trans = kb.each(undefined, TRIP('trip'), subject)\n // complain(\"@@ Number of transactions in this trip: \" + trans.length);\n trans.forEach(function (t) {\n let ty = kb.the(t, ns.rdf('type'))\n // complain(\" -- one trans: \"+t.uri + ' -> '+kb.any(t, UI.ns.qu('in_USD')));\n if (!ty) ty = UI.ns.qu('ErrorNoType')\n if (ty && ty.uri) {\n const tyuri = ty.uri\n if (!total[tyuri]) total[tyuri] = 0.0\n const lit = kb.any(t, UI.ns.qu('in_USD'))\n if (!lit) {\n complain(' @@ No amount in USD: ' + lit + ' for ' + t)\n }\n if (lit) {\n total[tyuri] = total[tyuri] + parseFloat(lit.value)\n // complain(' Trans type ='+ty+'; in_USD \"' + lit\n // +'; total[tyuri] = '+total[tyuri]+';')\n }\n }\n })\n let str = ''\n let types = 0\n let grandTotal = 0.0\n for (const uri in total) {\n str += UI.utils.label(kb.sym(uri)) + ': ' + total[uri] + '; '\n types++\n grandTotal += total[uri]\n }\n complain('Totals of ' + trans.length + ' transactions: ' + str, '') // @@@@@ yucky -- need 2 col table\n if (types > 1) {\n complain('Overall net: ' + grandTotal, 'text-treatment: bold;')\n }\n }\n const tableDiv = UI.table(myDocument, {\n query,\n onDone: calculations\n })\n thisDiv.appendChild(tableDiv)\n }\n\n // Render the set of trips which have transactions in this class\n\n if (UI.ns.qu('Transaction') in kb.findSuperClassesNT(subject)) {\n const ts = kb.each(undefined, ns.rdf('type'), subject)\n const triples = []\n const index = []\n for (let i = 0; i < ts.length; i++) {\n const trans = ts[i]\n const trip = kb.any(trans, TRIP('trip'))\n if (!trip) {\n triples.push(trans)\n } else {\n if (!(trans in index)) index[trip] = { total: 0, transactions: [] }\n const usd = kb.any(trans, UI.ns.qu('in_USD'))\n if (usd) index[trip].total += usd\n const date = kb.any(trans, UI.ns.qu('date'))\n index[trip.toNT()].transactions.push([date, trans])\n }\n }\n /* var byDate = function(a,b) {\n return new Date(kb.any(a, CAL('dtstart'))) -\n new Date(kb.any(b, CAL('dtstart')));\n }\n */\n const list = []\n for (const h1 in index) {\n const t1 = kb.fromNT(h1)\n list.push([kb.any(t1, CAL('dtstart')), t1])\n }\n list.sort()\n for (let j = 0; j < list.length; j++) {\n const t2 = list[j][1]\n renderTrip(t2, div)\n }\n\n // Render a single trip\n } else if (t['http://www.w3.org/ns/pim/trip#Trip']) {\n renderTrip(subject, div)\n }\n\n // if (!me) complain(\"You do not have your Web Id set. Set your Web ID to make changes.\");\n\n return div\n }\n}\n// ends\n"],"mappings":";;;;;;AAUA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,uBAAA,CAAAC,OAAA;AAA8B,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GA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