@sankhyalabs/sankhyablocks 8.16.0-dev.2 → 8.16.0-dev.20
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.
- package/dist/cjs/{ConfigStorage-942ce74b.js → ConfigStorage-e49214c6.js} +3 -2
- package/dist/cjs/{DataFetcher-313debd8.js → DataFetcher-77729a93.js} +7 -2
- package/dist/cjs/{IExporterProvider-9479f618.js → IExporterProvider-10b7fed5.js} +4 -4
- package/dist/cjs/{SnkFormConfigManager-1b13bacd.js → SnkFormConfigManager-beebf47a.js} +7 -9
- package/dist/cjs/{SnkMessageBuilder-722b104e.js → SnkMessageBuilder-cceebbae.js} +2 -2
- package/dist/cjs/{auth-fetcher-54f5ff9d.js → auth-fetcher-29bb791c.js} +1 -1
- package/dist/cjs/{dataunit-fetcher-0c7106a0.js → dataunit-fetcher-d4873076.js} +8 -4
- package/dist/cjs/{form-config-fetcher-2dd00e5b.js → form-config-fetcher-feb08214.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pesquisa-fetcher-680e198f.js → pesquisa-fetcher-a1d0353f.js} +1 -1
- package/dist/cjs/sankhyablocks.cjs.js +1 -1
- package/dist/cjs/snk-actions-button_4.cjs.entry.js +5 -5
- package/dist/cjs/snk-application.cjs.entry.js +7 -7
- package/dist/cjs/snk-attach.cjs.entry.js +36 -25
- package/dist/cjs/snk-crud.cjs.entry.js +11 -6
- package/dist/cjs/snk-data-exporter.cjs.entry.js +8 -8
- package/dist/cjs/{snk-data-unit-16791a2f.js → snk-data-unit-11e31d8d.js} +23 -11
- package/dist/cjs/snk-data-unit.cjs.entry.js +4 -4
- package/dist/cjs/snk-detail-view.cjs.entry.js +10 -11
- package/dist/cjs/snk-exporter-email-sender.cjs.entry.js +1 -1
- package/dist/cjs/snk-filter-bar.cjs.entry.js +19 -11
- package/dist/cjs/snk-filter-modal-item.cjs.entry.js +3 -3
- package/dist/cjs/snk-form-config.cjs.entry.js +3 -3
- package/dist/cjs/snk-form.cjs.entry.js +4 -4
- package/dist/cjs/snk-grid.cjs.entry.js +9 -9
- package/dist/cjs/{snk-guides-viewer-d82746e8.js → snk-guides-viewer-aafc3073.js} +12 -7
- package/dist/cjs/snk-guides-viewer.cjs.entry.js +7 -7
- package/dist/cjs/snk-personalized-filter.cjs.entry.js +3 -3
- package/dist/cjs/snk-simple-crud.cjs.entry.js +13 -11
- package/dist/cjs/snk-taskbar.cjs.entry.js +23 -1
- package/dist/collection/components/snk-attach/snk-attach.js +24 -15
- package/dist/collection/components/snk-crud/snk-crud.js +57 -1
- package/dist/collection/components/snk-crud/subcomponents/snk-detail-view/snk-detail-view.js +2 -3
- package/dist/collection/components/snk-crud/subcomponents/snk-guides-viewer.js +22 -2
- package/dist/collection/components/snk-data-exporter/exporter-email-sender/options-step.js +1 -1
- package/dist/collection/components/snk-data-exporter/structure/ItemBuilder.js +2 -2
- package/dist/collection/components/snk-data-unit/snk-data-unit.js +38 -9
- package/dist/collection/components/snk-filter-bar/snk-filter-bar.js +16 -8
- package/dist/collection/components/snk-form-config/SnkFormConfigManager.js +5 -7
- package/dist/collection/components/snk-form-config/snk-form-config.js +1 -1
- package/dist/collection/components/snk-grid/snk-grid.css +2 -0
- package/dist/collection/components/snk-grid/snk-grid.js +2 -2
- package/dist/collection/components/snk-simple-crud/snk-simple-crud.js +23 -4
- package/dist/collection/components/snk-taskbar/snk-taskbar.js +64 -0
- package/dist/collection/lib/configs/ConfigStorage.js +1 -0
- package/dist/collection/lib/dataUnit/dataUnitInMemoryUtils.js +7 -3
- package/dist/collection/lib/http/data-fetcher/DataFetcher.js +8 -3
- package/dist/collection/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.js +7 -5
- package/dist/collection/lib/message/resources/snk-data-unit.msg.js +1 -1
- package/dist/collection/lib/message/resources/snk-exporter.msg.js +1 -1
- package/dist/components/ConfigStorage.js +1 -0
- package/dist/components/DataFetcher.js +8 -3
- package/dist/components/SnkFormConfigManager.js +5 -7
- package/dist/components/SnkMessageBuilder.js +2 -2
- package/dist/components/dataunit-fetcher.js +7 -3
- package/dist/components/snk-attach2.js +31 -20
- package/dist/components/snk-crud.js +8 -1
- package/dist/components/snk-data-exporter2.js +2 -2
- package/dist/components/snk-data-unit2.js +22 -9
- package/dist/components/snk-detail-view2.js +10 -5
- package/dist/components/snk-exporter-email-sender2.js +1 -1
- package/dist/components/snk-filter-bar2.js +16 -8
- package/dist/components/snk-form-config2.js +1 -1
- package/dist/components/snk-grid2.js +3 -3
- package/dist/components/snk-simple-crud2.js +7 -4
- package/dist/components/snk-taskbar2.js +24 -2
- package/dist/esm/{ConfigStorage-86187da3.js → ConfigStorage-e476378d.js} +3 -2
- package/dist/esm/{DataFetcher-c1baf61d.js → DataFetcher-773a3e4b.js} +8 -3
- package/dist/esm/{IExporterProvider-5a858363.js → IExporterProvider-d597f27d.js} +4 -4
- package/dist/esm/{SnkFormConfigManager-d4554df9.js → SnkFormConfigManager-298cd647.js} +7 -9
- package/dist/esm/{SnkMessageBuilder-89925609.js → SnkMessageBuilder-ae87b754.js} +2 -2
- package/dist/esm/{auth-fetcher-039abba3.js → auth-fetcher-a411f73c.js} +1 -1
- package/dist/esm/{dataunit-fetcher-f7e0ffc0.js → dataunit-fetcher-3d2ec959.js} +8 -4
- package/dist/esm/{form-config-fetcher-30fb808f.js → form-config-fetcher-e0382e5a.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pesquisa-fetcher-03c8f919.js → pesquisa-fetcher-a87445a0.js} +1 -1
- package/dist/esm/sankhyablocks.js +1 -1
- package/dist/esm/snk-actions-button_4.entry.js +5 -5
- package/dist/esm/snk-application.entry.js +7 -7
- package/dist/esm/snk-attach.entry.js +36 -25
- package/dist/esm/snk-crud.entry.js +11 -6
- package/dist/esm/snk-data-exporter.entry.js +8 -8
- package/dist/esm/{snk-data-unit-a327d22c.js → snk-data-unit-29de836f.js} +23 -11
- package/dist/esm/snk-data-unit.entry.js +4 -4
- package/dist/esm/snk-detail-view.entry.js +10 -11
- package/dist/esm/snk-exporter-email-sender.entry.js +1 -1
- package/dist/esm/snk-filter-bar.entry.js +19 -11
- package/dist/esm/snk-filter-modal-item.entry.js +3 -3
- package/dist/esm/snk-form-config.entry.js +3 -3
- package/dist/esm/snk-form.entry.js +4 -4
- package/dist/esm/snk-grid.entry.js +9 -9
- package/dist/esm/{snk-guides-viewer-874da66f.js → snk-guides-viewer-62124f3d.js} +12 -7
- package/dist/esm/snk-guides-viewer.entry.js +7 -7
- package/dist/esm/snk-personalized-filter.entry.js +3 -3
- package/dist/esm/snk-simple-crud.entry.js +13 -11
- package/dist/esm/snk-taskbar.entry.js +23 -1
- package/dist/sankhyablocks/p-08c28ddd.entry.js +1 -0
- package/dist/sankhyablocks/{p-6d4f4614.js → p-091ce761.js} +1 -1
- package/dist/sankhyablocks/{p-b8cde0d8.entry.js → p-094eebf6.entry.js} +1 -1
- package/dist/sankhyablocks/{p-913a9979.js → p-0cd3c0a9.js} +1 -1
- package/dist/sankhyablocks/p-12f45f86.entry.js +1 -0
- package/dist/sankhyablocks/{p-60e46675.entry.js → p-162b9a59.entry.js} +2 -2
- package/dist/sankhyablocks/p-16a1dd18.entry.js +1 -0
- package/dist/sankhyablocks/{p-df5451c7.js → p-181975f1.js} +1 -1
- package/dist/sankhyablocks/p-18ed15f4.entry.js +1 -0
- package/dist/sankhyablocks/{p-af8efd95.js → p-25f1fc39.js} +1 -1
- package/dist/sankhyablocks/{p-8fc470e5.entry.js → p-2e9c764c.entry.js} +1 -1
- package/dist/sankhyablocks/{p-aff76a53.js → p-3287a6cc.js} +2 -2
- package/dist/sankhyablocks/{p-b7c4feeb.entry.js → p-421bec84.entry.js} +1 -1
- package/dist/sankhyablocks/p-51999ab5.entry.js +1 -0
- package/dist/sankhyablocks/p-53949130.entry.js +1 -0
- package/dist/sankhyablocks/p-594bc21d.js +1 -0
- package/dist/sankhyablocks/p-5b26cc7c.entry.js +1 -0
- package/dist/sankhyablocks/p-5b9160c6.entry.js +1 -0
- package/dist/sankhyablocks/{p-7d9baaf4.entry.js → p-5e384af4.entry.js} +1 -1
- package/dist/sankhyablocks/p-5f016aed.js +1 -0
- package/dist/sankhyablocks/p-70001ac1.js +1 -0
- package/dist/sankhyablocks/{p-e6210aec.js → p-76a65660.js} +1 -1
- package/dist/sankhyablocks/p-7c4aabe2.js +1 -0
- package/dist/sankhyablocks/p-8f4e743f.js +1 -0
- package/dist/sankhyablocks/p-939e15d3.entry.js +1 -0
- package/dist/sankhyablocks/{p-a1d72395.entry.js → p-9dfda04a.entry.js} +1 -1
- package/dist/sankhyablocks/{p-eae7a817.entry.js → p-bd008859.entry.js} +1 -1
- package/dist/sankhyablocks/p-d65d98ed.entry.js +1 -0
- package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
- package/dist/types/components/snk-attach/snk-attach.d.ts +1 -0
- package/dist/types/components/snk-crud/snk-crud.d.ts +9 -0
- package/dist/types/components/snk-crud/subcomponents/snk-guides-viewer.d.ts +5 -0
- package/dist/types/components/snk-data-unit/snk-data-unit.d.ts +6 -1
- package/dist/types/components/snk-filter-bar/snk-filter-bar.d.ts +1 -0
- package/dist/types/components/snk-form-config/SnkFormConfigManager.d.ts +2 -2
- package/dist/types/components/snk-simple-crud/snk-simple-crud.d.ts +4 -0
- package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +11 -0
- package/dist/types/components.d.ts +49 -0
- package/dist/types/lib/http/data-fetcher/fetchers/AttachFetcher/anexo-sistema-fetcher.d.ts +3 -2
- package/package.json +2 -2
- package/dist/sankhyablocks/p-0046959e.entry.js +0 -1
- package/dist/sankhyablocks/p-0e11ee18.entry.js +0 -1
- package/dist/sankhyablocks/p-14a08904.entry.js +0 -1
- package/dist/sankhyablocks/p-219f888d.entry.js +0 -1
- package/dist/sankhyablocks/p-47b60deb.entry.js +0 -1
- package/dist/sankhyablocks/p-6ded2076.entry.js +0 -1
- package/dist/sankhyablocks/p-7a337364.js +0 -1
- package/dist/sankhyablocks/p-829d4045.js +0 -1
- package/dist/sankhyablocks/p-8c6b44ea.entry.js +0 -1
- package/dist/sankhyablocks/p-a4b1f1eb.js +0 -1
- package/dist/sankhyablocks/p-c7cbad38.js +0 -1
- package/dist/sankhyablocks/p-dc7c9047.js +0 -1
- package/dist/sankhyablocks/p-e0b9f59a.entry.js +0 -1
- package/dist/sankhyablocks/p-e9bbc3d5.entry.js +0 -1
- package/dist/sankhyablocks/p-f2809746.entry.js +0 -1
@@ -1 +0,0 @@
|
|
1
|
-
import{DataType as t,ApplicationContext as e,StringUtils as n,ErrorException as i,WarningException as r,ObjectUtils as s}from"@sankhyalabs/core";import{P as o}from"./p-8d884fab.js";import{DataUnitTransient as u}from"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function c(t,e,n){return t(n={path:e,exports:{},require:function(){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}()}},n.exports),n.exports}var l=c((function(t,e){var n="undefined"!=typeof self?self:a,i=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n="URLSearchParams"in t,i="Symbol"in t&&"iterator"in Symbol,r="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),s="FormData"in t,o="ArrayBuffer"in t;if(o)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=ArrayBuffer.isView||function(t){return t&&u.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function l(t){return"string"!=typeof t&&(t=String(t)),t}function h(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return i&&(e[Symbol.iterator]=function(){return e}),e}function f(t){this.map={},t instanceof f?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function d(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function v(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function p(t){var e=new FileReader,n=v(e);return e.readAsArrayBuffer(t),n}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function y(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:r&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:s&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():o&&r&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(t)||a(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r&&(this.blob=function(){var t=d(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(p)}),this.text=function(){var t,e,n,i=d(this);if(i)return i;if(this._bodyBlob)return t=this._bodyBlob,n=v(e=new FileReader),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),i=0;i<e.length;i++)n[i]=String.fromCharCode(e[i]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(g)}),this.json=function(){return this.text().then(JSON.parse)},this}f.prototype.append=function(t,e){t=c(t),e=l(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},f.prototype.delete=function(t){delete this.map[c(t)]},f.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},f.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},f.prototype.set=function(t,e){this.map[c(t)]=l(e)},f.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},f.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),h(t)},f.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),h(t)},f.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),h(t)},i&&(f.prototype[Symbol.iterator]=f.prototype.entries);var b=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function w(t,e){var n,i,r=(e=e||{}).body;if(t instanceof w){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new f(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,r||null==t._bodyInit||(r=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new f(e.headers)),this.method=(i=(n=e.method||this.method||"GET").toUpperCase(),b.indexOf(i)>-1?i:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&r)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(r)}function g(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),i=n.shift().replace(/\+/g," "),r=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(i),decodeURIComponent(r))}})),e}function O(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new f(e.headers),this.url=e.url||"",this._initBody(t)}w.prototype.clone=function(){return new w(this,{body:this._bodyInit})},y.call(w.prototype),y.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new f(this.headers),url:this.url})},O.error=function(){var t=new O(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];O.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new O(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function T(t,n){return new Promise((function(i,s){var o=new w(t,n);if(o.signal&&o.signal.aborted)return s(new e.DOMException("Aborted","AbortError"));var u=new XMLHttpRequest;function a(){u.abort()}u.onload=function(){var t,e,n={status:u.status,statusText:u.statusText,headers:(t=u.getAllResponseHeaders()||"",e=new f,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),i=n.shift().trim();if(i){var r=n.join(":").trim();e.append(i,r)}})),e)};n.url="responseURL"in u?u.responseURL:n.headers.get("X-Request-URL"),i(new O("response"in u?u.response:u.responseText,n))},u.onerror=function(){s(new TypeError("Network request failed"))},u.ontimeout=function(){s(new TypeError("Network request failed"))},u.onabort=function(){s(new e.DOMException("Aborted","AbortError"))},u.open(o.method,o.url,!0),"include"===o.credentials?u.withCredentials=!0:"omit"===o.credentials&&(u.withCredentials=!1),"responseType"in u&&r&&(u.responseType="blob"),o.headers.forEach((function(t,e){u.setRequestHeader(e,t)})),o.signal&&(o.signal.addEventListener("abort",a),u.onreadystatechange=function(){4===u.readyState&&o.signal.removeEventListener("abort",a)}),u.send(void 0===o._bodyInit?null:o._bodyInit)}))}T.polyfill=!0,t.fetch||(t.fetch=T,t.Headers=f,t.Request=w,t.Response=O),e.Headers=f,e.Request=w,e.Response=O,e.fetch=T,Object.defineProperty(e,"__esModule",{value:!0})}({})}(i),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var r=i;(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e})),h=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.isObjectLike=function(t){return"object"==typeof t&&null!==t}})),f=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.invariant=function(t,e){if(!Boolean(t))throw new Error(null!=e?e:"Unexpected invariant triggered.")}})),d=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.getLocation=function(t,e){let i=0,r=1;for(const s of t.body.matchAll(n)){if("number"==typeof s.index||(0,f.invariant)(!1),s.index>=e)break;i=s.index+s[0].length,r+=1}return{line:r,column:e+1-i}};const n=/\r\n|[\n\r]/g})),v=c((function(t,e){function n(t,e){const n=t.locationOffset.column-1,r="".padStart(n)+t.body,s=e.line-1,o=e.line+(t.locationOffset.line-1),u=e.column+(1===e.line?n:0),a=`${t.name}:${o}:${u}\n`,c=r.split(/\r\n|[\n\r]/g),l=c[s];if(l.length>120){const t=Math.floor(u/80),e=u%80,n=[];for(let t=0;t<l.length;t+=80)n.push(l.slice(t,t+80));return a+i([[`${o} |`,n[0]],...n.slice(1,t+1).map((t=>["|",t])),["|","^".padStart(e)],["|",n[t+1]]])}return a+i([[o-1+" |",c[s-1]],[`${o} |`,l],["|","^".padStart(u)],[`${o+1} |`,c[s+1]]])}function i(t){const e=t.filter((([t,e])=>void 0!==e)),n=Math.max(...e.map((([t])=>t.length)));return e.map((([t,e])=>t.padStart(n)+(e?" "+e:""))).join("\n")}Object.defineProperty(e,"__esModule",{value:!0}),e.printLocation=function(t){return n(t.source,(0,d.getLocation)(t.source,t.start))},e.printSourceLocation=n})),p=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLError=void 0,e.formatError=function(t){return t.toJSON()},e.printError=function(t){return t.toString()};class n extends Error{constructor(t,...e){var r,s,o;const{nodes:u,source:a,positions:c,path:l,originalError:f,extensions:v}=function(t){const e=t[0];return null==e||"kind"in e||"length"in e?{nodes:e,source:t[1],positions:t[2],path:t[3],originalError:t[4],extensions:t[5]}:e}(e);super(t),this.name="GraphQLError",this.path=null!=l?l:void 0,this.originalError=null!=f?f:void 0,this.nodes=i(Array.isArray(u)?u:u?[u]:void 0);const p=i(null===(r=this.nodes)||void 0===r?void 0:r.map((t=>t.loc)).filter((t=>null!=t)));this.source=null!=a?a:null==p||null===(s=p[0])||void 0===s?void 0:s.source,this.positions=null!=c?c:null==p?void 0:p.map((t=>t.start)),this.locations=c&&a?c.map((t=>(0,d.getLocation)(a,t))):null==p?void 0:p.map((t=>(0,d.getLocation)(t.source,t.start)));const m=(0,h.isObjectLike)(null==f?void 0:f.extensions)?null==f?void 0:f.extensions:void 0;this.extensions=null!==(o=null!=v?v:m)&&void 0!==o?o:Object.create(null),Object.defineProperties(this,{message:{writable:!0,enumerable:!0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),null!=f&&f.stack?Object.defineProperty(this,"stack",{value:f.stack,writable:!0,configurable:!0}):Error.captureStackTrace?Error.captureStackTrace(this,n):Object.defineProperty(this,"stack",{value:Error().stack,writable:!0,configurable:!0})}get[Symbol.toStringTag](){return"GraphQLError"}toString(){let t=this.message;if(this.nodes)for(const e of this.nodes)e.loc&&(t+="\n\n"+(0,v.printLocation)(e.loc));else if(this.source&&this.locations)for(const e of this.locations)t+="\n\n"+(0,v.printSourceLocation)(this.source,e);return t}toJSON(){const t={message:this.message};return null!=this.locations&&(t.locations=this.locations),null!=this.path&&(t.path=this.path),null!=this.extensions&&Object.keys(this.extensions).length>0&&(t.extensions=this.extensions),t}}function i(t){return void 0===t||0===t.length?void 0:t}e.GraphQLError=n})),m=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.syntaxError=function(t,e,n){return new p.GraphQLError(`Syntax Error: ${n}`,{source:t,positions:[e]})}})),y=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Token=e.QueryDocumentKeys=e.OperationTypeNode=e.Location=void 0,e.isNode=function(t){const e=null==t?void 0:t.kind;return"string"==typeof e&&s.has(e)};class n{constructor(t,e,n){this.start=t.start,this.end=e.end,this.startToken=t,this.endToken=e,this.source=n}get[Symbol.toStringTag](){return"Location"}toJSON(){return{start:this.start,end:this.end}}}e.Location=n;class i{constructor(t,e,n,i,r,s){this.kind=t,this.start=e,this.end=n,this.line=i,this.column=r,this.value=s,this.prev=null,this.next=null}get[Symbol.toStringTag](){return"Token"}toJSON(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}}}e.Token=i;const r={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]};e.QueryDocumentKeys=r;const s=new Set(Object.keys(r));var o;e.OperationTypeNode=o,function(t){t.QUERY="query",t.MUTATION="mutation",t.SUBSCRIPTION="subscription"}(o||(e.OperationTypeNode=o={}))})),b=c((function(t,e){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.DirectiveLocation=void 0,e.DirectiveLocation=n,function(t){t.QUERY="QUERY",t.MUTATION="MUTATION",t.SUBSCRIPTION="SUBSCRIPTION",t.FIELD="FIELD",t.FRAGMENT_DEFINITION="FRAGMENT_DEFINITION",t.FRAGMENT_SPREAD="FRAGMENT_SPREAD",t.INLINE_FRAGMENT="INLINE_FRAGMENT",t.VARIABLE_DEFINITION="VARIABLE_DEFINITION",t.SCHEMA="SCHEMA",t.SCALAR="SCALAR",t.OBJECT="OBJECT",t.FIELD_DEFINITION="FIELD_DEFINITION",t.ARGUMENT_DEFINITION="ARGUMENT_DEFINITION",t.INTERFACE="INTERFACE",t.UNION="UNION",t.ENUM="ENUM",t.ENUM_VALUE="ENUM_VALUE",t.INPUT_OBJECT="INPUT_OBJECT",t.INPUT_FIELD_DEFINITION="INPUT_FIELD_DEFINITION"}(n||(e.DirectiveLocation=n={}))})),w=c((function(t,e){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.Kind=void 0,e.Kind=n,function(t){t.NAME="Name",t.DOCUMENT="Document",t.OPERATION_DEFINITION="OperationDefinition",t.VARIABLE_DEFINITION="VariableDefinition",t.SELECTION_SET="SelectionSet",t.FIELD="Field",t.ARGUMENT="Argument",t.FRAGMENT_SPREAD="FragmentSpread",t.INLINE_FRAGMENT="InlineFragment",t.FRAGMENT_DEFINITION="FragmentDefinition",t.VARIABLE="Variable",t.INT="IntValue",t.FLOAT="FloatValue",t.STRING="StringValue",t.BOOLEAN="BooleanValue",t.NULL="NullValue",t.ENUM="EnumValue",t.LIST="ListValue",t.OBJECT="ObjectValue",t.OBJECT_FIELD="ObjectField",t.DIRECTIVE="Directive",t.NAMED_TYPE="NamedType",t.LIST_TYPE="ListType",t.NON_NULL_TYPE="NonNullType",t.SCHEMA_DEFINITION="SchemaDefinition",t.OPERATION_TYPE_DEFINITION="OperationTypeDefinition",t.SCALAR_TYPE_DEFINITION="ScalarTypeDefinition",t.OBJECT_TYPE_DEFINITION="ObjectTypeDefinition",t.FIELD_DEFINITION="FieldDefinition",t.INPUT_VALUE_DEFINITION="InputValueDefinition",t.INTERFACE_TYPE_DEFINITION="InterfaceTypeDefinition",t.UNION_TYPE_DEFINITION="UnionTypeDefinition",t.ENUM_TYPE_DEFINITION="EnumTypeDefinition",t.ENUM_VALUE_DEFINITION="EnumValueDefinition",t.INPUT_OBJECT_TYPE_DEFINITION="InputObjectTypeDefinition",t.DIRECTIVE_DEFINITION="DirectiveDefinition",t.SCHEMA_EXTENSION="SchemaExtension",t.SCALAR_TYPE_EXTENSION="ScalarTypeExtension",t.OBJECT_TYPE_EXTENSION="ObjectTypeExtension",t.INTERFACE_TYPE_EXTENSION="InterfaceTypeExtension",t.UNION_TYPE_EXTENSION="UnionTypeExtension",t.ENUM_TYPE_EXTENSION="EnumTypeExtension",t.INPUT_OBJECT_TYPE_EXTENSION="InputObjectTypeExtension"}(n||(e.Kind=n={}))})),g=c((function(t,e){function n(t){return t>=48&&t<=57}function i(t){return t>=97&&t<=122||t>=65&&t<=90}Object.defineProperty(e,"__esModule",{value:!0}),e.isDigit=n,e.isLetter=i,e.isNameContinue=function(t){return i(t)||n(t)||95===t},e.isNameStart=function(t){return i(t)||95===t},e.isWhiteSpace=function(t){return 9===t||32===t}})),O=c((function(t,e){function n(t){let e=0;for(;e<t.length&&(0,g.isWhiteSpace)(t.charCodeAt(e));)++e;return e}Object.defineProperty(e,"__esModule",{value:!0}),e.dedentBlockStringLines=function(t){var e;let i=Number.MAX_SAFE_INTEGER,r=null,s=-1;for(let e=0;e<t.length;++e){var o;const u=t[e],a=n(u);a!==u.length&&(r=null!==(o=r)&&void 0!==o?o:e,s=e,0!==e&&a<i&&(i=a))}return t.map(((t,e)=>0===e?t:t.slice(i))).slice(null!==(e=r)&&void 0!==e?e:0,s+1)},e.isPrintableAsBlockString=function(t){if(""===t)return!0;let e=!0,n=!1,i=!0,r=!1;for(let s=0;s<t.length;++s)switch(t.codePointAt(s)){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 11:case 12:case 14:case 15:case 13:return!1;case 10:if(e&&!r)return!1;r=!0,e=!0,n=!1;break;case 9:case 32:n||(n=e);break;default:i&&(i=n),e=!1}return!e&&(!i||!r)},e.printBlockString=function(t,e){const n=t.replace(/"""/g,'\\"""'),i=n.split(/\r\n|[\n\r]/g),r=1===i.length,s=i.length>1&&i.slice(1).every((t=>0===t.length||(0,g.isWhiteSpace)(t.charCodeAt(0)))),o=n.endsWith('\\"""'),u=t.endsWith('"')&&!o,a=t.endsWith("\\"),c=u||a,l=!(null!=e&&e.minimize)&&(!r||t.length>70||c||s||o);let h="";const f=r&&(0,g.isWhiteSpace)(t.charCodeAt(0));return(l&&!f||s)&&(h+="\n"),h+=n,(l||c)&&(h+="\n"),'"""'+h+'"""'}})),E=c((function(t,e){var n;Object.defineProperty(e,"__esModule",{value:!0}),e.TokenKind=void 0,e.TokenKind=n,function(t){t.SOF="<SOF>",t.EOF="<EOF>",t.BANG="!",t.DOLLAR="$",t.AMP="&",t.PAREN_L="(",t.PAREN_R=")",t.SPREAD="...",t.COLON=":",t.EQUALS="=",t.AT="@",t.BRACKET_L="[",t.BRACKET_R="]",t.BRACE_L="{",t.PIPE="|",t.BRACE_R="}",t.NAME="Name",t.INT="Int",t.FLOAT="Float",t.STRING="String",t.BLOCK_STRING="BlockString",t.COMMENT="Comment"}(n||(e.TokenKind=n={}))})),T=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Lexer=void 0,e.isPunctuatorTokenKind=function(t){return t===E.TokenKind.BANG||t===E.TokenKind.DOLLAR||t===E.TokenKind.AMP||t===E.TokenKind.PAREN_L||t===E.TokenKind.PAREN_R||t===E.TokenKind.SPREAD||t===E.TokenKind.COLON||t===E.TokenKind.EQUALS||t===E.TokenKind.AT||t===E.TokenKind.BRACKET_L||t===E.TokenKind.BRACKET_R||t===E.TokenKind.BRACE_L||t===E.TokenKind.PIPE||t===E.TokenKind.BRACE_R};class n{constructor(t){const e=new y.Token(E.TokenKind.SOF,0,0,0,0);this.source=t,this.lastToken=e,this.token=e,this.line=1,this.lineStart=0}get[Symbol.toStringTag](){return"Lexer"}advance(){return this.lastToken=this.token,this.token=this.lookahead()}lookahead(){let t=this.token;if(t.kind!==E.TokenKind.EOF)do{if(t.next)t=t.next;else{const e=c(this,t.end);t.next=e,e.prev=t,t=e}}while(t.kind===E.TokenKind.COMMENT);return t}}function i(t){return t>=0&&t<=55295||t>=57344&&t<=1114111}function r(t,e){return s(t.charCodeAt(e))&&o(t.charCodeAt(e+1))}function s(t){return t>=55296&&t<=56319}function o(t){return t>=56320&&t<=57343}function u(t,e){const n=t.source.body.codePointAt(e);if(void 0===n)return E.TokenKind.EOF;if(n>=32&&n<=126){const t=String.fromCodePoint(n);return'"'===t?"'\"'":`"${t}"`}return"U+"+n.toString(16).toUpperCase().padStart(4,"0")}function a(t,e,n,i,r){return new y.Token(e,n,i,t.line,1+n-t.lineStart,r)}function c(t,e){const n=t.source.body,s=n.length;let o=e;for(;o<s;){const e=n.charCodeAt(o);switch(e){case 65279:case 9:case 32:case 44:++o;continue;case 10:++o,++t.line,t.lineStart=o;continue;case 13:10===n.charCodeAt(o+1)?o+=2:++o,++t.line,t.lineStart=o;continue;case 35:return l(t,o);case 33:return a(t,E.TokenKind.BANG,o,o+1);case 36:return a(t,E.TokenKind.DOLLAR,o,o+1);case 38:return a(t,E.TokenKind.AMP,o,o+1);case 40:return a(t,E.TokenKind.PAREN_L,o,o+1);case 41:return a(t,E.TokenKind.PAREN_R,o,o+1);case 46:if(46===n.charCodeAt(o+1)&&46===n.charCodeAt(o+2))return a(t,E.TokenKind.SPREAD,o,o+3);break;case 58:return a(t,E.TokenKind.COLON,o,o+1);case 61:return a(t,E.TokenKind.EQUALS,o,o+1);case 64:return a(t,E.TokenKind.AT,o,o+1);case 91:return a(t,E.TokenKind.BRACKET_L,o,o+1);case 93:return a(t,E.TokenKind.BRACKET_R,o,o+1);case 123:return a(t,E.TokenKind.BRACE_L,o,o+1);case 124:return a(t,E.TokenKind.PIPE,o,o+1);case 125:return a(t,E.TokenKind.BRACE_R,o,o+1);case 34:return 34===n.charCodeAt(o+1)&&34===n.charCodeAt(o+2)?S(t,o):d(t,o)}if((0,g.isDigit)(e)||45===e)return h(t,o,e);if((0,g.isNameStart)(e))return j(t,o);throw(0,m.syntaxError)(t.source,o,39===e?"Unexpected single quote character ('), did you mean to use a double quote (\")?":i(e)||r(n,o)?`Unexpected character: ${u(t,o)}.`:`Invalid character: ${u(t,o)}.`)}return a(t,E.TokenKind.EOF,s,s)}function l(t,e){const n=t.source.body,s=n.length;let o=e+1;for(;o<s;){const t=n.charCodeAt(o);if(10===t||13===t)break;if(i(t))++o;else{if(!r(n,o))break;o+=2}}return a(t,E.TokenKind.COMMENT,e,o,n.slice(e+1,o))}function h(t,e,n){const i=t.source.body;let r=e,s=n,o=!1;if(45===s&&(s=i.charCodeAt(++r)),48===s){if(s=i.charCodeAt(++r),(0,g.isDigit)(s))throw(0,m.syntaxError)(t.source,r,`Invalid number, unexpected digit after 0: ${u(t,r)}.`)}else r=f(t,r,s),s=i.charCodeAt(r);if(46===s&&(o=!0,s=i.charCodeAt(++r),r=f(t,r,s),s=i.charCodeAt(r)),69!==s&&101!==s||(o=!0,s=i.charCodeAt(++r),43!==s&&45!==s||(s=i.charCodeAt(++r)),r=f(t,r,s),s=i.charCodeAt(r)),46===s||(0,g.isNameStart)(s))throw(0,m.syntaxError)(t.source,r,`Invalid number, expected digit but got: ${u(t,r)}.`);return a(t,o?E.TokenKind.FLOAT:E.TokenKind.INT,e,r,i.slice(e,r))}function f(t,e,n){if(!(0,g.isDigit)(n))throw(0,m.syntaxError)(t.source,e,`Invalid number, expected digit but got: ${u(t,e)}.`);const i=t.source.body;let r=e+1;for(;(0,g.isDigit)(i.charCodeAt(r));)++r;return r}function d(t,e){const n=t.source.body,s=n.length;let o=e+1,c=o,l="";for(;o<s;){const s=n.charCodeAt(o);if(34===s)return l+=n.slice(c,o),a(t,E.TokenKind.STRING,e,o+1,l);if(92!==s){if(10===s||13===s)break;if(i(s))++o;else{if(!r(n,o))throw(0,m.syntaxError)(t.source,o,`Invalid character within String: ${u(t,o)}.`);o+=2}}else{l+=n.slice(c,o);const e=117===n.charCodeAt(o+1)?123===n.charCodeAt(o+2)?v(t,o):p(t,o):T(t,o);l+=e.value,o+=e.size,c=o}}throw(0,m.syntaxError)(t.source,o,"Unterminated string.")}function v(t,e){const n=t.source.body;let r=0,s=3;for(;s<12;){const t=n.charCodeAt(e+s++);if(125===t){if(s<5||!i(r))break;return{value:String.fromCodePoint(r),size:s}}if(r=r<<4|w(t),r<0)break}throw(0,m.syntaxError)(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+s)}".`)}function p(t,e){const n=t.source.body,r=b(n,e+2);if(i(r))return{value:String.fromCodePoint(r),size:6};if(s(r)&&92===n.charCodeAt(e+6)&&117===n.charCodeAt(e+7)){const t=b(n,e+8);if(o(t))return{value:String.fromCodePoint(r,t),size:12}}throw(0,m.syntaxError)(t.source,e,`Invalid Unicode escape sequence: "${n.slice(e,e+6)}".`)}function b(t,e){return w(t.charCodeAt(e))<<12|w(t.charCodeAt(e+1))<<8|w(t.charCodeAt(e+2))<<4|w(t.charCodeAt(e+3))}function w(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function T(t,e){const n=t.source.body;switch(n.charCodeAt(e+1)){case 34:return{value:'"',size:2};case 92:return{value:"\\",size:2};case 47:return{value:"/",size:2};case 98:return{value:"\b",size:2};case 102:return{value:"\f",size:2};case 110:return{value:"\n",size:2};case 114:return{value:"\r",size:2};case 116:return{value:"\t",size:2}}throw(0,m.syntaxError)(t.source,e,`Invalid character escape sequence: "${n.slice(e,e+2)}".`)}function S(t,e){const n=t.source.body,s=n.length;let o=t.lineStart,c=e+3,l=c,h="";const f=[];for(;c<s;){const s=n.charCodeAt(c);if(34===s&&34===n.charCodeAt(c+1)&&34===n.charCodeAt(c+2)){h+=n.slice(l,c),f.push(h);const i=a(t,E.TokenKind.BLOCK_STRING,e,c+3,(0,O.dedentBlockStringLines)(f).join("\n"));return t.line+=f.length-1,t.lineStart=o,i}if(92!==s||34!==n.charCodeAt(c+1)||34!==n.charCodeAt(c+2)||34!==n.charCodeAt(c+3))if(10!==s&&13!==s)if(i(s))++c;else{if(!r(n,c))throw(0,m.syntaxError)(t.source,c,`Invalid character within String: ${u(t,c)}.`);c+=2}else h+=n.slice(l,c),f.push(h),13===s&&10===n.charCodeAt(c+1)?c+=2:++c,h="",l=c,o=c;else h+=n.slice(l,c),l=c+1,c+=4}throw(0,m.syntaxError)(t.source,c,"Unterminated string.")}function j(t,e){const n=t.source.body,i=n.length;let r=e+1;for(;r<i;){const t=n.charCodeAt(r);if(!(0,g.isNameContinue)(t))break;++r}return a(t,E.TokenKind.NAME,e,r,n.slice(e,r))}e.Lexer=n})),S=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.devAssert=function(t,e){if(!Boolean(t))throw new Error(e)}})),j=c((function(t,e){function n(t,e){switch(typeof t){case"string":return JSON.stringify(t);case"function":return t.name?`[function ${t.name}]`:"[function]";case"object":return function(t,e){if(null===t)return"null";if(e.includes(t))return"[Circular]";const i=[...e,t];if(function(t){return"function"==typeof t.toJSON}(t)){const e=t.toJSON();if(e!==t)return"string"==typeof e?e:n(e,i)}else if(Array.isArray(t))return function(t,e){if(0===t.length)return"[]";if(e.length>2)return"[Array]";const i=Math.min(10,t.length),r=t.length-i,s=[];for(let r=0;r<i;++r)s.push(n(t[r],e));return 1===r?s.push("... 1 more item"):r>1&&s.push(`... ${r} more items`),"["+s.join(", ")+"]"}(t,i);return function(t,e){const i=Object.entries(t);if(0===i.length)return"{}";if(e.length>2)return"["+function(t){const e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if("Object"===e&&"function"==typeof t.constructor){const e=t.constructor.name;if("string"==typeof e&&""!==e)return e}return e}(t)+"]";const r=i.map((([t,i])=>t+": "+n(i,e)));return"{ "+r.join(", ")+" }"}(t,i)}(t,e);default:return String(t)}}Object.defineProperty(e,"__esModule",{value:!0}),e.inspect=function(t){return n(t,[])}})),D=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.instanceOf=void 0,e.instanceOf=function(t,e){return t instanceof e}})),x=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Source=void 0,e.isSource=function(t){return(0,D.instanceOf)(t,n)};class n{constructor(t,e="GraphQL request",n={line:1,column:1}){"string"==typeof t||(0,S.devAssert)(!1,`Body must be a string. Received: ${(0,j.inspect)(t)}.`),this.body=t,this.name=e,this.locationOffset=n,this.locationOffset.line>0||(0,S.devAssert)(!1,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||(0,S.devAssert)(!1,"column in locationOffset is 1-indexed and must be positive.")}get[Symbol.toStringTag](){return"Source"}}e.Source=n})),I=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.Parser=void 0,e.parse=function(t,e){return new n(t,e).parseDocument()},e.parseConstValue=function(t,e){const i=new n(t,e);i.expectToken(E.TokenKind.SOF);const r=i.parseConstValueLiteral();return i.expectToken(E.TokenKind.EOF),r},e.parseType=function(t,e){const i=new n(t,e);i.expectToken(E.TokenKind.SOF);const r=i.parseTypeReference();return i.expectToken(E.TokenKind.EOF),r},e.parseValue=function(t,e){const i=new n(t,e);i.expectToken(E.TokenKind.SOF);const r=i.parseValueLiteral(!1);return i.expectToken(E.TokenKind.EOF),r};class n{constructor(t,e={}){const n=(0,x.isSource)(t)?t:new x.Source(t);this._lexer=new T.Lexer(n),this._options=e,this._tokenCounter=0}parseName(){const t=this.expectToken(E.TokenKind.NAME);return this.node(t,{kind:w.Kind.NAME,value:t.value})}parseDocument(){return this.node(this._lexer.token,{kind:w.Kind.DOCUMENT,definitions:this.many(E.TokenKind.SOF,this.parseDefinition,E.TokenKind.EOF)})}parseDefinition(){if(this.peek(E.TokenKind.BRACE_L))return this.parseOperationDefinition();const t=this.peekDescription(),e=t?this._lexer.lookahead():this._lexer.token;if(e.kind===E.TokenKind.NAME){switch(e.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}if(t)throw(0,m.syntaxError)(this._lexer.source,this._lexer.token.start,"Unexpected description, descriptions are supported only on type definitions.");switch(e.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"extend":return this.parseTypeSystemExtension()}}throw this.unexpected(e)}parseOperationDefinition(){const t=this._lexer.token;if(this.peek(E.TokenKind.BRACE_L))return this.node(t,{kind:w.Kind.OPERATION_DEFINITION,operation:y.OperationTypeNode.QUERY,name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet()});const e=this.parseOperationType();let n;return this.peek(E.TokenKind.NAME)&&(n=this.parseName()),this.node(t,{kind:w.Kind.OPERATION_DEFINITION,operation:e,name:n,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseOperationType(){const t=this.expectToken(E.TokenKind.NAME);switch(t.value){case"query":return y.OperationTypeNode.QUERY;case"mutation":return y.OperationTypeNode.MUTATION;case"subscription":return y.OperationTypeNode.SUBSCRIPTION}throw this.unexpected(t)}parseVariableDefinitions(){return this.optionalMany(E.TokenKind.PAREN_L,this.parseVariableDefinition,E.TokenKind.PAREN_R)}parseVariableDefinition(){return this.node(this._lexer.token,{kind:w.Kind.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(E.TokenKind.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(E.TokenKind.EQUALS)?this.parseConstValueLiteral():void 0,directives:this.parseConstDirectives()})}parseVariable(){const t=this._lexer.token;return this.expectToken(E.TokenKind.DOLLAR),this.node(t,{kind:w.Kind.VARIABLE,name:this.parseName()})}parseSelectionSet(){return this.node(this._lexer.token,{kind:w.Kind.SELECTION_SET,selections:this.many(E.TokenKind.BRACE_L,this.parseSelection,E.TokenKind.BRACE_R)})}parseSelection(){return this.peek(E.TokenKind.SPREAD)?this.parseFragment():this.parseField()}parseField(){const t=this._lexer.token,e=this.parseName();let n,i;return this.expectOptionalToken(E.TokenKind.COLON)?(n=e,i=this.parseName()):i=e,this.node(t,{kind:w.Kind.FIELD,alias:n,name:i,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(E.TokenKind.BRACE_L)?this.parseSelectionSet():void 0})}parseArguments(t){return this.optionalMany(E.TokenKind.PAREN_L,t?this.parseConstArgument:this.parseArgument,E.TokenKind.PAREN_R)}parseArgument(t=!1){const e=this._lexer.token,n=this.parseName();return this.expectToken(E.TokenKind.COLON),this.node(e,{kind:w.Kind.ARGUMENT,name:n,value:this.parseValueLiteral(t)})}parseConstArgument(){return this.parseArgument(!0)}parseFragment(){const t=this._lexer.token;this.expectToken(E.TokenKind.SPREAD);const e=this.expectOptionalKeyword("on");return!e&&this.peek(E.TokenKind.NAME)?this.node(t,{kind:w.Kind.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1)}):this.node(t,{kind:w.Kind.INLINE_FRAGMENT,typeCondition:e?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentDefinition(){const t=this._lexer.token;return this.expectKeyword("fragment"),this.node(t,!0===this._options.allowLegacyFragmentVariables?{kind:w.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()}:{kind:w.Kind.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet()})}parseFragmentName(){if("on"===this._lexer.token.value)throw this.unexpected();return this.parseName()}parseValueLiteral(t){const e=this._lexer.token;switch(e.kind){case E.TokenKind.BRACKET_L:return this.parseList(t);case E.TokenKind.BRACE_L:return this.parseObject(t);case E.TokenKind.INT:return this.advanceLexer(),this.node(e,{kind:w.Kind.INT,value:e.value});case E.TokenKind.FLOAT:return this.advanceLexer(),this.node(e,{kind:w.Kind.FLOAT,value:e.value});case E.TokenKind.STRING:case E.TokenKind.BLOCK_STRING:return this.parseStringLiteral();case E.TokenKind.NAME:switch(this.advanceLexer(),e.value){case"true":return this.node(e,{kind:w.Kind.BOOLEAN,value:!0});case"false":return this.node(e,{kind:w.Kind.BOOLEAN,value:!1});case"null":return this.node(e,{kind:w.Kind.NULL});default:return this.node(e,{kind:w.Kind.ENUM,value:e.value})}case E.TokenKind.DOLLAR:if(t){if(this.expectToken(E.TokenKind.DOLLAR),this._lexer.token.kind===E.TokenKind.NAME)throw(0,m.syntaxError)(this._lexer.source,e.start,`Unexpected variable "$${this._lexer.token.value}" in constant value.`);throw this.unexpected(e)}return this.parseVariable();default:throw this.unexpected()}}parseConstValueLiteral(){return this.parseValueLiteral(!0)}parseStringLiteral(){const t=this._lexer.token;return this.advanceLexer(),this.node(t,{kind:w.Kind.STRING,value:t.value,block:t.kind===E.TokenKind.BLOCK_STRING})}parseList(t){return this.node(this._lexer.token,{kind:w.Kind.LIST,values:this.any(E.TokenKind.BRACKET_L,(()=>this.parseValueLiteral(t)),E.TokenKind.BRACKET_R)})}parseObject(t){return this.node(this._lexer.token,{kind:w.Kind.OBJECT,fields:this.any(E.TokenKind.BRACE_L,(()=>this.parseObjectField(t)),E.TokenKind.BRACE_R)})}parseObjectField(t){const e=this._lexer.token,n=this.parseName();return this.expectToken(E.TokenKind.COLON),this.node(e,{kind:w.Kind.OBJECT_FIELD,name:n,value:this.parseValueLiteral(t)})}parseDirectives(t){const e=[];for(;this.peek(E.TokenKind.AT);)e.push(this.parseDirective(t));return e}parseConstDirectives(){return this.parseDirectives(!0)}parseDirective(t){const e=this._lexer.token;return this.expectToken(E.TokenKind.AT),this.node(e,{kind:w.Kind.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(t)})}parseTypeReference(){const t=this._lexer.token;let e;if(this.expectOptionalToken(E.TokenKind.BRACKET_L)){const n=this.parseTypeReference();this.expectToken(E.TokenKind.BRACKET_R),e=this.node(t,{kind:w.Kind.LIST_TYPE,type:n})}else e=this.parseNamedType();return this.expectOptionalToken(E.TokenKind.BANG)?this.node(t,{kind:w.Kind.NON_NULL_TYPE,type:e}):e}parseNamedType(){return this.node(this._lexer.token,{kind:w.Kind.NAMED_TYPE,name:this.parseName()})}peekDescription(){return this.peek(E.TokenKind.STRING)||this.peek(E.TokenKind.BLOCK_STRING)}parseDescription(){if(this.peekDescription())return this.parseStringLiteral()}parseSchemaDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("schema");const n=this.parseConstDirectives(),i=this.many(E.TokenKind.BRACE_L,this.parseOperationTypeDefinition,E.TokenKind.BRACE_R);return this.node(t,{kind:w.Kind.SCHEMA_DEFINITION,description:e,directives:n,operationTypes:i})}parseOperationTypeDefinition(){const t=this._lexer.token,e=this.parseOperationType();this.expectToken(E.TokenKind.COLON);const n=this.parseNamedType();return this.node(t,{kind:w.Kind.OPERATION_TYPE_DEFINITION,operation:e,type:n})}parseScalarTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("scalar");const n=this.parseName(),i=this.parseConstDirectives();return this.node(t,{kind:w.Kind.SCALAR_TYPE_DEFINITION,description:e,name:n,directives:i})}parseObjectTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("type");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(t,{kind:w.Kind.OBJECT_TYPE_DEFINITION,description:e,name:n,interfaces:i,directives:r,fields:s})}parseImplementsInterfaces(){return this.expectOptionalKeyword("implements")?this.delimitedMany(E.TokenKind.AMP,this.parseNamedType):[]}parseFieldsDefinition(){return this.optionalMany(E.TokenKind.BRACE_L,this.parseFieldDefinition,E.TokenKind.BRACE_R)}parseFieldDefinition(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseName(),i=this.parseArgumentDefs();this.expectToken(E.TokenKind.COLON);const r=this.parseTypeReference(),s=this.parseConstDirectives();return this.node(t,{kind:w.Kind.FIELD_DEFINITION,description:e,name:n,arguments:i,type:r,directives:s})}parseArgumentDefs(){return this.optionalMany(E.TokenKind.PAREN_L,this.parseInputValueDef,E.TokenKind.PAREN_R)}parseInputValueDef(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseName();this.expectToken(E.TokenKind.COLON);const i=this.parseTypeReference();let r;this.expectOptionalToken(E.TokenKind.EQUALS)&&(r=this.parseConstValueLiteral());const s=this.parseConstDirectives();return this.node(t,{kind:w.Kind.INPUT_VALUE_DEFINITION,description:e,name:n,type:i,defaultValue:r,directives:s})}parseInterfaceTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("interface");const n=this.parseName(),i=this.parseImplementsInterfaces(),r=this.parseConstDirectives(),s=this.parseFieldsDefinition();return this.node(t,{kind:w.Kind.INTERFACE_TYPE_DEFINITION,description:e,name:n,interfaces:i,directives:r,fields:s})}parseUnionTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("union");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseUnionMemberTypes();return this.node(t,{kind:w.Kind.UNION_TYPE_DEFINITION,description:e,name:n,directives:i,types:r})}parseUnionMemberTypes(){return this.expectOptionalToken(E.TokenKind.EQUALS)?this.delimitedMany(E.TokenKind.PIPE,this.parseNamedType):[]}parseEnumTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("enum");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseEnumValuesDefinition();return this.node(t,{kind:w.Kind.ENUM_TYPE_DEFINITION,description:e,name:n,directives:i,values:r})}parseEnumValuesDefinition(){return this.optionalMany(E.TokenKind.BRACE_L,this.parseEnumValueDefinition,E.TokenKind.BRACE_R)}parseEnumValueDefinition(){const t=this._lexer.token,e=this.parseDescription(),n=this.parseEnumValueName(),i=this.parseConstDirectives();return this.node(t,{kind:w.Kind.ENUM_VALUE_DEFINITION,description:e,name:n,directives:i})}parseEnumValueName(){if("true"===this._lexer.token.value||"false"===this._lexer.token.value||"null"===this._lexer.token.value)throw(0,m.syntaxError)(this._lexer.source,this._lexer.token.start,`${i(this._lexer.token)} is reserved and cannot be used for an enum value.`);return this.parseName()}parseInputObjectTypeDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("input");const n=this.parseName(),i=this.parseConstDirectives(),r=this.parseInputFieldsDefinition();return this.node(t,{kind:w.Kind.INPUT_OBJECT_TYPE_DEFINITION,description:e,name:n,directives:i,fields:r})}parseInputFieldsDefinition(){return this.optionalMany(E.TokenKind.BRACE_L,this.parseInputValueDef,E.TokenKind.BRACE_R)}parseTypeSystemExtension(){const t=this._lexer.lookahead();if(t.kind===E.TokenKind.NAME)switch(t.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(t)}parseSchemaExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");const e=this.parseConstDirectives(),n=this.optionalMany(E.TokenKind.BRACE_L,this.parseOperationTypeDefinition,E.TokenKind.BRACE_R);if(0===e.length&&0===n.length)throw this.unexpected();return this.node(t,{kind:w.Kind.SCHEMA_EXTENSION,directives:e,operationTypes:n})}parseScalarTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");const e=this.parseName(),n=this.parseConstDirectives();if(0===n.length)throw this.unexpected();return this.node(t,{kind:w.Kind.SCALAR_TYPE_EXTENSION,name:e,directives:n})}parseObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");const e=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(t,{kind:w.Kind.OBJECT_TYPE_EXTENSION,name:e,interfaces:n,directives:i,fields:r})}parseInterfaceTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");const e=this.parseName(),n=this.parseImplementsInterfaces(),i=this.parseConstDirectives(),r=this.parseFieldsDefinition();if(0===n.length&&0===i.length&&0===r.length)throw this.unexpected();return this.node(t,{kind:w.Kind.INTERFACE_TYPE_EXTENSION,name:e,interfaces:n,directives:i,fields:r})}parseUnionTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseUnionMemberTypes();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:w.Kind.UNION_TYPE_EXTENSION,name:e,directives:n,types:i})}parseEnumTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseEnumValuesDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:w.Kind.ENUM_TYPE_EXTENSION,name:e,directives:n,values:i})}parseInputObjectTypeExtension(){const t=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");const e=this.parseName(),n=this.parseConstDirectives(),i=this.parseInputFieldsDefinition();if(0===n.length&&0===i.length)throw this.unexpected();return this.node(t,{kind:w.Kind.INPUT_OBJECT_TYPE_EXTENSION,name:e,directives:n,fields:i})}parseDirectiveDefinition(){const t=this._lexer.token,e=this.parseDescription();this.expectKeyword("directive"),this.expectToken(E.TokenKind.AT);const n=this.parseName(),i=this.parseArgumentDefs(),r=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");const s=this.parseDirectiveLocations();return this.node(t,{kind:w.Kind.DIRECTIVE_DEFINITION,description:e,name:n,arguments:i,repeatable:r,locations:s})}parseDirectiveLocations(){return this.delimitedMany(E.TokenKind.PIPE,this.parseDirectiveLocation)}parseDirectiveLocation(){const t=this._lexer.token,e=this.parseName();if(Object.prototype.hasOwnProperty.call(b.DirectiveLocation,e.value))return e;throw this.unexpected(t)}node(t,e){return!0!==this._options.noLocation&&(e.loc=new y.Location(t,this._lexer.lastToken,this._lexer.source)),e}peek(t){return this._lexer.token.kind===t}expectToken(t){const e=this._lexer.token;if(e.kind===t)return this.advanceLexer(),e;throw(0,m.syntaxError)(this._lexer.source,e.start,`Expected ${r(t)}, found ${i(e)}.`)}expectOptionalToken(t){return this._lexer.token.kind===t&&(this.advanceLexer(),!0)}expectKeyword(t){const e=this._lexer.token;if(e.kind!==E.TokenKind.NAME||e.value!==t)throw(0,m.syntaxError)(this._lexer.source,e.start,`Expected "${t}", found ${i(e)}.`);this.advanceLexer()}expectOptionalKeyword(t){const e=this._lexer.token;return e.kind===E.TokenKind.NAME&&e.value===t&&(this.advanceLexer(),!0)}unexpected(t){const e=null!=t?t:this._lexer.token;return(0,m.syntaxError)(this._lexer.source,e.start,`Unexpected ${i(e)}.`)}any(t,e,n){this.expectToken(t);const i=[];for(;!this.expectOptionalToken(n);)i.push(e.call(this));return i}optionalMany(t,e,n){if(this.expectOptionalToken(t)){const t=[];do{t.push(e.call(this))}while(!this.expectOptionalToken(n));return t}return[]}many(t,e,n){this.expectToken(t);const i=[];do{i.push(e.call(this))}while(!this.expectOptionalToken(n));return i}delimitedMany(t,e){this.expectOptionalToken(t);const n=[];do{n.push(e.call(this))}while(this.expectOptionalToken(t));return n}advanceLexer(){const{maxTokens:t}=this._options,e=this._lexer.advance();if(void 0!==t&&e.kind!==E.TokenKind.EOF&&(++this._tokenCounter,this._tokenCounter>t))throw(0,m.syntaxError)(this._lexer.source,e.start,`Document contains more that ${t} tokens. Parsing aborted.`)}}function i(t){const e=t.value;return r(t.kind)+(null!=e?` "${e}"`:"")}function r(t){return(0,T.isPunctuatorTokenKind)(t)?`"${t}"`:t}e.Parser=n})),k=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.printString=function(t){return`"${t.replace(n,i)}"`};const n=/[\x00-\x1f\x22\x5c\x7f-\x9f]/g;function i(t){return r[t.charCodeAt(0)]}const r=["\\u0000","\\u0001","\\u0002","\\u0003","\\u0004","\\u0005","\\u0006","\\u0007","\\b","\\t","\\n","\\u000B","\\f","\\r","\\u000E","\\u000F","\\u0010","\\u0011","\\u0012","\\u0013","\\u0014","\\u0015","\\u0016","\\u0017","\\u0018","\\u0019","\\u001A","\\u001B","\\u001C","\\u001D","\\u001E","\\u001F","","",'\\"',"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\\\","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","\\u007F","\\u0080","\\u0081","\\u0082","\\u0083","\\u0084","\\u0085","\\u0086","\\u0087","\\u0088","\\u0089","\\u008A","\\u008B","\\u008C","\\u008D","\\u008E","\\u008F","\\u0090","\\u0091","\\u0092","\\u0093","\\u0094","\\u0095","\\u0096","\\u0097","\\u0098","\\u0099","\\u009A","\\u009B","\\u009C","\\u009D","\\u009E","\\u009F"]})),N=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.BREAK=void 0,e.getEnterLeaveForKind=i,e.getVisitFn=function(t,e,n){const{enter:r,leave:s}=i(t,e);return n?s:r},e.visit=function(t,e,r=y.QueryDocumentKeys){const s=new Map;for(const t of Object.values(w.Kind))s.set(t,i(e,t));let o,u,a,c=Array.isArray(t),l=[t],h=-1,f=[],d=t;const v=[],p=[];do{h++;const t=h===l.length,i=t&&0!==f.length;if(t){if(u=0===p.length?void 0:v[v.length-1],d=a,a=p.pop(),i)if(c){d=d.slice();let t=0;for(const[e,n]of f){const i=e-t;null===n?(d.splice(i,1),t++):d[i]=n}}else{d=Object.defineProperties({},Object.getOwnPropertyDescriptors(d));for(const[t,e]of f)d[t]=e}h=o.index,l=o.keys,f=o.edits,c=o.inArray,o=o.prev}else if(a){if(u=c?h:l[h],d=a[u],null==d)continue;v.push(u)}let w;if(!Array.isArray(d)){var m,b;(0,y.isNode)(d)||(0,S.devAssert)(!1,`Invalid AST Node: ${(0,j.inspect)(d)}.`);const i=t?null===(m=s.get(d.kind))||void 0===m?void 0:m.leave:null===(b=s.get(d.kind))||void 0===b?void 0:b.enter;if(w=null==i?void 0:i.call(e,d,u,a,v,p),w===n)break;if(!1===w){if(!t){v.pop();continue}}else if(void 0!==w&&(f.push([u,w]),!t)){if(!(0,y.isNode)(w)){v.pop();continue}d=w}}var g;void 0===w&&i&&f.push([u,d]),t?v.pop():(o={inArray:c,index:h,keys:l,edits:f,prev:o},c=Array.isArray(d),l=c?d:null!==(g=r[d.kind])&&void 0!==g?g:[],h=-1,f=[],a&&p.push(a),a=d)}while(void 0!==o);return 0!==f.length?f[f.length-1][1]:t},e.visitInParallel=function(t){const e=new Array(t.length).fill(null),r=Object.create(null);for(const s of Object.values(w.Kind)){let o=!1;const u=new Array(t.length).fill(void 0),a=new Array(t.length).fill(void 0);for(let e=0;e<t.length;++e){const{enter:n,leave:r}=i(t[e],s);o||(o=null!=n||null!=r),u[e]=n,a[e]=r}o&&(r[s]={enter(...i){const r=i[0];for(let o=0;o<t.length;o++)if(null===e[o]){var s;const a=null===(s=u[o])||void 0===s?void 0:s.apply(t[o],i);if(!1===a)e[o]=r;else if(a===n)e[o]=n;else if(void 0!==a)return a}},leave(...i){const r=i[0];for(let o=0;o<t.length;o++)if(null===e[o]){var s;const r=null===(s=a[o])||void 0===s?void 0:s.apply(t[o],i);if(r===n)e[o]=n;else if(void 0!==r&&!1!==r)return r}else e[o]===r&&(e[o]=null)}})}return r};const n=Object.freeze({});function i(t,e){const n=t[e];return"object"==typeof n?n:"function"==typeof n?{enter:n,leave:void 0}:{enter:t.enter,leave:t.leave}}e.BREAK=n})),_=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.print=function(t){return(0,N.visit)(t,n)};const n={Name:{leave:t=>t.value},Variable:{leave:t=>"$"+t.name},Document:{leave:t=>i(t.definitions,"\n\n")},OperationDefinition:{leave(t){const e=s("(",i(t.variableDefinitions,", "),")"),n=i([t.operation,i([t.name,e]),i(t.directives," ")]," ");return("query"===n?"":n+" ")+t.selectionSet}},VariableDefinition:{leave:({variable:t,type:e,defaultValue:n,directives:r})=>t+": "+e+s(" = ",n)+s(" ",i(r," "))},SelectionSet:{leave:({selections:t})=>r(t)},Field:{leave({alias:t,name:e,arguments:n,directives:r,selectionSet:u}){const a=s("",t,": ")+e;let c=a+s("(",i(n,", "),")");return c.length>80&&(c=a+s("(\n",o(i(n,"\n")),"\n)")),i([c,i(r," "),u]," ")}},Argument:{leave:({name:t,value:e})=>t+": "+e},FragmentSpread:{leave:({name:t,directives:e})=>"..."+t+s(" ",i(e," "))},InlineFragment:{leave:({typeCondition:t,directives:e,selectionSet:n})=>i(["...",s("on ",t),i(e," "),n]," ")},FragmentDefinition:{leave:({name:t,typeCondition:e,variableDefinitions:n,directives:r,selectionSet:o})=>`fragment ${t}${s("(",i(n,", "),")")} on ${e} ${s("",i(r," ")," ")}`+o},IntValue:{leave:({value:t})=>t},FloatValue:{leave:({value:t})=>t},StringValue:{leave:({value:t,block:e})=>e?(0,O.printBlockString)(t):(0,k.printString)(t)},BooleanValue:{leave:({value:t})=>t?"true":"false"},NullValue:{leave:()=>"null"},EnumValue:{leave:({value:t})=>t},ListValue:{leave:({values:t})=>"["+i(t,", ")+"]"},ObjectValue:{leave:({fields:t})=>"{"+i(t,", ")+"}"},ObjectField:{leave:({name:t,value:e})=>t+": "+e},Directive:{leave:({name:t,arguments:e})=>"@"+t+s("(",i(e,", "),")")},NamedType:{leave:({name:t})=>t},ListType:{leave:({type:t})=>"["+t+"]"},NonNullType:{leave:({type:t})=>t+"!"},SchemaDefinition:{leave:({description:t,directives:e,operationTypes:n})=>s("",t,"\n")+i(["schema",i(e," "),r(n)]," ")},OperationTypeDefinition:{leave:({operation:t,type:e})=>t+": "+e},ScalarTypeDefinition:{leave:({description:t,name:e,directives:n})=>s("",t,"\n")+i(["scalar",e,i(n," ")]," ")},ObjectTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:o,fields:u})=>s("",t,"\n")+i(["type",e,s("implements ",i(n," & ")),i(o," "),r(u)]," ")},FieldDefinition:{leave:({description:t,name:e,arguments:n,type:r,directives:a})=>s("",t,"\n")+e+(u(n)?s("(\n",o(i(n,"\n")),"\n)"):s("(",i(n,", "),")"))+": "+r+s(" ",i(a," "))},InputValueDefinition:{leave:({description:t,name:e,type:n,defaultValue:r,directives:o})=>s("",t,"\n")+i([e+": "+n,s("= ",r),i(o," ")]," ")},InterfaceTypeDefinition:{leave:({description:t,name:e,interfaces:n,directives:o,fields:u})=>s("",t,"\n")+i(["interface",e,s("implements ",i(n," & ")),i(o," "),r(u)]," ")},UnionTypeDefinition:{leave:({description:t,name:e,directives:n,types:r})=>s("",t,"\n")+i(["union",e,i(n," "),s("= ",i(r," | "))]," ")},EnumTypeDefinition:{leave:({description:t,name:e,directives:n,values:o})=>s("",t,"\n")+i(["enum",e,i(n," "),r(o)]," ")},EnumValueDefinition:{leave:({description:t,name:e,directives:n})=>s("",t,"\n")+i([e,i(n," ")]," ")},InputObjectTypeDefinition:{leave:({description:t,name:e,directives:n,fields:o})=>s("",t,"\n")+i(["input",e,i(n," "),r(o)]," ")},DirectiveDefinition:{leave:({description:t,name:e,arguments:n,repeatable:r,locations:a})=>s("",t,"\n")+"directive @"+e+(u(n)?s("(\n",o(i(n,"\n")),"\n)"):s("(",i(n,", "),")"))+(r?" repeatable":"")+" on "+i(a," | ")},SchemaExtension:{leave:({directives:t,operationTypes:e})=>i(["extend schema",i(t," "),r(e)]," ")},ScalarTypeExtension:{leave:({name:t,directives:e})=>i(["extend scalar",t,i(e," ")]," ")},ObjectTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:o})=>i(["extend type",t,s("implements ",i(e," & ")),i(n," "),r(o)]," ")},InterfaceTypeExtension:{leave:({name:t,interfaces:e,directives:n,fields:o})=>i(["extend interface",t,s("implements ",i(e," & ")),i(n," "),r(o)]," ")},UnionTypeExtension:{leave:({name:t,directives:e,types:n})=>i(["extend union",t,i(e," "),s("= ",i(n," | "))]," ")},EnumTypeExtension:{leave:({name:t,directives:e,values:n})=>i(["extend enum",t,i(e," "),r(n)]," ")},InputObjectTypeExtension:{leave:({name:t,directives:e,fields:n})=>i(["extend input",t,i(e," "),r(n)]," ")}};function i(t,e=""){var n;return null!==(n=null==t?void 0:t.filter((t=>t)).join(e))&&void 0!==n?n:""}function r(t){return s("{\n",o(i(t,"\n")),"\n}")}function s(t,e,n=""){return null!=e&&""!==e?t+e+n:""}function o(t){return s(" ",t.replace(/\n/g,"\n "))}function u(t){var e;return null!==(e=null==t?void 0:t.some((t=>t.includes("\n"))))&&void 0!==e&&e}})),A=function(t){var e=t.name,n=t.type;this.uri=t.uri,this.name=e,this.type=n},F=function(t){return"undefined"!=typeof File&&t instanceof File||"undefined"!=typeof Blob&&t instanceof Blob||t instanceof A},$=function t(e,n,i){var r;void 0===n&&(n=""),void 0===i&&(i=F);var s=new Map;function o(t,e){var n=s.get(e);n?n.push.apply(n,t):s.set(e,t)}if(i(e))r=null,o([n],e);else{var u=n?n+".":"";if("undefined"!=typeof FileList&&e instanceof FileList)r=Array.prototype.map.call(e,(function(t,e){return o([""+u+e],t),null}));else if(Array.isArray(e))r=e.map((function(e,n){var r=t(e,""+u+n,i);return r.files.forEach(o),r.clone}));else if(e&&e.constructor===Object)for(var a in r={},e){var c=t(e[a],""+u+a,i);c.files.forEach(o),r[a]=c.clone}else r=e}return{clone:r,files:s}},q=F,U="object"==typeof self?self.FormData:window.FormData,V=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.defaultJsonSerializer=void 0,e.defaultJsonSerializer={parse:JSON.parse,stringify:JSON.stringify}})),C=c((function(t,e){var n=a&&a.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var i=n(U),r=function(t){return q(t)||null!==t&&"object"==typeof t&&"function"==typeof t.pipe};e.default=function(t,e,n,s){void 0===s&&(s=V.defaultJsonSerializer);var o=$({query:t,variables:e,operationName:n},"",r),u=o.clone,a=o.files;if(0===a.size){if(!Array.isArray(t))return s.stringify(u);if(void 0!==e&&!Array.isArray(e))throw new Error("Cannot create request body with given variable type, array expected");var c=t.reduce((function(t,n,i){return t.push({query:n,variables:e?e[i]:void 0}),t}),[]);return s.stringify(c)}var l=new("undefined"==typeof FormData?i.default:FormData);l.append("operations",s.stringify(u));var h={},f=0;return a.forEach((function(t){h[++f]=t})),l.append("map",s.stringify(h)),f=0,a.forEach((function(t,e){l.append(""+ ++f,e)})),l}})),M=c((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.parseBatchRequestsExtendedArgs=e.parseRawRequestExtendedArgs=e.parseRequestExtendedArgs=e.parseBatchRequestArgs=e.parseRawRequestArgs=e.parseRequestArgs=void 0,e.parseRequestArgs=function(t,e,n){return t.document?t:{document:t,variables:e,requestHeaders:n,signal:void 0}},e.parseRawRequestArgs=function(t,e,n){return t.query?t:{query:t,variables:e,requestHeaders:n,signal:void 0}},e.parseBatchRequestArgs=function(t,e){return t.documents?t:{documents:t,requestHeaders:e,signal:void 0}},e.parseRequestExtendedArgs=function(t,e,n,i){return t.document?t:{url:t,document:e,variables:n,requestHeaders:i,signal:void 0}},e.parseRawRequestExtendedArgs=function(t,e,n,i){return t.query?t:{url:t,query:e,variables:n,requestHeaders:i,signal:void 0}},e.parseBatchRequestsExtendedArgs=function(t,e,n){return t.documents?t:{url:t,documents:e,requestHeaders:n,signal:void 0}}})),P=c((function(t,e){var n,i=a&&a.__extends||(n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},n(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)});Object.defineProperty(e,"__esModule",{value:!0}),e.ClientError=void 0;var r=function(t){function e(n,i){var r=this,s=e.extractMessage(n)+": "+JSON.stringify({response:n,request:i});return r=t.call(this,s)||this,Object.setPrototypeOf(r,e.prototype),r.response=n,r.request=i,"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(r,e),r}return i(e,t),e.extractMessage=function(t){try{return t.errors[0].message}catch(e){return"GraphQL Error (Code: "+t.status+")"}},e}(Error);e.ClientError=r})),L=c((function(t,e){var n=a&&a.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)},i=a&&a.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{a(i.next(t))}catch(t){s(t)}}function u(t){try{a(i.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}a((i=i.apply(t,e||[])).next())}))},r=a&&a.__generator||function(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLWebSocketClient=void 0;var s="ping",o="pong",u="complete",c=function(){function t(t,e,n){this._type=t,this._payload=e,this._id=n}return Object.defineProperty(t.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"payload",{get:function(){return this._payload},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){var t={type:this.type};return null!=this.id&&null!=this.id&&(t.id=this.id),null!=this.payload&&null!=this.payload&&(t.payload=this.payload),JSON.stringify(t)},enumerable:!1,configurable:!0}),t.parse=function(e,n){var i=JSON.parse(e),r=i.id;return new t(i.type,n(i.payload),r)},t}(),l=function(){function t(t,e){var a=this,l=e.onInit,d=e.onAcknowledged,v=e.onPing,p=e.onPong;this.socketState={acknowledged:!1,lastRequestId:0,subscriptions:{}},this.socket=t,t.onopen=function(){return i(a,void 0,void 0,(function(){var e,n,i,s;return r(this,(function(r){switch(r.label){case 0:return this.socketState.acknowledged=!1,this.socketState.subscriptions={},n=(e=t).send,i=h,l?[4,l()]:[3,2];case 1:return s=r.sent(),[3,3];case 2:s=null,r.label=3;case 3:return n.apply(e,[i.apply(void 0,[s]).text]),[2]}}))}))},t.onclose=function(){a.socketState.acknowledged=!1,a.socketState.subscriptions={}},t.onerror=function(t){console.error(t)},t.onmessage=function(e){try{var i=(void 0===y&&(y=function(t){return t}),c.parse(e.data,y));switch(i.type){case"connection_ack":return void(a.socketState.acknowledged?console.warn("Duplicate CONNECTION_ACK message ignored"):(a.socketState.acknowledged=!0,d&&d(i.payload)));case s:return void(v?v(i.payload).then((function(e){return t.send(f(e).text)})):t.send(f(null).text));case o:return void(p&&p(i.payload))}if(!a.socketState.acknowledged)return;if(null==i.id||!a.socketState.subscriptions[i.id])return;var r=a.socketState.subscriptions[i.id],l=r.query,h=r.variables,m=r.subscriber;switch(i.type){case"next":return!i.payload.errors&&i.payload.data&&m.next&&m.next(i.payload.data),void(i.payload.errors&&m.error&&m.error(new P.ClientError(n(n({},i.payload),{status:200}),{query:l,variables:h})));case"error":return void(m.error&&m.error(new P.ClientError({errors:i.payload,status:200},{query:l,variables:h})));case u:return m.complete&&m.complete(),void delete a.socketState.subscriptions[i.id]}}catch(e){console.error(e),t.close(1006)}var y;t.close(4400,"Unknown graphql-ws message.")}}return t.prototype.makeSubscribe=function(t,e,n,i){var r,s,o=this,a=(this.socketState.lastRequestId++).toString();return this.socketState.subscriptions[a]={query:t,variables:n,subscriber:i},this.socket.send((r=a,s={query:t,operationName:e,variables:n},new c("subscribe",s,r)).text),function(){o.socket.send(function(t){return new c(u,void 0,t)}(a).text),delete o.socketState.subscriptions[a]}},t.prototype.rawRequest=function(t,e){var n=this;return new Promise((function(i,r){var s;n.rawSubscribe(t,{next:function(t,e){return s={data:t,extensions:e}},error:r,complete:function(){return i(s)}},e)}))},t.prototype.request=function(t,e){var n=this;return new Promise((function(i,r){var s;n.subscribe(t,{next:function(t){return s=t},error:r,complete:function(){return i(s)}},e)}))},t.prototype.subscribe=function(t,e,n){var i=R.resolveRequestDocument(t);return this.makeSubscribe(i.query,i.operationName,n,e)},t.prototype.rawSubscribe=function(t,e,n){return this.makeSubscribe(t,void 0,n,e)},t.prototype.ping=function(t){this.socket.send(function(t){return new c(s,t,void 0)}(t).text)},t.prototype.close=function(){this.socket.close(1e3)},t.PROTOCOL="graphql-transport-ws",t}();function h(t){return new c("connection_init",t)}function f(t){return new c(o,t,void 0)}e.GraphQLWebSocketClient=l})),R=c((function(t,e){var n=a&&a.__assign||function(){return n=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},n.apply(this,arguments)},i=a&&a.__createBinding||(Object.create?function(t,e,n,i){void 0===i&&(i=n),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[n]}})}:function(t,e,n,i){void 0===i&&(i=n),t[i]=e[n]}),r=a&&a.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=a&&a.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)"default"!==n&&Object.prototype.hasOwnProperty.call(t,n)&&i(e,t,n);return r(e,t),e},o=a&&a.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,s){function o(t){try{a(i.next(t))}catch(t){s(t)}}function u(t){try{a(i.throw(t))}catch(t){s(t)}}function a(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,u)}a((i=i.apply(t,e||[])).next())}))},u=a&&a.__generator||function(t,e){var n,i,r,s,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return s={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],i=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}},c=a&&a.__rest||function(t,e){var n={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(n[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(t);r<i.length;r++)e.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(t,i[r])&&(n[i[r]]=t[i[r]])}return n},h=a&&a.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.GraphQLWebSocketClient=e.gql=e.resolveRequestDocument=e.batchRequests=e.request=e.rawRequest=e.GraphQLClient=e.ClientError=void 0;var f=s(l),d=f,v=h(C);Object.defineProperty(e,"ClientError",{enumerable:!0,get:function(){return P.ClientError}});var p=function(t){var e={};return t&&("undefined"!=typeof Headers&&t instanceof Headers||t instanceof d.Headers?e=function(t){var e={};return t.forEach((function(t,n){e[n]=t})),e}(t):Array.isArray(t)?t.forEach((function(t){e[t[0]]=t[1]})):e=t),e},m=function(t){return t.replace(/([\s,]|#[^\n\r]+)+/g," ").trim()},y=function(t){var e=t.url,i=t.query,r=t.variables,s=t.operationName,a=t.headers,c=t.fetch,l=t.fetchOptions;return o(void 0,void 0,void 0,(function(){var t;return u(this,(function(o){switch(o.label){case 0:return t=v.default(i,r,s,l.jsonSerializer),[4,c(e,n({method:"POST",headers:n(n({},"string"==typeof t?{"Content-Type":"application/json"}:{}),a),body:t},l))];case 1:return[2,o.sent()]}}))}))},b=function(t){var e=t.url,i=t.query,r=t.variables,s=t.operationName,a=t.headers,c=t.fetch,l=t.fetchOptions;return o(void 0,void 0,void 0,(function(){var t;return u(this,(function(o){switch(o.label){case 0:return t=function(t){var e=t.query,n=t.variables,i=t.operationName,r=t.jsonSerializer;if(!Array.isArray(e)){var s=["query="+encodeURIComponent(m(e))];return n&&s.push("variables="+encodeURIComponent(r.stringify(n))),i&&s.push("operationName="+encodeURIComponent(i)),s.join("&")}if(void 0!==n&&!Array.isArray(n))throw new Error("Cannot create query with given variable type, array expected");var o=e.reduce((function(t,e,i){return t.push({query:m(e),variables:n?r.stringify(n[i]):void 0}),t}),[]);return"query="+encodeURIComponent(r.stringify(o))}({query:i,variables:r,operationName:s,jsonSerializer:l.jsonSerializer}),[4,c(e+"?"+t,n({method:"GET",headers:a},l))];case 1:return[2,o.sent()]}}))}))},w=function(){function t(t,e){this.url=t,this.options=e||{}}return t.prototype.rawRequest=function(t,e,i){return o(this,void 0,void 0,(function(){var r,s,o,a,l,h,d,v,m,y;return u(this,(function(){return r=M.parseRawRequestArgs(t,e,i),o=(s=this.options).headers,l=void 0===(a=s.fetch)?f.default:a,d=void 0===(h=s.method)?"POST":h,v=c(s,["headers","fetch","method"]),m=this.url,void 0!==r.signal&&(v.signal=r.signal),y=S(r.query).operationName,[2,g({url:m,query:r.query,variables:r.variables,headers:n(n({},p(j(o))),p(r.requestHeaders)),operationName:y,fetch:l,method:d,fetchOptions:v})]}))}))},t.prototype.request=function(t,e,i){return o(this,void 0,void 0,(function(){var r,s,o,a,l,h,d,v,m,y,b;return u(this,(function(u){switch(u.label){case 0:return r=M.parseRequestArgs(t,e,i),o=(s=this.options).headers,l=void 0===(a=s.fetch)?f.default:a,d=void 0===(h=s.method)?"POST":h,v=c(s,["headers","fetch","method"]),m=this.url,void 0!==r.signal&&(v.signal=r.signal),y=S(r.document),b=y.operationName,[4,g({url:m,query:y.query,variables:r.variables,headers:n(n({},p(j(o))),p(r.requestHeaders)),operationName:b,fetch:l,method:d,fetchOptions:v})];case 1:return[2,u.sent().data]}}))}))},t.prototype.batchRequests=function(t,e){return o(this,void 0,void 0,(function(){var i,r,s,o,a,l,h,d,v,m,y;return u(this,(function(u){switch(u.label){case 0:return i=M.parseBatchRequestArgs(t,e),s=(r=this.options).headers,a=void 0===(o=r.fetch)?f.default:o,h=void 0===(l=r.method)?"POST":l,d=c(r,["headers","fetch","method"]),v=this.url,void 0!==i.signal&&(d.signal=i.signal),m=i.documents.map((function(t){return S(t.document).query})),y=i.documents.map((function(t){return t.variables})),[4,g({url:v,query:m,variables:y,headers:n(n({},p(j(s))),p(i.requestHeaders)),operationName:void 0,fetch:a,method:h,fetchOptions:d})];case 1:return[2,u.sent().data]}}))}))},t.prototype.setHeaders=function(t){return this.options.headers=t,this},t.prototype.setHeader=function(t,e){var n,i=this.options.headers;return i?i[t]=e:this.options.headers=((n={})[t]=e,n),this},t.prototype.setEndpoint=function(t){return this.url=t,this},t}();function g(t){var e=t.url,i=t.query,r=t.variables,s=t.headers,a=t.operationName,l=t.fetch,h=t.method,f=void 0===h?"POST":h,d=t.fetchOptions;return o(this,void 0,void 0,(function(){var t,o,h,v,p,m,w,g,O,T;return u(this,(function(u){switch(u.label){case 0:return t="POST"===f.toUpperCase()?y:b,o=Array.isArray(i),[4,t({url:e,query:i,variables:r,operationName:a,headers:s,fetch:l,fetchOptions:d})];case 1:return[4,E(h=u.sent(),d.jsonSerializer)];case 2:if(v=u.sent(),p=o&&Array.isArray(v)?!v.some((function(t){return!t.data})):!!v.data,m=!v.errors||"all"===d.errorPolicy||"ignore"===d.errorPolicy,h.ok&&m&&p)return w=h.headers,g=h.status,O=c(v,["errors"]),T="ignore"===d.errorPolicy?O:v,[2,n(n({},o?{data:T}:T),{headers:w,status:g})];throw new P.ClientError(n(n({},"string"==typeof v?{error:v}:v),{status:h.status,headers:h.headers}),{query:i,variables:r})}}))}))}function O(t,e,i,r){return o(this,void 0,void 0,(function(){var s;return u(this,(function(){return s=M.parseRequestExtendedArgs(t,e,i,r),[2,new w(s.url).request(n({},s))]}))}))}function E(t,e){return void 0===e&&(e=V.defaultJsonSerializer),o(this,void 0,void 0,(function(){var n,i,r;return u(this,(function(s){switch(s.label){case 0:return t.headers.forEach((function(t,e){"content-type"===e.toLowerCase()&&(n=t)})),n&&n.toLowerCase().startsWith("application/json")?(r=(i=e).parse,[4,t.text()]):[3,2];case 1:return[2,r.apply(i,[s.sent()])];case 2:return[2,t.text()]}}))}))}function T(t){var e,n=void 0,i=t.definitions.filter((function(t){return"OperationDefinition"===t.kind}));return 1===i.length&&(n=null===(e=i[0].name)||void 0===e?void 0:e.value),n}function S(t){if("string"==typeof t){var e=void 0;try{e=T(I.parse(t))}catch(t){}return{query:t,operationName:e}}var n=T(t);return{query:_.print(t),operationName:n}}function j(t){return"function"==typeof t?t():t}e.GraphQLClient=w,e.rawRequest=function(t,e,i,r){return o(this,void 0,void 0,(function(){var s;return u(this,(function(){return s=M.parseRawRequestExtendedArgs(t,e,i,r),[2,new w(s.url).rawRequest(n({},s))]}))}))},e.request=O,e.batchRequests=function(t,e,i){return o(this,void 0,void 0,(function(){var r;return u(this,(function(){return r=M.parseBatchRequestsExtendedArgs(t,e,i),[2,new w(r.url).batchRequests(n({},r))]}))}))},e.default=O,e.resolveRequestDocument=S,e.gql=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return t.reduce((function(t,n,i){return""+t+n+(i in e?e[i]:"")}),"")},Object.defineProperty(e,"GraphQLWebSocketClient",{enumerable:!0,get:function(){return L.GraphQLWebSocketClient}})}));class B{static getQueryParams(t){const e=new Map,n=/[?&]?([^=]+)=([^&]*)/g;let i;for(t=(t=window.unescape(t)).split("+").join(" ");i=n.exec(t);)e.set(window.decodeURIComponent(i[1]),i[2]);return e.set("urlBase",this.getUrlBase()),window.moduleID&&window.URIServiceBroker&&(e.set("moduleID",window.moduleID),e.set("URIServiceBroker",window.URIServiceBroker)),e}static getUrlBase(){return window.mock_url?window.mock_url:`${location.protocol}//${location.hostname}${location.port?":"+location.port:""}`}static getResourceIdFromUrlToken(t){try{const e=t.split("/");return e[1]?atob(e[1]):null}catch(t){throw new Error("Erro ao obter resourceId:"+t)}}static getPkObjectFromUrlToken(t){try{let e=t.split("/")[2];return e?e.indexOf("&")>-1?JSON.parse(atob(e.split("&")[0])):JSON.parse(atob(e)):null}catch(t){throw new Error("Erro ao obter a PK do objeto:"+t)}}}class G{constructor(t,e,n){this.req=t,this.resolve=e,this.reject=n}putVariable(t,e){this.req.values[t]=e}reCall(){return z.get().callGraphQL(this.req).then(this.resolve,this.reject)}putTXPro(e,n){this.req&&this.req.values&&(this.req.values.changes||[]).length&&this.req.values.changes[0].fields.push({dataType:t.TEXT,fieldName:`${u.DATA_UNIT_TRANSIENT_PREFIX_NAME}${e}`,value:n})}}class J{constructor(t,e,n,i){this.serviceName=t,this.requestBody=e,this.successCallback=n,this.errorCallback=i}reCall(t){return t&&(this.requestBody=t),z.get().callServiceBroker(this.serviceName,this.requestBody).then(this.successCallback,this.errorCallback)}}var H=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t="function"==typeof __values?__values(t):t[Symbol.iterator](),e={},i("next"),i("throw"),i("return"),e[Symbol.asyncIterator]=function(){return this},e);function i(n){e[n]=t[n]&&function(e){return new Promise((function(i,r){!function(t,e,n,i){Promise.resolve(i).then((function(e){t({value:e,done:n})}),e)}(i,r,(e=t[n](e)).done,e.value)}))}}};class z{constructor(){this.ready=!0,this.watingRequestsById=new Map}static get(){if(!z.instance){z.instance=new z;const t=document.querySelector(this.appTagName);null===t?z.instance.resume():(!0===e.getContextValue("__SNK__APPLICATION__LOADING__")&&z.instance.pause(),t.addEventListener("applicationLoading",(()=>z.instance.pause())),t.addEventListener("applicationLoaded",(()=>z.instance.resume())))}return this.instance.application=e.getContextValue("__SNK__APPLICATION__"),this.instance}static getGraphQLPath(){return n.isEmpty(this.instance.graphqlPath)&&null!=this.instance.application&&(this.instance.graphqlPath=`/${this.instance.application.getModuleName()}/graphql`),this.instance.graphqlPath}static addRequestListener(t){z.requestListener.indexOf(t)<0&&z.requestListener.push(t)}static removeRequestListener(t){const e=z.requestListener.indexOf(t);e>-1&&z.requestListener.splice(e,1)}processGraphQlErrorInfo(t){var e,n;const s="Falha detectada",o=t[0];if(o.length>0){const t=o[0],u=(null==t?void 0:t.message)?null==t?void 0:t.message:"Não há mensagem de erro",a=(null===(e=null==t?void 0:t.extensions)||void 0===e?void 0:e.level)?t.extensions.level:"ERROR",c=(null===(n=null==t?void 0:t.extensions)||void 0===n?void 0:n.code)?t.extensions.code:"";return"WARNING"===a?new r(s,u,c):new i(s,u,c)}return new i(s,"Não há informações sobre o erro")}processServiceBrokerErrorInfo(t){const e="Falha detectada";let n,s,{statusMessage:o,tsError:u}=t||{};return o||(o="Não há informações sobre o erro"),u&&(n=u.tsErrorCode,s=u.tsErrorLevel),"WARNING"===s?new r(e,o,n):new i(e,o,n)}async callGraphQL(t,e=!1){var n;this.ready&&(this.pause(),window.requestAnimationFrame((()=>this.resume())));const i=this.getReqKey(t);if(t.queryID=i,t.values.queryID=i,z.clientEventsByID){t.values.registeredEventListeners=[];for(let[e]of z.clientEventsByID)t.values.registeredEventListeners.push(e)}return this.ready?new Promise((async(n,r)=>{let s=this.getQueryTemplate(t);const o=await this.fecthGraphQL([{document:s,variables:t.values}],e);o.errors.length>0?await this.proccesGraphQLClientEvents(null==o?void 0:o.extensions,t,n,r)||r(this.processGraphQlErrorInfo(o.errors)):(n(o.data[0][i]),await this.proccesGraphQLClientEvents(null==o?void 0:o.extensions,t,n,r))})):(this.watingRequestsById.has(i)||this.watingRequestsById.set(i,new Q(t,e)),null===(n=this.watingRequestsById.get(i))||void 0===n?void 0:n.promise)}resolveURL(){return B.getUrlBase()}async proccesGraphQLClientEvents(t,e,n,i){if(null==t)return!1;for(const s in t){const{clientEvents:o}=t[s];if(!o)return!1;for(const t in o){if(!z.hasClientEvent(t))throw console.warn(`Client event ${t} not registered`),new r("ClientEvent não registrado",`Ocorreu o client event ${t} porém não há client event registrado na aplicação.`);z.clientEventsByID.get(t).forEach((async r=>{await r({id:t,content:JSON.parse(o[t])},new G(e,n,i))}))}return Object.keys(o).length>0}return!1}async processServiceBrokerClientEvents(t){var e,n,i,r,s,o,u,a;const{clientEvents:c,serviceName:l,payloadJson:h,accept:f,reject:d}=t;if(!(null==c?void 0:c.length))return;const v=new J(l,h,f,d);try{for(var p,m=!0,y=H(c);!(e=(p=await y.next()).done);){r=p.value,m=!1;try{const t=r;if(z.hasClientEvent(t.id)){const e=z.clientEventsByID.get(t.id),n={id:t.id,content:t};try{for(var b,w=!0,g=(o=void 0,H(e));!(s=(b=await g.next()).done);){a=b.value,w=!1;try{const t=a;await t(n,v)}finally{w=!0}}}catch(t){o={error:t}}finally{try{w||s||!(u=g.return)||await u.call(g)}finally{if(o)throw o.error}}}}finally{m=!0}}}catch(t){n={error:t}}finally{try{m||e||!(i=y.return)||await i.call(y)}finally{if(n)throw n.error}}}async processPrinting(t){"true"===(null==t?void 0:t.pendingPrinting)&&await o.getInstance().processPendingPrinting(null==t?void 0:t.transactionId),"localPrintings"in t&&o.getInstance().processLocalPrinting(null==t?void 0:t.localPrintings)}getContext(t){var e;const i=B.getQueryParams(location.search);return{baseUrl:`${this.resolveURL()}/${t}/service.sbr`,appName:window.APPLICATION_NAME||"SankhyaBlocks",mgeSession:`${window.mgeSession||i.get("mgeSession")}`,globalID:window.GLOBALID||n.generateUUID(),resourceID:window.resourceID||(null===(e=window.workspace)||void 0===e?void 0:e.resourceID)}}async callServiceBroker(t,e,n){return new Promise((async(r,o)=>{const u=t.split("@"),[a,c]=2===u.length?u:["mge",t],l=this.getContext(a);let h=`${l.baseUrl}?serviceName=${c}&counter=21&application=${l.appName}&outputType=json&preventTransform=false&mgeSession=${l.mgeSession}&resourceID=${l.resourceID}&globalID=${l.globalID}&allowConcurrentCalls=true`;h=await this.addUrlParams(n,h),document.cookie=`JSESSIONID=${l.mgeSession};`;const f=new XMLHttpRequest;var d={};"string"==typeof e&&(e=s.stringToObject(e)),e.hasOwnProperty("requestBody")?d=e:d.requestBody=e;for(let[t]of z.clientEventsByID)d.requestBody.hasOwnProperty("clientEventList")||(d.requestBody.clientEventList={clientEvent:[]}),d.requestBody.clientEventList.clientEvent.push({$:t});z.requestListener.forEach((t=>t.onRequestStart({url:h,requestBody:e}))),f.open("POST",h,!0),f.withCredentials=!0,f.send(s.objectToString(d)),f.onreadystatechange=async()=>{var n;if(4==f.readyState&&200==f.status)try{const e=JSON.parse(f.responseText);await this.processPrinting(e),this.isServiceBrokerError(e)?o(this.processServiceBrokerErrorInfo(e)):e.status==z.SERVICE_BROKER_STATUS.SERVICE_CANCELED?e.statusMessage&&console.debug(`[DataFetcher] ${e.statusMessage}`):(r(e.responseBody),e.status==z.SERVICE_BROKER_STATUS.INFO&&(null===(n=this.application)||void 0===n||n.info(e.statusMessage))),this.processServiceBrokerClientEvents({clientEvents:null==e?void 0:e.clientEvents,serviceName:t,payloadJson:d,accept:r,reject:o})}catch(t){console.warn(`Erro ao executar serviço: ${t}`),o(new i("Erro ao executar serviço",t))}else 4==f.readyState&&200!=f.status&&o(new i(`Erro ao executar serviço: ${t}`,f.responseText));z.requestListener.forEach((t=>t.onRequestEnd({url:h,requestBody:e})))}}))}async addUrlParams(t,e){var i;const r=(null==t?void 0:t.urlParams)||{},s=await(null===(i=this.application)||void 0===i?void 0:i.getAttributeFromHTMLWrapper("VSS"));if(n.isEmpty(s)||(r.vss=s),0===Object.keys(r).length)return e;-1===e.indexOf("?")&&(e+="?");for(const t in r)e+=`&${t}=${r[t]}`;return e}isServiceBrokerError(t){return!t.hasOwnProperty("status")||t.status==z.SERVICE_BROKER_STATUS.ERROR||t.status==z.SERVICE_BROKER_STATUS.TIMEOUT}getReqKey(t){return window.btoa(n.hashCode(`${t.query}${JSON.stringify(t.values||"")}`)).replace(/=/g,"")}getQueryTemplate(t){return(t.query||"").replaceAll("$queryAlias$",t.queryID)}pause(){this.ready=!1}async resume(){if(this.ready=!0,this.watingRequestsById.size>0){const t=this.watingRequestsById;this.watingRequestsById=new Map,this.executePendingRequest(t)}}async executePendingRequest(t){const e=[];let n=!0;t.forEach((t=>{const i=this.getQueryTemplate(t.request);e.push({document:i,variables:Object.assign({},t.request.values)}),n=n&&t.quietMode}));const r=await this.fecthGraphQL(e,n),{data:s,errors:o,extensions:u}=r;o.forEach((e=>{Object.entries(e).forEach((async([e,n])=>{const r=t.get(n.request.variables[n.index].queryID),s=await this.proccesGraphQLClientEvents(u,r.request,r.resolve,r.reject);Promise.race([r.promise,new Promise((t=>{t(!1)}))]).then((e=>{var r;s&&!1!==e||((null===(r=t.get(n.request.variables[n.index].queryID))||void 0===r?void 0:r.reject)||Promise.reject)(new i("Falha detectada",n.message))}))}))})),s.forEach((e=>{Object.entries(e).forEach((async([e,n])=>{const i=t.get(e);await this.proccesGraphQLClientEvents(u,i.request,i.resolve,i.reject),((null==i?void 0:i.resolve)||Promise.resolve)(n)}))}))}buildGraphQlURL(t){const e=B.getQueryParams(location.search),n=`${window.mgeSession||e.get("mgeSession")}`;let i=`${this.resolveURL()+z.getGraphQLPath()}`;return n&&(i+=`?mgeSession=${n}`),t&&(i+=(i.indexOf("?")>-1?"&":"?")+"quietMode=true"),i}async fecthGraphQL(t,e){const n=[],r=[],s=[],o=this.buildGraphQlURL(e);z.requestListener.forEach((e=>e.onRequestStart({url:o,requestBody:t})));try{(await R.batchRequests(o,t,{"Content-Type":`application/json; charset=${window.SERVER_ENCODING||"UTF-8"}`})).forEach(((e,i)=>{var o;(null===(o=null==e?void 0:e.errors)||void 0===o?void 0:o.length)>0?r.push(e.errors.map((e=>this.normalizeErrorResponse(e,t,i)))):n.push(e.data),e.extensions&&s.push(e.extensions)}))}catch(e){if(this.isHttpError(e))throw z.requestListener.forEach((e=>e.onRequestEnd({url:o,requestBody:t}))),new i("Falha de comunicação",e.message);{const t=e.request;Object.entries(e.response).forEach((([e,i])=>{i.errors?r.push(i.errors.map((n=>(n.request=t,n.index=Number(e),n)))):i.data&&n.push(i.data)}))}}return z.requestListener.forEach((e=>e.onRequestEnd({url:o,requestBody:t}))),{data:n,errors:r,extensions:s}}isHttpError(t){var e;return!t.response&&!t.request||(null===(e=null==t?void 0:t.response)||void 0===e?void 0:e.status)>=300}normalizeErrorResponse(t,e,n){const i=Object.assign({},e[n]),{variables:r}=i;return i.variables=[],i.variables[n]=r,t.request=i,t.index=Number(n),t}static addClientEvent(t,e){let n=z.clientEventsByID.get(t);if(null!=n){if(n.some((t=>t.toString()===e.toString())))return;n.push(e)}else z.clientEventsByID.set(t,[e])}static hasClientEvent(t){return z.clientEventsByID.has(t)}static removeClientEvent(t){return z.clientEventsByID.delete(t)}}z.appTagName="snk-application",z.requestListener=[],z.SERVICE_BROKER_STATUS={ERROR:0,INFO:2,OK:1,TIMEOUT:3,SERVICE_CANCELED:4},z.clientEventsByID=new Map;class Q{constructor(t,e){this._resolve=()=>{},this._reject=()=>{},this._request=void 0,this._request=t,this._promisse=new Promise(((t,e)=>{this._resolve=t,this._reject=e})),this._quietMode=e}get resolve(){return this._resolve}get reject(){return this._reject}get promise(){return this._promisse}get request(){return this._request}get quietMode(){return this._quietMode}}export{z as D,B as U,R as d}
|
@@ -1 +0,0 @@
|
|
1
|
-
import{r as t,c as i,h as e}from"./p-d2d301a6.js";import{ApplicationContext as a,DataType as s,Action as n,UserInterface as o,StringUtils as r,DataUnit as l}from"@sankhyalabs/core";import{D as h}from"./p-dc7c9047.js";import"./p-af8efd95.js";import"./p-30cf616e.js";import{S as d}from"./p-21749402.js";import{P as c,b as u,c as v,d as m,D as A,I as O}from"./p-6d4f4614.js";import"./p-ff1990ad.js";import"./p-df5451c7.js";import{d as p}from"./p-b0ef4383.js";import{A as w}from"./p-913a9979.js";import{T as I}from"./p-7e7a7473.js";import"./p-8d884fab.js";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";import"./p-6dc031de.js";class _{constructor(t){this.dataUnitName=t}async save({dataUnit:t,record:i,updatingFields:e,operation:a}){var s,n;const o="INSERT"==a,r=o?e:i;if(!o&&(null==e?void 0:e.DESCRICAO)&&(null==e?void 0:e.DESCRICAO)!==(null==i?void 0:i.DESCRICAO))throw new Error(d.DESCRIPTION_CANNOT_BE_CHANGED);const l={anexo:{codata:o?null==e?void 0:e.REGISTER_KEY:null==i?void 0:i.CODATA,sequencia:(null==r?void 0:r.SEQUENCIA)||"0",tipo:(null==r?void 0:r.TIPO)||"N",descricao:null==r?void 0:r.DESCRICAO,arquivo:null===(n=null===(s=e.CAMINHO_ARQUIVO)||void 0===s?void 0:s[0])||void 0===n?void 0:n.name,ehInclusao:o?"S":"N",ehArquivoRepositorio:"N"}};return new Promise(((i,a)=>{h.get().callServiceBroker("Attach.save",JSON.stringify(l)).then((a=>{var s;return i([Object.assign(Object.assign(Object.assign({},a),e),{__owner__dataunit__name__:null!==(s=this.dataUnitName)&&void 0!==s?s:t})])})).catch((t=>a(t)))}))}async edit(t){throw new Error("Method not implemented.")}async delete(t){var i={anexo:{codata:t.CODATA,tipo:t.TIPO,descricao:t.DESCRICAO}};const e=await h.get().callServiceBroker("Attach.remove",JSON.stringify(i));return Promise.resolve(e)}async getDownloadKey(t){var i,e,a;if("S"==t.EHARQUIVOREPOSITORIO){const a={config:{path:t.ARQUIVO,tipoconteudo:t.TIPOCONTEUDO}},s=await h.get().callServiceBroker("RepositorioArquivoSP.abreArquivo",JSON.stringify(a));return Promise.resolve({chave:{valor:null===(e=null===(i=null==s?void 0:s.responseBody)||void 0===i?void 0:i.chave)||void 0===e?void 0:e.valor}})}const s={anexo:{codata:t.CODATA,codemp:t.CODEMP,sequencia:t.SEQUENCIA,tipo:t.TIPO,descricao:t.DESCRICAO,tipoConteudo:t.TIPOCONTEUDO}},n=await h.get().callServiceBroker("Attach.view",JSON.stringify(s));return(null==n?void 0:n.chaveAnexo)?Promise.resolve({chave:{valor:null===(a=null==n?void 0:n.chaveAnexo)||void 0===a?void 0:a.idChaveAnexo}}):Promise.reject(new Error("File not found."))}}const S="AnexoSistemaSP.salvar",k="AnexoSistemaSP.excluir",y="AnexoSistemaSP.baixar";class b{constructor(t,i,e){var a;this.entityName=t,this.registerKey=i,this.dataUnitName=e,this.validateFields=t=>{if(t.LINK&&t.NOMEARQUIVO)throw new Error(d.LINK_AND_FILE_AT_THE_SAME_TIME);if(!t.LINK&&!t.NOMEARQUIVO)throw new Error(d.ANY_LINK_OR_FILE_FILLED);if(!this.registerKey)throw new Error("Register key can not be null")},this.resourceID=window.resourceID||(null===(a=window.workspace)||void 0===a?void 0:a.resourceID)}async save(t){var i,e;let{updatingFields:a}=t;a=Object.assign(Object.assign({},a),{NOMEARQUIVO:null===(i=a.NOMEARQUIVO)||void 0===i?void 0:i[0]});try{this.validateFields(a);const t=a.LINK?null:a.NOMEARQUIVO,i={serviceName:S,requestBody:{params:{resourceID:this.resourceID,description:a.DESCRICAO,fileSelect:t?1:0,keySession:null===(e=null==t?void 0:t.properties)||void 0===e?void 0:e.fileNameTmp,nameAttach:null==t?void 0:t.name,link:a.LINK,nameEntity:this.entityName,pkEntity:this.registerKey,typeAcess:a.TIPOACESSO,typeApres:a.TIPOAPRES}}},s=await h.get().callServiceBroker(S,JSON.stringify(i));return Promise.resolve([Object.assign(Object.assign(Object.assign({},s),a),{ARQUIVOOULINK:a.LINK?a.LINK:null==t?void 0:t.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}async edit(t){var i,e,a;let{updatingFields:s,record:n}=t;const o=t=>void 0!==s[t]?s[t]:n[t],r=o("NOMEARQUIVO"),l=null===(e=null===(i=s.NOMEARQUIVO)||void 0===i?void 0:i[0])||void 0===e?void 0:e.downloadURL;s=Object.assign(Object.assign({},s),{DESCRICAO:o("DESCRICAO"),LINK:o("LINK"),TIPOACESSO:o("TIPOACESSO"),TIPOAPRES:o("TIPOAPRES"),CHAVEARQUIVO:n.CHAVEARQUIVO,NOMEARQUIVO:null==r?void 0:r[0]});const d=s.LINK?null:s.NOMEARQUIVO;try{this.validateFields(s);const t={serviceName:S,requestBody:{params:{resourceID:this.resourceID,nuAttach:null==n?void 0:n.NUATTACH,description:s.DESCRICAO,fileSelect:l?1:0,keySession:null===(a=null==d?void 0:d.properties)||void 0===a?void 0:a.fileNameTmp,keyAttach:s.CHAVEARQUIVO,nameAttach:null==d?void 0:d.name,link:s.LINK,nameEntity:this.entityName,pkEntity:this.registerKey,typeAcess:s.TIPOACESSO,typeApres:s.TIPOAPRES}}},i=await h.get().callServiceBroker(S,JSON.stringify(t));return Promise.resolve([Object.assign(Object.assign(Object.assign({},i),s),{ARQUIVOOULINK:s.LINK?s.LINK:null==d?void 0:d.name,__owner__dataunit__name__:this.dataUnitName})])}catch(t){return Promise.reject(t)}}delete(t){var i;const e=(null===(i=t.NOMEARQUIVO)||void 0===i?void 0:i[0])||{},a={serviceName:k,requestBody:{paramsDelete:{keyAttach:t.CHAVEARQUIVO,nameAttach:null==e?void 0:e.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO}}};return new Promise(((t,i)=>{h.get().callServiceBroker(k,JSON.stringify(a)).then((i=>t(i))).catch((t=>i(t)))}))}getDownloadKey(t){var i;const e=(null===(i=t.NOMEARQUIVO)||void 0===i?void 0:i[0])||{},a={serviceName:y,requestBody:{paramsDown:{nameAttach:null==e?void 0:e.name,nameEntity:t.NOMEINSTANCIA,nuAttach:t.NUATTACH,pkEntity:t.PKREGISTRO,keyAttach:t.CHAVEARQUIVO}}};return new Promise(((t,i)=>{h.get().callServiceBroker(y,JSON.stringify(a)).then((i=>t(i))).catch((t=>i(t)))}))}}class f{constructor(t,i){this.entityName=t,this.getMessage=i,this._application=a.getContextValue("__SNK__APPLICATION__")}initLoaders(t,i,e){this.loader||(this.loader=t.dataLoader),t.dataLoader=(t,i)=>this.dataLoader(t,i),t.saveLoader=(t,a)=>this.saveLoader(a,i).then((t=>(t.length&&e(),t))),t.removeLoader=(t,a)=>this.removeLoader(t,a,i).then((t=>(t.length&&e(),t)))}metadataLoader(t){throw new Error("Method not implemented.")}dataLoader(t,i){return new Promise((e=>{this.loader(t,i).then((t=>{const i=((null==t?void 0:t.records)||[]).map((t=>{let i;return t.LINK||(i=[{name:t.NOMEARQUIVO}]),Object.assign(Object.assign({},t),{ARQUIVOOULINK:t.LINK?t.LINK:t.NOMEARQUIVO,NOMEARQUIVO:i})}));e(Object.assign(Object.assign({},t),{records:i}))}))}))}saveLoader(t,i){return new Promise((e=>{var a;const s=Array.isArray(t)?t[0]:{};((null===(a=null==s?void 0:s.record)||void 0===a?void 0:a.NUATTACH)>=0?i.edit.bind(i):i.save.bind(i))(s).then((t=>{e(t)})).catch((t=>t.message===d.LINK_AND_FILE_AT_THE_SAME_TIME?(this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),e([])):t.message===d.ANY_LINK_OR_FILE_FILLED?(this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),e([])):t.message?(this._application.error(t.title||t.name,t.message),e([])):void e([])))}))}removeLoader(t,i,e){return new Promise((a=>{const{records:s}=t.getSelectionInfo(),n=s[0];e.delete(n).then((()=>(c.removeRecords(t,[n]),a(i))))}))}getFilters(t){return[{name:"AttachmentsByPK",expression:"this.PKREGISTRO = :PKREGISTRO",params:[{name:"PKREGISTRO",dataType:s.TEXT,value:`${t}_${this.entityName}`}]}]}getInterceptions(t,i,e){return new Promise((a=>i.type===n.EDITION_CANCELED?t.isDirty()?this._application.confirm(this.getMessage("snkAttach.cancelConfirmation.title"),this.getMessage("snkAttach.cancelConfirmation.message")).then((t=>t?(e.goToView(p.GRID),a(i)):a(void 0))):a(i):i.type===n.DATA_SAVED?(t.loadData(),a(i)):void a(i)))}}const E=a.getContextValue("__SNK__APPLICATION__"),N=t=>{var i,e;return null===(e=null===(i=null==E?void 0:E.messagesBuilder)||void 0===i?void 0:i.getMessage)||void 0===e?void 0:e.call(i,t,null)},g={grid:{columns:[{name:"CODATA",orderIndex:0,width:0},{name:"DESCRICAO",orderIndex:1,width:0},{name:"ARQUIVO",orderIndex:2,width:0},{name:"DTALTER",orderIndex:3,width:0},{name:"USUARIO",orderIndex:4,width:0}]},form:{emptyConfig:!1,fields:[{name:"DESCRICAO",label:N("snkAttach.attachMetadata.lblDescription"),visible:!0,readOnly:!1,required:!0},{name:"CAMINHO_ARQUIVO",label:N("snkAttach.attachMetadata.lblFile"),visible:!0,readOnly:!1,required:!0}]}},C={name:"Attach",label:"Attach List",fields:[{name:"CODATA",label:N("snkAttach.attachMetadata.lblCode"),dataType:s.TEXT},{name:"DESCRICAO",label:N("snkAttach.attachMetadata.lblDescription"),dataType:s.TEXT,readOnly:!1},{name:"ARQUIVO",label:N("snkAttach.attachMetadata.lblFileOrLink"),dataType:s.TEXT},{name:"USUARIO",label:N("snkAttach.attachMetadata.lblUser"),dataType:s.TEXT},{name:"DTALTER",label:N("snkAttach.attachMetadata.lblDate"),dataType:s.TEXT},{name:"CAMINHO_ARQUIVO",label:N("snkAttach.attachMetadata.lblFileUpload"),dataType:s.OBJECT,userInterface:o.FILE,readOnly:!1,required:!0,visible:!0,properties:{subTitle:N("snkAttach.attachMetadata.lblSubTitle"),MAX_FILES:1,STORAGESTRATEGY:"SESSION",INTERNAL_FILENAME:"Attach.upload"}}]};class P{constructor(t){this.getMessage=t,this._records=[],this._application=a.getContextValue("__SNK__APPLICATION__")}initLoaders(t,i,e){t.metadataLoader=t=>this.metadataLoader(t),t.dataLoader=(t,i)=>this.dataLoader(t,i),t.saveLoader=(t,a)=>this.saveLoader(a,i).then((t=>(t.length&&e(),t))),t.removeLoader=(t,a)=>this.removeLoader(t,a,i).then((t=>(t.length&&e(),t)))}metadataLoader(t){return Promise.resolve(C)}async dataLoader(t,i){if(!i.source)return Promise.resolve({records:this._records});if(!Number.isNaN(Number(i.source))){const t={criteria:{codata:i.source,tipoAnexo:"N"}},e=await this._application.getDataFetcher(),{anexos:{anexo:a=[]}}=await e.callServiceBroker("Attach.load",JSON.stringify(t)),s=[];a.forEach((t=>{s.push(Object.assign({__record__id__:r.generateUUID(),CAMINHO_ARQUIVO:[{name:null==t?void 0:t.ARQUIVO}]},t))})),this._records=s}let e=u(this._records,t,i.filters);return e=v(e,t,i.sort),Promise.resolve({records:e,paginationInfo:m(e,i.offset,i.limit)})}saveLoader(t,i){return new Promise((e=>{const a=Array.isArray(t)?t[0]:{};i.save(a).then(e).catch((t=>t.message===d.DESCRIPTION_CANNOT_BE_CHANGED?(this._application.alert(this.getMessage("snkAttach.alertValidation.descriptionCannotBeChanged.title"),this.getMessage("snkAttach.alertValidation.descriptionCannotBeChanged.message")),e([])):t.message===d.LINK_AND_FILE_AT_THE_SAME_TIME?(this._application.alert(this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.title"),this.getMessage("snkAttach.alertValidation.fileAndLinkAtTheSameTime.message")),e([])):t.message===d.ANY_LINK_OR_FILE_FILLED?(this._application.alert(this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.title"),this.getMessage("snkAttach.alertValidation.anyLinkOrFileFilled.message")),e([])):t.message?(this._application.error(t.title||t.name,t.message),e([])):void e([])))}))}removeLoader(t,i,e){return new Promise((a=>{t.getSelectionInfo().records.forEach((async t=>{this._application.hasAccess(w.REMOVE).then((async s=>{s&&(await e.delete(t),a(i))}))}))}))}getFilters(){throw new Error("Method not implemented.")}getInterceptions(t,i,e){return new Promise((a=>i.type===n.EDITION_CANCELED?t.isDirty()?this._application.confirm(this.getMessage("snkAttach.cancelConfirmation.title"),this.getMessage("snkAttach.cancelConfirmation.message")).then((t=>t?(e.goToView(p.GRID),a(i)):a(void 0))):a(i):i.type===n.DATA_SAVED?(t.loadData(),a(i)):void a(i)))}}const T=a.getContextValue("__SNK__APPLICATION__"),L=t=>{var i,e;return null===(e=null===(i=null==T?void 0:T.messagesBuilder)||void 0===i?void 0:i.getMessage)||void 0===e?void 0:e.call(i,t,null)},R={DOWNLOAD:{hint:L("snkAttach.taskbar.titleDownload"),name:"DOWNLOAD",iconName:"file-download"},LINK:{hint:L("snkAttach.taskbar.titleLink"),name:"LINK",iconName:"launch"}},x=()=>{const t=[I.REMOVE,"DOWNLOAD","LINK"];return{getButtons:(t,i,e)=>{if((null==i?void 0:i.insertionMode)||(null==i?void 0:i.isDirty))return e.reverse();e.splice(e.indexOf(I.REFRESH),1);const{selectedRecord:a}=i||{},s=(null==a?void 0:a.LINK)?R.LINK:R.DOWNLOAD;e.splice(e.indexOf(I.DIVIDER)+1,0,I.REMOVE,s,I.DIVIDER);const n=Array.from(new Set(e.filter((t=>t!==I.CLONE))));return n.splice(n.indexOf(s)+1,0,I.DIVIDER),n},isEnabled:(i,e,a)=>{const s=void 0!==(null==e?void 0:e.selectedRecord);return!(t.includes(a)&&!s)}}},D={grid:{columns:[{name:"ARQUIVOOULINK",orderIndex:0,width:0},{name:"DESCRICAO",orderIndex:1,width:0},{name:"DHCAD",orderIndex:2,width:0},{name:"DHALTER",orderIndex:3,width:0},{name:"TIPOAPRES",orderIndex:4,width:0},{name:"TIPOACESSO",orderIndex:5,width:0},{name:"CODUSU",orderIndex:6,width:0},{name:"CODUSUALT",orderIndex:7,width:0}]},form:{emptyConfig:!1,fields:[{name:"DESCRICAO",required:!0},{name:"TIPOAPRES",required:!0},{name:"TIPOACESSO",required:!0},{name:"LINK"},{name:"NOMEARQUIVO"}]}},j=class{constructor(e){t(this,e),this.back=i(this,"back",7),this.handleTaskbarClick=async({detail:t})=>{if(["DOWNLOAD","LINK"].includes(t))return this.downloadAttachment(this._currentDataUnit.getSelectedRecord());"Attach"===this.fetcherType&&["SAVE"].includes(t)&&this._currentDataUnit.isDirty()&&await this._currentDataUnit.setFieldValue("REGISTER_KEY",this.registerKey)},this.handleBack=()=>{this._currentDataUnit.cancelEdition().then((t=>{t&&this.back.emit()}))},this.handleFinish=()=>{if(!this._currentDataUnit.isDirty())return this.back.emit();this._currentDataUnit.saveData().then((()=>{this.showFinishedToast(),this.back.emit()}))},this.fetcherType=void 0,this.fetcher=void 0,this.dataUnit=void 0,this.dataUnitBuilder=void 0,this.registerKey=void 0,this.entityName=void 0,this.messagesBuilder=void 0,this._currentFetcher=void 0,this._currentDataUnit=void 0,this.crudConfig=void 0}async registerKeyWatcher(t,i){var e;null==this._currentDataUnit&&this.loadAttachmentDataUnit(),i!==t&&await(null===(e=this._currentDataUnit)||void 0===e?void 0:e.loadData())}async initAttach(){var t,i,e,a,s,n;if(this.fetcherType||this.registerKey){if(this.fetcherType||(this.fetcherType="AnexoSistema"),this.returnToGridMode(),"AnexoSistema"===this.fetcherType)return this._currentFetcher=new b(this.entityName,this.registerKey,null===(t=this._currentDataUnit)||void 0===t?void 0:t.name),null===(i=this._currentDataUnitBuilder)||void 0===i||i.initLoaders(this._currentDataUnit,this._currentFetcher,this.returnToGridMode.bind(this)),void await(null===(e=this._currentDataUnit)||void 0===e?void 0:e.loadData());if("Attach"===this.fetcherType&&(null===(a=this.registerKey)||void 0===a?void 0:a.split("_").length)>1)return;await(null===(s=this._currentDataUnit)||void 0===s?void 0:s.loadMetadata()),await(null===(n=this._currentDataUnit)||void 0===n?void 0:n.loadData(void 0,void 0,!0,this.registerKey))}}getMessage(t,i){if(this.messagesBuilder)return this.messagesBuilder.getMessage(t,i)}showFinishedToast(){this._application.info(this.getMessage("snkAttach.finishedMessage"),{iconName:"check"})}downloadAttachment(t){if(!t)throw new Error("Nenhum registro selecionado");t.LINK?window.open(`${t.LINK}`):this._currentFetcher.getDownloadKey(t).then((({chave:i})=>{var e;let a=!1;(null===(e=null==t?void 0:t.ARQUIVO)||void 0===e?void 0:e.endsWith(".pdf"))||(a=!0),window.open(`/mge/visualizadorArquivos.mge?chaveArquivo=${i.valor}${a?"&forcarDownload=S":""}`)}))}returnToGridMode(){var t;null===(t=this._currentDataUnit)||void 0===t||t.clearSelection(),this._crudElement&&this._crudElement.goToView(p.GRID)}async loadAttachmentDataUnit(){try{switch(this.fetcherType){case"AnexoSistema":await this.loadAnexoSistema();break;case"Attach":await this.loadAttach();break;default:this._currentFetcher=this.fetcher,this._currentDataUnit=this.dataUnit,this._currentDataUnitBuilder=this.dataUnitBuilder}}catch(t){throw new Error("There was an error while creating the data unit")}}async loadAnexoSistema(){var t,i,e;this._currentDataUnit=(new A).getDataUnit("AnexoSistema","br.com.sankhya.core.v3.anexoSistema"),this._currentFetcher=new b(this.entityName,this.registerKey,null===(t=this._currentDataUnit)||void 0===t?void 0:t.name),this._currentDataUnit.metadata||(await(null===(i=this._currentDataUnit)||void 0===i?void 0:i.loadMetadata()),this.crudConfig=Object.assign({},D)),this.initDataUnitLoaders(),this._currentDataUnit.addFilterProvider({getFilter:()=>this._currentDataUnitBuilder.getFilters(this.registerKey)}),this._currentDataUnit.addInterceptor({interceptAction:t=>this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit,t,this._crudElement)}),await(null===(e=this._currentDataUnit)||void 0===e?void 0:e.loadData()),this.disableEditFieldsNotInForm()}async loadAttach(){var t,i;this._currentFetcher=new _,this._currentDataUnit=new l(O.IN_MEMORY_DATA_UNIT_NAME),this.initDataUnitLoaders(),this._currentDataUnit.addInterceptor({interceptAction:t=>{var i;return t.type===n.METADATA_LOADED&&(this.crudConfig=Object.assign({},g),null===(i=this._crudElement)||void 0===i||i.updateConfig()),this._currentDataUnitBuilder.getInterceptions(this._currentDataUnit,t,this._crudElement)}}),this._currentDataUnit.metadata||(await(null===(t=this._currentDataUnit)||void 0===t?void 0:t.loadMetadata()),this.crudConfig=Object.assign({},g),await(null===(i=this._currentDataUnit)||void 0===i?void 0:i.loadData(void 0,void 0,!0,this.registerKey)),this.disableEditFieldsNotInForm())}initDataUnitLoaders(){var t,i,e;"AnexoSistema"===this.fetcherType&&(this._currentFetcher=new b(this.entityName,this.registerKey,null===(t=this._currentDataUnit)||void 0===t?void 0:t.name),this._currentDataUnitBuilder=new f(this.entityName,this.getMessage.bind(this)),null===(i=this._currentDataUnitBuilder)||void 0===i||i.initLoaders(this._currentDataUnit,this._currentFetcher,this.returnToGridMode.bind(this))),"Attach"===this.fetcherType&&(this._currentFetcher=new _,this._currentDataUnitBuilder=new P(this.getMessage.bind(this)),null===(e=this._currentDataUnitBuilder)||void 0===e||e.initLoaders(this._currentDataUnit,this._currentFetcher,(async()=>{this.returnToGridMode(),await this._currentDataUnit.loadData(void 0,void 0,!0,this.registerKey)})))}disableEditFieldsNotInForm(){var t;null===(t=this.crudConfig)||void 0===t||t.grid.columns.forEach((t=>{var i;const e=t.name;(null===(i=this.crudConfig)||void 0===i?void 0:i.form.fields.some((t=>t.name===e)))||this._currentDataUnit.disableField(e)}))}async componentWillLoad(){this._application=a.getContextValue("__SNK__APPLICATION__"),await this.initAttach()}componentWillRender(){this.fetcherType||(this.fetcherType="AnexoSistema"),null==this._currentDataUnit&&this.loadAttachmentDataUnit()}async handleOnDataStateChange({detail:t}){"Attach"===this.fetcherType&&(t.insertionMode?this._currentDataUnit.enableField("DESCRICAO"):this._currentDataUnit.disableField("DESCRICAO"),await this._currentDataUnit.loadMetadata())}render(){var t,i;return this._currentDataUnit?e("main",{class:"snk-attach__main"},e("header",{class:"snk-attach__header"},e("snk-simple-bar",{onExit:this.handleBack,messagesBuilder:this.messagesBuilder},e("div",{slot:"rightSlot"},e("ez-button",{class:"ez-button--primary",label:this.getMessage("snkAttach.finish"),onClick:this.handleFinish})))),e("div",{class:"snk-attach__crud-section ez-size-height--full ez-size-width--full ez-flex ez-flex--column"},e("div",{class:"ez-box__container"},e("snk-simple-crud",{ref:t=>this._crudElement=t,dataUnit:this._currentDataUnit,taskbarManager:x(),gridConfig:null===(t=this.crudConfig)||void 0===t?void 0:t.grid,formConfig:null===(i=this.crudConfig)||void 0===i?void 0:i.form,useCancelConfirm:!1,onActionClick:this.handleTaskbarClick,messagesBuilder:this.messagesBuilder,onDataStateChange:this.handleOnDataStateChange.bind(this)},e("div",{slot:"snkSimpleCrudHeader"},e("div",{class:"ez-flex ez-flex--column"},e("span",{class:"ez-title--primary ez-text ez-text--large ez-text--bold ez-padding-bottom--medium"},this.getMessage("snkAttach.title")),e("span",{class:"ez-text ez-text--medium ez-text--secondary"},this.getMessage("snkAttach.description")))))))):null}static get watchers(){return{registerKey:["registerKeyWatcher"]}}};j.style=".snk-attach__header.sc-snk-attach,.snk-attach__crud-section.sc-snk-attach{padding:0 var(--space--lg)}.snk-attach__file-info.sc-snk-attach{padding:var(--space--small);max-width:50%}.snk-attach__main.sc-snk-attach{height:85%}.ez-box__container.sc-snk-attach{height:100%}";export{j as snk_attach}
|
@@ -1 +0,0 @@
|
|
1
|
-
import{r as t,c as i,h as s,H as e,g as a}from"./p-d2d301a6.js";import{StringUtils as o,ElementIDUtils as n,ApplicationContext as h,JSUtils as r,FloatingManager as d}from"@sankhyalabs/core";import{T as c}from"./p-7e7a7473.js";import"./p-dc7c9047.js";import"./p-af8efd95.js";import{P as l}from"./p-30cf616e.js";import"./p-21749402.js";import"@sankhyalabs/ezui/dist/collection/utils/constants";import"@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata";import"./p-6d4f4614.js";import"./p-ff1990ad.js";import"./p-df5451c7.js";import{d as m}from"./p-b0ef4383.js";import{A as u}from"./p-913a9979.js";import"./p-6dc031de.js";import"./p-8d884fab.js";import"@sankhyalabs/ezui/dist/collection/components/ez-grid/utils";import"@sankhyalabs/core/dist/utils/SortingUtils";import"./p-688dcb4c.js";const p=class{constructor(s){t(this,s),this.actionClick=i(this,"actionClick",7),this.configuratorSave=i(this,"configuratorSave",7),this.configuratorCancel=i(this,"configuratorCancel",7),this.formItemsReady=i(this,"formItemsReady",7),this._keyDownHandler=async t=>this.keyDownListener(t),this._viewHistory=[],this._customEditors=new Map,this._customRenders=new Map,this._dataUnit=void 0,this._dataState=void 0,this.attachmentRegisterKey=void 0,this._currentViewMode=m.GRID,this._canEdit=void 0,this._resourceID=void 0,this.configName=void 0,this.filterBarTitle=void 0,this.selectionToastConfig=void 0,this.showActionButtons=!1,this.actionsList=void 0,this.taskbarManager=void 0,this.recordsValidator=void 0,this.statusResolver=void 0,this.multipleSelection=!0,this.presentationMode=l.PRIMARY,this.messagesBuilder=void 0,this.useEnterLikeTab=!1,this.gridLegacyConfigName=void 0,this.filterBarLegacyConfigName=void 0,this.formLegacyConfigName=void 0,this.disablePersonalizedFilter=void 0,this.autoLoad=void 0,this.autoFocus=!0,this.customContainerId=`SNK-CRUD-CUSTOM-CONTAINER-${o.generateUUID()}`}async goToView(t){this.executeAction(t)}async openConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.open()}async closeConfigurator(){var t;null===(t=this._snkConfigurator)||void 0===t||t.close()}async reloadFilterBar(){var t;null===(t=this._snkGrid)||void 0===t||t.reloadFilterBar()}async getFilterBar(){return await this._snkGrid.getFilterBar()}async addCustomEditor(t,i){if(this._guidesViewer&&this._snkGrid)return this._guidesViewer.addCustomEditor(t,i),void this._snkGrid.addCustomEditor(t,i);const s=new Map(this._customEditors);s.set(t,i),this._customEditors=s}async addGridCustomRender(t,i){if(this._snkGrid)return void this._snkGrid.addGridCustomRender(t,i);const s=new Map(this._customRenders);s.set(t,i),this._customRenders=s}async addCustomValueFormatter(t,i){this._snkGrid.addCustomValueFormatter(t,i)}async removeCustomValueFormatter(t){this._snkGrid.removeCustomValueFormatter(t)}async setFieldProp(t,i,s){await this._guidesViewer.setFieldProp(t,i,s)}currentViewModeWatcher(t){this._viewHistory=[...this._viewHistory.slice(-1),t]}async gridToForm(t=!1){this._backToGrid=!t&&await this._viewStack.getSelectedIndex()===m.GRID,this.setViewMode(m.FORM)}async executeAction(t){return t===c.GRID_MODE?this.setViewMode(m.GRID):t===c.FORM_MODE||t===c.UPDATE?this.gridToForm(t!==c.UPDATE):t===c.CONFIGURATOR?this._snkConfigurator.open():"ATTACH"===t?this.setViewMode(m.ATTACHMENT):void 0}backView(){const t=this._viewHistory.at(-2)||m.GRID;this.setViewMode(t)}setViewMode(t){this._viewStack.show(t),this._currentViewMode=t,t===m.GRID?this._snkGrid.setFocus():t===m.FORM&&this._guidesViewer.setFocus()}openConfig(t){this._snkConfigurator.close(),t===m.GRID?this._snkGrid.showConfig():t===m.FORM&&this._guidesViewer.showFormConfig()}addDataElementID(){n.addIDInfo(this._element,null,{dataUnit:this._dataUnit})}insertionModeHandler(){this.gridToForm()}cancelHandler(){this._backToGrid&&this.setViewMode(m.GRID)}async getAttachmentRegisterKey(){if(this._snkDataUnit)return(await this._snkDataUnit.getSelectedRecordsIDsInfo()).map((({value:t})=>t)).join("_")}setCustomRenders(){if(this._snkGrid)for(const[t,i]of this._customRenders)this._snkGrid.addGridCustomRender(t,i),this._customRenders.delete(t)}setCustomEditors(){if(this._snkGrid&&this._guidesViewer)for(const[t,i]of this._customEditors)this._guidesViewer.addCustomEditor(t,i),this._snkGrid.addCustomEditor(t,i),this._customEditors.delete(t)}componentDidRender(){this.setCustomRenders(),this.setCustomEditors()}componentWillLoad(){this._application=h.getContextValue("__SNK__APPLICATION__");let t=this._element.parentElement;for(this._application.hasAccess(u.UPDATE,this._resourceID).then((t=>this._canEdit=t));t;){if("SNK-DATA-UNIT"===t.tagName.toUpperCase()){this._snkDataUnit=t,this._snkDataUnit.addEventListener("insertionMode",(()=>this.insertionModeHandler())),this._snkDataUnit.addEventListener("cancelEdition",(()=>this.cancelHandler())),this._dataUnit=this._snkDataUnit.dataUnit,this._dataState=this._snkDataUnit.dataState,this._dataUnit?this.initDataUnit():this._snkDataUnit.addEventListener("dataUnitReady",(t=>{this._dataUnit=t.detail,this.initDataUnit()})),this._snkDataUnit.addEventListener("dataStateChange",this.handleDataStateChange.bind(this));break}t=t.parentElement}this.configName||(this.configName=this._application.configName)}componentDidLoad(){this.initKeyboardManager()}disconnectedCallback(){this.removeShortcuts(),window.removeEventListener("keydown",this._keyDownHandler)}async handleDataStateChange(t){var i;this._dataState=t.detail,void 0!==this._dataState.selectedRecord&&(this.attachmentRegisterKey=await this.getAttachmentRegisterKey());const s=await this._snkDataUnit.getFieldsWithRmPrecision();for(const t of s||[]){if(!t)continue;const s=null===(i=this._dataState.rowMetadata)||void 0===i?void 0:i.getProp("rm_precision",t);(s||0===s)&&(await this.setFieldProp(t,"precision",s),await this.setFieldProp(t,"prettyPrecision",s))}}async initKeyboardManager(){var t;const i=await(null===(t=this._application)||void 0===t?void 0:t.getKeyboardManager());if(i){const s=this._dataUnit||await this._snkDataUnit.getDataUnit();async function e(){const t=document.activeElement,i=t==document.body;i||t.blur(),await s.saveData(),i||null==t.setFocus?i||t.focus():t.setFocus()}i.bind("F6",this.toggleView.bind(this),{description:"Alterna entre modo formulário e grade.",element:this._element}).bind("F7",e.bind(this),{description:"Salva os dados.",element:this._element}).bind("ctrl + \\",e.bind(this),{description:"Salva os dados.",element:this._element}).bind("F8",s.addRecord.bind(s),{description:"Adiciona um novo registro.",element:this._element}).bind("F9",s.removeSelectedRecords.bind(s),{description:"Remove o registro selecionado.",element:this._element}).bind("ctrl + F9",s.removeSelectedRecords.bind(s),{description:"Remove o registro selecionado.",element:this._element}).bind("ctrl + .",(()=>0===s.getSelectionInfo().records.length?s.selectFirst():s.nextRecord()),{description:"Avança para o próximo registro.",element:this._element}).bind("ctrl + ,",s.previousRecord.bind(s),{description:"Retorna ao registro anterior.",element:this._element}).bind("F5",(async()=>{const t=await this._viewStack.getSelectedIndex();m.GRID===t&&s.loadData()}),{description:"Atualiza os dados.",element:this._element}).bind("Escape",(()=>{s.isDirty()&&s.cancelEdition()}),{debounceTime:1e3,description:"Cancela uma ação.",element:this._element})}}async removeShortcuts(){var t;const i=await(null===(t=this._application)||void 0===t?void 0:t.getKeyboardManager());i&&i.unbind("F6").unbind("F7").unbind("ctrl + \\").unbind("F8").unbind("F9").unbind("ctrl + F9").unbind("ctrl + .").unbind("ctrl + ,").unbind("F5").unbind("Escape")}async toggleView(){const t=await this._viewStack.getSelectedIndex();this.setViewMode(m.GRID===t?m.FORM:m.GRID)}async initDataUnit(){this.addDataElementID(),this.messagesBuilder||(this.messagesBuilder=this._snkDataUnit.messagesBuilder),null==this._resourceID&&(this._resourceID=this._snkDataUnit.resourceID,null==this._resourceID&&(this._resourceID=await this._application.getResourceID()))}handleConfiguratorEvent(t,i){t.stopImmediatePropagation(),"SAVE"!==i?this.configuratorCancel.emit():this.configuratorSave.emit()}async keyDownListener(t){t.ctrlKey&&null!=t.key&&"F"===t.key.toUpperCase()&&null!=this._element&&(r.isHiddenElement(this._element)||(d.closeAll(),this._currentViewMode===m.GRID?await this._snkGrid.findColumn():await this._guidesViewer.findField(),t.preventDefault()))}connectedCallback(){window.addEventListener("keydown",this._keyDownHandler,{capture:!0})}render(){if(null!=this._resourceID)return this._snkDataUnit.ignoreSaveMessage=this._currentViewMode===m.GRID,s(e,null,s("ez-view-stack",{ref:t=>this._viewStack=t,"data-element-id":"crud"},s("stack-item",null,s("snk-grid",{ref:t=>this._snkGrid=t,filterBarTitle:this.filterBarTitle,"data-element-id":"crud_grid",configName:this.configName,onGridDoubleClick:()=>this.gridToForm(!0),taskbarManager:this.taskbarManager,onActionClick:t=>this.executeAction(t.detail),messagesBuilder:this.messagesBuilder,actionsList:this.actionsList,statusResolver:this.statusResolver,multipleSelection:this.multipleSelection,presentationMode:this.presentationMode,recordsValidator:this.recordsValidator,selectionToastConfig:this.selectionToastConfig,useEnterLikeTab:this.useEnterLikeTab,canEdit:this._canEdit,resourceID:this._resourceID,disablePersonalizedFilter:this.disablePersonalizedFilter,gridLegacyConfigName:this.gridLegacyConfigName,filterBarLegacyConfigName:this.filterBarLegacyConfigName,autoLoad:this.autoLoad,autoFocus:this.autoFocus},s("slot",{name:"GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"SnkGridHeader"}),s("slot",{name:"SnkGridFooter"}),s("slot",{name:"SnkGridTaskBar"}))),s("stack-item",null,s("snk-guides-viewer",{ref:t=>this._guidesViewer=t,entityPath:this._snkDataUnit.entityName,messagesBuilder:this.messagesBuilder,onExit:()=>this.setViewMode(m.GRID),dataState:this._dataState,dataUnit:this._dataUnit,actionsList:this.actionsList,taskbarManager:this.taskbarManager,configName:this.configName,onActionClick:t=>this.executeAction(t.detail),presentationMode:this.presentationMode,"data-element-id":"crud_form",canEdit:this._canEdit,recordsValidator:this.recordsValidator,resourceID:this._resourceID,detailTaskbarCustomContainerId:this.customContainerId,formLegacyConfigName:this.formLegacyConfigName},s("slot",{name:"GUIDES_VIEWER_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"SnkFormTaskBar"}))),s("stack-item",null,s("snk-attach",{registerKey:this.attachmentRegisterKey,messagesBuilder:this.messagesBuilder,entityName:this._snkDataUnit.entityName,onBack:this.backView.bind(this)})),s("snk-configurator",{ref:t=>this._snkConfigurator=t,viewMode:this._currentViewMode,messagesBuilder:this.messagesBuilder,onConfigSelected:t=>this.setViewMode(t.detail),onOpenConfig:t=>this.openConfig(t.detail),showActionButtons:this.showActionButtons,onSave:t=>this.handleConfiguratorEvent(t,"SAVE"),onCancel:t=>this.handleConfiguratorEvent(t,"CANCEL"),resourceID:this._resourceID,customContainerId:this.customContainerId})),s("div",{id:`${this.customContainerId}`},s("slot",{name:"SnkConfigContainerSlot"}),s("slot",{name:"DETAIL_GRID_HEADER_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_GRID_TASKBAR_CUSTOM_ELEMENTS"}),s("slot",{name:"DETAIL_TASKBAR_CUSTOM_ELEMENTS"})))}get _element(){return a(this)}static get watchers(){return{_currentViewMode:["currentViewModeWatcher"]}}};p.style=".sc-snk-crud-h{display:flex;flex-direction:column;height:100%;width:100%}";export{p as snk_crud}
|
@@ -1 +0,0 @@
|
|
1
|
-
import{r as t,c as s,h as i,H as e,g as h}from"./p-d2d301a6.js";import{Action as a,StringUtils as n,ApplicationContext as r,OVERFLOWED_CLASS_NAME as o,OverflowWatcher as l,OverflowDirection as d,ElementIDUtils as u}from"@sankhyalabs/core";import{A as v}from"./p-dc36cfbf.js";import{T as m,V as c,A as k,b,a as p}from"./p-7e7a7473.js";import{P as T}from"./p-30cf616e.js";import"./p-6dc031de.js";const f=class{constructor(i){t(this,i),this.actionClick=s(this,"actionClick",7),this.TASKBAR_ITEM_ID_PREFIX="TASKBAR_ITEM_",this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME="taskbar-custom-elements-container",this.ACTIONS_BUTTON_TAG="TASKBAR-ACTIONS-BUTTON",this.NOT_OVERFLOW_ELEMENTS=["moreOptions","dataExporter_snkDataExporter","actionsButton_snkActionsButton"],this._titleKeyByElement={[m.UPDATE]:"snkTaskbar.titleUpdate",[m.PREVIOUS]:"snkTaskbar.titlePrevious",[m.NEXT]:"snkTaskbar.titleNext",[m.REFRESH]:"snkTaskbar.titleRefresh",[m.CLONE]:"snkTaskbar.titleClone",[m.REMOVE]:"snkTaskbar.titleRemove",[m.MORE_OPTIONS]:"snkTaskbar.titleMoreOptions",[m.INSERT]:"snkTaskbar.titleInsert",[m.CANCEL]:"snkTaskbar.titleCancel",[m.SAVE]:"snkTaskbar.titleSave",[m.GRID_MODE]:"snkTaskbar.titleGridMode",[m.FORM_MODE]:"snkTaskbar.titleFormMode",[m.CONFIGURATOR]:"snkTaskbar.titleConfigurator",[m.ATTACH]:"snkTaskbar.titleAttach"},this.onSaveEvent=t=>{switch(t.type){case a.FIELD_INVALIDATED:case a.DATA_SAVED:case a.SAVING_ERROR:this._isWaitingForSave=!1;break;case a.SAVING_DATA:this._isWaitingForSave=!0}},this._permissions=void 0,this._overFlowedElements=[],this._customElements=void 0,this._customElementsId=void 0,this._slotContainer=void 0,this._hiddenActionsList=[],this._lastWidth=void 0,this._hasToUpdateOverFlow=!1,this._isWaitingForSave=!1,this.alignRigth=!1,this.customSlotId="TASKBAR_CUSTOM_ELEMENTS",this.customContainerId=void 0,this.overflowStrategy="hiddenItems",this.configName=void 0,this.resourceID=void 0,this.buttons=void 0,this.customButtons=void 0,this.actionsList=void 0,this.primaryButton=void 0,this.disabledButtons=void 0,this.dataUnit=void 0,this.presentationMode=T.PRIMARY,this.messagesBuilder=void 0}handleCustomSlotElementsLoaded(t){this.hasToSearchCustomElements(t)&&this.getCustomElements(!0)}hasToSearchCustomElements(t){return this.customSlotId===t.detail&&!this._slotContainer}observeButtons(){this._definitions=void 0,requestAnimationFrame((()=>{requestAnimationFrame((()=>{var t;return null===(t=this._overFlowWatcher)||void 0===t?void 0:t.forceUpdate()}))}))}observeDisabledButtons(){var t;null===(t=this._overFlowWatcher)||void 0===t||t.forceUpdate()}observeLastWidth(t,s){0===s&&0!==t&&(this._hasToUpdateOverFlow=!0)}elementsFromString(t){const s=[];return null==t||t.split(",").forEach((t=>{t=t.trim(),(c[t]||this.isAllowed(t))&&s.push(t.trim())})),s}isAllowed(t){return t===k.CONFIGURATOR?!!this._permissions&&(this._permissions.isSup||this._permissions[v.CONFIG_GRID]||this._permissions[v.CONFIG]):!k[t]||!!this._permissions&&(this._permissions.isSup||this._permissions[t])}getTitle(t){var s;let i;return i=this.isAllowed(t)?this._titleKeyByElement[t]:"snkTaskbar.forbidden",i?null===(s=this.messagesBuilder)||void 0===s?void 0:s.getMessage(i,{}):""}elementClick(t){if(this.dataUnit)switch(t){case m.PREVIOUS:this.dataUnit.previousRecord();break;case m.NEXT:this.dataUnit.nextRecord();break;case m.REFRESH:this.dataUnit.loadData();break;case m.CLONE:this.dataUnit.copySelected();break;case m.REMOVE:this.dataUnit.removeSelectedRecords();break;case m.INSERT:this.dataUnit.addRecord();break;case m.CANCEL:this.dataUnit.cancelEdition();break;case m.SAVE:this._isWaitingForSave||(this._isWaitingForSave=!0,this.dataUnit.saveData().finally((()=>{this._isWaitingForSave=!1})))}this.isEnabled(t)&&this.actionClick.emit(t)}isEnabled(t){return!(!this.isAllowed(t)||this.disabledButtons&&this.disabledButtons.includes(t))}validatePresentationMode(){Object.values(T).includes(this.presentationMode)||(this.presentationMode=T.PRIMARY)}getElement(t,s){let i=s===this.primaryButton?"ez-button--primary ":"";t>1&&(i+="ez-padding-left--medium");const e=m[s.toString()],h=this._element.dataset.exporterStoreKey||this.configName;return e?b(s,i,this.getIdElemBtnNative(s),(t=>this.getTitle(t)),(t=>this.elementClick(t)),(t=>this.isEnabled(t)),this.buildDynamicActionsList(),h,this.presentationMode):p(s,i,this.getIdElemBtnCustom(s),(t=>this.elementClick(t)),(t=>this.isEnabled(t)))}buildDynamicActionsList(){var t;return this._hiddenActionsList.length?[...null!==(t=this.actionsList)&&void 0!==t?t:[],{type:"divider",label:"",value:""},...this._hiddenActionsList]:this.actionsList}getIdElemBtnNative(t){return n.toCamelCase(t)}getIdElemBtnCustom(t){return n.toCamelCase(t.name)}isDivider(t){var s;return void 0!==t&&(null===(s=t.t)||void 0===s?void 0:s["data-taskbar-divider"])}removeEmpty(t){let s;return t.filter((t=>!(null==t||this.isDivider(s)&&this.isDivider(t)||(s=t,0))))}appendCustomElementsInTaskbar(){this._customElementsId.forEach((t=>{const s=t.replace(this.TASKBAR_ITEM_ID_PREFIX,""),i=this._customElements.get(s),e=this._element.querySelector(`#${t}`);e?null==e||e.appendChild(i):this.unlinkCustomElementFromTaskbar(i)}))}addCustomElementContainer(t){var s;const e=`${this.TASKBAR_ITEM_ID_PREFIX}${t}`;return this._customElementsId.includes(e)||(this._customElementsId.push(e),null===(s=this._overFlowWatcher)||void 0===s||s.addNotOverFlowElement(e)),i("span",{class:"ez-padding-left--medium",key:e,id:e})}getCustomElements(t){var s,i;this._customElementsId=[],this._customElements=new Map,this._slotContainer=this.buildSlotContainer(t),Array.from(null!==(i=null===(s=this._slotContainer)||void 0===s?void 0:s.children)&&void 0!==i?i:[]).forEach((t=>this._customElements.set(t.id,t)))}buildSlotContainer(t){let s;if(this.customContainerId){const t=document.querySelector(`#${this.customContainerId}`);s=null==t?void 0:t.querySelector(`#${this.customSlotId}`)}else s=this._element.querySelector(`#${this.customSlotId}`);return t&&!s&&(s=document.querySelector(`#${this.customSlotId}`)),s}componentWillLoad(){this._application=r.getContextValue("__SNK__APPLICATION__"),this._application?this._application.getAllAccess(this.resourceID).then((t=>this._permissions=t)):this._permissions={},this.getCustomElements()}componentWillRender(){this.handleDefinitions(),this.validatePresentationMode(),this.updateOverFlowIfNeeded()}handleDefinitions(){null==this._definitions&&this._permissions&&(this._definitions=this.elementsFromString(this.buttons))}updateOverFlowIfNeeded(){this._hasToUpdateOverFlow&&(requestAnimationFrame((()=>{var t;return null===(t=this._overFlowWatcher)||void 0===t?void 0:t.forceUpdate()})),this._hasToUpdateOverFlow=!1)}handleOverFlow(t){const s=t.filter((t=>!this.hasToIgnoreOverFlow(t)));this.resetOverFlowedElements(),this.doOverFlowElements(s)}resetOverFlowedElements(){this._overFlowedElements.forEach((t=>{t.classList.remove(o)})),this._hiddenActionsList=[],this._overFlowedElements=[]}doOverFlowElements(t){t.forEach((t=>{t.classList.add(o),this._overFlowedElements.push(t),this.addItemToActionList(t)}))}addItemToActionList(t){const s=this.getTaskbarElementName(t);if(s&&this.isEnabled(s)&&this.isAllowed(s)){const i={value:s,label:this.getTaskbarElementLabel(t),iconName:this.getTaskbarElementIcon(t)};this._hiddenActionsList.push(i)}}getTaskbarElementName(t){var s;return null!==(s=t.getAttribute("data-taskbar-element"))&&void 0!==s?s:""}getTaskbarElementIcon(t){var s;return null!==(s=t.getAttribute("data-taskbar-icon"))&&void 0!==s?s:""}getTaskbarElementLabel(t){var s;return null!==(s=t.getAttribute("data-taskbar-label"))&&void 0!==s?s:""}hasToIgnoreOverFlow(t){return t.classList.contains(this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME)}handleOverFlowStrategy(){"hiddenItems"===this.overflowStrategy&&(this._overFlowWatcher=new l(this.buildOverFlowWatcherParams()))}buildOverFlowWatcherParams(){return{element:this._element,callback:this.handleOverFlow.bind(this),overFlowDirection:d.HORIZONTAL,notOverFlow:this.NOT_OVERFLOW_ELEMENTS}}componentDidLoad(){u.addIDInfo(this._element,null,{dataUnit:this.dataUnit}),this.handleOverFlowStrategy(),this.dataUnit.subscribe(this.onSaveEvent)}componentDidRender(){this.appendCustomElementsInTaskbar(),this.updateLastWidth()}updateLastWidth(){this._lastWidth=this._element.getBoundingClientRect().width}disconnectedCallback(){var t;this.unlinkAllCustomElements(),null===(t=this._overFlowWatcher)||void 0===t||t.destroy()}unlinkAllCustomElements(){var t;null===(t=this._customElementsId)||void 0===t||t.forEach((t=>{const s=t.replace(this.TASKBAR_ITEM_ID_PREFIX,""),i=this._customElements.get(s);this.unlinkCustomElementFromTaskbar(i)}))}unlinkCustomElementFromTaskbar(t){this._slotContainer.appendChild(t)}render(){if(void 0===this._definitions)return;let t=0;return i(e,{class:this.getHostClasses()},this.removeEmpty(this._definitions.map((s=>{var e,h;return t++,m[s]?this.getElement(t,m[s]):(null===(e=this.customButtons)||void 0===e?void 0:e.has(s))?this.getElement(t,this.customButtons.get(s)):this._customElements.has(s)?this.addCustomElementContainer(s):(null===(h=this._overFlowWatcher)||void 0===h||h.addNotOverFlowElement(s),i("slot",{name:s}))}))),i("div",{class:this.TASKBAR_CUSTOM_ELEMENTS_CONTAINER_CLASS_NAME},i("slot",{name:this.customSlotId})))}getHostClasses(){return"hiddenItems"!==this.overflowStrategy?"no-wrap":"full-width "+(this.alignRigth?"align-right":"")}get _element(){return h(this)}static get watchers(){return{buttons:["observeButtons"],disabledButtons:["observeDisabledButtons"],_lastWidth:["observeLastWidth"]}}};f.style=".sc-snk-taskbar-h{display:flex;flex-wrap:wrap}.no-wrap.sc-snk-taskbar-h{flex-wrap:nowrap}.full-width.sc-snk-taskbar-h{width:100%}.align-right.sc-snk-taskbar-h{justify-content:flex-end}.overflowed.sc-snk-taskbar{display:none}";export{f as snk_taskbar}
|