@pickaxeproject/react 1.1.4 → 1.1.6

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 (47) hide show
  1. package/dist/cjs/components/Icons/copied-new.svg.js +1 -0
  2. package/dist/cjs/components/Icons/copy-new.svg.js +1 -0
  3. package/dist/cjs/components/Icons/pickaxe.svg.js +1 -1
  4. package/dist/cjs/components/Pickaxe/Addons/Scroll/hooks/useScroll.js +1 -1
  5. package/dist/cjs/components/Pickaxe/Chat/History/Message.js +1 -1
  6. package/dist/cjs/components/Pickaxe/Chat/History/index.js +1 -1
  7. package/dist/cjs/components/Pickaxe/Chat/Input.js +1 -1
  8. package/dist/cjs/components/Pickaxe/Form/History/Response.js +1 -1
  9. package/dist/cjs/components/Pickaxe/Form/Questions/Document.js +1 -1
  10. package/dist/cjs/components/Pickaxe/Form/Questions/Submit.js +1 -1
  11. package/dist/cjs/components/Pickaxe/common/PickaxeBranding.js +1 -1
  12. package/dist/cjs/components/Pickaxe/common/PickaxeCopyButton.js +1 -1
  13. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.js +1 -1
  14. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/Code/index.js +1 -1
  15. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Custom/Img/index.js +1 -1
  16. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
  17. package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/index.js +1 -1
  18. package/dist/cjs/components/Pickaxe/common/PickaxeSimpleButton.js +1 -1
  19. package/dist/cjs/prose.css +1 -1
  20. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/hooks/usePickaxeMarkdownContext.d.ts +1 -0
  21. package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/index.d.ts +3 -1
  22. package/dist/esm/components/Icons/copied-new.svg.js +1 -0
  23. package/dist/esm/components/Icons/copy-new.svg.js +1 -0
  24. package/dist/esm/components/Icons/pickaxe.svg.js +1 -1
  25. package/dist/esm/components/Pickaxe/Addons/Scroll/hooks/useScroll.js +1 -1
  26. package/dist/esm/components/Pickaxe/Chat/History/Message.js +1 -1
  27. package/dist/esm/components/Pickaxe/Chat/History/index.js +1 -1
  28. package/dist/esm/components/Pickaxe/Chat/Input.js +1 -1
  29. package/dist/esm/components/Pickaxe/Form/History/Response.js +1 -1
  30. package/dist/esm/components/Pickaxe/Form/Questions/Document.js +1 -1
  31. package/dist/esm/components/Pickaxe/Form/Questions/Submit.js +1 -1
  32. package/dist/esm/components/Pickaxe/common/PickaxeBranding.js +1 -1
  33. package/dist/esm/components/Pickaxe/common/PickaxeCopyButton.js +1 -1
  34. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/A/index.js +1 -1
  35. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/Code/index.js +1 -1
  36. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Custom/Img/index.js +1 -1
  37. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
  38. package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/index.js +1 -1
  39. package/dist/esm/components/Pickaxe/common/PickaxeSimpleButton.js +1 -1
  40. package/dist/esm/prose.css +1 -1
  41. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/hooks/usePickaxeMarkdownContext.d.ts +1 -0
  42. package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/index.d.ts +3 -1
  43. package/package.json +1 -1
  44. package/dist/cjs/components/Icons/copied.svg.js +0 -1
  45. package/dist/cjs/components/Icons/copy.svg.js +0 -1
  46. package/dist/esm/components/Icons/copied.svg.js +0 -1
  47. package/dist/esm/components/Icons/copy.svg.js +0 -1
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}Object.defineProperty(exports,"__esModule",{value:!0});var r,t=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},n.apply(null,arguments)}var c=e=>t.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16"},e),r||(r=t.createElement("path",{fill:"currentColor",d:"M5 15.333h8c.733 0 1.333-.6 1.333-1.333V4.667H13V14H5zm-2-2.666h7.333c.734 0 1.334-.6 1.334-1.334V2c0-.733-.6-1.333-1.334-1.333H3c-.733 0-1.333.6-1.333 1.333v9.333c0 .734.6 1.334 1.333 1.334"})));exports.default=c;
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}Object.defineProperty(exports,"__esModule",{value:!0});var r,t=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},n.apply(null,arguments)}var c=e=>t.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16"},e),r||(r=t.createElement("path",{fill:"currentColor",d:"M5 15.333h8c.733 0 1.333-.6 1.333-1.333V4.667H13V14H5zm-2-2.666h7.333c.733 0 1.333-.6 1.333-1.334V2c0-.733-.6-1.333-1.333-1.333H3c-.734 0-1.334.6-1.334 1.333v9.333c0 .734.6 1.334 1.334 1.334M3 2h7.333v9.333H3z"})));exports.default=c;
@@ -1 +1 @@
1
- "use strict";function e(e){if(e&&e.__esModule)return e;var c=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(c,t,a.get?a:{enumerable:!0,get:function(){return e[t]}})}})),c.default=e,Object.freeze(c)}Object.defineProperty(exports,"__esModule",{value:!0});var c,t,a,r,n=e(require("react"));function l(){return l=Object.assign?Object.assign.bind():function(e){for(var c=1;c<arguments.length;c++){var t=arguments[c];for(var a in t)({}).hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},l.apply(null,arguments)}var i=e=>n.createElement("svg",l({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18"},e),c||(c=n.createElement("path",{fill:"#1C1C1C",d:"M15.014 17.998c-.74-.29-1.195-.922-1.73-1.451-1.31-1.296-2.605-2.606-3.907-3.91-.18-.18-.359-.364-.55-.533a1.45 1.45 0 0 1-.418-.633c-.161-.483-.458-.867-.829-1.208-.714-.656-1.382-1.359-2.067-2.045-.167-.166-.17-.174-.329.003-.09.1-.14.104-.237.001-.285-.302-.587-.589-.876-.887-.106-.11-.164-.11-.267.018-.658.82-.97 1.758-.991 2.799-.01.497-.005.937.002 1.435.002.125-.071.204-.215.21a27 27 0 0 0-.954.005c-.654-.03-1.138-.343-1.456-.915-.127-.211-.158-.241-.19-.342V9.68l.093-.885c.11-.964.394-1.878.778-2.765.243-.56.551-1.082.876-1.596.03-.048.055-.082.032-.145-.18-.51-.106-.99.253-1.388.344-.381.68-.784 1.131-1.05.342-.202.717-.222 1.092-.099.087.029.139.023.209-.024a9.8 9.8 0 0 1 1.872-1A10 10 0 0 1 8.702.092a10 10 0 0 1 1.434-.098c.657.01 1.123.335 1.458.878.16.262.224.55.22.856-.005.3 0 0 .002.867.006.147-.097.213-.234.212-.57-.003-1.09-.017-1.66.011a4.3 4.3 0 0 0-2.564.978c-.13.107-.116.168-.011.27.287.275.564.561.853.835.118.112.152.2-.002.305-.12.081-.12.15-.006.264q1.177 1.17 2.335 2.357c.253.259.554.428.885.554.299.114.553.286.78.515 1.507 1.518 3.022 3.03 4.533 4.544.314.315.641.617.932.956.374.436.447 1.21.196 1.72-.219.444-.6.734-.925 1.076-.24.254-.473.519-.81.659-.076.032-.166.042-.238.085 0 0-.177.044-.403.062-.18.015-.462 0-.462 0zM3.214 4.324c.005.07-.05.107-.084.153-.141.19-.293.374-.426.57a9 9 0 0 0-1.329 3.027c-.155.663-.22 1.334-.24 2.011-.008.269.128.438.375.553.145.068.174.03.175-.114 0-.485-.002-.967.098-1.449a5.9 5.9 0 0 1 .556-1.543c.364-.692.87-1.273 1.448-1.796.12-.109.196-.1.303.01.284.292.583.571.862.869.097.102.15.081.227-.005.054-.062.104-.132.192-.152.023.034.04.074.07.102 1.046 1.045 2.09 2.093 3.143 3.132.314.309.59.63.731 1.06q.125.38.424.674c1.228 1.217 2.445 2.444 3.668 3.666.546.545 1.091 1.091 1.647 1.626.23.222.519.213.754-.01q.449-.425.88-.867c.272-.28.259-.582-.024-.865-1.593-1.594-3.188-3.184-4.774-4.784-.432-.435-.862-.857-1.472-1.035a.7.7 0 0 1-.307-.18Q8.997 7.857 7.88 6.74c-.468-.467-.94-.928-1.41-1.392a.33.33 0 0 1 .133-.163c.115-.084.112-.152.008-.252-.294-.284-.577-.581-.869-.869-.098-.097-.114-.172-.003-.278.188-.18.359-.378.551-.557a5.75 5.75 0 0 1 3.137-1.514c.364-.054.73-.039 1.096-.035.15.001.174-.037.115-.177-.107-.254-.28-.384-.566-.377-.925.023-1.831.152-2.715.444a9.2 9.2 0 0 0-2.434 1.218c-.198.139-.366.32-.59.42-.109-.11-.212-.224-.326-.327-.12-.107-.261-.104-.373.001q-.383.362-.745.745c-.112.12-.11.26.01.384q.156.158.315.313"})),t||(t=n.createElement("path",{fill:"#EBA300",d:"M6.474 5.344c.47.464.943.926 1.41 1.393q1.117 1.116 2.232 2.237a.7.7 0 0 0 .306.18c.61.177 1.04.6 1.472 1.034 1.586 1.6 3.182 3.191 4.774 4.785.283.283.296.584.023.864a30 30 0 0 1-.879.868c-.234.222-.523.232-.754.01-.555-.535-1.1-1.081-1.647-1.626-1.223-1.222-2.44-2.45-3.668-3.666a1.7 1.7 0 0 1-.423-.674c-.142-.43-.418-.751-.731-1.06-1.053-1.04-2.097-2.087-3.144-3.132-.029-.029-.047-.068-.07-.103.095-.201.289-.312.434-.467.21-.225.423-.45.664-.643"})),a||(a=n.createElement("path",{fill:"#CCC",d:"M6.472 5.347a6.4 6.4 0 0 0-.665.643c-.145.155-.339.266-.434.467-.088.02-.138.091-.192.153-.076.086-.13.107-.226.004-.28-.297-.578-.576-.863-.869-.107-.11-.183-.118-.303-.01-.578.524-1.084 1.104-1.448 1.797q-.385.729-.555 1.543c-.101.482-.099.964-.1 1.449 0 .145-.029.182-.174.114-.246-.115-.383-.284-.375-.553.02-.677.085-1.348.24-2.011a9 9 0 0 1 1.33-3.027c.132-.197.284-.38.425-.57.035-.046.09-.084.085-.153.006 0 .015.003.017 0q.529-.57 1.1-1.099c.003-.003 0-.012 0-.018.225-.1.394-.28.591-.42A9.2 9.2 0 0 1 7.36 1.57c.883-.292 1.789-.421 2.714-.444.287-.007.459.123.566.377.06.14.035.179-.115.177-.366-.003-.733-.018-1.096.035a5.75 5.75 0 0 0-3.137 1.515c-.192.178-.363.376-.551.557-.111.106-.095.18.004.278.29.288.574.584.868.868.104.1.107.169-.007.253a.34.34 0 0 0-.134.162"})),r||(r=n.createElement("path",{fill:"#EBA300",d:"M4.338 3.21q.002.012-.001.018-.571.529-1.1 1.099c-.002.003-.011 0-.017 0q-.159-.155-.316-.313c-.12-.124-.121-.264-.009-.384q.362-.383.745-.745c.112-.105.253-.109.373 0 .114.102.217.216.325.326"})));exports.default=i;
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}Object.defineProperty(exports,"__esModule",{value:!0});var r,t,n=e(require("react"));function l(){return l=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},l.apply(null,arguments)}var c=e=>n.createElement("svg",l({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48"},e),r||(r=n.createElement("path",{fill:"currentColor",d:"m24.547 19.397-19.538 19.5L9.121 43 28.66 23.5z"})),t||(t=n.createElement("path",{fill:"currentColor",d:"m35.752 16.428 2.158-2.154-4.11-4.102-2.158 2.154A31.57 31.57 0 0 0 11.378 5v5.804c14.268 0 25.886 11.596 25.886 25.835h5.815c0-7.674-2.753-14.73-7.34-20.211z"})));exports.default=c;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./useScrollContext.js");exports.useScroll=({auto:o})=>{const{scrollContainerRef:l,scrollTargetRef:t,isLocked:n,isScrollSession:s,isScrollIncreasing:c,setIsLocked:u,setIsScrollSession:i,setIsScrolling:d,setIsScrollIncreasing:v}=r.useScrollContext(),[a,f]=e.useState(0),E=e.useRef(!1),S=e.useMemo((()=>l&&l.current?l.current:"undefined"==typeof window?null:window),[l]);e.useEffect((()=>{if(!S)return;const e=e=>{s&&n&&("mousedown"===e.type||"wheel"===e.type||"DOMMouseScroll"===e.type||"mousewheel"===e.type)&&u(!1)};return null==S||S.addEventListener("scroll",e),null==S||S.addEventListener("mousedown",e),null==S||S.addEventListener("wheel",e),null==S||S.addEventListener("DOMMouseScroll",e),null==S||S.addEventListener("mousewheel",e),()=>{null==S||S.removeEventListener("scroll",e),null==S||S.removeEventListener("mousedown",e),null==S||S.removeEventListener("wheel",e),null==S||S.removeEventListener("DOMMouseScroll",e),null==S||S.removeEventListener("mousewheel",e)}}),[S,s,n]),e.useEffect((()=>{E.current=!n}),[n]),e.useEffect((()=>{const e=setInterval((()=>{if(l.current){const e=l.current.scrollHeight;if(e===a)return;const r=e>a;v(r),f(e),r&&o&&m()}}),100);return()=>clearInterval(e)}),[l,a]);const m=()=>{try{if(d(!0),!l.current)return void("development"===process.env.NODE_ENV&&console.log("[useScroll] scrollContainerRef not detected"));if(E.current)return;const e=l.current.scrollHeight;l.current.scrollTo({top:e,behavior:"smooth"}),"development"===process.env.NODE_ENV&&console.log("[useScroll] scrolled scrollContainerRef")}finally{d(!1)}};return{isScrollIncreasing:c,scrollStartSession:()=>{i(!0),u(!0),E.current=!1},scrollEndSession:()=>{i(!1)},scrollToBottom:m,scrollToTarget:()=>{try{d(!0);const e=l.current||window;if(!t.current)return void("development"===process.env.NODE_ENV&&console.log("[useScroll] scrollTargetRef not detected"));const r=e.scrollHeight;e.scrollTo({top:r,behavior:"smooth"}),"development"===process.env.NODE_ENV&&console.log("[useScroll] scrolled scrollTargetRef")}finally{d(!1)}}}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("./useScrollContext.js");exports.useScroll=({auto:t})=>{const{scrollContainerRef:n,scrollTargetRef:o,isLocked:l,isScrollSession:s,isScrollIncreasing:c,setIsLocked:u,setIsScrollSession:i,setIsScrolling:d,setIsScrollIncreasing:v}=r.useScrollContext(),[a,f]=e.useState(0),g=e.useRef(!1),E=e.useMemo((()=>n&&n.current?n.current:"undefined"==typeof window?null:window),[n]);e.useEffect((()=>{if(!E)return;const e=e=>{s&&l&&("mousedown"===e.type||"wheel"===e.type||"DOMMouseScroll"===e.type||"mousewheel"===e.type)&&u(!1)};return null==E||E.addEventListener("scroll",e),null==E||E.addEventListener("mousedown",e),null==E||E.addEventListener("wheel",e),null==E||E.addEventListener("DOMMouseScroll",e),null==E||E.addEventListener("mousewheel",e),()=>{null==E||E.removeEventListener("scroll",e),null==E||E.removeEventListener("mousedown",e),null==E||E.removeEventListener("wheel",e),null==E||E.removeEventListener("DOMMouseScroll",e),null==E||E.removeEventListener("mousewheel",e)}}),[E,s,l]),e.useEffect((()=>{g.current=!l}),[l]),e.useEffect((()=>{const e=setInterval((()=>{if(!n.current)return;const e=n.current.scrollHeight;if(e===a)return;const r=e>a;v(r),f(e),r&&t&&S()}),100);return()=>clearInterval(e)}),[n,a]),e.useEffect((()=>{const e=setInterval((()=>{if(n.current)return;if(!o.current)return;const e=o.current.getBoundingClientRect().top+o.current.getBoundingClientRect().height+window.scrollY;if(e===a)return;const r=e>a;v(r),f(e),r&&t&&p()}),100);return()=>clearInterval(e)}),[o,a]);const S=()=>{try{if(d(!0),!n.current)return void("development"===process.env.NODE_ENV&&console.log("[useScroll] scrollContainerRef not detected"));if(g.current)return;const e=n.current.scrollHeight;n.current.scrollTo({top:e,behavior:"smooth"}),"development"===process.env.NODE_ENV&&console.log("[useScroll] scrolled scrollContainerRef")}finally{d(!1)}},p=()=>{try{if(d(!0),!o.current)return void("development"===process.env.NODE_ENV&&console.log("[useScroll] scrollTargetRef not detected"));const e=o.current.getBoundingClientRect().top+o.current.getBoundingClientRect().height+window.scrollY;window.scroll({top:e,behavior:"smooth"}),"development"===process.env.NODE_ENV&&console.log("[useScroll] scrolled scrollTargetRef")}finally{d(!1)}};return{isScrollIncreasing:c,scrollStartSession:()=>{i(!0),u(!0),g.current=!1},scrollEndSession:()=>{i(!1)},scrollToBottom:S,scrollToTarget:p}};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../../hooks/studio/useStyleFontSize.js"),c=require("../../common/PickaxeMarkdown/index.js"),r=require("../../common/PickaxeMarkdown/Renderer.js"),o=require("../../common/PickaxeIcon.js"),i=require("./Document.js"),l=require("../../common/PickaxeCopyButton.js"),n=require("../../../../common/cn.js");exports.default=({index:d,message:x})=>{var m;const{formId:u,pickaxe:j,styles:p,colors:h,misc:k,responsiveBy:f}=a.usePickaxeContext(),[b,v]=s.useState(!1),w=t.useStyleFontSize(),g=null!==(m=null==j?void 0:j.chaticon)&&void 0!==m?m:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${u}.png`;return"assistant"===x.role?e.jsx("div",Object.assign({className:n.default("flex flex-col","viewport"===f?"min-[767px]:max-w-[80%]":"@[767px]/pickaxe-root:max-w-[80%]")},{children:e.jsxs("div",Object.assign({className:"flex gap-x-3"},{children:[k.isChatImage&&"NONE"!==g&&e.jsx(o.default,{src:g,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:h.text}),e.jsxs("div",Object.assign({className:"flex flex-col"},{children:[e.jsx("div",Object.assign({className:n.default(w.b2,"chat-message overflow-x-auto overflow-y-hidden pt-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B]"),style:{borderRadius:p.cornerRadius}},{children:e.jsx(c.PickaxeMarkdown,Object.assign({theme:p.theme,accentColor:h.accent,linkPreviews:!0,actions:!0},{children:e.jsx(r.PickaxeMarkdownRenderer,Object.assign({value:x.content},0===d&&{maxLines:b?void 0:4,onExpandClick:()=>v(!0)}))}))})),e.jsx("div",Object.assign({className:"mt-2 flex gap-3"},{children:e.jsx(l.default,{color:h.accent,text:x.content})}))]}))]}))})):"user"===x.role?e.jsx("div",Object.assign({className:n.default("flex gap-x-3 justify-self-end pl-9","viewport"===f?"min-[767px]:max-w-[80%] min-[767px]:pl-0":"@[767px]/pickaxe-root:max-w-[80%] @[767px]/pickaxe-root:pl-0")},{children:e.jsxs("div",Object.assign({className:n.default(w.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3"),style:{backgroundColor:h.secondary+"80",color:h.secondaryText,borderRadius:p.cornerRadius}},{children:[x.documentIds&&x.documentIds.length>0&&e.jsx("div",Object.assign({className:"flex flex-col items-end"},{children:x.documentIds.map((a=>e.jsx(s.Fragment,{children:a.startsWith("IMAGE-")?e.jsx("div",Object.assign({className:"max-w-[300px]"},{children:e.jsx("img",{style:{borderRadius:p.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${a.split("-")[2]}/${a.split("-")[1]}.${null==a?void 0:a.split("-")[2]}`,alt:""})})):e.jsx(i.default,{documentId:a})},a)))})),e.jsx(c.PickaxeMarkdown,Object.assign({theme:p.theme,accentColor:h.accent},{children:e.jsx(r.PickaxeMarkdownRenderer,{value:x.content})}))]}))})):e.jsx("div",{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../../hooks/studio/useStyleFontSize.js"),c=require("../../common/PickaxeMarkdown/index.js"),o=require("../../common/PickaxeMarkdown/Renderer.js"),i=require("../../common/PickaxeIcon.js"),r=require("./Document.js"),l=require("../../common/PickaxeCopyButton.js"),n=require("../../../../common/cn.js");exports.default=({index:d,message:x})=>{var m;const{formId:u,pickaxe:j,styles:p,colors:h,misc:k,responsiveBy:f,isNewChat:v}=a.usePickaxeContext(),[w,b]=s.useState(!1),g=t.useStyleFontSize(),y=null!==(m=null==j?void 0:j.chaticon)&&void 0!==m?m:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${u}.png`;return"assistant"===x.role?e.jsx("div",Object.assign({className:n.default("flex flex-col","viewport"===f?"min-[767px]:max-w-[80%]":"@[767px]/pickaxe-root:max-w-[80%]")},{children:e.jsxs("div",Object.assign({className:"flex gap-x-3"},{children:[k.isChatImage&&"NONE"!==y&&e.jsx(i.default,{src:y,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:h.text}),e.jsxs("div",Object.assign({className:"flex flex-col"},{children:[e.jsx("div",Object.assign({className:n.default(g.b2,"chat-message overflow-x-auto overflow-y-hidden pt-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B]")},{children:e.jsx(c.PickaxeMarkdown,Object.assign({theme:p.theme,accentColor:h.accent,linkPreviews:!0,actions:!0},{children:e.jsx(o.PickaxeMarkdownRenderer,Object.assign({value:x.content},0===d&&v&&{maxLines:w?void 0:4,onExpandClick:()=>b(!0)}))}))})),e.jsx("div",Object.assign({className:"mt-4 flex gap-3"},{children:e.jsx(l.default,{color:h.accent,text:x.content})}))]}))]}))})):"user"===x.role?e.jsx("div",Object.assign({className:n.default("flex gap-x-3 justify-self-end pl-9","viewport"===f?"min-[767px]:max-w-[80%] min-[767px]:pl-0":"@[767px]/pickaxe-root:max-w-[80%] @[767px]/pickaxe-root:pl-0")},{children:e.jsxs("div",Object.assign({className:n.default(g.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3"),style:{backgroundColor:h.secondary+"80",color:h.secondaryText,borderRadius:p.cornerRadius}},{children:[x.documentIds&&x.documentIds.length>0&&e.jsx("div",Object.assign({className:"flex flex-col items-end"},{children:x.documentIds.map((a=>e.jsx(s.Fragment,{children:a.startsWith("IMAGE-")?e.jsx("div",Object.assign({className:"max-w-[300px]"},{children:e.jsx("img",{style:{borderRadius:p.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${a.split("-")[2]}/${a.split("-")[1]}.${null==a?void 0:a.split("-")[2]}`,alt:""})})):e.jsx(r.default,{documentId:a})},a)))})),e.jsx(c.PickaxeMarkdown,Object.assign({theme:p.theme,accentColor:h.accent},{children:e.jsx(o.PickaxeMarkdownRenderer,{value:x.content})}))]}))})):e.jsx("div",{})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../../hooks/pickaxe/useResponseContext.js"),r=require("../../../../hooks/studio/useStyleFontSize.js"),o=require("../../../../hooks/pickaxe/useConversation.js"),n=require("../../../../hooks/core/useDebounce.js"),l=require("../../common/PickaxeIcon.js"),i=require("../../../Core/ErrorAlert.js"),c=require("../../Addons/Scroll/ScrollLockView.js"),d=require("../../common/PickaxeHead.js"),u=require("../../common/PickaxeCompactHead.js"),x=require("../../common/PickaxeInfoModal.js"),m=require("../../common/PickaxeUpgradeCard.js"),f=require("./Message.js"),j=require("../../../../common/cn.js");exports.default=()=>{var g;const p=o.useConversation(),h=r.useStyleFontSize(),{pickaxe:b,styles:k,colors:v,responsiveBy:E,isNewChat:w,setChatId:y,isEmbed:C}=a.usePickaxeContext(),{messages:N,status:O,limitData:q,error:S}=t.useResponseContext(),[B,P]=s.useState(!1),[F,R]=s.useState(!1),I=s.useRef(null),M=s.useRef(null),z=s.useRef(null),T=s.useMemo((()=>!!p.data&&!(p.data.messages.length<=1)),[p.data]),D=s.useMemo((()=>p.isSuccess&&w&&!T),[p.isSuccess,w,T]),H=n.useDebounce((()=>{L()}),200),L=s.useCallback((()=>{if(!I.current||!z.current)return;const e=I.current.getBoundingClientRect(),s=z.current.getBoundingClientRect().top-e.top;R(s<=210)}),[]);return s.useEffect((()=>{if(!I.current||!z.current)return;const e=new ResizeObserver((()=>{H()}));return e.observe(I.current),e.observe(z.current),()=>{e.disconnect()}}),[]),e.jsxs("div",Object.assign({ref:I,className:j.default("relative flex flex-grow flex-col",!C||!F&&D?"justify-end":"justify-between gap-y-4")},{children:[B&&e.jsx(x.default,{isOpen:B,onChangeIsOpen:P}),!C||!F&&D?e.jsx("div",Object.assign({ref:M,className:j.default("absolute left-1/2 top-0 flex w-full max-w-[550px] -translate-x-1/2 -translate-y-1/3 transform flex-col items-center px-4 opacity-0 duration-300",D&&!F&&"top-1/4 opacity-100")},{children:e.jsx(d.default,{iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>y("")})})):e.jsx(u.default,{}),e.jsx("div",Object.assign({ref:z,className:"pxe-messages-container flex w-full justify-center"},{children:p.isLoading?e.jsxs("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[e.jsx("div",{className:"h-10 w-[70%] animate-pulse justify-self-end rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===k.theme?"#1E1E1F":"#E5E7EB"}}),e.jsx("div",{className:"h-[150px] w-[70%] animate-pulse rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===k.theme?"#1E1E1F":"#E5E7EB"}}),e.jsx("div",{className:"h-10 w-[50%] animate-pulse justify-self-end rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===k.theme?"#1E1E1F":"#E5E7EB"}})]})):p.isError?e.jsx("div",Object.assign({className:"flex w-full max-w-[800px] justify-center pt-10"},{children:e.jsxs("p",Object.assign({className:j.default(h.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e.jsx("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):e.jsxs("div",Object.assign({className:"flex flex-col w-full"},{children:[e.jsxs("div",Object.assign({className:j.default("relative grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-4 pt-6","viewport"===E?"min-[767px]:pt-10":"@[767px]/pickaxe-root:pt-10")},{children:[p.data.messages.map(((s,a)=>e.jsx(f.default,{index:a,message:s},a))),N.map(((s,a)=>e.jsx(f.default,{index:p.data.messages.length+a,message:s},a))),"fetching"===O?e.jsxs("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:["NONE"!==(null==b?void 0:b.chaticon)&&e.jsx(l.default,{src:null!==(g=null==b?void 0:b.chaticon)&&void 0!==g?g:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==b?void 0:b.formid}.png`,alt:`${null==b?void 0:b.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:v.text}),e.jsxs("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4",style:{backgroundColor:v.secondary+"80",color:v.secondaryText}},{children:[e.jsx("div",{className:"h-1.5 w-1.5 animate-dot rounded-full",style:{backgroundColor:v.secondaryText}}),e.jsx("div",{className:"h-1.5 w-1.5 animate-dot-down rounded-full",style:{backgroundColor:v.secondaryText}}),e.jsx("div",{className:"h-1.5 w-1.5 animate-dot rounded-full",style:{backgroundColor:v.secondaryText}})]}))]})):q?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e.jsx(m.default,{})})):S?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e.jsx(i.default,{error:S})})):null]})),e.jsx(c.default,{className:"w-full"})]}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../../hooks/pickaxe/useResponseContext.js"),r=require("../../../../hooks/studio/useStyleFontSize.js"),n=require("../../../../hooks/pickaxe/useConversation.js"),l=require("../../../../hooks/core/useDebounce.js"),o=require("../../common/PickaxeIcon.js"),i=require("../../../Core/ErrorAlert.js"),c=require("../../Addons/Scroll/ScrollLockView.js"),u=require("../../common/PickaxeHead.js"),d=require("../../common/PickaxeCompactHead.js"),x=require("../../common/PickaxeInfoModal.js"),m=require("../../common/PickaxeUpgradeCard.js"),f=require("./Message.js"),j=require("../../../../common/cn.js");exports.default=()=>{var g;const p=n.useConversation(),h=r.useStyleFontSize(),{pickaxe:b,styles:v,colors:k,responsiveBy:E,isNewChat:w,setChatId:y,isEmbed:C}=a.usePickaxeContext(),{messages:N,status:O,limitData:q,error:S}=t.useResponseContext(),[B,P]=s.useState(!1),[F,R]=s.useState(!1),I=s.useRef(null),M=s.useRef(null),z=s.useRef(null),T=s.useMemo((()=>!!p.data&&!(p.data.messages.length<=1)),[p.data]),D=s.useMemo((()=>p.isSuccess&&w&&!T),[p.isSuccess,w,T]),H=s.useMemo((()=>{var e,s;return!!N.length&&!(null!==(s=null===(e=null==N?void 0:N[N.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[N]),L=l.useDebounce((()=>{_()}),200),_=s.useCallback((()=>{if(!I.current||!z.current)return;const e=I.current.getBoundingClientRect(),s=z.current.getBoundingClientRect().top-e.top;R(s<=210)}),[]);return s.useEffect((()=>{if(!I.current||!z.current)return;const e=new ResizeObserver((()=>{L()}));return e.observe(I.current),e.observe(z.current),()=>{e.disconnect()}}),[]),e.jsxs("div",Object.assign({ref:I,className:j.default("relative flex flex-grow flex-col",!C||!F&&D?"justify-end":"justify-between gap-y-4")},{children:[B&&e.jsx(x.default,{isOpen:B,onChangeIsOpen:P}),!C||!F&&D?e.jsx("div",Object.assign({ref:M,className:j.default("absolute left-1/2 top-0 flex w-full max-w-[550px] -translate-x-1/2 -translate-y-1/3 transform flex-col items-center px-4 opacity-0 duration-300",D&&!F&&"top-1/4 opacity-100")},{children:e.jsx(u.default,{iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>y("")})})):e.jsx(d.default,{}),e.jsx("div",Object.assign({ref:z,className:"pxe-messages-container flex w-full justify-center"},{children:p.isLoading?e.jsxs("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[e.jsx("div",{className:"h-10 w-[70%] animate-pulse justify-self-end rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===v.theme?"#1E1E1F":"#E5E7EB"}}),e.jsx("div",{className:"h-[150px] w-[70%] animate-pulse rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===v.theme?"#1E1E1F":"#E5E7EB"}}),e.jsx("div",{className:"h-10 w-[50%] animate-pulse justify-self-end rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===v.theme?"#1E1E1F":"#E5E7EB"}})]})):p.isError?e.jsx("div",Object.assign({className:"flex w-full max-w-[800px] justify-center pt-10"},{children:e.jsxs("p",Object.assign({className:j.default(h.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e.jsx("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):e.jsxs("div",Object.assign({className:"flex flex-col w-full"},{children:[e.jsxs("div",Object.assign({className:j.default("relative grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-4 pt-6","viewport"===E?"min-[767px]:pt-10":"@[767px]/pickaxe-root:pt-10")},{children:[p.data.messages.map(((s,a)=>e.jsx(f.default,{index:a,message:s},a))),N.map(((s,a)=>e.jsx(f.default,{index:p.data.messages.length+a,message:s},a))),"fetching"===O||H?e.jsxs("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:["NONE"!==(null==b?void 0:b.chaticon)&&e.jsx(o.default,{src:null!==(g=null==b?void 0:b.chaticon)&&void 0!==g?g:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==b?void 0:b.formid}.png`,alt:`${null==b?void 0:b.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:k.text}),e.jsxs("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4",style:{backgroundColor:k.secondary+"80",color:k.secondaryText}},{children:[e.jsx("div",{className:"h-1.5 w-1.5 animate-dot rounded-full",style:{backgroundColor:k.secondaryText}}),e.jsx("div",{className:"h-1.5 w-1.5 animate-dot-down rounded-full",style:{backgroundColor:k.secondaryText}}),e.jsx("div",{className:"h-1.5 w-1.5 animate-dot rounded-full",style:{backgroundColor:k.secondaryText}})]}))]})):q?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e.jsx(m.default,{})})):S?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e.jsx(i.default,{error:S})})):null]})),e.jsx(c.default,{className:"w-full"})]}))}))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),o=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/pickaxe/useResponseContext.js"),i=require("../../../hooks/pickaxe/useDimensionContext.js"),n=require("../../../hooks/studio/useStyleInput.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),l=require("../../../hooks/pickaxe/useConversation.js"),d=require("../../../hooks/pickaxe/useSubmit.js"),c=require("../../../hooks/pickaxe/useSubmitResult.js"),u=require("../../../common/documents.js"),m=require("../../../common/api/streamer.js"),p=require("../Addons/Document/hooks/useDocument.js"),x=require("../Addons/Scroll/hooks/useScroll.js"),f=require("../../../hooks/core/useHover.js"),b=require("../../../common/utils.js"),g=require("../../Icons/attach-vertical.svg.js"),h=require("../../Icons/spinner-lines.svg.js"),j=require("../../Icons/file.svg.js"),v=require("../../Icons/x.svg.js"),y=require("../../Icons/arrow-right.svg.js"),k=require("../common/PickaxeBranding.js"),w=require("../Addons/IceBreaker/index.js"),I=require("react-textarea-autosize"),O=require("../../../common/error.js"),C=require("../../../common/cn.js");function N(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var q=N(I);exports.default=()=>{var I;const{formId:N,chatId:S,userId:R,studioUserId:D,deploymentId:A,pickaxe:_,styles:T,colors:U,misc:E,chatInput:H,responsiveBy:M,forceMobile:z,isNewChat:B,setIsNewChat:F,setIsShowIceBreaker:L,onGenerateComplete:P}=o.usePickaxeContext(),{messages:W,status:$,limits:G,setMessages:K,setStatus:J,setLimitData:Q,setError:V,setIsGenerating:X}=r.useResponseContext(),{isMobile:Y}=i.useDimensionContext(),{documents:Z,isUploading:ee,isImageUploadAllowed:se,upsertDocuments:te,onFileUpload:oe}=p.useDocument(),{scrollStartSession:re,scrollEndSession:ie,scrollToBottom:ne}=x.useScroll({auto:!0}),ae=l.useConversation(),le=d.useSubmit(),de=c.useSubmitResult(),ce=a.useStyleFontSize(),ue=n.useStyleInput(),[me,pe]=t.useState(H),xe=t.useRef(null),fe=f.useHover(),{isHover:be}=fe,ge=e.__rest(fe,["isHover"]),he=f.useHover(),{isHover:je}=he,ve=e.__rest(he,["isHover"]),ye=t.useMemo((()=>{var e,s,t;return!!B&&(!!_&&(!ae.isLoading&&(!((null!==(s=null===(e=ae.data)||void 0===e?void 0:e.messages.length)&&void 0!==s?s:0)>1)&&!!(null===(t=_.icebreakers)||void 0===t?void 0:t.length))))}),[_,B,ae.data,ae.isLoading]),ke=s=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if(ee||"idle"!==$)return;const e=null!=s?s:me;if(!e)return;pe(""),V(""),Q(null),X(!0),F(!1);const t=new Date,o="enduserupload"===(null==_?void 0:_.documentuploadtype),r=Z.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),i=r.length?r[r.length-1].documentId:"";J("fetching"),re(),ne();const n=Array.from(W);let a=[...n,{id:W.length+1,role:"user",content:e}];K(a),ne();const{success:l,data:d,actionData:c,usedDocumentIds:u,endUserDocumentId:p,endUserImageId:x,rawUserInput:f,error:b}=yield le.mutateAsync(Object.assign(Object.assign(Object.assign({formId:N,responseId:S,value:e},o&&i&&{documentId:i}),D&&{studioUserId:D}),A&&{deploymentId:A}));if(!l)throw new Error(null!=b?b:"An error occurred, please try again.");const g=[];p&&g.push(p),x&&g.push(x),g.length>0&&(a=[...n,Object.assign({id:W.length+1,role:"user",content:e},g&&{documentIds:g})],K(a),ne()),te([]),ne();const h=(yield m.streamer({formId:N,responseId:S,data:d,actionData:c})).body;if(!h)throw new Error("Streaming error");const j=h.getReader(),v=new TextDecoder,y=a.length;let k="",w=!0,I=!1;for(;w;){const{value:e,done:s}=yield j.read();w=!s;if(k+=v.decode(e),k)K([...a.slice(0,y),{id:W.length+1,role:"assistant",content:k}]),I||(J("streaming"),I=!0);else if(!w&&!k)throw new Error("Server error")}const O=new Date;k&&(ne(),J("idle"),yield de.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:N,responseId:S,documentIds:u},R&&{userId:R}),D&&{studioUserId:D}),D&&(null==_?void 0:_.studioid)&&{studioId:_.studioid}),A&&{deploymentId:A}),{messages:[Object.assign(Object.assign({role:"user",message:f},g&&{documentIds:g}),{sentAt:t}),{role:"assistant",message:k,sentAt:O}]})),null==P||P(S))}catch(e){let s=O.default(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(G).find((([e])=>s.includes(e)));t?Q(t[1]):V(s),ne()}finally{J("idle"),X(!1),ie()}}));return t.useEffect((()=>{L(ye)}),[ye]),t.useEffect((()=>{pe(H)}),[H]),s.jsxs("div",Object.assign({className:C.default("fixed flex w-full flex-col bottom-0 left-0","viewport"===M?"min-[767px]:relative min-[767px]:bottom-auto min-[767px]:left-auto":"absolute @[767px]/pickaxe-root:relative @[767px]/pickaxe-root:bottom-auto @[767px]/pickaxe-root:left-auto")},{children:[!E.isWhiteLabel&&s.jsx("div",Object.assign({className:"flex justify-end pr-3 pb-3 @[767px]/pickaxe-root:pr-0"},{children:s.jsx(k.default,{animateHover:!0})})),ye&&s.jsx(w.default,{data:(null==_?void 0:_.icebreakers)||[],onSend:ke}),s.jsxs("div",Object.assign({id:(null==_?void 0:_.formid)+"--chat-parent",style:Object.assign(Object.assign({},ue),(Y||z)&&{paddingLeft:"0.75rem",paddingRight:"0.75rem"}),className:C.default("flex min-h-[56px] flex-col gap-y-2 px-4 py-3 pb-[15px]","block"===T.formFieldStyle&&"shadow")},{children:["idle"===$&&Z.length>0&&s.jsx("div",Object.assign({className:C.default("grid grid-cols-1","viewport"===M?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:Z.map((e=>{var o,r,i;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:"relative gap-x-[10px] flex items-center px-2 h-[56px] border",style:{borderRadius:ue.borderRadius,borderColor:U.secondaryText+"50"}},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:U.accent,borderRadius:ue.borderRadius}},{children:ee?s.jsx(h.default,{className:"w-5 h-5 animate-spin",style:{color:U.accentText}}):s.jsx(j.default,{className:"w-5 h-5",style:{color:U.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(C.default(ce.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:C.default(ce.b4,"opacity-80 truncate")},{children:b.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",disabled:ee||"idle"!==$,onClick:()=>te([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:U.accent,borderColor:ue.backgroundColor}},{children:s.jsx(v.default,{className:"w-4 h-4",style:{color:U.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:ue.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:ue.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(o=e.documentId)||void 0===o?void 0:o.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(i=e.documentId)||void 0===i?void 0:i.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:ue.borderRadius,backgroundColor:U.secondary}}),s.jsx("button",Object.assign({type:"button",disabled:ee||"idle"!==$,onClick:()=>te([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:U.accent,borderColor:ue.backgroundColor}},{children:s.jsx(v.default,{className:"w-4 h-4",style:{color:U.accentText}})}))]})):null},e.id)}))})),s.jsxs("div",Object.assign({className:"flex items-end gap-x-2 grow"},{children:[s.jsx(q.default,{id:(null==_?void 0:_.formid)+"--chat-textarea",className:C.default(ce.b2,"max-h-60 mb-[0.2em] w-full resize-none border-transparent bg-transparent outline-none ring-0 scrollbar scrollbar-thin placeholder:text-inherit placeholder:opacity-50",!me.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:me,placeholder:null!==(I=null==_?void 0:_.placeholdertext)&&void 0!==I?I:"What do you want to talk about?",onChange:e=>pe(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ee||"idle"!==$||ke()))}}),s.jsxs("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==_?void 0:_.documentuploadtype)&&s.jsxs("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:je?U.accent+"10":void 0},disabled:ee||"idle"!==$,onClick:()=>{var e;return null===(e=xe.current)||void 0===e?void 0:e.click()}},ve,{children:[s.jsx("input",{id:"file-upload",ref:xe,type:"file",accept:[...u.allowedFileMimeTypes,...se?u.allowedImageMimeTypes:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield oe(Array.from(s.target.files||[])),s.target.value=""}))}),s.jsx(g.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:je?U.accent:U.accent+"80"}})]})),s.jsx("button",Object.assign({id:(null==_?void 0:_.formid)+"--chat-button",className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:be?U.accent:U.accent+"10"},disabled:ee||"idle"!==$,onClick:()=>ke()},ge,{children:s.jsx(y.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:be?U.accentText:U.accent}})}))]}))]}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),o=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/pickaxe/useResponseContext.js"),i=require("../../../hooks/pickaxe/useDimensionContext.js"),n=require("../../../hooks/studio/useStyleInput.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),l=require("../../../hooks/pickaxe/useConversation.js"),d=require("../../../hooks/pickaxe/useSubmit.js"),c=require("../../../hooks/pickaxe/useSubmitResult.js"),u=require("../../../common/documents.js"),m=require("../../../common/api/streamer.js"),p=require("../Addons/Document/hooks/useDocument.js"),f=require("../Addons/Scroll/hooks/useScroll.js"),h=require("../../../hooks/core/useHover.js"),x=require("../../../common/utils.js"),g=require("../../Icons/attach-vertical.svg.js"),b=require("../../Icons/spinner-lines.svg.js"),j=require("../../Icons/file.svg.js"),v=require("../../Icons/x.svg.js"),y=require("../../Icons/arrow-right.svg.js"),k=require("../common/PickaxeBranding.js"),w=require("../Addons/IceBreaker/index.js"),I=require("react-textarea-autosize"),O=require("../../../common/error.js"),C=require("../../../common/cn.js");function N(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var q=N(I);exports.default=()=>{var I;const{formId:N,chatId:S,userId:R,studioUserId:D,deploymentId:A,pickaxe:_,styles:T,colors:U,misc:E,chatInput:H,responsiveBy:B,forceMobile:M,isNewChat:z,setIsNewChat:F,setIsShowIceBreaker:L,onGenerateComplete:P}=o.usePickaxeContext(),{messages:W,status:$,limits:G,setMessages:K,setStatus:J,setLimitData:Q,setError:V,setIsGenerating:X}=r.useResponseContext(),{isMobile:Y}=i.useDimensionContext(),{documents:Z,isUploading:ee,isImageUploadAllowed:se,upsertDocuments:te,onFileUpload:oe}=p.useDocument(),{scrollStartSession:re,scrollEndSession:ie,scrollToBottom:ne}=f.useScroll({auto:!0}),ae=l.useConversation(),le=d.useSubmit(),de=c.useSubmitResult(),ce=a.useStyleFontSize(),ue=n.useStyleInput(),[me,pe]=t.useState(H),fe=t.useRef(null),he=h.useHover(),{isHover:xe}=he,ge=e.__rest(he,["isHover"]),be=h.useHover(),{isHover:je}=be,ve=e.__rest(be,["isHover"]),ye=t.useMemo((()=>{var e,s,t;return!!z&&(!!_&&(!ae.isLoading&&(!((null!==(s=null===(e=ae.data)||void 0===e?void 0:e.messages.length)&&void 0!==s?s:0)>1)&&!!(null===(t=_.icebreakers)||void 0===t?void 0:t.length))))}),[_,z,ae.data,ae.isLoading]),ke=s=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if(ee||"idle"!==$)return;const e=null!=s?s:me;if(!e)return;pe(""),V(""),Q(null),X(!0),F(!1);const t=new Date,o="enduserupload"===(null==_?void 0:_.documentuploadtype),r=Z.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),i=r.length?r[r.length-1].documentId:"";J("fetching"),re(),ne();const n=Array.from(W);let a=[...n,{id:W.length+1,role:"user",content:e}];K(a),ne();const{success:l,data:d,actionData:c,usedDocumentIds:u,endUserDocumentId:p,endUserImageId:f,rawUserInput:h,error:x}=yield le.mutateAsync(Object.assign(Object.assign(Object.assign({formId:N,responseId:S,value:e},o&&i&&{documentId:i}),D&&{studioUserId:D}),A&&{deploymentId:A}));if(!l)throw new Error(null!=x?x:"An error occurred, please try again.");const g=[];p&&g.push(p),f&&g.push(f),g.length>0&&(a=[...n,Object.assign({id:W.length+1,role:"user",content:e},g&&{documentIds:g})],K(a),ne()),te([]),ne();const b=(yield m.streamer({formId:N,responseId:S,data:d,actionData:c})).body;if(!b)throw new Error("Streaming error");const j=b.getReader(),v=new TextDecoder,y=a.length;let k="",w=!0,I=!1;for(;w;){const{value:e,done:s}=yield j.read();w=!s;if(k+=v.decode(e).replace(/\u200B/g,""),k)K([...a.slice(0,y),{id:W.length+1,role:"assistant",content:k}]),I||(J("streaming"),I=!0);else if(!w&&!k)throw new Error("Server error")}const O=new Date;k&&(ne(),J("idle"),yield de.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:N,responseId:S,documentIds:u},R&&{userId:R}),D&&{studioUserId:D}),D&&(null==_?void 0:_.studioid)&&{studioId:_.studioid}),A&&{deploymentId:A}),{messages:[Object.assign(Object.assign({role:"user",message:h},g&&{documentIds:g}),{sentAt:t}),{role:"assistant",message:k,sentAt:O}]})),null==P||P(S))}catch(e){let s=O.default(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(G).find((([e])=>s.includes(e)));t?Q(t[1]):V(s),ne()}finally{J("idle"),X(!1),ie()}}));return t.useEffect((()=>{L(ye)}),[ye]),t.useEffect((()=>{pe(H)}),[H]),s.jsxs("div",Object.assign({className:C.default("fixed flex w-full flex-col bottom-0 left-0","viewport"===B?"min-[767px]:relative min-[767px]:bottom-auto min-[767px]:left-auto":"absolute @[767px]/pickaxe-root:relative @[767px]/pickaxe-root:bottom-auto @[767px]/pickaxe-root:left-auto")},{children:[!E.isWhiteLabel&&s.jsx("div",Object.assign({className:"flex justify-end pr-3 pb-3 @[767px]/pickaxe-root:pr-0"},{children:s.jsx(k.default,{animateHover:!0})})),ye&&s.jsx(w.default,{data:(null==_?void 0:_.icebreakers)||[],onSend:ke}),s.jsxs("div",Object.assign({id:(null==_?void 0:_.formid)+"--chat-parent",style:Object.assign(Object.assign({},ue),(Y||M)&&{paddingLeft:"0.75rem",paddingRight:"0.75rem"}),className:C.default("flex min-h-[56px] flex-col gap-y-2 px-4 py-3 pb-[15px]","block"===T.formFieldStyle&&"shadow")},{children:["idle"===$&&Z.length>0&&s.jsx("div",Object.assign({className:C.default("grid grid-cols-1","viewport"===B?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:Z.map((e=>{var o,r,i;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:"relative gap-x-[10px] flex items-center px-2 h-[56px] border",style:{borderRadius:ue.borderRadius,borderColor:U.secondaryText+"50"}},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:U.accent,borderRadius:ue.borderRadius}},{children:ee?s.jsx(b.default,{className:"w-5 h-5 animate-spin",style:{color:U.accentText}}):s.jsx(j.default,{className:"w-5 h-5",style:{color:U.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(C.default(ce.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:C.default(ce.b4,"opacity-80 truncate")},{children:x.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",disabled:ee||"idle"!==$,onClick:()=>te([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:U.accent,borderColor:ue.backgroundColor}},{children:s.jsx(v.default,{className:"w-4 h-4",style:{color:U.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:ue.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:ue.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(o=e.documentId)||void 0===o?void 0:o.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(i=e.documentId)||void 0===i?void 0:i.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:ue.borderRadius,backgroundColor:U.secondary}}),s.jsx("button",Object.assign({type:"button",disabled:ee||"idle"!==$,onClick:()=>te([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:U.accent,borderColor:ue.backgroundColor}},{children:s.jsx(v.default,{className:"w-4 h-4",style:{color:U.accentText}})}))]})):null},e.id)}))})),s.jsxs("div",Object.assign({className:"flex items-end gap-x-2 grow"},{children:[s.jsx(q.default,{id:(null==_?void 0:_.formid)+"--chat-textarea",className:C.default(ce.b2,"max-h-60 mb-[0.2em] w-full resize-none border-transparent bg-transparent outline-none ring-0 scrollbar scrollbar-thin placeholder:text-inherit placeholder:opacity-50",!me.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:me,placeholder:null!==(I=null==_?void 0:_.placeholdertext)&&void 0!==I?I:"What do you want to talk about?",onChange:e=>pe(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ee||"idle"!==$||ke()))}}),s.jsxs("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==_?void 0:_.documentuploadtype)&&s.jsxs("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:je?U.accent+"10":void 0},disabled:ee||"idle"!==$,onClick:()=>{var e;return null===(e=fe.current)||void 0===e?void 0:e.click()}},ve,{children:[s.jsx("input",{id:"file-upload",ref:fe,type:"file",accept:[...u.allowedFileMimeTypes,...se?u.allowedImageMimeTypes:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield oe(Array.from(s.target.files||[])),s.target.value=""}))}),s.jsx(g.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:je?U.accent:U.accent+"80"}})]})),s.jsx("button",Object.assign({id:(null==_?void 0:_.formid)+"--chat-button",className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:xe||me.length||Z.length&&Z.every((e=>"finished"===e.status))?U.accent:U.accent+"10"},disabled:ee||"idle"!==$,onClick:()=>ke()},ge,{children:s.jsx(y.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:xe||me.length||Z.length&&Z.every((e=>"finished"===e.status))?U.accentText:U.accent+"80"}})}))]}))]}))]}))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),o=require("../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../../hooks/pickaxe/useResponseContext.js"),n=require("../../Addons/Scroll/hooks/useScrollContext.js"),r=require("../../../../hooks/studio/useStyleFontSize.js"),l=require("../../Addons/Document/hooks/useDocument.js"),a=require("date-fns"),i=require("../../common/PickaxeMarkdown/index.js"),c=require("../../common/PickaxeMarkdown/Renderer.js"),d=require("../../../Icons/message-square-notes.svg.js"),u=require("../../../Icons/visitor.svg.js"),x=require("../../common/PickaxeIcon.js"),h=require("../../common/PickaxeSimpleButton.js"),m=require("../../common/PickaxeCopyButton.js"),p=require("../../Addons/Scroll/ScrollLockView.js"),j=require("../../../../common/cn.js");exports.default=()=>{var f;const{pickaxe:b,styles:g,colors:k,misc:v,translations:y,setChatId:w,setIsNewChat:q}=o.usePickaxeContext(),{response:N}=t.useResponseContext(),{scrollTargetRef:C,scrollContainerRef:O}=n.useScrollContext(),M=r.useStyleFontSize(),{upsertDocuments:I}=l.useDocument(),S=s.useMemo((()=>N?a.format(N.createdAt,"hh:mm a MMM dd, yy"):a.format(new Date,"hh:mm a MMM dd, yy")),[N]),P=s.useMemo((()=>{var e;if(!N)return"";return(null!==(e=N.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}),[N]);return N?e.jsxs("div",Object.assign({ref:C,className:"flex flex-col shadow-black transition duration-300 hover:shadow"},{children:[e.jsxs("div",Object.assign({className:"flex gap-x-3 overflow-hidden px-4 py-5",style:{backgroundColor:k.primary,color:k.text}},{children:[e.jsx("div",Object.assign({className:"shrink-0 pt-1"},{children:e.jsx(u.default,{className:"h-6 w-6"})})),e.jsxs("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar scrollbar-thin"},{children:[e.jsx("input",{id:`${N.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:P.length<280}),e.jsx("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:P}}),e.jsx("label",Object.assign({htmlFor:`${N.responseId}-input`,className:j.default(M.b3,"mt-1 flex shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer"),style:{color:k.accent}},{children:(null==y?void 0:y["see-input"])||"See input"})),e.jsx("label",Object.assign({htmlFor:`${N.responseId}-input`,className:j.default(M.b3,"hidden shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer"),style:{color:k.accent}},{children:(null==y?void 0:y["hide-input"])||"Hide input"}))]}))]})),e.jsxs("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:k.secondary,color:k.secondaryText}},{children:[v.isChatImage&&e.jsx(x.default,{src:null==b?void 0:b.chaticon,alt:`${null==b?void 0:b.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:k.secondaryText}),e.jsxs("div",Object.assign({ref:O,className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[e.jsx(i.PickaxeMarkdown,Object.assign({theme:g.theme,accentColor:k.accent,linkPreviews:!0,actions:!0},{children:e.jsx(c.PickaxeMarkdownRenderer,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:N.questionResponse})})),e.jsxs("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e.jsxs("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==b?void 0:b.enablechatresponses)&&e.jsxs(h.default,Object.assign({color:k.accent,onClick:()=>{return e=N.responseId,I([]),q(!1),void w(e);var e}},{children:[e.jsx(d.default,{className:"h-4 w-4 shrink-0"}),e.jsx("p",Object.assign({className:j.default(M.b3,"font-semibold")},{children:N.messages.length+1}))]})),e.jsx(m.default,{color:k.accent,text:null!==(f=N.questionResponse)&&void 0!==f?f:""})]})),e.jsx("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:e.jsx("p",Object.assign({className:j.default(M.b3,"font-semibold uppercase opacity-30")},{children:S}))}))]}))]}))]})),e.jsx(p.default,{className:"w-full"})]})):null};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),o=require("../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../../hooks/pickaxe/useResponseContext.js"),n=require("../../Addons/Scroll/hooks/useScrollContext.js"),r=require("../../../../hooks/studio/useStyleFontSize.js"),a=require("../../Addons/Document/hooks/useDocument.js"),l=require("date-fns"),i=require("../../common/PickaxeMarkdown/index.js"),c=require("../../common/PickaxeMarkdown/Renderer.js"),d=require("../../../Icons/message-square-notes.svg.js"),u=require("../../../Icons/visitor.svg.js"),x=require("../../common/PickaxeIcon.js"),h=require("../../common/PickaxeSimpleButton.js"),m=require("../../common/PickaxeCopyButton.js"),p=require("../../Addons/Scroll/ScrollLockView.js"),j=require("../../../../common/cn.js");exports.default=()=>{var f;const{pickaxe:b,styles:g,colors:k,misc:v,translations:y,setChatId:w,setIsNewChat:q}=o.usePickaxeContext(),{response:N}=t.useResponseContext(),{scrollTargetRef:C}=n.useScrollContext(),O=r.useStyleFontSize(),{upsertDocuments:M}=a.useDocument(),I=s.useMemo((()=>N?l.format(N.createdAt,"hh:mm a MMM dd, yy"):l.format(new Date,"hh:mm a MMM dd, yy")),[N]),S=s.useMemo((()=>{var e;if(!N)return"";return(null!==(e=N.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}),[N]);return N?e.jsxs("div",Object.assign({ref:C,className:"flex flex-col shadow-black transition duration-300 hover:shadow"},{children:[e.jsxs("div",Object.assign({className:"flex gap-x-3 overflow-hidden px-4 py-5",style:{backgroundColor:k.primary,color:k.text}},{children:[e.jsx("div",Object.assign({className:"shrink-0 pt-1"},{children:e.jsx(u.default,{className:"h-6 w-6"})})),e.jsxs("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar scrollbar-thin"},{children:[e.jsx("input",{id:`${N.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:S.length<280}),e.jsx("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:S}}),e.jsx("label",Object.assign({htmlFor:`${N.responseId}-input`,className:j.default(O.b3,"mt-1 flex shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer"),style:{color:k.accent}},{children:(null==y?void 0:y["see-input"])||"See input"})),e.jsx("label",Object.assign({htmlFor:`${N.responseId}-input`,className:j.default(O.b3,"hidden shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer"),style:{color:k.accent}},{children:(null==y?void 0:y["hide-input"])||"Hide input"}))]}))]})),e.jsxs("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:k.secondary,color:k.secondaryText}},{children:[v.isChatImage&&e.jsx(x.default,{src:null==b?void 0:b.chaticon,alt:`${null==b?void 0:b.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:k.secondaryText}),e.jsxs("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[e.jsx(i.PickaxeMarkdown,Object.assign({theme:g.theme,accentColor:k.accent,linkPreviews:!0,actions:!0},{children:e.jsx(c.PickaxeMarkdownRenderer,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:N.questionResponse})})),e.jsxs("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e.jsxs("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==b?void 0:b.enablechatresponses)&&e.jsxs(h.default,Object.assign({color:k.accent,onClick:()=>{return e=N.responseId,M([]),q(!1),void w(e);var e}},{children:[e.jsx(d.default,{className:"h-4 w-4 shrink-0"}),e.jsx("p",Object.assign({className:j.default(O.b3,"font-semibold")},{children:N.messages.length+1}))]})),e.jsx(m.default,{color:k.accent,text:null!==(f=N.questionResponse)&&void 0!==f?f:""})]})),e.jsx("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:e.jsx("p",Object.assign({className:j.default(O.b3,"font-semibold uppercase opacity-30")},{children:I}))}))]}))]}))]})),e.jsx(p.default,{className:"w-full"})]})):null};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),l=require("../../../../hooks/studio/useStyleInput.js"),r=require("../../../../hooks/studio/useStyleFontSize.js"),i=require("../../Addons/Document/hooks/useDocument.js"),n=require("../../../../hooks/core/useHover.js"),o=require("../../../../common/documents.js"),c=require("../../../../common/utils.js"),d=require("../../../Icons/attach-vertical.svg.js"),u=require("../../../Icons/check.svg.js"),b=require("../../../Icons/spinner-lines.svg.js"),m=require("../../../Icons/file.svg.js"),x=require("../../../Icons/x.svg.js"),j=require("../../../Icons/link.svg.js"),f=require("../../../Core/ErrorAlert.js"),p=require("../../../../common/cn.js");exports.default=({field:h,update:g})=>{const y=r.useStyleFontSize(),{colors:v,responsiveBy:w}=a.usePickaxeContext(),N=n.useHover(),{isHover:k}=N,O=e.__rest(N,["isHover"]),{documents:C,documentError:q,websiteLink:I,isUploading:R,isImageUploadAllowed:T,upsertDocuments:_,setDocumentError:D,setWebsiteLink:F,onFileUpload:S,onWebsiteUpload:A}=i.useDocument({onQuestionChange:e=>{g(Object.assign(Object.assign({},h),e))}}),[U,z]=t.useState(!1),E=t.useRef(null),H=l.useStyleInput();return s.jsxs("div",Object.assign({className:"flex flex-col gap-y-4"},{children:[s.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[s.jsxs("div",Object.assign({className:"flex items-center gap-2"},{children:[s.jsx("p",Object.assign({className:p.default(y.b3,"font-semibold opacity-70")},{children:h.main})),h.isRequired&&s.jsx("span",Object.assign({className:"select-none font-semibold",style:{color:v.error}},{children:"*"}))]})),s.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[s.jsx("input",{ref:E,type:"file",accept:[...o.allowedFileMimeTypes,...T?o.allowedImageMimeTypes:[]].join(", "),id:h.id,hidden:!0,multiple:!1,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield S(Array.from(s.target.files||[])),s.target.value=""})),disabled:R}),s.jsxs("div",Object.assign({className:p.default("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 duration-300 ease-in-out transition-all shadow hover:shadow-none",U&&"shadow"),style:H},{children:[s.jsx("input",{type:"text",value:I,className:p.default(y.b2,"w-full outline-none bg-transparent placeholder:font-semilight"),placeholder:"Paste a website/video link or drag a file",onChange:e=>F(e.target.value),onDrop:s=>e.__awaiter(void 0,void 0,void 0,(function*(){s.preventDefault(),yield S(Array.from(s.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),A(I))},onFocus:()=>z(!0),onBlur:()=>z(!1)}),s.jsx("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:I.length>0?s.jsxs(s.Fragment,{children:[s.jsx("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:R,onClick:()=>A(I)},{children:s.jsx(u.default,{className:"h-5 w-5 shrink-0",style:{color:v.accent}})})),s.jsx("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:R,onClick:()=>{F(""),D("")}},{children:s.jsx(x.default,{className:"h-6 w-6 shrink-0",style:{color:v.accent}})}))]}):s.jsx("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors",disabled:R,onClick:()=>{var e;null===(e=E.current)||void 0===e||e.click()},style:{backgroundColor:k?v.accent+"10":void 0}},O,{children:s.jsx(d.default,{className:"h-6 w-6",style:{color:k?v.accent:v.accent+"80"}})}))}))]}))]}))]})),C.length>0&&s.jsx("div",Object.assign({className:p.default("flex gap-4","viewport"===w?"min-[765px]:flex-col":"@[767px]/pickaxe-root:flex-col")},{children:C.map((e=>{var a,l,r;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:H},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:v.accent,borderRadius:H.borderRadius}},{children:R?s.jsx(b.default,{className:"w-5 h-5 animate-spin",style:{color:v.accentText}}):s.jsx(m.default,{className:"w-5 h-5",style:{color:v.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(p.default(y.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:p.default(y.b4,"opacity-80 truncate")},{children:c.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",disabled:R,onClick:()=>_([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:v.accent,borderColor:H.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4",style:{color:v.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:H.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:H.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(a=e.documentId)||void 0===a?void 0:a.split("-")[2]}/${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[1]}.${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:H.borderRadius,backgroundColor:v.secondary}}),s.jsx("button",Object.assign({type:"button",disabled:R,onClick:()=>_([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:v.accent,borderColor:H.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4",style:{color:v.accentText}})}))]})):"website"===e.type?s.jsxs("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:H},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:v.accent,borderRadius:H.borderRadius}},{children:R?s.jsx(b.default,{className:"w-5 h-5 animate-spin",style:{color:v.accentText}}):s.jsx(j.default,{className:"w-5 h-5",style:{color:v.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(p.default(y.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),s.jsx("p",Object.assign({className:p.default(y.b4,"opacity-80 truncate")},{children:"Website"}))]})),s.jsx("button",Object.assign({type:"button",disabled:R,onClick:()=>_([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:v.accent,borderColor:H.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4",style:{color:v.accentText}})}))]})):null},e.id)}))})),q&&s.jsx(f.default,{error:q,className:"mt-3"})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),l=require("../../../../hooks/pickaxe/usePickaxeContext.js"),a=require("../../../../hooks/studio/useStyleInput.js"),r=require("../../../../hooks/studio/useStyleFontSize.js"),o=require("../../Addons/Document/hooks/useDocument.js"),i=require("../../../../hooks/core/useHover.js"),n=require("../../../../common/documents.js"),c=require("../../../../common/utils.js"),d=require("../../../Icons/attach-vertical.svg.js"),u=require("../../../Icons/check.svg.js"),b=require("../../../Icons/spinner-lines.svg.js"),m=require("../../../Icons/file.svg.js"),x=require("../../../Icons/x.svg.js"),j=require("../../../Icons/link.svg.js"),f=require("../../../Core/ErrorAlert.js"),p=require("../../../../common/cn.js");exports.default=({field:h,update:g})=>{const y=r.useStyleFontSize(),{colors:v,styles:w,responsiveBy:N}=l.usePickaxeContext(),k=i.useHover(),{isHover:O}=k,C=e.__rest(k,["isHover"]),{documents:q,documentError:I,websiteLink:R,isUploading:T,isImageUploadAllowed:_,upsertDocuments:D,setDocumentError:F,setWebsiteLink:S,onFileUpload:A,onWebsiteUpload:U}=o.useDocument({onQuestionChange:e=>{g(Object.assign(Object.assign({},h),e))}}),[z,E]=t.useState(!1),H=t.useRef(null),P=a.useStyleInput();return s.jsxs("div",Object.assign({className:"flex flex-col gap-y-4"},{children:[s.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[s.jsxs("div",Object.assign({className:"flex items-center gap-2"},{children:[s.jsx("p",Object.assign({className:p.default(y.b3,"font-semibold opacity-70")},{children:h.main})),h.isRequired&&s.jsx("span",Object.assign({className:"select-none font-semibold",style:{color:v.error}},{children:"*"}))]})),s.jsxs("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[s.jsx("input",{ref:H,type:"file",accept:[...n.allowedFileMimeTypes,..._?n.allowedImageMimeTypes:[]].join(", "),id:h.id,hidden:!0,multiple:!1,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){yield A(Array.from(s.target.files||[])),s.target.value=""})),disabled:T}),s.jsxs("div",Object.assign({className:p.default("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 duration-300 ease-in-out transition-all",z&&"block"===w.formFieldStyle&&"shadow","block"===w.formFieldStyle&&"shadow hover:shadow-none"),style:P},{children:[s.jsx("input",{type:"text",value:R,className:p.default(y.b2,"w-full outline-none bg-transparent placeholder:font-semilight"),placeholder:"Paste a website/video link or drag a file",onChange:e=>S(e.target.value),onDrop:s=>e.__awaiter(void 0,void 0,void 0,(function*(){s.preventDefault(),yield A(Array.from(s.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),U(R))},onFocus:()=>E(!0),onBlur:()=>E(!1)}),s.jsx("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:R.length>0?s.jsxs(s.Fragment,{children:[s.jsx("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:T,onClick:()=>U(R)},{children:s.jsx(u.default,{className:"h-5 w-5 shrink-0",style:{color:v.accent}})})),s.jsx("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:T,onClick:()=>{S(""),F("")}},{children:s.jsx(x.default,{className:"h-6 w-6 shrink-0",style:{color:v.accent}})}))]}):s.jsx("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors",disabled:T,onClick:()=>{var e;null===(e=H.current)||void 0===e||e.click()},style:{backgroundColor:O?v.accent+"10":void 0}},C,{children:s.jsx(d.default,{className:"h-6 w-6",style:{color:O?v.accent:v.accent+"80"}})}))}))]}))]}))]})),q.length>0&&s.jsx("div",Object.assign({className:p.default("flex gap-4","viewport"===N?"min-[765px]:flex-col":"@[767px]/pickaxe-root:flex-col")},{children:q.map((e=>{var l,a,r;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:P},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:v.accent,borderRadius:P.borderRadius}},{children:T?s.jsx(b.default,{className:"w-5 h-5 animate-spin",style:{color:v.accentText}}):s.jsx(m.default,{className:"w-5 h-5",style:{color:v.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(p.default(y.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:p.default(y.b4,"opacity-80 truncate")},{children:c.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",disabled:T,onClick:()=>D([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:v.accent,borderColor:P.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4",style:{color:v.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:P.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:P.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[2]}/${null===(a=e.documentId)||void 0===a?void 0:a.split("-")[1]}.${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:P.borderRadius,backgroundColor:v.secondary}}),s.jsx("button",Object.assign({type:"button",disabled:T,onClick:()=>D([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:v.accent,borderColor:P.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4",style:{color:v.accentText}})}))]})):"website"===e.type?s.jsxs("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:P},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:v.accent,borderRadius:P.borderRadius}},{children:T?s.jsx(b.default,{className:"w-5 h-5 animate-spin",style:{color:v.accentText}}):s.jsx(j.default,{className:"w-5 h-5",style:{color:v.accentText}})})),s.jsxs("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s.jsx("p",Object.assign({className:(p.default(y.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),s.jsx("p",Object.assign({className:p.default(y.b4,"opacity-80 truncate")},{children:"Website"}))]})),s.jsx("button",Object.assign({type:"button",disabled:T,onClick:()=>D([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:v.accent,borderColor:P.backgroundColor}},{children:s.jsx(x.default,{className:"w-4 h-4",style:{color:v.accentText}})}))]})):null},e.id)}))})),I&&s.jsx(f.default,{error:I,className:"mt-3"})]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),o=require("../../../../hooks/pickaxe/usePickaxeContext.js"),i=require("../../../../hooks/pickaxe/useResponseContext.js"),r=require("../../../../hooks/pickaxe/useSubmit.js"),n=require("../../../../hooks/pickaxe/useSubmitResult.js"),l=require("../../Addons/Document/hooks/useDocument.js"),a=require("../../Addons/Scroll/hooks/useScroll.js"),u=require("../../../../common/api/streamer.js"),d=require("../../../../common/utils.js"),c=require("@nem035/gpt-3-encoder"),m=require("../../common/PickaxeBranding.js"),p=require("../../common/PickaxeButton.js"),x=require("../../../../common/error.js"),f=require("../../../../common/cn.js");exports.default=({questions:g})=>{var h;const{formId:j,userId:w,studioUserId:b,deploymentId:v,pickaxe:y,misc:q,translations:I,responsiveBy:k,isShowHistory:O,setIsShowHistory:S,onGenerateComplete:D}=o.usePickaxeContext(),{status:P,limits:R,setResponse:U,setStatus:C,setLimitData:E,setError:A,setIsGenerating:T}=i.useResponseContext(),{documents:_,websiteLink:L,isUploading:N,onWebsiteUpload:B,setDocumentError:H}=l.useDocument(),{scrollStartSession:W,scrollEndSession:G,scrollToTarget:M,scrollToBottom:F}=a.useScroll({auto:!0}),K=r.useSubmit(),Y=n.useSubmitResult(),[z,J]=t.useState(!1);return s.jsxs("div",Object.assign({className:f.default("mt-4 flex flex-wrap flex-col justify-between gap-2","viewport"===k?"min-[767px]:flex-row":"@[767px]/pickaxe-root:flex-row")},{children:[s.jsxs("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:[s.jsx(p.default,Object.assign({className:f.default("w-full","viewport"===k?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]"),isDisabled:N||z||"idle"!==P,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;try{if(N||z||"idle"!==P)return;E(null),H(""),T(!0);const s="enduserupload"===(null==y?void 0:y.documentuploadtype),t=g.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),o=_.filter((e=>"finished"===e.status)),i=d.extractUrlsFromText(L),r=_.map((e=>e.name)),n=i.filter((e=>!r.includes(e)));if(n.length){const e=n[n.length-1];J(!0);const s=yield B(e);s&&(o.push(s),yield new Promise((e=>setTimeout(e,5e3)))),J(!1)}else if(t&&s&&!o.length)return void H("Please paste a valid website/video link or drag a file to add to the knowledge base.");A("");const l=["Multiple Choice","Checkbox"];for(const e of g){if(c.encode(e.input).length>e.maxLength&&!l.includes(e.type))throw new Error("One or more of your responses is too long!");if(e.isRequired&&!e.input.trim()&&"userinput:documentupload"!==e.id)throw new Error("You must fill out all required fields.")}const a=o.length?o[o.length-1]:null;let m={};g.forEach((e=>m=Object.assign(Object.assign({},m),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?(null==a?void 0:a.name)||"":e.input}))),C("fetching");const{success:p,responseId:x,data:f,actionData:h,usedDocumentIds:q,rawUserInput:I,error:k}=yield K.mutateAsync(Object.assign(Object.assign(Object.assign({formId:j,valueObj:m},s&&a&&{documentId:null!==(e=a.documentId)&&void 0!==e?e:""}),b&&{studioUserId:b}),v&&{deploymentId:v}));if(!p)throw new Error(null!=k?k:"An error occurred, please try again.");const O=(yield u.streamer({formId:j,responseId:x,data:f,actionData:h})).body;if(!O)throw new Error("Streaming error");const S=O.getReader(),R=new TextDecoder;let G="",M=!0,Q=!1;U(null);const V=g.map((e=>({id:e.id,question:e.main,answer:e.input})));for(;M;){const{value:e,done:s}=yield S.read();M=!s;const t=R.decode(e);if(G&&!Q&&(W(),F(),Q=!0),G+=t,G)C("streaming"),U({formId:j,responseId:x,documentIds:q,messages:[],questions:V,questionPrompt:I,questionResponse:G,createdAt:new Date});else if(!M&&!G)throw new Error("Server error")}G&&(F(),C("idle"),yield Y.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:j,responseId:x,documentIds:q},w&&{userId:w}),b&&{studioUserId:b}),b&&(null==y?void 0:y.studioid)&&{studioId:y.studioid}),v&&{deploymentId:v}),{questions:V,questionPrompt:I,questionResponse:G})),null==D||D(x))}catch(e){let s=x.default(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(R).find((([e])=>s.includes(e)));t?E(t[1]):A(s),M(),F()}finally{C("idle"),T(!1),J(!1),G()}}))},{children:z?(null==I?void 0:I.processing)||"Processing...":N?(null==I?void 0:I.uploading)||"Uploading...":"fetching"===P||"streaming"===P?(null==I?void 0:I.processing)||"Loading...":null!==(h=null==y?void 0:y.submittext)&&void 0!==h?h:"Submit"})),q.isHistory&&!O&&s.jsx(p.default,Object.assign({variant:"transparent-text",className:f.default("w-full","viewport"===k?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]"),onClick:()=>S(!0)},{children:(null==I?void 0:I["see-history"])||"See history"}))]})),!q.isWhiteLabel&&s.jsx("div",Object.assign({className:"flex justify-end pr-3"},{children:s.jsx(m.default,{})}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),i=require("../../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../../../../hooks/pickaxe/useResponseContext.js"),n=require("../../../../hooks/pickaxe/useSubmit.js"),r=require("../../../../hooks/pickaxe/useSubmitResult.js"),l=require("../../Addons/Document/hooks/useDocument.js"),u=require("../../Addons/Scroll/hooks/useScroll.js"),d=require("../../../../common/api/streamer.js"),a=require("../../../../common/utils.js"),c=require("@nem035/gpt-3-encoder"),m=require("../../common/PickaxeBranding.js"),p=require("../../common/PickaxeButton.js"),g=require("../../../../common/error.js"),f=require("../../../../common/cn.js");exports.default=({questions:x})=>{var h;const{formId:j,userId:b,studioUserId:v,deploymentId:w,pickaxe:y,misc:q,translations:I,responsiveBy:k,isShowHistory:O,setIsShowHistory:S,onGenerateComplete:D}=i.usePickaxeContext(),{status:P,limits:R,setResponse:U,setStatus:C,setLimitData:E,setError:A,setIsGenerating:_}=o.useResponseContext(),{documents:L,websiteLink:N,isUploading:T,onWebsiteUpload:B,setDocumentError:H}=l.useDocument(),{scrollStartSession:W,scrollEndSession:G,scrollToTarget:M}=u.useScroll({auto:!0}),F=n.useSubmit(),K=r.useSubmitResult(),[Y,z]=t.useState(!1);return s.jsxs("div",Object.assign({className:f.default("mt-4 flex flex-wrap flex-col justify-between gap-2","viewport"===k?"min-[767px]:flex-row":"@[767px]/pickaxe-root:flex-row")},{children:[s.jsxs("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:[s.jsx(p.default,Object.assign({className:"px-5 min-h-[42px]",isDisabled:T||Y||"idle"!==P,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;try{if(T||Y||"idle"!==P)return;E(null),H(""),_(!0);const s="enduserupload"===(null==y?void 0:y.documentuploadtype),t=x.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),i=L.filter((e=>"finished"===e.status)),o=a.extractUrlsFromText(N),n=L.map((e=>e.name)),r=o.filter((e=>!n.includes(e)));if(r.length){const e=r[r.length-1];z(!0);const s=yield B(e);s&&(i.push(s),yield new Promise((e=>setTimeout(e,5e3)))),z(!1)}else if(t&&s&&!i.length)return void H("Please paste a valid website/video link or drag a file to add to the knowledge base.");A("");const l=["Multiple Choice","Checkbox"];for(const e of x){if(c.encode(e.input).length>e.maxLength&&!l.includes(e.type))throw new Error("One or more of your responses is too long!");if(e.isRequired&&!e.input.trim()&&"userinput:documentupload"!==e.id)throw new Error("You must fill out all required fields.")}const u=i.length?i[i.length-1]:null;let m={};x.forEach((e=>m=Object.assign(Object.assign({},m),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?(null==u?void 0:u.name)||"":e.input}))),C("fetching"),W(),M();const{success:p,responseId:g,data:f,actionData:h,usedDocumentIds:q,rawUserInput:I,error:k}=yield F.mutateAsync(Object.assign(Object.assign(Object.assign({formId:j,valueObj:m},s&&u&&{documentId:null!==(e=u.documentId)&&void 0!==e?e:""}),v&&{studioUserId:v}),w&&{deploymentId:w}));if(!p)throw new Error(null!=k?k:"An error occurred, please try again.");M();const O=(yield d.streamer({formId:j,responseId:g,data:f,actionData:h})).body;if(!O)throw new Error("Streaming error");const S=O.getReader(),R=new TextDecoder;let G="",J=!0,Q=!1;U(null),M();const V=x.map((e=>({id:e.id,question:e.main,answer:e.input})));for(;J;){const{value:e,done:s}=yield S.read();J=!s;if(G+=R.decode(e).replace(/\u200B/g,""),G)U({formId:j,responseId:g,documentIds:q,messages:[],questions:V,questionPrompt:I,questionResponse:G,createdAt:new Date}),Q||(C("streaming"),M(),Q=!0);else if(!J&&!G)throw new Error("Server error")}G&&(M(),C("idle"),yield K.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:j,responseId:g,documentIds:q},b&&{userId:b}),v&&{studioUserId:v}),v&&(null==y?void 0:y.studioid)&&{studioId:y.studioid}),w&&{deploymentId:w}),{questions:V,questionPrompt:I,questionResponse:G})),null==D||D(g))}catch(e){let s=g.default(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(R).find((([e])=>s.includes(e)));t?E(t[1]):A(s),M()}finally{C("idle"),_(!1),z(!1),G()}}))},{children:Y?(null==I?void 0:I.processing)||"Processing...":T?(null==I?void 0:I.uploading)||"Uploading...":"fetching"===P||"streaming"===P?(null==I?void 0:I.processing)||"Loading...":null!==(h=null==y?void 0:y.submittext)&&void 0!==h?h:"Submit"})),q.isHistory&&!O&&s.jsx(p.default,Object.assign({variant:"transparent-text",className:"px-4",onClick:()=>S(!0)},{children:(null==I?void 0:I["see-history"])||"See history"}))]})),!q.isWhiteLabel&&s.jsx("div",Object.assign({className:"flex justify-end pr-3"},{children:s.jsx(m.default,{})}))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),i=require("../../../hooks/studio/useStyleFontSize.js"),a=require("framer-motion"),t=require("../../Icons/pickaxe.svg.js"),r=require("../../../common/cn.js");exports.default=({className:o,animateHover:c=!0})=>{const{pickaxe:n,misc:l}=s.usePickaxeContext(),u=i.useStyleFontSize();return!n||l.isWhiteLabel?null:e.jsxs(a.motion.a,Object.assign({href:`https://${process.env.NEXT_PUBLIC_PICKAXE_DOMAIN}`,className:r.default("flex items-center gap-2 select-none overflow-hidden px-2 py-1 rounded",o)},c&&{initial:{scale:1},whileHover:{scale:1.05},whileTap:{scale:.95}},{children:[e.jsx(t.default,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",Object.assign({className:r.default(u.b4,"opacity-50")},{children:"Powered by Pickaxe"}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../hooks/studio/useStyleFontSize.js"),a=require("framer-motion"),i=require("../../Icons/pickaxe.svg.js"),r=require("../../../common/cn.js");exports.default=({className:o,animateHover:c=!0})=>{const{pickaxe:l,colors:n,misc:u}=s.usePickaxeContext(),x=t.useStyleFontSize();return!l||u.isWhiteLabel?null:e.jsxs(a.motion.a,Object.assign({href:`https://${process.env.NEXT_PUBLIC_PICKAXE_DOMAIN}`,className:r.default("flex items-center gap-2 select-none overflow-hidden px-2 py-1 rounded",o,"#ffffff"===n.text.toLowerCase()?"text-white":"text-black")},c&&{initial:{scale:1},whileHover:{scale:1.05},whileTap:{scale:.95}},{children:[e.jsx(i.default,{className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",Object.assign({className:r.default(x.b4,"opacity-50")},{children:"Powered by Pickaxe"}))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),s=require("copy-to-clipboard"),o=require("../../Icons/copied.svg.js"),a=require("../../Icons/copy.svg.js"),i=require("./PickaxeSimpleButton.js"),c=require("../../../common/cn.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=l(s);exports.default=({color:s,text:l="",className:u,iconClassName:f})=>{const[d,m]=r.useState(l),[p,h]=r.useState(!1),[j,y]=r.useState(!1);r.useEffect((()=>{m(l)}),[l]);return t.jsx(i.default,Object.assign({color:s},u&&{className:u},{isForceColor:j,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;try{if(p)return;h(!0);const t=null!==(e=[...Array.from(l.matchAll(/https:\/\/streaming\.pickaxeproject\.com\/api\/function_call_results\?.*?&name=[^&]+/g)),...Array.from(l.matchAll(/https:\/\/utils\.pickaxe\.chat\/api\/fn\/result\?.*?&name=[^&]+/g))].map((e=>e[0])))&&void 0!==e?e:[],r=[];if(t.length){for(const e of t)try{const t=yield fetch(e),s=yield t.json(),o=s.text||s.url||"";r.push(o)}catch(e){console.error(e)}r.length&&m(r.join("\n"))}n.default(r.length>0?r.join("\n"):d),h(!1),y(!0),yield new Promise((e=>setTimeout(e,1500)))}catch(e){console.error(e)}finally{h(!1),y(!1)}}))},{children:p||j?t.jsx(o.default,{className:c.default("w-4 h-4 shrink-0",f)}):t.jsx(a.default,{className:c.default("w-4 h-4 shrink-0",f)})}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),s=require("copy-to-clipboard"),o=require("../../Icons/copied-new.svg.js"),a=require("../../Icons/copy-new.svg.js"),i=require("./PickaxeSimpleButton.js"),c=require("../../../common/cn.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=l(s);exports.default=({color:s,text:l="",className:u,iconClassName:f})=>{const[d,m]=r.useState(l),[p,h]=r.useState(!1),[j,y]=r.useState(!1);r.useEffect((()=>{m(l)}),[l]);return t.jsx(i.default,Object.assign({color:s},u&&{className:u},{isForceColor:j,onClick:()=>e.__awaiter(void 0,void 0,void 0,(function*(){var e;try{if(p)return;h(!0);const t=null!==(e=[...Array.from(l.matchAll(/https:\/\/streaming\.pickaxeproject\.com\/api\/function_call_results\?.*?&name=[^&]+/g)),...Array.from(l.matchAll(/https:\/\/utils\.pickaxe\.chat\/api\/fn\/result\?.*?&name=[^&]+/g))].map((e=>e[0])))&&void 0!==e?e:[],r=[];if(t.length){for(const e of t)try{const t=yield fetch(e),s=yield t.json(),o=s.text||s.url||"";r.push(o)}catch(e){console.error(e)}r.length&&m(r.join("\n"))}n.default(r.length>0?r.join("\n"):d),h(!1),y(!0),yield new Promise((e=>setTimeout(e,1500)))}catch(e){console.error(e)}finally{h(!1),y(!1)}}))},{children:p||j?t.jsx(o.default,{className:c.default("w-4 h-4 shrink-0",f)}):t.jsx(a.default,{className:c.default("w-4 h-4 shrink-0",f)})}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),s=require("@tanstack/react-query"),a=require("../../hooks/usePickaxeMarkdownContext.js"),i=require("../common/Action.js"),o=require("../Img/index.js"),n=require("../common/Audio.js"),u=require("../common/Html/index.js"),l=require("../../../../../../common/api/utils.js"),c=require("../../../../../../common/error.js");exports.default=({node:d,href:f="",children:p})=>{const{accentColor:m,websiteMetadatas:h,linkPreviews:w,actions:j,setWebsiteMetadatas:x}=a.usePickaxeMarkdownContext(),[b,v]=r.useState("");r.useEffect((()=>{if(!f)return;const e=f.startsWith("http://")?`https://${f.slice(7)}`:f.startsWith("www.")?`https://${f}`:f;e!==b&&v(e)}),[f,b]),s.useQuery({queryKey:["website-metadata",b],queryFn:()=>e.__awaiter(void 0,void 0,void 0,(function*(){try{const r=yield(t=b,e.__awaiter(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield l.default.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=c.default(e);console.error("[getJobResult]",t)}return null}})));if(!r||!r.title)throw new Error("No valid metadata");return r}catch(e){return console.warn(`Failed to fetch metadata for URL: ${b}`,e),null}var t})),enabled:"undefined"!=typeof window&&w&&Boolean(b)&&!h.some((e=>e.href===b))&&b.includes(".")&&!b.includes("https://prod-pickaxe-assets")&&!b.includes("https://pickaxeproject--v2"),retry:2,onSuccess:e=>{e&&e.title&&!h.some((t=>t.href===e.href))&&x((t=>[...t,e]))}});const y=b.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(y&&(null==y?void 0:y[1]))return t.jsx("div",Object.assign({className:"pxe-markdown-youtube",style:{display:"flex",width:"100%",justifyContent:"center"}},{children:t.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${y[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(b.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/))return t.jsx(o.default,{src:b,alt:"string"==typeof p?p:"Markdown Image"});if(b.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/))return t.jsx(n.default,{url:b});return b.includes("action_generated_files")&&b.match(/\.html$/)?t.jsx(u.default,{url:b}):j&&b.includes("pickaxe")&&(b.includes("/api/fn/result")||b.includes("/api/function_call_results"))?t.jsx(i.default,{jobUrl:b}):t.jsx("a",Object.assign({href:b,target:"_blank",rel:"noopener noreferrer",style:{color:m}},{children:p}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),r=require("react"),s=require("@tanstack/react-query"),i=require("../../hooks/usePickaxeMarkdownContext.js"),a=require("../common/Action.js"),n=require("../Img/index.js"),o=require("../common/Audio.js"),u=require("../common/Html/index.js"),c=require("../../../../../../common/api/utils.js"),l=require("../../../../../../common/error.js");exports.default=({node:d,href:f="",children:p})=>{const{accentColor:m,websiteMetadatas:h,linkPreviews:w,actions:j,setWebsiteMetadatas:x}=i.usePickaxeMarkdownContext(),[b,v]=r.useState("");r.useEffect((()=>{if(!f)return;const e=f.startsWith("http://")?`https://${f.slice(7)}`:f.startsWith("www.")?`https://${f}`:f;e!==b&&v(e)}),[f,b]),s.useQuery({queryKey:["website-metadata",b],queryFn:()=>e.__awaiter(void 0,void 0,void 0,(function*(){return t=b,e.__awaiter(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield c.default.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=l.default(e);console.error("[getJobResult]",t)}return null}}));var t})),enabled:"undefined"!=typeof window&&w&&Boolean(b)&&!h.some((e=>e.href===b))&&b.includes(".")&&!b.includes("https://prod-pickaxe-assets")&&!b.includes("https://pickaxeproject--v2"),retry:2,onSuccess:e=>{e&&e.title&&(h.some((t=>t.href===e.href))||x((t=>[...t,e])))}});const g=b.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(g&&(null==g?void 0:g[1]))return t.jsx("div",Object.assign({className:"pxe-markdown-youtube",style:{display:"flex",width:"100%",justifyContent:"center"}},{children:t.jsx("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${g[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(b.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/))return t.jsx(n.default,{src:b,alt:"string"==typeof p?p:"Markdown Image"});if(b.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/))return t.jsx(o.default,{url:b});return b.includes("action_generated_files")&&b.match(/\.html$/)?t.jsx(u.default,{url:b}):j&&b.includes("pickaxe")&&(b.includes("/api/fn/result")||b.includes("/api/function_call_results"))?t.jsx(a.default,{jobUrl:b}):t.jsx("a",Object.assign({href:b,target:"_blank",rel:"noopener noreferrer",style:{color:m}},{children:p}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),s=require("react-syntax-highlighter"),a=require("../../hooks/usePickaxeMarkdownContext.js"),l=require("../../../PickaxeCopyButton.js");exports.default=t=>{var i,{node:c,children:o,className:n}=t,u=e.__rest(t,["node","children","className"]);const{syntaxTheme:d,accentColor:x}=a.usePickaxeMarkdownContext(),b=/language-(\w+)/.exec(n||"");return r.jsxs("div",Object.assign({className:"pxe-markdown-code relative"},{children:[r.jsx("div",Object.assign({className:"absolute right-2 top-4 text-white"},{children:r.jsx(l.default,{color:x,text:null!==(i=null==o?void 0:o.toString())&&void 0!==i?i:"",iconClassName:"w-4 h-4"})})),r.jsx("div",Object.assign({className:"overflow-x-auto max-w-[600px] scrollbar scrollbar-thumb-black/50 scrollbar-thumb-rounded-full scrollbar-w-[4px] scrollbar-h-[4px] dark:scrollbar-thumb-black/60"},{children:r.jsx(s.Prism,Object.assign({},u,{PreTag:"div",language:b?b[1]:"js",style:d,showLineNumbers:!0},{children:String(o).replace(/\n$/,"")}))}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),s=require("react-syntax-highlighter"),a=require("../../hooks/usePickaxeMarkdownContext.js"),l=require("../../../PickaxeCopyButton.js");exports.default=t=>{var i,{node:c,children:o,className:n}=t,u=e.__rest(t,["node","children","className"]);const{syntaxTheme:d}=a.usePickaxeMarkdownContext(),x=/language-(\w+)/.exec(n||"");return r.jsx("div",Object.assign({className:"pxe-markdown-code relative"},{children:r.jsxs("div",Object.assign({className:"relative overflow-x-auto max-w-[600px] scrollbar scrollbar-thumb-black/50 scrollbar-thumb-rounded-full scrollbar-w-[4px] scrollbar-h-[4px] dark:scrollbar-thumb-black/60"},{children:[r.jsx("div",Object.assign({className:"absolute right-2 top-4 text-white"},{children:r.jsx(l.default,{color:"#FFFFFF",text:null!==(i=null==o?void 0:o.toString())&&void 0!==i?i:"",iconClassName:"w-4 h-4"})})),r.jsx(s.Prism,Object.assign({},u,{PreTag:"div",language:x?x[1]:"js",style:d,showLineNumbers:!0},{children:String(o).replace(/\n$/,"")}))]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),o=require("react/jsx-runtime"),t=require("react"),s=require("../../hooks/usePickaxeMarkdownContext.js"),i=require("../../../../../../hooks/core/useHover.js"),r=require("framer-motion"),n=require("../../../../../../common/utils.js"),a=require("../../../../../Icons/download.svg.js"),l=require("../../../PickaxeCopyButton.js"),d=require("./ImgModal.js");exports.default=({node:c,src:p,alt:u})=>{const{accentColor:x}=s.usePickaxeMarkdownContext(),[b,h]=t.useState(!1),[g,j]=t.useState(!1),m=i.useHover(),{isHover:y}=m,v=e.__rest(m,["isHover"]);return o.jsxs("div",Object.assign({className:"pxe-markdown-image",style:{display:"flex",width:"100%",justifyContent:"center",overflow:"hidden",borderRadius:"8px",transition:"transform 0.3s ease, box-shadow 0.3s ease",transform:y?"translateY(-5px)":"translateY(0)"}},v,{children:[g&&o.jsx(d.default,{src:p,isOpen:g,onChangeIsOpen:j}),b?o.jsx("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):o.jsxs("div",Object.assign({style:{position:"relative"}},{children:[o.jsxs(r.motion.div,Object.assign({initial:"hidden",animate:y?"visible":"hidden",variants:{hidden:{opacity:0,y:-10,pointerEvents:"none"},visible:{opacity:1,y:0,pointerEvents:"auto"}},style:{position:"absolute",display:"flex",gap:"0.4rem",top:"10px",right:"10px",color:"#FFF"}},{children:[o.jsx(r.motion.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:x,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:e=>{e.stopPropagation(),window.open(p,"_blank")}},{children:o.jsx(a.default,{width:24,height:24,style:{color:n.getContrastColor(x),flexShrink:0}})})),o.jsx(r.motion.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:x,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:e=>e.stopPropagation()},{children:o.jsx(l.default,{color:n.getContrastColor(x),iconClassName:"w-6 h-6",text:p||""})}))]})),o.jsx("img",{src:p,alt:u,style:{borderRadius:"8px",width:"100%",transition:"box-shadow 0.3s ease",boxShadow:y?"inset 0px 4px 10px rgba(0, 0, 0, 0.5)":"none"},onError:()=>h(!0),onClick:()=>j(!0)})]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_tslib.js"),o=require("react/jsx-runtime"),s=require("react"),t=require("../../hooks/usePickaxeMarkdownContext.js"),i=require("../../../../../../hooks/core/useHover.js"),r=require("framer-motion"),n=require("../../../../../../common/utils.js"),a=require("../../../../../Icons/download.svg.js"),l=require("../../../PickaxeCopyButton.js"),d=require("./ImgModal.js");exports.default=({node:c,src:p,alt:u})=>{const{accentColor:x,readOnly:b}=t.usePickaxeMarkdownContext(),[g,h]=s.useState(!1),[j,y]=s.useState(!1),m=i.useHover(),{isHover:v}=m,w=e.__rest(m,["isHover"]);return o.jsxs("div",Object.assign({className:"pxe-markdown-image",style:Object.assign({display:"flex",width:"100%",justifyContent:"center",overflow:"hidden",borderRadius:"8px"},!b&&{transition:"transform 0.3s ease, box-shadow 0.3s ease",transform:v?"translateY(-5px)":"translateY(0)"})},!b&&Object.assign({},w),{children:[j&&o.jsx(d.default,{src:p,isOpen:j,onChangeIsOpen:y}),g?o.jsx("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):o.jsxs("div",Object.assign({style:{position:"relative"}},{children:[!b&&o.jsxs(r.motion.div,Object.assign({initial:"hidden",animate:v?"visible":"hidden",variants:{hidden:{opacity:0,y:-10,pointerEvents:"none"},visible:{opacity:1,y:0,pointerEvents:"auto"}},style:{position:"absolute",display:"flex",gap:"0.4rem",top:"10px",right:"10px",color:"#FFF"}},{children:[o.jsx(r.motion.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:x,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:e=>{e.stopPropagation(),window.open(p,"_blank")}},{children:o.jsx(a.default,{width:24,height:24,style:{color:n.getContrastColor(x),flexShrink:0}})})),o.jsx(r.motion.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:x,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:e=>e.stopPropagation()},{children:o.jsx(l.default,{color:n.getContrastColor(x),iconClassName:"w-6 h-6",text:p||""})}))]})),o.jsx("img",Object.assign({src:p,alt:u,style:{borderRadius:"8px",width:"100%",transition:"box-shadow 0.3s ease",boxShadow:v?"inset 0px 4px 10px rgba(0, 0, 0, 0.5)":"none"},onError:()=>h(!0)},!b&&{onClick:()=>y(!0)}))]}))]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),n=require("react"),i=require("./hooks/usePickaxeMarkdownContext.js"),s=require("react-markdown"),t=require("remark-gfm"),d=require("remark-math"),l=require("rehype-katex"),a=require("rehype-raw"),o=require("./Custom/A/index.js"),c=require("./Custom/P/index.js"),u=require("./Custom/Img/index.js"),h=require("./Custom/Iframe/index.js"),x=require("./Custom/Code/index.js"),p=require("./Custom/common/LinkPreview.js"),m=require("../../../../common/cn.js");function j(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=j(s),g=j(t),b=j(d),k=j(l),q=j(a);exports.PickaxeMarkdownRenderer=({className:s,style:t,value:d,recursion:l=!1,children:a,maxLines:j,multiLineBreaks:w,onExpandClick:y})=>{const{theme:v,accentColor:C,websiteMetadatas:D}=i.usePickaxeMarkdownContext(),[O,P]=n.useState({width:0,height:0}),M=n.useRef(null),_=n.useMemo((()=>{if(!d)return"";let e=d;e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),w&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e)));const r=M.current;if(j&&r){const n=j*parseInt(window.getComputedStyle(r).lineHeight,10);if(O.height>n){const r=8,n=Math.floor(O.width/r)*j;e=e.slice(0,n)+'<span class="pxe-expand-btn">...</span>'}}return e}),[d,w,j,O]),B={h1:({node:e,children:n})=>r.jsx("h1",{children:n}),h2:({node:e,children:n})=>r.jsx("h2",{children:n}),h3:({node:e,children:n})=>r.jsx("h3",{children:n}),h4:({node:e,children:n})=>r.jsx("h4",{children:n}),h5:({node:e,children:n})=>r.jsx("h5",{children:n}),p:c.default,a:o.default,ol:({node:e,children:n})=>r.jsx("ol",{children:n}),ul:({node:e,children:n})=>r.jsx("ul",{children:n}),li:({node:e,children:n})=>r.jsx("li",{children:n}),table:({children:e})=>r.jsx("div",Object.assign({className:"pxe-markdown-table"},{children:r.jsx("table",{children:e})})),th:({node:e,children:n})=>r.jsx("th",{children:n}),tr:({node:e,children:n})=>r.jsx("tr",Object.assign({style:{border:"dark"===v?"1px solid #30363D":"1px solid #D0D7DE"}},{children:n})),td:({node:e,children:n})=>r.jsx("td",{children:n}),code:x.default,blockquote:({node:e,children:n})=>r.jsx("blockquote",Object.assign({style:{borderLeft:"dark"===v?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===v?"#8B8B8B":"#656D76"}},{children:n})),img:u.default,iframe:h.default,hr:()=>r.jsx("hr",{style:{border:0,borderTop:"dark"===v?"1px solid #30363D":"1px solid #D0D7DE"}}),span:n=>{var{node:i,children:s}=n,t=e.__rest(n,["node","children"]);return"pxe-expand-btn"===t.className?r.jsx("span",Object.assign({},t,{style:Object.assign({display:"inline",fontWeight:500,color:C,marginLeft:".25rem",userSelect:"none"},y&&{cursor:"pointer"})},y&&{onClick:y},{children:s})):r.jsx("span",Object.assign({},t,{children:s}))},br:()=>r.jsx("br",{})};return n.useEffect((()=>{if(!M.current)return;const e=new ResizeObserver((e=>{for(const r of e){const{width:e,height:n}=r.contentRect;P({width:e,height:n})}}));return e.observe(M.current),()=>{e.disconnect()}}),[]),r.jsxs("div",Object.assign({className:"pxe-markdown",ref:M,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},t)},{children:[r.jsx(f.default,Object.assign({className:m.default("pxe-prose",s),components:B,remarkPlugins:[g.default,b.default],rehypePlugins:[k.default,q.default]},{children:`${_}${!l&&D.length>0?"\n\n---":""}`})),!l&&D.length>0&&r.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"2rem",marginTop:"2rem"}},{children:D.map(((e,n)=>r.jsx(p.default,{data:e},n)))})),a]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),n=require("react"),t=require("./hooks/usePickaxeMarkdownContext.js"),s=require("react-markdown"),i=require("remark-gfm"),l=require("remark-math"),d=require("rehype-katex"),a=require("rehype-raw"),o=require("./Custom/A/index.js"),c=require("./Custom/P/index.js"),u=require("./Custom/Img/index.js"),h=require("./Custom/Iframe/index.js"),x=require("./Custom/Code/index.js"),p=require("./Custom/common/LinkPreview.js"),m=require("../../../../common/cn.js");function j(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=j(s),g=j(i),b=j(l),k=j(d),q=j(a);exports.PickaxeMarkdownRenderer=({className:s,style:i,value:l,recursion:d=!1,children:a,maxLines:j,multiLineBreaks:w,onExpandClick:y})=>{const{theme:v,accentColor:C,websiteMetadatas:D}=t.usePickaxeMarkdownContext(),[O,M]=n.useState({width:0,height:0}),[P,S]=n.useState(null),$=n.useRef(null),E=n.useMemo((()=>{if(!l)return"";let e=l.trim();return e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),e=e.replace(/\\[\s\S]*?\\]/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")).replace(/\\\(\s*[\s\S]*?\s*\\\)/g,(e=>"$"+e.substring(2,e.length-2)+"$")),w&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e))),e||""}),[l,w]);n.useEffect((()=>{if(!j)return void S(null);if(!$.current||!E||P)return;const e=$.current,r=parseInt(window.getComputedStyle(e).lineHeight,10),n=j*r;if(!(O.height>n))return;const t=Math.floor(O.width/8),s=Math.floor(t*j);S(E.slice(0,s)+'<span class="pxe-expand-btn">...</span>')}),[E,j,O,P]);const _={h1:({node:e,children:n})=>r.jsx("h1",{children:n}),h2:({node:e,children:n})=>r.jsx("h2",{children:n}),h3:({node:e,children:n})=>r.jsx("h3",{children:n}),h4:({node:e,children:n})=>r.jsx("h4",{children:n}),h5:({node:e,children:n})=>r.jsx("h5",{children:n}),p:c.default,a:o.default,ol:({node:e,children:n})=>r.jsx("ol",{children:n}),ul:({node:e,children:n})=>r.jsx("ul",{children:n}),li:({node:e,children:n})=>r.jsx("li",{children:n}),table:({children:e})=>r.jsx("div",Object.assign({className:"pxe-markdown-table"},{children:r.jsx("table",{children:e})})),th:({node:e,children:n})=>r.jsx("th",{children:n}),tr:({node:e,children:n})=>r.jsx("tr",Object.assign({style:{border:"dark"===v?"1px solid #30363D":"1px solid #D0D7DE"}},{children:n})),td:({node:e,children:n})=>r.jsx("td",{children:n}),code:x.default,blockquote:({node:e,children:n})=>r.jsx("blockquote",Object.assign({style:{borderLeft:"dark"===v?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===v?"#8B8B8B":"#656D76"}},{children:n})),img:u.default,iframe:h.default,hr:()=>r.jsx("hr",{style:{border:0,borderTop:"dark"===v?"1px solid #30363D":"1px solid #D0D7DE"}}),span:n=>{var{node:t,children:s}=n,i=e.__rest(n,["node","children"]);return"pxe-expand-btn"===i.className?r.jsx("span",Object.assign({},i,{style:Object.assign({display:"inline",fontWeight:500,color:C,marginLeft:".25rem",userSelect:"none"},y&&{cursor:"pointer"})},y&&{onClick:y},{children:s})):r.jsx("span",Object.assign({},i,{children:s}))},br:()=>r.jsx("br",{})};n.useEffect((()=>{if(!$.current)return;const e=new ResizeObserver((e=>{for(const r of e){const{width:e,height:n}=r.contentRect;M({width:e,height:n})}}));return e.observe($.current),()=>{e.disconnect()}}),[]);const B=P||E,L=!d&&D.length>0?"\n\n---":"";return r.jsxs("div",Object.assign({className:"pxe-markdown",ref:$,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},i)},{children:[r.jsx(f.default,Object.assign({className:m.default("pxe-prose",s),components:_,remarkPlugins:[g.default,b.default],rehypePlugins:[k.default,q.default]},{children:`${B}${L}`})),!d&&D.length>0&&r.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"2rem",marginTop:"2rem"}},{children:D.map(((e,n)=>r.jsx(p.default,{data:e},n)))})),a]}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react");const t=o.createContext({}),r=({children:r,theme:n="light",syntaxTheme:a,accentColor:c="#228DD7",linkPreviews:l=!1,actions:i=!1})=>{const[s,d]=o.useState(n),[p,u]=o.useState(c),[C,m]=o.useState([]),[g,F]=o.useState(l),[h,b]=o.useState(i);return e.jsx(t.Provider,Object.assign({value:{theme:s,syntaxTheme:a||{'code[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",width:"max-content"},'pre[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",paddingTop:"1.5em",margin:".5em 0",overflow:"auto",borderRadius:"0.3em",background:"#1d1f21",width:"max-content"},':not(pre) > code[class*="language-"]':{background:"#1d1f21",padding:".1em",borderRadius:".3em"},comment:{color:"#7C7C7C"},prolog:{color:"#7C7C7C"},doctype:{color:"#7C7C7C"},cdata:{color:"#7C7C7C"},punctuation:{color:"#c5c8c6"},".namespace":{opacity:".7"},property:{color:"#96CBFE"},keyword:{color:"#96CBFE"},tag:{color:"#96CBFE"},"class-name":{color:"#FFFFB6",textDecoration:"underline"},boolean:{color:"#99CC99"},constant:{color:"#99CC99"},symbol:{color:"#f92672"},deleted:{color:"#f92672"},number:{color:"#FF73FD"},selector:{color:"#A8FF60"},"attr-name":{color:"#A8FF60"},string:{color:"#A8FF60"},char:{color:"#A8FF60"},builtin:{color:"#A8FF60"},inserted:{color:"#A8FF60"},variable:{color:"#C6C5FE"},operator:{color:"#EDEDED"},entity:{color:"#FFFFB6",cursor:"help"},url:{color:"#96CBFE"},".language-css .token.string":{color:"#87C38A"},".style .token.string":{color:"#87C38A"},atrule:{color:"#F9EE98"},"attr-value":{color:"#F9EE98"},function:{color:"#DAD085"},regex:{color:"#E9C062"},important:{color:"#fd971f",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},accentColor:p,websiteMetadatas:C,linkPreviews:g,actions:h,setTheme:d,setAccentColor:u,setWebsiteMetadatas:m,setLinkPreviews:F,setActions:b}},{children:r}))};exports.PickaxeMarkdown=r,exports.PickaxeMarkdownContext=t,exports.default=r;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react");const t=o.createContext({}),r=({children:r,theme:n="light",syntaxTheme:a,accentColor:c="#228DD7",linkPreviews:l=!1,actions:i=!1,readOnly:s=!1})=>{const[d,p]=o.useState(n),[u,C]=o.useState(c),[m,g]=o.useState([]),[F,h]=o.useState(l),[b,y]=o.useState(i);return e.jsx(t.Provider,Object.assign({value:{theme:d,syntaxTheme:a||{'code[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",width:"max-content"},'pre[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",paddingTop:"1.5em",margin:".5em 0",overflow:"auto",borderRadius:"0.3em",background:"#1d1f21",width:"max-content"},':not(pre) > code[class*="language-"]':{background:"#1d1f21",padding:".1em",borderRadius:".3em"},comment:{color:"#7C7C7C"},prolog:{color:"#7C7C7C"},doctype:{color:"#7C7C7C"},cdata:{color:"#7C7C7C"},punctuation:{color:"#c5c8c6"},".namespace":{opacity:".7"},property:{color:"#96CBFE"},keyword:{color:"#96CBFE"},tag:{color:"#96CBFE"},"class-name":{color:"#FFFFB6",textDecoration:"underline"},boolean:{color:"#99CC99"},constant:{color:"#99CC99"},symbol:{color:"#f92672"},deleted:{color:"#f92672"},number:{color:"#FF73FD"},selector:{color:"#A8FF60"},"attr-name":{color:"#A8FF60"},string:{color:"#A8FF60"},char:{color:"#A8FF60"},builtin:{color:"#A8FF60"},inserted:{color:"#A8FF60"},variable:{color:"#C6C5FE"},operator:{color:"#EDEDED"},entity:{color:"#FFFFB6",cursor:"help"},url:{color:"#96CBFE"},".language-css .token.string":{color:"#87C38A"},".style .token.string":{color:"#87C38A"},atrule:{color:"#F9EE98"},"attr-value":{color:"#F9EE98"},function:{color:"#DAD085"},regex:{color:"#E9C062"},important:{color:"#fd971f",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},accentColor:u,websiteMetadatas:m,linkPreviews:F,actions:b,readOnly:s,setTheme:p,setAccentColor:C,setWebsiteMetadatas:g,setLinkPreviews:h,setActions:y}},{children:r}))};exports.PickaxeMarkdown=r,exports.PickaxeMarkdownContext=t,exports.default=r;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),o=require("../../../hooks/core/useHover.js"),s=require("../../../common/cn.js");exports.default=({color:t,children:i,className:n,isForceColor:l,onClick:a})=>{const c=o.useHover(),{isHover:u}=c,d=e.__rest(c,["isHover"]);return r.jsx("button",Object.assign({className:s.default("flex items-center gap-1 outline-none transition-all duration-300 ease-in-out",n)},(u||l)&&{style:{color:t}},a&&{onClick:e=>{e.stopPropagation(),a()}},d,{children:i}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),o=require("../../../hooks/core/useHover.js"),s=require("../../../common/cn.js");exports.default=({color:t,children:i,className:n,isForceColor:c,onClick:l})=>{const u=o.useHover(),{isHover:a}=u,d=e.__rest(u,["isHover"]);return r.jsx("button",Object.assign({className:s.default("flex items-center gap-1 outline-none transition-colors duration-300 ease-in-out",n)},(a||c)&&{style:{color:t}},l&&{onClick:e=>{e.stopPropagation(),l()}},d,{children:i}))};
@@ -1 +1 @@
1
- .pxe-prose p{font-weight:350;margin-bottom:.75rem}.pxe-prose a{font-weight:600;text-decoration:underline;text-underline-offset:.2rem}.pxe-prose iframe{margin-bottom:1.5rem}.pxe-prose blockquote{margin-bottom:2.5rem;padding-bottom:.25rem;padding-left:1rem;padding-top:.25rem}.pxe-prose hr{margin-bottom:1.5rem}.pxe-prose .pxe-markdown-code,.pxe-prose .pxe-markdown-image,.pxe-prose .pxe-markdown-youtube{margin-bottom:2.5rem}.pxe-prose ol{list-style-type:decimal}.pxe-prose ol,.pxe-prose ul{list-style-position:inside;margin-bottom:1.5rem;padding-left:1rem}.pxe-prose ul{list-style-type:disc}.pxe-prose li{margin:10px}.pxe-prose li>p{display:inline}.pxe-prose .pxe-markdown-table{margin-bottom:2.5rem;overflow:auto;position:relative}.pxe-prose table{font-size:.875rem;line-height:1.24rem;table-layout:fixed}.pxe-prose th{font-weight:600;text-align:left}.pxe-prose td,.pxe-prose th{padding:.75em 1em}.pxe-prose h1{font-size:2.25rem;line-height:2.5rem;margin-bottom:1.5rem}.pxe-prose h2{font-size:1.875rem;line-height:2.25rem;margin-bottom:1.5rem}.pxe-prose h3{font-size:1.5rem;line-height:2rem;margin-bottom:1.5rem}.pxe-prose h4{font-size:1.25rem}.pxe-prose h4,.pxe-prose h5{line-height:1.75rem;margin-bottom:1rem}.pxe-prose h5{font-size:1.125rem}.pxe-prose h2:not(:first-child),.pxe-prose h3:not(:first-child),.pxe-prose h4:not(:first-child),.pxe-prose h5:not(:first-child),.pxe-prose>p:not(:first-child) .pxe-markdown-image,.pxe-prose>p:not(:first-child) .pxe-markdown-youtube,.pxe-prose>pre:not(:first-child){margin-top:2.5rem}
1
+ .pxe-prose p{font-weight:350}.pxe-prose p:not(:only-child){margin-bottom:.75rem}.pxe-prose a{font-weight:600;text-decoration:underline;text-underline-offset:.2rem}.pxe-prose iframe{margin-bottom:1.5rem}.pxe-prose blockquote{margin-bottom:2.5rem;padding-bottom:.25rem;padding-left:1rem;padding-top:.25rem}.pxe-prose hr{margin-bottom:1.5rem}.pxe-prose .pxe-markdown-code,.pxe-prose .pxe-markdown-image,.pxe-prose .pxe-markdown-youtube{margin-bottom:2.5rem}.pxe-prose .pxe-action{margin-top:1rem}.pxe-prose ol{list-style-type:decimal}.pxe-prose ol,.pxe-prose ul{list-style-position:inside;margin-bottom:1.5rem;padding-left:1rem}.pxe-prose ul{list-style-type:disc}.pxe-prose li{margin:10px}.pxe-prose li>p{display:inline}.pxe-prose .pxe-markdown-table{margin-bottom:2.5rem;overflow:auto;position:relative}.pxe-prose table{font-size:.875rem;line-height:1.24rem;table-layout:fixed}.pxe-prose th{font-weight:600;text-align:left}.pxe-prose td,.pxe-prose th{padding:.75em 1em}.pxe-prose h1{font-size:2.25rem;line-height:2.5rem;margin-bottom:1.5rem}.pxe-prose h2{font-size:1.875rem;line-height:2.25rem;margin-bottom:1.5rem}.pxe-prose h3{font-size:1.5rem;line-height:2rem;margin-bottom:1.5rem}.pxe-prose h4{font-size:1.25rem}.pxe-prose h4,.pxe-prose h5{line-height:1.75rem;margin-bottom:1rem}.pxe-prose h5{font-size:1.125rem}.pxe-prose h2:not(:first-child),.pxe-prose h3:not(:first-child),.pxe-prose h4:not(:first-child),.pxe-prose h5:not(:first-child),.pxe-prose>p:not(:first-child) .pxe-markdown-image,.pxe-prose>p:not(:first-child) .pxe-markdown-youtube,.pxe-prose>pre:not(:first-child){margin-top:2.5rem}
@@ -6,6 +6,7 @@ export declare const usePickaxeMarkdownContext: () => {
6
6
  websiteMetadatas: import("..").WebsiteMetadata[];
7
7
  linkPreviews: boolean;
8
8
  actions: boolean;
9
+ readOnly: boolean;
9
10
  setTheme: import("../../../../../types/common").SetState<import("..").PickaxeMarkdownTheme>;
10
11
  setAccentColor: import("../../../../../types/common").SetState<string>;
11
12
  setWebsiteMetadatas: import("../../../../../types/common").SetState<import("..").WebsiteMetadata[]>;
@@ -14,6 +14,7 @@ type PickaxeMarkdownContextType = {
14
14
  websiteMetadatas: WebsiteMetadata[];
15
15
  linkPreviews: boolean;
16
16
  actions: boolean;
17
+ readOnly: boolean;
17
18
  setTheme: SetState<PickaxeMarkdownTheme>;
18
19
  setAccentColor: SetState<string>;
19
20
  setWebsiteMetadatas: SetState<WebsiteMetadata[]>;
@@ -27,7 +28,8 @@ export interface PickaxeMarkdownProps {
27
28
  accentColor?: string;
28
29
  linkPreviews?: boolean;
29
30
  actions?: boolean;
31
+ readOnly?: boolean;
30
32
  }
31
33
  export declare const PickaxeMarkdownContext: import("react").Context<PickaxeMarkdownContextType>;
32
- export declare const PickaxeMarkdown: ({ children, theme: _theme, syntaxTheme, accentColor: _accentColor, linkPreviews: _linkPreviews, actions: _actions, }: PickaxeMarkdownProps) => import("react/jsx-runtime").JSX.Element;
34
+ export declare const PickaxeMarkdown: ({ children, theme: _theme, syntaxTheme, accentColor: _accentColor, linkPreviews: _linkPreviews, actions: _actions, readOnly, }: PickaxeMarkdownProps) => import("react/jsx-runtime").JSX.Element;
33
35
  export default PickaxeMarkdown;
@@ -0,0 +1 @@
1
+ import*as r from"react";var e;function t(){return t=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},t.apply(null,arguments)}var n=n=>r.createElement("svg",t({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16"},n),e||(e=r.createElement("path",{fill:"currentColor",d:"M5 15.333h8c.733 0 1.333-.6 1.333-1.333V4.667H13V14H5zm-2-2.666h7.333c.734 0 1.334-.6 1.334-1.334V2c0-.733-.6-1.333-1.334-1.333H3c-.733 0-1.333.6-1.333 1.333v9.333c0 .734.6 1.334 1.333 1.334"})));export{n as default};
@@ -0,0 +1 @@
1
+ import*as r from"react";var e;function t(){return t=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},t.apply(null,arguments)}var n=n=>r.createElement("svg",t({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 16 16"},n),e||(e=r.createElement("path",{fill:"currentColor",d:"M5 15.333h8c.733 0 1.333-.6 1.333-1.333V4.667H13V14H5zm-2-2.666h7.333c.733 0 1.333-.6 1.333-1.334V2c0-.733-.6-1.333-1.333-1.333H3c-.734 0-1.334.6-1.334 1.333v9.333c0 .734.6 1.334 1.334 1.334M3 2h7.333v9.333H3z"})));export{n as default};
@@ -1 +1 @@
1
- import*as a from"react";var c,e,t,l;function r(){return r=Object.assign?Object.assign.bind():function(a){for(var c=1;c<arguments.length;c++){var e=arguments[c];for(var t in e)({}).hasOwnProperty.call(e,t)&&(a[t]=e[t])}return a},r.apply(null,arguments)}var n=n=>a.createElement("svg",r({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18"},n),c||(c=a.createElement("path",{fill:"#1C1C1C",d:"M15.014 17.998c-.74-.29-1.195-.922-1.73-1.451-1.31-1.296-2.605-2.606-3.907-3.91-.18-.18-.359-.364-.55-.533a1.45 1.45 0 0 1-.418-.633c-.161-.483-.458-.867-.829-1.208-.714-.656-1.382-1.359-2.067-2.045-.167-.166-.17-.174-.329.003-.09.1-.14.104-.237.001-.285-.302-.587-.589-.876-.887-.106-.11-.164-.11-.267.018-.658.82-.97 1.758-.991 2.799-.01.497-.005.937.002 1.435.002.125-.071.204-.215.21a27 27 0 0 0-.954.005c-.654-.03-1.138-.343-1.456-.915-.127-.211-.158-.241-.19-.342V9.68l.093-.885c.11-.964.394-1.878.778-2.765.243-.56.551-1.082.876-1.596.03-.048.055-.082.032-.145-.18-.51-.106-.99.253-1.388.344-.381.68-.784 1.131-1.05.342-.202.717-.222 1.092-.099.087.029.139.023.209-.024a9.8 9.8 0 0 1 1.872-1A10 10 0 0 1 8.702.092a10 10 0 0 1 1.434-.098c.657.01 1.123.335 1.458.878.16.262.224.55.22.856-.005.3 0 0 .002.867.006.147-.097.213-.234.212-.57-.003-1.09-.017-1.66.011a4.3 4.3 0 0 0-2.564.978c-.13.107-.116.168-.011.27.287.275.564.561.853.835.118.112.152.2-.002.305-.12.081-.12.15-.006.264q1.177 1.17 2.335 2.357c.253.259.554.428.885.554.299.114.553.286.78.515 1.507 1.518 3.022 3.03 4.533 4.544.314.315.641.617.932.956.374.436.447 1.21.196 1.72-.219.444-.6.734-.925 1.076-.24.254-.473.519-.81.659-.076.032-.166.042-.238.085 0 0-.177.044-.403.062-.18.015-.462 0-.462 0zM3.214 4.324c.005.07-.05.107-.084.153-.141.19-.293.374-.426.57a9 9 0 0 0-1.329 3.027c-.155.663-.22 1.334-.24 2.011-.008.269.128.438.375.553.145.068.174.03.175-.114 0-.485-.002-.967.098-1.449a5.9 5.9 0 0 1 .556-1.543c.364-.692.87-1.273 1.448-1.796.12-.109.196-.1.303.01.284.292.583.571.862.869.097.102.15.081.227-.005.054-.062.104-.132.192-.152.023.034.04.074.07.102 1.046 1.045 2.09 2.093 3.143 3.132.314.309.59.63.731 1.06q.125.38.424.674c1.228 1.217 2.445 2.444 3.668 3.666.546.545 1.091 1.091 1.647 1.626.23.222.519.213.754-.01q.449-.425.88-.867c.272-.28.259-.582-.024-.865-1.593-1.594-3.188-3.184-4.774-4.784-.432-.435-.862-.857-1.472-1.035a.7.7 0 0 1-.307-.18Q8.997 7.857 7.88 6.74c-.468-.467-.94-.928-1.41-1.392a.33.33 0 0 1 .133-.163c.115-.084.112-.152.008-.252-.294-.284-.577-.581-.869-.869-.098-.097-.114-.172-.003-.278.188-.18.359-.378.551-.557a5.75 5.75 0 0 1 3.137-1.514c.364-.054.73-.039 1.096-.035.15.001.174-.037.115-.177-.107-.254-.28-.384-.566-.377-.925.023-1.831.152-2.715.444a9.2 9.2 0 0 0-2.434 1.218c-.198.139-.366.32-.59.42-.109-.11-.212-.224-.326-.327-.12-.107-.261-.104-.373.001q-.383.362-.745.745c-.112.12-.11.26.01.384q.156.158.315.313"})),e||(e=a.createElement("path",{fill:"#EBA300",d:"M6.474 5.344c.47.464.943.926 1.41 1.393q1.117 1.116 2.232 2.237a.7.7 0 0 0 .306.18c.61.177 1.04.6 1.472 1.034 1.586 1.6 3.182 3.191 4.774 4.785.283.283.296.584.023.864a30 30 0 0 1-.879.868c-.234.222-.523.232-.754.01-.555-.535-1.1-1.081-1.647-1.626-1.223-1.222-2.44-2.45-3.668-3.666a1.7 1.7 0 0 1-.423-.674c-.142-.43-.418-.751-.731-1.06-1.053-1.04-2.097-2.087-3.144-3.132-.029-.029-.047-.068-.07-.103.095-.201.289-.312.434-.467.21-.225.423-.45.664-.643"})),t||(t=a.createElement("path",{fill:"#CCC",d:"M6.472 5.347a6.4 6.4 0 0 0-.665.643c-.145.155-.339.266-.434.467-.088.02-.138.091-.192.153-.076.086-.13.107-.226.004-.28-.297-.578-.576-.863-.869-.107-.11-.183-.118-.303-.01-.578.524-1.084 1.104-1.448 1.797q-.385.729-.555 1.543c-.101.482-.099.964-.1 1.449 0 .145-.029.182-.174.114-.246-.115-.383-.284-.375-.553.02-.677.085-1.348.24-2.011a9 9 0 0 1 1.33-3.027c.132-.197.284-.38.425-.57.035-.046.09-.084.085-.153.006 0 .015.003.017 0q.529-.57 1.1-1.099c.003-.003 0-.012 0-.018.225-.1.394-.28.591-.42A9.2 9.2 0 0 1 7.36 1.57c.883-.292 1.789-.421 2.714-.444.287-.007.459.123.566.377.06.14.035.179-.115.177-.366-.003-.733-.018-1.096.035a5.75 5.75 0 0 0-3.137 1.515c-.192.178-.363.376-.551.557-.111.106-.095.18.004.278.29.288.574.584.868.868.104.1.107.169-.007.253a.34.34 0 0 0-.134.162"})),l||(l=a.createElement("path",{fill:"#EBA300",d:"M4.338 3.21q.002.012-.001.018-.571.529-1.1 1.099c-.002.003-.011 0-.017 0q-.159-.155-.316-.313c-.12-.124-.121-.264-.009-.384q.362-.383.745-.745c.112-.105.253-.109.373 0 .114.102.217.216.325.326"})));export{n as default};
1
+ import*as r from"react";var e,t;function n(){return n=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},n.apply(null,arguments)}var a=a=>r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 48 48"},a),e||(e=r.createElement("path",{fill:"currentColor",d:"m24.547 19.397-19.538 19.5L9.121 43 28.66 23.5z"})),t||(t=r.createElement("path",{fill:"currentColor",d:"m35.752 16.428 2.158-2.154-4.11-4.102-2.158 2.154A31.57 31.57 0 0 0 11.378 5v5.804c14.268 0 25.886 11.596 25.886 25.835h5.815c0-7.674-2.753-14.73-7.34-20.211z"})));export{a as default};
@@ -1 +1 @@
1
- import{useState as e,useRef as o,useMemo as r,useEffect as l}from"react";import{useScrollContext as n}from"./useScrollContext.js";const t=({auto:t})=>{const{scrollContainerRef:s,scrollTargetRef:c,isLocked:u,isScrollSession:i,isScrollIncreasing:d,setIsLocked:v,setIsScrollSession:a,setIsScrolling:m,setIsScrollIncreasing:E}=n(),[S,f]=e(0),p=o(!1),g=r((()=>s&&s.current?s.current:"undefined"==typeof window?null:window),[s]);l((()=>{if(!g)return;const e=e=>{i&&u&&("mousedown"===e.type||"wheel"===e.type||"DOMMouseScroll"===e.type||"mousewheel"===e.type)&&v(!1)};return null==g||g.addEventListener("scroll",e),null==g||g.addEventListener("mousedown",e),null==g||g.addEventListener("wheel",e),null==g||g.addEventListener("DOMMouseScroll",e),null==g||g.addEventListener("mousewheel",e),()=>{null==g||g.removeEventListener("scroll",e),null==g||g.removeEventListener("mousedown",e),null==g||g.removeEventListener("wheel",e),null==g||g.removeEventListener("DOMMouseScroll",e),null==g||g.removeEventListener("mousewheel",e)}}),[g,i,u]),l((()=>{p.current=!u}),[u]),l((()=>{const e=setInterval((()=>{if(s.current){const e=s.current.scrollHeight;if(e===S)return;const o=e>S;E(o),f(e),o&&t&&w()}}),100);return()=>clearInterval(e)}),[s,S]);const w=()=>{try{if(m(!0),!s.current)return void("development"===process.env.NODE_ENV&&console.log("[useScroll] scrollContainerRef not detected"));if(p.current)return;const e=s.current.scrollHeight;s.current.scrollTo({top:e,behavior:"smooth"}),"development"===process.env.NODE_ENV&&console.log("[useScroll] scrolled scrollContainerRef")}finally{m(!1)}};return{isScrollIncreasing:d,scrollStartSession:()=>{a(!0),v(!0),p.current=!1},scrollEndSession:()=>{a(!1)},scrollToBottom:w,scrollToTarget:()=>{try{m(!0);const e=s.current||window;if(!c.current)return void("development"===process.env.NODE_ENV&&console.log("[useScroll] scrollTargetRef not detected"));const o=e.scrollHeight;e.scrollTo({top:o,behavior:"smooth"}),"development"===process.env.NODE_ENV&&console.log("[useScroll] scrolled scrollTargetRef")}finally{m(!1)}}}};export{t as useScroll};
1
+ import{useState as e,useRef as r,useMemo as n,useEffect as t}from"react";import{useScrollContext as o}from"./useScrollContext.js";const l=({auto:l})=>{const{scrollContainerRef:s,scrollTargetRef:c,isLocked:u,isScrollSession:i,isScrollIncreasing:d,setIsLocked:v,setIsScrollSession:a,setIsScrolling:g,setIsScrollIncreasing:m}=o(),[f,p]=e(0),w=r(!1),E=n((()=>s&&s.current?s.current:"undefined"==typeof window?null:window),[s]);t((()=>{if(!E)return;const e=e=>{i&&u&&("mousedown"===e.type||"wheel"===e.type||"DOMMouseScroll"===e.type||"mousewheel"===e.type)&&v(!1)};return null==E||E.addEventListener("scroll",e),null==E||E.addEventListener("mousedown",e),null==E||E.addEventListener("wheel",e),null==E||E.addEventListener("DOMMouseScroll",e),null==E||E.addEventListener("mousewheel",e),()=>{null==E||E.removeEventListener("scroll",e),null==E||E.removeEventListener("mousedown",e),null==E||E.removeEventListener("wheel",e),null==E||E.removeEventListener("DOMMouseScroll",e),null==E||E.removeEventListener("mousewheel",e)}}),[E,i,u]),t((()=>{w.current=!u}),[u]),t((()=>{const e=setInterval((()=>{if(!s.current)return;const e=s.current.scrollHeight;if(e===f)return;const r=e>f;m(r),p(e),r&&l&&S()}),100);return()=>clearInterval(e)}),[s,f]),t((()=>{const e=setInterval((()=>{if(s.current)return;if(!c.current)return;const e=c.current.getBoundingClientRect().top+c.current.getBoundingClientRect().height+window.scrollY;if(e===f)return;const r=e>f;m(r),p(e),r&&l&&h()}),100);return()=>clearInterval(e)}),[c,f]);const S=()=>{try{if(g(!0),!s.current)return void("development"===process.env.NODE_ENV&&console.log("[useScroll] scrollContainerRef not detected"));if(w.current)return;const e=s.current.scrollHeight;s.current.scrollTo({top:e,behavior:"smooth"}),"development"===process.env.NODE_ENV&&console.log("[useScroll] scrolled scrollContainerRef")}finally{g(!1)}},h=()=>{try{if(g(!0),!c.current)return void("development"===process.env.NODE_ENV&&console.log("[useScroll] scrollTargetRef not detected"));const e=c.current.getBoundingClientRect().top+c.current.getBoundingClientRect().height+window.scrollY;window.scroll({top:e,behavior:"smooth"}),"development"===process.env.NODE_ENV&&console.log("[useScroll] scrolled scrollTargetRef")}finally{g(!1)}};return{isScrollIncreasing:d,scrollStartSession:()=>{a(!0),v(!0),w.current=!1},scrollEndSession:()=>{a(!1)},scrollToBottom:S,scrollToTarget:h}};export{l as useScroll};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useState as o,Fragment as t}from"react";import{usePickaxeContext as a}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as c}from"../../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdown as i}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as r}from"../../common/PickaxeMarkdown/Renderer.js";import n from"../../common/PickaxeIcon.js";import l from"./Document.js";import m from"../../common/PickaxeCopyButton.js";import d from"../../../../common/cn.js";const x=({index:x,message:p})=>{var h;const{formId:u,pickaxe:f,styles:b,colors:v,misc:g,responsiveBy:j}=a(),[w,k]=o(!1),y=c(),N=null!==(h=null==f?void 0:f.chaticon)&&void 0!==h?h:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${u}.png`;return"assistant"===p.role?e("div",Object.assign({className:d("flex flex-col","viewport"===j?"min-[767px]:max-w-[80%]":"@[767px]/pickaxe-root:max-w-[80%]")},{children:s("div",Object.assign({className:"flex gap-x-3"},{children:[g.isChatImage&&"NONE"!==N&&e(n,{src:N,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:v.text}),s("div",Object.assign({className:"flex flex-col"},{children:[e("div",Object.assign({className:d(y.b2,"chat-message overflow-x-auto overflow-y-hidden pt-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B]"),style:{borderRadius:b.cornerRadius}},{children:e(i,Object.assign({theme:b.theme,accentColor:v.accent,linkPreviews:!0,actions:!0},{children:e(r,Object.assign({value:p.content},0===x&&{maxLines:w?void 0:4,onExpandClick:()=>k(!0)}))}))})),e("div",Object.assign({className:"mt-2 flex gap-3"},{children:e(m,{color:v.accent,text:p.content})}))]}))]}))})):"user"===p.role?e("div",Object.assign({className:d("flex gap-x-3 justify-self-end pl-9","viewport"===j?"min-[767px]:max-w-[80%] min-[767px]:pl-0":"@[767px]/pickaxe-root:max-w-[80%] @[767px]/pickaxe-root:pl-0")},{children:s("div",Object.assign({className:d(y.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3"),style:{backgroundColor:v.secondary+"80",color:v.secondaryText,borderRadius:b.cornerRadius}},{children:[p.documentIds&&p.documentIds.length>0&&e("div",Object.assign({className:"flex flex-col items-end"},{children:p.documentIds.map((s=>e(t,{children:s.startsWith("IMAGE-")?e("div",Object.assign({className:"max-w-[300px]"},{children:e("img",{style:{borderRadius:b.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${s.split("-")[2]}/${s.split("-")[1]}.${null==s?void 0:s.split("-")[2]}`,alt:""})})):e(l,{documentId:s})},s)))})),e(i,Object.assign({theme:b.theme,accentColor:v.accent},{children:e(r,{value:p.content})}))]}))})):e("div",{})};export{x as default};
1
+ import{jsx as e,jsxs as s}from"react/jsx-runtime";import{useState as o,Fragment as t}from"react";import{usePickaxeContext as a}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as c}from"../../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdown as i}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as r}from"../../common/PickaxeMarkdown/Renderer.js";import n from"../../common/PickaxeIcon.js";import l from"./Document.js";import m from"../../common/PickaxeCopyButton.js";import d from"../../../../common/cn.js";const x=({index:x,message:p})=>{var h;const{formId:u,pickaxe:f,styles:b,colors:v,misc:g,responsiveBy:w,isNewChat:j}=a(),[k,y]=o(!1),N=c(),O=null!==(h=null==f?void 0:f.chaticon)&&void 0!==h?h:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${u}.png`;return"assistant"===p.role?e("div",Object.assign({className:d("flex flex-col","viewport"===w?"min-[767px]:max-w-[80%]":"@[767px]/pickaxe-root:max-w-[80%]")},{children:s("div",Object.assign({className:"flex gap-x-3"},{children:[g.isChatImage&&"NONE"!==O&&e(n,{src:O,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:v.text}),s("div",Object.assign({className:"flex flex-col"},{children:[e("div",Object.assign({className:d(N.b2,"chat-message overflow-x-auto overflow-y-hidden pt-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B]")},{children:e(i,Object.assign({theme:b.theme,accentColor:v.accent,linkPreviews:!0,actions:!0},{children:e(r,Object.assign({value:p.content},0===x&&j&&{maxLines:k?void 0:4,onExpandClick:()=>y(!0)}))}))})),e("div",Object.assign({className:"mt-4 flex gap-3"},{children:e(m,{color:v.accent,text:p.content})}))]}))]}))})):"user"===p.role?e("div",Object.assign({className:d("flex gap-x-3 justify-self-end pl-9","viewport"===w?"min-[767px]:max-w-[80%] min-[767px]:pl-0":"@[767px]/pickaxe-root:max-w-[80%] @[767px]/pickaxe-root:pl-0")},{children:s("div",Object.assign({className:d(N.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3"),style:{backgroundColor:v.secondary+"80",color:v.secondaryText,borderRadius:b.cornerRadius}},{children:[p.documentIds&&p.documentIds.length>0&&e("div",Object.assign({className:"flex flex-col items-end"},{children:p.documentIds.map((s=>e(t,{children:s.startsWith("IMAGE-")?e("div",Object.assign({className:"max-w-[300px]"},{children:e("img",{style:{borderRadius:b.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${s.split("-")[2]}/${s.split("-")[1]}.${null==s?void 0:s.split("-")[2]}`,alt:""})})):e(l,{documentId:s})},s)))})),e(i,Object.assign({theme:b.theme,accentColor:v.accent},{children:e(r,{value:p.content})}))]}))})):e("div",{})};export{x as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useState as a,useRef as o,useMemo as t,useCallback as r,useEffect as n}from"react";import{usePickaxeContext as i}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as c}from"../../../../hooks/pickaxe/useResponseContext.js";import{useStyleFontSize as l}from"../../../../hooks/studio/useStyleFontSize.js";import{useConversation as m}from"../../../../hooks/pickaxe/useConversation.js";import{useDebounce as d}from"../../../../hooks/core/useDebounce.js";import p from"../../common/PickaxeIcon.js";import u from"../../../Core/ErrorAlert.js";import f from"../../Addons/Scroll/ScrollLockView.js";import x from"../../common/PickaxeHead.js";import g from"../../common/PickaxeCompactHead.js";import h from"../../common/PickaxeInfoModal.js";import b from"../../common/PickaxeUpgradeCard.js";import j from"./Message.js";import k from"../../../../common/cn.js";const E=()=>{var E;const w=m(),v=l(),{pickaxe:y,styles:N,colors:C,responsiveBy:O,isNewChat:B,setChatId:F,isEmbed:P}=i(),{messages:S,status:I,limitData:R,error:T}=c(),[z,H]=a(!1),[L,A]=a(!1),D=o(null),M=o(null),$=o(null),U=t((()=>!!w.data&&!(w.data.messages.length<=1)),[w.data]),V=t((()=>w.isSuccess&&B&&!U),[w.isSuccess,B,U]),_=d((()=>{q()}),200),q=r((()=>{if(!D.current||!$.current)return;const e=D.current.getBoundingClientRect(),s=$.current.getBoundingClientRect().top-e.top;A(s<=210)}),[]);return n((()=>{if(!D.current||!$.current)return;const e=new ResizeObserver((()=>{_()}));return e.observe(D.current),e.observe($.current),()=>{e.disconnect()}}),[]),e("div",Object.assign({ref:D,className:k("relative flex flex-grow flex-col",!P||!L&&V?"justify-end":"justify-between gap-y-4")},{children:[z&&s(h,{isOpen:z,onChangeIsOpen:H}),!P||!L&&V?s("div",Object.assign({ref:M,className:k("absolute left-1/2 top-0 flex w-full max-w-[550px] -translate-x-1/2 -translate-y-1/3 transform flex-col items-center px-4 opacity-0 duration-300",V&&!L&&"top-1/4 opacity-100")},{children:s(x,{iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>F("")})})):s(g,{}),s("div",Object.assign({ref:$,className:"pxe-messages-container flex w-full justify-center"},{children:w.isLoading?e("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[s("div",{className:"h-10 w-[70%] animate-pulse justify-self-end rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===N.theme?"#1E1E1F":"#E5E7EB"}}),s("div",{className:"h-[150px] w-[70%] animate-pulse rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===N.theme?"#1E1E1F":"#E5E7EB"}}),s("div",{className:"h-10 w-[50%] animate-pulse justify-self-end rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===N.theme?"#1E1E1F":"#E5E7EB"}})]})):w.isError?s("div",Object.assign({className:"flex w-full max-w-[800px] justify-center pt-10"},{children:e("p",Object.assign({className:k(v.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",s("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):e("div",Object.assign({className:"flex flex-col w-full"},{children:[e("div",Object.assign({className:k("relative grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-4 pt-6","viewport"===O?"min-[767px]:pt-10":"@[767px]/pickaxe-root:pt-10")},{children:[w.data.messages.map(((e,a)=>s(j,{index:a,message:e},a))),S.map(((e,a)=>s(j,{index:w.data.messages.length+a,message:e},a))),"fetching"===I?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:["NONE"!==(null==y?void 0:y.chaticon)&&s(p,{src:null!==(E=null==y?void 0:y.chaticon)&&void 0!==E?E:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==y?void 0:y.formid}.png`,alt:`${null==y?void 0:y.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:C.text}),e("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4",style:{backgroundColor:C.secondary+"80",color:C.secondaryText}},{children:[s("div",{className:"h-1.5 w-1.5 animate-dot rounded-full",style:{backgroundColor:C.secondaryText}}),s("div",{className:"h-1.5 w-1.5 animate-dot-down rounded-full",style:{backgroundColor:C.secondaryText}}),s("div",{className:"h-1.5 w-1.5 animate-dot rounded-full",style:{backgroundColor:C.secondaryText}})]}))]})):R?s("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:s(b,{})})):T?s("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:s(u,{error:T})})):null]})),s(f,{className:"w-full"})]}))}))]}))};export{E as default};
1
+ import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useState as o,useRef as t,useMemo as a,useCallback as r,useEffect as n}from"react";import{usePickaxeContext as i}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as l}from"../../../../hooks/pickaxe/useResponseContext.js";import{useStyleFontSize as c}from"../../../../hooks/studio/useStyleFontSize.js";import{useConversation as m}from"../../../../hooks/pickaxe/useConversation.js";import{useDebounce as d}from"../../../../hooks/core/useDebounce.js";import u from"../../common/PickaxeIcon.js";import p from"../../../Core/ErrorAlert.js";import f from"../../Addons/Scroll/ScrollLockView.js";import g from"../../common/PickaxeHead.js";import x from"../../common/PickaxeCompactHead.js";import h from"../../common/PickaxeInfoModal.js";import b from"../../common/PickaxeUpgradeCard.js";import v from"./Message.js";import j from"../../../../common/cn.js";const k=()=>{var k;const E=m(),w=c(),{pickaxe:y,styles:N,colors:C,responsiveBy:O,isNewChat:B,setChatId:F,isEmbed:P}=i(),{messages:S,status:I,limitData:R,error:T}=l(),[z,H]=o(!1),[L,A]=o(!1),D=t(null),M=t(null),$=t(null),U=a((()=>!!E.data&&!(E.data.messages.length<=1)),[E.data]),V=a((()=>E.isSuccess&&B&&!U),[E.isSuccess,B,U]),_=a((()=>{var e,s;return!!S.length&&!(null!==(s=null===(e=null==S?void 0:S[S.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[S]),q=d((()=>{G()}),200),G=r((()=>{if(!D.current||!$.current)return;const e=D.current.getBoundingClientRect(),s=$.current.getBoundingClientRect().top-e.top;A(s<=210)}),[]);return n((()=>{if(!D.current||!$.current)return;const e=new ResizeObserver((()=>{q()}));return e.observe(D.current),e.observe($.current),()=>{e.disconnect()}}),[]),e("div",Object.assign({ref:D,className:j("relative flex flex-grow flex-col",!P||!L&&V?"justify-end":"justify-between gap-y-4")},{children:[z&&s(h,{isOpen:z,onChangeIsOpen:H}),!P||!L&&V?s("div",Object.assign({ref:M,className:j("absolute left-1/2 top-0 flex w-full max-w-[550px] -translate-x-1/2 -translate-y-1/3 transform flex-col items-center px-4 opacity-0 duration-300",V&&!L&&"top-1/4 opacity-100")},{children:s(g,{iconClassName:"duration-300 hover:opacity-90",maxLines:2,onIconClick:()=>F("")})})):s(x,{}),s("div",Object.assign({ref:$,className:"pxe-messages-container flex w-full justify-center"},{children:E.isLoading?e("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[s("div",{className:"h-10 w-[70%] animate-pulse justify-self-end rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===N.theme?"#1E1E1F":"#E5E7EB"}}),s("div",{className:"h-[150px] w-[70%] animate-pulse rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===N.theme?"#1E1E1F":"#E5E7EB"}}),s("div",{className:"h-10 w-[50%] animate-pulse justify-self-end rounded bg-[#E5E7EB] dark:bg-[#1E1E1F]",style:{backgroundColor:"dark"===N.theme?"#1E1E1F":"#E5E7EB"}})]})):E.isError?s("div",Object.assign({className:"flex w-full max-w-[800px] justify-center pt-10"},{children:e("p",Object.assign({className:j(w.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",s("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):e("div",Object.assign({className:"flex flex-col w-full"},{children:[e("div",Object.assign({className:j("relative grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-4 pt-6","viewport"===O?"min-[767px]:pt-10":"@[767px]/pickaxe-root:pt-10")},{children:[E.data.messages.map(((e,o)=>s(v,{index:o,message:e},o))),S.map(((e,o)=>s(v,{index:E.data.messages.length+o,message:e},o))),"fetching"===I||_?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:["NONE"!==(null==y?void 0:y.chaticon)&&s(u,{src:null!==(k=null==y?void 0:y.chaticon)&&void 0!==k?k:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==y?void 0:y.formid}.png`,alt:`${null==y?void 0:y.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6",textColor:C.text}),e("div",Object.assign({className:"flex items-center gap-x-2 rounded px-4 py-4",style:{backgroundColor:C.secondary+"80",color:C.secondaryText}},{children:[s("div",{className:"h-1.5 w-1.5 animate-dot rounded-full",style:{backgroundColor:C.secondaryText}}),s("div",{className:"h-1.5 w-1.5 animate-dot-down rounded-full",style:{backgroundColor:C.secondaryText}}),s("div",{className:"h-1.5 w-1.5 animate-dot rounded-full",style:{backgroundColor:C.secondaryText}})]}))]})):R?s("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:s(b,{})})):T?s("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:s(p,{error:T})})):null]})),s(f,{className:"w-full"})]}))}))]}))};export{k as default};
@@ -1 +1 @@
1
- import{__rest as e,__awaiter as t}from"../../../_virtual/_tslib.js";import{jsxs as o,jsx as s}from"react/jsx-runtime";import{useState as r,useRef as i,useMemo as n,useEffect as a,Fragment as l}from"react";import{usePickaxeContext as d}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as c}from"../../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as u}from"../../../hooks/pickaxe/useDimensionContext.js";import{useStyleInput as m}from"../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as p}from"../../../hooks/studio/useStyleFontSize.js";import{useConversation as f}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as h}from"../../../hooks/pickaxe/useSubmit.js";import{useSubmitResult as g}from"../../../hooks/pickaxe/useSubmitResult.js";import{allowedFileMimeTypes as b,allowedImageMimeTypes as v}from"../../../common/documents.js";import{streamer as x}from"../../../common/api/streamer.js";import{useDocument as j}from"../Addons/Document/hooks/useDocument.js";import{useScroll as y}from"../Addons/Scroll/hooks/useScroll.js";import{useHover as k}from"../../../hooks/core/useHover.js";import{formatBytes as I}from"../../../common/utils.js";import w from"../../Icons/attach-vertical.svg.js";import O from"../../Icons/spinner-lines.svg.js";import N from"../../Icons/file.svg.js";import C from"../../Icons/x.svg.js";import S from"../../Icons/arrow-right.svg.js";import R from"../common/PickaxeBranding.js";import D from"../Addons/IceBreaker/index.js";import A from"react-textarea-autosize";import U from"../../../common/error.js";import T from"../../../common/cn.js";const E=()=>{var E;const{formId:H,chatId:z,userId:B,studioUserId:L,deploymentId:F,pickaxe:M,styles:P,colors:W,misc:$,chatInput:G,responsiveBy:K,forceMobile:_,isNewChat:q,setIsNewChat:J,setIsShowIceBreaker:Q,onGenerateComplete:V}=d(),{messages:X,status:Y,limits:Z,setMessages:ee,setStatus:te,setLimitData:oe,setError:se,setIsGenerating:re}=c(),{isMobile:ie}=u(),{documents:ne,isUploading:ae,isImageUploadAllowed:le,upsertDocuments:de,onFileUpload:ce}=j(),{scrollStartSession:ue,scrollEndSession:me,scrollToBottom:pe}=y({auto:!0}),fe=f(),he=h(),ge=g(),be=p(),ve=m(),[xe,je]=r(G),ye=i(null),ke=k(),{isHover:Ie}=ke,we=e(ke,["isHover"]),Oe=k(),{isHover:Ne}=Oe,Ce=e(Oe,["isHover"]),Se=n((()=>{var e,t,o;return!!q&&(!!M&&(!fe.isLoading&&(!((null!==(t=null===(e=fe.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&!!(null===(o=M.icebreakers)||void 0===o?void 0:o.length))))}),[M,q,fe.data,fe.isLoading]),Re=e=>t(void 0,void 0,void 0,(function*(){try{if(ae||"idle"!==Y)return;const t=null!=e?e:xe;if(!t)return;je(""),se(""),oe(null),re(!0),J(!1);const o=new Date,s="enduserupload"===(null==M?void 0:M.documentuploadtype),r=ne.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),i=r.length?r[r.length-1].documentId:"";te("fetching"),ue(),pe();const n=Array.from(X);let a=[...n,{id:X.length+1,role:"user",content:t}];ee(a),pe();const{success:l,data:d,actionData:c,usedDocumentIds:u,endUserDocumentId:m,endUserImageId:p,rawUserInput:f,error:h}=yield he.mutateAsync(Object.assign(Object.assign(Object.assign({formId:H,responseId:z,value:t},s&&i&&{documentId:i}),L&&{studioUserId:L}),F&&{deploymentId:F}));if(!l)throw new Error(null!=h?h:"An error occurred, please try again.");const g=[];m&&g.push(m),p&&g.push(p),g.length>0&&(a=[...n,Object.assign({id:X.length+1,role:"user",content:t},g&&{documentIds:g})],ee(a),pe()),de([]),pe();const b=(yield x({formId:H,responseId:z,data:d,actionData:c})).body;if(!b)throw new Error("Streaming error");const v=b.getReader(),j=new TextDecoder,y=a.length;let k="",I=!0,w=!1;for(;I;){const{value:e,done:t}=yield v.read();I=!t;if(k+=j.decode(e),k)ee([...a.slice(0,y),{id:X.length+1,role:"assistant",content:k}]),w||(te("streaming"),w=!0);else if(!I&&!k)throw new Error("Server error")}const O=new Date;k&&(pe(),te("idle"),yield ge.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:H,responseId:z,documentIds:u},B&&{userId:B}),L&&{studioUserId:L}),L&&(null==M?void 0:M.studioid)&&{studioId:M.studioid}),F&&{deploymentId:F}),{messages:[Object.assign(Object.assign({role:"user",message:f},g&&{documentIds:g}),{sentAt:o}),{role:"assistant",message:k,sentAt:O}]})),null==V||V(z))}catch(e){let t=U(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const o=Object.entries(Z).find((([e])=>t.includes(e)));o?oe(o[1]):se(t),pe()}finally{te("idle"),re(!1),me()}}));return a((()=>{Q(Se)}),[Se]),a((()=>{je(G)}),[G]),o("div",Object.assign({className:T("fixed flex w-full flex-col bottom-0 left-0","viewport"===K?"min-[767px]:relative min-[767px]:bottom-auto min-[767px]:left-auto":"absolute @[767px]/pickaxe-root:relative @[767px]/pickaxe-root:bottom-auto @[767px]/pickaxe-root:left-auto")},{children:[!$.isWhiteLabel&&s("div",Object.assign({className:"flex justify-end pr-3 pb-3 @[767px]/pickaxe-root:pr-0"},{children:s(R,{animateHover:!0})})),Se&&s(D,{data:(null==M?void 0:M.icebreakers)||[],onSend:Re}),o("div",Object.assign({id:(null==M?void 0:M.formid)+"--chat-parent",style:Object.assign(Object.assign({},ve),(ie||_)&&{paddingLeft:"0.75rem",paddingRight:"0.75rem"}),className:T("flex min-h-[56px] flex-col gap-y-2 px-4 py-3 pb-[15px]","block"===P.formFieldStyle&&"shadow")},{children:["idle"===Y&&ne.length>0&&s("div",Object.assign({className:T("grid grid-cols-1","viewport"===K?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:ne.map((e=>{var t,r,i;return s(l,{children:"document"===e.type?o("div",Object.assign({className:"relative gap-x-[10px] flex items-center px-2 h-[56px] border",style:{borderRadius:ve.borderRadius,borderColor:W.secondaryText+"50"}},{children:[s("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:W.accent,borderRadius:ve.borderRadius}},{children:ae?s(O,{className:"w-5 h-5 animate-spin",style:{color:W.accentText}}):s(N,{className:"w-5 h-5",style:{color:W.accentText}})})),o("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s("p",Object.assign({className:(T(be.b3),"font-medium truncate")},{children:e.name})),s("p",Object.assign({className:T(be.b4,"opacity-80 truncate")},{children:I(e.size)}))]})),s("button",Object.assign({type:"button",disabled:ae||"idle"!==Y,onClick:()=>de([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:W.accent,borderColor:ve.backgroundColor}},{children:s(C,{className:"w-4 h-4",style:{color:W.accentText}})}))]})):"image"===e.type?o("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:ve.borderRadius}},{children:["finished"===e.status?s("img",{style:{borderRadius:ve.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(t=e.documentId)||void 0===t?void 0:t.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(i=e.documentId)||void 0===i?void 0:i.split("-")[2]}`,alt:""}):s("div",{className:"h-full w-full animate-pulse",style:{borderRadius:ve.borderRadius,backgroundColor:W.secondary}}),s("button",Object.assign({type:"button",disabled:ae||"idle"!==Y,onClick:()=>de([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:W.accent,borderColor:ve.backgroundColor}},{children:s(C,{className:"w-4 h-4",style:{color:W.accentText}})}))]})):null},e.id)}))})),o("div",Object.assign({className:"flex items-end gap-x-2 grow"},{children:[s(A,{id:(null==M?void 0:M.formid)+"--chat-textarea",className:T(be.b2,"max-h-60 mb-[0.2em] w-full resize-none border-transparent bg-transparent outline-none ring-0 scrollbar scrollbar-thin placeholder:text-inherit placeholder:opacity-50",!xe.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:xe,placeholder:null!==(E=null==M?void 0:M.placeholdertext)&&void 0!==E?E:"What do you want to talk about?",onChange:e=>je(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ae||"idle"!==Y||Re()))}}),o("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==M?void 0:M.documentuploadtype)&&o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:Ne?W.accent+"10":void 0},disabled:ae||"idle"!==Y,onClick:()=>{var e;return null===(e=ye.current)||void 0===e?void 0:e.click()}},Ce,{children:[s("input",{id:"file-upload",ref:ye,type:"file",accept:[...b,...le?v:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:e=>t(void 0,void 0,void 0,(function*(){yield ce(Array.from(e.target.files||[])),e.target.value=""}))}),s(w,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:Ne?W.accent:W.accent+"80"}})]})),s("button",Object.assign({id:(null==M?void 0:M.formid)+"--chat-button",className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:Ie?W.accent:W.accent+"10"},disabled:ae||"idle"!==Y,onClick:()=>Re()},we,{children:s(S,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:Ie?W.accentText:W.accent}})}))]}))]}))]}))]}))};export{E as default};
1
+ import{__rest as e,__awaiter as t}from"../../../_virtual/_tslib.js";import{jsxs as o,jsx as s}from"react/jsx-runtime";import{useState as r,useRef as i,useMemo as n,useEffect as a,Fragment as l}from"react";import{usePickaxeContext as d}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as c}from"../../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as u}from"../../../hooks/pickaxe/useDimensionContext.js";import{useStyleInput as m}from"../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as p}from"../../../hooks/studio/useStyleFontSize.js";import{useConversation as f}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as h}from"../../../hooks/pickaxe/useSubmit.js";import{useSubmitResult as g}from"../../../hooks/pickaxe/useSubmitResult.js";import{allowedFileMimeTypes as b,allowedImageMimeTypes as v}from"../../../common/documents.js";import{streamer as x}from"../../../common/api/streamer.js";import{useDocument as j}from"../Addons/Document/hooks/useDocument.js";import{useScroll as y}from"../Addons/Scroll/hooks/useScroll.js";import{useHover as k}from"../../../hooks/core/useHover.js";import{formatBytes as I}from"../../../common/utils.js";import w from"../../Icons/attach-vertical.svg.js";import O from"../../Icons/spinner-lines.svg.js";import N from"../../Icons/file.svg.js";import C from"../../Icons/x.svg.js";import S from"../../Icons/arrow-right.svg.js";import R from"../common/PickaxeBranding.js";import D from"../Addons/IceBreaker/index.js";import A from"react-textarea-autosize";import U from"../../../common/error.js";import T from"../../../common/cn.js";const B=()=>{var B;const{formId:E,chatId:H,userId:z,studioUserId:L,deploymentId:F,pickaxe:M,styles:P,colors:W,misc:$,chatInput:G,responsiveBy:K,forceMobile:_,isNewChat:q,setIsNewChat:J,setIsShowIceBreaker:Q,onGenerateComplete:V}=d(),{messages:X,status:Y,limits:Z,setMessages:ee,setStatus:te,setLimitData:oe,setError:se,setIsGenerating:re}=c(),{isMobile:ie}=u(),{documents:ne,isUploading:ae,isImageUploadAllowed:le,upsertDocuments:de,onFileUpload:ce}=j(),{scrollStartSession:ue,scrollEndSession:me,scrollToBottom:pe}=y({auto:!0}),fe=f(),he=h(),ge=g(),be=p(),ve=m(),[xe,je]=r(G),ye=i(null),ke=k(),{isHover:Ie}=ke,we=e(ke,["isHover"]),Oe=k(),{isHover:Ne}=Oe,Ce=e(Oe,["isHover"]),Se=n((()=>{var e,t,o;return!!q&&(!!M&&(!fe.isLoading&&(!((null!==(t=null===(e=fe.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&!!(null===(o=M.icebreakers)||void 0===o?void 0:o.length))))}),[M,q,fe.data,fe.isLoading]),Re=e=>t(void 0,void 0,void 0,(function*(){try{if(ae||"idle"!==Y)return;const t=null!=e?e:xe;if(!t)return;je(""),se(""),oe(null),re(!0),J(!1);const o=new Date,s="enduserupload"===(null==M?void 0:M.documentuploadtype),r=ne.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),i=r.length?r[r.length-1].documentId:"";te("fetching"),ue(),pe();const n=Array.from(X);let a=[...n,{id:X.length+1,role:"user",content:t}];ee(a),pe();const{success:l,data:d,actionData:c,usedDocumentIds:u,endUserDocumentId:m,endUserImageId:p,rawUserInput:f,error:h}=yield he.mutateAsync(Object.assign(Object.assign(Object.assign({formId:E,responseId:H,value:t},s&&i&&{documentId:i}),L&&{studioUserId:L}),F&&{deploymentId:F}));if(!l)throw new Error(null!=h?h:"An error occurred, please try again.");const g=[];m&&g.push(m),p&&g.push(p),g.length>0&&(a=[...n,Object.assign({id:X.length+1,role:"user",content:t},g&&{documentIds:g})],ee(a),pe()),de([]),pe();const b=(yield x({formId:E,responseId:H,data:d,actionData:c})).body;if(!b)throw new Error("Streaming error");const v=b.getReader(),j=new TextDecoder,y=a.length;let k="",I=!0,w=!1;for(;I;){const{value:e,done:t}=yield v.read();I=!t;if(k+=j.decode(e).replace(/\u200B/g,""),k)ee([...a.slice(0,y),{id:X.length+1,role:"assistant",content:k}]),w||(te("streaming"),w=!0);else if(!I&&!k)throw new Error("Server error")}const O=new Date;k&&(pe(),te("idle"),yield ge.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:E,responseId:H,documentIds:u},z&&{userId:z}),L&&{studioUserId:L}),L&&(null==M?void 0:M.studioid)&&{studioId:M.studioid}),F&&{deploymentId:F}),{messages:[Object.assign(Object.assign({role:"user",message:f},g&&{documentIds:g}),{sentAt:o}),{role:"assistant",message:k,sentAt:O}]})),null==V||V(H))}catch(e){let t=U(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const o=Object.entries(Z).find((([e])=>t.includes(e)));o?oe(o[1]):se(t),pe()}finally{te("idle"),re(!1),me()}}));return a((()=>{Q(Se)}),[Se]),a((()=>{je(G)}),[G]),o("div",Object.assign({className:T("fixed flex w-full flex-col bottom-0 left-0","viewport"===K?"min-[767px]:relative min-[767px]:bottom-auto min-[767px]:left-auto":"absolute @[767px]/pickaxe-root:relative @[767px]/pickaxe-root:bottom-auto @[767px]/pickaxe-root:left-auto")},{children:[!$.isWhiteLabel&&s("div",Object.assign({className:"flex justify-end pr-3 pb-3 @[767px]/pickaxe-root:pr-0"},{children:s(R,{animateHover:!0})})),Se&&s(D,{data:(null==M?void 0:M.icebreakers)||[],onSend:Re}),o("div",Object.assign({id:(null==M?void 0:M.formid)+"--chat-parent",style:Object.assign(Object.assign({},ve),(ie||_)&&{paddingLeft:"0.75rem",paddingRight:"0.75rem"}),className:T("flex min-h-[56px] flex-col gap-y-2 px-4 py-3 pb-[15px]","block"===P.formFieldStyle&&"shadow")},{children:["idle"===Y&&ne.length>0&&s("div",Object.assign({className:T("grid grid-cols-1","viewport"===K?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:ne.map((e=>{var t,r,i;return s(l,{children:"document"===e.type?o("div",Object.assign({className:"relative gap-x-[10px] flex items-center px-2 h-[56px] border",style:{borderRadius:ve.borderRadius,borderColor:W.secondaryText+"50"}},{children:[s("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:W.accent,borderRadius:ve.borderRadius}},{children:ae?s(O,{className:"w-5 h-5 animate-spin",style:{color:W.accentText}}):s(N,{className:"w-5 h-5",style:{color:W.accentText}})})),o("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[s("p",Object.assign({className:(T(be.b3),"font-medium truncate")},{children:e.name})),s("p",Object.assign({className:T(be.b4,"opacity-80 truncate")},{children:I(e.size)}))]})),s("button",Object.assign({type:"button",disabled:ae||"idle"!==Y,onClick:()=>de([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:W.accent,borderColor:ve.backgroundColor}},{children:s(C,{className:"w-4 h-4",style:{color:W.accentText}})}))]})):"image"===e.type?o("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:ve.borderRadius}},{children:["finished"===e.status?s("img",{style:{borderRadius:ve.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(t=e.documentId)||void 0===t?void 0:t.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(i=e.documentId)||void 0===i?void 0:i.split("-")[2]}`,alt:""}):s("div",{className:"h-full w-full animate-pulse",style:{borderRadius:ve.borderRadius,backgroundColor:W.secondary}}),s("button",Object.assign({type:"button",disabled:ae||"idle"!==Y,onClick:()=>de([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:W.accent,borderColor:ve.backgroundColor}},{children:s(C,{className:"w-4 h-4",style:{color:W.accentText}})}))]})):null},e.id)}))})),o("div",Object.assign({className:"flex items-end gap-x-2 grow"},{children:[s(A,{id:(null==M?void 0:M.formid)+"--chat-textarea",className:T(be.b2,"max-h-60 mb-[0.2em] w-full resize-none border-transparent bg-transparent outline-none ring-0 scrollbar scrollbar-thin placeholder:text-inherit placeholder:opacity-50",!xe.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:xe,placeholder:null!==(B=null==M?void 0:M.placeholdertext)&&void 0!==B?B:"What do you want to talk about?",onChange:e=>je(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ae||"idle"!==Y||Re()))}}),o("div",Object.assign({className:"flex items-center gap-x-2"},{children:["enduserupload"===(null==M?void 0:M.documentuploadtype)&&o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:Ne?W.accent+"10":void 0},disabled:ae||"idle"!==Y,onClick:()=>{var e;return null===(e=ye.current)||void 0===e?void 0:e.click()}},Ce,{children:[s("input",{id:"file-upload",ref:ye,type:"file",accept:[...b,...le?v:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:e=>t(void 0,void 0,void 0,(function*(){yield ce(Array.from(e.target.files||[])),e.target.value=""}))}),s(w,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:Ne?W.accent:W.accent+"80"}})]})),s("button",Object.assign({id:(null==M?void 0:M.formid)+"--chat-button",className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:Ie||xe.length||ne.length&&ne.every((e=>"finished"===e.status))?W.accent:W.accent+"10"},disabled:ae||"idle"!==Y,onClick:()=>Re()},we,{children:s(S,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:Ie||xe.length||ne.length&&ne.every((e=>"finished"===e.status))?W.accentText:W.accent+"80"}})}))]}))]}))]}))]}))};export{B as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useMemo as s}from"react";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useScrollContext as r}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as i}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as l}from"../../Addons/Document/hooks/useDocument.js";import{format as c}from"date-fns";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as m}from"../../common/PickaxeMarkdown/Renderer.js";import d from"../../../Icons/message-square-notes.svg.js";import p from"../../../Icons/visitor.svg.js";import h from"../../common/PickaxeIcon.js";import f from"../../common/PickaxeSimpleButton.js";import u from"../../common/PickaxeCopyButton.js";import x from"../../Addons/Scroll/ScrollLockView.js";import g from"../../../../common/cn.js";const b=()=>{var b;const{pickaxe:v,styles:j,colors:k,misc:y,translations:w,setChatId:N,setIsNewChat:C}=t(),{response:O}=n(),{scrollTargetRef:I,scrollContainerRef:S}=r(),D=i(),{upsertDocuments:P}=l(),M=s((()=>c(O?O.createdAt:new Date,"hh:mm a MMM dd, yy")),[O]),R=s((()=>{var e;if(!O)return"";return(null!==(e=O.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}),[O]);return O?e("div",Object.assign({ref:I,className:"flex flex-col shadow-black transition duration-300 hover:shadow"},{children:[e("div",Object.assign({className:"flex gap-x-3 overflow-hidden px-4 py-5",style:{backgroundColor:k.primary,color:k.text}},{children:[o("div",Object.assign({className:"shrink-0 pt-1"},{children:o(p,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar scrollbar-thin"},{children:[o("input",{id:`${O.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:R.length<280}),o("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:R}}),o("label",Object.assign({htmlFor:`${O.responseId}-input`,className:g(D.b3,"mt-1 flex shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer"),style:{color:k.accent}},{children:(null==w?void 0:w["see-input"])||"See input"})),o("label",Object.assign({htmlFor:`${O.responseId}-input`,className:g(D.b3,"hidden shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer"),style:{color:k.accent}},{children:(null==w?void 0:w["hide-input"])||"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:k.secondary,color:k.secondaryText}},{children:[y.isChatImage&&o(h,{src:null==v?void 0:v.chaticon,alt:`${null==v?void 0:v.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:k.secondaryText}),e("div",Object.assign({ref:S,className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[o(a,Object.assign({theme:j.theme,accentColor:k.accent,linkPreviews:!0,actions:!0},{children:o(m,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:O.questionResponse})})),e("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==v?void 0:v.enablechatresponses)&&e(f,Object.assign({color:k.accent,onClick:()=>{return e=O.responseId,P([]),C(!1),void N(e);var e}},{children:[o(d,{className:"h-4 w-4 shrink-0"}),o("p",Object.assign({className:g(D.b3,"font-semibold")},{children:O.messages.length+1}))]})),o(u,{color:k.accent,text:null!==(b=O.questionResponse)&&void 0!==b?b:""})]})),o("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:o("p",Object.assign({className:g(D.b3,"font-semibold uppercase opacity-30")},{children:M}))}))]}))]}))]})),o(x,{className:"w-full"})]})):null};export{b as default};
1
+ import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useMemo as o}from"react";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useScrollContext as r}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as i}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as l}from"../../Addons/Document/hooks/useDocument.js";import{format as c}from"date-fns";import{PickaxeMarkdown as a}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as m}from"../../common/PickaxeMarkdown/Renderer.js";import d from"../../../Icons/message-square-notes.svg.js";import p from"../../../Icons/visitor.svg.js";import h from"../../common/PickaxeIcon.js";import f from"../../common/PickaxeSimpleButton.js";import u from"../../common/PickaxeCopyButton.js";import x from"../../Addons/Scroll/ScrollLockView.js";import g from"../../../../common/cn.js";const b=()=>{var b;const{pickaxe:v,styles:j,colors:k,misc:y,translations:w,setChatId:N,setIsNewChat:O}=t(),{response:C}=n(),{scrollTargetRef:I}=r(),S=i(),{upsertDocuments:D}=l(),P=o((()=>c(C?C.createdAt:new Date,"hh:mm a MMM dd, yy")),[C]),M=o((()=>{var e;if(!C)return"";return(null!==(e=C.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}),[C]);return C?e("div",Object.assign({ref:I,className:"flex flex-col shadow-black transition duration-300 hover:shadow"},{children:[e("div",Object.assign({className:"flex gap-x-3 overflow-hidden px-4 py-5",style:{backgroundColor:k.primary,color:k.text}},{children:[s("div",Object.assign({className:"shrink-0 pt-1"},{children:s(p,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar scrollbar-thin"},{children:[s("input",{id:`${C.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:M.length<280}),s("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:M}}),s("label",Object.assign({htmlFor:`${C.responseId}-input`,className:g(S.b3,"mt-1 flex shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer"),style:{color:k.accent}},{children:(null==w?void 0:w["see-input"])||"See input"})),s("label",Object.assign({htmlFor:`${C.responseId}-input`,className:g(S.b3,"hidden shrink-0 whitespace-nowrap font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer"),style:{color:k.accent}},{children:(null==w?void 0:w["hide-input"])||"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:k.secondary,color:k.secondaryText}},{children:[y.isChatImage&&s(h,{src:null==v?void 0:v.chaticon,alt:`${null==v?void 0:v.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1",textColor:k.secondaryText}),e("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[s(a,Object.assign({theme:j.theme,accentColor:k.accent,linkPreviews:!0,actions:!0},{children:s(m,{className:"overflow-x-auto pb-2 font-semilight opacity-90 scrollbar scrollbar-thin",value:C.questionResponse})})),e("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==v?void 0:v.enablechatresponses)&&e(f,Object.assign({color:k.accent,onClick:()=>{return e=C.responseId,D([]),O(!1),void N(e);var e}},{children:[s(d,{className:"h-4 w-4 shrink-0"}),s("p",Object.assign({className:g(S.b3,"font-semibold")},{children:C.messages.length+1}))]})),s(u,{color:k.accent,text:null!==(b=C.questionResponse)&&void 0!==b?b:""})]})),s("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:s("p",Object.assign({className:g(S.b3,"font-semibold uppercase opacity-30")},{children:P}))}))]}))]}))]})),s(x,{className:"w-full"})]})):null};export{b as default};
@@ -1 +1 @@
1
- import{__rest as e,__awaiter as s}from"../../../../_virtual/_tslib.js";import{jsxs as t,jsx as o,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as r,Fragment as n}from"react";import{usePickaxeContext as i}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleInput as c}from"../../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as d}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as m}from"../../Addons/Document/hooks/useDocument.js";import{useHover as u}from"../../../../hooks/core/useHover.js";import{allowedFileMimeTypes as b,allowedImageMimeTypes as p}from"../../../../common/documents.js";import{formatBytes as f}from"../../../../common/utils.js";import h from"../../../Icons/attach-vertical.svg.js";import g from"../../../Icons/check.svg.js";import y from"../../../Icons/spinner-lines.svg.js";import j from"../../../Icons/file.svg.js";import x from"../../../Icons/x.svg.js";import v from"../../../Icons/link.svg.js";import N from"../../../Core/ErrorAlert.js";import w from"../../../../common/cn.js";const k=({field:k,update:O})=>{const C=d(),{colors:R,responsiveBy:I}=i(),D=u(),{isHover:T}=D,A=e(D,["isHover"]),{documents:U,documentError:E,websiteLink:F,isUploading:z,isImageUploadAllowed:H,upsertDocuments:L,setDocumentError:S,setWebsiteLink:W,onFileUpload:$,onWebsiteUpload:B}=m({onQuestionChange:e=>{O(Object.assign(Object.assign({},k),e))}}),[P,_]=a(!1),q=r(null),K=c();return t("div",Object.assign({className:"flex flex-col gap-y-4"},{children:[t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[t("div",Object.assign({className:"flex items-center gap-2"},{children:[o("p",Object.assign({className:w(C.b3,"font-semibold opacity-70")},{children:k.main})),k.isRequired&&o("span",Object.assign({className:"select-none font-semibold",style:{color:R.error}},{children:"*"}))]})),t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[o("input",{ref:q,type:"file",accept:[...b,...H?p:[]].join(", "),id:k.id,hidden:!0,multiple:!1,className:"hidden",onChange:e=>s(void 0,void 0,void 0,(function*(){yield $(Array.from(e.target.files||[])),e.target.value=""})),disabled:z}),t("div",Object.assign({className:w("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 duration-300 ease-in-out transition-all shadow hover:shadow-none",P&&"shadow"),style:K},{children:[o("input",{type:"text",value:F,className:w(C.b2,"w-full outline-none bg-transparent placeholder:font-semilight"),placeholder:"Paste a website/video link or drag a file",onChange:e=>W(e.target.value),onDrop:e=>s(void 0,void 0,void 0,(function*(){e.preventDefault(),yield $(Array.from(e.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),B(F))},onFocus:()=>_(!0),onBlur:()=>_(!1)}),o("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:F.length>0?t(l,{children:[o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:z,onClick:()=>B(F)},{children:o(g,{className:"h-5 w-5 shrink-0",style:{color:R.accent}})})),o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:z,onClick:()=>{W(""),S("")}},{children:o(x,{className:"h-6 w-6 shrink-0",style:{color:R.accent}})}))]}):o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors",disabled:z,onClick:()=>{var e;null===(e=q.current)||void 0===e||e.click()},style:{backgroundColor:T?R.accent+"10":void 0}},A,{children:o(h,{className:"h-6 w-6",style:{color:T?R.accent:R.accent+"80"}})}))}))]}))]}))]})),U.length>0&&o("div",Object.assign({className:w("flex gap-4","viewport"===I?"min-[765px]:flex-col":"@[767px]/pickaxe-root:flex-col")},{children:U.map((e=>{var s,l,a;return o(n,{children:"document"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:K},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:R.accent,borderRadius:K.borderRadius}},{children:z?o(y,{className:"w-5 h-5 animate-spin",style:{color:R.accentText}}):o(j,{className:"w-5 h-5",style:{color:R.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(w(C.b3),"font-medium truncate")},{children:e.name})),o("p",Object.assign({className:w(C.b4,"opacity-80 truncate")},{children:f(e.size)}))]})),o("button",Object.assign({type:"button",disabled:z,onClick:()=>L([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:R.accent,borderColor:K.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:R.accentText}})}))]})):"image"===e.type?t("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:K.borderRadius}},{children:["finished"===e.status?o("img",{style:{borderRadius:K.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(s=e.documentId)||void 0===s?void 0:s.split("-")[2]}/${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[1]}.${null===(a=e.documentId)||void 0===a?void 0:a.split("-")[2]}`,alt:""}):o("div",{className:"h-full w-full animate-pulse",style:{borderRadius:K.borderRadius,backgroundColor:R.secondary}}),o("button",Object.assign({type:"button",disabled:z,onClick:()=>L([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:R.accent,borderColor:K.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:R.accentText}})}))]})):"website"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:K},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:R.accent,borderRadius:K.borderRadius}},{children:z?o(y,{className:"w-5 h-5 animate-spin",style:{color:R.accentText}}):o(v,{className:"w-5 h-5",style:{color:R.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(w(C.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),o("p",Object.assign({className:w(C.b4,"opacity-80 truncate")},{children:"Website"}))]})),o("button",Object.assign({type:"button",disabled:z,onClick:()=>L([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:R.accent,borderColor:K.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:R.accentText}})}))]})):null},e.id)}))})),E&&o(N,{error:E,className:"mt-3"})]}))};export{k as default};
1
+ import{__rest as e,__awaiter as s}from"../../../../_virtual/_tslib.js";import{jsxs as t,jsx as o,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as r,Fragment as n}from"react";import{usePickaxeContext as i}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleInput as c}from"../../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as d}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as m}from"../../Addons/Document/hooks/useDocument.js";import{useHover as u}from"../../../../hooks/core/useHover.js";import{allowedFileMimeTypes as b,allowedImageMimeTypes as p}from"../../../../common/documents.js";import{formatBytes as f}from"../../../../common/utils.js";import h from"../../../Icons/attach-vertical.svg.js";import g from"../../../Icons/check.svg.js";import y from"../../../Icons/spinner-lines.svg.js";import j from"../../../Icons/file.svg.js";import x from"../../../Icons/x.svg.js";import v from"../../../Icons/link.svg.js";import N from"../../../Core/ErrorAlert.js";import w from"../../../../common/cn.js";const k=({field:k,update:O})=>{const C=d(),{colors:R,styles:I,responsiveBy:D}=i(),T=u(),{isHover:F}=T,A=e(T,["isHover"]),{documents:S,documentError:U,websiteLink:E,isUploading:z,isImageUploadAllowed:H,upsertDocuments:L,setDocumentError:W,setWebsiteLink:$,onFileUpload:B,onWebsiteUpload:P}=m({onQuestionChange:e=>{O(Object.assign(Object.assign({},k),e))}}),[_,q]=a(!1),K=r(null),Q=c();return t("div",Object.assign({className:"flex flex-col gap-y-4"},{children:[t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[t("div",Object.assign({className:"flex items-center gap-2"},{children:[o("p",Object.assign({className:w(C.b3,"font-semibold opacity-70")},{children:k.main})),k.isRequired&&o("span",Object.assign({className:"select-none font-semibold",style:{color:R.error}},{children:"*"}))]})),t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[o("input",{ref:K,type:"file",accept:[...b,...H?p:[]].join(", "),id:k.id,hidden:!0,multiple:!1,className:"hidden",onChange:e=>s(void 0,void 0,void 0,(function*(){yield B(Array.from(e.target.files||[])),e.target.value=""})),disabled:z}),t("div",Object.assign({className:w("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 duration-300 ease-in-out transition-all",_&&"block"===I.formFieldStyle&&"shadow","block"===I.formFieldStyle&&"shadow hover:shadow-none"),style:Q},{children:[o("input",{type:"text",value:E,className:w(C.b2,"w-full outline-none bg-transparent placeholder:font-semilight"),placeholder:"Paste a website/video link or drag a file",onChange:e=>$(e.target.value),onDrop:e=>s(void 0,void 0,void 0,(function*(){e.preventDefault(),yield B(Array.from(e.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),P(E))},onFocus:()=>q(!0),onBlur:()=>q(!1)}),o("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:E.length>0?t(l,{children:[o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:z,onClick:()=>P(E)},{children:o(g,{className:"h-5 w-5 shrink-0",style:{color:R.accent}})})),o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:z,onClick:()=>{$(""),W("")}},{children:o(x,{className:"h-6 w-6 shrink-0",style:{color:R.accent}})}))]}):o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors",disabled:z,onClick:()=>{var e;null===(e=K.current)||void 0===e||e.click()},style:{backgroundColor:F?R.accent+"10":void 0}},A,{children:o(h,{className:"h-6 w-6",style:{color:F?R.accent:R.accent+"80"}})}))}))]}))]}))]})),S.length>0&&o("div",Object.assign({className:w("flex gap-4","viewport"===D?"min-[765px]:flex-col":"@[767px]/pickaxe-root:flex-col")},{children:S.map((e=>{var s,l,a;return o(n,{children:"document"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:Q},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:R.accent,borderRadius:Q.borderRadius}},{children:z?o(y,{className:"w-5 h-5 animate-spin",style:{color:R.accentText}}):o(j,{className:"w-5 h-5",style:{color:R.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(w(C.b3),"font-medium truncate")},{children:e.name})),o("p",Object.assign({className:w(C.b4,"opacity-80 truncate")},{children:f(e.size)}))]})),o("button",Object.assign({type:"button",disabled:z,onClick:()=>L([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:R.accent,borderColor:Q.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:R.accentText}})}))]})):"image"===e.type?t("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:Q.borderRadius}},{children:["finished"===e.status?o("img",{style:{borderRadius:Q.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(s=e.documentId)||void 0===s?void 0:s.split("-")[2]}/${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[1]}.${null===(a=e.documentId)||void 0===a?void 0:a.split("-")[2]}`,alt:""}):o("div",{className:"h-full w-full animate-pulse",style:{borderRadius:Q.borderRadius,backgroundColor:R.secondary}}),o("button",Object.assign({type:"button",disabled:z,onClick:()=>L([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:R.accent,borderColor:Q.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:R.accentText}})}))]})):"website"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:Q},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:R.accent,borderRadius:Q.borderRadius}},{children:z?o(y,{className:"w-5 h-5 animate-spin",style:{color:R.accentText}}):o(v,{className:"w-5 h-5",style:{color:R.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(w(C.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),o("p",Object.assign({className:w(C.b4,"opacity-80 truncate")},{children:"Website"}))]})),o("button",Object.assign({type:"button",disabled:z,onClick:()=>L([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:R.accent,borderColor:Q.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:R.accentText}})}))]})):null},e.id)}))})),U&&o(N,{error:U,className:"mt-3"})]}))};export{k as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../_virtual/_tslib.js";import{jsxs as o,jsx as t}from"react/jsx-runtime";import{useState as s}from"react";import{usePickaxeContext as i}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useSubmit as r}from"../../../../hooks/pickaxe/useSubmit.js";import{useSubmitResult as l}from"../../../../hooks/pickaxe/useSubmitResult.js";import{useDocument as a}from"../../Addons/Document/hooks/useDocument.js";import{useScroll as d}from"../../Addons/Scroll/hooks/useScroll.js";import{streamer as c}from"../../../../common/api/streamer.js";import{extractUrlsFromText as m}from"../../../../common/utils.js";import{encode as u}from"@nem035/gpt-3-encoder";import p from"../../common/PickaxeBranding.js";import f from"../../common/PickaxeButton.js";import g from"../../../../common/error.js";import x from"../../../../common/cn.js";const h=({questions:h})=>{var w;const{formId:j,userId:b,studioUserId:v,deploymentId:y,pickaxe:I,misc:k,translations:O,responsiveBy:S,isShowHistory:q,setIsShowHistory:D,onGenerateComplete:E}=i(),{status:P,limits:U,setResponse:R,setStatus:A,setLimitData:C,setError:L,setIsGenerating:N}=n(),{documents:T,websiteLink:B,isUploading:H,onWebsiteUpload:W,setDocumentError:G}=a(),{scrollStartSession:_,scrollEndSession:K,scrollToTarget:M,scrollToBottom:Y}=d({auto:!0}),z=r(),F=l(),[J,Q]=s(!1);return o("div",Object.assign({className:x("mt-4 flex flex-wrap flex-col justify-between gap-2","viewport"===S?"min-[767px]:flex-row":"@[767px]/pickaxe-root:flex-row")},{children:[o("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:[t(f,Object.assign({className:x("w-full","viewport"===S?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]"),isDisabled:H||J||"idle"!==P,onClick:()=>e(void 0,void 0,void 0,(function*(){var e;try{if(H||J||"idle"!==P)return;C(null),G(""),N(!0);const o="enduserupload"===(null==I?void 0:I.documentuploadtype),t=h.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),s=T.filter((e=>"finished"===e.status)),i=m(B),n=T.map((e=>e.name)),r=i.filter((e=>!n.includes(e)));if(r.length){const e=r[r.length-1];Q(!0);const o=yield W(e);o&&(s.push(o),yield new Promise((e=>setTimeout(e,5e3)))),Q(!1)}else if(t&&o&&!s.length)return void G("Please paste a valid website/video link or drag a file to add to the knowledge base.");L("");const l=["Multiple Choice","Checkbox"];for(const e of h){if(u(e.input).length>e.maxLength&&!l.includes(e.type))throw new Error("One or more of your responses is too long!");if(e.isRequired&&!e.input.trim()&&"userinput:documentupload"!==e.id)throw new Error("You must fill out all required fields.")}const a=s.length?s[s.length-1]:null;let d={};h.forEach((e=>d=Object.assign(Object.assign({},d),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?(null==a?void 0:a.name)||"":e.input}))),A("fetching");const{success:p,responseId:f,data:g,actionData:x,usedDocumentIds:w,rawUserInput:k,error:O}=yield z.mutateAsync(Object.assign(Object.assign(Object.assign({formId:j,valueObj:d},o&&a&&{documentId:null!==(e=a.documentId)&&void 0!==e?e:""}),v&&{studioUserId:v}),y&&{deploymentId:y}));if(!p)throw new Error(null!=O?O:"An error occurred, please try again.");const S=(yield c({formId:j,responseId:f,data:g,actionData:x})).body;if(!S)throw new Error("Streaming error");const q=S.getReader(),D=new TextDecoder;let U="",K=!0,M=!1;R(null);const V=h.map((e=>({id:e.id,question:e.main,answer:e.input})));for(;K;){const{value:e,done:o}=yield q.read();K=!o;const t=D.decode(e);if(U&&!M&&(_(),Y(),M=!0),U+=t,U)A("streaming"),R({formId:j,responseId:f,documentIds:w,messages:[],questions:V,questionPrompt:k,questionResponse:U,createdAt:new Date});else if(!K&&!U)throw new Error("Server error")}U&&(Y(),A("idle"),yield F.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:j,responseId:f,documentIds:w},b&&{userId:b}),v&&{studioUserId:v}),v&&(null==I?void 0:I.studioid)&&{studioId:I.studioid}),y&&{deploymentId:y}),{questions:V,questionPrompt:k,questionResponse:U})),null==E||E(f))}catch(e){let o=g(e)||"";o&&!o.includes("Unexpected token 'A',")||(o="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(U).find((([e])=>o.includes(e)));t?C(t[1]):L(o),M(),Y()}finally{A("idle"),N(!1),Q(!1),K()}}))},{children:J?(null==O?void 0:O.processing)||"Processing...":H?(null==O?void 0:O.uploading)||"Uploading...":"fetching"===P||"streaming"===P?(null==O?void 0:O.processing)||"Loading...":null!==(w=null==I?void 0:I.submittext)&&void 0!==w?w:"Submit"})),k.isHistory&&!q&&t(f,Object.assign({variant:"transparent-text",className:x("w-full","viewport"===S?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]"),onClick:()=>D(!0)},{children:(null==O?void 0:O["see-history"])||"See history"}))]})),!k.isWhiteLabel&&t("div",Object.assign({className:"flex justify-end pr-3"},{children:t(p,{})}))]}))};export{h as default};
1
+ import{__awaiter as e}from"../../../../_virtual/_tslib.js";import{jsxs as o,jsx as s}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeContext as i}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as n}from"../../../../hooks/pickaxe/useResponseContext.js";import{useSubmit as r}from"../../../../hooks/pickaxe/useSubmit.js";import{useSubmitResult as l}from"../../../../hooks/pickaxe/useSubmitResult.js";import{useDocument as d}from"../../Addons/Document/hooks/useDocument.js";import{useScroll as a}from"../../Addons/Scroll/hooks/useScroll.js";import{streamer as c}from"../../../../common/api/streamer.js";import{extractUrlsFromText as u}from"../../../../common/utils.js";import{encode as m}from"@nem035/gpt-3-encoder";import p from"../../common/PickaxeBranding.js";import f from"../../common/PickaxeButton.js";import g from"../../../../common/error.js";import h from"../../../../common/cn.js";const x=({questions:x})=>{var j;const{formId:b,userId:v,studioUserId:w,deploymentId:y,pickaxe:I,misc:k,translations:O,responsiveBy:S,isShowHistory:q,setIsShowHistory:D,onGenerateComplete:E}=i(),{status:P,limits:U,setResponse:R,setStatus:A,setLimitData:C,setError:L,setIsGenerating:N}=n(),{documents:B,websiteLink:T,isUploading:H,onWebsiteUpload:W,setDocumentError:G}=d(),{scrollStartSession:_,scrollEndSession:K,scrollToTarget:M}=a({auto:!0}),Y=r(),z=l(),[F,J]=t(!1);return o("div",Object.assign({className:h("mt-4 flex flex-wrap flex-col justify-between gap-2","viewport"===S?"min-[767px]:flex-row":"@[767px]/pickaxe-root:flex-row")},{children:[o("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:[s(f,Object.assign({className:"px-5 min-h-[42px]",isDisabled:H||F||"idle"!==P,onClick:()=>e(void 0,void 0,void 0,(function*(){var e;try{if(H||F||"idle"!==P)return;C(null),G(""),N(!0);const o="enduserupload"===(null==I?void 0:I.documentuploadtype),s=x.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),t=B.filter((e=>"finished"===e.status)),i=u(T),n=B.map((e=>e.name)),r=i.filter((e=>!n.includes(e)));if(r.length){const e=r[r.length-1];J(!0);const o=yield W(e);o&&(t.push(o),yield new Promise((e=>setTimeout(e,5e3)))),J(!1)}else if(s&&o&&!t.length)return void G("Please paste a valid website/video link or drag a file to add to the knowledge base.");L("");const l=["Multiple Choice","Checkbox"];for(const e of x){if(m(e.input).length>e.maxLength&&!l.includes(e.type))throw new Error("One or more of your responses is too long!");if(e.isRequired&&!e.input.trim()&&"userinput:documentupload"!==e.id)throw new Error("You must fill out all required fields.")}const d=t.length?t[t.length-1]:null;let a={};x.forEach((e=>a=Object.assign(Object.assign({},a),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?(null==d?void 0:d.name)||"":e.input}))),A("fetching"),_(),M();const{success:p,responseId:f,data:g,actionData:h,usedDocumentIds:j,rawUserInput:k,error:O}=yield Y.mutateAsync(Object.assign(Object.assign(Object.assign({formId:b,valueObj:a},o&&d&&{documentId:null!==(e=d.documentId)&&void 0!==e?e:""}),w&&{studioUserId:w}),y&&{deploymentId:y}));if(!p)throw new Error(null!=O?O:"An error occurred, please try again.");M();const S=(yield c({formId:b,responseId:f,data:g,actionData:h})).body;if(!S)throw new Error("Streaming error");const q=S.getReader(),D=new TextDecoder;let U="",K=!0,Q=!1;R(null),M();const V=x.map((e=>({id:e.id,question:e.main,answer:e.input})));for(;K;){const{value:e,done:o}=yield q.read();K=!o;if(U+=D.decode(e).replace(/\u200B/g,""),U)R({formId:b,responseId:f,documentIds:j,messages:[],questions:V,questionPrompt:k,questionResponse:U,createdAt:new Date}),Q||(A("streaming"),M(),Q=!0);else if(!K&&!U)throw new Error("Server error")}U&&(M(),A("idle"),yield z.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:b,responseId:f,documentIds:j},v&&{userId:v}),w&&{studioUserId:w}),w&&(null==I?void 0:I.studioid)&&{studioId:I.studioid}),y&&{deploymentId:y}),{questions:V,questionPrompt:k,questionResponse:U})),null==E||E(f))}catch(e){let o=g(e)||"";o&&!o.includes("Unexpected token 'A',")||(o="Oops! We're experiencing high traffic at the moment. Please try again later.");const s=Object.entries(U).find((([e])=>o.includes(e)));s?C(s[1]):L(o),M()}finally{A("idle"),N(!1),J(!1),K()}}))},{children:F?(null==O?void 0:O.processing)||"Processing...":H?(null==O?void 0:O.uploading)||"Uploading...":"fetching"===P||"streaming"===P?(null==O?void 0:O.processing)||"Loading...":null!==(j=null==I?void 0:I.submittext)&&void 0!==j?j:"Submit"})),k.isHistory&&!q&&s(f,Object.assign({variant:"transparent-text",className:"px-4",onClick:()=>D(!0)},{children:(null==O?void 0:O["see-history"])||"See history"}))]})),!k.isWhiteLabel&&s("div",Object.assign({className:"flex justify-end pr-3"},{children:s(p,{})}))]}))};export{x as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as s}from"react/jsx-runtime";import{usePickaxeContext as o}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as i}from"../../../hooks/studio/useStyleFontSize.js";import{motion as a}from"framer-motion";import r from"../../Icons/pickaxe.svg.js";import t from"../../../common/cn.js";const c=({className:c,animateHover:n=!0})=>{const{pickaxe:m,misc:l}=o(),p=i();return!m||l.isWhiteLabel?null:e(a.a,Object.assign({href:`https://${process.env.NEXT_PUBLIC_PICKAXE_DOMAIN}`,className:t("flex items-center gap-2 select-none overflow-hidden px-2 py-1 rounded",c)},n&&{initial:{scale:1},whileHover:{scale:1.05},whileTap:{scale:.95}},{children:[s(r,{className:"h-3.5 w-3.5 shrink-0"}),s("span",Object.assign({className:t(p.b4,"opacity-50")},{children:"Powered by Pickaxe"}))]}))};export{c as default};
1
+ import{jsxs as e,jsx as s}from"react/jsx-runtime";import{usePickaxeContext as o}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as t}from"../../../hooks/studio/useStyleFontSize.js";import{motion as a}from"framer-motion";import i from"../../Icons/pickaxe.svg.js";import r from"../../../common/cn.js";const c=({className:c,animateHover:n=!0})=>{const{pickaxe:m,colors:l,misc:p}=o(),f=t();return!m||p.isWhiteLabel?null:e(a.a,Object.assign({href:`https://${process.env.NEXT_PUBLIC_PICKAXE_DOMAIN}`,className:r("flex items-center gap-2 select-none overflow-hidden px-2 py-1 rounded",c,"#ffffff"===l.text.toLowerCase()?"text-white":"text-black")},n&&{initial:{scale:1},whileHover:{scale:1.05},whileTap:{scale:.95}},{children:[s(i,{className:"h-3.5 w-3.5 shrink-0"}),s("span",Object.assign({className:r(f.b4,"opacity-50")},{children:"Powered by Pickaxe"}))]}))};export{c as default};
@@ -1 +1 @@
1
- import{__awaiter as o}from"../../../_virtual/_tslib.js";import{jsx as r}from"react/jsx-runtime";import{useState as t,useEffect as c}from"react";import i from"copy-to-clipboard";import e from"../../Icons/copied.svg.js";import s from"../../Icons/copy.svg.js";import n from"./PickaxeSimpleButton.js";import l from"../../../common/cn.js";const m=({color:m,text:a="",className:p,iconClassName:f})=>{const[h,u]=t(a),[d,j]=t(!1),[y,g]=t(!1);c((()=>{u(a)}),[a]);return r(n,Object.assign({color:m},p&&{className:p},{isForceColor:y,onClick:()=>o(void 0,void 0,void 0,(function*(){var o;try{if(d)return;j(!0);const r=null!==(o=[...Array.from(a.matchAll(/https:\/\/streaming\.pickaxeproject\.com\/api\/function_call_results\?.*?&name=[^&]+/g)),...Array.from(a.matchAll(/https:\/\/utils\.pickaxe\.chat\/api\/fn\/result\?.*?&name=[^&]+/g))].map((o=>o[0])))&&void 0!==o?o:[],t=[];if(r.length){for(const o of r)try{const r=yield fetch(o),c=yield r.json(),i=c.text||c.url||"";t.push(i)}catch(o){console.error(o)}t.length&&u(t.join("\n"))}i(t.length>0?t.join("\n"):h),j(!1),g(!0),yield new Promise((o=>setTimeout(o,1500)))}catch(o){console.error(o)}finally{j(!1),g(!1)}}))},{children:r(d||y?e:s,{className:l("w-4 h-4 shrink-0",f)})}))};export{m as default};
1
+ import{__awaiter as o}from"../../../_virtual/_tslib.js";import{jsx as r}from"react/jsx-runtime";import{useState as t,useEffect as e}from"react";import c from"copy-to-clipboard";import i from"../../Icons/copied-new.svg.js";import s from"../../Icons/copy-new.svg.js";import n from"./PickaxeSimpleButton.js";import l from"../../../common/cn.js";const m=({color:m,text:a="",className:p,iconClassName:f})=>{const[h,u]=t(a),[d,j]=t(!1),[y,g]=t(!1);e((()=>{u(a)}),[a]);return r(n,Object.assign({color:m},p&&{className:p},{isForceColor:y,onClick:()=>o(void 0,void 0,void 0,(function*(){var o;try{if(d)return;j(!0);const r=null!==(o=[...Array.from(a.matchAll(/https:\/\/streaming\.pickaxeproject\.com\/api\/function_call_results\?.*?&name=[^&]+/g)),...Array.from(a.matchAll(/https:\/\/utils\.pickaxe\.chat\/api\/fn\/result\?.*?&name=[^&]+/g))].map((o=>o[0])))&&void 0!==o?o:[],t=[];if(r.length){for(const o of r)try{const r=yield fetch(o),e=yield r.json(),c=e.text||e.url||"";t.push(c)}catch(o){console.error(o)}t.length&&u(t.join("\n"))}c(t.length>0?t.join("\n"):h),j(!1),g(!0),yield new Promise((o=>setTimeout(o,1500)))}catch(o){console.error(o)}finally{j(!1),g(!1)}}))},{children:r(d||y?i:s,{className:l("w-4 h-4 shrink-0",f)})}))};export{m as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import{useState as r,useEffect as o}from"react";import{useQuery as i}from"@tanstack/react-query";import{usePickaxeMarkdownContext as s}from"../../hooks/usePickaxeMarkdownContext.js";import a from"../common/Action.js";import n from"../Img/index.js";import c from"../common/Audio.js";import l from"../common/Html/index.js";import m from"../../../../../../common/api/utils.js";import u from"../../../../../../common/error.js";const d=({node:d,href:p="",children:f})=>{const{accentColor:h,websiteMetadatas:w,linkPreviews:b,actions:g,setWebsiteMetadatas:v}=s(),[y,j]=r("");o((()=>{if(!p)return;const e=p.startsWith("http://")?`https://${p.slice(7)}`:p.startsWith("www.")?`https://${p}`:p;e!==y&&j(e)}),[p,y]),i({queryKey:["website-metadata",y],queryFn:()=>e(void 0,void 0,void 0,(function*(){try{const r=yield(t=y,e(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield m.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=u(e);console.error("[getJobResult]",t)}return null}})));if(!r||!r.title)throw new Error("No valid metadata");return r}catch(e){return console.warn(`Failed to fetch metadata for URL: ${y}`,e),null}var t})),enabled:"undefined"!=typeof window&&b&&Boolean(y)&&!w.some((e=>e.href===y))&&y.includes(".")&&!y.includes("https://prod-pickaxe-assets")&&!y.includes("https://pickaxeproject--v2"),retry:2,onSuccess:e=>{e&&e.title&&!w.some((t=>t.href===e.href))&&v((t=>[...t,e]))}});const x=y.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(x&&(null==x?void 0:x[1]))return t("div",Object.assign({className:"pxe-markdown-youtube",style:{display:"flex",width:"100%",justifyContent:"center"}},{children:t("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${x[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(y.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/))return t(n,{src:y,alt:"string"==typeof f?f:"Markdown Image"});if(y.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/))return t(c,{url:y});return y.includes("action_generated_files")&&y.match(/\.html$/)?t(l,{url:y}):g&&y.includes("pickaxe")&&(y.includes("/api/fn/result")||y.includes("/api/function_call_results"))?t(a,{jobUrl:y}):t("a",Object.assign({href:y,target:"_blank",rel:"noopener noreferrer",style:{color:h}},{children:f}))};export{d as default};
1
+ import{__awaiter as e}from"../../../../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import{useState as r,useEffect as o}from"react";import{useQuery as i}from"@tanstack/react-query";import{usePickaxeMarkdownContext as s}from"../../hooks/usePickaxeMarkdownContext.js";import n from"../common/Action.js";import a from"../Img/index.js";import c from"../common/Audio.js";import l from"../common/Html/index.js";import m from"../../../../../../common/api/utils.js";import u from"../../../../../../common/error.js";const p=({node:p,href:d="",children:f})=>{const{accentColor:h,websiteMetadatas:w,linkPreviews:b,actions:g,setWebsiteMetadatas:j}=s(),[v,y]=r("");o((()=>{if(!d)return;const e=d.startsWith("http://")?`https://${d.slice(7)}`:d.startsWith("www.")?`https://${d}`:d;e!==v&&y(e)}),[d,v]),i({queryKey:["website-metadata",v],queryFn:()=>e(void 0,void 0,void 0,(function*(){return t=v,e(void 0,void 0,void 0,(function*(){try{if("development"===process.env.NODE_ENV&&console.log("[getWebsiteMetadata]",t),!t||!t.startsWith("https")||!t.includes("."))return null;if(["/api/fn/result","/api/function_call_results","https://prod-pickaxe-assets.s3.amazonaws.com"].some((e=>t.includes(e))))return null;const e=(yield m.get(`/metadata?url=${encodeURIComponent(t)}`)).data;if(e.error)throw new Error(e.error||"Failed to fetch metadata");return e}catch(e){if("development"===process.env.NODE_ENV){const t=u(e);console.error("[getJobResult]",t)}return null}}));var t})),enabled:"undefined"!=typeof window&&b&&Boolean(v)&&!w.some((e=>e.href===v))&&v.includes(".")&&!v.includes("https://prod-pickaxe-assets")&&!v.includes("https://pickaxeproject--v2"),retry:2,onSuccess:e=>{e&&e.title&&(w.some((t=>t.href===e.href))||j((t=>[...t,e])))}});const x=v.match(/(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(x&&(null==x?void 0:x[1]))return t("div",Object.assign({className:"pxe-markdown-youtube",style:{display:"flex",width:"100%",justifyContent:"center"}},{children:t("iframe",Object.assign({title:"youtube-embed",src:`https://www.youtube.com/embed/${x[1]}`,style:{width:"100%",maxWidth:"560px",minHeight:"315px"},allowFullScreen:!0},{children:"Iframe not supported, use a different browser."}))}));if(v.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/))return t(a,{src:v,alt:"string"==typeof f?f:"Markdown Image"});if(v.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/))return t(c,{url:v});return v.includes("action_generated_files")&&v.match(/\.html$/)?t(l,{url:v}):g&&v.includes("pickaxe")&&(v.includes("/api/fn/result")||v.includes("/api/function_call_results"))?t(n,{jobUrl:v}):t("a",Object.assign({href:v,target:"_blank",rel:"noopener noreferrer",style:{color:h}},{children:f}))};export{p as default};
@@ -1 +1 @@
1
- import{__rest as e}from"../../../../../../_virtual/_tslib.js";import{jsxs as r,jsx as a}from"react/jsx-runtime";import{Prism as l}from"react-syntax-highlighter";import{usePickaxeMarkdownContext as o}from"../../hooks/usePickaxeMarkdownContext.js";import t from"../../../PickaxeCopyButton.js";const s=s=>{var c,{node:i,children:n,className:m}=s,d=e(s,["node","children","className"]);const{syntaxTheme:h,accentColor:b}=o(),u=/language-(\w+)/.exec(m||"");return r("div",Object.assign({className:"pxe-markdown-code relative"},{children:[a("div",Object.assign({className:"absolute right-2 top-4 text-white"},{children:a(t,{color:b,text:null!==(c=null==n?void 0:n.toString())&&void 0!==c?c:"",iconClassName:"w-4 h-4"})})),a("div",Object.assign({className:"overflow-x-auto max-w-[600px] scrollbar scrollbar-thumb-black/50 scrollbar-thumb-rounded-full scrollbar-w-[4px] scrollbar-h-[4px] dark:scrollbar-thumb-black/60"},{children:a(l,Object.assign({},d,{PreTag:"div",language:u?u[1]:"js",style:h,showLineNumbers:!0},{children:String(n).replace(/\n$/,"")}))}))]}))};export{s as default};
1
+ import{__rest as e}from"../../../../../../_virtual/_tslib.js";import{jsx as r,jsxs as a}from"react/jsx-runtime";import{Prism as l}from"react-syntax-highlighter";import{usePickaxeMarkdownContext as t}from"../../hooks/usePickaxeMarkdownContext.js";import s from"../../../PickaxeCopyButton.js";const o=o=>{var i,{node:c,children:n,className:m}=o,d=e(o,["node","children","className"]);const{syntaxTheme:h}=t(),b=/language-(\w+)/.exec(m||"");return r("div",Object.assign({className:"pxe-markdown-code relative"},{children:a("div",Object.assign({className:"relative overflow-x-auto max-w-[600px] scrollbar scrollbar-thumb-black/50 scrollbar-thumb-rounded-full scrollbar-w-[4px] scrollbar-h-[4px] dark:scrollbar-thumb-black/60"},{children:[r("div",Object.assign({className:"absolute right-2 top-4 text-white"},{children:r(s,{color:"#FFFFFF",text:null!==(i=null==n?void 0:n.toString())&&void 0!==i?i:"",iconClassName:"w-4 h-4"})})),r(l,Object.assign({},d,{PreTag:"div",language:b?b[1]:"js",style:h,showLineNumbers:!0},{children:String(n).replace(/\n$/,"")}))]}))}))};export{o as default};
@@ -1 +1 @@
1
- import{__rest as o}from"../../../../../../_virtual/_tslib.js";import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeMarkdownContext as r}from"../../hooks/usePickaxeMarkdownContext.js";import{useHover as n}from"../../../../../../hooks/core/useHover.js";import{motion as s}from"framer-motion";import{getContrastColor as a}from"../../../../../../common/utils.js";import l from"../../../../../Icons/download.svg.js";import p from"../../../PickaxeCopyButton.js";import c from"./ImgModal.js";const d=({node:d,src:m,alt:x})=>{const{accentColor:b}=r(),[h,g]=t(!1),[u,y]=t(!1),f=n(),{isHover:w}=f,k=o(f,["isHover"]);return e("div",Object.assign({className:"pxe-markdown-image",style:{display:"flex",width:"100%",justifyContent:"center",overflow:"hidden",borderRadius:"8px",transition:"transform 0.3s ease, box-shadow 0.3s ease",transform:w?"translateY(-5px)":"translateY(0)"}},k,{children:[u&&i(c,{src:m,isOpen:u,onChangeIsOpen:y}),h?i("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):e("div",Object.assign({style:{position:"relative"}},{children:[e(s.div,Object.assign({initial:"hidden",animate:w?"visible":"hidden",variants:{hidden:{opacity:0,y:-10,pointerEvents:"none"},visible:{opacity:1,y:0,pointerEvents:"auto"}},style:{position:"absolute",display:"flex",gap:"0.4rem",top:"10px",right:"10px",color:"#FFF"}},{children:[i(s.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:b,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:o=>{o.stopPropagation(),window.open(m,"_blank")}},{children:i(l,{width:24,height:24,style:{color:a(b),flexShrink:0}})})),i(s.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:b,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:o=>o.stopPropagation()},{children:i(p,{color:a(b),iconClassName:"w-6 h-6",text:m||""})}))]})),i("img",{src:m,alt:x,style:{borderRadius:"8px",width:"100%",transition:"box-shadow 0.3s ease",boxShadow:w?"inset 0px 4px 10px rgba(0, 0, 0, 0.5)":"none"},onError:()=>g(!0),onClick:()=>y(!0)})]}))]}))};export{d as default};
1
+ import{__rest as o}from"../../../../../../_virtual/_tslib.js";import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeMarkdownContext as r}from"../../hooks/usePickaxeMarkdownContext.js";import{useHover as s}from"../../../../../../hooks/core/useHover.js";import{motion as n}from"framer-motion";import{getContrastColor as a}from"../../../../../../common/utils.js";import l from"../../../../../Icons/download.svg.js";import p from"../../../PickaxeCopyButton.js";import c from"./ImgModal.js";const d=({node:d,src:m,alt:b})=>{const{accentColor:x,readOnly:h}=r(),[g,u]=t(!1),[y,f]=t(!1),w=s(),{isHover:j}=w,k=o(w,["isHover"]);return e("div",Object.assign({className:"pxe-markdown-image",style:Object.assign({display:"flex",width:"100%",justifyContent:"center",overflow:"hidden",borderRadius:"8px"},!h&&{transition:"transform 0.3s ease, box-shadow 0.3s ease",transform:j?"translateY(-5px)":"translateY(0)"})},!h&&Object.assign({},k),{children:[y&&i(c,{src:m,isOpen:y,onChangeIsOpen:f}),g?i("p",Object.assign({style:{userSelect:"none",opacity:.5,fontStyle:"italic"}},{children:"[Image link is broken]"})):e("div",Object.assign({style:{position:"relative"}},{children:[!h&&e(n.div,Object.assign({initial:"hidden",animate:j?"visible":"hidden",variants:{hidden:{opacity:0,y:-10,pointerEvents:"none"},visible:{opacity:1,y:0,pointerEvents:"auto"}},style:{position:"absolute",display:"flex",gap:"0.4rem",top:"10px",right:"10px",color:"#FFF"}},{children:[i(n.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:x,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:o=>{o.stopPropagation(),window.open(m,"_blank")}},{children:i(l,{width:24,height:24,style:{color:a(x),flexShrink:0}})})),i(n.button,Object.assign({style:{outline:"none",padding:"0.5rem 0.65rem",borderRadius:"4px",boxShadow:"0px 4px 6px rgba(0, 0, 0, 0.1)",transition:"background-color 0.2s ease",backgroundColor:x,opacity:.6},whileTap:{scale:.95},whileHover:{opacity:1},onClick:o=>o.stopPropagation()},{children:i(p,{color:a(x),iconClassName:"w-6 h-6",text:m||""})}))]})),i("img",Object.assign({src:m,alt:b,style:{borderRadius:"8px",width:"100%",transition:"box-shadow 0.3s ease",boxShadow:j?"inset 0px 4px 10px rgba(0, 0, 0, 0.5)":"none"},onError:()=>u(!0)},!h&&{onClick:()=>f(!0)}))]}))]}))};export{d as default};
@@ -1 +1 @@
1
- import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsxs as r,jsx as n}from"react/jsx-runtime";import{useState as i,useRef as o,useMemo as t,useEffect as s}from"react";import{usePickaxeMarkdownContext as l}from"./hooks/usePickaxeMarkdownContext.js";import d from"react-markdown";import c from"remark-gfm";import a from"remark-math";import m from"rehype-katex";import h from"rehype-raw";import p from"./Custom/A/index.js";import f from"./Custom/P/index.js";import u from"./Custom/Img/index.js";import g from"./Custom/Iframe/index.js";import b from"./Custom/Code/index.js";import x from"./Custom/common/LinkPreview.js";import k from"../../../../common/cn.js";const j=({className:j,style:w,value:y,recursion:D=!1,children:C,maxLines:v,multiLineBreaks:O,onExpandClick:B})=>{const{theme:L,accentColor:N,websiteMetadatas:P}=l(),[E,S]=i({width:0,height:0}),I=o(null),M=t((()=>{if(!y)return"";let e=y;e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),O&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e)));const r=I.current;if(v&&r){const n=v*parseInt(window.getComputedStyle(r).lineHeight,10);if(E.height>n){const r=8,n=Math.floor(E.width/r)*v;e=e.slice(0,n)+'<span class="pxe-expand-btn">...</span>'}}return e}),[y,O,v,E]),T={h1:({node:e,children:r})=>n("h1",{children:r}),h2:({node:e,children:r})=>n("h2",{children:r}),h3:({node:e,children:r})=>n("h3",{children:r}),h4:({node:e,children:r})=>n("h4",{children:r}),h5:({node:e,children:r})=>n("h5",{children:r}),p:f,a:p,ol:({node:e,children:r})=>n("ol",{children:r}),ul:({node:e,children:r})=>n("ul",{children:r}),li:({node:e,children:r})=>n("li",{children:r}),table:({children:e})=>n("div",Object.assign({className:"pxe-markdown-table"},{children:n("table",{children:e})})),th:({node:e,children:r})=>n("th",{children:r}),tr:({node:e,children:r})=>n("tr",Object.assign({style:{border:"dark"===L?"1px solid #30363D":"1px solid #D0D7DE"}},{children:r})),td:({node:e,children:r})=>n("td",{children:r}),code:b,blockquote:({node:e,children:r})=>n("blockquote",Object.assign({style:{borderLeft:"dark"===L?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===L?"#8B8B8B":"#656D76"}},{children:r})),img:u,iframe:g,hr:()=>n("hr",{style:{border:0,borderTop:"dark"===L?"1px solid #30363D":"1px solid #D0D7DE"}}),span:r=>{var{node:i,children:o}=r,t=e(r,["node","children"]);return"pxe-expand-btn"===t.className?n("span",Object.assign({},t,{style:Object.assign({display:"inline",fontWeight:500,color:N,marginLeft:".25rem",userSelect:"none"},B&&{cursor:"pointer"})},B&&{onClick:B},{children:o})):n("span",Object.assign({},t,{children:o}))},br:()=>n("br",{})};return s((()=>{if(!I.current)return;const e=new ResizeObserver((e=>{for(const r of e){const{width:e,height:n}=r.contentRect;S({width:e,height:n})}}));return e.observe(I.current),()=>{e.disconnect()}}),[]),r("div",Object.assign({className:"pxe-markdown",ref:I,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},w)},{children:[n(d,Object.assign({className:k("pxe-prose",j),components:T,remarkPlugins:[c,a],rehypePlugins:[m,h]},{children:`${M}${!D&&P.length>0?"\n\n---":""}`})),!D&&P.length>0&&n("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"2rem",marginTop:"2rem"}},{children:P.map(((e,r)=>n(x,{data:e},r)))})),C]}))};export{j as PickaxeMarkdownRenderer};
1
+ import{__rest as e}from"../../../../_virtual/_tslib.js";import{jsxs as r,jsx as n}from"react/jsx-runtime";import{useState as i,useRef as t,useMemo as o,useEffect as s}from"react";import{usePickaxeMarkdownContext as l}from"./hooks/usePickaxeMarkdownContext.js";import d from"react-markdown";import c from"remark-gfm";import a from"remark-math";import m from"rehype-katex";import h from"rehype-raw";import p from"./Custom/A/index.js";import u from"./Custom/P/index.js";import g from"./Custom/Img/index.js";import f from"./Custom/Iframe/index.js";import b from"./Custom/Code/index.js";import x from"./Custom/common/LinkPreview.js";import k from"../../../../common/cn.js";const j=({className:j,style:w,value:y,recursion:D=!1,children:C,maxLines:v,multiLineBreaks:O,onExpandClick:$})=>{const{theme:S,accentColor:B,websiteMetadatas:L}=l(),[N,P]=i({width:0,height:0}),[E,M]=i(null),I=t(null),T=o((()=>{if(!y)return"";let e=y.trim();return e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),e=e.replace(/\\[\s\S]*?\\]/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")).replace(/\\\(\s*[\s\S]*?\s*\\\)/g,(e=>"$"+e.substring(2,e.length-2)+"$")),O&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e))),e||""}),[y,O]);s((()=>{if(!v)return void M(null);if(!I.current||!T||E)return;const e=I.current,r=parseInt(window.getComputedStyle(e).lineHeight,10),n=v*r;if(!(N.height>n))return;const i=Math.floor(N.width/8),t=Math.floor(i*v);M(T.slice(0,t)+'<span class="pxe-expand-btn">...</span>')}),[T,v,N,E]);const q={h1:({node:e,children:r})=>n("h1",{children:r}),h2:({node:e,children:r})=>n("h2",{children:r}),h3:({node:e,children:r})=>n("h3",{children:r}),h4:({node:e,children:r})=>n("h4",{children:r}),h5:({node:e,children:r})=>n("h5",{children:r}),p:u,a:p,ol:({node:e,children:r})=>n("ol",{children:r}),ul:({node:e,children:r})=>n("ul",{children:r}),li:({node:e,children:r})=>n("li",{children:r}),table:({children:e})=>n("div",Object.assign({className:"pxe-markdown-table"},{children:n("table",{children:e})})),th:({node:e,children:r})=>n("th",{children:r}),tr:({node:e,children:r})=>n("tr",Object.assign({style:{border:"dark"===S?"1px solid #30363D":"1px solid #D0D7DE"}},{children:r})),td:({node:e,children:r})=>n("td",{children:r}),code:b,blockquote:({node:e,children:r})=>n("blockquote",Object.assign({style:{borderLeft:"dark"===S?"4px solid #30363D":"4px solid #D0D7DE",color:"dark"===S?"#8B8B8B":"#656D76"}},{children:r})),img:g,iframe:f,hr:()=>n("hr",{style:{border:0,borderTop:"dark"===S?"1px solid #30363D":"1px solid #D0D7DE"}}),span:r=>{var{node:i,children:t}=r,o=e(r,["node","children"]);return"pxe-expand-btn"===o.className?n("span",Object.assign({},o,{style:Object.assign({display:"inline",fontWeight:500,color:B,marginLeft:".25rem",userSelect:"none"},$&&{cursor:"pointer"})},$&&{onClick:$},{children:t})):n("span",Object.assign({},o,{children:t}))},br:()=>n("br",{})};s((()=>{if(!I.current)return;const e=new ResizeObserver((e=>{for(const r of e){const{width:e,height:n}=r.contentRect;P({width:e,height:n})}}));return e.observe(I.current),()=>{e.disconnect()}}),[]);const R=E||T,W=!D&&L.length>0?"\n\n---":"";return r("div",Object.assign({className:"pxe-markdown",ref:I,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},w)},{children:[n(d,Object.assign({className:k("pxe-prose",j),components:q,remarkPlugins:[c,a],rehypePlugins:[m,h]},{children:`${R}${W}`})),!D&&L.length>0&&n("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"2rem",marginTop:"2rem"}},{children:L.map(((e,r)=>n(x,{data:e},r)))})),C]}))};export{j as PickaxeMarkdownRenderer};
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{createContext as e,useState as r}from"react";const t=e({}),n=({children:e,theme:n="light",syntaxTheme:a,accentColor:c="#228DD7",linkPreviews:l=!1,actions:i=!1})=>{const[s,d]=r(n),[m,p]=r(c),[C,g]=r([]),[F,h]=r(l),[u,b]=r(i);return o(t.Provider,Object.assign({value:{theme:s,syntaxTheme:a||{'code[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",width:"max-content"},'pre[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",paddingTop:"1.5em",margin:".5em 0",overflow:"auto",borderRadius:"0.3em",background:"#1d1f21",width:"max-content"},':not(pre) > code[class*="language-"]':{background:"#1d1f21",padding:".1em",borderRadius:".3em"},comment:{color:"#7C7C7C"},prolog:{color:"#7C7C7C"},doctype:{color:"#7C7C7C"},cdata:{color:"#7C7C7C"},punctuation:{color:"#c5c8c6"},".namespace":{opacity:".7"},property:{color:"#96CBFE"},keyword:{color:"#96CBFE"},tag:{color:"#96CBFE"},"class-name":{color:"#FFFFB6",textDecoration:"underline"},boolean:{color:"#99CC99"},constant:{color:"#99CC99"},symbol:{color:"#f92672"},deleted:{color:"#f92672"},number:{color:"#FF73FD"},selector:{color:"#A8FF60"},"attr-name":{color:"#A8FF60"},string:{color:"#A8FF60"},char:{color:"#A8FF60"},builtin:{color:"#A8FF60"},inserted:{color:"#A8FF60"},variable:{color:"#C6C5FE"},operator:{color:"#EDEDED"},entity:{color:"#FFFFB6",cursor:"help"},url:{color:"#96CBFE"},".language-css .token.string":{color:"#87C38A"},".style .token.string":{color:"#87C38A"},atrule:{color:"#F9EE98"},"attr-value":{color:"#F9EE98"},function:{color:"#DAD085"},regex:{color:"#E9C062"},important:{color:"#fd971f",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},accentColor:m,websiteMetadatas:C,linkPreviews:F,actions:u,setTheme:d,setAccentColor:p,setWebsiteMetadatas:g,setLinkPreviews:h,setActions:b}},{children:e}))};export{n as PickaxeMarkdown,t as PickaxeMarkdownContext,n as default};
1
+ import{jsx as o}from"react/jsx-runtime";import{createContext as e,useState as r}from"react";const n=e({}),t=({children:e,theme:t="light",syntaxTheme:a,accentColor:c="#228DD7",linkPreviews:l=!1,actions:i=!1,readOnly:s=!1})=>{const[d,m]=r(t),[p,C]=r(c),[g,F]=r([]),[h,u]=r(l),[b,y]=r(i);return o(n.Provider,Object.assign({value:{theme:d,syntaxTheme:a||{'code[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",width:"max-content"},'pre[class*="language-"]':{color:"#c5c8c6",textShadow:"0 1px rgba(0, 0, 0, 0.3)",fontFamily:"Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",direction:"ltr",textAlign:"left",whiteSpace:"pre",wordSpacing:"normal",wordBreak:"normal",lineHeight:"1.5",MozTabSize:"4",OTabSize:"4",tabSize:"4",WebkitHyphens:"none",MozHyphens:"none",msHyphens:"none",hyphens:"none",padding:"1em",paddingTop:"1.5em",margin:".5em 0",overflow:"auto",borderRadius:"0.3em",background:"#1d1f21",width:"max-content"},':not(pre) > code[class*="language-"]':{background:"#1d1f21",padding:".1em",borderRadius:".3em"},comment:{color:"#7C7C7C"},prolog:{color:"#7C7C7C"},doctype:{color:"#7C7C7C"},cdata:{color:"#7C7C7C"},punctuation:{color:"#c5c8c6"},".namespace":{opacity:".7"},property:{color:"#96CBFE"},keyword:{color:"#96CBFE"},tag:{color:"#96CBFE"},"class-name":{color:"#FFFFB6",textDecoration:"underline"},boolean:{color:"#99CC99"},constant:{color:"#99CC99"},symbol:{color:"#f92672"},deleted:{color:"#f92672"},number:{color:"#FF73FD"},selector:{color:"#A8FF60"},"attr-name":{color:"#A8FF60"},string:{color:"#A8FF60"},char:{color:"#A8FF60"},builtin:{color:"#A8FF60"},inserted:{color:"#A8FF60"},variable:{color:"#C6C5FE"},operator:{color:"#EDEDED"},entity:{color:"#FFFFB6",cursor:"help"},url:{color:"#96CBFE"},".language-css .token.string":{color:"#87C38A"},".style .token.string":{color:"#87C38A"},atrule:{color:"#F9EE98"},"attr-value":{color:"#F9EE98"},function:{color:"#DAD085"},regex:{color:"#E9C062"},important:{color:"#fd971f",fontWeight:"bold"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"}},accentColor:p,websiteMetadatas:g,linkPreviews:h,actions:b,readOnly:s,setTheme:m,setAccentColor:C,setWebsiteMetadatas:F,setLinkPreviews:u,setActions:y}},{children:e}))};export{t as PickaxeMarkdown,n as PickaxeMarkdownContext,t as default};
@@ -1 +1 @@
1
- import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as r}from"react/jsx-runtime";import{useHover as t}from"../../../hooks/core/useHover.js";import e from"../../../common/cn.js";const s=({color:s,children:i,className:n,isForceColor:c,onClick:l})=>{const a=t(),{isHover:m}=a,u=o(a,["isHover"]);return r("button",Object.assign({className:e("flex items-center gap-1 outline-none transition-all duration-300 ease-in-out",n)},(m||c)&&{style:{color:s}},l&&{onClick:o=>{o.stopPropagation(),l()}},u,{children:i}))};export{s as default};
1
+ import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as r}from"react/jsx-runtime";import{useHover as t}from"../../../hooks/core/useHover.js";import e from"../../../common/cn.js";const s=({color:s,children:i,className:n,isForceColor:c,onClick:l})=>{const a=t(),{isHover:m}=a,u=o(a,["isHover"]);return r("button",Object.assign({className:e("flex items-center gap-1 outline-none transition-colors duration-300 ease-in-out",n)},(m||c)&&{style:{color:s}},l&&{onClick:o=>{o.stopPropagation(),l()}},u,{children:i}))};export{s as default};
@@ -1 +1 @@
1
- .pxe-prose p{font-weight:350;margin-bottom:.75rem}.pxe-prose a{font-weight:600;text-decoration:underline;text-underline-offset:.2rem}.pxe-prose iframe{margin-bottom:1.5rem}.pxe-prose blockquote{margin-bottom:2.5rem;padding-bottom:.25rem;padding-left:1rem;padding-top:.25rem}.pxe-prose hr{margin-bottom:1.5rem}.pxe-prose .pxe-markdown-code,.pxe-prose .pxe-markdown-image,.pxe-prose .pxe-markdown-youtube{margin-bottom:2.5rem}.pxe-prose ol{list-style-type:decimal}.pxe-prose ol,.pxe-prose ul{list-style-position:inside;margin-bottom:1.5rem;padding-left:1rem}.pxe-prose ul{list-style-type:disc}.pxe-prose li{margin:10px}.pxe-prose li>p{display:inline}.pxe-prose .pxe-markdown-table{margin-bottom:2.5rem;overflow:auto;position:relative}.pxe-prose table{font-size:.875rem;line-height:1.24rem;table-layout:fixed}.pxe-prose th{font-weight:600;text-align:left}.pxe-prose td,.pxe-prose th{padding:.75em 1em}.pxe-prose h1{font-size:2.25rem;line-height:2.5rem;margin-bottom:1.5rem}.pxe-prose h2{font-size:1.875rem;line-height:2.25rem;margin-bottom:1.5rem}.pxe-prose h3{font-size:1.5rem;line-height:2rem;margin-bottom:1.5rem}.pxe-prose h4{font-size:1.25rem}.pxe-prose h4,.pxe-prose h5{line-height:1.75rem;margin-bottom:1rem}.pxe-prose h5{font-size:1.125rem}.pxe-prose h2:not(:first-child),.pxe-prose h3:not(:first-child),.pxe-prose h4:not(:first-child),.pxe-prose h5:not(:first-child),.pxe-prose>p:not(:first-child) .pxe-markdown-image,.pxe-prose>p:not(:first-child) .pxe-markdown-youtube,.pxe-prose>pre:not(:first-child){margin-top:2.5rem}
1
+ .pxe-prose p{font-weight:350}.pxe-prose p:not(:only-child){margin-bottom:.75rem}.pxe-prose a{font-weight:600;text-decoration:underline;text-underline-offset:.2rem}.pxe-prose iframe{margin-bottom:1.5rem}.pxe-prose blockquote{margin-bottom:2.5rem;padding-bottom:.25rem;padding-left:1rem;padding-top:.25rem}.pxe-prose hr{margin-bottom:1.5rem}.pxe-prose .pxe-markdown-code,.pxe-prose .pxe-markdown-image,.pxe-prose .pxe-markdown-youtube{margin-bottom:2.5rem}.pxe-prose .pxe-action{margin-top:1rem}.pxe-prose ol{list-style-type:decimal}.pxe-prose ol,.pxe-prose ul{list-style-position:inside;margin-bottom:1.5rem;padding-left:1rem}.pxe-prose ul{list-style-type:disc}.pxe-prose li{margin:10px}.pxe-prose li>p{display:inline}.pxe-prose .pxe-markdown-table{margin-bottom:2.5rem;overflow:auto;position:relative}.pxe-prose table{font-size:.875rem;line-height:1.24rem;table-layout:fixed}.pxe-prose th{font-weight:600;text-align:left}.pxe-prose td,.pxe-prose th{padding:.75em 1em}.pxe-prose h1{font-size:2.25rem;line-height:2.5rem;margin-bottom:1.5rem}.pxe-prose h2{font-size:1.875rem;line-height:2.25rem;margin-bottom:1.5rem}.pxe-prose h3{font-size:1.5rem;line-height:2rem;margin-bottom:1.5rem}.pxe-prose h4{font-size:1.25rem}.pxe-prose h4,.pxe-prose h5{line-height:1.75rem;margin-bottom:1rem}.pxe-prose h5{font-size:1.125rem}.pxe-prose h2:not(:first-child),.pxe-prose h3:not(:first-child),.pxe-prose h4:not(:first-child),.pxe-prose h5:not(:first-child),.pxe-prose>p:not(:first-child) .pxe-markdown-image,.pxe-prose>p:not(:first-child) .pxe-markdown-youtube,.pxe-prose>pre:not(:first-child){margin-top:2.5rem}
@@ -6,6 +6,7 @@ export declare const usePickaxeMarkdownContext: () => {
6
6
  websiteMetadatas: import("..").WebsiteMetadata[];
7
7
  linkPreviews: boolean;
8
8
  actions: boolean;
9
+ readOnly: boolean;
9
10
  setTheme: import("../../../../../types/common").SetState<import("..").PickaxeMarkdownTheme>;
10
11
  setAccentColor: import("../../../../../types/common").SetState<string>;
11
12
  setWebsiteMetadatas: import("../../../../../types/common").SetState<import("..").WebsiteMetadata[]>;
@@ -14,6 +14,7 @@ type PickaxeMarkdownContextType = {
14
14
  websiteMetadatas: WebsiteMetadata[];
15
15
  linkPreviews: boolean;
16
16
  actions: boolean;
17
+ readOnly: boolean;
17
18
  setTheme: SetState<PickaxeMarkdownTheme>;
18
19
  setAccentColor: SetState<string>;
19
20
  setWebsiteMetadatas: SetState<WebsiteMetadata[]>;
@@ -27,7 +28,8 @@ export interface PickaxeMarkdownProps {
27
28
  accentColor?: string;
28
29
  linkPreviews?: boolean;
29
30
  actions?: boolean;
31
+ readOnly?: boolean;
30
32
  }
31
33
  export declare const PickaxeMarkdownContext: import("react").Context<PickaxeMarkdownContextType>;
32
- export declare const PickaxeMarkdown: ({ children, theme: _theme, syntaxTheme, accentColor: _accentColor, linkPreviews: _linkPreviews, actions: _actions, }: PickaxeMarkdownProps) => import("react/jsx-runtime").JSX.Element;
34
+ export declare const PickaxeMarkdown: ({ children, theme: _theme, syntaxTheme, accentColor: _accentColor, linkPreviews: _linkPreviews, actions: _actions, readOnly, }: PickaxeMarkdownProps) => import("react/jsx-runtime").JSX.Element;
33
35
  export default PickaxeMarkdown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickaxeproject/react",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Client utility library for Pickaxe",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1 +0,0 @@
1
- "use strict";function e(e){if(e&&e.__esModule)return e;var r=Object.create(null);return e&&Object.keys(e).forEach((function(t){if("default"!==t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})}})),r.default=e,Object.freeze(r)}Object.defineProperty(exports,"__esModule",{value:!0});var r,t,n=e(require("react"));function o(){return o=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)({}).hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},o.apply(null,arguments)}var a=e=>n.createElement("svg",o({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},e),r||(r=n.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 9h-9a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2"})),t||(t=n.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1M18.5 13.25l-4.125 4.125L12.5 15.5"})));exports.default=a;
@@ -1 +0,0 @@
1
- "use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n.apply(null,arguments)}var a=e=>r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18"},e),t||(t=r.createElement("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,clipPath:"url(#copy_svg__clip0_1255_17924)"},r.createElement("path",{d:"M15 6.75H8.25a1.5 1.5 0 0 0-1.5 1.5V15a1.5 1.5 0 0 0 1.5 1.5H15a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5"}),r.createElement("path",{d:"M3.75 11.25H3a1.5 1.5 0 0 1-1.5-1.5V3A1.5 1.5 0 0 1 3 1.5h6.75a1.5 1.5 0 0 1 1.5 1.5v.75"}))));exports.default=a;
@@ -1 +0,0 @@
1
- import*as r from"react";var e,t;function n(){return n=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(r[n]=t[n])}return r},n.apply(null,arguments)}var o=o=>r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},o),e||(e=r.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M20 9h-9a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-9a2 2 0 0 0-2-2"})),t||(t=r.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1M18.5 13.25l-4.125 4.125L12.5 15.5"})));export{o as default};
@@ -1 +0,0 @@
1
- import*as e from"react";var r;function t(){return t=Object.assign?Object.assign.bind():function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var a in t)({}).hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},t.apply(null,arguments)}var a=a=>e.createElement("svg",t({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18"},a),r||(r=e.createElement("g",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,clipPath:"url(#copy_svg__clip0_1255_17924)"},e.createElement("path",{d:"M15 6.75H8.25a1.5 1.5 0 0 0-1.5 1.5V15a1.5 1.5 0 0 0 1.5 1.5H15a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5"}),e.createElement("path",{d:"M3.75 11.25H3a1.5 1.5 0 0 1-1.5-1.5V3A1.5 1.5 0 0 1 3 1.5h6.75a1.5 1.5 0 0 1 1.5 1.5v.75"}))));export{a as default};