sanity 3.94.1-next.4.3a875e37ff → 3.94.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/BehaviorSubject-CU-WJrzA.mjs +30 -0
  2. package/dist/BehaviorSubject-CU-WJrzA.mjs.map +1 -0
  3. package/dist/BroadcastDisplayedDocument-BSV9T3BU.mjs +20 -0
  4. package/dist/BroadcastDisplayedDocument-BSV9T3BU.mjs.map +1 -0
  5. package/dist/DisplayedDocumentBroadcaster-DZ65n35Q.mjs +62 -0
  6. package/dist/DisplayedDocumentBroadcaster-DZ65n35Q.mjs.map +1 -0
  7. package/dist/LiveQueries-Crz53eU5.mjs +407 -0
  8. package/dist/LiveQueries-Crz53eU5.mjs.map +1 -0
  9. package/dist/Observable-CCQtH8Gg.mjs +546 -0
  10. package/dist/Observable-CCQtH8Gg.mjs.map +1 -0
  11. package/dist/PostMessageDocuments-BjgsJxz4.mjs +72 -0
  12. package/dist/PostMessageDocuments-BjgsJxz4.mjs.map +1 -0
  13. package/dist/PostMessagePerspective-pucY-E6a.mjs +22 -0
  14. package/dist/PostMessagePerspective-pucY-E6a.mjs.map +1 -0
  15. package/dist/PostMessagePreviewSnapshots-CRQgRg4_.mjs +71 -0
  16. package/dist/PostMessagePreviewSnapshots-CRQgRg4_.mjs.map +1 -0
  17. package/dist/PostMessageRefreshMutations-D944RbO3.mjs +66 -0
  18. package/dist/PostMessageRefreshMutations-D944RbO3.mjs.map +1 -0
  19. package/dist/PostMessageSchema-3eOtr1bs.mjs +516 -0
  20. package/dist/PostMessageSchema-3eOtr1bs.mjs.map +1 -0
  21. package/dist/PostMessageTelemetry-DMTQDJeN.mjs +20 -0
  22. package/dist/PostMessageTelemetry-DMTQDJeN.mjs.map +1 -0
  23. package/dist/PresentationToolGrantsCheck-B0q4AQ3b.mjs +3999 -0
  24. package/dist/PresentationToolGrantsCheck-B0q4AQ3b.mjs.map +1 -0
  25. package/dist/QRCodeSVG-hyTW2xeN.mjs +648 -0
  26. package/dist/QRCodeSVG-hyTW2xeN.mjs.map +1 -0
  27. package/dist/Refractor-Zss2QEe8.mjs +2568 -0
  28. package/dist/Refractor-Zss2QEe8.mjs.map +1 -0
  29. package/dist/SourceContext-QxJD1Wrm.mjs +111 -0
  30. package/dist/SourceContext-QxJD1Wrm.mjs.map +1 -0
  31. package/dist/StructureToolProvider-B-7cwz7l.mjs +2287 -0
  32. package/dist/StructureToolProvider-B-7cwz7l.mjs.map +1 -0
  33. package/dist/ViteDevServerStopped-CgIEqy9p.mjs +57 -0
  34. package/dist/ViteDevServerStopped-CgIEqy9p.mjs.map +1 -0
  35. package/dist/_createContext.mjs +38 -0
  36. package/dist/_createContext.mjs.map +1 -0
  37. package/dist/_singletons.mjs +216 -0
  38. package/dist/_singletons.mjs.map +1 -0
  39. package/dist/browser-B0Q9qZJS.mjs +478 -0
  40. package/dist/browser-B0Q9qZJS.mjs.map +1 -0
  41. package/dist/browser-DmX5VEcE.mjs +324 -0
  42. package/dist/browser-DmX5VEcE.mjs.map +1 -0
  43. package/dist/desk.mjs +53 -0
  44. package/dist/desk.mjs.map +1 -0
  45. package/dist/first-Cz545eV-.mjs +42 -0
  46. package/dist/first-Cz545eV-.mjs.map +1 -0
  47. package/dist/index-B2GCDfau.mjs +96 -0
  48. package/dist/index-B2GCDfau.mjs.map +1 -0
  49. package/dist/index-BRIelBPK.mjs +6946 -0
  50. package/dist/index-BRIelBPK.mjs.map +1 -0
  51. package/dist/index-BUB137yJ.mjs +144 -0
  52. package/dist/index-BUB137yJ.mjs.map +1 -0
  53. package/dist/index-C3PGPrdL.mjs +1192 -0
  54. package/dist/index-C3PGPrdL.mjs.map +1 -0
  55. package/dist/index-C9NvTy6s.mjs +319 -0
  56. package/dist/index-C9NvTy6s.mjs.map +1 -0
  57. package/dist/index-DCkQlgdi.mjs +4001 -0
  58. package/dist/index-DCkQlgdi.mjs.map +1 -0
  59. package/dist/index-DG-3plB0.mjs +71 -0
  60. package/dist/index-DG-3plB0.mjs.map +1 -0
  61. package/dist/index-RoxwhtVB.mjs +5600 -0
  62. package/dist/index-RoxwhtVB.mjs.map +1 -0
  63. package/dist/index-iMZR29eF.mjs +756 -0
  64. package/dist/index-iMZR29eF.mjs.map +1 -0
  65. package/dist/index-wVXq9rWS.mjs +244 -0
  66. package/dist/index-wVXq9rWS.mjs.map +1 -0
  67. package/dist/index.mjs +137385 -0
  68. package/dist/index.mjs.map +1 -0
  69. package/dist/lodash-Vz5dH_Dm.mjs +3679 -0
  70. package/dist/lodash-Vz5dH_Dm.mjs.map +1 -0
  71. package/dist/pane-Bm_57XKB.mjs +5 -0
  72. package/dist/pane-Bm_57XKB.mjs.map +1 -0
  73. package/dist/pane-Dopl4BjD.mjs +5 -0
  74. package/dist/pane-Dopl4BjD.mjs.map +1 -0
  75. package/dist/presentation-DsIky7Cj.mjs +556 -0
  76. package/dist/presentation-DsIky7Cj.mjs.map +1 -0
  77. package/dist/presentation.mjs +10 -0
  78. package/dist/presentation.mjs.map +1 -0
  79. package/dist/publishReplay-PuJoYJpp.mjs +92 -0
  80. package/dist/publishReplay-PuJoYJpp.mjs.map +1 -0
  81. package/dist/refractor-Bg1S3YDK.mjs +26 -0
  82. package/dist/refractor-Bg1S3YDK.mjs.map +1 -0
  83. package/dist/resources-BQsCEzu1.mjs +60 -0
  84. package/dist/resources-BQsCEzu1.mjs.map +1 -0
  85. package/dist/resources-BahMtJuO.mjs +177 -0
  86. package/dist/resources-BahMtJuO.mjs.map +1 -0
  87. package/dist/resources-CjkBN4z6.mjs +126 -0
  88. package/dist/resources-CjkBN4z6.mjs.map +1 -0
  89. package/dist/resources-Dc-6ZcPg.mjs +157 -0
  90. package/dist/resources-Dc-6ZcPg.mjs.map +1 -0
  91. package/dist/resources-DqxSuDsr.mjs +37 -0
  92. package/dist/resources-DqxSuDsr.mjs.map +1 -0
  93. package/dist/resources-_gTjFWLH.mjs +517 -0
  94. package/dist/resources-_gTjFWLH.mjs.map +1 -0
  95. package/dist/resources-kA1bao30.mjs +358 -0
  96. package/dist/resources-kA1bao30.mjs.map +1 -0
  97. package/dist/router.mjs +721 -0
  98. package/dist/router.mjs.map +1 -0
  99. package/dist/stegaEncodeSourceMap-DCG9Ba1H.mjs +358 -0
  100. package/dist/stegaEncodeSourceMap-DCG9Ba1H.mjs.map +1 -0
  101. package/dist/structure.mjs +57 -0
  102. package/dist/structure.mjs.map +1 -0
  103. package/dist/structureTool-Bth1vd8r.mjs +13150 -0
  104. package/dist/structureTool-Bth1vd8r.mjs.map +1 -0
  105. package/dist/switchMap-DHVUskpL.mjs +54 -0
  106. package/dist/switchMap-DHVUskpL.mjs.map +1 -0
  107. package/dist/v4-zH-CAum7.mjs +24798 -0
  108. package/dist/v4-zH-CAum7.mjs.map +1 -0
  109. package/dist/version-DoE_JnhG.mjs +5 -0
  110. package/dist/version-DoE_JnhG.mjs.map +1 -0
  111. package/lib/_chunks-cjs/version.js +1 -1
  112. package/lib/_chunks-es/version.mjs +1 -1
  113. package/package.json +23 -23
