Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

837 строки
30 KiB

  1. var UI = {
  2. apiMethodName: function (args) {
  3. let methodName = args.method.toLowerCase() + args.db.capitalize();
  4. if (args.method == 'GET') methodName += "s";
  5. console.log('args');
  6. console.log(args);
  7. console.log('methodName:' + methodName);
  8. return methodName;
  9. },
  10. apiGet: function (args) {
  11. if (!args.db) { console.log('apiGet requires db parameter'); }
  12. console.log('apiGet args');
  13. console.log(args);
  14. let methodName = this.apiMethodName(args);
  15. //window.args = args;
  16. window[methodName](args.item)
  17. .then(function (data) {
  18. console.log('apiCall success');
  19. //let result = JSON.stringify(data, null, 2);
  20. console.log('args');
  21. console.log(args);
  22. let apiCallback = [
  23. {
  24. "rl:apiGetCallback": {
  25. "db": args.db,
  26. "template": args.template,
  27. "data": data
  28. }
  29. }
  30. ];
  31. js.callback({ do: apiCallback, to: 'data db ' + args.db, value: data });
  32. })
  33. .catch(function (err) {
  34. console.log('apiCall error');
  35. console.log(err);
  36. });
  37. },
  38. apiPost: function (args) {
  39. if (!args.db) { console.log('apiPost requires db parameter'); }
  40. let methodName = this.apiMethodName(args);
  41. let item = js.replaceProperties('{formDataToJson:.form' + args.db + '}');
  42. console.log(item);
  43. //window.args = args;
  44. window[methodName](item)
  45. .then(function (data) {
  46. console.log('apiCall success');
  47. let result = JSON.stringify(data, null, 2);
  48. let apiCallback = [
  49. {
  50. "rl:apiPostCallback": {
  51. "db": args.db,
  52. "template": args.template,
  53. "data": data
  54. }
  55. }
  56. ];
  57. js.callback({ do: apiCallback });
  58. })
  59. .catch(function (err) {
  60. console.log('apiCall error');
  61. console.log(err);
  62. let apiCallback = [
  63. {
  64. "rl:apiPostCallback": {
  65. "db": args.db,
  66. "template": args.template,
  67. "data": err
  68. }
  69. }
  70. ];
  71. js.callback({ do: apiCallback });
  72. });
  73. },
  74. apiCall: function (args) {
  75. let method = args.method || "GET";
  76. let db = args.db || "";
  77. let item = args.item || {};
  78. let serverUrl = args.serverUrl || "";
  79. let apiSuccess = args.success;
  80. let apiError = args.error;
  81. window.args = args;
  82. //RESLEVIS_API_BASE = serverUrl;
  83. let methodName = args.method.toLowerCase() + args.db.capitalize();
  84. if (method == 'GET') methodName += "s";
  85. console.log('methodName:' + methodName);
  86. //let result = window[methodName](item);
  87. window[methodName](item)
  88. .then(function (data) {
  89. console.log('apiCall success');
  90. let result = JSON.stringify(data, null, 2);
  91. console.log(data);
  92. console.log({ do: apiSuccess, to: 'data db ' + db, value: data });
  93. let apiCallback = [
  94. {
  95. "rl:apiCallback": {
  96. "db": window.args.db,
  97. "template": window.args.template,
  98. "data": data
  99. }
  100. }
  101. ];
  102. js.do(apiSuccess);
  103. //js.callback({ do: apiSuccess, to: 'data db ' + db, value: data });
  104. })
  105. .catch(function (err) {
  106. console.log('apiCall error');
  107. console.log(err);
  108. let apiCallback = [
  109. {
  110. "rl:apiCallback": {
  111. "db": window.args.db,
  112. "template": window.args.template,
  113. "data": []
  114. }
  115. }
  116. ];
  117. js.do(apiCallback);
  118. //js.callback({ do: apiSuccess, to: 'data db ' + db, value: data });
  119. });
  120. },
  121. capitalize: function (val) {
  122. return String(val).charAt(0).toUpperCase() + String(val).slice(1);
  123. },
  124. getVisibleColumns: function (db) {
  125. if (window.table && window.table[db]) {
  126. const visibility = {};
  127. window.table[db].table.getAllLeafColumns().forEach(column => {
  128. visibility[column.id] = column.getIsVisible();
  129. });
  130. return visibility;
  131. }
  132. },
  133. setVisibleColumns: function (db, columns) {
  134. if (window.table && window.table[db]) {
  135. const table = window.table[db].table;
  136. const visibility = {};
  137. const pinning = { left: [], right: [] };
  138. for (const [id, val] of Object.entries(columns)) {
  139. if (val === 'left' || val === 'right') {
  140. visibility[id] = true;
  141. pinning[val].push(id);
  142. } else {
  143. visibility[id] = !!val;
  144. }
  145. }
  146. table.setColumnVisibility(visibility);
  147. table.setColumnPinning(pinning);
  148. window.table[db].render();
  149. }
  150. },
  151. getToken: function (args) {
  152. if (args.options.body && typeof args.options.body !== 'string') args.options.body = JSON.stringify(args.options.body);
  153. fetch(args.url, args.options).then(response => response.json()).then(data => {
  154. //console.log('getToken success');
  155. //console.log(data);
  156. js.json.data.user.token = data.access_token;
  157. js.callback({ do: args.success });
  158. }).catch((err) => {
  159. //console.log('getToken error');
  160. //console.log(err);
  161. js.json.data.user.token = data.access_token;
  162. js.callback({ do: args.error });
  163. })
  164. },
  165. init: function () {
  166. },
  167. // Function to generate a form as a JSON structure from a JSON schema
  168. schemaToForm: function (params) {
  169. /* alert(JSON.stringify(params)); */
  170. if (!params.schema || !params.schema.properties) {
  171. return {
  172. html: [
  173. {
  174. tag: 'p',
  175. text: 'schemaToForm Error: Invalid JSON schema provided.'
  176. }
  177. ]
  178. };
  179. }
  180. const formElements = [];
  181. // Iterate through schema properties
  182. for (const [key, prop] of Object.entries(params.schema.properties)) {
  183. const label = prop.description || key;
  184. const required = params.schema.required && params.schema.required.includes(key) ? 'required' : '';
  185. const inputId = `input-${key}`; // Unique ID for accessibility
  186. // && jsonApp && jsonApp.json.data.settings &&
  187. const hiddenId = ((key == 'id' || key == 'status') && !jsonApp.json.data.settings.debug) ? ' hidden' : '';
  188. // Create fieldset for each field
  189. const fieldsetChildren = [
  190. {
  191. "tag": "label",
  192. "attr": {
  193. "class": "label text-primary " + hiddenId,
  194. "data-value": params.db + "/" + key,
  195. "for": key
  196. },
  197. text: label
  198. }
  199. ];
  200. console.log(fieldsetChildren);
  201. // Handle different input types
  202. let inputElement;
  203. switch (prop.type) {
  204. case 'string':
  205. if (prop.format == 'dbid') {
  206. inputElement = {
  207. tag: "select",
  208. attr: {
  209. "data-value": params.db + "/" + key,
  210. "name": key,
  211. "type": 'text',
  212. "value": (params.fields && params.fields[key]) ? params.fields[key] : false,
  213. "placeholder": prop.description || ' ',
  214. "class": 'field select w-full select-primary' + hiddenId,
  215. ...(required && { required: '' })
  216. }
  217. };
  218. inputElement.html = [];
  219. let db = (js.json.data.db) ? js.json.data.db : {};
  220. if (db[key]) {
  221. for (let item of db[key]) {
  222. let id = item.id;
  223. let name = item.name || '';
  224. let attr = { "value": id, "class": "option", "data-value": params.db + "/" + key + "/" + id };
  225. if (id == params.fields[key]) attr.selected = true;
  226. inputElement.html.push(
  227. {
  228. "tag": "option",
  229. "attr": attr,
  230. "text": name
  231. }
  232. )
  233. }
  234. } else {
  235. //js.log('Can\'t load local db: ' + key, 'red');
  236. console.log('%c' + 'Can\'t load local db ' + key, 'color: red');
  237. }
  238. } else if (prop.format == 'date-time') {
  239. // https://unpkg.com/flatpickr@2.0.2/index_.html
  240. inputElement = {
  241. "tag": "input",
  242. "attr": {
  243. //"id": inputId,
  244. "data-value": params.db + "/" + key,
  245. "name": key,
  246. "type": "number", // datetime-local
  247. "value": (params.fields && params.fields[key]) ? new Date(Number(params.fields[key])) : false,
  248. "placeholder": new Date().toLocaleDateString("it-IT", { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit" }) || ' ',
  249. "data-enable-time": true,
  250. "data-enable-seconds": true,
  251. "data-time_24hr": true,
  252. "data-date-format": "Y-m-d H:i:S",
  253. class: "field input datepicker w-full input-primary" + hiddenId,
  254. ...(required && { required: '' })
  255. },
  256. "on": {
  257. "in": [
  258. {
  259. "js": "flatpickr('.datepicker', {enableSeconds: true, time_24hr: true})"
  260. }
  261. ]
  262. }
  263. };
  264. /* flatpickr("#date-time-flatpickr-demo", {
  265. defaultDate: new Date(),
  266. enableTime: true,
  267. }) */
  268. } else if (prop.enum) { // enum ()
  269. inputElement = {
  270. tag: "select",
  271. attr: {
  272. //"id": inputId,
  273. "data-value": params.db + "/" + key,
  274. "name": key,
  275. "type": 'text',
  276. "value": (params.fields && params.fields[key]) ? params.fields[key] : false,
  277. "placeholder": prop.description || ' ',
  278. "class": 'field select w-full select-primary' + hiddenId,
  279. ...(required && { required: '' })
  280. }
  281. };
  282. inputElement.html = [];
  283. for (let item of prop.enum) {
  284. let attr = { "value": item, "class": "option", "data-value": params.db + "/" + key + "/" + item };
  285. if (params.fields && params.fields[key] && params.fields[key] == item) attr.selected = true;
  286. inputElement.html.push(
  287. {
  288. "tag": "option",
  289. "attr": attr,
  290. "text": String(item)
  291. }
  292. )
  293. }
  294. } else { // string
  295. inputElement = {
  296. tag: 'input',
  297. attr: {
  298. //id: inputId,
  299. "data-value": params.db + "/" + key,
  300. "name": key,
  301. type: 'text',
  302. value: (params.fields && params.fields[key]) ? params.fields[key] : false,
  303. placeholder: prop.description || ' ',
  304. class: 'field input w-full input-primary' + hiddenId,
  305. ...(required && { required: '' })
  306. }
  307. };
  308. }
  309. break;
  310. case 'number':
  311. case 'integer':
  312. inputElement = {
  313. tag: 'input',
  314. attr: {
  315. //id: inputId,
  316. "data-value": params.db + "/" + key,
  317. "name": key,
  318. type: 'number',
  319. value: (params.fields && params.fields[key]) ? params.fields[key] : false,
  320. placeholder: prop.description || ' ',
  321. class: 'field input w-full input-primary' + hiddenId,
  322. ...(required && { required: '' })
  323. }
  324. };
  325. break;
  326. case 'boolean':
  327. inputElement = {
  328. tag: 'input',
  329. attr: {
  330. //id: inputId,
  331. "data-value": params.db + "/" + key,
  332. "name": key,
  333. type: 'checkbox',
  334. class: 'field toggle toggle-info' + hiddenId,
  335. ...(required && { required: '' })
  336. }
  337. };
  338. if (params.fields[key]) inputElement.attr.checked = true;
  339. break;
  340. case 'array':
  341. inputElement = {
  342. tag: 'textarea',
  343. attr: {
  344. //id: inputId,
  345. "data-value": params.db + "/" + key,
  346. "name": key,
  347. value: (params.fields && params.fields[key]) ? params.fields[key] : false,
  348. placeholder: prop.description || 'Enter values separated by commas',
  349. class: 'field textarea w-full input-primary' + hiddenId,
  350. ...(required && { required: '' })
  351. }
  352. };
  353. break;
  354. case 'object':
  355. inputElement = {
  356. tag: 'textarea',
  357. attr: {
  358. //id: inputId,
  359. "data-value": params.db + "/" + key,
  360. "name": key,
  361. placeholder: prop.description || 'Enter JSON object',
  362. class: 'field textarea w-full input-primary' + hiddenId,
  363. ...(required && { required: '' })
  364. }
  365. };
  366. break;
  367. default:
  368. inputElement = {
  369. tag: 'input',
  370. attr: {
  371. //id: inputId,
  372. "data-value": params.db + "/" + key,
  373. "name": key,
  374. type: 'text',
  375. value: (params.fields && params.fields[key]) ? params.fields[key] : false,
  376. placeholder: prop.description || ' ',
  377. class: 'field input w-full input-primary' + hiddenId,
  378. ...(required && { required: '' })
  379. }
  380. };
  381. }
  382. // Add input element to fieldset
  383. fieldsetChildren.push(inputElement);
  384. // Add fieldset to form elements
  385. formElements.push({
  386. tag: 'fieldset',
  387. attr: {
  388. "class": "fieldset text-center",
  389. "data-value": params.db
  390. },
  391. html: fieldsetChildren
  392. });
  393. /* console.log('fviewRow');
  394. console.log(inputElement); */
  395. }
  396. /* // Add buttons
  397. formElements.push({
  398. tag: 'div',
  399. attr: {
  400. "class": "w-full mt-6 text-center px-[50px] flex flex-wrap items-center justify-between gap-2 "
  401. },
  402. html: [
  403. {
  404. "for": {
  405. "var": "button",
  406. "of": params.buttons,
  407. "do": [
  408. {
  409. "tag": 'button',
  410. "attr": {
  411. "type": "{var button type}",
  412. "class": "btn {var button class}"
  413. },
  414. "text": "{var button title}",
  415. "on": {
  416. "mousedown": "{var button actions}"
  417. }
  418. }
  419. ]
  420. }
  421. }
  422. ]
  423. }); */
  424. // Return the full form structure
  425. return {
  426. html: formElements
  427. };
  428. },
  429. createForm: function (params) {
  430. let appForm = UI.schemaToForm(params);
  431. appForm.selector = params.selector;
  432. jsonApp.do(appForm);
  433. },
  434. columnsFromApi: function (db) {
  435. let dbFields = js.json.data.api.components.schemas[params.db].properties;
  436. let columns = [];
  437. for (let key in dbFields) {
  438. columns.push({
  439. "header": key,
  440. "accessorKey": key
  441. });
  442. }
  443. return columns;
  444. },
  445. createTable: function (params) {
  446. /* console.log('createTable');
  447. console.log(params); */
  448. const tableData = jsonApp.json.data.db[params.db].map((data) => {
  449. return {
  450. ...data,
  451. //dateTime: new Date(Date.now()) // - 1000 * 60 * 60 * Math.floor(Math.random() * 24 * 100)),
  452. }
  453. })
  454. const getTableData = () => {
  455. return [...tableData]
  456. //return [...tableData].sort(() => 0.5 - Math.random())
  457. }
  458. const flexRender = (comp, props) => {
  459. if (typeof comp === "function") {
  460. return comp(props)
  461. }
  462. return comp
  463. }
  464. let data = getTableData()
  465. let version = 0
  466. let columns = JSON.parse(JSON.stringify(js.json.data.preferences.tables[params.db].columns));
  467. /*
  468. let columns = this.columnsFromApi(params.db);
  469. console.log('columns', JSON.stringify(columns));
  470. let visibility = js.json.data.preferences.tables[params.db].columns;
  471. console.log('visibility', JSON.stringify(visibility));
  472. */
  473. const state = {
  474. columnPinning: { left: [], right: [] },
  475. pagination: {
  476. pageSize: 10,
  477. pageIndex: 0,
  478. },
  479. globalFilter: "",
  480. columnFilters: [],
  481. columnVisibility: {},
  482. rowSelection: {},
  483. }
  484. const table = TableCore.createTable({
  485. state,
  486. data,
  487. columns,
  488. getCoreRowModel: TableCore.getCoreRowModel(),
  489. getPaginationRowModel:
  490. TableCore.getPaginationRowModel(),
  491. getFilteredRowModel: TableCore.getFilteredRowModel(),
  492. globalFilterFn: "auto",
  493. onStateChange: (updater) => {
  494. const newState =
  495. typeof updater === "function"
  496. ? updater(state)
  497. : updater
  498. Object.assign(state, newState)
  499. },
  500. });
  501. if (!window.table) window.table = {};
  502. window.table[params.db] = Alpine.reactive({
  503. dbId: params.db,
  504. version,
  505. columns,
  506. pageSizes: [5, 10, 20, 50],
  507. flexRender,
  508. search: "",
  509. get table() {
  510. this.version
  511. return table
  512. },
  513. get visibleRows() {
  514. this.version
  515. return this.table.getRowModel().rows
  516. },
  517. get selectedCount() {
  518. return this.table.getSelectedRowModel().rows.length
  519. },
  520. get totalCount() {
  521. return this.table.getPaginationRowModel().rows
  522. .length
  523. },
  524. get isIndeterminateAllRowsSelected() {
  525. this.version
  526. return (
  527. this.table.getIsSomePageRowsSelected() &&
  528. !this.table.getIsAllPageRowsSelected()
  529. )
  530. },
  531. get allLeafColumns() {
  532. this.version
  533. return this.table.getAllLeafColumns()
  534. },
  535. get pageSize() {
  536. this.version
  537. return this.table.getState().pagination.pageSize
  538. },
  539. get pageIndex() {
  540. this.version
  541. return this.table.getState().pagination.pageIndex
  542. },
  543. get rowCount() {
  544. this.version
  545. return data.length
  546. },
  547. get start() {
  548. this.version
  549. return this.rowCount === 0
  550. ? 0
  551. : this.pageIndex * this.pageSize + 1
  552. },
  553. get end() {
  554. this.version
  555. return Math.min(
  556. this.start + this.pageSize - 1,
  557. this.rowCount
  558. )
  559. },
  560. /* updateInterval(duration) {
  561. console.log('updateInterval:'+this.dbId);
  562. clearInterval(this.interval);
  563. this.interval = setInterval(function (event) {console.log(event); this.dbId}, duration)
  564. }, */
  565. updateData() {
  566. //console.log('updateData:'+this.dbId);
  567. let newData = jsonApp.json.data.db[this.dbId];
  568. this.table.setOptions(prev => ({
  569. ...prev,
  570. data: newData
  571. }))
  572. this.render()
  573. },
  574. setPageIndex(n) {
  575. this.table.setPageIndex(n)
  576. this.render()
  577. },
  578. nextPage() {
  579. this.version
  580. if (this.table.getCanNextPage()) {
  581. this.table.setPageIndex(this.pageIndex + 1)
  582. this.render()
  583. }
  584. },
  585. prevPage() {
  586. this.version
  587. if (this.table.getCanPreviousPage()) {
  588. this.table.setPageIndex(this.pageIndex - 1)
  589. this.render()
  590. }
  591. },
  592. changePageSize(newSize) {
  593. this.table.setPageSize(Number(newSize))
  594. this.render()
  595. },
  596. updateSearch() {
  597. table.setState({
  598. ...table.getState(),
  599. globalFilter: this.search,
  600. })
  601. this.render()
  602. },
  603. getVisibleCells(row) {
  604. this.version
  605. return row.getVisibleCells()
  606. },
  607. isColumnVisible(column) {
  608. this.version
  609. return column.getIsVisible()
  610. },
  611. toggleColumn(column) {
  612. column.toggleVisibility();
  613. /* let preferences = JSON.parse(localStorage.getItem("preferences"));
  614. preferences.tables[this.dbId].columns = this.getVisibleColumns(this.dbId);
  615. localStorage.setItem("preferences", JSON.stringify(preferences)); */
  616. this.render()
  617. },
  618. toggleSelectedRow(row) {
  619. row.toggleSelected()
  620. this.render()
  621. },
  622. isRowSelected(row) {
  623. this.version
  624. return row.getIsSelected()
  625. },
  626. toggleAllRowsSelected() {
  627. this.table.toggleAllPageRowsSelected()
  628. this.render()
  629. },
  630. viewRow(row) {
  631. let fields = Alpine.raw(row.original);
  632. //let id = `${row.original.id}`;
  633. js.part({ 'do': 'rl:openPost', arguments: { db: params.db, fields: fields, method: 'UPDATE' } });
  634. },
  635. deleteRow(row) {
  636. let fields = Alpine.raw(row.original);
  637. //let id = `${row.original.id}`;
  638. js.part({ 'do': 'removePost', arguments: { db: params.db, fields: fields } });
  639. },
  640. clearFilters() {
  641. this.search = ""
  642. this.updateSearch()
  643. },
  644. render() {
  645. this.version++
  646. }
  647. });
  648. return window.table[params.db]
  649. },
  650. loadTemplate: function (params) {
  651. console.log('loadTemplate', params);
  652. // add to html the parameters {url, to}
  653. var xmlhttp = new XMLHttpRequest();
  654. xmlhttp.onreadystatechange = function () {
  655. console.log('readyState', this.readyState, 'status', this.status);
  656. //console.log(this);
  657. if (this.readyState == 4 && this.status == 200) {
  658. //console.log(this.responseText);
  659. } else if (this.readyState == 4 && this.status == 401) {
  660. // unauthenticated
  661. window.location.reload();
  662. } else {
  663. if (this.status !== 0)
  664. console.log('Error loading ' + params.url);
  665. }
  666. };
  667. xmlhttp.open("GET", params.url, false);
  668. xmlhttp.send();/* .then(function (data) {
  669. console.log('loadTemplate success');
  670. console.log(data);
  671. //js.callback({ do: params.success });
  672. }).catch((err) => {
  673. console.log('loadTemplate error');
  674. console.log(err);
  675. window.location.reload();
  676. //js.callback({ do: params.error });
  677. }); */
  678. if (xmlhttp.responseText) {
  679. var responseText = xmlhttp.responseText;
  680. if (params.arguments) {
  681. responseText = js.replacePropertyWithPrefix(responseText, 'arguments', params.arguments);
  682. }
  683. if (params.to)
  684. js.element({ root: js.json, path: params.to, value: responseText });
  685. if (params.selector) {
  686. if (params.prepend)
  687. document.querySelector(params.selector).innerHTML = responseText + document.querySelector(params.selector).innerHTML;
  688. else if (params.empty)
  689. document.querySelector(params.selector).innerHTML = responseText;
  690. else
  691. document.querySelector(params.selector).innerHTML += responseText;
  692. }
  693. } else console.log('Error loading ' + params.url);
  694. }
  695. }
  696. Object.defineProperty(String.prototype, 'capitalize', {
  697. value: function () {
  698. return this.charAt(0).toUpperCase() + this.slice(1);
  699. },
  700. enumerable: false
  701. });
  702. /*
  703. var getToken = function (args) {
  704. //UI.token(args);
  705. if (args.options.body && typeof args.options.body !== 'string') args.options.body = JSON.stringify(args.options.body); fetch(args.url, args.options).then(response => response.json()).then(data => {console.log('fetchJson success'); console.log(data); js.callback({do:args.success});}).catch((err) => {console.log('fetchJson error');console.log(err);js.callback({do:args.error});})
  706. }
  707. */
  708. /*
  709. let args = {
  710. "url": "https://192.168.1.3:10002/realms/API.Server.local/protocol/openid-connect/token",
  711. "options": {
  712. "method": "POST",
  713. "headers": {
  714. "Content-Type": "application/x-www-form-urlencoded"
  715. },
  716. "body": "grant_type=client_credentials&client_id=Fastapi&client_secret=wojuoB7Z5xhlPFrF2lIxJSSdVHCApEgC"
  717. }
  718. };
  719. */
  720. //UI.getToken(args);
  721. //UI.loadTemplate({selector: 'content', url:'./assets/html/tracks.html'});
  722. // components-interactions-form-validations
  723. /* empty css */; (function () {
  724. const t = document.createElement("link").relList
  725. if (t && t.supports && t.supports("modulepreload")) return
  726. for (const e of document.querySelectorAll('link[rel="modulepreload"]')) i(e)
  727. new MutationObserver((e) => {
  728. for (const r of e)
  729. if (r.type === "childList")
  730. for (const o of r.addedNodes)
  731. o.tagName === "LINK" && o.rel === "modulepreload" && i(o)
  732. }).observe(document, { childList: !0, subtree: !0 })
  733. function s(e) {
  734. const r = {}
  735. return (
  736. e.integrity && (r.integrity = e.integrity),
  737. e.referrerPolicy && (r.referrerPolicy = e.referrerPolicy),
  738. e.crossOrigin === "use-credentials"
  739. ? (r.credentials = "include")
  740. : e.crossOrigin === "anonymous"
  741. ? (r.credentials = "omit")
  742. : (r.credentials = "same-origin"),
  743. r
  744. )
  745. }
  746. function i(e) {
  747. if (e.ep) return
  748. e.ep = !0
  749. const r = s(e)
  750. fetch(e.href, r)
  751. }
  752. })()