@@ -0,0 +1,30 @@
1
+ import { _ as i } from "./Observable-CCQtH8Gg.mjs";
2
+ import { S as u } from "./SourceContext-QxJD1Wrm.mjs";
3
+ var h = function(o) {
4
+ i(e, o);
5
+ function e(t) {
6
+ var r = o.call(this) || this;
7
+ return r._value = t, r;
8
+ }
9
+ return Object.defineProperty(e.prototype, "value", {
10
+ get: function() {
11
+ return this.getValue();
12
+ },
13
+ enumerable: !1,
14
+ configurable: !0
15
+ }), e.prototype._subscribe = function(t) {
16
+ var r = o.prototype._subscribe.call(this, t);
17
+ return !r.closed && t.next(this._value), r;
18
+ }, e.prototype.getValue = function() {
19
+ var t = this, r = t.hasError, n = t.thrownError, a = t._value;
20
+ if (r)
21
+ throw n;
22
+ return this._throwIfClosed(), a;
23
+ }, e.prototype.next = function(t) {
24
+ o.prototype.next.call(this, this._value = t);
25
+ }, e;
26
+ }(u);
27
+ export {
28
+ h as B
29
+ };
30
+ //# sourceMappingURL=BehaviorSubject-CU-WJrzA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BehaviorSubject-CU-WJrzA.mjs","sources":["../../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/dist/esm5/internal/BehaviorSubject.js"],"sourcesContent":["import { __extends } from \"tslib\";\nimport { Subject } from './Subject';\nvar BehaviorSubject = (function (_super) {\n __extends(BehaviorSubject, _super);\n function BehaviorSubject(_value) {\n var _this = _super.call(this) || this;\n _this._value = _value;\n return _this;\n }\n Object.defineProperty(BehaviorSubject.prototype, \"value\", {\n get: function () {\n return this.getValue();\n },\n enumerable: false,\n configurable: true\n });\n BehaviorSubject.prototype._subscribe = function (subscriber) {\n var subscription = _super.prototype._subscribe.call(this, subscriber);\n !subscription.closed && subscriber.next(this._value);\n return subscription;\n };\n BehaviorSubject.prototype.getValue = function () {\n var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, _value = _a._value;\n if (hasError) {\n throw thrownError;\n }\n this._throwIfClosed();\n return _value;\n };\n BehaviorSubject.prototype.next = function (value) {\n _super.prototype.next.call(this, (this._value = value));\n };\n return BehaviorSubject;\n}(Subject));\nexport { BehaviorSubject };\n//# sourceMappingURL=BehaviorSubject.js.map"],"names":["BehaviorSubject","_super","__extends","_value","_this","subscriber","subscription","_a","hasError","thrownError","value","Subject"],"mappings":";;AAEG,IAACA,IAAmB,SAAUC,GAAQ;AACrC,EAAAC,EAAUF,GAAiBC,CAAM;AACjC,WAASD,EAAgBG,GAAQ;AAC7B,QAAIC,IAAQH,EAAO,KAAK,IAAI,KAAK;AACjC,WAAAG,EAAM,SAASD,GACRC;AAAA,EACf;AACI,gBAAO,eAAeJ,EAAgB,WAAW,SAAS;AAAA,IACtD,KAAK,WAAY;AACb,aAAO,KAAK,SAAU;AAAA,IACzB;AAAA,IACD,YAAY;AAAA,IACZ,cAAc;AAAA,EACtB,CAAK,GACDA,EAAgB,UAAU,aAAa,SAAUK,GAAY;AACzD,QAAIC,IAAeL,EAAO,UAAU,WAAW,KAAK,MAAMI,CAAU;AACpE,YAACC,EAAa,UAAUD,EAAW,KAAK,KAAK,MAAM,GAC5CC;AAAA,EACV,GACDN,EAAgB,UAAU,WAAW,WAAY;AAC7C,QAAIO,IAAK,MAAMC,IAAWD,EAAG,UAAUE,IAAcF,EAAG,aAAaJ,IAASI,EAAG;AACjF,QAAIC;AACA,YAAMC;AAEV,gBAAK,eAAgB,GACdN;AAAA,EACV,GACDH,EAAgB,UAAU,OAAO,SAAUU,GAAO;AAC9C,IAAAT,EAAO,UAAU,KAAK,KAAK,MAAO,KAAK,SAASS,CAAO;AAAA,EAC1D,GACMV;AACX,EAAEW,CAAO;","x_google_ignoreList":[0]}
@@ -0,0 +1,20 @@
1
+ import { d as r } from "./index-C9NvTy6s.mjs";
2
+ import { memo as i, useEffect as m } from "react";
3
+ import { u as n } from "./presentation-DsIky7Cj.mjs";
4
+ import { u as f } from "./DisplayedDocumentBroadcaster-DZ65n35Q.mjs";
5
+ function d(a) {
6
+ const e = r.c(7), t = f(), s = n(!1);
7
+ let o;
8
+ e[0] !== a.value || e[1] !== t ? (o = () => {
9
+ const c = setTimeout(() => t == null ? void 0 : t(a.value), 10);
10
+ return () => clearTimeout(c);
11
+ }, e[0] = a.value, e[1] = t, e[2] = o) : o = e[2];
12
+ const l = s == null ? void 0 : s.perspective;
13
+ let u;
14
+ return e[3] !== a.value || e[4] !== t || e[5] !== l ? (u = [l, a.value, t], e[3] = a.value, e[4] = t, e[5] = l, e[6] = u) : u = e[6], m(o, u), null;
15
+ }
16
+ const y = i(d);
17
+ export {
18
+ y as default
19
+ };
20
+ //# sourceMappingURL=BroadcastDisplayedDocument-BSV9T3BU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BroadcastDisplayedDocument-BSV9T3BU.mjs","sources":["../src/presentation/loader/BroadcastDisplayedDocument.tsx"],"sourcesContent":["import {memo, useEffect} from 'react'\nimport {type SanityDocument} from 'sanity'\n\nimport {usePresentationParams} from '../usePresentationParams'\nimport {useDisplayedDocumentBroadcaster} from './DisplayedDocumentBroadcaster'\n\n/**\n * Sanity Form input component that reads the current form state and broadcasts it to\n * the live query store\n */\nfunction BroadcastDisplayedDocument(props: {\n value: Partial<SanityDocument> | null | undefined\n}): React.JSX.Element | null {\n const setDisplayedDocument = useDisplayedDocumentBroadcaster()\n const params = usePresentationParams(false)\n\n useEffect(() => {\n const timeout = setTimeout(() => setDisplayedDocument?.(props.value), 10)\n return () => clearTimeout(timeout)\n }, [params?.perspective, props.value, setDisplayedDocument])\n\n return null\n}\n\nexport default memo(BroadcastDisplayedDocument)\n"],"names":["BroadcastDisplayedDocument","props","$","_c","setDisplayedDocument","useDisplayedDocumentBroadcaster","params","usePresentationParams","t0","value","timeout","setTimeout","clearTimeout","t1","perspective","t2","useEffect","memo"],"mappings":";;;;AAUA,SAAAA,EAAAC,GAAA;AAAAC,QAAAA,IAAAC,IAAA,CAAA,GAGEC,IAA6BC,EAAgC,GAC7DC,IAAeC,EAAA,EAA2B;AAACC,MAAAA;AAAAN,EAAAA,SAAAD,EAAAQ,SAAAP,SAAAE,KAEjCI,IAAAA,MAAA;AACR,UAAAE,IAAgBC,WAAiBP,MAAAA,KAAAA,gBAAAA,EAAuBH,EAAKQ,QAAA,EAAW;AAC3DG,WAAAA,MAAAA,aAAaF,CAAO;AAAA,EAAC,GACnCR,EAAA,CAAA,IAAAD,EAAAQ,OAAAP,OAAAE,GAAAF,OAAAM,KAAAA,IAAAN,EAAA,CAAA;AAAG,QAAAW,IAAAP,KAAAA,gBAAAA,EAAMQ;AAAaC,MAAAA;AAAA,SAAAb,EAAA,CAAA,MAAAD,EAAAQ,SAAAP,EAAA,CAAA,MAAAE,KAAAF,EAAA,CAAA,MAAAW,KAApBE,KAACF,GAAqBZ,EAAKQ,OAAQL,CAAoB,GAACF,EAAA,CAAA,IAAAD,EAAAQ,OAAAP,OAAAE,GAAAF,OAAAW,GAAAX,OAAAa,KAAAA,IAAAb,EAAA,CAAA,GAH3Dc,EAAUR,GAGPO,CAAwD,GAAC;AAAA;AAK9D,MAAeE,IAAAA,EAAKjB,CAA0B;"}
@@ -0,0 +1,62 @@
1
+ import { jsx as D } from "react/jsx-runtime";
2
+ import { g as v, d as y } from "./index-C9NvTy6s.mjs";
3
+ import { useContext as E, useEffect as O } from "react";
4
+ import { PresentationDisplayedDocumentContext as d } from "sanity/_singletons";
5
+ var a, m;
6
+ function j() {
7
+ return m || (m = 1, a = function n(t, e) {
8
+ if (t === e) return !0;
9
+ if (t && e && typeof t == "object" && typeof e == "object") {
10
+ if (t.constructor !== e.constructor) return !1;
11
+ var r, o, u;
12
+ if (Array.isArray(t)) {
13
+ if (r = t.length, r != e.length) return !1;
14
+ for (o = r; o-- !== 0; )
15
+ if (!n(t[o], e[o])) return !1;
16
+ return !0;
17
+ }
18
+ if (t.constructor === RegExp) return t.source === e.source && t.flags === e.flags;
19
+ if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === e.valueOf();
20
+ if (t.toString !== Object.prototype.toString) return t.toString() === e.toString();
21
+ if (u = Object.keys(t), r = u.length, r !== Object.keys(e).length) return !1;
22
+ for (o = r; o-- !== 0; )
23
+ if (!Object.prototype.hasOwnProperty.call(e, u[o])) return !1;
24
+ for (o = r; o-- !== 0; ) {
25
+ var s = u[o];
26
+ if (!n(t[s], e[s])) return !1;
27
+ }
28
+ return !0;
29
+ }
30
+ return t !== t && e !== e;
31
+ }), a;
32
+ }
33
+ var q = j();
34
+ const x = /* @__PURE__ */ v(q);
35
+ function F(n) {
36
+ const t = y.c(9), {
37
+ children: e,
38
+ setDisplayedDocument: r,
39
+ documentId: o
40
+ } = n;
41
+ let u;
42
+ t[0] !== r ? (u = (l) => r((p) => x(p, l) ? p : l), t[0] = r, t[1] = u) : u = t[1];
43
+ const s = u;
44
+ let f, c;
45
+ t[2] !== o || t[3] !== r ? (f = () => {
46
+ if (o)
47
+ return;
48
+ const l = setTimeout(() => r(null));
49
+ return () => clearTimeout(l);
50
+ }, c = [o, r], t[2] = o, t[3] = r, t[4] = f, t[5] = c) : (f = t[4], c = t[5]), O(f, c);
51
+ let i;
52
+ return t[6] !== e || t[7] !== s ? (i = /* @__PURE__ */ D(d.Provider, { value: s, children: e }), t[6] = e, t[7] = s, t[8] = i) : i = t[8], i;
53
+ }
54
+ function A() {
55
+ return E(d);
56
+ }
57
+ export {
58
+ F as D,
59
+ x as i,
60
+ A as u
61
+ };
62
+ //# sourceMappingURL=DisplayedDocumentBroadcaster-DZ65n35Q.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DisplayedDocumentBroadcaster-DZ65n35Q.mjs","sources":["../../../node_modules/.pnpm/fast-deep-equal@3.1.3/node_modules/fast-deep-equal/index.js","../src/presentation/loader/DisplayedDocumentBroadcaster.tsx"],"sourcesContent":["'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","/**\n * Report back up the document state being displayed in the document pane,\n * allowing Presentation Tool to patch the live queries with the same state.\n * This makes the Perspective switcher less confusing, as it applies to everything else on the page.\n * It's also why it's possible to select an older revision and see it in the preview,\n * effectively letting you preview a revert action you might be considering to perform.\n */\n\nimport isEqual from 'fast-deep-equal'\nimport {type PropsWithChildren, useCallback, useContext, useEffect} from 'react'\nimport {type SanityDocument} from 'sanity'\nimport {PresentationDisplayedDocumentContext} from 'sanity/_singletons'\n\nimport {type PresentationDisplayedDocumentContextValue} from './types'\n\nexport interface DisplayedDocumentBroadcasterProps extends PropsWithChildren {\n setDisplayedDocument: React.Dispatch<\n React.SetStateAction<Partial<SanityDocument> | null | undefined>\n >\n documentId: string | null | undefined\n}\n\nexport function DisplayedDocumentBroadcasterProvider(\n props: DisplayedDocumentBroadcasterProps,\n): React.JSX.Element {\n const {children, setDisplayedDocument, documentId} = props\n\n const context = useCallback<PresentationDisplayedDocumentContextValue>(\n (next) => setDisplayedDocument((prev) => (isEqual(prev, next) ? prev : next)),\n [setDisplayedDocument],\n )\n\n useEffect(() => {\n // If no document is currently being displayed then reset the state\n if (documentId) {\n return undefined\n }\n const timeout = setTimeout(() => setDisplayedDocument(null))\n return () => clearTimeout(timeout)\n }, [documentId, setDisplayedDocument])\n\n return (\n <PresentationDisplayedDocumentContext.Provider value={context}>\n {children}\n </PresentationDisplayedDocumentContext.Provider>\n )\n}\n\nexport function useDisplayedDocumentBroadcaster(): PresentationDisplayedDocumentContextValue | null {\n return useContext(PresentationDisplayedDocumentContext)\n}\n"],"names":["fastDeepEqual","equal","a","b","length","i","keys","key","DisplayedDocumentBroadcasterProvider","props","$","_c","children","setDisplayedDocument","documentId","t0","next","prev","isEqual","context","t1","t2","timeout","setTimeout","clearTimeout","useEffect","t3","PresentationDisplayedDocumentContext","useDisplayedDocumentBroadcaster","useContext"],"mappings":";;;;;;sBAMAA,IAAiB,SAASC,EAAMC,GAAGC,GAAG;AACpC,QAAID,MAAMC,EAAG,QAAO;AAEpB,QAAID,KAAKC,KAAK,OAAOD,KAAK,YAAY,OAAOC,KAAK,UAAU;AAC1D,UAAID,EAAE,gBAAgBC,EAAE,YAAa,QAAO;AAE5C,UAAIC,GAAQC,GAAGC;AACf,UAAI,MAAM,QAAQJ,CAAC,GAAG;AAEpB,YADAE,IAASF,EAAE,QACPE,KAAUD,EAAE,OAAQ,QAAO;AAC/B,aAAKE,IAAID,GAAQC,QAAQ;AACvB,cAAI,CAACJ,EAAMC,EAAEG,CAAC,GAAGF,EAAEE,CAAC,CAAC,EAAG,QAAO;AACjC,eAAO;AAAA,MACb;AAII,UAAIH,EAAE,gBAAgB,OAAQ,QAAOA,EAAE,WAAWC,EAAE,UAAUD,EAAE,UAAUC,EAAE;AAC5E,UAAID,EAAE,YAAY,OAAO,UAAU,QAAS,QAAOA,EAAE,QAAO,MAAOC,EAAE,QAAS;AAC9E,UAAID,EAAE,aAAa,OAAO,UAAU,SAAU,QAAOA,EAAE,SAAQ,MAAOC,EAAE,SAAU;AAIlF,UAFAG,IAAO,OAAO,KAAKJ,CAAC,GACpBE,IAASE,EAAK,QACVF,MAAW,OAAO,KAAKD,CAAC,EAAE,OAAQ,QAAO;AAE7C,WAAKE,IAAID,GAAQC,QAAQ;AACvB,YAAI,CAAC,OAAO,UAAU,eAAe,KAAKF,GAAGG,EAAKD,CAAC,CAAC,EAAG,QAAO;AAEhE,WAAKA,IAAID,GAAQC,QAAQ,KAAI;AAC3B,YAAIE,IAAMD,EAAKD,CAAC;AAEhB,YAAI,CAACJ,EAAMC,EAAEK,CAAG,GAAGJ,EAAEI,CAAG,CAAC,EAAG,QAAO;AAAA,MACzC;AAEI,aAAO;AAAA,IACX;AAGE,WAAOL,MAAIA,KAAKC,MAAIA;AAAA,EACrB;;;;ACvBM,SAAAK,EAAAC,GAAA;AAAAC,QAAAA,IAAAC,IAAA,CAAA,GAGL;AAAA,IAAAC,UAAAA;AAAAA,IAAAC,sBAAAA;AAAAA,IAAAC,YAAAA;AAAAA,EAAAA,IAAqDL;AAAKM,MAAAA;AAAAL,EAAAA,SAAAG,KAGxDG,IAAAA,CAAAA,MAAUH,EAAoBI,CAAYC,MAAAA,EAAQD,GAAMD,CAAI,IAAIC,IAAOD,CAAK,GAACN,OAAAG,GAAAH,OAAAK,KAAAA,IAAAL,EAAA,CAAA;AAD/E,QAAAS,IAAgBJ;AAGfK,MAAAA,GAAAC;AAAA,EAAAX,EAAAI,CAAAA,MAAAA,KAAAJ,SAAAG,KAESO,IAAAA,MAAA;AAAA,QAEJN;AAAU;AAGd,UAAAQ,IAAgBC,iBAAiBV,EAAoB,IAAK,CAAC;AAC9CW,WAAAA,MAAAA,aAAaF,CAAO;AAAA,EAAC,GACjCD,IAAA,CAACP,GAAYD,CAAoB,GAACH,OAAAI,GAAAJ,OAAAG,GAAAH,OAAAU,GAAAV,OAAAW,MAAAD,IAAAV,EAAA,CAAA,GAAAW,IAAAX,EAAA,CAAA,IAPrCe,EAAUL,GAOPC,CAAkC;AAACK,MAAAA;AAAA,SAAAhB,EAAAE,CAAAA,MAAAA,KAAAF,SAAAS,KAGpCO,sBAAAC,EAAA,UAAA,EAAsDR,OAAAA,GACnDP,UAAAA,GACH,GAAgDF,OAAAE,GAAAF,OAAAS,GAAAT,OAAAgB,KAAAA,IAAAhB,EAAA,CAAA,GAFhDgB;AAEgD;AAI7C,SAAAE,IAAA;AAAA,SACEC,EAAAF,CAA+C;AAAC;","x_google_ignoreList":[0]}
@@ -0,0 +1,407 @@
1
+ import { jsx as Q, Fragment as J } from "react/jsx-runtime";
2
+ import { d as P } from "./index-C9NvTy6s.mjs";
3
+ import { w as V, g as H, e as B, h as C, r as D, p as K, j as Y, k as z } from "./index-RoxwhtVB.mjs";
4
+ import { c as F } from "./index-DCkQlgdi.mjs";
5
+ import { c as G } from "./PresentationToolGrantsCheck-B0q4AQ3b.mjs";
6
+ import { i as T } from "./DisplayedDocumentBroadcaster-DZ65n35Q.mjs";
7
+ import { useReducer as j, useState as M, useEffect as R, useDeferredValue as x, memo as W, startTransition as X } from "react";
8
+ import { useProjectId as Z, useDataset as ee, RELEASES_STUDIO_CLIENT_OPTIONS as te, isReleasePerspective as re, useClient as se } from "sanity";
9
+ import { e as ne } from "./v4-zH-CAum7.mjs";
10
+ import { L as ie, A as oe, M as N } from "./presentation-DsIky7Cj.mjs";
11
+ import { i as ae, t as ce } from "./index-wVXq9rWS.mjs";
12
+ function ue(t) {
13
+ if (Array.isArray(t) && t.length > 1 && t.includes("raw"))
14
+ throw new TypeError(
15
+ 'Invalid API perspective value: "raw". The raw-perspective can not be combined with other perspectives'
16
+ );
17
+ }
18
+ function le(t) {
19
+ if (ue(t), Array.isArray(t))
20
+ return t.includes("published") ? t : [...t, "published"];
21
+ switch (t) {
22
+ case "previewDrafts":
23
+ case "drafts":
24
+ return ["drafts", "published"];
25
+ case "published":
26
+ default:
27
+ return ["published"];
28
+ }
29
+ }
30
+ function fe(t, e) {
31
+ const i = le(e);
32
+ function o(r) {
33
+ for (const n of i) {
34
+ let s = null;
35
+ if (n.startsWith("r") && (s = t({
36
+ ...r,
37
+ _id: H(r._id, n)
38
+ })), n === "drafts" && (s = t({
39
+ ...r,
40
+ _id: B(r._id)
41
+ })), n === "published" && (s = t({
42
+ ...r,
43
+ _id: C(r._id)
44
+ })), s)
45
+ return { ...s, _id: C(s._id), _originalId: s._id };
46
+ }
47
+ return null;
48
+ }
49
+ return function(r) {
50
+ return o(r);
51
+ };
52
+ }
53
+ function pe(t, e, i, o, r) {
54
+ var h, d;
55
+ if (!e) return t;
56
+ const n = fe(i, r), s = ((d = (h = e.documents) == null ? void 0 : h.map) == null ? void 0 : d.call(h, n)) || [];
57
+ return V(JSON.parse(JSON.stringify(t)), (l, f) => {
58
+ const p = D(f, e);
59
+ if (!p)
60
+ return l;
61
+ const { mapping: c, pathSuffix: g } = p;
62
+ if (c.type !== "value" || c.source.type !== "documentValue")
63
+ return l;
64
+ const b = e.documents[c.source.document], v = e.paths[c.source.path];
65
+ if (b) {
66
+ const w = K(v + g), E = Y(w), y = s[c.source.document];
67
+ if (!y)
68
+ return l;
69
+ const S = y ? z(y, E, l) : l;
70
+ return l === S ? l : o(S, {
71
+ cachedDocument: y,
72
+ previousValue: l,
73
+ sourceDocument: b,
74
+ sourcePath: w
75
+ });
76
+ }
77
+ return l;
78
+ });
79
+ }
80
+ function de(t, e) {
81
+ switch (e.type) {
82
+ case "message":
83
+ return {
84
+ ...t,
85
+ messages: [...t.messages, e]
86
+ };
87
+ case "reconnect":
88
+ case "restart":
89
+ return {
90
+ ...t,
91
+ messages: [],
92
+ resets: t.resets + 1
93
+ };
94
+ case "welcome":
95
+ return t;
96
+ default:
97
+ throw Error(`Unknown event: ${// eslint-disable-next-line @typescript-eslint/no-explicit-any
98
+ e.type}`, {
99
+ cause: e
100
+ });
101
+ }
102
+ }
103
+ const he = {
104
+ messages: [],
105
+ resets: 0
106
+ };
107
+ function me(t) {
108
+ const e = P.c(3), [i, o] = j(de, he), [r, n] = M(null);
109
+ if (r !== null)
110
+ throw r;
111
+ let s, h;
112
+ return e[0] !== t.live ? (s = () => {
113
+ const d = t.live.events({
114
+ includeDrafts: !0,
115
+ tag: "presentation-loader"
116
+ }).subscribe({
117
+ next: o,
118
+ error: (l) => n(l instanceof Error ? l : new Error("Unexpected error in useLiveEvents", {
119
+ cause: l
120
+ }))
121
+ });
122
+ return () => d.unsubscribe();
123
+ }, h = [t.live], e[0] = t.live, e[1] = s, e[2] = h) : (s = e[1], h = e[2]), R(s, h), x(i);
124
+ }
125
+ const ye = (t, {
126
+ previousValue: e
127
+ }) => {
128
+ if (typeof e == "string") {
129
+ if (typeof t == "number")
130
+ return `${t}`;
131
+ if (Array.isArray(t)) {
132
+ if (t.length === 0)
133
+ return "";
134
+ if (t.some((i) => typeof i == "object" && ae(i)))
135
+ return ce(t);
136
+ }
137
+ }
138
+ return t;
139
+ };
140
+ function be(t, e, i) {
141
+ return `${t}:${e}:${JSON.stringify(i)}`;
142
+ }
143
+ function ge(t) {
144
+ if (t.queries.size < 1)
145
+ return t;
146
+ const e = Date.now();
147
+ if (!Array.from(t.heartbeats.values()).some((n) => n.heartbeat !== !1 && e > n.receivedAt + n.heartbeat))
148
+ return t;
149
+ const o = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map();
150
+ for (const [n, s] of t.heartbeats.entries())
151
+ s.heartbeat !== !1 && e > s.receivedAt + s.heartbeat || (o.set(n, s), r.set(n, t.queries.get(n)));
152
+ return {
153
+ ...t,
154
+ queries: r,
155
+ heartbeats: o
156
+ };
157
+ }
158
+ function ve(t, {
159
+ payload: e
160
+ }) {
161
+ const i = be(e.perspective, e.query, e.params), o = {
162
+ query: e.query,
163
+ params: e.params,
164
+ perspective: e.perspective
165
+ }, r = new Map(t.heartbeats);
166
+ r.set(i, {
167
+ receivedAt: Date.now(),
168
+ heartbeat: e.heartbeat
169
+ });
170
+ let n = t.queries;
171
+ return (!t.queries.has(i) || !T(t.queries.get(i), o)) && (n = new Map(t.queries), n.set(i, o)), {
172
+ heartbeats: r,
173
+ queries: n
174
+ };
175
+ }
176
+ function we(t, e) {
177
+ switch (e.type) {
178
+ case "query-listen":
179
+ return ve(t, e);
180
+ case "gc":
181
+ return ge(t);
182
+ default:
183
+ throw Error(`Unknown action: ${// eslint-disable-next-line @typescript-eslint/no-explicit-any
184
+ e.type}`, {
185
+ cause: e
186
+ });
187
+ }
188
+ }
189
+ const Ee = {
190
+ queries: /* @__PURE__ */ new Map(),
191
+ heartbeats: /* @__PURE__ */ new Map()
192
+ };
193
+ function Se() {
194
+ const t = P.c(4), [e, i] = j(we, Ee);
195
+ let o, r;
196
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (o = () => {
197
+ const h = setInterval(() => i({
198
+ type: "gc"
199
+ }), ie);
200
+ return () => clearInterval(h);
201
+ }, r = [], t[0] = o, t[1] = r) : (o = t[0], r = t[1]), R(o, r);
202
+ const n = x(e.queries);
203
+ let s;
204
+ return t[2] !== n ? (s = [n, i], t[2] = n, t[3] = s) : s = t[3], s;
205
+ }
206
+ function Oe(t) {
207
+ const e = P.c(28), {
208
+ controller: i,
209
+ perspective: o,
210
+ onLoadersConnection: r,
211
+ onDocumentsOnPage: n
212
+ } = t, [s, h] = M(), [d, l] = Se(), f = Z(), p = ee();
213
+ let c, g;
214
+ e[0] !== i || e[1] !== p || e[2] !== l || e[3] !== n || e[4] !== r || e[5] !== f ? (c = () => {
215
+ if (i) {
216
+ const u = i.createChannel({
217
+ name: "presentation",
218
+ connectTo: "loaders",
219
+ heartbeat: !0
220
+ }, F().provide({
221
+ actors: G()
222
+ }));
223
+ return h(u), u.onStatus(r), u.on("loader/documents", (a) => {
224
+ a.projectId === f && a.dataset === p && n("loaders", a.perspective, a.documents);
225
+ }), u.on("loader/query-listen", (a) => {
226
+ if (a.projectId === f && a.dataset === p) {
227
+ if (typeof a.heartbeat == "number" && a.heartbeat < N)
228
+ throw new Error(`Loader query listen heartbeat interval must be at least ${N}ms`);
229
+ l({
230
+ type: "query-listen",
231
+ payload: {
232
+ perspective: a.perspective,
233
+ query: a.query,
234
+ params: a.params,
235
+ heartbeat: a.heartbeat ?? !1
236
+ }
237
+ });
238
+ }
239
+ }), u.start();
240
+ }
241
+ return qe;
242
+ }, g = [i, p, l, n, r, f], e[0] = i, e[1] = p, e[2] = l, e[3] = n, e[4] = r, e[5] = f, e[6] = c, e[7] = g) : (c = e[6], g = e[7]), R(c, g);
243
+ let b;
244
+ e[8] !== o ? (b = re(o) ? te : {
245
+ apiVersion: oe
246
+ }, e[8] = o, e[9] = b) : b = e[9];
247
+ const v = se(b);
248
+ let w, E;
249
+ e[10] !== v ? (E = v.withConfig({
250
+ resultSourceMap: "withKeyArraySelector"
251
+ }), e[10] = v, e[11] = E) : E = e[11], w = E;
252
+ const y = w;
253
+ let S, _;
254
+ e[12] !== o || e[13] !== s || e[14] !== p || e[15] !== f ? (S = () => {
255
+ s && s.post("loader/perspective", {
256
+ projectId: f,
257
+ dataset: p,
258
+ perspective: o
259
+ });
260
+ }, _ = [s, o, f, p], e[12] = o, e[13] = s, e[14] = p, e[15] = f, e[16] = S, e[17] = _) : (S = e[16], _ = e[17]), R(S, _);
261
+ const I = x(t.liveDocument), A = me(y);
262
+ let q;
263
+ e[18] !== d ? (q = [...d.entries()], e[18] = d, e[19] = q) : q = e[19];
264
+ let m;
265
+ return e[20] !== y || e[21] !== s || e[22] !== p || e[23] !== I || e[24] !== A || e[25] !== f || e[26] !== q ? (m = /* @__PURE__ */ Q(J, { children: q.map((u) => {
266
+ const [a, L] = u, {
267
+ query: $,
268
+ params: O,
269
+ perspective: U
270
+ } = L;
271
+ return /* @__PURE__ */ Q(k, { projectId: f, dataset: p, perspective: U, query: $, params: O, comlink: s, client: y, liveDocument: I, liveEventsMessages: A.messages }, `${A.resets}:${a}`);
272
+ }) }), e[20] = y, e[21] = s, e[22] = p, e[23] = I, e[24] = A, e[25] = f, e[26] = q, e[27] = m) : m = e[27], m;
273
+ }
274
+ function qe() {
275
+ }
276
+ function Ae(t) {
277
+ const e = P.c(20), {
278
+ projectId: i,
279
+ dataset: o,
280
+ perspective: r,
281
+ query: n,
282
+ client: s,
283
+ liveDocument: h,
284
+ params: d,
285
+ comlink: l,
286
+ liveEventsMessages: f
287
+ } = t, {
288
+ result: p,
289
+ resultSourceMap: c,
290
+ syncTags: g
291
+ } = Ie({
292
+ client: s,
293
+ liveDocument: h,
294
+ params: d,
295
+ perspective: r,
296
+ query: n,
297
+ liveEventsMessages: f
298
+ }) || {};
299
+ let b;
300
+ e[0] !== o || e[1] !== i ? (b = (y, S, _, I, A, q, m) => {
301
+ y == null || y.post("loader/query-change", {
302
+ projectId: i,
303
+ dataset: o,
304
+ perspective: S,
305
+ query: _,
306
+ params: I,
307
+ result: A,
308
+ resultSourceMap: q,
309
+ tags: m
310
+ });
311
+ }, e[0] = o, e[1] = i, e[2] = b) : b = e[2];
312
+ const v = ne(b);
313
+ let w;
314
+ e[3] !== l || e[4] !== v || e[5] !== d || e[6] !== r || e[7] !== n || e[8] !== p || e[9] !== c || e[10] !== g ? (w = () => {
315
+ c && v(l, r, n, d, p, c, g);
316
+ }, e[3] = l, e[4] = v, e[5] = d, e[6] = r, e[7] = n, e[8] = p, e[9] = c, e[10] = g, e[11] = w) : w = e[11];
317
+ let E;
318
+ return e[12] !== l || e[13] !== d || e[14] !== r || e[15] !== n || e[16] !== p || e[17] !== c || e[18] !== g ? (E = [l, d, r, n, p, c, g], e[12] = l, e[13] = d, e[14] = r, e[15] = n, e[16] = p, e[17] = c, e[18] = g, e[19] = E) : E = e[19], R(w, E), null;
319
+ }
320
+ const k = W(Ae);
321
+ k.displayName = "Memo(QuerySubscription)";
322
+ function Ie(t) {
323
+ const e = P.c(30), {
324
+ liveDocument: i,
325
+ client: o,
326
+ query: r,
327
+ params: n,
328
+ perspective: s,
329
+ liveEventsMessages: h
330
+ } = t, [d, l] = M(null), [f, p] = M(null), [c, g] = M(void 0);
331
+ let b;
332
+ e[0] !== h ? (b = () => new Set(h.map(_e)), e[0] = h, e[1] = b) : b = e[1];
333
+ const [v] = M(b);
334
+ let w;
335
+ if (e[2] !== h || e[3] !== v || e[4] !== c) {
336
+ let m;
337
+ e[6] !== v ? (m = (L) => !v.has(L.id), e[6] = v, e[7] = m) : m = e[7];
338
+ const u = h.filter(m);
339
+ let a;
340
+ e[8] !== c ? (a = (L) => L.tags.some(($) => c == null ? void 0 : c.includes($)), e[8] = c, e[9] = a) : a = e[9], w = u.findLast(a), e[2] = h, e[3] = v, e[4] = c, e[5] = w;
341
+ } else
342
+ w = e[5];
343
+ const E = w, y = E == null ? void 0 : E.id, [S, _] = M(null);
344
+ if (S)
345
+ throw S;
346
+ let I, A;
347
+ e[10] !== o || e[11] !== y || e[12] !== n || e[13] !== s || e[14] !== r ? (I = () => {
348
+ const m = new AbortController();
349
+ return o.fetch(r, n, {
350
+ lastLiveEventId: y,
351
+ tag: "presentation-loader",
352
+ signal: m.signal,
353
+ perspective: s,
354
+ filterResponse: !1,
355
+ returnQuery: !1
356
+ }).then((u) => {
357
+ X(() => {
358
+ l((a) => T(a, u.result) ? a : u.result), p((a) => T(a, u.resultSourceMap) ? a : u.resultSourceMap), g((a) => T(a, u.syncTags) ? a : u.syncTags);
359
+ });
360
+ }).catch((u) => {
361
+ (typeof u != "object" || (u == null ? void 0 : u.name) !== "AbortError") && _(u);
362
+ }), () => {
363
+ m.abort();
364
+ };
365
+ }, A = [o, y, n, s, r], e[10] = o, e[11] = y, e[12] = n, e[13] = s, e[14] = r, e[15] = I, e[16] = A) : (I = e[15], A = e[16]), R(I, A);
366
+ let q;
367
+ e: {
368
+ if (i && f) {
369
+ let u;
370
+ e[17] !== i || e[18] !== s || e[19] !== d || e[20] !== f ? (u = Me(i, d, s, f), e[17] = i, e[18] = s, e[19] = d, e[20] = f, e[21] = u) : u = e[21];
371
+ let a;
372
+ e[22] !== f || e[23] !== c || e[24] !== u ? (a = {
373
+ result: u,
374
+ resultSourceMap: f,
375
+ syncTags: c
376
+ }, e[22] = f, e[23] = c, e[24] = u, e[25] = a) : a = e[25], q = a;
377
+ break e;
378
+ }
379
+ let m;
380
+ e[26] !== d || e[27] !== f || e[28] !== c ? (m = {
381
+ result: d,
382
+ resultSourceMap: f,
383
+ syncTags: c
384
+ }, e[26] = d, e[27] = f, e[28] = c, e[29] = m) : m = e[29], q = m;
385
+ }
386
+ return q;
387
+ }
388
+ function _e(t) {
389
+ return t.id;
390
+ }
391
+ function Me(t, e, i, o) {
392
+ if (i === "raw")
393
+ throw new Error("turboChargeResultIfSourceMap does not support raw perspective");
394
+ return pe(e, o, (r) => (
395
+ // If _projectId is set, it's a cross dataset reference and we should skip it
396
+ !r._projectId && (t != null && t._id) && C(t._id) === C(r._id) ? typeof t._id == "string" && typeof r._type == "string" ? t : {
397
+ ...t,
398
+ _id: t._id || r._id,
399
+ _type: t._type || r._type
400
+ } : null
401
+ ), ye, i);
402
+ }
403
+ export {
404
+ Oe as default,
405
+ Me as turboChargeResultIfSourceMap
406
+ };
407
+ //# sourceMappingURL=LiveQueries-Crz53eU5.mjs.map